Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef WIMAPOLYGON_H
#define WIMAPOLYGON_H
#include "QGCMapPolygon.h"
#include "Vehicle.h"
class WimaPolygon : public QGCMapPolygon //abstract base class for all WimaPolygons
{
Q_OBJECT
public:
WimaPolygon(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(QmlObjectListModel* polygonFractions READ polygonFractions NOTIFY polygonFractionsChanged)
//Property accessors
double maxAltitude (void) const { return _maxAltitude;}
Vehicle* vehicle (void) const { return _vehicle;}
virtual QString mapVisualQML (void) const = 0;
virtual QString editorQML (void) const = 0;
//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);
void polygonFractionsChanged (QmlObjectListModel* pfrac);
protected:
QGCMapPolygon* extractQGCPolygon(void);
private:
double _maxAltitude;
Vehicle* _vehicle;
QmlObjectListModel* _polygonFractions;
};
#endif // WIMAPOLYGON_H