-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmap.qml
156 lines (143 loc) · 4.87 KB
/
map.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
import QtQuick 2.0
import QtQuick.Controls 2.2
import QtQuick.Window 2.0
import QtLocation 5.9
import QtPositioning 5.5
Item {
id: myItem
Plugin {
id: mapPlugin
name: "mapboxgl"
}
Map {
id: map
objectName: "mapboxgl"
property double lat: 47.368649
property double lon: 8.5391825
visible: true
anchors.fill: parent
plugin: mapPlugin
center {
latitude: lat
longitude: lon
}
zoomLevel: 14
ListView {
height: 1
model: map
delegate: Text {
text: "Latitude: " + (center.latitude).toFixed(3) + " Longitude: " + (center.longitude).toFixed(3)
}
}
MouseArea{
id: mouseArea
property var positionRoot: map.toCoordinate(Qt.point(mouseX, mouseY))
anchors.fill: parent
onClicked: {
var component = Qt.createComponent("addAttribute.qml")
if (component.status === Component.Ready) {
var dialog = component.createObject(parent,{popupType: 1})
dialog.sqlPosition = positionRoot
dialog.show()
}
}
}
MapQuickItem {
id: marker
objectName: "marker"
visible: false
anchorPoint.x: 0.5 * image.width
anchorPoint.y: image.height
sourceItem: Image {
id: image
source: "icons/markerIcon.png"
MouseArea{
anchors.fill: parent
onClicked: {
ToolTip.timeout = 2000
ToolTip.visible = true
ToolTip.text = qsTr("Coordinates: %1, %2").arg(marker.coordinate.latitude).arg(marker.coordinate.longitude)
}
}
}
}
MapItemView {
model: markerModel
delegate: MapQuickItem{
anchorPoint: Qt.point(2.5, 2.5)
coordinate: QtPositioning.coordinate(markerPosition.x, markerPosition.y)
zoomLevel: 0
sourceItem: Column{
Image {
id: imag
source: "icons/markerIcon.png"
MouseArea{
anchors.fill: parent
onClicked: {
ToolTip.timeout = 2000
ToolTip.visible = true
ToolTip.text = qsTr("Coordinates: %1, %2".arg(markerPosition.x).arg(markerPosition.y))
}
}
}
Text {
text: markerTitle
font.bold: true
}
}
}
}
MapParameter {
type: "source"
property var name: "coordinates"
property var sourceType: "geojson"
property var data: '{ "type": "FeatureCollection", "features": \
[{ "type": "Feature", "properties": {}, "geometry": { \
"type": "LineString", "coordinates": [[ 8.541484, \
47.366850 ], [8.542171, 47.370018],[8.545561, 47.369233]]}}]}'
}
MapParameter {
type: "layer"
property var name: "layer"
property var layerType: "line"
property var source: "coordinates"
property var before: "road-label-small"
}
MapParameter {
objectName: "paint"
type: "paint"
property var layer: "layer"
property var lineColor: "black"
property var lineWidth: 8.0
}
MapParameter {
type: "layout"
property var layer: "layer"
property var lineJoin: "round"
property var lineCap: "round"
}
}
/* Canvas { //Create Grid
id: canvas
anchors.fill : parent
property int distance: 25
onPaint: {
var context = getContext("2d")
context.lineWidth = 1
context.strokeStyle = "black"
context.beginPath()
var gridRows = height/distance;
for(var i=0; i < gridRows+1; i++){
context.moveTo(0, distance*i);
context.lineTo(width, distance*i);
}
var gridColumns = width/distance
for(var j=0; j < gridColumns+1; j++){
context.moveTo(distance*j, 0);
context.lineTo(distance*j, height);
}
context.closePath()
context.stroke()
}
} */
}