summaryrefslogtreecommitdiff
path: root/src/location/maps/qgeotiledmap.cpp
diff options
context:
space:
mode:
authorAaron McCarthy <aaron.mccarthy@jollamobile.com>2015-06-24 11:38:44 +1000
committerMichal Klocek <michal.klocek@theqtcompany.com>2016-02-09 13:58:49 +0000
commit48651de4a7a11b7bd348487df6eb68f258ed3c6a (patch)
treea9d3f780e902a81b3c2a83f5c52bb28da3b4c0b1 /src/location/maps/qgeotiledmap.cpp
parent5fd9681a3563e2346c722bcd779e2b16cd4ac9fd (diff)
downloadqtlocation-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/location/maps/qgeotiledmap.cpp')
-rw-r--r--src/location/maps/qgeotiledmap.cpp5
1 files changed, 3 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);