WimaPolyline.h 2.1 KB
Newer Older
Valentin Platzgummer's avatar
Valentin Platzgummer committed
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
#ifndef WIMAPOLYLINE_H
#define WIMAPOLYLINE_H

#include <QObject>
#include "QGCMapPolyline.h"
#include "QGCMapPolygon.h"

class WimaPolyline : public QObject
{
    Q_OBJECT
public:
    WimaPolyline(QObject *parent = nullptr);
    WimaPolyline(QGCMapPolyline *polyline, QObject *parent = nullptr);

    Q_PROPERTY(QGCMapPolyline const*    polyline            READ polyline                                       NOTIFY polylineChanged)
    Q_PROPERTY(int                      startVertexIndex    READ startVertexIndex   WRITE setStartVertexIndex   NOTIFY startVertexIndexChanged)
    Q_PROPERTY(int                      endVertexIndex      READ endVertexIndex     WRITE setEndVertexIndex     NOTIFY endVertexIndexChanged)
    Q_PROPERTY(bool                     interactive         READ interactive        WRITE setInteractive        NOTIFY interactiveChanged)

    // Property accessors
    QGCMapPolyline const*   polyline            (void) const { return &_polyline;}
    int                     startVertexIndex    (void) const { return _startVertexIndex;}
    int                     endVertexIndex      (void) const { return _endVertexIndex;}
    bool                    interactive         (void) const { return _polyline.interactive();}


    //Property setters
    Q_INVOKABLE  void       bindPolygon             (QGCMapPolygon* polygon);
    Q_INVOKABLE  void       unbindPolygon           ();
    Q_INVOKABLE  void       swapLimits              ();
    Q_INVOKABLE  void       setInteractive          (bool interactive);
    void                    setStartVertexIndex     (int PolygonVertexIndex);
    void                    setEndVertexIndex       (int PolygonVertexIndex);





signals:
    void polylineChanged            (void);
    void startVertexIndexChanged    (void);
    void endVertexIndexChanged      (void);
    void interactiveChanged         (void);

public slots:
    void recalcPolyline(void);

private:
    QGCMapPolyline              _polyline;
    QGCMapPolygon*              _boundPolygon;
    int                         _startVertexIndex;
    int                         _endVertexIndex;

};

#endif // WIMAPOLYLINE_H