1/****************************************************************************
3 * (c) 2009-2024 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
5 * QGroundControl is licensed according to the terms in the file
6 * COPYING.md in the root of the source code directory.
8 ****************************************************************************/
14import QGroundControl.Controls
16/// Guided-action popup for a click on the fly view map (Go to / Orbit / ROI /
17/// Set home / Set Estimator Origin / Set Heading). Shared between the
18/// QtLocation FlyViewMap and the GeoMap engine adapter: the map indicator
19/// properties are optional, engines without those visuals still get the
20/// actions (confirmAction works without an indicator).
24 property var mapClickCoord
26 // Optional map indicators (QtLocation engine only)
27 property var gotoIndicator: null
28 property var orbitIndicator: null
30 readonly property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
31 readonly property var _guidedController: globals.guidedControllerFlyView
32 readonly property var _flyViewSettings: QGroundControl.settingsManager.flyViewSettings
34 // The available actions were evaluated against the vehicle the panel was
35 // opened for; close if that vehicle goes away or the active vehicle changes
36 on_ActiveVehicleChanged: close()
38 // Callers create the panel dynamically per map click; close() alone would leak it
41 sourceComponent: Component {
43 spacing: ScreenTools.defaultFontPixelWidth / 2
46 Layout.fillWidth: true
47 text: qsTr("Go to location")
48 visible: root._guidedController.showGotoLocation
51 if (!root._activeVehicle) {
54 if (root.gotoIndicator) {
55 root.gotoIndicator.show(root.mapClickCoord)
58 if ((root._activeVehicle.flightMode == root._activeVehicle.gotoFlightMode) && !root._flyViewSettings.goToLocationRequiresConfirmInGuided.value) {
59 const executed = root._guidedController.executeAction(root._guidedController.actionGoto, root.mapClickCoord)
60 if (root.gotoIndicator) {
62 root.gotoIndicator.actionConfirmed() // Still need to call this to commit the new coordinate and radius
64 root.gotoIndicator.actionCancelled()
68 root._guidedController.confirmAction(root._guidedController.actionGoto, root.mapClickCoord, root.gotoIndicator)
74 Layout.fillWidth: true
75 text: qsTr("Orbit at location")
76 visible: root._guidedController.showOrbit && (root.orbitIndicator !== null)
79 root.orbitIndicator.show(root.mapClickCoord)
80 root._guidedController.confirmAction(root._guidedController.actionOrbit, root.mapClickCoord, root.orbitIndicator)
85 objectName: "mapClickROI"
86 Layout.fillWidth: true
87 text: qsTr("ROI at location")
88 visible: root._guidedController.showROI
91 root._guidedController.confirmAction(root._guidedController.actionROI, root.mapClickCoord)
96 Layout.fillWidth: true
97 text: qsTr("Set home here")
98 visible: root._guidedController.showSetHome
101 root._guidedController.confirmAction(root._guidedController.actionSetHome, root.mapClickCoord)
106 Layout.fillWidth: true
107 text: qsTr("Set Estimator Origin")
108 visible: root._guidedController.showSetEstimatorOrigin
111 root._guidedController.confirmAction(root._guidedController.actionSetEstimatorOrigin, root.mapClickCoord)
116 Layout.fillWidth: true
117 text: qsTr("Set Heading")
118 visible: root._guidedController.showChangeHeading
121 root._guidedController.confirmAction(root._guidedController.actionChangeHeading, root.mapClickCoord)
127 QGCLabel { text: qsTr("Lat: %1").arg(root.mapClickCoord.latitude.toFixed(6)) }
128 QGCLabel { text: qsTr("Lon: %1").arg(root.mapClickCoord.longitude.toFixed(6)) }