-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.qml
173 lines (151 loc) · 5.64 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
169
170
171
172
173
import QtQuick 2.0
import QtQuick.Window 2.14
import QtQuick.Controls 1.4
import QtLocation 5.15
import QtPositioning 5.6
import io.qt.examples.gps_data 1.0
Window {
id: window
width: Qt.platform.os == "android" ? Screen.width : 512
height: Qt.platform.os == "android" ? Screen.height : 512
visible: true
GPSData {
id: gpsData
}
GroundControlStation {
id: groundControlStation
}
CustomCursor {
id: customCursor
}
Map {
id: map
anchors.fill: parent
plugin: Plugin {
id: mapPlugin
name: "osm"
PluginParameter {
name: "osm.mapping.offline.directory"
value: ":/Offline_tiles/"
}
}
center: QtPositioning.coordinate(gpsData.longitude, gpsData.latitude)
zoomLevel: 1
MapQuickItem {
id: gpsCursor
sourceItem: Rectangle { width: 20; height: 20; color: "red"; border.width: 2; border.color: "black"; smooth: true; radius: 15 }
coordinate : QtPositioning.coordinate(gpsData.longitude, gpsData.latitude)
opacity: 1.0
anchorPoint: Qt.point(sourceItem.width/2, sourceItem.height/2)
visible: gpsData.hasFix
}
MapQuickItem {
id: flyingObjectCursor
sourceItem: Rectangle { width: 20; height: 20; color: "blue"; border.width: 2; border.color: "black"; smooth: true; radius: 15 }
coordinate : QtPositioning.coordinate(groundControlStation.flyingObjectLatitude, groundControlStation.flyingObjectLongitude)
opacity: 1.0
anchorPoint: Qt.point(sourceItem.width/2, sourceItem.height/2)
visible: true
}
MapQuickItem {
id: customCursorIcon
sourceItem: Rectangle { width: 20; height: 20; color: "yellow"; border.width: 2; border.color: "black"; smooth: true; radius: 15 }
coordinate : QtPositioning.coordinate(customCursor.latitude, customCursor.longitude)
opacity: 1.0
anchorPoint: Qt.point(sourceItem.width/2, sourceItem.height/2)
visible: customCursor.latitudeIsSet && customCursor.longitudeIsSet
}
}
Rectangle {
id: gpsDataRectangle
width: 200; height: 235
color: "#FFD2D2D2"
opacity: 0.75
x: 5; y: 5
border.color: "black"
Rectangle {
id: gpsDataSection
anchors.left: gpsDataRectangle.left; anchors.leftMargin: 5
anchors.right: parent.right; anchors.rightMargin: 5
height: 150
color: "transparent"
Text {
id: gpsDataSectionTitle
text: "GPS data"
font.pointSize: 13; font.bold: true
anchors.top: gpsDataSection.top
anchors.horizontalCenter: parent.horizontalCenter
}
Text {
id: longitude
text: "Longitude: " + (gpsData.longitude).toFixed(5) + "°"
font.pointSize: 11;
anchors.top: gpsDataSectionTitle.bottom
}
Text {
id: latitude
text: "Latitude: " + (gpsData.latitude).toFixed(5) + "°"
font.pointSize: 11;
anchors.top: longitude.bottom
}
Text {
id: altitude
text: "Altitude: " + gpsData.altitude + "m"
font.pointSize: 11;
anchors.top: latitude.bottom
}
Text {
id: time
text: "UTC Time: " + gpsData.hour.valueOf() + ":" + gpsData.minute.valueOf() + ":" + gpsData.second.valueOf()
font.pointSize: 11;
anchors.top: altitude.bottom
}
Text {
id: hasFix
text: "Has fix: " + gpsData.hasFix
font.pointSize: 11;
anchors.top: time.bottom
}
}
Rectangle {
id: customCursorSection
anchors.top: gpsDataSection.bottom
anchors.left: parent.left; anchors.leftMargin: 5
anchors.right: parent.right
Text {
id: customCursorSectionTitle
text: "Custom cursor"
font.pointSize: 13; font.bold: true
anchors.top: customCursorSection.top
anchors.horizontalCenter: parent.horizontalCenter
}
Text {
id: latitudeLabel
text: "Lat: "
font.pointSize: 11;
anchors.top: customCursorSectionTitle.bottom
}
TextField {
placeholderText: qsTr("Latitude ...")
anchors.top: latitudeLabel.top
anchors.left: latitudeLabel.right
anchors.right: customCursorSection.right; anchors.rightMargin: 5
onEditingFinished: text !== "" ? customCursor.latitude = text : customCursor.latitudeIsSet = false
}
Text {
id: longitudeLabel
text: "Long: "
font.pointSize: 11;
anchors.top: latitudeLabel.bottom
anchors.topMargin: 5
}
TextField {
placeholderText: qsTr("Longitude ...")
anchors.top: longitudeLabel.top
anchors.left: longitudeLabel.right;
anchors.right: customCursorSection.right; anchors.rightMargin: 5
onEditingFinished: text !== "" ? customCursor.longitude = text : customCursor.longitudeIsSet = false
}
}
}
}