CoordinateVector.cc 1.3 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 26 27 28 29

/// @file
///     @author Don Gagne <don@thegagnes.com>

#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)
{
    
}

30
void CoordinateVector::setCoordinates(const QGeoCoordinate& coordinate1, const QGeoCoordinate& coordinate2)
31
{
32 33
    setCoordinate1(coordinate1);
    setCoordinate2(coordinate2);
34 35
}

36 37 38 39 40 41 42 43 44
void CoordinateVector::setCoordinate1(const QGeoCoordinate &coordinate)
{
    if (_coordinate1 != coordinate) {
        _coordinate1 = coordinate;
        emit coordinate1Changed(_coordinate1);
    }
}

void CoordinateVector::setCoordinate2(const QGeoCoordinate &coordinate)
45
{
46 47 48 49
    if (_coordinate2 != coordinate) {
        _coordinate2 = coordinate;
        emit coordinate2Changed(_coordinate2);
    }
50
}