QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
GeoMapFenceWall.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 QtQuick3D
12import QtPositioning
13
14import QGroundControl.GeoMap
15
16/// Vertical fence curtain rendered from the terrain up to heightAglMeters
17/// along a closed coordinate ring (visible in 3D mode only; flattens away in
18/// 2D). Backs the extrudeHeightMeters mode of GeoMapPolygon/GeoMapCircle.
19GeoMapItem {
20 id: root
21
22 property var coordinates: [] ///< QGeoCoordinate ring vertices
23 property real heightAglMeters: 0
24 property color color: "orange"
25
26 // Bridges the wall geometry's anchor out of the 3D delegate (see GeoMapFlightPath)
27 property var _wallGeometry: null
28
29 altitudeMode: GeoMapItem.Absolute
30 crossfade3D: false // wall flattens to zero height with terrainScale instead
31 coordinate: (_wallGeometry && _wallGeometry.anchorCoordinate.isValid)
32 ? _wallGeometry.anchorCoordinate
33 : QtPositioning.coordinate()
34
35 delegate3D: Component {
36 // z offsets are relative altitudes; flatten them with the terrain
37 // during the 2D<->3D transition (anchor z already tracks
38 // terrainScale through GeoMapItem)
39 Node {
40 scale: Qt.vector3d(1, 1, root.scene ? root.scene.terrainScale : 1)
41
42 Model {
43 geometry: FenceWallGeometry {
44 id: wallGeometry
45 scene: root.scene
46 surfaceModel: root.surfaceModel
47 heightAglMeters: root.heightAglMeters
48 // Skip the geometry work entirely while hidden
49 coordinates: (root.visible && root.coordinates) ? root.coordinates : []
50 }
51
52 materials: PrincipledMaterial {
53 lighting: PrincipledMaterial.NoLighting
54 baseColor: root.color
55 alphaMode: PrincipledMaterial.Blend
56 cullMode: Material.NoCulling
57 }
58
59 Component.onCompleted: root._wallGeometry = wallGeometry
60 Component.onDestruction: root._wallGeometry = null
61 }
62 }
63 }
64}