summaryrefslogtreecommitdiff
path: root/src/location/maps/qgeocameratiles.cpp
diff options
context:
space:
mode:
authorAnders Gunnarsson <anders.gunnarsson@appello.com>2014-02-12 09:01:03 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-03 16:08:00 +0100
commit61d235c2f5af88a0a22105722142f2c72817ee00 (patch)
treed310f0c75bc939589bdc9f20e28b824f63ac58f2 /src/location/maps/qgeocameratiles.cpp
parent985a8b9c608503d90b7fe73f5a995ad2091f0070 (diff)
downloadqtlocation-61d235c2f5af88a0a22105722142f2c72817ee00.tar.gz
Tile cache versioning for Nokia maps
Added to avoid mixing of different map versions in map view. Generic cache versioning by adding an incremental version number to tile specs and filenames. Default version -1 falls back to not using version in file names for backward compatibility. Nokia specific version management by implementing the version request, comparing all version information and increment the version if anything has changed. Task-number: QTBUG-25559 Change-Id: I6820f2efbe7458701475cc833d3077022797b2df Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Diffstat (limited to 'src/location/maps/qgeocameratiles.cpp')
-rw-r--r--src/location/maps/qgeocameratiles.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/location/maps/qgeocameratiles.cpp b/src/location/maps/qgeocameratiles.cpp
index 32bbae36..0d5a5626 100644
--- a/src/location/maps/qgeocameratiles.cpp
+++ b/src/location/maps/qgeocameratiles.cpp
@@ -85,6 +85,7 @@ public:
QString pluginString_;
QGeoMapType mapType_;
+ int mapVersion_;
QGeoCameraData camera_;
QSize screenSize_;
int tileSize_;
@@ -245,6 +246,17 @@ void QGeoCameraTiles::setMapType(const QGeoMapType &mapType)
d->updateMetadata();
}
+void QGeoCameraTiles::setMapVersion(const int mapVersion)
+{
+ Q_D(QGeoCameraTiles);
+
+ if (d->mapVersion_ == mapVersion)
+ return;
+
+ d->mapVersion_ = mapVersion;
+ d->updateMetadata();
+}
+
void QGeoCameraTiles::setTileSize(int tileSize)
{
Q_D(QGeoCameraTiles);
@@ -285,7 +297,8 @@ QGeoCameraTilesPrivate::QGeoCameraTilesPrivate()
: tileSize_(0),
maxZoom_(0),
intZoomLevel_(0),
- sideLength_(0) {}
+ sideLength_(0),
+ mapVersion_(-1) {}
QGeoCameraTilesPrivate::~QGeoCameraTilesPrivate() {}
@@ -300,7 +313,7 @@ void QGeoCameraTilesPrivate::updateMetadata()
for (; i != end; ++i) {
QGeoTileSpec tile = *i;
- newTiles.insert(QGeoTileSpec(pluginString_, mapType_.mapId(), tile.zoom(), tile.x(), tile.y()));
+ newTiles.insert(QGeoTileSpec(pluginString_, mapType_.mapId(), tile.zoom(), tile.x(), tile.y(), mapVersion_));
}
tiles_ = newTiles;
@@ -988,7 +1001,7 @@ QSet<QGeoTileSpec> QGeoCameraTilesPrivate::tilesFromPolygon(const Polygon &polyg
int minX = i->first;
int maxX = i->second;
for (int x = minX; x <= maxX; ++x) {
- results.insert(QGeoTileSpec(pluginString_, mapType_.mapId(), z, x, y));
+ results.insert(QGeoTileSpec(pluginString_, mapType_.mapId(), z, x, y, mapVersion_));
}
}