WimaFlyArea.h 1.6 KB
Newer Older
Valentin Platzgummer's avatar
Valentin Platzgummer committed
1 2 3 4 5
#ifndef WIMAFLYAREA_H
#define WIMAFLYAREA_H

#include <QObject>
#include "QGCMapPolygon.h"
6
#include "QmlObjectListModel.h"
Valentin Platzgummer's avatar
Valentin Platzgummer committed
7 8 9 10 11 12 13 14 15 16 17 18

class WimaFlyArea : public QObject
{
    Q_OBJECT
public:
    WimaFlyArea(QObject *parent = nullptr);
    WimaFlyArea(const WimaFlyArea& other, QObject *parent = nullptr);

    const WimaFlyArea& operator=(const WimaFlyArea& other);



19 20 21
    Q_PROPERTY(QmlObjectListModel   *polygons                           READ    polygons                NOTIFY  polygonsChanged)
    Q_PROPERTY(QGCMapPolygon        *currentPolygonItem                 READ    currentPolygonItem      NOTIFY  currentPolygonItemChanged)
    Q_PROPERTY(int                  currentPolygonIndex                 READ    currentPolygonIndex     NOTIFY  currentPolygonIndexChanged)
22

23 24 25
    Q_INVOKABLE void appendFlyAreaPolygon();
    Q_INVOKABLE void removeFlyAreaPolygon(int index);
    Q_INVOKABLE void setCurrentPolygon(int index);
Valentin Platzgummer's avatar
Valentin Platzgummer committed
26 27

    //  Property Accessors
28 29 30
    QmlObjectListModel *        polygons                        (void)        { return _polygons;}
    QGCMapPolygon *             currentPolygonItem              (void)        { return _currentPolygonItem;}
    int                         currentPolygonIndex             (void)        { return _currentPolygonIndex;}
Valentin Platzgummer's avatar
Valentin Platzgummer committed
31 32 33


    // Methodes
34
    void _init(void);
Valentin Platzgummer's avatar
Valentin Platzgummer committed
35 36

signals:
37
    void polygonsChanged(void);
38 39
    void currentPolygonItemChanged(QGCMapPolygon * polygon);
    void currentPolygonIndexChanged(int index);
Valentin Platzgummer's avatar
Valentin Platzgummer committed
40 41 42 43 44


public slots:

private:
45 46 47



Valentin Platzgummer's avatar
Valentin Platzgummer committed
48
    QmlObjectListModel* _polygons;
49 50
    QGCMapPolygon*      _currentPolygonItem;
    int                 _currentPolygonIndex;
51 52


Valentin Platzgummer's avatar
Valentin Platzgummer committed
53 54 55
};

#endif // WIMAFLYAREA_H