diff options
author | Aaron McCarthy <aaron.mccarthy@jollamobile.com> | 2015-06-24 11:38:44 +1000 |
---|---|---|
committer | Michal Klocek <michal.klocek@theqtcompany.com> | 2016-02-09 13:58:49 +0000 |
commit | 48651de4a7a11b7bd348487df6eb68f258ed3c6a (patch) | |
tree | a9d3f780e902a81b3c2a83f5c52bb28da3b4c0b1 /src | |
parent | 5fd9681a3563e2346c722bcd779e2b16cd4ac9fd (diff) | |
download | qtlocation-48651de4a7a11b7bd348487df6eb68f258ed3c6a.tar.gz |
Don't request invalid tiles from provider when prefetching
The tile prefetching code assumes that the minimum zoom is 0 for all
providers. Remove this assumption and use the actual minimum zoom
level.
Change-Id: Ifcde130eea5d4f9f0bb5449b804943eadd75512b
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/location/maps/qgeotiledmap.cpp | 5 | ||||
-rw-r--r-- | src/location/maps/qgeotiledmap_p_p.h | 1 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/location/maps/qgeotiledmap.cpp b/src/location/maps/qgeotiledmap.cpp index 7a56c548..7ca1a5ff 100644 --- a/src/location/maps/qgeotiledmap.cpp +++ b/src/location/maps/qgeotiledmap.cpp @@ -169,6 +169,7 @@ QGeoTiledMapPrivate::QGeoTiledMapPrivate(QGeoTiledMappingManagerEngine *engine) m_mapScene(new QGeoMapScene()), m_tileRequests(0), m_maxZoomLevel(static_cast<int>(std::ceil(engine->cameraCapabilities().maximumZoomLevel()))), + m_minZoomLevel(static_cast<int>(std::ceil(engine->cameraCapabilities().minimumZoomLevel()))), m_prefetchStyle(QGeoTiledMap::PrefetchTwoNeighbourLayers) { int tileSize = engine->tileSize().width(); @@ -210,7 +211,7 @@ void QGeoTiledMapPrivate::prefetchTiles() case QGeoTiledMap::PrefetchNeighbourLayer: { double zoomFraction = camera.zoomLevel() - currentIntZoom; int nearestNeighbourLayer = zoomFraction > 0.5 ? currentIntZoom + 1 : currentIntZoom - 1; - if (nearestNeighbourLayer <= m_maxZoomLevel && nearestNeighbourLayer >= 0) { + if (nearestNeighbourLayer <= m_maxZoomLevel && nearestNeighbourLayer >= m_minZoomLevel) { camera.setZoomLevel(nearestNeighbourLayer); // Approx heuristic, keeping total # prefetched tiles roughly independent of the // fractional zoom level. @@ -225,7 +226,7 @@ void QGeoTiledMapPrivate::prefetchTiles() case QGeoTiledMap::PrefetchTwoNeighbourLayers: { // This is a simpler strategy, we just prefetch from layer above and below // for the layer below we only use half the size as this fills the screen - if (currentIntZoom > 0) { + if (currentIntZoom > m_minZoomLevel) { camera.setZoomLevel(currentIntZoom - 1); m_prefetchTiles->setCameraData(camera); m_prefetchTiles->setViewExpansion(0.5); diff --git a/src/location/maps/qgeotiledmap_p_p.h b/src/location/maps/qgeotiledmap_p_p.h index 15442bd1..6f8be328 100644 --- a/src/location/maps/qgeotiledmap_p_p.h +++ b/src/location/maps/qgeotiledmap_p_p.h @@ -98,6 +98,7 @@ private: QGeoMapScene *m_mapScene; QGeoTileRequestManager *m_tileRequests; int m_maxZoomLevel; + int m_minZoomLevel; QGeoTiledMap::PrefetchStyle m_prefetchStyle; Q_DISABLE_COPY(QGeoTiledMapPrivate) }; |