Newer
Older
#ifndef WIMAPOLYGON_H
#define WIMAPOLYGON_H
#include "QGCMapPolygon.h"
#include "Vehicle.h"
class WimaPolygon : public QObject //abstract base class for all WimaPolygons
{
Q_OBJECT
public:
WimaPolygon(QObject* parent = nullptr);
WimaPolygon(QGCMapPolygon* other, QObject* parent = nullptr);
Q_PROPERTY(double maxAltitude READ maxAltitude WRITE setMaxAltitude NOTIFY maxAltitudeChanged)
Q_PROPERTY(QString mapVisualQML READ mapVisualQML CONSTANT)
Q_PROPERTY(QString editorQML READ editorQML CONSTANT)
Q_PROPERTY(Vehicle* vehicle READ vehicle WRITE setVehicle NOTIFY vehicleChanged)
Q_PROPERTY(QGCMapPolygon* polygon READ polygon NOTIFY polygonChanged)
double maxAltitude (void) const { return _maxAltitude;}
Vehicle* vehicle (void) const { return _vehicle;}
QGCMapPolygon* polygon (void) const { return _polygon;}
virtual QString mapVisualQML (void) const = 0;
virtual QString editorQML (void) const = 0;
virtual QList<WimaPolygon*>& subPolygons (void) { return _subPolygons;}
//Property setters
void setMaxAltitude (double alt);
void setName (QString name);
void setVehicle (Vehicle* vehicle);
/// Splits the polygon in numberOfFractions fractions with equal area.
/// @param polygonFractions The polygon List to add the fractions to.
/// @param numberOfFractions The number of fractions to split the polygon to.
Q_INVOKABLE QmlObjectListModel* splitPolygonArea(int numberOfFractions);
signals:
void maxAltitudeChanged (double alt);
void vehicleChanged (Vehicle* vehicle);
protected:
QGCMapPolygon* extractQGCPolygon(void);
private:
double _maxAltitude;
Vehicle* _vehicle;
QGCMapPolygon* _polygon;
QList<WimaPolygon*> _subPolygons;
};
#endif // WIMAPOLYGON_H