#include "WimaFlyArea.h"

WimaFlyArea::WimaFlyArea(QObject *parent) : QObject(parent)
  , _polygons             (nullptr)
{

}

WimaFlyArea::WimaFlyArea(const WimaFlyArea &other, QObject *parent): QObject(parent)
{
    *this = other;
}

const WimaFlyArea& WimaFlyArea::operator=(const WimaFlyArea& other)
{
    this->_polygons = other._polygons;
    return *this;
}

void WimaFlyArea::_init()
{
    _polygons = new QmlObjectListModel(this);
}

void WimaFlyArea::append_WimaFlyArea()
{
    QGCMapPolygon *newPolygon  = new QGCMapPolygon();
    newPolygon->setInteractive(true);

    for (int i = 0; i < _polygons->count(); i++) {
        QGCMapPolygon* polygon = qobject_cast<QGCMapPolygon*>(_polygons->get(i));
        polygon->setInteractive(false);
    }

    _polygons->append(newPolygon);

    emit polygonsChanged();
}



