blob: 40c42c847fbc58ceba00d2abbfdeb0e81e052820 (
plain)
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
|
import QtQuick 2.0
import org.asteroid.controls 1.0
import Nemo.Configuration 1.0
import QtPositioning 5.15
import QtLocation 5.15
import QtSensors 5.3
Item {
ConfigurationValue {
id: mapZoom
key: "/map/view/zoomlevel"
defaultValue: 3.4
}
ConfigurationValue {
id: mapCenterLat
key: "/map/view/location/lat"
defaultValue: ""
}
ConfigurationValue {
id: mapCenterLong
key: "/map/view/location/long"
defaultValue: ""
}
ConfigurationValue {
id: compassMode
key: "/map/view/compassMode"
defaultValue: 0
}
ConfigurationValue {
id: waypointSource
key: "/map/waypointList"
defaultValue: ""
onValueChanged: {
mapView.updateWaypoints()
console.log("value changed")
}
Component.onCompleted: mapView.updateWaypoints()
}
Label {
text: "Map Data from OpenStreetMap"
font.pixelSize: parent.width*0.03
anchors.centerIn: parent
z: 0
}
Map {
id: mapView
plugin: mapProvider
anchors.fill: parent
copyrightsVisible: false //this is compensated by showing the copyright when application is loading
color: "#00000000"
z: 1
Component.onCompleted: { zoomLevel = mapZoom.value; center.latitude = mapCenterLat.value; center.longitude = mapCenterLong.value; console.log(mapCenterLat.value,mapCenterLong.value)}
onZoomLevelChanged: mapZoom.value = zoomLevel
onCenterChanged: {mapCenterLat.value = center.latitude; mapCenterLong.value = center.longitude; console.log(center)}
Connections {
target: positionProvider
function onPositionChanged() {
mapView.center = positionProvider.position.coordinate
}
}
Connections {
target: compass
function onReadingChanged() {
if (compassMode.value == 2) {
mapView.bearing = compass.reading.azimuth
}
}
}
property MapQuickItem mapItem
function updateWaypoints() {
console.log("waypoints updated")
var waypointsList = waypointSource.value.split(">")
for(var i = 0, size = waypointsList.length-1; i < size ; i++){
var currWaypointData = waypointsList[i].split(";")
var currWaypointCoord = currWaypointData[1].split(",")
mapItem = waypoint.createObject(mapView)
mapItem.coordinate = QtPositioning.coordinate(currWaypointCoord[0],currWaypointCoord[1])
mapItem.iconName = currWaypointData[0]
mapItem.iconColor = currWaypointData[2]
mapItem.index = i
mapView.addMapItem(mapItem)
}
}
}
DefaultMapControls {
id: mapControls
anchors.fill: parent
z: 2
}
SetPointMapControls {
id: setPointControls
anchors.fill: parent
visible: false
z: 2
function primaryButtonAction() {
pageStack.push(setPointPage,{coord: mapView.center})
}
}
function editWaypoint(number) {
console.log("invoking the edit page for waypoint number ", number)
}
Component {
id: waypoint
MapWaypoint {
}
}
Component {
id: setPointPage
SetPointPage {
}
}
}
|