Newer
Older
#include "Vehicle.h"
#include "qobject.h"
#include "WimaVehicle.h"
#include "WimaArea.h"
#include <QLineF>
#include <QPointF>
#include "QGCGeo.h"
class WimaArea : public QGCMapPolygon //abstract base class for all WimaAreas
WimaArea(QObject* parent = nullptr);
WimaArea(const WimaArea& other, QObject* parent = nullptr);
Valentin Platzgummer
committed
WimaArea &operator=(const WimaArea &other);
Valentin Platzgummer
committed
Q_PROPERTY(double maxAltitude READ maxAltitude WRITE setMaxAltitude NOTIFY maxAltitudeChanged)
Q_PROPERTY(QString mapVisualQML READ mapVisualQML CONSTANT)
Q_PROPERTY(QString editorQML READ editorQML CONSTANT)
Valentin Platzgummer
committed
double maxAltitude (void) const { return _maxAltitude;}
Valentin Platzgummer
committed
// overrides from WimaArea
virtual QString mapVisualQML (void) const { return "WimaAreaMapVisual.qml";}
virtual QString editorQML (void) const { return "WimaAreaEditor.qml";}
Valentin Platzgummer
committed
int getClosestVertexIndex (const QGeoCoordinate& coordinate) const;
QGeoCoordinate getClosestVertex (const QGeoCoordinate& coordinate) const;
QGCMapPolygon toQGCPolygon () const;
Valentin Platzgummer
committed
bool join (WimaArea &area, QString &errorString);
Valentin Platzgummer
committed
int nextVertexIndex (int index) const;
int previousVertexIndex (int index) const;
void saveToJson (QJsonObject& jsonObject);
bool loadFromJson (const QJsonObject &jsonObject, QString& errorString);
// static Methodes
static QGCMapPolygon toQGCPolygon (const WimaArea& area);
Valentin Platzgummer
committed
static bool join (WimaArea &area1, WimaArea &area2, WimaArea& joinedArea, QString &errorString);
static bool join (WimaArea &area1, WimaArea &area2, WimaArea& joinedArea);
Valentin Platzgummer
committed
static bool intersects (const QGCMapPolyline& line1, const QGCMapPolyline& line2,
QGeoCoordinate& intersectionPt);
static bool intersects (const QGCMapPolyline& line, const WimaArea& area,
Valentin Platzgummer
committed
QList<QGeoCoordinate>& intersectionList,
QList<QPair<int, int>>& neighbourList);
static double distInsidePoly (const QGeoCoordinate& c1, const QGeoCoordinate& c2, WimaArea area);
Valentin Platzgummer
committed
static bool dijkstraPath (const QGeoCoordinate& c1, const QGeoCoordinate& c2,
Valentin Platzgummer
committed
const WimaArea& area, QList<QGeoCoordinate>& dijkstraPath, QString &errorstring);
static bool isSelfIntersecting (const WimaArea& area);
Valentin Platzgummer
committed
bool isSelfIntersecting ();
// Friends
friend void print(const WimaArea& area, QString& outputString);
friend void print(const WimaArea& area);
// Accurracy used to compute isDisjunct
Valentin Platzgummer
committed
static const double epsilonMeter;
static const char* maxAltitudeName;
static const char* wimaAreaName;
static const char* areaTypeName;
signals:
void maxAltitudeChanged (void);
Valentin Platzgummer
committed
public slots:
void setMaxAltitude (double altitude);
Valentin Platzgummer
committed
private:
private:
void init();