Newer
Older
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
/****************************************************************************
*
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import QtQuick 2.12
import QtQuick.Shapes 1.12
import QtQuick.Layouts 1.2
import QtCharts 2.3
import QGroundControl 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
Rectangle {
id: root
radius: ScreenTools.defaultFontPixelWidth * 0.5
color: qgcPal.window
opacity: 0.80
clip: true
property var missionController
signal setCurrentSeqNum(int seqNum)
property real _margins: ScreenTools.defaultFontPixelWidth / 2
property var _visualItems: missionController.visualItems
property real _altRange: _maxAMSLAltitude - _minAMSLAltitude
property real _indicatorSpacing: 5
property real _minAMSLAltitude: isNaN(missionController.minAMSLAltitude) ? 0 : missionController.minAMSLAltitude
property real _maxAMSLAltitude: isNaN(missionController.maxAMSLAltitude) ? 100 : missionController.maxAMSLAltitude
property real _missionDistance: isNaN(missionController.missionDistance) ? 100 : missionController.missionDistance
function yPosFromAlt(alt) {
var fullHeight = terrainProfileFlickable.height
return ((alt - _minAMSLAltitude) / _fullHeight) * _fullHeight
}
QGCPalette { id: qgcPal }
QGCLabel {
id: titleLabel
anchors.top: parent.bottom
width: parent.height
font.pointSize: ScreenTools.smallFontPointSize
text: qsTr("Height AMSL (%1)").arg(
QGroundControl.unitsConversion.appSettingsHorizontalDistanceUnitsString
)
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
horizontalAlignment: Text.AlignHCenter
rotation: -90
transformOrigin: Item.TopLeft
}
QGCFlickable {
id: terrainProfileFlickable
//anchors.margins: _margins
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.leftMargin: titleLabel.contentHeight
anchors.left: parent.left
anchors.right: parent.right
clip: true
Item {
height: terrainProfileFlickable.height
width: terrainProfileFlickable.width
ChartView {
id: chart
anchors.fill: parent
margins.top: 0
margins.right: 0
margins.bottom: 0
margins.left: 0
backgroundColor: "transparent"
legend.visible: false
antialiasing: true
ValueAxis {
id: axisX
min: 0
max: missionController.missionDistance
lineVisible: true
labelsFont.family: "Fixed"
labelsFont.pointSize: ScreenTools.smallFontPointSize
labelsColor: "white"
tickCount: 5
gridLineColor: "#44FFFFFF"
}
ValueAxis {
id: axisY
min: _minAMSLAltitude
max: _maxAMSLAltitude
lineVisible: true
labelsFont.family: "Fixed"
labelsFont.pointSize: ScreenTools.smallFontPointSize
labelsColor: "white"
tickCount: 4
gridLineColor: "#44FFFFFF"
}
LineSeries {
id: lineSeries
axisX: axisX
axisY: axisY
visible: true
XYPoint { x: 0; y: _minAMSLAltitude }
XYPoint { x: _missionDistance; y: _maxAMSLAltitude }
}
}
TerrainProfile {
id: terrainProfile
x: chart.plotArea.x
y: chart.plotArea.y
height: chart.plotArea.height
visibleWidth: chart.plotArea.width
missionController: root.missionController
Repeater {
model: missionController.visualItems
Item {
id: topLevelItem
anchors.fill: parent
visible: object.specifiesCoordinate && !object.standaloneCoordinate
Rectangle {
id: simpleItem
height: terrainProfile.height
width: 1
color: "white"
x: (object.distanceFromStart * terrainProfile.pixelsPerMeter)
visible: object.isSimpleItem || object.isSingleItem
MissionItemIndexLabel {
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
small: true
checked: object.isCurrentItem
label: object.abbreviation.charAt(0)
index: object.abbreviation.charAt(0) > 'A' && object.abbreviation.charAt(0) < 'z' ? -1 : object.sequenceNumber
onClicked: root.setCurrentSeqNum(object.sequenceNumber)
}
}
Rectangle {
id: complexItemEntry
height: terrainProfile.height
width: 1
color: "white"
x: (object.distanceFromStart * terrainProfile.pixelsPerMeter)
visible: complexItem.visible
MissionItemIndexLabel {
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
small: true
checked: object.isCurrentItem
index: object.sequenceNumber
onClicked: root.setCurrentSeqNum(object.sequenceNumber)
}
}
Rectangle {
id: complexItemExit
height: terrainProfile.height
width: 1
color: "white"
x: ((object.distanceFromStart + object.complexDistance) * terrainProfile.pixelsPerMeter)
visible: complexItem.visible
MissionItemIndexLabel {
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
small: true
checked: object.isCurrentItem
index: object.lastSequenceNumber
onClicked: root.setCurrentSeqNum(object.sequenceNumber)
}
}
Rectangle {
id: complexItem
anchors.bottom: parent.bottom
x: (object.distanceFromStart * terrainProfile.pixelsPerMeter)
width: complexItem.visible ? object.complexDistance * terrainProfile.pixelsPerMeter : 0
height: patternNameLabel.height
color: "green"
opacity: 0.5
visible: !object.isSimpleItem && !object.isSingleItem
QGCMouseArea {
anchors.fill: parent
onClicked: root.setCurrentSeqNum(object.sequenceNumber)
}
QGCLabel {
id: patternNameLabel
anchors.horizontalCenter: parent.horizontalCenter
text: complexItem.visible ? object.patternName : ""
}
}
}
}
}
}
}
}