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/QByteArray>
4#include <QtCore/QString>
5#include <QtGui/QVector2D>
6#include <QtGui/QVector3D>
7#include <QtQmlIntegration/QtQmlIntegration>
8
9#include <vector>
10
11#include "Viewer3DMapProvider.h"
12
13class OsmParserThread;
14class QVariant;
15
17{
18 Q_OBJECT
19 QML_ELEMENT
20 QML_UNCREATABLE("")
21
22 friend class OsmParserTest;
23
24public:
25 explicit OsmParser(QObject *parent = nullptr);
26 ~OsmParser() override;
27
28 bool mapLoaded() const override { return _mapLoadedFlag; }
29 QGeoCoordinate gpsRef() const override { return _gpsRefPoint; }
30 std::pair<QGeoCoordinate, QGeoCoordinate> mapBoundingBox() const override { return {_coordinateMin, _coordinateMax}; }
31
32 float buildingLevelHeight() const { return _buildingLevelHeight; }
33
34 void setGpsRef(const QGeoCoordinate &gpsRef);
35 void resetGpsRef();
36 void parseOsmFile(const QString &filePath);
37 QByteArray buildingToMesh();
38
39signals:
41
42private:
43 void _setBuildingLevelHeight(const QVariant &value);
44 void _onOsmParserFinished(bool isValid);
45 void _triangulateWallsExtrudedPolygon(std::vector<QVector3D> &triangulatedMesh, const std::vector<QVector2D> &verticesCcw, float h, bool inverseOrder);
46 void _triangulateRectangle(std::vector<QVector3D> &triangulatedMesh, const std::vector<QVector3D> &verticesCcw, bool invertNormal);
47
48 OsmParserThread *_osmParserWorker = nullptr;
49
50 QGeoCoordinate _gpsRefPoint;
51 QGeoCoordinate _coordinateMin;
52 QGeoCoordinate _coordinateMax;
53
54 float _buildingLevelHeight = 0;
55 bool _gpsRefSet = false;
56 bool _mapLoadedFlag = false;
57};
void parseOsmFile(const QString &filePath)
Definition OsmParser.cc:72
void buildingLevelHeightChanged()
std::pair< QGeoCoordinate, QGeoCoordinate > mapBoundingBox() const override
Definition OsmParser.h:30
QGeoCoordinate gpsRef() const override
Definition OsmParser.h:29
float buildingLevelHeight() const
Definition OsmParser.h:32
bool mapLoaded() const override
Definition OsmParser.h:28
void resetGpsRef()
Definition OsmParser.cc:44
QByteArray buildingToMesh()
Definition OsmParser.cc:81
friend class OsmParserTest
Definition OsmParser.h:22
void setGpsRef(const QGeoCoordinate &gpsRef)
Definition OsmParser.cc:37