5import QGroundControl.GeoMap
7/// Rally point marker. A PX4 rally point is a position on the ground (its altitude is the ground elevation), so it lies
8/// flat on the terrain. Other firmware flies to the point's altitude, so the marker floats there.
12 property var rallyPoint ///< RallyPoint
13 property var vehicle ///< Vehicle whose firmware decides the meaning of the altitude
14 property real homeAltitude: NaN ///< Home AMSL, for the relative altitude frame
15 property real homeTerrainBias: 0 ///< See GeoMapWaypointItem.homeTerrainBias
17 readonly property bool onGround: vehicle ? vehicle.px4Firmware : false
19 // terrainHeightAt does not notify, so _terrainRev re-evaluates a terrain frame altitude as tiles arrive
20 property int _terrainRev: 0
21 readonly property bool _terrainFrame: !!rallyPoint && rallyPoint.altitudeFrame === QGroundControl.AltitudeFrameTerrain
23 // Rendered height: the rendered terrain is homeTerrainBias above AMSL
24 readonly property real _renderedAltitude: {
29 const altitude = rallyPoint.coordinate.altitude
30 switch (rallyPoint.altitudeFrame) {
31 case QGroundControl.AltitudeFrameAbsolute:
32 return altitude + homeTerrainBias
33 case QGroundControl.AltitudeFrameTerrain:
34 return (surfaceModel ? surfaceModel.terrainHeightAt(rallyPoint.coordinate) : 0) + altitude
36 return homeAltitude + altitude + homeTerrainBias
40 objectName: "geoMapRallyPoint"
41 label: qsTr("R", "rally point map item label")
42 groundMarker: onGround
43 altitudeMode: onGround ? GeoMapItem.ClampToGround : GeoMapItem.Absolute
44 dragHeightAt: _terrainFrame && surfaceModel
45 ? (position) => surfaceModel.terrainHeightAt(position) + rallyPoint.coordinate.altitude
49 return QtPositioning.coordinate()
52 return rallyPoint.coordinate
54 return QtPositioning.coordinate(rallyPoint.coordinate.latitude, rallyPoint.coordinate.longitude, _renderedAltitude)
58 target: root.surfaceModel
59 enabled: !root.onGround && root._terrainFrame
61 function onTerrainHeightsChanged() {