summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli.qt@gmail.com>2019-12-30 13:27:29 +0100
committerPaolo Angelelli <paolo.angelelli.qt@gmail.com>2020-02-12 11:24:45 +0000
commitbe7cbed7411d024d178377bd327d5916c80e02a0 (patch)
treed5840e89206157770188c4472bcc752f793a6a5d /tests
parenta4469cad4041f21e640efa9ca5d0b192dd702955 (diff)
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 <fabian.kosmale@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/manual/mapobjects_tester/main.qml38
-rw-r--r--tests/manual/mapobjects_tester/qml.qrc1
2 files changed, 28 insertions, 11 deletions
diff --git a/tests/manual/mapobjects_tester/main.qml b/tests/manual/mapobjects_tester/main.qml
index 4695df3a..1e758ace 100644
--- a/tests/manual/mapobjects_tester/main.qml
+++ b/tests/manual/mapobjects_tester/main.qml
@@ -39,7 +39,7 @@ Window {
visible: true
width: 1440
height: 720
- title: qsTr("MapItems backends")
+ title: qsTr("MapObjects tester")
property real initialZL: 5
@@ -365,6 +365,12 @@ Window {
}
}
+ LongPolyline {
+ id: longPoly
+ backend: polylineBackend()
+ Component.onCompleted: longPolyPath = path
+ }
+
MapCircle {
center: QtPositioning.coordinate(52, 0)
radius: sliRadius.value
@@ -391,8 +397,8 @@ Window {
center: QtPositioning.coordinate(17, 44);
radius: 200*1000
color: "firebrick"
- layer.enabled: (backend == MapCircle.Software)
- layer.samples: 4
+// layer.enabled: (backend == MapCircle.Software)
+// layer.samples: 4
}
}
}
@@ -486,17 +492,27 @@ Window {
border.color: 'firebrick'
}
-// MapCircleObject {
-// id: circle1
-// border.color: 'deepskyblue'
-// border.width: 26
-// center: QtPositioning.coordinate(17, 44);
-// radius: 200*1000
-// color: "firebrick"
-// }
+ MapPolylineObject {
+ id: longPolyline
+ line.color: "firebrick"
+ objectName: parent.objectName + "longPolyline"
+ line.width: 10
+ path: longPolyPath
+ }
+
+ MapCircleObject {
+ id: circle1
+ border.color: 'deepskyblue'
+ border.width: 26
+ center: QtPositioning.coordinate(17, 44);
+ radius: 200*1000
+ color: "firebrick"
+ }
}
}
+ property var longPolyPath
+
C2.Slider {
id: sliRadius
orientation: Qt.Vertical
diff --git a/tests/manual/mapobjects_tester/qml.qrc b/tests/manual/mapobjects_tester/qml.qrc
index 5f6483ac..3a8a697d 100644
--- a/tests/manual/mapobjects_tester/qml.qrc
+++ b/tests/manual/mapobjects_tester/qml.qrc
@@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/">
<file>main.qml</file>
+ <file alias="LongPolyline.qml">../mappolyline_tester/LongPolyline.qml</file>
</qresource>
</RCC>