diff options
author | Paolo Angelelli <paolo.angelelli@theqtcompany.com> | 2016-09-15 23:12:42 +0200 |
---|---|---|
committer | Paolo Angelelli <paolo.angelelli@qt.io> | 2016-10-05 11:30:12 +0000 |
commit | 218e208bbf1c3112d2ea5781debc605fc76db80a (patch) | |
tree | 34812fb7c66e401bc288d4916ec6fed58d443022 /src/plugins/geoservices/osm/qgeofiletilecacheosm.h | |
parent | a65d9b7acf62fdafd670b40c01425cedff61106c (diff) | |
download | qtlocation-218e208bbf1c3112d2ea5781debc605fc76db80a.tar.gz |
Fix cache mixing with high-dpi and low-dpi osm providers
This cache fixes the cache mixing problem that has been introduced
with the osm high dpi tiles support.
high dpi providers fall back to low dpi ones and ultimately
to hardcoded providers (also low dpi), and can also be enabled/disabled
via plugin parameter, thus leaving the cache for a given map id
dirty for the next run.
With this patch high dpi tiles are named differently from low dpi ones.
If high-dpi providers are selected, but become not available, the
cache can also change the tileset to load at runtime
Change-Id: I229692da07c1fc61c58fb0b6fae6ec5af16e43a7
Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io>
Diffstat (limited to 'src/plugins/geoservices/osm/qgeofiletilecacheosm.h')
-rw-r--r-- | src/plugins/geoservices/osm/qgeofiletilecacheosm.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/plugins/geoservices/osm/qgeofiletilecacheosm.h b/src/plugins/geoservices/osm/qgeofiletilecacheosm.h index f48fad7f..52d57747 100644 --- a/src/plugins/geoservices/osm/qgeofiletilecacheosm.h +++ b/src/plugins/geoservices/osm/qgeofiletilecacheosm.h @@ -37,6 +37,7 @@ #ifndef QGEOFILETILECACHEOSM_H #define QGEOFILETILECACHEOSM_H +#include "qgeotileproviderosm.h" #include <QtLocation/private/qgeofiletilecache_p.h> #include <QHash> #include <QtConcurrent> @@ -48,14 +49,24 @@ class QGeoFileTileCacheOsm : public QGeoFileTileCache { Q_OBJECT public: - QGeoFileTileCacheOsm(const QString &offlineDirectory = QString(), const QString &directory = QString(), QObject *parent = 0); + QGeoFileTileCacheOsm(const QVector<QGeoTileProviderOsm *> &providers, const QString &offlineDirectory = QString(), const QString &directory = QString(), QObject *parent = 0); ~QGeoFileTileCacheOsm(); QSharedPointer<QGeoTileTexture> get(const QGeoTileSpec &spec) Q_DECL_OVERRIDE; +Q_SIGNALS: + void mapDataUpdated(int mapId); + +protected Q_SLOTS: + void onProviderResolutionFinished(const QGeoTileProviderOsm *provider); + protected: void init() Q_DECL_OVERRIDE; + QString tileSpecToFilename(const QGeoTileSpec &spec, const QString &format, const QString &directory) const Q_DECL_OVERRIDE; + QGeoTileSpec filenameToTileSpec(const QString &filename) const Q_DECL_OVERRIDE; QSharedPointer<QGeoTileTexture> getFromOfflineStorage(const QGeoTileSpec &spec); + void dropTiles(int mapId); + void loadTiles(int mapId); void initOfflineRegistry(); @@ -64,6 +75,8 @@ protected: QAtomicInt m_requestCancel; QFuture<void> m_future; QMutex storageLock; + QVector<QGeoTileProviderOsm *> m_providers; + QVector<bool> m_highDpi; }; QT_END_NAMESPACE |