aboutsummaryrefslogtreecommitdiff
path: root/src/MainMapView.qml
diff options
context:
space:
mode:
authorArseniy Movshev <dodoradio@outlook.com>2022-11-27 20:25:43 +0000
committerArseniy Movshev <dodoradio@outlook.com>2023-01-07 15:46:45 +0000
commit452a1a4d5784cfc191485f4e77133ef3090ee693 (patch)
tree98cc099e6000848b034a58a2cedbdf86af6379bd /src/MainMapView.qml
parentde2b3d293d97eb85dc920e6facec684e79c69d43 (diff)
changes to compass, overlays and waypoints
a very messy commit: - add waypoints to show up on the map - fix compass to work correctly - fix centering of buttons on flat tyre watches
Diffstat (limited to '')
-rw-r--r--src/MainMapView.qml50
1 files changed, 45 insertions, 5 deletions
diff --git a/src/MainMapView.qml b/src/MainMapView.qml
index 5042d24..00f0ef2 100644
--- a/src/MainMapView.qml
+++ b/src/MainMapView.qml
@@ -3,26 +3,40 @@ 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/zoomlevel"
+ key: "/map/view/zoomlevel"
defaultValue: 3.4
}
ConfigurationValue {
id: mapCenterLat
- key: "/map/location/lat"
- defaultValue: 0
+ key: "/map/view/location/lat"
+ defaultValue: ""
}
ConfigurationValue {
id: mapCenterLong
- key: "/map/location/long"
+ 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()
+ Component.onCompleted: mapView.updateWaypoints()
+ }
+
Label {
text: "Map Data from OpenStreetMap"
- font.pixelSize: parent.width*0.02
+ font.pixelSize: parent.width*0.03
anchors.centerIn: parent
z: 0
}
@@ -42,6 +56,27 @@ Item {
center = positionProvider.position.coordinate
}
}
+ Connections {
+ target: compass
+ function onReadingChanged() {
+ if (compassMode.value == 2) {
+ mapView.bearing = compass.reading.azimuth
+ }
+ }
+ }
+ property MapQuickItem mapItem
+ function updateWaypoints() {
+ 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]
+ mapView.addMapItem(mapItem)
+ }
+ }
}
DefaultMapControls {
id: mapControls
@@ -58,6 +93,11 @@ Item {
}
}
Component {
+ id: waypoint
+ MapWaypoint {
+ }
+ }
+ Component {
id: setPointPage
SetPointPage {
}