#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
