QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
FenceWallGeometry.h
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
10#pragma once
11
12#include <QtCore/QByteArray>
13#include <QtCore/QList>
14#include <QtCore/QVariantList>
15#include <QtGui/QVector3D>
16#include <QtPositioning/QGeoCoordinate>
17#include <QtQmlIntegration/QtQmlIntegration>
18#include <QtQuick3D/QQuick3DGeometry>
19
20class GeoScene;
22
23Q_MOC_INCLUDE("GeoScene.h")
24Q_MOC_INCLUDE("SurfacePatchModel.h")
25
37class FenceWallGeometry : public QQuick3DGeometry
38{
39 Q_OBJECT
40 QML_ELEMENT
41 Q_PROPERTY(GeoScene* scene READ scene WRITE setScene NOTIFY sceneChanged)
42 Q_PROPERTY(SurfacePatchModel* surfaceModel READ surfaceModel WRITE setSurfaceModel NOTIFY surfaceModelChanged)
43 Q_PROPERTY(QVariantList coordinates READ coordinates WRITE setCoordinates NOTIFY coordinatesChanged)
44 Q_PROPERTY(qreal heightAglMeters READ heightAglMeters WRITE setHeightAglMeters NOTIFY heightAglMetersChanged)
45 Q_PROPERTY(QGeoCoordinate anchorCoordinate READ anchorCoordinate NOTIFY anchorCoordinateChanged)
46
47public:
48 explicit FenceWallGeometry(QQuick3DObject* parent = nullptr);
49
50 GeoScene* scene() const { return _scene; }
51
52 void setScene(GeoScene* scene);
53
54 SurfacePatchModel* surfaceModel() const { return _surfaceModel; }
55
56 void setSurfaceModel(SurfacePatchModel* surfaceModel);
57
60 QVariantList coordinates() const { return _coordinates; }
61
62 void setCoordinates(const QVariantList& coordinates);
63
64 qreal heightAglMeters() const { return _heightAglMeters; }
65
66 void setHeightAglMeters(qreal heightAglMeters);
67
71 QGeoCoordinate anchorCoordinate() const { return _anchorCoordinate; }
72
73signals:
79
80private slots:
81 void _rebuild();
82
83private:
86 void _scheduleRebuild();
87 double _terrainHeight(const QGeoCoordinate& coordinate) const;
88 void _setAnchorCoordinate(const QGeoCoordinate& anchorCoordinate);
89
90 GeoScene* _scene = nullptr;
91 SurfacePatchModel* _surfaceModel = nullptr;
92 QVariantList _coordinates;
93 QList<QGeoCoordinate> _ring;
94 qreal _heightAglMeters = 0.0;
95 QGeoCoordinate _anchorCoordinate;
96 bool _rebuildPending = false;
97};
void anchorCoordinateChanged()
QVariantList coordinates() const
void surfaceModelChanged()
SurfacePatchModel * surfaceModel() const
void coordinatesChanged()
GeoScene * scene() const
void heightAglMetersChanged()
QGeoCoordinate anchorCoordinate() const
qreal heightAglMeters() const
void setScene(GeoScene *scene)
GeoScene * scene() const