QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
GeoMapGeoFenceVisuals.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 QtPositioning
12
13import QGroundControl
14import QGroundControl.GeoMap
15
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.
20Item {
21 id: root
22
23 property var scene
24 property var surfaceModel
25 property var geoFenceController
26 property var homePosition ///< QGeoCoordinate; param circular fence centers here
27
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)
33
34 Repeater {
35 model: root.geoFenceController ? root.geoFenceController.polygons : undefined
36
37 GeoMapPolygon {
38 scene: root.scene
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
46 }
47 }
48
49 Repeater {
50 model: root.geoFenceController ? root.geoFenceController.circles : undefined
51
52 GeoMapCircle {
53 scene: root.scene
54 surfaceModel: root.surfaceModel
55 center: object.center
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
62 }
63 }
64
65 // Circular geofence specified from vehicle parameter, centered on home
66 GeoMapCircle {
67 scene: root.scene
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
75 }
76
77 // Breach return point
78 GeoMapMissionLabel {
79 scene: root.scene
80 surfaceModel: root.surfaceModel
81 coordinate: root.geoFenceController ? root.geoFenceController.breachReturnPoint : QtPositioning.coordinate()
82 visible: root.geoFenceController && root.geoFenceController.breachReturnPoint.isValid
83 checked: true
84 label: qsTr("B", "Breach Return Point item indicator")
85 }
86}