QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
OsmParser.h
Go to the documentation of this file.
1#pragma once
2
3#include <QtCore/QLoggingCategory>
4#include <QtCore/QVariant>
5#include <QtGui/QVector2D>
6#include <QtGui/QVector3D>
7#include <QtQmlIntegration/QtQmlIntegration>
8
10
12
13class OsmParserThread;
14
16{
17 Q_OBJECT
18 QML_ELEMENT
19 QML_UNCREATABLE("")
20
21 friend class OsmParserTest;
22
23public:
24 explicit OsmParser(QObject *parent = nullptr);
25 ~OsmParser() override;
26
27 bool mapLoaded() const override { return _mapLoadedFlag; }
28 QGeoCoordinate gpsRef() const override { return _gpsRefPoint; }
29 std::pair<QGeoCoordinate, QGeoCoordinate> mapBoundingBox() const override { return {_coordinateMin, _coordinateMax}; }
30
31 float buildingLevelHeight() const { return _buildingLevelHeight; }
32
33 void setGpsRef(const QGeoCoordinate &gpsRef);
34 void resetGpsRef();
35 void parseOsmFile(const QString &filePath);
36 QByteArray buildingToMesh();
37
38signals:
40
41private:
42 void _setBuildingLevelHeight(const QVariant &value);
43 void _onOsmParserFinished(bool isValid);
44 void _triangulateWallsExtrudedPolygon(std::vector<QVector3D> &triangulatedMesh, const std::vector<QVector2D> &verticesCcw, float h, bool inverseOrder);
45 void _triangulateRectangle(std::vector<QVector3D> &triangulatedMesh, const std::vector<QVector3D> &verticesCcw, bool invertNormal);
46
47 OsmParserThread *_osmParserWorker = nullptr;
48
49 QGeoCoordinate _gpsRefPoint;
50 QGeoCoordinate _coordinateMin;
51 QGeoCoordinate _coordinateMax;
52
53 float _buildingLevelHeight = 0;
54 bool _gpsRefSet = false;
55 bool _mapLoadedFlag = false;
56};
Q_DECLARE_LOGGING_CATEGORY(AndroidSerialLog)
void parseOsmFile(const QString &filePath)
Definition OsmParser.cc:69
void buildingLevelHeightChanged()
std::pair< QGeoCoordinate, QGeoCoordinate > mapBoundingBox() const override
Definition OsmParser.h:29
QGeoCoordinate gpsRef() const override
Definition OsmParser.h:28
float buildingLevelHeight() const
Definition OsmParser.h:31
bool mapLoaded() const override
Definition OsmParser.h:27
void resetGpsRef()
Definition OsmParser.cc:41
QByteArray buildingToMesh()
Definition OsmParser.cc:78
friend class OsmParserTest
Definition OsmParser.h:21
void setGpsRef(const QGeoCoordinate &gpsRef)
Definition OsmParser.cc:34