Ref T231, arbitrary radius for elevation plane

This commit is contained in:
Klaus Basan
2018-01-26 22:23:00 +01:00
parent 844436e744
commit e7f2d639c1
2 changed files with 17 additions and 3 deletions

View File

@@ -34,7 +34,7 @@ namespace BlackMisc
bool CElevationPlane::isNull() const
{
return m_radius.isNull();
return m_radius.isNull() || CCoordinateGeodetic::isNull();
}
bool CElevationPlane::isWithinRange(const ICoordinateGeodetic &coordinate) const
@@ -46,6 +46,16 @@ namespace BlackMisc
return inRange;
}
bool CElevationPlane::isWithinRange(const ICoordinateGeodetic &coordinate, const CLength &radius) const
{
if (coordinate.isNull()) { return false; }
if (radius.isNull()) { return false; }
if (isNull()) { return false; }
const CLength d = this->calculateGreatCircleDistance(coordinate);
const bool inRange = (radius >= d);
return inRange;
}
void CElevationPlane::setSinglePointRadius()
{
m_radius = singlePointRadius();

View File

@@ -48,12 +48,16 @@ namespace BlackMisc
//! Altitude (synonym for geodetic height)
const Aviation::CAltitude &getAltitude() const { return this->geodeticHeight(); }
//! Existing value
bool isNull() const;
//! Existing value?
virtual bool isNull() const override;
//! Check if elevation is within radius and can be used
//! \remark checks against the set radius
bool isWithinRange(const ICoordinateGeodetic &coordinate) const;
//! Check if elevation is within radius and can be used
bool isWithinRange(const ICoordinateGeodetic &coordinate, const PhysicalQuantities::CLength &radius) const;
//! Treat as single point as obtained from simulator
void setSinglePointRadius();