blob: 45545eebb0716b69175f1e7632ce1536495f303a (
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
import QtQuick 2.0
import QtQuick.Controls 1.5
import QtLocation 5.9
import QtPositioning 5.6
Item {
id: btn_guidance
// 0: idle
// 1: routing
// 2: on guide
property int sts_guide: 0
property real total_distance: 0
onSts_guideChanged: {
console.log("onSts_guideChanged")
switch(btn_guidance.sts_guide){
case 0:
if (root.st_demo_state === true){
positionTimer.stop();
}
break
case 1:
break
case 2:
if (root.st_demo_state === true){
positionTimer.start();
}
break
default:
break
}
}
function startGuidance() {
btn_present_position.state = "Flowing"
btn_guidance.sts_guide = 2
btn_guidance.state = "onGuide"
map.addStartPoint()
if (root.st_demo_state === false){
if (routeModel.count > 0){
for (var i = 0; i < routeModel.get(0).segments.length; i++)
{
btn_guidance.total_distance +=routeModel.get(0).segments[i].maneuver.distanceToNextInstruction
// console.log("navi: segmentcounter i:"+i+" distance:"+routeModel.get(0).segments[i].maneuver.distanceToNextInstruction)
}
// console.log("navi: segmentcounter total_distance"+btn_guidance.total_distance)
}
root.setdistance(btn_guidance.total_distance,0)
root.do_startguidance()
}
}
function stopGuidance() {
// map.initDestination(map.currentpostion)
map.resetDestination()
if(btn_guidance.sts_guide != 0){
root.do_stopdemo()
}
if(map.center !== map.currentpostion){
btn_present_position.state = "Optional"
}
btn_guidance.sts_guide = 0
btn_guidance.state = "Idle"
}
function discardWaypoints(startFromCurrentPosition) {
if (startFromCurrentPosition === undefined) startFromCurrentPosition = false
map.initDestination(startFromCurrentPosition)
if(btn_guidance.sts_guide != 0){
root.do_stopdemo()
}
if(map.center !== map.currentpostion){
btn_present_position.state = "Optional"
}
btn_guidance.sts_guide = 0
btn_guidance.state = "Idle"
if (root.st_demo_state === false){
root.setdistance(btn_guidance.total_distance,0)
root.do_cancelguidance()
}
}
Timer {
id: positionTimer
interval: fileOperation.getUpdateInterval();
running: false;
repeat: true
onTriggered: map.updateDemoPositon()
}
Button {
id: discard
width: 100
height: 100
visible: false
onClicked: discardWaypoints()
Image {
id: discard_image
width: 92
height: 92
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
source: "images/200px-Black_close_x.svg.png"
}
}
Button {
id: guidance
width: 100
height: 100
visible: false
onClicked: { startGuidance() }
Image {
id: guidance_image
width: 92
height: 92
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
source: "images/MUTCD_RS-113.svg"
}
}
states: [
State {
name: "Idle"
PropertyChanges { target: discard; visible: false }
PropertyChanges { target: guidance; visible: false }
PropertyChanges { target: guidance; x: 0 }
PropertyChanges { target: progress_next_cross; state: "invisible" }
PropertyChanges { target: img_destination_direction; state: "invisible" }
},
State {
name: "Routing"
PropertyChanges { target: discard; visible: true }
PropertyChanges { target: guidance; visible: true }
PropertyChanges { target: guidance; x: -150 }
PropertyChanges { target: progress_next_cross; state: "invisible" }
PropertyChanges { target: img_destination_direction; state: "invisible" }
},
State {
name: "onGuide"
PropertyChanges { target: discard; visible: true }
PropertyChanges { target: guidance; visible: false }
PropertyChanges { target: guidance; x: 0 }
PropertyChanges { target: progress_next_cross; state: "visible" }
PropertyChanges { target: img_destination_direction; state: "0" }
}
]
transitions: Transition {
NumberAnimation { properties: "x"; easing.type: Easing.InOutQuad }
NumberAnimation { properties: "visible"; easing.type: Easing.InOutQuad }
}
}
|