From d055098540df99a5d426360e9322c659e678e5ee Mon Sep 17 00:00:00 2001 From: Paolo Angelelli Date: Wed, 27 Nov 2019 15:37:07 +0100 Subject: Enable mercator-to-screen projection in GLSL 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 --- src/imports/location/location.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/imports/location/location.cpp') diff --git a/src/imports/location/location.cpp b/src/imports/location/location.cpp index fd53ad7a..7876e45a 100644 --- a/src/imports/location/location.cpp +++ b/src/imports/location/location.cpp @@ -206,6 +206,12 @@ public: qmlRegisterUncreatableType(uri, major, minor, "GeoMapItemBase", QStringLiteral("GeoMapItemBase is not intended instantiable by developer.")); + minor = 15; + qmlRegisterType(uri, major, minor, "MapPolyline"); + qmlRegisterType(uri, major, minor, "MapPolygon"); + qmlRegisterType(uri, major, minor, "MapRectangle"); + qmlRegisterType(uri, major, minor, "MapCircle"); + // Register the latest Qt version as QML type version qmlRegisterModule(uri, QT_VERSION_MAJOR, QT_VERSION_MINOR); -- cgit v1.2.1 From be7cbed7411d024d178377bd327d5916c80e02a0 Mon Sep 17 00:00:00 2001 From: Paolo Angelelli Date: Mon, 30 Dec 2019 13:27:29 +0100 Subject: Add geometry simplification to MapPolyline/MapPolylineObjectQSG 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 --- src/imports/location/location.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/imports/location/location.cpp') diff --git a/src/imports/location/location.cpp b/src/imports/location/location.cpp index 7876e45a..01b6fb62 100644 --- a/src/imports/location/location.cpp +++ b/src/imports/location/location.cpp @@ -211,6 +211,8 @@ public: qmlRegisterType(uri, major, minor, "MapPolygon"); qmlRegisterType(uri, major, minor, "MapRectangle"); qmlRegisterType(uri, major, minor, "MapCircle"); + qmlRegisterUncreatableType(uri, major, minor, "GeoMapItemBase", + QStringLiteral("GeoMapItemBase is not intended instantiable by developer.")); // Register the latest Qt version as QML type version qmlRegisterModule(uri, QT_VERSION_MAJOR, QT_VERSION_MINOR); -- cgit v1.2.1