Skip to content
WimaServiceArea.cc 1.48 KiB
Newer Older
#include "WimaServiceArea.h"

const char* WimaServiceArea::wimaServiceAreaName = "Service Area";

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

WimaServiceArea::WimaServiceArea(WimaArea *other, QObject *parent):
    WimaArea (other, parent)
{
    this->setObjectName(wimaServiceAreaName);
void WimaServiceArea::setTakeOffPosition(const QGeoCoordinate &coordinate)
    if(_takeOffPosition != coordinate){
        _takeOffPosition = coordinate;
        emit takeOffPositionChanged();
    }
}

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

void WimaServiceArea::setVehicleCorridor(WimaVCorridor &corridor)
{

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

void WimaServiceArea::saveToJson(QJsonObject &json)
{
    this->WimaArea::saveToJson(json);
    json[areaTypeName] = wimaServiceAreaName;
}

bool WimaServiceArea::loadFromJson(const QJsonObject &json, QString &errorString)
    if ( this->WimaArea::loadFromJson(json, errorString)) {
        bool retVal = true;
        // code for loading here
        return retVal;
    } else {
        qWarning() << errorString;
        return false;