summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2017-03-21 17:35:05 +0100
committerPaolo Angelelli <paolo.angelelli@qt.io>2017-03-27 11:22:32 +0000
commit74b456578063f184838774c54c89a96d7ab90a5b (patch)
tree9a57a65f51d1a2f71f4f31bd8c895223408c74e0
parent2e79bbca6465d404a821510c7a6b897fd284ca99 (diff)
downloadqtlocation-74b456578063f184838774c54c89a96d7ab90a5b.tar.gz
Add parameter to control prefetching in tile-based geoservice plugins
Change-Id: I18fc1788f7af0efe76f97257ffe739eb1a96e6cc Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
-rw-r--r--src/location/doc/src/plugins/esri.qdoc7
-rw-r--r--src/location/doc/src/plugins/mapbox.qdoc7
-rw-r--r--src/location/doc/src/plugins/nokia.qdoc7
-rw-r--r--src/location/doc/src/plugins/osm.qdoc7
-rw-r--r--src/location/maps/qgeotiledmappingmanagerengine.cpp1
-rw-r--r--src/location/maps/qgeotiledmappingmanagerengine_p.h2
-rw-r--r--src/plugins/geoservices/esri/geotiledmappingmanagerengine_esri.cpp14
-rw-r--r--src/plugins/geoservices/mapbox/qgeotiledmappingmanagerenginemapbox.cpp14
-rw-r--r--src/plugins/geoservices/nokia/qgeotiledmappingmanagerengine_nokia.cpp15
-rw-r--r--src/plugins/geoservices/osm/qgeotiledmappingmanagerengineosm.cpp12
10 files changed, 83 insertions, 3 deletions
diff --git a/src/location/doc/src/plugins/esri.qdoc b/src/location/doc/src/plugins/esri.qdoc
index c19f19dd..9dce349c 100644
--- a/src/location/doc/src/plugins/esri.qdoc
+++ b/src/location/doc/src/plugins/esri.qdoc
@@ -150,6 +150,13 @@ or you can sign up for an \l {http://www.arcgis.com/features/plans/pricing.html}
Note that the texture cache has a hard minimum size which depends on the size of the map viewport
(it must contain enough data to display the tiles currently visible on the display).
This value is the amount of cache to be used in addition to the bare minimum.
+\row
+ \li esri.mapping.prefetching_style
+ \li This parameter allows to control how tile prefetching is performed by the engine. The default value,
+ \tt{TwoNeighbourLayers}, makes the engine prefetch tiles for the layer above and the one below the current tile
+ layer, providing ready tiles when zooming in or out from the current zoom level.
+ \tt{OneNeighbourLayer} only prefetches the one layer closest to the current zoom level.
+ Finally, \tt{NoPrefetching} allows to disable the prefetching, so only tiles that are visible will be fetched.
\endtable
\section2 Directions language
diff --git a/src/location/doc/src/plugins/mapbox.qdoc b/src/location/doc/src/plugins/mapbox.qdoc
index 12c29aee..cf564415 100644
--- a/src/location/doc/src/plugins/mapbox.qdoc
+++ b/src/location/doc/src/plugins/mapbox.qdoc
@@ -138,5 +138,12 @@ The following table lists optional parameters that can be passed to the Mapbox p
viewport (it must contain enough data to display the tiles currently visible on the
display).
This value is the amount of tiles to be cached in addition to the bare minimum.
+\row
+ \li mapbox.mapping.prefetching_style
+ \li This parameter allows to control how tile prefetching is performed by the engine. The default value,
+ \tt{TwoNeighbourLayers}, makes the engine prefetch tiles for the layer above and the one below the current tile
+ layer, providing ready tiles when zooming in or out from the current zoom level.
+ \tt{OneNeighbourLayer} only prefetches the one layer closest to the current zoom level.
+ Finally, \tt{NoPrefetching} allows to disable the prefetching, so only tiles that are visible will be fetched.
\endtable
*/
diff --git a/src/location/doc/src/plugins/nokia.qdoc b/src/location/doc/src/plugins/nokia.qdoc
index 4e46a18d..fdd5ce6d 100644
--- a/src/location/doc/src/plugins/nokia.qdoc
+++ b/src/location/doc/src/plugins/nokia.qdoc
@@ -136,6 +136,13 @@ a prefix.
(it must contain enough data to display the tiles currently visible on the display).
This value is the amount of cache to be used in addition to the bare minimum.
\row
+ \li here.mapping.prefetching_style
+ \li This parameter allows to control how tile prefetching is performed by the engine. The default value,
+ \tt{TwoNeighbourLayers}, makes the engine prefetch tiles for the layer above and the one below the current tile
+ layer, providing ready tiles when zooming in or out from the current zoom level.
+ \tt{OneNeighbourLayer} only prefetches the one layer closest to the current zoom level.
+ Finally, \tt{NoPrefetching} allows to disable the prefetching, so only tiles that are visible will be fetched.
+\row
\li here.mapping.highdpi_tiles
\li Whether or not to request high dpi tiles. Valid values are \b true and \b false. The default value is \b false.
\row
diff --git a/src/location/doc/src/plugins/osm.qdoc b/src/location/doc/src/plugins/osm.qdoc
index 01efa021..236b0255 100644
--- a/src/location/doc/src/plugins/osm.qdoc
+++ b/src/location/doc/src/plugins/osm.qdoc
@@ -101,6 +101,13 @@ a prefix.
\tt{street-hires}, \tt{satellite-hires}, \tt{cycle-hires}, \tt{transit-hires}, \tt{night-transit-hires}, \tt{terrain-hires} and \tt{hiking-hires}.
These are fetched from the same location used for the low dpi counterparts.
\row
+ \li osm.mapping.prefetching_style
+ \li This parameter allows to control how tile prefetching is performed by the engine. The default value,
+ \tt{TwoNeighbourLayers}, makes the engine prefetch tiles for the layer above and the one below the current tile
+ layer, providing ready tiles when zooming in or out from the current zoom level.
+ \tt{OneNeighbourLayer} only prefetches the one layer closest to the current zoom level.
+ Finally, \tt{NoPrefetching} allows to disable the prefetching, so only tiles that are visible will be fetched.
+\row
\li osm.routing.host
\li Url string set when making network requests to the routing server. This parameter should be set to a
valid server url with the correct osrm API. If not specified the default \l {http://router.project-osrm.org/route/v1/driving/}{url} will be used.
diff --git a/src/location/maps/qgeotiledmappingmanagerengine.cpp b/src/location/maps/qgeotiledmappingmanagerengine.cpp
index 84938c61..c17f7ffd 100644
--- a/src/location/maps/qgeotiledmappingmanagerengine.cpp
+++ b/src/location/maps/qgeotiledmappingmanagerengine.cpp
@@ -53,6 +53,7 @@ QT_BEGIN_NAMESPACE
QGeoTiledMappingManagerEngine::QGeoTiledMappingManagerEngine(QObject *parent)
: QGeoMappingManagerEngine(parent),
+ m_prefetchStyle(QGeoTiledMap::PrefetchTwoNeighbourLayers),
d_ptr(new QGeoTiledMappingManagerEnginePrivate)
{
}
diff --git a/src/location/maps/qgeotiledmappingmanagerengine_p.h b/src/location/maps/qgeotiledmappingmanagerengine_p.h
index 956c4852..929e92f8 100644
--- a/src/location/maps/qgeotiledmappingmanagerengine_p.h
+++ b/src/location/maps/qgeotiledmappingmanagerengine_p.h
@@ -55,6 +55,7 @@
#include <QtLocation/private/qabstractgeotilecache_p.h>
#include <QtLocation/private/qgeomaptype_p.h>
#include <QtLocation/private/qgeomappingmanagerengine_p.h>
+#include <QtLocation/private/qgeotiledmap_p.h>
QT_BEGIN_NAMESPACE
@@ -106,6 +107,7 @@ protected:
void setCacheHint(QAbstractGeoTileCache::CacheAreas cacheHint);
void setTileCache(QAbstractGeoTileCache *cache);
+ QGeoTiledMap::PrefetchStyle m_prefetchStyle;
private:
QGeoTiledMappingManagerEnginePrivate *d_ptr;
diff --git a/src/plugins/geoservices/esri/geotiledmappingmanagerengine_esri.cpp b/src/plugins/geoservices/esri/geotiledmappingmanagerengine_esri.cpp
index a0f00615..3b06d237 100644
--- a/src/plugins/geoservices/esri/geotiledmappingmanagerengine_esri.cpp
+++ b/src/plugins/geoservices/esri/geotiledmappingmanagerengine_esri.cpp
@@ -199,6 +199,16 @@ GeoTiledMappingManagerEngineEsri::GeoTiledMappingManagerEngineEsri(const QVarian
tileCache->setExtraTextureUsage(cacheSize);
}
+ /* PREFETCHING */
+ if (parameters.contains(QStringLiteral("esri.mapping.prefetching_style"))) {
+ const QString prefetchingMode = parameters.value(QStringLiteral("esri.mapping.prefetching_style")).toString();
+ if (prefetchingMode == QStringLiteral("TwoNeighbourLayers"))
+ m_prefetchStyle = QGeoTiledMap::PrefetchTwoNeighbourLayers;
+ else if (prefetchingMode == QStringLiteral("OneNeighbourLayer"))
+ m_prefetchStyle = QGeoTiledMap::PrefetchNeighbourLayer;
+ else if (prefetchingMode == QStringLiteral("NoPrefetching"))
+ m_prefetchStyle = QGeoTiledMap::NoPrefetching;
+ }
setTileCache(tileCache);
*error = QGeoServiceProvider::NoError;
@@ -212,7 +222,9 @@ GeoTiledMappingManagerEngineEsri::~GeoTiledMappingManagerEngineEsri()
QGeoMap *GeoTiledMappingManagerEngineEsri::createMap()
{
- return new GeoTiledMapEsri(this);
+ QGeoTiledMap *map = new GeoTiledMapEsri(this);
+ map->setPrefetchStyle(m_prefetchStyle);
+ return map;
}
// ${z} = Zoom
diff --git a/src/plugins/geoservices/mapbox/qgeotiledmappingmanagerenginemapbox.cpp b/src/plugins/geoservices/mapbox/qgeotiledmappingmanagerenginemapbox.cpp
index 4b62aece..090ba310 100644
--- a/src/plugins/geoservices/mapbox/qgeotiledmappingmanagerenginemapbox.cpp
+++ b/src/plugins/geoservices/mapbox/qgeotiledmappingmanagerenginemapbox.cpp
@@ -221,6 +221,16 @@ QGeoTiledMappingManagerEngineMapbox::QGeoTiledMappingManagerEngineMapbox(const Q
tileCache->setExtraTextureUsage(cacheSize);
}
+ /* PREFETCHING */
+ if (parameters.contains(QStringLiteral("mapbox.mapping.prefetching_style"))) {
+ const QString prefetchingMode = parameters.value(QStringLiteral("mapbox.mapping.prefetching_style")).toString();
+ if (prefetchingMode == QStringLiteral("TwoNeighbourLayers"))
+ m_prefetchStyle = QGeoTiledMap::PrefetchTwoNeighbourLayers;
+ else if (prefetchingMode == QStringLiteral("OneNeighbourLayer"))
+ m_prefetchStyle = QGeoTiledMap::PrefetchNeighbourLayer;
+ else if (prefetchingMode == QStringLiteral("NoPrefetching"))
+ m_prefetchStyle = QGeoTiledMap::NoPrefetching;
+ }
setTileCache(tileCache);
@@ -234,7 +244,9 @@ QGeoTiledMappingManagerEngineMapbox::~QGeoTiledMappingManagerEngineMapbox()
QGeoMap *QGeoTiledMappingManagerEngineMapbox::createMap()
{
- return new QGeoTiledMap(this, 0);
+ QGeoTiledMap *map = new QGeoTiledMap(this, 0);
+ map->setPrefetchStyle(m_prefetchStyle);
+ return map;
}
QT_END_NAMESPACE
diff --git a/src/plugins/geoservices/nokia/qgeotiledmappingmanagerengine_nokia.cpp b/src/plugins/geoservices/nokia/qgeotiledmappingmanagerengine_nokia.cpp
index ab6cd7ea..ca83dc30 100644
--- a/src/plugins/geoservices/nokia/qgeotiledmappingmanagerengine_nokia.cpp
+++ b/src/plugins/geoservices/nokia/qgeotiledmappingmanagerengine_nokia.cpp
@@ -185,6 +185,17 @@ QGeoTiledMappingManagerEngineNokia::QGeoTiledMappingManagerEngineNokia(
tileCache->setExtraTextureUsage(cacheSize);
}
+ /* PREFETCHING */
+ if (parameters.contains(QStringLiteral("here.mapping.prefetching_style"))) {
+ const QString prefetchingMode = parameters.value(QStringLiteral("here.mapping.prefetching_style")).toString();
+ if (prefetchingMode == QStringLiteral("TwoNeighbourLayers"))
+ m_prefetchStyle = QGeoTiledMap::PrefetchTwoNeighbourLayers;
+ else if (prefetchingMode == QStringLiteral("OneNeighbourLayer"))
+ m_prefetchStyle = QGeoTiledMap::PrefetchNeighbourLayer;
+ else if (prefetchingMode == QStringLiteral("NoPrefetching"))
+ m_prefetchStyle = QGeoTiledMap::NoPrefetching;
+ }
+
setTileCache(tileCache);
populateMapSchemes();
loadMapVersion();
@@ -431,7 +442,9 @@ QString QGeoTiledMappingManagerEngineNokia::evaluateCopyrightsText(const QGeoMap
QGeoMap *QGeoTiledMappingManagerEngineNokia::createMap()
{
- return new QGeoTiledMapNokia(this);
+ QGeoTiledMap *map = new QGeoTiledMapNokia(this);
+ map->setPrefetchStyle(m_prefetchStyle);
+ return map;
}
QT_END_NAMESPACE
diff --git a/src/plugins/geoservices/osm/qgeotiledmappingmanagerengineosm.cpp b/src/plugins/geoservices/osm/qgeotiledmappingmanagerengineosm.cpp
index 0e1fb356..a0fb1a59 100644
--- a/src/plugins/geoservices/osm/qgeotiledmappingmanagerengineosm.cpp
+++ b/src/plugins/geoservices/osm/qgeotiledmappingmanagerengineosm.cpp
@@ -311,6 +311,17 @@ QGeoTiledMappingManagerEngineOsm::QGeoTiledMappingManagerEngineOsm(const QVarian
}
setTileFetcher(tileFetcher);
+ /* PREFETCHING */
+ if (parameters.contains(QStringLiteral("osm.mapping.prefetching_style"))) {
+ const QString prefetchingMode = parameters.value(QStringLiteral("osm.mapping.prefetching_style")).toString();
+ if (prefetchingMode == QStringLiteral("TwoNeighbourLayers"))
+ m_prefetchStyle = QGeoTiledMap::PrefetchTwoNeighbourLayers;
+ else if (prefetchingMode == QStringLiteral("OneNeighbourLayer"))
+ m_prefetchStyle = QGeoTiledMap::PrefetchNeighbourLayer;
+ else if (prefetchingMode == QStringLiteral("NoPrefetching"))
+ m_prefetchStyle = QGeoTiledMap::NoPrefetching;
+ }
+
*error = QGeoServiceProvider::NoError;
errorString->clear();
}
@@ -324,6 +335,7 @@ QGeoMap *QGeoTiledMappingManagerEngineOsm::createMap()
QGeoTiledMap *map = new QGeoTiledMapOsm(this);
connect(qobject_cast<QGeoFileTileCacheOsm *>(tileCache()), &QGeoFileTileCacheOsm::mapDataUpdated
, map, &QGeoTiledMap::clearScene);
+ map->setPrefetchStyle(m_prefetchStyle);
return map;
}