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/// 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.
22 property var coordinates: [] ///< QGeoCoordinate ring vertices
23 property real heightAglMeters: 0
24 property color color: "orange"
26 // Bridges the wall geometry's anchor out of the 3D delegate (see GeoMapFlightPath)
27 property var _wallGeometry: null
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()
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)
40 scale: Qt.vector3d(1, 1, root.scene ? root.scene.terrainScale : 1)
43 geometry: FenceWallGeometry {
46 surfaceModel: root.surfaceModel
47 heightAglMeters: root.heightAglMeters
48 // Skip the geometry work entirely while hidden
49 coordinates: (root.visible && root.coordinates) ? root.coordinates : []
52 materials: PrincipledMaterial {
53 lighting: PrincipledMaterial.NoLighting
55 alphaMode: PrincipledMaterial.Blend
56 cullMode: Material.NoCulling
59 Component.onCompleted: root._wallGeometry = wallGeometry
60 Component.onDestruction: root._wallGeometry = null