summaryrefslogtreecommitdiff
path: root/src/location/labs/qsg
Commit message (Collapse)AuthorAgeFilesLines
* Fix crash with empty maps on constructionPaolo Angelelli2020-02-131-0/+2
| | | | | Change-Id: I8716c94b2c3f1fb995e933fe5be736e94ff161ce Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Add geometry simplification to MapPolyline/MapPolylineObjectQSGPaolo Angelelli2020-02-123-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change introduces a metric-based implementation of the Ramer-Douglas-Peucker line simplification algorithm to generate a LOD pyramid for the polyline geometries. This comes with a related property (in MapItemBase), lodThreshold, that can be used to change the threshold after which no simplification will be used. By default the value of this property is 0, meaning that the behavior will be unchanged and no LOD will be used. This change also introduces LOD on map polyine objects QSG, for which no property is introduced, and there's a default threshold set to zoom level 12 (which appear to produce acceptable results). Finally, this patch makes use of a threadpool with 1 thread to enqueue geometry simplification tasks, which would otherwise freeze the UI when computing for the first time. Support for geometry simplification is currently added only to polylines. It might be of interest extending it to polygons as well, once a proper strategy for handling the simplification of inner holes has been identified. Finally, extending it to circles could be of interest, while potentially bringing only minor benefits, as circle geometries are currently fixed to 128 vertices. Also adds a MapObject-based delegate to the geojson viewer example. Task-number: QTBUG-46652 Task-number: QTBUG-38459 Task-number: QTBUG-49303 Change-Id: I64b5db4577962db17e5388812909285c9356ef0d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Port Map*ObjectPrivateQSG to the shader-based projection geometriesv5.15.0-alpha1Paolo Angelelli2020-02-117-189/+414
| | | | | | | | | | | | | | | | | | | | | | | This patch changes the implementation of the scenegraph-based mapobjects (those created by QGeoTiledMap) to be the recently introduced one sporting shader-based map projection. This is much faster than the previous, but may introduce small glitches at this time (mostly on minified polylines). Adding polyline LOD simplification will solve this problem. Compared to equivalent Map Items (that is, Map Items backed by the same underlying implementation), map objects now are approximately 1.5x faster. This measure has been gathered using medium-size polygons (contained in the file 10_countries.json from the geojson_viewer example). The difference is caused by the additional QtQuick geometry related operations (essentially projecting the bounding box for each item) present in MapItems. Smaller polygons may therefore yield larger improvements, larger polygons the opposite. Change-Id: I3fc92b02b74a3a4d001e69755949a98f80d8a3d3 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Fix Map*ObjectsQSG implementation triggering QSGBatchRenderer crashesPaolo Angelelli2020-02-116-24/+35
| | | | | | | | The new approach introduces a root node for all objects, that is repopulated at every repaint. Change-Id: I4562e1aaa18999a03e8c38fe3bf59fe41f14dd70 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Enable mercator-to-screen projection in GLSLPaolo Angelelli2020-02-114-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this change, all the geo-to-screen conversion, and the triangulation operations for geo polylines and geo polygon are performed either at set time or in the shader. A separate bounding box geometry is processed in the old way to provide a correct QtQuick Item geometry, that can be used for nesting mouse areas, performing translations, input event delivery, etc. With this approach, performance are improved by more than one order of magnitude in average, but complex geometries will of course benefit more. It also adds correct rendering support for polygons with holes, previously only rendered correctly by the MapboxGL plugin. The polyline shader has basic miter joins. The miter is skipped if the angle is too sharp to avoid complicating the implementation. This shader introduces some glitches when the polyline is minified, for which the real fix is to have LOD for the geometry, and render simplified geometries at low zoom levels (added in a subsequent patch). Note: this approach, at least in its current implementation, does not support enabling layers on individual items, only on the Map element. Task-number: QTBUG-49303 Task-number: QTBUG-38459 Change-Id: I0c2dc0bf364d32f74ca7c4014f6d66e6219c8ae4 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Introduce Qt.labs.location QtLocationLabs singleton typePaolo Angelelli2019-03-113-1/+11
| | | | | | | | | | | This singleton is meant to offer tech-preview map-related API. It starts with a mapObjectsAt invokable, that can be used to probe MapObjects at a specific coordinate of a map. Reference implementation for Q*ObjectQSG, based on QGeoShape::contains, included. Change-Id: Ief692eb5a43115ca02d4642c82023d1b2e217400 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Fix broken MapPolylineObjectQSGPaolo Angelelli2019-02-041-1/+3
| | | | | | | | | Fixes missing data sync between MapPolylineObjectPrivateDefault m_path and MapPolylineObjectPrivateQSG m_geoPath. Change-Id: Ie9eaee0bd23795b3afa51ca2facbd11ce32c8a26 Fixes: QTBUG-73408 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Introduce QGeoMapObject::geoShape propertyPaolo Angelelli2019-02-016-81/+67
| | | | | | | | | | In this way MapObjects become a little closer to MapItems, and this property can be used to, for example, center the map on one specific object or object group. Fixes: QTBUG-69640 Change-Id: I4dbead9e670bf5d1eeaccb2bd09d956b8de7da87 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Unify semicolon usage in Q_UNUSEDJesus Fernandez2019-01-234-4/+4
| | | | | Change-Id: I36dd6881b6f6f028869d63b6311cba7f52a99cc4 Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io>
* Rename MapIconObject.size to MapIconObject.iconSizePaolo Angelelli2019-01-142-4/+4
| | | | | | | Associated signals and methods are also renamed Change-Id: I6a6baa77f8324d3b345118072be75491ca251be2 Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* QGeoMapObject: Fix MSVC warnings about '*/' found outside of commentFriedemann Kleint2018-07-103-3/+3
| | | | | | | | | labs\qsg\qmappolylineobjectqsg.cpp(103): warning C4138: '*/' found outside of comment labs\qsg\qmappolygonobjectqsg.cpp(81): warning C4138: '*/' found outside of comment labs\qsg\qqsgmapobject.cpp(53): warning C4138: '*/' found outside of comment Change-Id: I5c000dbd40e59af6504b52303bd4ae4a1b782dc9 Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io>
* Fix crash in Map{Polyline,Polygon,Route}ObjectQsgPaolo Angelelli2018-05-092-0/+4
| | | | | | | | | | | | | | | | When these objects get added to a map but aren't immediately visible (meaning are outside the visible region entirely), their respective QSGNodes will be marked as blocked. However, this isn't handled gracefully in qsgbatchrenderer. Renderer::nodeWasAdded discards nodes that are blocked. Meaning that when they will become unblocked, the node will result in being unallocated. This patch makes sure that a node is not instantiated at all if it would result in a blocked node. Change-Id: I8e174ba1d317e1d0c4006d993ec558bdad8a5b39 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* QtLocation: Fix build warningsFriedemann Kleint2018-05-041-0/+11
| | | | | | | | | | QtLocation: WARNING: qtlocation/src/location/qlocationglobal.h includes qlocation.h when it should include QtLocation/qlocation.h QtLocation: WARNING: qtlocation/src/location/labs/qsg/qqsgmapobject_p.h does not have the "We mean it." warning Amends 2782765e20ba3bc6af92375574456fd54d4243f7. Change-Id: I6c225c8af70ebc5753b3b20aec1900efd1bc2c5c Reviewed-by: Martin Smith <martin.smith@qt.io>
* Fix QGeoMapObject handling in reference implementationPaolo Angelelli2018-04-2214-31/+389
| | | | | | | | | | | | | | | | | setVisible was neither changing the visibility nor triggering repaint. Pimpls weren't removing themselves in their destructors when dynamically added/removed via QGeoMapObjectView add/removeMapObject. This patch also factors out the duplicated QGeoMapObject support from QGeoTiledMapLabs and QGeoMapObjectsOverlay and moves it into an own class, QGeoMapObjectQSGSupport. To properly flush the scene graph nodes upon object removal, a pointer to the QSGNode is added to the MapObject struct, now moved inside QGeoMapObjectQSGSupport. Change-Id: Ie8c6d54f8f340ba3867717d9620791d3fe8021cc Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Fix MapPolyline being drawn misplaced and moving when clippedPaolo Angelelli2018-04-193-3/+3
| | | | | | | Regression introduced in f0bc0db15ed262a8f31bb07b3b46a5cdf9277e79 Change-Id: I4c4a3cb2302daeb825be21f9e2f6c235d2cb7c93 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Introduce map objects reference implementationPaolo Angelelli2018-04-1712-0/+1515
This patch introduces a reference implementation for the QGeoMapObject subclasses in the locationlabs module. If this module is built, all current plugins, with the exception of mapboxgl, will also be able to render map objects. The current reference implementation of map objects is not optimized, but it can be useful for both testing and feature parity (so that switching between plugins will give the same result). Change-Id: I830ebb3813f219e42c085f450952a2b4327361cd Reviewed-by: Alex Blasche <alexander.blasche@qt.io>