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 ****************************************************************************/
10pragma ComponentBehavior: Bound
16import QGroundControl.Controls
17import QGroundControl.GeoMap
19/// Point marker for complex mission item visuals: same colored dot that
20/// crossfades into a 3D sphere as GeoMapWaypointItem, plus an always-visible
21/// side text label (e.g. "Loiter", "Land").
25 property int index: -1 ///< Sequence number shown in the dot; < 0 shows none
26 property string label: ""
27 property bool checked: false
28 property real size: ScreenTools.defaultFontPixelHeight * 1.5
32 anchorPoint: Qt.point(width / 2, height / 2)
33 // altitudeMode defaults to ClampToGround (GeoMapItem); callers may override
35 QGCPalette { id: qgcPal; colorGroupEnabled: root.enabled }
37 // Same conventions as GeoMapWaypointItem / MissionItemIndexLabel:
38 // checked is "green" and grown, everything else the plain indicator color
39 readonly property color _markerColor: root.checked ? "green" : qgcPal.mapIndicator
40 readonly property real _indicatorSize: root.checked ? root.size : root.size * 0.75
42 readonly property var _camera: scene ? scene.camera : null
44 // Constant apparent size, same technique as GeoMapWaypointItem: scene
45 // units per screen pixel at the camera's look-at distance. Built-in
46 // QtQuick3D meshes are 100 units across.
47 readonly property real _modelScale: _camera
48 ? root._indicatorSize * _camera.distance * _camera.unitsPerPixelAtUnitDistance / 100
52 anchors.centerIn: parent
53 width: root._indicatorSize
54 height: root._indicatorSize
56 color: root._markerColor
57 opacity: root.contentOpacity2D
61 anchors.centerIn: parent
62 // MissionItemIndexLabel convention: single-char label lives inside the dot
63 text: root.index >= 0 ? root.index : (root.label.length === 1 ? root.label : "")
71 indicatorSize: root._indicatorSize
75 anchors.left: parent.right
76 anchors.leftMargin: ScreenTools.defaultFontPixelWidth / 2
77 anchors.verticalCenter: parent.verticalCenter
78 width: sideLabel.width + ScreenTools.defaultFontPixelWidth
79 height: sideLabel.height
81 color: root._markerColor
82 visible: root.label.length > 1
86 anchors.centerIn: parent
92 delegate3D: Component {
95 scale: Qt.vector3d(root._modelScale, root._modelScale, root._modelScale)
100 materials: PrincipledMaterial {
101 baseColor: root._markerColor
107 dropLength: dropShadow.dropLength
108 lineScale: dropShadow.dropLineScale
109 lineColor: root._markerColor