summaryrefslogtreecommitdiff
path: root/src/location/maps/qgeotiledmapscene.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Avoid initializing QFlags with 0 or nullptrFriedemann Kleint2019-11-251-1/+1
| | | | | | | It is being deprecated. Change-Id: I33a411f9b2fc18feabd3cc8d7f3a44b353e25639 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Fix deprecation warningsFriedemann Kleint2019-05-271-2/+6
| | | | | | | | | | | | | | | | | | | Fix warnings: maps/qgeotilefetcher.cpp:78:36: warning: 'QList<T> QSet<T>::toList() const [with T = QGeoTileSpec]' is deprecated: Use values() instead. [-Wdeprecated-declarations] declarativeplaces/qdeclarativeplace.cpp:1088:101: warning: 'QVariant qVariantFromValue(const T&) [with T = QDeclarativePlaceAttribute*]' is deprecated: Use QVariant::fromValue() instead. [-Wdeprecated-declarations] maps/qgeotiledmapscene.cpp:498:62: warning: 'static QSet<T> QSet<T>::fromList(const QList<T>&) [with T = QGeoTileSpec]' is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations] maps/qgeotiledmapscene.cpp:498:89: warning: 'static QSet<T> QSet<T>::fromList(const QList<T>&) [with T = QGeoTileSpec]' is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations] maps/qgeotiledmapscene.cpp:643:61: warning: 'static QSet<T> QSet<T>::fromList(const QList<T>&) [with T = QGeoTileSpec]' is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations] maps/qgeotiledmapscene.cpp:643:94: warning: 'static QSet<T> QSet<T>::fromList(const QList<T>&) [with T = QGeoTileSpec]' is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations] /data1/frkleint/qt-dev/qtbase/include/QtCore/../../src/corelib/tools/qset.h:400:23: warning: 'QSet<T> QList<T>::toSet() const [with T = QGeoTileSpec]' is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations] declarativemaps/qdeclarativegeomap.cpp:453:45: warning: 'QSet<T> QList<T>::toSet() const [with T = QObject*]' is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations] qplacemanagerengine_test.h:477:72: warning: 'QSet<T> QList<T>::toSet() const [with T = QPlaceCategory]' is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations] ../utils/qlocationtestutils.cpp:50:31: warning: 'QString& QString::sprintf(const char*, ...)' is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations] Change-Id: Ice04fd0f158ee95a42f53b33dcb7b9204a33c90e Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Unify semicolon usage in Q_UNUSEDJesus Fernandez2019-01-231-1/+1
| | | | | Change-Id: I36dd6881b6f6f028869d63b6311cba7f52a99cc4 Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io>
* Make tiled renderer and QGeoProjectionWebMercator debuggablePaolo Angelelli2018-11-281-123/+31
| | | | | | | | | | | | | | | This patch introduces a new macro, QT_LOCATION_DEBUG, that, when fed via qmake command line, changes the scope of some members, adds some extra members and some extra data dumping into these members. In this way external code can inspect the state of the renderer in order to debug it. The patch also moves a few classes into separate files, as well as privately exporting them. Change-Id: I32a042863f78dcd10f94b0b7fe8b90f3fc486891 Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io>
* Introduce Map.visibleAreaPaolo Angelelli2018-07-261-1/+35
| | | | | | | | | | This will allow moving the visible map area to a subregion of the viewport, allowing to maintain the desired visible region visible when overlaying controls on top of the map. Task-number: QTBUG-68966 Change-Id: Idf4b30f7c1e4062e5e1c0ddc01a31bc856c0bc0c Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Fix compilation error without openglPaolo Angelelli2017-06-181-0/+2
| | | | | | | | If opengl is not present, now that warnings are error, Location fails to build due to an unused ogl variable. Change-Id: Id1e9a1f4da8bc31a65e29b3dd2770250284d02bb Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Fix building on configurations without openglPaolo Angelelli2017-05-201-0/+4
| | | | | | Task-number: QTBUG-60881 Change-Id: Iffdcfe1ebfe81da9b809dceeff61fca044e94891 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Fix for nearest scaling still being used in overzoomPaolo Angelelli2017-04-281-0/+1
| | | | | | | | An assignment was missing to make the overzooming bool actually kick in. Change-Id: I5f6e52016026af050c734bca31e45f06fbbdb9b5 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Prevent accessing invalid QGeoTileSpec from QHash look-upsPaolo Angelelli2017-04-111-9/+13
| | | | | Change-Id: Ic169824201ed6aeaeb2a482b28da989f9312181d Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Prevent containers from detaching within for loops in QGeoTiledMapScenePaolo Angelelli2017-04-111-6/+6
| | | | | Change-Id: I7f81f3dab3ef0243c45ec22bafa8687f756134f4 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Replace foreach with ranged for loops in QGeoTiledMapScenePaolo Angelelli2017-04-111-8/+8
| | | | | Change-Id: I7a82c0d63f35d1cfd264801e58089408254757c8 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Use linear filterning whenever overzooming lo-res tilesPaolo Angelelli2017-04-071-7/+9
| | | | | | | | | This patch fixes the incorrect behavior of using nearest filtering at integer zoom level, even if the texture is being overzoomed from a lower zoom level Change-Id: Ia3572399187a6f24829504116602685434ecfc5f Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Fix for QGeoTiledMapPrivate::changeActiveMapType not setting tileSizePaolo Angelelli2017-03-281-5/+15
| | | | | Change-Id: If3e920f4b4cb5bf6310914a258eb3f569de9a8ef Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Enable overzooming tiles in qgeotiledmapscenePaolo Angelelli2017-03-231-4/+38
| | | | | | | | | With this patch tiles from previous zoom levels can be temporarily used to fill the map until the actual tiles are fetched. Task-number: QTBUG-23659 Change-Id: I7db68c82217cb18a9bec2abdc3e679fc0bfb6b94 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Fix for projection mismatch when aspect ratio < 1.0Paolo Angelelli2017-03-221-6/+3
| | | | | | | | | | | This patch fixes an incorrect computation of the projection matrices and thus a mismatch in projections between mbgl vs the other plugins when the window A/R is less than 1.0. Task-number: QTBUG-59417 Change-Id: Ib03eaa4c877a00c9281c335f859c854d6db632c0 Reviewed-by: Bruno de Oliveira Abinader <brunoabinader@gmail.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Merge remote-tracking branch 'gerrit/5.8' into 5.9Alex Blasche2017-02-281-2/+3
|\ | | | | | | Change-Id: I3c27a0635fa324dfea7a1d19774a66e21c066bbe
| * Consider devicePixelRatio when enabling tiles mipmappingPaolo Angelelli2017-02-281-2/+3
| | | | | | | | | | | | | | | | | | Tiles are magnified when high dpi scaling factor is used for the app, so the scale factor must be considered when tile size is used to decide whether to switch mipmapping on or not Change-Id: I628ddc82f41bbdb94d0c1c6ed628bc13990f64bf Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | Use OpenGL anisotropic texture filtering if availablePaolo Angelelli2017-02-131-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | Enabling 16x anisotropic texture filtering by default if available and running on OpenGL. This has almost no performance impact, while at the same time greatly improving the map quality when tilting the map. OpenGL is also supposed to be smart enough not to use it when no anisotropy is present. Change-Id: Ic0303b13625a28d36b258d617a9dd64f5b1a9700 Reviewed-by: Gunnar Sletta <gunnar@crimson.no>
* | Add rotation/tilting support to QGeoTiledMapScene/QGeoCameraTilesPaolo Angelelli2017-01-261-59/+81
| | | | | | | | | | | | | | | | | | | | | | | | This patch adds rotation and tilting support to QGeoTiledMapScene and QGeoCameraTiles. It also adds the related capabilities to the geoservice plugins mapping managers QML Api is added in a separate patch Change-Id: I3de1b52a9928c4856f6ee57ad39191acebe0f770 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | Add rotation and tilt controls to QDeclarativeGeoMapPaolo Angelelli2017-01-251-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QDeclarativeGeoMap currently does not provide any mean to set bearing and tilt into qgeocameradata. It has been not a problem since QGeoTiledMap and sons did not support it. External renderers however support it, so this patch adds QML api calls to control these parameters, and adapt the existing logic to take them into consideration in camera-related calls, as well as in the afterViewportChange handlers of the Map Items. This patch also sligthly modifies the QML api to make the handling of all the bounded camera property more homogeneous. Minimum and maximum zoom levels prior plugin initialization aren't -1 anymore, but are some valid lower and upper bounds for this property, that is 0 and 30. in this way all the 2 bounded properties (zoomLevel and tilt) behave the same, in that they can be freely set before plugin initialization, within reasonable predefined bounds, and, after that, they may be clamped depending on the actual plugin capabilities. Autotests for the QML part of the API included. Change-Id: I9d09e32698a7330388e465e8ea7523ee39577d34 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | Move the coordinate <-> item position conversion to QGeoProjectionPaolo Angelelli2017-01-161-148/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch simplifies the QGeoMap API removing all the API necessary to convert to and from screen. This is now demanded to a specific QGeoProjection class, that will be independent of the map, except for using the same Geo projection (currently only WebMercator, or EPSG:3857, although we use a sphere instead of an ellipsoid, i believe) The benefits are - This relieves subclasses of QGeoMap from implementing a GeoProjection API, especially since QtLocation currently supports only WebMercator, and reimplementations would have to anyway produce the same results as the inbuilt one. - This avoids the several indirection steps previously necessary to perform a map projection (qgeotiledmap -> private->mapscene-> private). Since these operation are quite frequent one per map item coordinate at every redraw, shortening the indirection chain is beneficial - It simplifies the highly complex QGeoTiledMapScene, separating all the logic that is not needed to draw the scene, but only to perform geo coordinate <-> screen coordinate conversion Change-Id: I9e3ca5280166f2d6430a32deb44c030d02d9d4e1 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | Rename QGeoProjection to QWebMercatorPaolo Angelelli2017-01-161-3/+4
| | | | | | | | | | | | | | | | | | | | QGeoProjection is currently a class containing only static methods for WebMercator conversion/interpolation. This patch renames it to QWebMercator, effectively freeing the QGeoProjection name for a real projection class Change-Id: I15b71d04f7d1d21a1d26f46687ed33aa277f6deb Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | Refactor QGeoMap API: split coordinate <-> itemPosition callsPaolo Angelelli2016-12-071-23/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch splits the two calls coordinateToItemPosition and itemPositionToCoordinate into 3 separate steps: - coordinate to map projection. Map projection has always to be in [0,1] [0,1] range. In case of QGeoTiledMap, the only map projection supported is WebMercator, thus this call is currently equivalent to coordinateToMercator. - wrap map projection. Due to the longitude-wrapping-around nature of QGeoMap/QDeclarativeGeoMap, coordinates which are greater than others might end up before the others on the X axis of the projection. This stage takes care of this aspect - finally wrapped map projection to item position. this maps a wrapped coordinate to screen. Equivalent calls to do the inverse conversion are also provided. The benefits of splitting the conversion in 3 are: - possibility to precompute the map projection of item coordinates, thus having to simply re-wrap them (2 ifs and one sum) upon camera change. - Possibility to bake the last step into a 4x4 matrix and offload this to GPU - support for rotation and tilting cameras. Without, it would be impossible to "unwrapBelowX" item coordinates in presence of rotation and tilt, while now it would be possible to do this before the final projection to screen that peforms the tilting/rotation. Change-Id: I9b6a06ff051bbfd09e6d3584485acdcebdceb7bd Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | Refactoring QGeoTiledMapScene::mercatorToItemPositionPaolo Angelelli2016-12-071-117/+51
|/ | | | | | | | | | | | | | | | | | | This patch reimplements the method mercatorToItemPosition using values relevant for this type of conversion, instead of re-using values initially computed for the tile generation. This allows to greatly optimize the method, reducing branches and the total number of operations, as well as making it easier to understand. This patch also removes the support for letterboxing the map viewport inside the DeclarativeGeoMap, as there now is the constraint that the map can never be smaller than the containing element. Change-Id: Ida98e97ad0a6b65233c80ae3c4abd3ec7664c555 Reviewed-by: Michal Klocek <michal.klocek@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Fix cache mixing with high-dpi and low-dpi osm providersPaolo Angelelli2016-10-051-1/+17
| | | | | | | | | | | | | | | | | 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>
* Add OSM plugin parameter osm.mapping.highdpi_tilesPaolo Angelelli2016-08-301-4/+10
| | | | | | | | | | | | | | | | | | | This patch adds a mean to enable/disable high dpi support for the OSM plugin too, following the same approach taken for the mapbox and here plugins. In order to do so, it has been necessary to rework QGeoTileProviderOsm. It can now be constructed with an arbitrary number of TileProviders, as opposed to the previous approach with one primary and one fallback tileprovider. It has also been necessary to disable Nearest interpolation for high dpi tiles, as it appears to produce considerable artifacts. So in presence of highdpi tiles, Linear interpolation is now always used. Change-Id: Id7d20fd5a320f3d5ef41b9fa28447a5c4f5398be Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* QGeoTiledMapScene: Use QSGImageNode API to set geometryAndy Nichols2016-07-211-30/+11
| | | | | | | | | | Previously a custom QSGGeometry is supplied, which is a bit of a hack. Instead the QSGImageNode has API's to modify the existing geometry and they can and should be used instead. Change-Id: I7725502619fd640a2be1ac0290bd580acbaa6146 Reviewed-by: Michal Klocek <michal.klocek@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Use HiDpi tiles to produce crisper maps at fractional zoom levelsPaolo Angelelli2016-07-011-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Migrate to cross-API helper scenegraph nodesLaszlo Agocs2016-06-231-12/+16
| | | | | | | | Maps are now functional with the Direct3D 12 as well. Change-Id: Ia03c6c5b10d74895140ad10835df0ae1ea9724b2 Reviewed-by: Michal Klocek <michal.klocek@theqtcompany.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* QGeoMapScene renamed to QGeoTiledMapScenev5.7.0-alpha1Paolo Angelelli2016-03-031-0/+749
Since the class QGeoMapScene is tightly coupled to QGeoTiledMap, this patch renames it into QGeoTiledMapScene/QGeoTiledMapScenePrivate, to clarify the structure of the module and avoid confusion, as otherwise it would not be clear that this class is exclusively used by QGeoTiledMap. Change-Id: Ifd76b02ff14d0f0690dc37fcb0a93b0e0702d05d Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>