diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/location/geojson_viewer/GeoJsonDelegate.qml | 12 | ||||
-rw-r--r-- | examples/location/geojson_viewer/main.qml | 23 |
2 files changed, 29 insertions, 6 deletions
diff --git a/examples/location/geojson_viewer/GeoJsonDelegate.qml b/examples/location/geojson_viewer/GeoJsonDelegate.qml index ff0fbffa..afbafe95 100644 --- a/examples/location/geojson_viewer/GeoJsonDelegate.qml +++ b/examples/location/geojson_viewer/GeoJsonDelegate.qml @@ -51,14 +51,15 @@ import QtQuick 2.12 import QtPositioning 5.12 -import QtLocation 5.12 +import QtLocation 5.15 import Qt.labs.qmlmodels 1.0 DelegateChooser { id: dc role: "type" property color defaultColor: "grey" - property real defaultOpacity: 0.7 + property real defaultOpacity: 0.6 + property bool openGLBackends: false DelegateChoice { roleValue: "Point" @@ -82,8 +83,9 @@ DelegateChooser { delegate: MapPolyline { property string geojsonType: "LineString" property var props: modelData.properties + backend: (dc.openGLBackends) ? MapPolyline.OpenGLExtruded : MapPolyline.Software geoShape: modelData.data - line.width: 3 + line.width: 4 opacity: dc.defaultOpacity line.color: (props && props.color) || (parent && parent.props && parent.props.color) || dc.defaultColor } @@ -97,7 +99,9 @@ DelegateChooser { geoShape: modelData.data opacity: dc.defaultOpacity color: (props && props.color) || (parent && parent.props && parent.props.color) || dc.defaultColor - border.width: 0 + border.width: 4 + border.color: 'black' + backend: (dc.openGLBackends) ? MapPolygon.OpenGL : MapPolygon.Software MouseArea { anchors.fill: parent onClicked: { diff --git a/examples/location/geojson_viewer/main.qml b/examples/location/geojson_viewer/main.qml index 01faef5f..b2fc3524 100644 --- a/examples/location/geojson_viewer/main.qml +++ b/examples/location/geojson_viewer/main.qml @@ -61,11 +61,13 @@ import Qt.labs.qmlmodels 1.0 import Qt.GeoJson 1.0 C1.ApplicationWindow { + id: win visible: true width: 1024 height: 1024 menuBar: mainMenu title: qsTr("GeoJSON Viewer") + property bool openGLBackends: glBackendSelector.checked FileDialog { visible: false @@ -141,6 +143,12 @@ C1.ApplicationWindow { geoJsoner.print(miv) } } + C1.MenuItem { + text: "&OpenGL Item backends" + id: glBackendSelector + checkable: true + checked: false + } } } @@ -149,17 +157,28 @@ C1.ApplicationWindow { id: geoJsoner } + Shortcut { + sequence: "Ctrl+P" + onActivated: { + + console.log("Center : QtPositioning.coordinate(",map.center.latitude,",",map.center.longitude,")") + console.log("Zoom : ",map.zoomLevel) + } + } + Map { id: map anchors.fill: parent center: QtPositioning.coordinate(43.59, 13.50) // Starting coordinates: Ancona, the city where I am studying :) - plugin: Plugin { name: "mapboxgl" } + plugin: Plugin { name: "osm" } zoomLevel: 4 MapItemView { id: miv model: geoJsoner.model - delegate: GeoJsonDelegate {} + delegate: GeoJsonDelegate { + openGLBackends: win.openGLBackends + } } } } |