-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.qml
169 lines (146 loc) · 4.44 KB
/
main.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
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.0
import QtLocation 5.3
import QtPositioning 5.8
import QtQuick.Window 2.2
import ru.indigosystem.mobile 1.0
ApplicationWindow {
visible: true
width: Screen.desktopAvailableWidth
height: Screen.desktopAvailableHeight
title: qsTr("Hello World")
id: mainWindow
ScoroNetwork {
id: scoronetwork
onRoutePointsChanged: {
console.log("route points received!")
routePolyline.path = []
var path = []
for (var i = 0; i < Object.keys(routePoints).length; i++) {
var key = String(i)
path.push(QtPositioning.coordinate(
routePoints[key][1],
routePoints[key][0]))
}
busUpdateTimer.running = true
routePolyline.path = path
routePolyline.update()
}
onRouteNameChanged: {
console.log("new route name: " + routeName)
scoronetwork.getRoutesAndPoints()
}
}
Plugin {
id: osmPlugin
name: "osm"
// specify plugin parameters if necessary
// PluginParameter {
// name:
// value:
// }
}
Map {
id: map
anchors.fill: parent
plugin: osmPlugin
center: QtPositioning.coordinate(47.229229, 38.912398) // Taganrog
zoomLevel: 12
Row {
id: topButtons
Button {
padding: 5
width: mainWindow.width / 5
id: route2
text: "2"
onClicked: {
scoronetwork.routeName = "2"
}
}
Button {
padding: 5
width: mainWindow.width / 5
id: route5
text: "5"
onClicked: {
scoronetwork.routeName = "5"
}
}
Button {
padding: 5
width: mainWindow.width / 5
id: route60
text: "60"
onClicked: {
scoronetwork.routeName = "60"
}
}
Button {
padding: 5
width: mainWindow.width / 5
id: route74
text: "74"
onClicked: {
scoronetwork.routeName = "74"
}
}
}
MapPolyline {
id: routePolyline
line.width: 3
line.color: 'green'
path: []
}
MapItemView {
id: busesView
model: scoronetwork.busModel
delegate: MapCircle {
id: point
radius: 100
color: "red"
border.color: "black"
border.width: 2
smooth: true
opacity: 0.8
center: QtPositioning.coordinate(latitude, longitude)
}
}
/*
MouseArea {
id: mouseArea
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
onDoubleClicked: {
var mouseGeoPos = map.toCoordinate(Qt.point(mouse.x, mouse.y))
var preZoomPoint = map.fromCoordinate(mouseGeoPos, false)
if (mouse.button === Qt.LeftButton) {
map.zoomLevel += 2
} else if (mouse.button === Qt.RightButton) {
map.zoomLevel -= 2
}
var postZoomPoint = map.fromCoordinate(mouseGeoPos, false)
var dx = postZoomPoint.x - preZoomPoint.x
var dy = postZoomPoint.y - preZoomPoint.y
var mapCenterPoint = Qt.point(map.width / 2.0 + dx,
map.height / 2.0 + dy)
map.center = map.toCoordinate(mapCenterPoint)
}
}
*/
}
function init() {
console.log("init called")
scoronetwork.routeName = "2"
}
Timer {
id: busUpdateTimer
interval: 5000
repeat: true
triggeredOnStart: true
onTriggered: {
//console.log("updateTimerTick")
scoronetwork.updateTimerTick()
}
}
}