summaryrefslogtreecommitdiff
path: root/src/plugins/geoservices/osm/qgeotileproviderosm.cpp
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2017-02-10 19:05:56 +0100
committerPaolo Angelelli <paolo.angelelli@qt.io>2017-02-28 11:09:56 +0000
commitba2a82b7db86d96fc1f110b4bbc88408f47a5774 (patch)
tree66bb4e03d6cff164cac4161b4363e3444a78ad23 /src/plugins/geoservices/osm/qgeotileproviderosm.cpp
parent11e6a62957433843816b41ad11fada7ca8eab85c (diff)
downloadqtlocation-ba2a82b7db86d96fc1f110b4bbc88408f47a5774.tar.gz
Make QGeoCameraCapabilities independent of the engine
This patch makes it possible to change QGeoCameraCapabilites at runtime, when the map type changes, to accommodate for those plugins that offer different maps having different capabilities. This is then used to properly push the min/max zoom levels for each map type in our OSM plugin. Autotests are included. Change-Id: I48532da77ffb3eaf2e752561395945c3a2c21985 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/plugins/geoservices/osm/qgeotileproviderosm.cpp')
-rw-r--r--src/plugins/geoservices/osm/qgeotileproviderosm.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/plugins/geoservices/osm/qgeotileproviderosm.cpp b/src/plugins/geoservices/osm/qgeotileproviderosm.cpp
index 1989c44f..1b48401c 100644
--- a/src/plugins/geoservices/osm/qgeotileproviderosm.cpp
+++ b/src/plugins/geoservices/osm/qgeotileproviderosm.cpp
@@ -47,8 +47,9 @@ static const QDateTime defaultTs = QDateTime::fromString(QStringLiteral("2016-06
QGeoTileProviderOsm::QGeoTileProviderOsm(QNetworkAccessManager *nm,
const QGeoMapType &mapType,
- const QVector<TileProvider *> &providers)
-: m_nm(nm), m_provider(nullptr), m_mapType(mapType), m_status(Idle)
+ const QVector<TileProvider *> &providers,
+ const QGeoCameraCapabilities &cameraCapabilities)
+: m_nm(nm), m_provider(nullptr), m_mapType(mapType), m_status(Idle), m_cameraCapabilities(cameraCapabilities)
{
for (int i = 0; i < providers.size(); ++i) {
TileProvider *p = providers[i];
@@ -59,6 +60,8 @@ QGeoTileProviderOsm::QGeoTileProviderOsm(QNetworkAccessManager *nm,
if (!m_provider || m_provider->isValid())
m_status = Resolved;
+
+ connect(this, &QGeoTileProviderOsm::resolutionFinished, this, &QGeoTileProviderOsm::updateCameraCapabilities);
}
QGeoTileProviderOsm::~QGeoTileProviderOsm()
@@ -128,6 +131,11 @@ const QDateTime QGeoTileProviderOsm::timestamp() const
return m_provider->timestamp();
}
+QGeoCameraCapabilities QGeoTileProviderOsm::cameraCapabilities() const
+{
+ return m_cameraCapabilities;
+}
+
const QGeoMapType &QGeoTileProviderOsm::mapType() const
{
return m_mapType;
@@ -220,6 +228,15 @@ void QGeoTileProviderOsm::onResolutionError(TileProvider *provider)
}
}
+void QGeoTileProviderOsm::updateCameraCapabilities()
+{
+ // Set proper min/max ZoomLevel coming from the json, if available.
+ m_cameraCapabilities.setMinimumZoomLevel(minimumZoomLevel());
+ m_cameraCapabilities.setMaximumZoomLevel(maximumZoomLevel());
+
+ // Pushing the change
+}
+
void QGeoTileProviderOsm::addProvider(TileProvider *provider)
{
if (!provider)