-
Notifications
You must be signed in to change notification settings - Fork 1
/
CustomerTrackPage.qml
271 lines (263 loc) · 8.3 KB
/
CustomerTrackPage.qml
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
import QtQuick 2.0
import QtQuick.Controls 1.3
import QtQuick.Controls.Styles 1.3
import QtPositioning 5.2
import QtLocation 5.3
Rectangle {
width: parent? parent.width : 500
height: parent? parent.height : 800
visible: true
Image {
visible: true
anchors.right: parent.right
anchors.rightMargin: page.width*0.05
anchors.bottom: parent.bottom
anchors.bottomMargin: page.width*0.05
width: page.width*.10
height: page.width*.10
source: "qrc:/images/logo.png"
asynchronous : true
}
Text {
id: customertrackWindowtitle
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: page.height * 0.05
text: "TRACK YOUR ORDER"
font.family: "Avenir"
font.letterSpacing: 2
}
Plugin {
id: osmplugin
name:"osm"
}
Address {
id: geocodeAddress
street: address_page_handler.street
city: address_page_handler.city
state: address_page_handler.state
country: address_page_handler.region
postalCode: address_page_handler.zip
}
Map {
id: map
plugin: osmplugin
zoomLevel: maximumZoomLevel
anchors.horizontalCenter: parent.horizontalCenter
y: page.height * 0.08
width: page.width * 0.8
height: page.width * 0.6
signal resetState()
center {
latitude: 22.336400
longitude: 114.265466
}
gesture.flickDeceleration: 3000
gesture.enabled: true
// ORIGIN POINT
MapCircle {
id: homecoordinates
center {
latitude: vendor_handler.latitude
longitude: vendor_handler.longitude
}
radius: if (map.zoomLevel < 13) {200} else {30}
color: "#3938FF" // Origin Point will be in blue
border.width: 2
border.color: "#000000"
opacity: 0.6
}
// DRONE POINT
MapCircle {
id: dronepoint
radius:
if (zoomSlider.value > 13) {5}
else if (zoomSlider.value = 13) {20}
else if (zoomSlider.value > 12 & zoomSlider.value < 13) {200}
else {1000}
color: "#FF0F47" // Shows drone point in red
opacity: 0.6
border.width: 2
border.color: "#000000"
center {
latitude: manual_control_handler.latitude
longitude: manual_control_handler.longitude
}
}
MapPolyline {
line.width: 3
line.color: "#000000"
path: [
{ latitude: vendor_handler.latitude, longitude: vendor_handler.longitude },
{ latitude: customerlat.text, longitude: customerlong.text }
]
}
Text {
id: customerlat
text: ""
visible: false
}
Text {
id: customerlong
text: ""
visible: false
}
GeocodeModel {
id: geocodeModel
plugin: osmplugin
autoUpdate: true
query: geocodeAddress
onLocationsChanged:
{
map.center.latitude = get(0).coordinate.latitude
map.center.longitude = get(0).coordinate.longitude
customerlat.text = get(0).coordinate.latitude
customerlong.text = get(0).coordinate.longitude
}
}
Component {
id: pointDelegate
// DESTINATION POINT
MapCircle {
id: destination_point
radius: if (map.zoomLevel < 13) {200} else {30}
color: "#C638FF"
border.color: "#000000"
opacity: 0.6
center {
latitude: customerlat.text
longitude: customerlong.text
}
}
}
MapItemView {
model: geocodeModel
delegate: pointDelegate
}
}
Slider {
id: zoomSlider;
anchors.right: parent.right
anchors.rightMargin: 15
anchors.top: parent.top
anchors.topMargin: map.y
height: map.height
value: 15
maximumValue: 19
minimumValue: 2
tickmarksEnabled: false
updateValueWhileDragging: true
visible: true
orientation: Qt.Vertical
onValueChanged: {
map.zoomLevel = value
map.state=""
map.resetState()
}
}
Text {
id: custtrackorderaddress
anchors.left: parent.left
anchors.leftMargin: 50
y: map.y + map.height + 20
width: 200
text: "Delivering to: " + '<br>' + address_page_handler.name + '<br>' + address_page_handler.street + '<br>'
+ address_page_handler.city + ", " + address_page_handler.state + " "+ address_page_handler.zip
font.family: "Avenir"
font.letterSpacing: 2
}
Text {
id: distancecustside
text: Math.floor(6371000*Math.acos(Math.sin(vendor_handler.latitude*0.0174532925) * Math.sin(customerlat.text*0.0174532925) + Math.cos(vendor_handler.latitude*0.0174532925) * Math.cos(customerlat.text*0.0174532925) * Math.cos (customerlong.text*0.0174532925 - vendor_handler.longitude*0.0174532925))) + " m"
visible: false
y: custtrackorderaddress.y + custtrackorderaddress.height + 20
}
Text {
y: custtrackorderaddress.y + custtrackorderaddress.height + 20
anchors.left: parent.left
anchors.leftMargin: 50
text: "Current Distance:"
font.family: "Avenir"
horizontalAlignment: Text.AlignHCenter
font.letterSpacing: 2
}
Text {
id: display_distancecustside
anchors.right: parent.right
anchors.rightMargin: 70
y: custtrackorderaddress.y + custtrackorderaddress.height + 20
text: distancecustside.text
font.family: "Avenir"
horizontalAlignment: Text.AlignHCenter
font.letterSpacing: 2
}
Text {
id: orderrecieved
y: display_distancecustside.y + display_distancecustside.height + 20
anchors.left: parent.left
anchors.leftMargin: 50
text: "Order Recieved"
font.family: "Avenir"
font.letterSpacing: 2
z: 10
}
Image {
id: orderrecieved_circle
y: orderrecieved.y - 5
height: orderrecieved.height + 10
width: orderrecieved.height + 10
anchors.right: parent.right
anchors.rightMargin: 70
source: "qrc:/images/checkgreen.png"
}
Text {
id: enroute
y: orderrecieved.y + orderrecieved.height + 20
anchors.left: parent.left
anchors.leftMargin: 50
text: "Order En Route"
font.family: "Avenir"
font.letterSpacing: 2
z: 10
}
Image {
id: enroutevalidation_circle
y: enroute.y - 5
height: enroute.height + 10
width: enroute.height + 10
anchors.right: parent.right
anchors.rightMargin: 70
source: if (vendor_handler.enroute == 1) {"qrc:/images/checkgreen.png"}
else {"qrc:/images/checkgrey.png"}
}
Text {
id: delivered2
y: enroute.y + enroute.height + 20
anchors.left: parent.left
anchors.leftMargin: 50
text: "Delivered"
font.family: "Avenir"
font.letterSpacing: 2
}
Image {
id: deliveredvalidation_circle
y: delivered2.y - 5
height: delivered2.height + 10
width: delivered2.height + 10
anchors.right: parent.right
anchors.rightMargin: 70
source:
if (Math.abs(customerlat.text - manual_control_handler.latitude) < 0.0002 & Math.abs(customerlong.text - manual_control_handler.longitude) < 0.0002) {"qrc:/images/checkgreen.png"}
else {"qrc:/images/checkgrey.png"}
}
Button {
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: page.height * 0.05
text: "Place another order"
onClicked:{
customer_track_page.visible = false
opening_page.visible = true
}
}
}