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/// GeoFence visuals for the GeoMap engine (display only, no editing):
17/// inclusion/exclusion polygons and circles, the parameter-driven circular
18/// fence around home, and the breach return point. Same colors and
19/// conventions as the QtLocation GeoFenceMapVisuals.
24 property var surfaceModel
25 property var geoFenceController
26 property var homePosition ///< QGeoCoordinate; param circular fence centers here
28 readonly property color _borderColor: "orange"
29 readonly property int _borderWidthInclusion: 2
30 readonly property color _interiorColorExclusion: Qt.alpha("orange", 0.2)
31 readonly property real _fenceWallHeightMeters: 121.92 // 400 ft AGL
32 readonly property color _fenceWallColor: Qt.alpha("orange", 0.25)
35 model: root.geoFenceController ? root.geoFenceController.polygons : undefined
39 surfaceModel: root.surfaceModel
40 coordinates: object.path
41 strokeColor: object.inclusion ? root._borderColor : "transparent"
42 strokeWidth: root._borderWidthInclusion
43 fillColor: object.inclusion ? "transparent" : root._interiorColorExclusion
44 extrudeHeightMeters: root._fenceWallHeightMeters
45 extrudeColor: root._fenceWallColor
50 model: root.geoFenceController ? root.geoFenceController.circles : undefined
54 surfaceModel: root.surfaceModel
56 radiusMeters: object.radius.rawValue
57 strokeColor: object.inclusion ? root._borderColor : "transparent"
58 strokeWidth: root._borderWidthInclusion
59 fillColor: object.inclusion ? "transparent" : root._interiorColorExclusion
60 extrudeHeightMeters: root._fenceWallHeightMeters
61 extrudeColor: root._fenceWallColor
65 // Circular geofence specified from vehicle parameter, centered on home
68 surfaceModel: root.surfaceModel
69 center: root.homePosition
70 radiusMeters: root.geoFenceController ? root.geoFenceController.paramCircularFence : 0
71 strokeColor: root._borderColor
72 strokeWidth: root._borderWidthInclusion
73 extrudeHeightMeters: root._fenceWallHeightMeters
74 extrudeColor: root._fenceWallColor
77 // Breach return point
80 surfaceModel: root.surfaceModel
81 coordinate: root.geoFenceController ? root.geoFenceController.breachReturnPoint : QtPositioning.coordinate()
82 visible: root.geoFenceController && root.geoFenceController.breachReturnPoint.isValid
84 label: qsTr("B", "Breach Return Point item indicator")