diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/api/GPS.qml | 8 | ||||
-rw-r--r-- | app/map/MapComponent.qml | 11 | ||||
-rw-r--r-- | app/mapviewer.qrc | 1 | ||||
-rw-r--r-- | app/resources/car.png | bin | 0 -> 78074 bytes |
4 files changed, 17 insertions, 3 deletions
diff --git a/app/api/GPS.qml b/app/api/GPS.qml index 8a2ebb9..679c66e 100644 --- a/app/api/GPS.qml +++ b/app/api/GPS.qml @@ -56,13 +56,17 @@ WebSocket { var payload = JSON.parse(JSON.stringify(json[2])) var event = payload.event if (event == "gps/location") { - var latitude = json[2].data.latitude - var longitude = json[2].data.longitude + var data = json[2].data + var latitude = data.latitude + var longitude = data.longitude var location = QtPositioning.coordinate(latitude, longitude) if (map.followme || !map.location) { map.center = location } map.location = location + if (data.speed > 1) { + map.updateCompass(data.track) + } } break } diff --git a/app/map/MapComponent.qml b/app/map/MapComponent.qml index 84ee7fe..161038c 100644 --- a/app/map/MapComponent.qml +++ b/app/map/MapComponent.qml @@ -267,6 +267,10 @@ Map { //! [geocode1] } + function updateCompass(heading) + { + compass.rotation = heading - 90 + } //! [coord] zoomLevel: (maximumZoomLevel - minimumZoomLevel)/2 @@ -335,7 +339,12 @@ Map { MapQuickItem { id: locationPoint - sourceItem: Rectangle { width: 14; height: 14; color: "#e41e25"; border.width: 2; border.color: "white"; smooth: true; radius: 7 } + sourceItem: Image { + id: compass + width: 100 * (map.zoomLevel / map.maximumZoomLevel) + height: 50 * (map.zoomLevel / map.maximumZoomLevel) + source: "../resources/car.png" + } coordinate: location opacity: 1.0 anchorPoint: Qt.point(sourceItem.width/2, sourceItem.height/2) diff --git a/app/mapviewer.qrc b/app/mapviewer.qrc index b039234..d0a9013 100644 --- a/app/mapviewer.qrc +++ b/app/mapviewer.qrc @@ -30,6 +30,7 @@ <file>menus/MarkerPopupMenu.qml</file> <file>menus/ItemPopupMenu.qml</file> <file>helper.js</file> + <file>resources/car.png</file> <file>resources/scale_end.png</file> <file>resources/scale.png</file> <file>resources/marker.png</file> diff --git a/app/resources/car.png b/app/resources/car.png Binary files differnew file mode 100644 index 0000000..0a8195e --- /dev/null +++ b/app/resources/car.png |