#include "WimaServiceAreaData.h"

const char *WimaServiceAreaData::typeString = "WimaServiceAreaData";

WimaServiceAreaData::WimaServiceAreaData(QObject *parent)
    : WimaAreaData(parent) {}

WimaServiceAreaData::WimaServiceAreaData(const WimaServiceAreaData &other,
                                         QObject *parent)
    : WimaAreaData(other, parent), _depot(other._depot) {}

WimaServiceAreaData::WimaServiceAreaData(const WimaServiceArea &other,
                                         QObject *parent)
    : WimaAreaData(other, parent), _depot(other.depot()) {}

WimaServiceAreaData &WimaServiceAreaData::
operator=(const WimaServiceAreaData &otherData) {
  WimaAreaData::operator=(otherData);
  this->setDepot(otherData.depot());
  return *this;
}

WimaServiceAreaData &WimaServiceAreaData::
operator=(const WimaServiceArea &otherArea) {
  WimaAreaData::operator=(otherArea);
  this->setDepot(otherArea.depot());
  return *this;
}

QString WimaServiceAreaData::mapVisualQML() const {
  return QStringLiteral("WimaServiceAreaDataVisual.qml");
}

/*!
 * \fn const QGeoCoordinate &WimaServiceAreaData::takeOffPosition() const
 * Returns a constant reference to the takeOffPosition.
 *
 */
const QGeoCoordinate &WimaServiceAreaData::depot() const { return _depot; }

QString WimaServiceAreaData::type() const { return this->typeString; }
/*!
 * \fn void WimaServiceAreaData::setTakeOffPosition(const QGeoCoordinate
 * &newCoordinate) Sets the takeoff position to the \a newCoordinate and emits
 * the takeOffPositionChanged() signal, if newCoordinate differs from the member
 * value.
 *
 */
void WimaServiceAreaData::setDepot(const QGeoCoordinate &newCoordinate) {
  if (_depot != newCoordinate) {
    _depot = newCoordinate;
    emit depotChanged(_depot);
  }
}

/*!
 * \class WimaAreaData::WimaServiceAreaData
 * \brief Class to store and exchange data of a \c WimaServiceArea Object.
 * Class to store and exchange data of a \c WimaServiceArea Object. In contrast
 * to \c WimaServiceArea this class does not provied any interface to a grafical
 * user interface, neiter it uses the QGC Fact System. It is designed to
 * exchange data between the \c WimaPlaner and the \c WimaController class. And
 * it is the derived from WimaAreaData.
 *
 * \sa WimaServiceArea, WimaAreaData
 */
