You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
116 lines
3.0 KiB
QML
116 lines
3.0 KiB
QML
4 years ago
|
import QtQuick 2.12
|
||
|
import QtQuick.Controls 2.5
|
||
|
import QtLocation 5.15
|
||
|
|
||
|
import QtPositioning 5.5
|
||
|
|
||
|
|
||
|
|
||
|
ApplicationWindow {
|
||
|
width: 640
|
||
|
height: 480
|
||
|
visible: true
|
||
|
title: qsTr("Pick a location")
|
||
|
id: root
|
||
|
signal selected()
|
||
|
|
||
|
PositionSource {
|
||
|
id: positionSource
|
||
|
}
|
||
|
|
||
|
function getSelectedLocation(){
|
||
|
return marker.coordinate.latitude + "|" + marker.coordinate.longitude
|
||
|
}
|
||
|
|
||
|
|
||
|
Plugin {
|
||
|
id: mapPlugin
|
||
|
name: "mapboxgl" // "mapboxgl", "esri", ...
|
||
|
// specify plugin parameters if necessary
|
||
|
PluginParameter {
|
||
|
name: "access_token"
|
||
|
value: "pk.eyJ1Ijoia3ViYS1vcmxpayIsImEiOiJja2plYzc3bjYyaW8yMnhydXNsY2FxdTFhIn0.Qi8QihmbMcxfvoOXaQ7PxQ"
|
||
|
}
|
||
|
}
|
||
|
|
||
|
Map {
|
||
|
anchors.fill: parent
|
||
|
plugin: mapPlugin
|
||
|
id: map
|
||
|
center: QtPositioning.coordinate(52.397445910207296, 16.90215638925963) // Poznań
|
||
|
zoomLevel: 14
|
||
|
|
||
|
MapParameter {
|
||
|
type: "layer"
|
||
|
|
||
|
property var name: "trees"
|
||
|
property var source: "trees-source"
|
||
|
property var layerType: "circle"
|
||
|
property var minzoom: 15.0
|
||
|
}
|
||
|
|
||
|
MapParameter {
|
||
|
type: "paint"
|
||
|
|
||
|
property var layer: "trees"
|
||
|
property var circleRadius: 3
|
||
|
property var circleColor: "#223b53"
|
||
|
property var circleStrokeColor: "white"
|
||
|
property var circleStrokeWidth: 1
|
||
|
property var circleOpacity: 1
|
||
|
}
|
||
|
|
||
|
|
||
|
MapParameter {
|
||
|
type: "layer"
|
||
|
|
||
|
property var name: "3d-buildings"
|
||
|
property var source: "composite"
|
||
|
property var sourceLayer: "building"
|
||
|
property var layerType: "fill-extrusion"
|
||
|
property var minzoom: 15.0
|
||
|
}
|
||
|
|
||
|
MapParameter {
|
||
|
type: "filter"
|
||
|
|
||
|
property var layer: "3d-buildings"
|
||
|
property var filter: [ "==", "extrude", "true" ]
|
||
|
}
|
||
|
|
||
|
MapParameter {
|
||
|
type: "paint"
|
||
|
|
||
|
property var layer: "3d-buildings"
|
||
|
property var fillExtrusionColor: "#aaaaaa"
|
||
|
property var fillExtrusionOpacity: .6
|
||
|
property var fillExtrusionHeight: { return { type: "identity", property: "height" } }
|
||
|
property var fillExtrusionBase: { return { type: "identity", property: "min_height" } }
|
||
|
}
|
||
|
|
||
|
MapQuickItem {
|
||
|
id:marker
|
||
|
sourceItem: Image{
|
||
|
id: image
|
||
|
source: "pin64.png"
|
||
|
width: 32
|
||
|
height: 32
|
||
|
}
|
||
|
coordinate: map.center
|
||
|
anchorPoint.x: image.width / 2
|
||
|
anchorPoint.y: image.height
|
||
|
}
|
||
|
|
||
|
MouseArea {
|
||
|
anchors.fill: parent
|
||
|
onClicked: {
|
||
|
marker.coordinate = map.toCoordinate(Qt.point(mouse.x,mouse.y))
|
||
|
}
|
||
|
onDoubleClicked: {
|
||
|
marker.coordinate = map.toCoordinate(Qt.point(mouse.x,mouse.y))
|
||
|
root.selected()
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|