add aw navigation
[apps/navigation.git] / app / BtnGuidance.qml
diff --git a/app/BtnGuidance.qml b/app/BtnGuidance.qml
new file mode 100644 (file)
index 0000000..18efd9f
--- /dev/null
@@ -0,0 +1,128 @@
+import QtQuick 2.0\r
+import QtQuick.Controls 1.5\r
+import QtLocation 5.9\r
+import QtPositioning 5.6\r
+\r
+Item {\r
+    id: btn_guidance\r
+\r
+    // 0: idle\r
+    // 1: routing\r
+    // 2: on guide\r
+    property int sts_guide: 0\r
+\r
+    onSts_guideChanged: {\r
+        console.log("onSts_guideChanged")\r
+        switch(btn_guidance.sts_guide){\r
+        case 0:\r
+            positionTimer.stop();\r
+            break\r
+        case 1:\r
+            break\r
+        case 2:\r
+            positionTimer.start();\r
+            break\r
+        default:\r
+            break\r
+        }\r
+    }\r
+\r
+    function startGuidance() {\r
+        btn_present_position.state = "Flowing"\r
+        btn_guidance.sts_guide = 2\r
+        btn_guidance.state = "onGuide"\r
+    }\r
+\r
+    function discardWaypoints() {\r
+        map.initDestination()\r
+\r
+        if(btn_guidance.sts_guide != 0){\r
+            map.qmlSignalStopDemo()\r
+        }\r
+\r
+        if(map.center !== map.currentpostion){\r
+            btn_present_position.state = "Optional"\r
+        }\r
+\r
+        btn_guidance.sts_guide = 0\r
+        btn_guidance.state = "Idle"\r
+    }\r
+\r
+    Timer {\r
+        id: positionTimer\r
+        interval: fileOperation.getInterval() // set millisecond\r
+        running: false\r
+        repeat: true\r
+        onTriggered: map.updatePositon()\r
+    }\r
+\r
+    Button {\r
+        id: discard\r
+        width: 100\r
+        height: 100\r
+\r
+        visible: false\r
+\r
+        onClicked: discardWaypoints()\r
+\r
+        Image {\r
+            id: discard_image\r
+            width: 92\r
+            height: 92\r
+            anchors.verticalCenter: parent.verticalCenter\r
+            anchors.horizontalCenter: parent.horizontalCenter\r
+            source: "images/200px-Black_close_x.svg.png"\r
+        }\r
+    }\r
+\r
+    Button {\r
+        id: guidance\r
+               width: 100\r
+               height: 100\r
+\r
+        visible: false\r
+\r
+        onClicked: { startGuidance() }\r
+\r
+               Image {\r
+            id: guidance_image\r
+                       width: 92\r
+                       height: 92\r
+                       anchors.verticalCenter: parent.verticalCenter\r
+                       anchors.horizontalCenter: parent.horizontalCenter\r
+            source: "images/124px-Pictograms-nps-land-driving_tour-2.svg.png"\r
+               }\r
+\r
+       }\r
+    states: [\r
+        State {\r
+            name: "Idle"\r
+            PropertyChanges { target: discard; visible: false }\r
+            PropertyChanges { target: guidance; visible: false }\r
+            PropertyChanges { target: guidance; x: 0 }\r
+            PropertyChanges { target: progress_next_cross; state: "invisible" }\r
+            PropertyChanges { target: img_destination_direction; state: "invisible" }\r
+        },\r
+        State {\r
+            name: "Routing"\r
+            PropertyChanges { target: discard; visible: true }\r
+            PropertyChanges { target: guidance; visible: true }\r
+            PropertyChanges { target: guidance; x: -150 }\r
+            PropertyChanges { target: progress_next_cross; state: "invisible" }\r
+            PropertyChanges { target: img_destination_direction; state: "invisible" }\r
+        },\r
+        State {\r
+            name: "onGuide"\r
+            PropertyChanges { target: discard; visible: true }\r
+            PropertyChanges { target: guidance; visible: false }\r
+            PropertyChanges { target: guidance; x: 0 }\r
+            PropertyChanges { target: progress_next_cross; state: "visible" }\r
+            PropertyChanges { target: img_destination_direction; state: "0" }\r
+        }\r
+    ]\r
+\r
+    transitions: Transition {\r
+        NumberAnimation { properties: "x"; easing.type: Easing.InOutQuad }\r
+        NumberAnimation { properties: "visible"; easing.type: Easing.InOutQuad }\r
+    }\r
+}\r