Commit 6240302b authored by Nate Weibley's avatar Nate Weibley

Updating CoordinateVector to be less noisy and easier to bind to VisualMissionItems

parent b669753d
......@@ -27,15 +27,24 @@ CoordinateVector::CoordinateVector(const QGeoCoordinate& coordinate1, const QGeo
}
CoordinateVector::~CoordinateVector()
void CoordinateVector::setCoordinates(const QGeoCoordinate& coordinate1, const QGeoCoordinate& coordinate2)
{
setCoordinate1(coordinate1);
setCoordinate2(coordinate2);
}
void CoordinateVector::setCoordinates(const QGeoCoordinate& coordinate1, const QGeoCoordinate& coordinate2)
void CoordinateVector::setCoordinate1(const QGeoCoordinate &coordinate)
{
if (_coordinate1 != coordinate) {
_coordinate1 = coordinate;
emit coordinate1Changed(_coordinate1);
}
}
void CoordinateVector::setCoordinate2(const QGeoCoordinate &coordinate)
{
_coordinate1 = coordinate1;
_coordinate2 = coordinate2;
emit coordinate1Changed(_coordinate1);
emit coordinate2Changed(_coordinate2);
if (_coordinate2 != coordinate) {
_coordinate2 = coordinate;
emit coordinate2Changed(_coordinate2);
}
}
......@@ -21,12 +21,15 @@ class CoordinateVector : public QObject
public:
CoordinateVector(QObject* parent = NULL);
CoordinateVector(const QGeoCoordinate& coordinate1, const QGeoCoordinate& coordinate2, QObject* parent = NULL);
~CoordinateVector();
Q_PROPERTY(QGeoCoordinate coordinate1 MEMBER _coordinate1 NOTIFY coordinate1Changed)
Q_PROPERTY(QGeoCoordinate coordinate2 MEMBER _coordinate2 NOTIFY coordinate2Changed)
void setCoordinates(const QGeoCoordinate& coordinate1, const QGeoCoordinate& coordinate2);
public slots:
void setCoordinate1(const QGeoCoordinate& coordinate);
void setCoordinate2(const QGeoCoordinate& coordinate);
signals:
void coordinate1Changed(QGeoCoordinate coordinate);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment