diff options
author | Paolo Angelelli <paolo.angelelli@qt.io> | 2017-04-07 13:40:19 +0200 |
---|---|---|
committer | Paolo Angelelli <paolo.angelelli@qt.io> | 2017-04-12 13:30:59 +0000 |
commit | e81ba34a98b259723e783e2d2df4321309992291 (patch) | |
tree | 4b8263cf08657d31fbfc7fed40b8824a91c24d52 /src/location/maps | |
parent | 15ceb0279c46e286116a93b61f442de0105fcd0c (diff) | |
download | qtlocation-e81ba34a98b259723e783e2d2df4321309992291.tar.gz |
Allow overzooming when setting zoomLevel directly in a Map
This patch moves the lower/upper bound check on setZoom from
QDeclarativeGeoMap to the gesture area, allowing to set higher zoom
levels than the maximumZoomLevel when setting Map.zoomLevel directly,
for the map types that support overzoom.
This is now safe as the bound check is introduced in the tile fetcher,
so no invalid tiles will be requested, and is beneficial when
combining layers supporting different maximum zoom levels.
Change-Id: I08ee9c282ee2ebc1dafa3c68a238b93ffbc1ba02
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/location/maps')
-rw-r--r-- | src/location/maps/qgeocameracapabilities.cpp | 32 | ||||
-rw-r--r-- | src/location/maps/qgeocameracapabilities_p.h | 3 |
2 files changed, 32 insertions, 3 deletions
diff --git a/src/location/maps/qgeocameracapabilities.cpp b/src/location/maps/qgeocameracapabilities.cpp index f9eecbf8..d5a2f11e 100644 --- a/src/location/maps/qgeocameracapabilities.cpp +++ b/src/location/maps/qgeocameracapabilities.cpp @@ -74,6 +74,7 @@ public: int tileSize_; double minimumFieldOfView_; double maximumFieldOfView_; + bool overzoomEnabled_; }; QGeoCameraCapabilitiesPrivate::QGeoCameraCapabilitiesPrivate() @@ -87,7 +88,8 @@ QGeoCameraCapabilitiesPrivate::QGeoCameraCapabilitiesPrivate() maxTilt_(0.0), tileSize_(256), minimumFieldOfView_(45.0), // Defaulting to a fixed FOV of 45 degrees. Too large FOVs cause the loading of too many tiles - maximumFieldOfView_(45.0) {} + maximumFieldOfView_(45.0), + overzoomEnabled_(false) {} QGeoCameraCapabilitiesPrivate::QGeoCameraCapabilitiesPrivate(const QGeoCameraCapabilitiesPrivate &other) @@ -102,7 +104,8 @@ QGeoCameraCapabilitiesPrivate::QGeoCameraCapabilitiesPrivate(const QGeoCameraCap maxTilt_(other.maxTilt_), tileSize_(other.tileSize_), minimumFieldOfView_(other.minimumFieldOfView_), - maximumFieldOfView_(other.maximumFieldOfView_) {} + maximumFieldOfView_(other.maximumFieldOfView_), + overzoomEnabled_(other.overzoomEnabled_){} QGeoCameraCapabilitiesPrivate::~QGeoCameraCapabilitiesPrivate() {} @@ -123,6 +126,7 @@ QGeoCameraCapabilitiesPrivate &QGeoCameraCapabilitiesPrivate::operator = (const tileSize_ = other.tileSize_; minimumFieldOfView_ = other.minimumFieldOfView_; maximumFieldOfView_ = other.maximumFieldOfView_; + overzoomEnabled_ = other.overzoomEnabled_; return *this; } @@ -139,7 +143,8 @@ bool QGeoCameraCapabilitiesPrivate::operator == (const QGeoCameraCapabilitiesPri && (maxTilt_ == rhs.maxTilt_) && (tileSize_ == rhs.tileSize_) && (minimumFieldOfView_ == rhs.minimumFieldOfView_) - && (maximumFieldOfView_ == rhs.maximumFieldOfView_)); + && (maximumFieldOfView_ == rhs.maximumFieldOfView_) + && (overzoomEnabled_ == rhs.overzoomEnabled_)); } /*! @@ -430,5 +435,26 @@ double QGeoCameraCapabilities::maximumFieldOfView() const return d->maximumFieldOfView_; } +/*! + Sets whether overzooming is supported by the associated plugin. + + \since 5.9 +*/ +void QGeoCameraCapabilities::setOverzoomEnabled(bool overzoomEnabled) +{ + d->overzoomEnabled_ = overzoomEnabled; + d->valid_ = true; +} + +/*! + Returns whether overzooming is supported by the associated plugin. + + \since 5.9 +*/ +bool QGeoCameraCapabilities::overzoomEnabled() const +{ + return d->overzoomEnabled_; +} + QT_END_NAMESPACE diff --git a/src/location/maps/qgeocameracapabilities_p.h b/src/location/maps/qgeocameracapabilities_p.h index 099ad76d..d0f69229 100644 --- a/src/location/maps/qgeocameracapabilities_p.h +++ b/src/location/maps/qgeocameracapabilities_p.h @@ -100,6 +100,9 @@ public: void setMaximumFieldOfView(double maximumFieldOfView); double maximumFieldOfView() const; + void setOverzoomEnabled(bool overzoomEnabled); + bool overzoomEnabled() const; + bool isValid() const; private: |