WimaPolygon.h 2.63 KB
Newer Older
1 2 3 4
#ifndef WIMAPOLYGON_H
#define WIMAPOLYGON_H

#include "QGCMapPolygon.h"
5
#include "QGCMapPolyline.h"
6
#include "Vehicle.h"
7
#include "qobject.h"
8 9 10



11
class WimaPolygon : public QObject //abstract base class for all WimaPolygons
12 13 14 15
{
    Q_OBJECT
public:
    WimaPolygon(QObject* parent = nullptr);
16
    WimaPolygon(QGCMapPolygon* other, QObject* parent = nullptr);
17 18 19



20 21 22 23 24 25 26
    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)
    Q_PROPERTY(QList<WimaPolygon*>      subPolygons                 READ subPolygons                                                    NOTIFY subPolygonsChanged)
    Q_PROPERTY(QList<QGCMapPolyline*>   subPolylines                READ subPolylines                                                   NOTIFY  subPolylinesChanged)
27 28

    //Property accessors
29 30 31
    double                  maxAltitude         (void) const    { return _maxAltitude;}
    Vehicle*                vehicle             (void) const    { return _vehicle;}
    QGCMapPolygon*          polygon             (void) const    { return _polygon;}
32 33
    QList<WimaPolygon*>     subPolygons         (void) const    { return _subPolygons;}
    QList<QGCMapPolyline*>  subPolylines        (void) const    { return _subPolylines;}
34 35 36

    virtual QString                     mapVisualQML    (void) const = 0;
    virtual QString                     editorQML       (void) const = 0;
37 38 39 40 41 42

    //Property setters
    void        setMaxAltitude     (double alt);
    void        setName            (QString name);
    void        setVehicle         (Vehicle* vehicle);

43 44

    QGCMapPolygon* splitPolygonArea(int numberOfFractions);
45 46 47


signals:
48 49 50
    void    maxAltitudeChanged      (void);
    void    vehicleChanged          (void);
    void    subPolygons             (void);
51 52 53 54 55 56 57


private:


    double                  _maxAltitude;
    Vehicle*                _vehicle;
58 59
    QGCMapPolygon*          _polygon;
    QList<WimaPolygon*>     _subPolygons;
60
    QList<QGCMapPolyline*>  _subPolylines;
61 62 63
};

#endif // WIMAPOLYGON_H