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.GeoMap
16/// Base visual shared by Fixed Wing and VTOL landing patterns on GeoMap:
17/// read-only GeoMap-native port of the common elements in
18/// src/PlanView/FWLandingPatternMapVisual.qml / VTOLLandingPatternMapVisual.qml
19/// (flight path, loiter ring, final-approach/landing markers). No
20/// drag-to-place code ports over — FlyView missions are already loaded and
21/// immutable; the markers are clickable only to change the current item.
25 property var item ///< VisualMissionItem (LandingComplexItem)
27 property var surfaceModel
28 // DEM-vs-home-AMSL bias, wired by GeoMapMissionItems (see GeoMapWaypointItem)
29 property real homeTerrainBias: 0
30 property string landingLabel: "" ///< Label for the landing-point marker (VTOL overrides to "Land")
31 property real node3DOpacity: 1 ///< Dimming of the markers' 3D nodes, see GeoMapItem.node3DOpacity
32 property bool pickable: true ///< The markers take clicks
36 readonly property bool _useLoiterToAlt: item.useLoiterToAlt.rawValue
37 // Approach leg descends from the final-approach altitude to the landing
38 // altitude; project at those AMSL heights so the 3D view shows the slope
39 // instead of a ground-hugging line
40 readonly property real _approachAltAMSL: item.amslEntryAlt + homeTerrainBias
41 readonly property real _landAltAMSL: item.amslExitAlt + homeTerrainBias
42 readonly property var _flightPath: {
43 const from = _useLoiterToAlt ? item.slopeStartCoordinate : item.finalApproachCoordinate
44 return [QtPositioning.coordinate(from.latitude, from.longitude, _approachAltAMSL),
45 QtPositioning.coordinate(item.landingCoordinate.latitude, item.landingCoordinate.longitude, _landAltAMSL)]
49 id: flightPathProjector
51 surfaceModel: root.surfaceModel
52 altitudeMode: GeoMapItem.Absolute
53 coordinates: root._flightPath
56 // Flight path (final approach/loiter exit -> landing point)
58 visible: root.item.landingCoordSet && flightPathProjector.projected
60 strokeColor: QGroundControl.globalPalette.mapMissionTrajectory
62 fillColor: "transparent"
63 PathPolyline { path: flightPathProjector.screenPoints }
70 surfaceModel: root.surfaceModel
71 altitudeMode: GeoMapItem.Absolute
72 // Static invokables aren't callable via the QML type name; call
73 // through the instance instead. Ring altitude rides on the center
74 // coordinate (atDistanceAndAzimuth preserves it).
75 coordinates: root._useLoiterToAlt
76 ? loiterPath.circleCoordinates(QtPositioning.coordinate(root.item.finalApproachCoordinate.latitude,
77 root.item.finalApproachCoordinate.longitude,
78 root._approachAltAMSL),
79 root.item.loiterRadius.rawValue)
85 visible: root._useLoiterToAlt && loiterPath.projected
89 fillColor: "transparent"
90 PathPolyline { path: loiterPath.screenPoints }
94 // Final approach / loiter point
97 surfaceModel: root.surfaceModel
98 altitudeMode: GeoMapItem.Absolute
99 coordinate: QtPositioning.coordinate(root.item.finalApproachCoordinate.latitude,
100 root.item.finalApproachCoordinate.longitude,
101 root._approachAltAMSL)
102 index: root.item.sequenceNumber
103 label: root._useLoiterToAlt ? qsTr("Loiter") : qsTr("Approach")
104 checked: root.item.isCurrentItem
105 node3DOpacity: root.node3DOpacity
106 visible: root.item.landingCoordSet
110 enabled: root.pickable
111 onClicked: root.clicked()
118 surfaceModel: root.surfaceModel
119 altitudeMode: GeoMapItem.Absolute
120 coordinate: QtPositioning.coordinate(root.item.landingCoordinate.latitude,
121 root.item.landingCoordinate.longitude,
123 index: root.item.lastSequenceNumber
124 label: root.landingLabel
125 checked: root.item.isCurrentItem
126 node3DOpacity: root.node3DOpacity
127 visible: root.item.landingCoordSet
131 enabled: root.pickable
132 onClicked: root.clicked()