#include "WimaAreaData.h" const char *WimaAreaData::typeString = "WimaAreaData"; WimaAreaData::WimaAreaData(QObject *parent) : QObject(parent) { _maxAltitude = 0; } WimaAreaData::WimaAreaData(const WimaAreaData &other, QObject *parent) : QObject (parent) { *this = other; } WimaAreaData::WimaAreaData(const WimaArea &other, QObject *parent) : QObject (parent) { *this = other; } /*! * \fn WimaAreaData &WimaAreaData::operator=(const WimaAreaData &otherData) * * Copies the maximum altitude and the path of the \c WimaAreaData \a otherData to the calling object. * Returns a reference to the calling object. */ WimaAreaData &WimaAreaData::operator=(const WimaAreaData &otherData) { setMaxAltitude(otherData.maxAltitude()); setPath(otherData.path()); return *this; } /*! * \overload operator=() * * Copies the maximum altitude and the path of \c WimaArea \a otherArea to the calling object. * Returns a reference to the calling object. */ WimaAreaData &WimaAreaData::operator=(const WimaArea &otherArea) { setMaxAltitude(otherArea.maxAltitude()); setPath(otherArea.coordinateList()); return *this; } /*! * \fn double WimaAreaData::maxAltitude() * * Returns the maximum altitude at which vehicles are allowed to fly. */ double WimaAreaData::maxAltitude() const { return _maxAltitude; } /*! * \fn double WimaAreaData::maxAltitude() * * Returns the path (vertex list defining the \l {Simple Polygon}). */ QVariantList WimaAreaData::path() const { return _path; } /*! * \fn QString WimaAreaData::type() * * Returns the type name of the object. Used to destinguish between derived objects. */ QString WimaAreaData::type() const { return typeString; } /*! * \fn void WimaAreaData::setMaxAltitude(double maxAltitude) * * Sets the maximum altitude member to \a maxAltitude and emits the \c maxAltitudeChanged() signal if * \a maxAltitude differs from the members value. */ void WimaAreaData::setMaxAltitude(double maxAltitude) { if ( !qFuzzyCompare(_maxAltitude, maxAltitude) ) { _maxAltitude = maxAltitude; emit maxAltitudeChanged(_maxAltitude); } } void WimaAreaData::setPath(const QVariantList &coordinateList) { _path.clear(); _path.append(coordinateList); } /*! * \fn void WimaAreaData::setPath(const QList &coordinateList) * * Sets the path member to \a coordinateList by copying all entries of \a coordinateList. * Emits the \c pathChanged() signal. */ void WimaAreaData::setPath(const QList &coordinateList) { _path.clear(); // copy all coordinates to _path for(int i = 0; i < coordinateList.size(); i++) { _path.append(QVariant::fromValue(coordinateList.value(i))); } emit pathChanged(_path); } /*! * \class WimaArea::WimaAreaData * \brief Class to store and exchange data of a \c WimaArea Object. * Class to store and exchange data of a \c WimaArea Object. In contrast to \c WimaArea this class * does not uses the QGC Fact System. It is designed to exchange data between the \c WimaPlaner and * the \c WimaController class. And it is the base class for any derived data objects * * \sa WimaArea */