QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
Viewer3DTerrainGeometry.h
Go to the documentation of this file.
1#pragma once
2
3#include <QtGui/QVector2D>
4#include <QtGui/QVector3D>
5#include <QtPositioning/QGeoCoordinate>
6#include <QtQmlIntegration/QtQmlIntegration>
7#include <QtQuick3D/QQuick3DGeometry>
8
9#include <vector>
10
11class Viewer3DTerrainGeometry : public QQuick3DGeometry
12{
13 Q_OBJECT
14 QML_ELEMENT
15
16 Q_PROPERTY(int sectorCount READ sectorCount WRITE setSectorCount NOTIFY sectorCountChanged)
17 Q_PROPERTY(int stackCount READ stackCount WRITE setStackCount NOTIFY stackCountChanged)
18 Q_PROPERTY(QGeoCoordinate roiMin READ roiMin WRITE setRoiMin NOTIFY roiMinChanged)
19 Q_PROPERTY(QGeoCoordinate roiMax READ roiMax WRITE setRoiMax NOTIFY roiMaxChanged)
20 Q_PROPERTY(QGeoCoordinate refCoordinate READ refCoordinate WRITE setRefCoordinate NOTIFY refCoordinateChanged)
21
23
24public:
25 explicit Viewer3DTerrainGeometry();
26
27 Q_INVOKABLE void updateEarthData();
28
29 int sectorCount() const { return _sectorCount; }
30 void setSectorCount(int newSectorCount);
31
32 int stackCount() const { return _stackCount; }
33 void setStackCount(int newStackCount);
34
35 QGeoCoordinate roiMin() const { return _roiMin; }
36 void setRoiMin(const QGeoCoordinate &newRoiMin);
37
38 QGeoCoordinate roiMax() const { return _roiMax; }
39 void setRoiMax(const QGeoCoordinate &newRoiMax);
40
41 QGeoCoordinate refCoordinate() const { return _refCoordinate; }
42 void setRefCoordinate(const QGeoCoordinate &newRefCoordinate);
43
44signals:
50
51private:
52 bool _buildTerrain(const QGeoCoordinate &roiMinCoordinate, const QGeoCoordinate &roiMaxCoordinate, const QGeoCoordinate &refCoordinate, bool scale);
53 static QVector3D _computeFaceNormal(const QVector3D &x1, const QVector3D &x2, const QVector3D &x3);
54 void _clearScene();
55
56 std::vector<QVector3D> _vertices;
57 std::vector<QVector2D> _texCoords;
58 std::vector<QVector3D> _normals;
59
60 QGeoCoordinate _roiMin;
61 QGeoCoordinate _roiMax;
62 QGeoCoordinate _refCoordinate;
63
64 int _sectorCount = 0;
65 int _stackCount = 0;
66};
void setRoiMax(const QGeoCoordinate &newRoiMax)
void setRoiMin(const QGeoCoordinate &newRoiMin)
QGeoCoordinate roiMin() const
void setStackCount(int newStackCount)
QGeoCoordinate roiMax() const
QGeoCoordinate refCoordinate() const
void setSectorCount(int newSectorCount)
void setRefCoordinate(const QGeoCoordinate &newRefCoordinate)