Skip to content
WimaArea.h 2.23 KiB
Newer Older
#pragma once
#include "QGCMapPolygon.h"
#include "Vehicle.h"
#include "qobject.h"
#include "WimaVehicle.h"
class WimaArea : public QGCMapPolygon //abstract base class for all WimaAreas
public:
    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
    QGeoCoordinate         getClosestVertex        (QGeoCoordinate coordinate);

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


protected:
    double                  _maxAltitude;
    WimaVehicle*            _wimaVehicle;