10import QGroundControl.FlightMap
11import QGroundControl.Controls
12import QGroundControl.FactControls
13import QGroundControl.FlyView
14import QGroundControl.Geo
15import QGroundControl.Toolbar
20 readonly property int _decimalPlaces: 8
21 readonly property real _margin: ScreenTools.defaultFontPixelHeight * 0.5
22 readonly property real _toolsMargin: ScreenTools.defaultFontPixelWidth * 0.75
23 readonly property real _rightPanelWidth: Math.min(width / 3, ScreenTools.defaultFontPixelWidth * 30)
25 property var _planMasterController: planMasterController
26 property var _missionController: _planMasterController.missionController
27 property var _geoFenceController: _planMasterController.geoFenceController
28 property var _rallyPointController: _planMasterController.rallyPointController
29 property var _visualItems: _missionController.visualItems
30 property bool _singleComplexItem: _missionController.complexMissionItems.length === 1
31 property int _editingLayer: _layerMission
32 property var _appSettings: QGroundControl.settingsManager.appSettings
33 property var _planViewSettings: QGroundControl.settingsManager.planViewSettings
34 readonly property bool _useNewPlanPanelSetting: _planViewSettings.useNewPlanPanel.rawValue
35 // The Plan map engine in use, decided once at startup (the setting is qgcRebootRequired). The GeoMap engine
36 // supports the tabbed panel only, so the panel follows it instead of the setting while it is loaded
37 property bool _useGeoMapEngine: false
38 readonly property bool _useNewPlanPanel: _useNewPlanPanelSetting || _useGeoMapEngine
39 property bool _promptForPlanUsageShowing: false
40 property bool _addROIOnClick: false
41 property bool _addWaypointOnClick: false
43 // The map is created by editorMapLoader: QtLocation FlightMap or, when enabled, the experimental GeoMap engine
44 readonly property var editorMap: editorMapLoader.item
45 readonly property real _nonInteractiveOpacity: 0.5
46 readonly property real _leftToolWidth: toolStrip.x + toolStrip.width
47 readonly property real _rightToolWidth: rightPanel.width + rightPanel.anchors.rightMargin
48 // This is the center rectangle of the map which is not obscured by tools
49 readonly property rect _centerViewport: Qt.rect(_leftToolWidth + _margin, _margin, mainPlanViewArea.width - _leftToolWidth - _rightToolWidth - (_margin * 2), (missionStatus.visible ? missionStatus.y : mainPlanViewArea.height - _margin) - _margin)
51 readonly property int _layerMission: PlanEditLayers.layerMission
52 readonly property int _layerPlan: PlanEditLayers.layerPlan
53 readonly property int _layerFence: PlanEditLayers.layerFence
54 readonly property int _layerRally: PlanEditLayers.layerRally
57 if (visible && editorMap) {
58 editorMap.zoomLevel = QGroundControl.flightMapZoom
59 editorMap.center = QGroundControl.flightMapPosition
65 function onToolbarButtonClicked() {
66 _addWaypointOnClick = false
67 _addROIOnClick = false
71 function mapCenter() {
72 var coordinate = editorMap.center
73 coordinate.latitude = coordinate.latitude.toFixed(_decimalPlaces)
74 coordinate.longitude = coordinate.longitude.toFixed(_decimalPlaces)
75 coordinate.altitude = coordinate.altitude.toFixed(_decimalPlaces)
79 function _onEditorMapClicked(mouse) {
80 // Take focus to close any previous editing
81 editorMap.focus = true
83 // Collapse layer switcher on any map click
84 layerSwitcher.expanded = false
87 if (!mainWindow.allowViewSwitch()) {
90 var coordinate = editorMap.toCoordinate(Qt.point(mouse.x, mouse.y), false /* clipToViewPort */)
91 if (!coordinate.isValid) {
94 coordinate.latitude = coordinate.latitude.toFixed(_decimalPlaces)
95 coordinate.longitude = coordinate.longitude.toFixed(_decimalPlaces)
96 coordinate.altitude = coordinate.altitude.toFixed(_decimalPlaces)
98 switch (_editingLayer) {
100 _missionController.setHomePosition(coordinate)
103 if (!_useNewPlanPanel && _planMasterController.showCreateFromTemplate) {
104 _missionController.setHomePosition(coordinate)
105 } else if (_addROIOnClick) {
106 _addROIOnClick = false
107 if (_missionController.isROIActive) {
108 var pos = Qt.point(mouse.x, mouse.y)
109 // For some strange reason using mainWindow in mapToItem doesn't work, so we use globals.parent instead which also gets us mainWindow
110 pos = editorMap.mapToItem(globals.parent, pos)
111 var dropPanel = insertOrCancelROIDropPanelComponent.createObject(mainWindow, { mapClickCoord: coordinate, clickRect: Qt.rect(pos.x, pos.y, 0, 0) })
114 insertROIAfterCurrent(coordinate)
116 } else if (_addWaypointOnClick) {
117 insertSimpleItemAfterCurrent(coordinate)
121 if (_rallyPointController.supported) {
122 _rallyPointController.addPoint(coordinate)
128 function _onMapItemSelected(sequenceNumber) {
129 if (!mainWindow.allowViewSwitch()) {
132 _missionController.setCurrentPlanViewSeqNum(sequenceNumber, false)
133 rightPanel.showItemInspector()
137 id: mapFitFunctions // The name for this id cannot be changed without breaking references outside of this code. Beware!
139 usePlannedHomePosition: true
140 planMasterController: _planMasterController
143 PlanMasterController {
144 id: planMasterController
147 Component.onCompleted: {
148 _planMasterController.start()
149 _missionController.setCurrentPlanViewSeqNum(0, true)
152 onPromptForPlanUsageOnVehicleChange: {
153 if (!_promptForPlanUsageShowing) {
154 _promptForPlanUsageShowing = true
155 promptForPlanUsageOnVehicleChangePopupFactory.open()
159 function waitingOnIncompleteDataMessage(save) {
160 var saveOrUpload = save ? qsTr("Save") : qsTr("Upload")
161 QGroundControl.showMessageDialog(_root, qsTr("Unable to %1").arg(saveOrUpload), qsTr("Plan has incomplete items. Complete all items and %1 again.").arg(saveOrUpload))
164 function waitingOnTerrainDataMessage(save) {
165 var saveOrUpload = save ? qsTr("Save") : qsTr("Upload")
166 QGroundControl.showMessageDialog(_root, qsTr("Unable to %1").arg(saveOrUpload), qsTr("Plan is waiting on terrain data from server for correct altitude values."))
169 function checkReadyForSaveUpload(save) {
170 if (readyForSaveState() == VisualMissionItem.NotReadyForSaveData) {
171 waitingOnIncompleteDataMessage(save)
173 } else if (readyForSaveState() == VisualMissionItem.NotReadyForSaveTerrain) {
174 waitingOnTerrainDataMessage(save)
181 if (!checkReadyForSaveUpload(false /* save */)) {
184 switch (_missionController.sendToVehiclePreCheck()) {
185 case MissionController.SendToVehiclePreCheckStateOk: sendToVehicle()
187 case MissionController.SendToVehiclePreCheckStateActiveMission: QGroundControl.showMessageDialog(_root, qsTr("Send To Vehicle"), qsTr("Current mission must be paused prior to uploading a new Plan"))
189 case MissionController.SendToVehiclePreCheckStateFirwmareVehicleMismatch: QGroundControl.showMessageDialog(_root, qsTr("Plan Upload"),
190 qsTr("This Plan was created for a different firmware or vehicle type than the firmware/vehicle type of vehicle you are uploading to. " +
191 "This can lead to errors or incorrect behavior. " +
192 "It is recommended to recreate the Plan for the correct firmware/vehicle type.\n\n" +
193 "Click 'Ok' to upload the Plan anyway."),
194 Dialog.Ok | Dialog.Cancel,
195 function() { _planMasterController.sendToVehicle() })
200 function loadFromSelectedFile() {
201 fileDialog.title = qsTr("Select Plan File")
202 fileDialog.planFiles = true
203 fileDialog.nameFilters = _planMasterController.loadNameFilters
204 fileDialog.openForLoad()
207 function saveToSelectedFile() {
208 if (!checkReadyForSaveUpload(true /* save */)) {
211 fileDialog.title = qsTr("Save Plan")
212 fileDialog.planFiles = true
213 fileDialog.nameFilters = _planMasterController.saveNameFilters
214 fileDialog.openForSave()
217 function fitViewportToItems() {
218 mapFitFunctions.fitMapViewportToMissionItems()
221 function saveKmlToSelectedFile() {
222 if (!checkReadyForSaveUpload(true /* save */)) {
225 fileDialog.title = qsTr("Save KML")
226 fileDialog.planFiles = false
227 fileDialog.nameFilters = ShapeFileHelper.fileDialogKMLFilters
228 fileDialog.openForSave()
233 target: _missionController
235 function onNewItemsFromVehicle() {
236 if (_visualItems && _visualItems.count !== 1) {
237 mapFitFunctions.fitMapViewportToMissionItems()
239 _missionController.setCurrentPlanViewSeqNum(0, true)
243 function insertSimpleItemAfterCurrent(coordinate) {
244 var nextIndex = _missionController.currentPlanViewVIIndex + 1
245 _missionController.insertSimpleMissionItem(coordinate, nextIndex, true /* makeCurrentItem */)
248 function insertROIAfterCurrent(coordinate) {
249 var nextIndex = _missionController.currentPlanViewVIIndex + 1
250 _missionController.insertROIMissionItem(coordinate, nextIndex, true /* makeCurrentItem */)
253 function insertCancelROIAfterCurrent() {
254 var nextIndex = _missionController.currentPlanViewVIIndex + 1
255 _missionController.insertCancelROIMissionItem(nextIndex, true /* makeCurrentItem */)
258 function insertComplexItemAfterCurrent(complexItemName) {
259 var nextIndex = _missionController.currentPlanViewVIIndex + 1
260 _missionController.insertComplexMissionItem(complexItemName, mapCenter(), nextIndex, true /* makeCurrentItem */)
263 function insertTakeoffItemAfterCurrent() {
264 var nextIndex = _missionController.currentPlanViewVIIndex + 1
265 _missionController.insertTakeoffItem(mapCenter(), nextIndex, true /* makeCurrentItem */)
268 function insertVTOLMulticopterTakeoffItemAfterCurrent() {
269 var nextIndex = _missionController.currentPlanViewVIIndex + 1
270 _missionController.insertVTOLMulticopterTakeoffItem(mapCenter(), nextIndex, true /* makeCurrentItem */)
273 function insertLandItemAfterCurrent() {
274 var nextIndex = _missionController.currentPlanViewVIIndex + 1
275 _missionController.insertLandItem(mapCenter(), nextIndex, true /* makeCurrentItem */)
278 function _landButtonText() {
279 // Must mirror MissionController::insertLandItem: only fixed-wing/VTOL get landing patterns
280 if (!_planMasterController.controllerVehicle.fixedWing && !_planMasterController.controllerVehicle.vtol) {
281 return qsTr("Return")
283 if (_missionController.isInsertLandValid && _missionController.hasLandItem) {
284 return qsTr("Alt Land")
291 folder: _appSettings ? _appSettings.missionSavePath : ""
293 property bool planFiles: true ///< true: working with plan files, false: working with kml file
295 onAcceptedForSave: (file) => {
297 if (_planMasterController.saveToFile(file)) {
301 _planMasterController.saveToKml(file)
306 onAcceptedForLoad: (file) => {
307 _planMasterController.loadFromFile(file)
308 _planMasterController.fitViewportToItems()
309 _missionController.setCurrentPlanViewSeqNum(0, true)
316 planMasterController: _planMasterController
318 if (_editingLayer === _layerPlan) {
319 return _missionController.homePositionSet ? qsTr("Click in map to move Home") : qsTr("Click in map to set Home")
321 if (_editingLayer === _layerRally) {
322 return qsTr("Click in map to add rally points")
330 anchors.left: parent.left
331 anchors.right: parent.right
332 anchors.top: planToolBar.bottom
333 anchors.bottom: parent.bottom
339 // Engine choice is snapshotted at startup (the setting is qgcRebootRequired)
340 Component.onCompleted: {
341 _root._useGeoMapEngine = _root._planViewSettings.useGeoMapEngine.rawValue && _root._useNewPlanPanelSetting
342 sourceComponent = _root._useGeoMapEngine ? geoMapEngineComponent : qtLocationEngineComponent
347 id: geoMapEngineComponent
350 objectName: "planView_map"
351 planMasterController: _root._planMasterController
352 centerViewport: _root._centerViewport
353 missionOpacity: _root._editingLayer == _root._layerMission ? 1 : _root._nonInteractiveOpacity
354 missionInteractive: _root._editingLayer == _root._layerMission
355 rallyOpacity: _root._editingLayer == _root._layerRally ? 1 : _root._nonInteractiveOpacity
356 rallyInteractive: _root._editingLayer == _root._layerRally
359 controlsLeftMargin: _root._leftToolWidth + _root._toolsMargin
360 controlsTopMargin: _root._toolsMargin
361 _nonInteractiveOpacity: _root._nonInteractiveOpacity
363 onMapClicked: (mouse) => _root._onEditorMapClicked(mouse)
364 onItemSelected: (sequenceNumber) => _root._onMapItemSelected(sequenceNumber)
369 id: qtLocationEngineComponent
373 objectName: "planView_map"
374 mapName: "MissionEditor"
375 allowGCSLocationCenter: true
376 allowVehicleLocationCenter: true
379 zoomLevel: QGroundControl.flightMapZoom
380 center: QGroundControl.flightMapPosition
382 property rect centerViewport: _root._centerViewport
383 property real _nonInteractiveOpacity: _root._nonInteractiveOpacity
385 // Initial map position duplicates Fly view position
386 Component.onCompleted: qtLocationMap.center = QGroundControl.flightMapPosition
388 onZoomLevelChanged: {
389 QGroundControl.flightMapZoom = qtLocationMap.zoomLevel
392 QGroundControl.flightMapPosition = qtLocationMap.center
395 onMapClicked: (mouse) => _root._onEditorMapClicked(mouse)
397 MissionItemIndicatorGroup {
398 id: _missionItemIndicatorGroup
400 objectName: "planView_missionItemIndicators"
402 missionItems: _root._missionController.visualItems
403 onItemSelected: (sequenceNumber) => _root._onMapItemSelected(sequenceNumber)
406 // Add the mission item visuals to the map
408 model: _missionController.visualItems
409 delegate: MissionItemMapVisual {
411 opacity: _editingLayer == _layerMission ? 1 : qtLocationMap._nonInteractiveOpacity
412 interactive: _editingLayer == _layerMission
413 vehicle: _planMasterController.controllerVehicle
414 indicatorGroup: _missionItemIndicatorGroup
415 onClicked: (sequenceNumber) => _root._onMapItemSelected(sequenceNumber)
419 // Add lines between waypoints
421 showSpecialVisual: _missionController.isROIBeginCurrentItem
422 model: _missionController.simpleFlightPathSegments
423 opacity: _editingLayer == _layerMission ? 1 : qtLocationMap._nonInteractiveOpacity
426 // Direction arrows in waypoint lines
428 model: _editingLayer == _layerMission ? _missionController.directionArrows : undefined
430 delegate: MapLineArrow {
431 fromCoord: object ? object.coordinate1 : undefined
432 toCoord: object ? object.coordinate2 : undefined
434 mapControl: qtLocationMap
435 z: QGroundControl.zOrderWaypointLines + 1
439 // UI for splitting the current segment
443 property real _screenLegLength: 0
445 anchorPoint.x: sourceItem.width / 2
446 anchorPoint.y: sourceItem.height / 2
447 z: QGroundControl.zOrderWaypointLines + 1
448 visible: _editingLayer == _layerMission
449 && _screenLegLength > _missionItemIndicatorGroup.groupingDistance * 2
451 sourceItem: SplitIndicator {
452 onClicked: _missionController.insertSimpleMissionItem(splitSegmentItem.coordinate,
453 _missionController.currentPlanViewVIIndex,
454 true /* makeCurrentItem */)
457 function _updateScreenLegLength() {
458 const segment = _root._missionController.splitSegment
459 if (segment && segment.coordinate1.isValid && segment.coordinate2.isValid) {
460 const fromPoint = qtLocationMap.fromCoordinate(segment.coordinate1, false /* clipToViewPort */)
461 const toPoint = qtLocationMap.fromCoordinate(segment.coordinate2, false /* clipToViewPort */)
462 _screenLegLength = Math.hypot(toPoint.x - fromPoint.x, toPoint.y - fromPoint.y)
468 function _updateSplitCoord() {
469 if (_missionController.splitSegment) {
470 var distance = _missionController.splitSegment.coordinate1.distanceTo(_missionController.splitSegment.coordinate2)
471 var azimuth = _missionController.splitSegment.coordinate1.azimuthTo(_missionController.splitSegment.coordinate2)
472 splitSegmentItem.coordinate = _missionController.splitSegment.coordinate1.atDistanceAndAzimuth(distance / 2, azimuth)
474 coordinate = QtPositioning.coordinate()
476 _updateScreenLegLength()
480 target: _missionController
481 function onSplitSegmentChanged() { splitSegmentItem._updateSplitCoord() }
485 target: _missionController.splitSegment
486 function onCoordinate1Changed() { splitSegmentItem._updateSplitCoord() }
487 function onCoordinate2Changed() { splitSegmentItem._updateSplitCoord() }
491 target: qtLocationMap
492 function onCenterChanged() { splitSegmentItem._updateScreenLegLength() }
493 function onZoomLevelChanged() { splitSegmentItem._updateScreenLegLength() }
497 // Add the vehicles to the map
499 model: QGroundControl.multiVehicleManager.vehicles
500 delegate: VehicleMapItem {
502 coordinate: object.coordinate
504 size: ScreenTools.defaultFontPixelHeight * 3
505 z: QGroundControl.zOrderMapItems - 1
510 objectName: "planView_geoFenceMapVisuals"
512 myGeoFenceController: _geoFenceController
513 interactive: _editingLayer == _layerFence
514 homePosition: _missionController.plannedHomePosition
516 opacity: _editingLayer != _layerFence ? qtLocationMap._nonInteractiveOpacity : 1
519 RallyPointMapVisuals {
520 objectName: "planView_rallyPointMapVisuals"
522 myRallyPointController: _rallyPointController
523 interactive: _editingLayer == _layerRally
525 opacity: _editingLayer != _layerRally ? qtLocationMap._nonInteractiveOpacity : 1
530 //-----------------------------------------------------------
534 anchors.margins: _toolsMargin
535 anchors.left: parent.left
536 anchors.top: parent.top
537 z: QGroundControl.zOrderWidgets
538 maxHeight: parent.height - toolStrip.y
539 visible: _editingLayer == _layerMission
541 property bool _isMissionLayer: _editingLayer == _layerMission
544 target: waypointButton
546 value: _addWaypointOnClick
552 value: _addROIOnClick
555 ToolStripActionList {
556 id: toolStripActionList
559 objectName: "planToolStrip_takeoffButton"
560 text: qsTr("Takeoff")
561 iconSource: "/res/takeoff.svg"
562 enabled: _missionController.isInsertTakeoffValid
563 visible: toolStrip._isMissionLayer && !_planMasterController.controllerVehicle.rover
564 dropPanelComponent: _planMasterController.controllerVehicle.supports.vtolMulticopterTakeoff
565 ? vtolTakeoffDropPanel
568 insertTakeoffItemAfterCurrent()
572 objectName: "planToolStrip_patternButton"
573 text: _singleComplexItem ? _missionController.complexMissionItems[0].translatedName : qsTr("Pattern")
574 iconSource: "/qmlimages/MapDrawShape.svg"
575 enabled: _missionController.flyThroughCommandsAllowed
576 visible: toolStrip._isMissionLayer
577 dropPanelComponent: _singleComplexItem ? undefined : patternDropPanel
579 if (_singleComplexItem) {
580 insertComplexItemAfterCurrent(_missionController.complexMissionItems[0].canonicalName)
586 objectName: "planToolStrip_waypointButton"
587 text: qsTr("Waypoint")
588 iconSource: "/res/waypoint.svg"
589 enabled: _missionController.flyThroughCommandsAllowed
590 visible: toolStrip._isMissionLayer
593 _addWaypointOnClick = !_addWaypointOnClick
594 if (_addWaypointOnClick) {
595 _addROIOnClick = false
596 // Arming an insert tool leaves template-creation mode, otherwise
597 // map clicks keep moving the home position instead of inserting
598 _planMasterController.userSelectedManualCreation = true
604 objectName: "planToolStrip_roiButton"
605 text: _missionController.isROIActive ? qsTr("Cancel ROI") : qsTr("ROI")
606 iconSource: "/qmlimages/roi.svg"
607 enabled: _missionController.isInsertROIValid
608 visible: toolStrip._isMissionLayer && _planMasterController.controllerVehicle.supports.roiMode
611 _addROIOnClick = !_addROIOnClick
612 if (_addROIOnClick) {
613 _addWaypointOnClick = false
614 _planMasterController.userSelectedManualCreation = true
619 objectName: "planToolStrip_landButton"
620 text: _landButtonText()
621 iconSource: "/res/rtl.svg"
622 enabled: _missionController.isInsertLandValid
623 visible: toolStrip._isMissionLayer
625 insertLandItemAfterCurrent()
630 iconSource: "/res/chevron-double-right.svg"
631 visible: missionStatus.hidden && QGroundControl.corePlugin.options.showMissionStatus
632 onTriggered: missionStatus.showMissionStatus()
637 model: toolStripActionList.model
640 // The GeoMap engine shows its own scale next to its camera controls
642 anchors.margins: _toolsMargin
643 anchors.left: toolStrip.right
644 anchors.top: parent.top
645 mapControl: _root.editorMap
647 visible: !_root._useGeoMapEngine
652 anchors.top: parent.top
653 anchors.bottom: parent.bottom
654 anchors.right: parent.right
655 width: _rightPanelWidth
656 planMasterController: _planMasterController
657 editorMap: _root.editorMap
658 useNewPlanPanel: _root._useNewPlanPanel
659 onEditingLayerChangeRequested: (layer) => _editingLayer = layer
662 // Layer switching icons — only active icon visible; click to expand choices leftward
665 objectName: "planView_layerSwitcher"
666 anchors.right: rightPanel.left
667 anchors.rightMargin: _toolsMargin
668 anchors.top: parent.top
669 anchors.topMargin: _toolsMargin
670 width: layerRow.width
671 height: _layerButtonSize
672 z: QGroundControl.zOrderWidgets
673 visible: !_planMasterController.showCreateFromTemplate && !_useNewPlanPanel
675 property bool expanded: false
676 property real _layerButtonSize: ScreenTools.defaultFontPixelHeight * 2.0
677 property real _spacing: ScreenTools.defaultFontPixelHeight * 0.25
682 onTriggered: layerSwitcher.expanded = false
688 collapseTimer.restart()
694 function choose(nodeType) {
697 rightPanel.selectLayer(nodeType)
700 // Row laid out right-to-left: active icon on the right, choices expand left
703 anchors.right: parent.right
704 spacing: layerSwitcher._spacing
705 layoutDirection: Qt.RightToLeft
707 // Active layer button (always visible)
709 objectName: "layerSwitcher_activeButton"
710 width: layerSwitcher._layerButtonSize
712 radius: ScreenTools.defaultBorderRadius
713 color: QGroundControl.globalPalette.accent
716 anchors.centerIn: parent
717 width: parent.width * 0.6
719 source: PlanEditLayers.layerInfos.find(l => l.layer === _editingLayer)?.icon ?? "/res/waypoint.svg"
720 color: QGroundControl.globalPalette.accentText
725 onClicked: layerSwitcher.toggle()
729 // Choice buttons (only layers that are NOT the current one)
731 model: PlanEditLayers.layerInfos.filter(l => l.layer !== _editingLayer)
734 required property var modelData
735 objectName: "layerSwitcher_choice_" + modelData.nodeType
736 width: choiceRow.implicitWidth + layerSwitcher._spacing * 2
737 height: layerSwitcher._layerButtonSize
738 radius: ScreenTools.defaultBorderRadius
739 color: QGroundControl.globalPalette.windowCard
741 opacity: layerSwitcher.expanded ? 1 : 0
743 Behavior on opacity { NumberAnimation { duration: 150 } }
747 anchors.centerIn: parent
748 spacing: layerSwitcher._spacing
751 anchors.verticalCenter: parent.verticalCenter
752 width: layerSwitcher._layerButtonSize * 0.6
754 source: modelData.icon
755 color: QGroundControl.globalPalette.textPrimary
759 anchors.verticalCenter: parent.verticalCenter
761 color: QGroundControl.globalPalette.textPrimary
767 onClicked: layerSwitcher.choose(modelData.nodeType)
776 anchors.margins: _toolsMargin
777 anchors.left: _calcLeftAnchor()
778 anchors.right: rightPanel.left
779 anchors.bottom: parent.bottom
781 visible: !hidden && _editingLayer == _layerMission && QGroundControl.corePlugin.options.showMissionStatus
783 readonly property bool hidden: _planViewSettings.showMissionItemStatus.rawValue ? false : true
785 function showMissionStatus() {
786 _planViewSettings.showMissionItemStatus.rawValue = true
789 function _calcLeftAnchor() {
790 let bottomOfToolStrip = toolStrip.y + toolStrip.height
791 let largestStatsHeight = Math.max(terrainStatus.height, missionStats.height)
792 if (bottomOfToolStrip + largestStatsHeight > parent.height - missionStatus.anchors.margins) {
793 return toolStrip.right
798 function _toggleMissionStatusVisibility() {
799 _planViewSettings.showMissionItemStatus.rawValue = _planViewSettings.showMissionItemStatus.rawValue ? false : true
803 id: missionStatsButtonLayout
804 Layout.alignment: Qt.AlignBottom
807 property real _buttonImplicitWidth: ScreenTools.defaultFontPixelHeight * 1.5
808 property real _buttonImageMargins: _buttonImplicitWidth * 0.15
812 implicitWidth: missionStatsButtonLayout._buttonImplicitWidth
813 implicitHeight: implicitWidth
814 color: checked ? QGroundControl.globalPalette.accent : QGroundControl.globalPalette.windowCard
816 property bool checked: true
819 anchors.margins: missionStatsButtonLayout._buttonImageMargins
821 source: "/res/terrain.svg"
822 color: parent.checked ? QGroundControl.globalPalette.accentText : QGroundControl.globalPalette.textPrimary
828 terrainButton.checked = true
829 missionStatsButton.checked = false
835 id: missionStatsButton
836 implicitWidth: missionStatsButtonLayout._buttonImplicitWidth
837 implicitHeight: implicitWidth
838 color: checked ? QGroundControl.globalPalette.accent : QGroundControl.globalPalette.windowCard
840 property bool checked: false
843 anchors.margins: missionStatsButtonLayout._buttonImageMargins
845 source: "/res/sliders.svg"
846 color: parent.checked ? QGroundControl.globalPalette.accentText : QGroundControl.globalPalette.textPrimary
852 missionStatsButton.checked = true
853 terrainButton.checked = false
859 id: bottomStatusOpenCloseButton
860 implicitWidth: missionStatsButtonLayout._buttonImplicitWidth
861 implicitHeight: implicitWidth
862 color: QGroundControl.globalPalette.windowCard
865 anchors.margins: missionStatsButtonLayout._buttonImageMargins
867 source: "/res/chevron-double-left.svg"
868 color: QGroundControl.globalPalette.textPrimary
873 onClicked: missionStatus._toggleMissionStatusVisibility()
880 Layout.alignment: Qt.AlignBottom
881 Layout.fillWidth: true
882 height: ScreenTools.defaultFontPixelHeight * 7
883 missionController: _missionController
884 visible: terrainButton.checked
885 onSetCurrentSeqNum: _missionController.setCurrentPlanViewSeqNum(seqNum, true)
890 Layout.alignment: Qt.AlignBottom
891 Layout.fillWidth: true
892 visible: missionStatsButton.checked
893 planMasterController: _root._planMasterController
898 //- ToolStrip ToolStripDropPanel Components
904 spacing: ScreenTools.defaultFontPixelWidth * 0.5
906 QGCLabel { text: qsTr("Create complex pattern:") }
909 model: _missionController.complexMissionItems
912 text: modelData.translatedName
913 Layout.fillWidth: true
916 insertComplexItemAfterCurrent(modelData.canonicalName)
925 id: vtolTakeoffDropPanel
928 spacing: ScreenTools.defaultFontPixelWidth * 0.5
930 QGCLabel { text: qsTr("Choose takeoff mode:") }
933 objectName: "planTakeoff_vtolButton"
934 text: qsTr("VTOL takeoff")
935 Layout.fillWidth: true
939 insertTakeoffItemAfterCurrent()
945 objectName: "planTakeoff_mcButton"
946 text: qsTr("Multicopter takeoff")
947 Layout.fillWidth: true
950 insertVTOLMulticopterTakeoffItemAfterCurrent()
957 QGCPopupDialogFactory {
958 id: promptForPlanUsageOnVehicleChangePopupFactory
960 dialogComponent: promptForPlanUsageOnVehicleChangePopupComponent
964 id: promptForPlanUsageOnVehicleChangePopupComponent
966 title: _planMasterController.managerVehicle.isOfflineEditingVehicle ? qsTr("Plan View - Vehicle Disconnected") : qsTr("Plan View - Vehicle Changed")
967 buttons: Dialog.NoButton
971 Layout.maximumWidth: parent.width
972 wrapMode: QGCLabel.WordWrap
973 text: _planMasterController.managerVehicle.isOfflineEditingVehicle ?
974 qsTr("The vehicle associated with the plan in the Plan View is no longer available. What would you like to do with that plan?") : qsTr("The plan being worked on in the Plan View is not from the current vehicle. What would you like to do with that plan?")
978 Layout.fillWidth: true
979 text: (_planMasterController.dirtyForSave) ?
980 (_planMasterController.managerVehicle.isOfflineEditingVehicle ?
981 qsTr("Discard Unsaved Changes") : qsTr("Discard Unsaved Changes, Load New Plan From Vehicle")) : qsTr("Load New Plan From Vehicle")
983 _planMasterController.showPlanFromManagerVehicle()
984 _promptForPlanUsageShowing = false
990 Layout.fillWidth: true
991 text: _planMasterController.managerVehicle.isOfflineEditingVehicle ?
992 qsTr("Keep Current Plan") : qsTr("Keep Current Plan, Don't Update From Vehicle")
994 _promptForPlanUsageShowing = false
1003 id: insertOrCancelROIDropPanelComponent
1006 id: insertOrCancelROIDropPanel
1009 property var mapClickCoord
1011 sourceComponent: Component {
1013 spacing: ScreenTools.defaultFontPixelWidth / 2
1016 Layout.fillWidth: true
1017 text: qsTr("Insert ROI")
1020 insertOrCancelROIDropPanel.close()
1021 insertROIAfterCurrent(mapClickCoord)
1026 Layout.fillWidth: true
1027 text: qsTr("Insert Cancel ROI")
1030 insertOrCancelROIDropPanel.close()
1031 insertCancelROIAfterCurrent()