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 <QtCore/QLoggingCategory>
4#include <QtGui/QVector2D>
5#include <QtGui/QVector3D>
6#include <QtPositioning/QGeoCoordinate>
7#include <QtQmlIntegration/QtQmlIntegration>
8#include <QtQuick3D/QQuick3DGeometry>
9
10Q_DECLARE_LOGGING_CATEGORY(Viewer3DTerrainGeometryLog)
11
12class Viewer3DTerrainGeometry : public QQuick3DGeometry
13{
14 Q_OBJECT
15 QML_ELEMENT
16
17 Q_PROPERTY(int sectorCount READ sectorCount WRITE setSectorCount NOTIFY sectorCountChanged)
18 Q_PROPERTY(int stackCount READ stackCount WRITE setStackCount NOTIFY stackCountChanged)
19 Q_PROPERTY(QGeoCoordinate roiMin READ roiMin WRITE setRoiMin NOTIFY roiMinChanged)
20 Q_PROPERTY(QGeoCoordinate roiMax READ roiMax WRITE setRoiMax NOTIFY roiMaxChanged)
21 Q_PROPERTY(QGeoCoordinate refCoordinate READ refCoordinate WRITE setRefCoordinate NOTIFY refCoordinateChanged)
22
23 friend class Viewer3DTerrainGeometryTest;
24
25public:
26 explicit Viewer3DTerrainGeometry();
27
28 Q_INVOKABLE void updateEarthData();
29
30 int sectorCount() const { return _sectorCount; }
31 void setSectorCount(int newSectorCount);
32
33 int stackCount() const { return _stackCount; }
34 void setStackCount(int newStackCount);
35
36 QGeoCoordinate roiMin() const { return _roiMin; }
37 void setRoiMin(const QGeoCoordinate &newRoiMin);
38
39 QGeoCoordinate roiMax() const { return _roiMax; }
40 void setRoiMax(const QGeoCoordinate &newRoiMax);
41
42 QGeoCoordinate refCoordinate() const { return _refCoordinate; }
43 void setRefCoordinate(const QGeoCoordinate &newRefCoordinate);
44
45signals:
51
52private:
53 bool _buildTerrain(const QGeoCoordinate &roiMinCoordinate, const QGeoCoordinate &roiMaxCoordinate, const QGeoCoordinate &refCoordinate, bool scale);
54 static QVector3D _computeFaceNormal(const QVector3D &x1, const QVector3D &x2, const QVector3D &x3);
55 void _clearScene();
56
57 std::vector<QVector3D> _vertices;
58 std::vector<QVector2D> _texCoords;
59 std::vector<QVector3D> _normals;
60
61 QGeoCoordinate _roiMin;
62 QGeoCoordinate _roiMax;
63 QGeoCoordinate _refCoordinate;
64
65 int _sectorCount = 0;
66 int _stackCount = 0;
67};
Q_DECLARE_LOGGING_CATEGORY(AndroidSerialLog)
QGeoCoordinate roiMin() const
QGeoCoordinate roiMax() const
QGeoCoordinate refCoordinate() const