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.windowPanel
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 _showDMS: coordinateSystemCombo.currentIndex === 1
147 property bool _showUTM: coordinateSystemCombo.currentIndex === 2
148 property bool _showMGRS: coordinateSystemCombo.currentIndex === 3
149 property bool _showVehicle: coordinateSystemCombo.currentIndex === 4
152 Layout.fillWidth: true
156 text: qsTr("Coordinate System")
160 id: coordinateSystemCombo
161 Layout.fillWidth: true
162 model: globals.activeVehicle
163 ? [ qsTr("Geographic"), qsTr("Degrees Minutes Seconds"), qsTr("Universal Transverse Mercator"), qsTr("Military Grid Reference"), qsTr("Vehicle Position") ]
164 : [ qsTr("Geographic"), qsTr("Degrees Minutes Seconds"), qsTr("Universal Transverse Mercator"), qsTr("Military Grid Reference") ]
166 Component.onCompleted: currentIndex = positionController.defaultCoordinateSystem
170 LabelledFactTextField {
172 label: qsTr("Latitude")
173 fact: positionController.latitude
174 textFieldPreferredWidth: _textFieldWidth
175 Layout.fillWidth: true
176 visible: repositionContent._showGeographic
179 LabelledFactTextField {
181 label: qsTr("Longitude")
182 fact: positionController.longitude
183 textFieldPreferredWidth: _textFieldWidth
184 Layout.fillWidth: true
185 visible: repositionContent._showGeographic
189 Layout.alignment: Qt.AlignHCenter
190 text: qsTr("Move to Position")
191 enabled: _hasHome && !latitudeField.textField.validationError && !longitudeField.textField.validationError
192 visible: repositionContent._showGeographic
194 positionController.setFromGeo()
195 _root.missionController.repositionMission(positionController.coordinate)
199 LabelledFactTextField {
201 label: qsTr("Latitude")
202 fact: positionController.latitudeDMS
203 textFieldPreferredWidth: _textFieldWidth
204 Layout.fillWidth: true
205 visible: repositionContent._showDMS
208 LabelledFactTextField {
209 id: longitudeDMSField
210 label: qsTr("Longitude")
211 fact: positionController.longitudeDMS
212 textFieldPreferredWidth: _textFieldWidth
213 Layout.fillWidth: true
214 visible: repositionContent._showDMS
218 Layout.alignment: Qt.AlignHCenter
219 text: qsTr("Move to Position")
221 visible: repositionContent._showDMS
223 if (positionController.setFromDMS())
224 _root.missionController.repositionMission(positionController.coordinate)
226 QGroundControl.showMessageDialog(_root, qsTr("Move to Position"), qsTr("Invalid coordinate. Check the entered values and try again."))
230 LabelledFactTextField {
233 fact: positionController.zone
234 textFieldPreferredWidth: _textFieldWidth
235 Layout.fillWidth: true
236 visible: repositionContent._showUTM
239 LabelledFactComboBox {
240 label: qsTr("Hemisphere")
241 fact: positionController.hemisphere
243 Layout.fillWidth: true
244 visible: repositionContent._showUTM
247 LabelledFactTextField {
249 label: qsTr("Easting")
250 fact: positionController.easting
251 textFieldPreferredWidth: _textFieldWidth
252 Layout.fillWidth: true
253 visible: repositionContent._showUTM
256 LabelledFactTextField {
258 label: qsTr("Northing")
259 fact: positionController.northing
260 textFieldPreferredWidth: _textFieldWidth
261 Layout.fillWidth: true
262 visible: repositionContent._showUTM
266 Layout.alignment: Qt.AlignHCenter
267 text: qsTr("Move to Position")
268 enabled: _hasHome && !zoneField.textField.validationError && !eastingField.textField.validationError && !northingField.textField.validationError
269 visible: repositionContent._showUTM
271 if (positionController.setFromUTM())
272 _root.missionController.repositionMission(positionController.coordinate)
274 QGroundControl.showMessageDialog(_root, qsTr("Move to Position"), qsTr("Invalid coordinate. Check the entered values and try again."))
278 LabelledFactTextField {
281 fact: positionController.mgrs
282 textFieldPreferredWidth: _textFieldWidth
283 Layout.fillWidth: true
284 visible: repositionContent._showMGRS
288 Layout.alignment: Qt.AlignHCenter
289 text: qsTr("Move to Position")
290 enabled: _hasHome && !mgrsField.textField.validationError
291 visible: repositionContent._showMGRS
293 if (positionController.setFromMGRS())
294 _root.missionController.repositionMission(positionController.coordinate)
296 QGroundControl.showMessageDialog(_root, qsTr("Move to Position"), qsTr("Invalid coordinate. Check the entered values and try again."))
301 Layout.alignment: Qt.AlignHCenter
302 text: qsTr("Move to Vehicle Position")
304 visible: repositionContent._showVehicle
306 positionController.setFromVehicle()
307 _root.missionController.repositionMission(positionController.coordinate)
312 // ── Rotate Mission ──
315 Layout.fillWidth: true
316 text: qsTr("Rotate Mission")
321 Layout.fillWidth: true
323 visible: rotateSection.checked
326 Layout.fillWidth: true
327 wrapMode: Text.WordWrap
328 font.pointSize: ScreenTools.smallFontPointSize
329 text: qsTr("Home position must be set to rotate the mission.")
333 LabelledFactTextField {
335 label: qsTr("Clockwise")
336 fact: positionController.rotateDegreesCW
337 textFieldPreferredWidth: _textFieldWidth
338 Layout.fillWidth: true
342 id: rotateTakeoffCheck
343 text: qsTr("Also move takeoff items")
347 id: rotateLandingCheck
348 text: qsTr("Also move landing items")
352 Layout.fillWidth: true
353 Layout.maximumWidth: _labelWidth + _textFieldWidth
354 wrapMode: Text.WordWrap
355 font.pointSize: ScreenTools.smallFontPointSize
356 text: qsTr("Note: Complex items are rotated by moving their reference coordinate: their geometry and orientation are not changed.")
360 Layout.alignment: Qt.AlignHCenter
361 text: qsTr("Apply Rotation")
362 enabled: _hasHome && !degreesCWField.textField.validationError
365 _root.missionController.rotateMission(
366 positionController.rotateDegreesCW.rawValue,
367 rotateTakeoffCheck.checked,
368 rotateLandingCheck.checked