mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 21:56:43 +08:00
Ref T236, isNull default implementation of ICoordinateGeodetic
Also interface can be checked agains null
This commit is contained in:
@@ -95,6 +95,10 @@ namespace BlackMisc
|
||||
//! Geodetic height null?
|
||||
bool isGeodeticHeightNull() const { return this->geodeticHeight().isNull(); }
|
||||
|
||||
//! Is null, means vector x, y, z == 0
|
||||
//! \remark this is a default implementation, concrete implementations of ICoordinateGeodetic might override it
|
||||
virtual bool isNull() const { return this->normalVector().isNull(); }
|
||||
|
||||
//! Great circle distance
|
||||
PhysicalQuantities::CLength calculateGreatCircleDistance(const ICoordinateGeodetic &otherCoordinate) const;
|
||||
|
||||
@@ -256,7 +260,7 @@ namespace BlackMisc
|
||||
void setNull() { this->setNormalVector(0, 0, 0); }
|
||||
|
||||
//! Is null?
|
||||
bool isNull() const { return m_x == 0 && m_y == 0 && m_z == 0; }
|
||||
virtual bool isNull() const override { 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 = {});
|
||||
|
||||
@@ -24,8 +24,7 @@ namespace BlackMisc
|
||||
return s.arg(this->latitude().valueRoundedWithUnit(6, i18n),
|
||||
this->longitude().valueRoundedWithUnit(6, i18n),
|
||||
this->geodeticHeight().valueRoundedWithUnit(6, i18n),
|
||||
m_radius.valueRoundedWithUnit(2, i18n)
|
||||
);
|
||||
m_radius.valueRoundedWithUnit(2, i18n));
|
||||
}
|
||||
|
||||
const CAltitude &CElevationPlane::getAltitudeIfWithinRadius(const ICoordinateGeodetic &coordinate) const
|
||||
@@ -40,6 +39,7 @@ namespace BlackMisc
|
||||
|
||||
bool CElevationPlane::isWithinRange(const ICoordinateGeodetic &coordinate) const
|
||||
{
|
||||
if (coordinate.isNull()) { return false; }
|
||||
if (isNull()) { return false; }
|
||||
const CLength d = this->calculateGreatCircleDistance(coordinate);
|
||||
const bool inRange = (m_radius >= d);
|
||||
|
||||
Reference in New Issue
Block a user