From 656d86a4efde50d6bda019cbef924a71a1253fe8 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Sat, 4 Nov 2017 03:58:16 +0100 Subject: [PATCH] Ref T180, isNull for CCoordinateGeodetic / situation --- src/blackmisc/aviation/aircraftsituation.h | 3 +++ src/blackmisc/geo/coordinategeodetic.h | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/blackmisc/aviation/aircraftsituation.h b/src/blackmisc/aviation/aircraftsituation.h index 9fd10acda..1af33d3eb 100644 --- a/src/blackmisc/aviation/aircraftsituation.h +++ b/src/blackmisc/aviation/aircraftsituation.h @@ -112,6 +112,9 @@ namespace BlackMisc //! Get position const Geo::CCoordinateGeodetic &getPosition() const { return m_position; } + //! Position null? + bool isPositionNull() const { return m_position.isNull(); } + //! Set position void setPosition(const Geo::CCoordinateGeodetic &position) { m_position = position; } diff --git a/src/blackmisc/geo/coordinategeodetic.h b/src/blackmisc/geo/coordinategeodetic.h index fe81f0e6c..a8872e74e 100644 --- a/src/blackmisc/geo/coordinategeodetic.h +++ b/src/blackmisc/geo/coordinategeodetic.h @@ -93,7 +93,7 @@ namespace BlackMisc QString geodeticHeightAsString() const { return this->geodeticHeight().toQString(true); } //! Geodetic height null? - bool isGeodeticHeightNull() { return this->geodeticHeight().isNull(); } + bool isGeodeticHeightNull() const { return this->geodeticHeight().isNull(); } //! Great circle distance PhysicalQuantities::CLength calculateGreatCircleDistance(const ICoordinateGeodetic &otherCoordinate) const; @@ -249,6 +249,12 @@ namespace BlackMisc //! Set normal vector void setNormalVector(double x, double y, double z) { m_x = x; m_y = y; m_z = z; } + //! Set to null + void setNull() { this->setNormalVector(0, 0, 0); } + + //! Is null? + bool isNull() const { return m_x == 0 && m_y == 0 && m_z == 0; } + //! Coordinate by WGS84 position data static CCoordinateGeodetic fromWgs84(const QString &latitudeWgs84, const QString &longitudeWgs84, const Aviation::CAltitude &geodeticHeight = {});