From 31a4cd81829e4a95b76d6cbebd9e069ae16943f8 Mon Sep 17 00:00:00 2001 From: Matt Ranostay Date: Tue, 14 Nov 2017 20:53:42 -0800 Subject: navigation: gps: add gps geolocation support Use GPS binding to get current location for navigation Bug-AGL: SPEC-1068 Change-Id: Ie708117499b342f86c60674c83f0222857a67bee Signed-off-by: Matt Ranostay --- app/map/MapComponent.qml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'app/map/MapComponent.qml') diff --git a/app/map/MapComponent.qml b/app/map/MapComponent.qml index b4bb330..ce669ff 100644 --- a/app/map/MapComponent.qml +++ b/app/map/MapComponent.qml @@ -38,7 +38,9 @@ ** ****************************************************************************/ import QtQuick 2.5 +import QtQuick.Layouts 1.3 import QtQuick.Controls 1.4 +import QtQuick.Extras 1.4 import QtLocation 5.6 import QtPositioning 5.5 import "../helper.js" as Helper @@ -267,20 +269,17 @@ Map { // Enable pan, flick, and pinch gestures to zoom in and out gesture.acceptedGestures: MapGestureArea.PanGesture | MapGestureArea.FlickGesture | MapGestureArea.PinchGesture gesture.flickDeceleration: 3000 - gesture.enabled: true + gesture.enabled: !map.followme //! [mapnavigation] focus: true onCopyrightLinkActivated: Qt.openUrlExternally(link) onCenterChanged:{ scaleTimer.restart() - if (map.followme) - if (map.center != positionSource.position.coordinate) map.followme = false } onZoomLevelChanged:{ scaleTimer.restart() - if (map.followme) map.center = positionSource.position.coordinate } onWidthChanged:{ @@ -324,19 +323,9 @@ Map { Binding { target: map property: 'center' - value: positionSource.position.coordinate when: followme }*/ - PositionSource{ - id: positionSource - active: followme - - onPositionChanged: { - map.center = positionSource.position.coordinate - } - } - MapQuickItem { id: locationPoint sourceItem: Rectangle { width: 14; height: 14; color: "#e41e25"; border.width: 2; border.color: "white"; smooth: true; radius: 7 } @@ -368,6 +357,17 @@ Map { width: 300 height: 300 + ToggleButton { + id: followme + text: "GeoLocation Pan" + checked: map.followme + Layout.fillWidth: true + Layout.fillHeight: true + onClicked: { + map.followme = !map.followme + } + } + Button { text: "Lookup Route" Layout.fillWidth: true -- cgit 1.2.3-korg