summaryrefslogtreecommitdiff
path: root/src/imports/location/qdeclarativegeomap.cpp
diff options
context:
space:
mode:
authorDavid Laing <david.laing@nokia.com>2012-02-08 09:06:55 +1000
committerQt by Nokia <qt-info@nokia.com>2012-02-16 07:19:19 +0100
commitcdb80baa8386d11a0cbab8423ea956ae2393672f (patch)
treeb6679498ff4082d33ef1a0f7d8fd62d735bda5bd /src/imports/location/qdeclarativegeomap.cpp
parent3288e355c1d96cd3ac70b0dc9a88ad73f2d94517 (diff)
downloadqtlocation-cdb80baa8386d11a0cbab8423ea956ae2393672f.tar.gz
Adds the camera capabilities class.
This class unifies access to the data related to what the valid range of camera parameters are for a given map plugin. Change-Id: I681eba4a8e1c1cbd34995ed1e97064ab194b1e40 Reviewed-by: Alex Wilson <alex.wilson@nokia.com>
Diffstat (limited to 'src/imports/location/qdeclarativegeomap.cpp')
-rw-r--r--src/imports/location/qdeclarativegeomap.cpp36
1 files changed, 22 insertions, 14 deletions
diff --git a/src/imports/location/qdeclarativegeomap.cpp b/src/imports/location/qdeclarativegeomap.cpp
index b9e8bf34..6d9eeb7e 100644
--- a/src/imports/location/qdeclarativegeomap.cpp
+++ b/src/imports/location/qdeclarativegeomap.cpp
@@ -51,6 +51,7 @@
#include "qgeotilecache_p.h"
#include "qgeocameradata_p.h"
+#include "qgeocameracapabilities_p.h"
#include "qgeomapcontroller_p.h"
#include "mapnode_p.h"
#include <cmath>
@@ -231,8 +232,6 @@ void QDeclarativeGeoMap::pluginReady()
return;
}
- pinchArea_->zoomLevelLimits(mappingManager_->minimumZoomLevel(), mappingManager_->maximumZoomLevel());
-
if (!mappingManager_->isInitialized())
connect(mappingManager_, SIGNAL(initialized()), this, SLOT(mappingManagerInitialized()));
else
@@ -449,10 +448,15 @@ void QDeclarativeGeoMap::setPlugin(QDeclarativeGeoServiceProvider *plugin)
void QDeclarativeGeoMap::mappingManagerInitialized()
{
mappingManagerInitialized_ = true;
- if (zoomLevel_ < mappingManager_->minimumZoomLevel())
- setZoomLevel(mappingManager_->minimumZoomLevel());
- else if (zoomLevel_ > mappingManager_->maximumZoomLevel())
- setZoomLevel(mappingManager_->maximumZoomLevel());
+
+ pinchArea_->zoomLevelLimits(mappingManager_->cameraCapabilities().minimumZoomLevel(),
+ mappingManager_->cameraCapabilities().maximumZoomLevel());
+
+ QGeoCameraCapabilities capabilities = mappingManager_->cameraCapabilities();
+ if (zoomLevel_ < capabilities.minimumZoomLevel())
+ setZoomLevel(capabilities.minimumZoomLevel());
+ else if (zoomLevel_ > capabilities.maximumZoomLevel())
+ setZoomLevel(capabilities.maximumZoomLevel());
connect(map_,
SIGNAL(updateRequired()),
this,
@@ -524,8 +528,8 @@ QDeclarativeGeoServiceProvider* QDeclarativeGeoMap::plugin() const
qreal QDeclarativeGeoMap::minimumZoomLevel() const
{
- if (mappingManager_)
- return mappingManager_->minimumZoomLevel();
+ if (mappingManager_ && mappingManagerInitialized_)
+ return mappingManager_->cameraCapabilities().minimumZoomLevel();
else
return -1.0;
}
@@ -541,8 +545,8 @@ qreal QDeclarativeGeoMap::minimumZoomLevel() const
qreal QDeclarativeGeoMap::maximumZoomLevel() const
{
- if (mappingManager_)
- return mappingManager_->maximumZoomLevel();
+ if (mappingManager_ && mappingManagerInitialized_)
+ return mappingManager_->cameraCapabilities().maximumZoomLevel();
else
return -1.0;
}
@@ -621,11 +625,15 @@ void QDeclarativeGeoMap::setZoomLevel(qreal zoomLevel)
{
if (zoomLevel_ == zoomLevel || zoomLevel < 0)
return;
- if (mappingManagerInitialized_ &&
- (zoomLevel < mappingManager_->minimumZoomLevel() ||
- zoomLevel > mappingManager_->maximumZoomLevel())) {
- return;
+
+ if (mappingManagerInitialized_) {
+ QGeoCameraCapabilities capabilities = mappingManager_->cameraCapabilities();
+ if ((zoomLevel < capabilities.minimumZoomLevel() ||
+ zoomLevel > capabilities.maximumZoomLevel())) {
+ return;
+ }
}
+
zoomLevel_ = zoomLevel;
if (mappingManagerInitialized_)
map_->mapController()->setZoom(zoomLevel_);