WimaServiceAreaData.cc 3.11 KB
Newer Older
Valentin Platzgummer's avatar
Valentin Platzgummer committed
1 2
#include "WimaServiceAreaData.h"

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

Valentin Platzgummer's avatar
Valentin Platzgummer committed
5 6 7 8 9 10 11

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

}

12 13 14 15 16 17 18 19 20 21 22 23 24 25
WimaServiceAreaData::WimaServiceAreaData(const WimaServiceAreaData &other, QObject *parent)
    :   WimaAreaData (parent)
{
    *this = other;
}

WimaServiceAreaData::WimaServiceAreaData(const WimaServiceArea &other, QObject *parent)
    :   WimaAreaData (parent)
{
    *this = other;
}

WimaServiceAreaData &WimaServiceAreaData::operator=(const WimaServiceAreaData &otherData)
{
26
    this->assign(otherData);
27 28 29 30 31

    return *this;
}

WimaServiceAreaData &WimaServiceAreaData::operator=(const WimaServiceArea &otherArea)
Valentin Platzgummer's avatar
Valentin Platzgummer committed
32
{
33
    this->assign(otherArea);
Valentin Platzgummer's avatar
Valentin Platzgummer committed
34

35
    return *this;
Valentin Platzgummer's avatar
Valentin Platzgummer committed
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
}

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

/*!
 * \fn const QGeoCoordinate &WimaServiceAreaData::landOffPosition() const
 * Returns a constant reference to the landOffPosition.
 *
 */
53
const QGeoCoordinate &WimaServiceAreaData::landPosition() const
Valentin Platzgummer's avatar
Valentin Platzgummer committed
54 55 56 57
{
    return _landPosition;
}

58 59 60 61
QString WimaServiceAreaData::type() const
{
    return this->typeString;
}
Valentin Platzgummer's avatar
Valentin Platzgummer committed
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
/*!
 * \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::setTakeOffPosition(const QGeoCoordinate &newCoordinate)
{
    if (_takeOffPosition != newCoordinate) {
        _takeOffPosition = newCoordinate;

        emit takeOffPositionChanged(_takeOffPosition);
    }
}

/*!
 * \fn void WimaServiceAreaData::setLandOffPosition(const QGeoCoordinate &newCoordinate)
 * Sets the land position to the \a newCoordinate and emits the landOffPositionChanged() signal,
 * if newCoordinate differs from the member value.
 *
 */
83
void WimaServiceAreaData::setLandPosition(const QGeoCoordinate &newCoordinate)
Valentin Platzgummer's avatar
Valentin Platzgummer committed
84 85 86 87
{
    if (_landPosition != newCoordinate) {
        _landPosition = newCoordinate;

88
        emit landPositionChanged(_landPosition);
Valentin Platzgummer's avatar
Valentin Platzgummer committed
89 90 91
    }
}

92 93 94 95 96 97 98 99 100 101 102 103 104 105
void WimaServiceAreaData::assign(const WimaServiceAreaData &other)
{
    WimaAreaData::assign(other);
    setLandPosition(other.landPosition());
    setTakeOffPosition(other.takeOffPosition());
}

void WimaServiceAreaData::assign(const WimaServiceArea &other)
{
    WimaAreaData::assign(other);
    setLandPosition(other.landPosition());
    setTakeOffPosition(other.takeOffPosition());
}

106

Valentin Platzgummer's avatar
Valentin Platzgummer committed
107 108 109 110 111 112 113 114 115 116
/*!
 * \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
 */