summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <[email protected]>2015-10-17 22:01:31 +0200
committerDennis Nienhüser <[email protected]>2015-10-17 22:01:31 +0200
commit34eba7e8f0432d1ae8f13fe5cca771d074d8e1e9 (patch)
treed8c9e6b5dbbcfa73ff749cab7fd2b5c9f8a5f13e
parentd47fddb03812cc93a4ceca1acdabc78ed05167b8 (diff)
Fix discrete tile level calculation
-rw-r--r--src/lib/marble/VectorTileModel.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/lib/marble/VectorTileModel.cpp b/src/lib/marble/VectorTileModel.cpp
index 354c406..17ec62b 100644
--- a/src/lib/marble/VectorTileModel.cpp
+++ b/src/lib/marble/VectorTileModel.cpp
@@ -89,11 +89,14 @@ void VectorTileModel::setViewport( const GeoDataLatLonBox &bbox, int radius )
QVector<int> tileLevels = m_layer->tileLevels();
- auto iter = qLowerBound(tileLevels, tileZoomLevel);
- if (*iter != tileZoomLevel && iter != tileLevels.begin()) {
- --iter;
- tileZoomLevel = *iter;
+ int tileLevel = tileLevels.isEmpty() ? 0 : tileLevels.first();
+ for (int i=1, n=tileLevels.size(); i<n; ++i) {
+ if (tileLevels[i] > tileZoomLevel) {
+ break;
+ }
+ tileLevel = tileLevels[i];
}
+ tileZoomLevel = tileLevel;
// if zoom level has changed, empty vectortile cache
if ( tileZoomLevel != m_tileZoomLevel ) {