6import QGroundControl.Controls
7import QGroundControl.FactControls
12 required property var missionController
14 width: parent ? parent.width : 0
15 height: mainColumn.height + (_margins * 2)
16 color: QGroundControl.globalPalette.windowShadeDark
18 property real _margins: ScreenTools.defaultFontPixelWidth / 2
19 property real _textFieldWidth: ScreenTools.defaultFontPixelWidth * 20
20 property real _labelWidth: ScreenTools.defaultFontPixelWidth * 14
21 property bool _hasHome: missionController ? missionController.plannedHomePosition.isValid : false
23 TransformPositionController {
24 id: positionController
25 Component.onCompleted: {
27 coordinate = _root.missionController.plannedHomePosition
34 target: _root.missionController
35 function onPlannedHomePositionChanged() {
36 positionController.coordinate = _root.missionController.plannedHomePosition
37 positionController.initValues()
43 anchors.left: parent.left
44 anchors.right: parent.right
45 anchors.top: parent.top
46 anchors.margins: _margins
47 spacing: ScreenTools.defaultFontPixelHeight * 0.5
49 // ── Offset Mission ──
52 Layout.fillWidth: true
53 text: qsTr("Offset Mission")
58 Layout.fillWidth: true
60 visible: offsetSection.checked
62 LabelledFactTextField {
65 fact: positionController.offsetEast
66 textFieldPreferredWidth: _textFieldWidth
67 Layout.fillWidth: true
70 LabelledFactTextField {
73 fact: positionController.offsetNorth
74 textFieldPreferredWidth: _textFieldWidth
75 Layout.fillWidth: true
78 LabelledFactTextField {
81 fact: positionController.offsetUp
82 textFieldPreferredWidth: _textFieldWidth
83 Layout.fillWidth: true
87 id: offsetTakeoffCheck
88 text: qsTr("Also move takeoff items")
92 id: offsetLandingCheck
93 text: qsTr("Also move landing items")
97 Layout.fillWidth: true
98 Layout.maximumWidth: _labelWidth + _textFieldWidth
99 wrapMode: Text.WordWrap
100 font.pointSize: ScreenTools.smallFontPointSize
101 text: qsTr("Note: Home altitude is not modified.")
105 Layout.alignment: Qt.AlignHCenter
106 text: qsTr("Apply Offset")
107 enabled: !eastField.textField.validationError
108 && !northField.textField.validationError
109 && !upField.textField.validationError
112 _root.missionController.offsetMission(
113 positionController.offsetEast.rawValue,
114 positionController.offsetNorth.rawValue,
115 positionController.offsetUp.rawValue,
116 offsetTakeoffCheck.checked,
117 offsetLandingCheck.checked
123 // ── Reposition Mission ──
125 id: repositionSection
126 Layout.fillWidth: true
127 text: qsTr("Reposition Mission")
132 id: repositionContent
133 Layout.fillWidth: true
135 visible: repositionSection.checked
138 Layout.fillWidth: true
139 wrapMode: Text.WordWrap
140 font.pointSize: ScreenTools.smallFontPointSize
141 text: qsTr("Home position must be set to reposition the mission.")
145 property bool _showGeographic: coordinateSystemCombo.currentIndex === 0
146 property bool _showUTM: coordinateSystemCombo.currentIndex === 1
147 property bool _showMGRS: coordinateSystemCombo.currentIndex === 2
148 property bool _showVehicle: coordinateSystemCombo.currentIndex === 3
151 Layout.fillWidth: true
155 text: qsTr("Coordinate System")
159 id: coordinateSystemCombo
160 Layout.fillWidth: true
161 model: globals.activeVehicle
162 ? [ qsTr("Geographic"), qsTr("Universal Transverse Mercator"), qsTr("Military Grid Reference"), qsTr("Vehicle Position") ]
163 : [ qsTr("Geographic"), qsTr("Universal Transverse Mercator"), qsTr("Military Grid Reference") ]
167 LabelledFactTextField {
169 label: qsTr("Latitude")
170 fact: positionController.latitude
171 textFieldPreferredWidth: _textFieldWidth
172 Layout.fillWidth: true
173 visible: repositionContent._showGeographic
176 LabelledFactTextField {
178 label: qsTr("Longitude")
179 fact: positionController.longitude
180 textFieldPreferredWidth: _textFieldWidth
181 Layout.fillWidth: true
182 visible: repositionContent._showGeographic
186 Layout.alignment: Qt.AlignHCenter
187 text: qsTr("Move to Position")
188 enabled: _hasHome && !latitudeField.textField.validationError && !longitudeField.textField.validationError
189 visible: repositionContent._showGeographic
191 positionController.setFromGeo()
192 _root.missionController.repositionMission(positionController.coordinate)
196 LabelledFactTextField {
199 fact: positionController.zone
200 textFieldPreferredWidth: _textFieldWidth
201 Layout.fillWidth: true
202 visible: repositionContent._showUTM
205 LabelledFactComboBox {
206 label: qsTr("Hemisphere")
207 fact: positionController.hemisphere
209 Layout.fillWidth: true
210 visible: repositionContent._showUTM
213 LabelledFactTextField {
215 label: qsTr("Easting")
216 fact: positionController.easting
217 textFieldPreferredWidth: _textFieldWidth
218 Layout.fillWidth: true
219 visible: repositionContent._showUTM
222 LabelledFactTextField {
224 label: qsTr("Northing")
225 fact: positionController.northing
226 textFieldPreferredWidth: _textFieldWidth
227 Layout.fillWidth: true
228 visible: repositionContent._showUTM
232 Layout.alignment: Qt.AlignHCenter
233 text: qsTr("Move to Position")
234 enabled: _hasHome && !zoneField.textField.validationError && !eastingField.textField.validationError && !northingField.textField.validationError
235 visible: repositionContent._showUTM
237 positionController.setFromUTM()
238 _root.missionController.repositionMission(positionController.coordinate)
242 LabelledFactTextField {
245 fact: positionController.mgrs
246 textFieldPreferredWidth: _textFieldWidth
247 Layout.fillWidth: true
248 visible: repositionContent._showMGRS
252 Layout.alignment: Qt.AlignHCenter
253 text: qsTr("Move to Position")
254 enabled: _hasHome && !mgrsField.textField.validationError
255 visible: repositionContent._showMGRS
257 positionController.setFromMGRS()
258 _root.missionController.repositionMission(positionController.coordinate)
263 Layout.alignment: Qt.AlignHCenter
264 text: qsTr("Move to Vehicle Position")
266 visible: repositionContent._showVehicle
268 positionController.setFromVehicle()
269 _root.missionController.repositionMission(positionController.coordinate)
274 // ── Rotate Mission ──
277 Layout.fillWidth: true
278 text: qsTr("Rotate Mission")
283 Layout.fillWidth: true
285 visible: rotateSection.checked
288 Layout.fillWidth: true
289 wrapMode: Text.WordWrap
290 font.pointSize: ScreenTools.smallFontPointSize
291 text: qsTr("Home position must be set to rotate the mission.")
295 LabelledFactTextField {
297 label: qsTr("Clockwise")
298 fact: positionController.rotateDegreesCW
299 textFieldPreferredWidth: _textFieldWidth
300 Layout.fillWidth: true
304 id: rotateTakeoffCheck
305 text: qsTr("Also move takeoff items")
309 id: rotateLandingCheck
310 text: qsTr("Also move landing items")
314 Layout.fillWidth: true
315 Layout.maximumWidth: _labelWidth + _textFieldWidth
316 wrapMode: Text.WordWrap
317 font.pointSize: ScreenTools.smallFontPointSize
318 text: qsTr("Note: Complex items are rotated by moving their reference coordinate: their geometry and orientation are not changed.")
322 Layout.alignment: Qt.AlignHCenter
323 text: qsTr("Apply Rotation")
324 enabled: _hasHome && !degreesCWField.textField.validationError
327 _root.missionController.rotateMission(
328 positionController.rotateDegreesCW.rawValue,
329 rotateTakeoffCheck.checked,
330 rotateLandingCheck.checked