QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
GeoMapCircle.qml
Go to the documentation of this file.
1/****************************************************************************
2 *
3 * (c) 2009-2024 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
4 *
5 * QGroundControl is licensed according to the terms in the file
6 * COPYING.md in the root of the source code directory.
7 *
8 ****************************************************************************/
9
10import QtQuick
11import QtQuick.Shapes
12
13import QGroundControl
14import QGroundControl.GeoMap
15
16/// Circle outline only; GeoMapCircleVisuals is the full QGCMapCircleVisuals
17/// counterpart (adds drag handles and rotation arrows). Built from
18/// great-circle points so it stays correct under 3D
19/// camera tilt. Ground-projected by default; set altitudeMode to
20/// GeoMapItem.Absolute to render at the center coordinate's altitude.
21/// Set extrudeHeightMeters to also render a 3D fence wall from the terrain
22/// up to that AGL height (visible in 3D mode only; flattens away in 2D).
23Item {
24 id: root
25
26 property var scene
27 property var surfaceModel
28 property var center ///< QGeoCoordinate
29 property real radiusMeters: 0
30 property color strokeColor: QGroundControl.globalPalette.mapMissionTrajectory
31 property real strokeWidth: 3
32 property color fillColor: "transparent"
33 property real extrudeHeightMeters: 0 ///< 0 = flat outline only
34 property color extrudeColor: Qt.alpha(strokeColor, 0.25)
35 property alias altitudeMode: pathProjector.altitudeMode
36
37 GeoMapProjectedPath {
38 id: pathProjector
39 scene: root.scene
40 surfaceModel: root.surfaceModel
41 // Skip the projection work entirely while hidden
42 coordinates: (root.visible && root.center && root.center.isValid && root.radiusMeters > 0)
43 ? pathProjector.circleCoordinates(root.center, root.radiusMeters)
44 : []
45 }
46
47 Shape {
48 visible: pathProjector.projected
49
50 ShapePath {
51 strokeColor: root.strokeColor
52 strokeWidth: root.strokeWidth
53 fillColor: root.fillColor
54 PathPolyline { path: pathProjector.screenPoints }
55 }
56 }
57
58 GeoMapFenceWall {
59 id: wallItem
60 visible: root.visible && root.extrudeHeightMeters > 0
61 scene: root.scene
62 surfaceModel: root.surfaceModel
63 heightAglMeters: root.extrudeHeightMeters
64 color: root.extrudeColor
65 // Skip the ring construction entirely while hidden
66 coordinates: (wallItem.visible && root.center && root.center.isValid && root.radiusMeters > 0)
67 ? pathProjector.circleCoordinates(root.center, root.radiusMeters)
68 : []
69 }
70}