QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
GeoMapPolygon.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/// Polygon outline/fill from a coordinate list: the GeoMap counterpart of
17/// QGCMapPolygonVisuals (display only — no drag-to-edit vertices).
18/// Ground-projected by default; set altitudeMode to GeoMapItem.Absolute to
19/// render at the vertex coordinates' altitude. Set extrudeHeightMeters to
20/// also render a 3D fence wall from the terrain up to that AGL height
21/// (visible in 3D mode only; flattens away in 2D).
22Item {
23 id: root
24
25 property var scene
26 property var surfaceModel
27 property var coordinates: [] ///< QGeoCoordinate vertices, unclosed ring
28 property color strokeColor: QGroundControl.globalPalette.mapMissionTrajectory
29 property real strokeWidth: 3
30 property color fillColor: "transparent"
31 property real extrudeHeightMeters: 0 ///< 0 = flat outline only
32 property color extrudeColor: Qt.alpha(strokeColor, 0.25)
33 property alias altitudeMode: pathProjector.altitudeMode
34
35 GeoMapProjectedPath {
36 id: pathProjector
37 scene: root.scene
38 surfaceModel: root.surfaceModel
39 // Skip the projection work entirely while hidden; close the ring
40 coordinates: (root.visible && root.coordinates && root.coordinates.length > 2)
41 ? root.coordinates.concat([root.coordinates[0]])
42 : []
43 }
44
45 Shape {
46 visible: pathProjector.projected
47
48 ShapePath {
49 strokeColor: root.strokeColor
50 strokeWidth: root.strokeWidth
51 fillColor: root.fillColor
52 PathPolyline { path: pathProjector.screenPoints }
53 }
54 }
55
56 GeoMapFenceWall {
57 visible: root.visible && root.extrudeHeightMeters > 0
58 scene: root.scene
59 surfaceModel: root.surfaceModel
60 heightAglMeters: root.extrudeHeightMeters
61 color: root.extrudeColor
62 coordinates: root.coordinates
63 }
64}