diff options
author | Paolo Angelelli <paolo.angelelli@theqtcompany.com> | 2016-06-28 16:27:09 +0200 |
---|---|---|
committer | Paolo Angelelli <paolo.angelelli@theqtcompany.com> | 2016-07-01 09:29:11 +0000 |
commit | c2329ca8fb48aac7da1694f4b9c3d28924feae63 (patch) | |
tree | 4031363229220cf4617f689799340013b9fa091a /src/plugins/geoservices/mapbox/qgeotiledmappingmanagerenginemapbox.cpp | |
parent | a10b6b5bf6ed29f705c2e3dd85c1206a96171f60 (diff) | |
download | qtlocation-c2329ca8fb48aac7da1694f4b9c3d28924feae63.tar.gz |
Use HiDpi tiles to produce crisper maps at fractional zoom levels
The current QtLocation renderer uses geotiles of specified size for
each specific zoom level, and show them using nearest neighbor
interpolation when the camera is at that specific zoom level.
Interpolation is changed to linear when the zoom level is in between
two neighboring tile layers, but hasn't reached the next yet, so that
the previous layer can be magnified smoothly.
While this is the correct approach, it produces blurry images most of
the time, while the previous camera mechanics, not allowing continuous
zoom, was able to show crisp images all the time.
To retain the continuous zoom and produce crisp images, this patch
makes use of HiDpi tiles from providers that offer them (HERE and
mapbox).
The way these two providers offer HiDpi is different: HERE scales the
map elements (text, mostly), to address a specific dpi (supported
dpis are 72, the standard, 250, 320, 500), while mapbox returns
the same tile at double resolution.
The way the patch deals with this is by taking the image requested
as is, but setting the tile size in the renderer to be half of that,
while at the same time enabling mip mapping for QSGImageNodes.
In this way, at integer zoom level, texture LOD 1 is shown, that is
an OpenGL-scaled-down version of the downloaded tile, while at the
other fractional zoom levels trilinear interpolation is used to
produce a good image.
This approach was not possible for the openstreetmap geoservice
provider because mapquest (the currently used data provider) does
not offer HiDpi tiles, and a scaled version of the standard tile
would make the text unreadable half of the times.
Further scaling would be possible, e.g., with HERE maps, offering
500ppi maps, to look good during scaling also on HiDpi devices.
This can be addressed in a future patch.
Task-number: QTBUG-53318
Task-number: QTBUG-48868
Task-number: QTBUG-36949
Change-Id: Iaa6f5b1ece9d37a0c85e73efaf1bd3b50b1d5950
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src/plugins/geoservices/mapbox/qgeotiledmappingmanagerenginemapbox.cpp')
-rw-r--r-- | src/plugins/geoservices/mapbox/qgeotiledmappingmanagerenginemapbox.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/plugins/geoservices/mapbox/qgeotiledmappingmanagerenginemapbox.cpp b/src/plugins/geoservices/mapbox/qgeotiledmappingmanagerenginemapbox.cpp index ea679afc..eb1ad866 100644 --- a/src/plugins/geoservices/mapbox/qgeotiledmappingmanagerenginemapbox.cpp +++ b/src/plugins/geoservices/mapbox/qgeotiledmappingmanagerenginemapbox.cpp @@ -116,8 +116,13 @@ QGeoTiledMappingManagerEngineMapbox::QGeoTiledMappingManagerEngineMapbox(const Q setSupportedMapTypes(mapTypes); - QGeoTileFetcherMapbox *tileFetcher = new QGeoTileFetcherMapbox(this); - tileFetcher->setMapIds(mapIds); + bool doubleRes = true; + if (parameters.contains(QStringLiteral("mapbox.highdpi_tiles"))) { + const QString param = parameters.value(QStringLiteral("mapbox.highdpi_tiles")).toString().toLower(); + if (param == "false") + doubleRes = false; + } + QGeoTileFetcherMapbox *tileFetcher = new QGeoTileFetcherMapbox(this, doubleRes); if (parameters.contains(QStringLiteral("useragent"))) { const QByteArray ua = parameters.value(QStringLiteral("useragent")).toString().toLatin1(); |