CoordinateVector.cc 1.25 KB
Newer Older
1 2 3 4 5 6 7 8 9
/****************************************************************************
 *
 *   (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/

10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
#include "CoordinateVector.h"

CoordinateVector::CoordinateVector(QObject* parent)
    : QObject(parent)
{

}

CoordinateVector::CoordinateVector(const QGeoCoordinate& coordinate1, const QGeoCoordinate& coordinate2, QObject* parent)
    : QObject(parent)
    , _coordinate1(coordinate1)
    , _coordinate2(coordinate2)
{
    
}

26
void CoordinateVector::setCoordinates(const QGeoCoordinate& coordinate1, const QGeoCoordinate& coordinate2)
27
{
28 29
    setCoordinate1(coordinate1);
    setCoordinate2(coordinate2);
30 31
}

32 33 34 35 36 37 38 39 40
void CoordinateVector::setCoordinate1(const QGeoCoordinate &coordinate)
{
    if (_coordinate1 != coordinate) {
        _coordinate1 = coordinate;
        emit coordinate1Changed(_coordinate1);
    }
}

void CoordinateVector::setCoordinate2(const QGeoCoordinate &coordinate)
41
{
42 43 44 45
    if (_coordinate2 != coordinate) {
        _coordinate2 = coordinate;
        emit coordinate2Changed(_coordinate2);
    }
46
}