#include "WimaServiceArea.h"

WimaServiceArea::WimaServiceArea(QObject *parent):
    WimaServiceArea (nullptr, parent)
{

}

WimaServiceArea::WimaServiceArea(WimaArea *other, QObject *parent):
    WimaArea (other, parent)
{
    _polyline.bindPolygon(this);
    this->setObjectName("Service Area");
}

void WimaServiceArea::setTakeOffPosition(QGeoCoordinate* coordinate)
{
    if(_takeOffPosition != *coordinate){
        _takeOffPosition = *coordinate;
        emit takeOffPositionChanged();
    }
}

void WimaServiceArea::setLandPosition(QGeoCoordinate* coordinate)
{
    if(_landPosition != *coordinate){
        _landPosition = *coordinate;
        emit landPositionChanged();
    }
}

void WimaServiceArea::setVehicleCorridor(WimaVCorridor *corridor)
{
    if(corridor != nullptr){
        if (corridor != _vehicleCorridor){
            _vehicleCorridor = corridor;
            emit vehicleCorridorChanged(_vehicleCorridor);
        }
        else {
            qWarning("WimaServiceArea::setVehicleCorridor(): new corridor equals old _vehicleCorridor!");
        }
    }else{
        qWarning("WimaServiceArea::setVehicleCorridor(): corridor == nullptr!");
    }
}

