WimaArea.h 2.38 KB
Newer Older
1
#pragma once
2

3 4 5 6
#include "QGCMapPolygon.h"
#include "Vehicle.h"
#include "qobject.h"
#include "WimaVehicle.h"
7

8
class WimaArea : public QGCMapPolygon //abstract base class for all WimaAreas
9
{
10
    Q_OBJECT
11
public:
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
    WimaArea(QObject* parent = nullptr);
    WimaArea(WimaArea* other, QObject* parent = nullptr);
    ~WimaArea();



    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(WimaVehicle*             vehicle                     READ vehicle                    WRITE setVehicle                    NOTIFY vehicleChanged)

    //Property accessors
    double                  maxAltitude         (void) const    { return _maxAltitude;}
    WimaVehicle*            vehicle             (void) const    { return _wimaVehicle;}

    virtual QString                     mapVisualQML    (void) const = 0;
    virtual QString                     editorQML       (void) const = 0;

    //Property setters
    void        setMaxAltitude     (double alt);
    void        setVehicle         (WimaVehicle* vehicle);

    // Member Methodes
    /*template <class T>
    QList<T*>*      splitArea        (WimaArea *polygonToSplitt, int numberOfFractions); // use QScopedPointer to store return value
    template <class T>
    QList<T*>*      splitArea        (int numberOfFractions); // use QScopedPointer to store return value*/
    //iterates over all vertices in _polygon and returns the index of that one closest to coordinate
    int                    getClosestVertexIndex   (QGeoCoordinate coordinate);
    //iterates over all vertices in _polygon and returns that one closest to coordinate
42 43 44
    QGeoCoordinate        getClosestVertex        (QGeoCoordinate coordinate);
    QGCMapPolygon*         toQGCPolygon            (WimaArea* poly);
    QGCMapPolygon*         joinPolygons            (QList<QGCMapPolygon*> polyList);
45 46 47 48 49 50 51 52 53

signals:
    void    maxAltitudeChanged      (void);
    void    vehicleChanged          (void);


protected:
    double                  _maxAltitude;
    WimaVehicle*            _wimaVehicle;
54 55
};

56