mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 15:25:35 +08:00
Ref T259, Ref T243 utility functions for aircraft situation/elevation plane
This commit is contained in:
@@ -381,6 +381,12 @@ namespace BlackMisc
|
||||
return gsKmh >= 1.0;
|
||||
}
|
||||
|
||||
bool CAircraftSituation::canLikelySkipNearGroundInterpolation() const
|
||||
{
|
||||
if (this->getGroundSpeed().value(CSpeedUnit::kts()) > 250) { return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
CLength CAircraftSituation::getDistancePerTime(const CTime &time) const
|
||||
{
|
||||
if (this->getGroundSpeed().isNull()) { return CLength(0, CLengthUnit::nullUnit()); }
|
||||
|
||||
@@ -274,6 +274,9 @@ namespace BlackMisc
|
||||
//! Is moving? Means ground speed > epsilon
|
||||
bool isMoving() const;
|
||||
|
||||
//! Situation looks like an aircraft not near ground
|
||||
bool canLikelySkipNearGroundInterpolation() const;
|
||||
|
||||
//! Distance per time
|
||||
PhysicalQuantities::CLength getDistancePerTime(const PhysicalQuantities::CTime &time) const;
|
||||
|
||||
|
||||
@@ -77,5 +77,20 @@ namespace BlackMisc
|
||||
{
|
||||
return this->findBy(&CAircraftSituation::hasInboundGroundInformation, hasGroundInfo);
|
||||
}
|
||||
|
||||
bool CAircraftSituationList::hasSituationWithoutGroundElevation() const
|
||||
{
|
||||
return this->contains(&CAircraftSituation::hasGroundElevation, false);
|
||||
}
|
||||
|
||||
bool CAircraftSituationList::hasGroundElevationOutsideRange(const CLength &range) const
|
||||
{
|
||||
for (const CAircraftSituation &situation : *this)
|
||||
{
|
||||
if (!situation.hasGroundElevation()) { return true; }
|
||||
if (situation.getGroundElevationPlane().getRadius() > range) { return true; }
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -62,6 +62,12 @@ namespace BlackMisc
|
||||
|
||||
//! Find if having inbound information
|
||||
CAircraftSituationList findByInboundGroundInformation(bool hasGroundInfo) const;
|
||||
|
||||
//! Any situation without ground info
|
||||
bool hasSituationWithoutGroundElevation() const;
|
||||
|
||||
//! Any situation outside range
|
||||
bool hasGroundElevationOutsideRange(const PhysicalQuantities::CLength &range) const;
|
||||
};
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "elevationplane.h"
|
||||
#include "coordinategeodetic.h"
|
||||
#include "blackmisc/pq/length.h"
|
||||
#include "blackmisc/propertyindex.h"
|
||||
|
||||
@@ -27,6 +28,12 @@ namespace BlackMisc
|
||||
m_radius.valueRoundedWithUnit(2, i18n));
|
||||
}
|
||||
|
||||
CElevationPlane::CElevationPlane(const ICoordinateGeodetic &coordinate, const ICoordinateGeodetic &rangeCoordinate) :
|
||||
CCoordinateGeodetic(coordinate)
|
||||
{
|
||||
m_radius = this->calculateGreatCircleDistance(rangeCoordinate);
|
||||
}
|
||||
|
||||
const CAltitude &CElevationPlane::getAltitudeIfWithinRadius(const ICoordinateGeodetic &coordinate) const
|
||||
{
|
||||
return (isWithinRange(coordinate)) ? geodeticHeight() : CAltitude::null();
|
||||
|
||||
@@ -21,8 +21,7 @@ namespace BlackMisc
|
||||
{
|
||||
//! Plane of same elevation, can be a single point or larger area (e.g. airport)
|
||||
//! \remark 100km/h 1sec => 28m
|
||||
class BLACKMISC_EXPORT CElevationPlane :
|
||||
public CValueObject<CElevationPlane, CCoordinateGeodetic>
|
||||
class BLACKMISC_EXPORT CElevationPlane : public CCoordinateGeodetic
|
||||
{
|
||||
public:
|
||||
//! Properties by index
|
||||
@@ -34,8 +33,11 @@ namespace BlackMisc
|
||||
//! Default constructor
|
||||
CElevationPlane() {}
|
||||
|
||||
//! Plane at given coordinates with range to 2nd coordinate
|
||||
CElevationPlane(const ICoordinateGeodetic &coordinate, const ICoordinateGeodetic &rangeCoordinate);
|
||||
|
||||
//! Constructors from CCoordinateGeodetic
|
||||
using CValueObject<CElevationPlane, CCoordinateGeodetic>::CValueObject;
|
||||
using CCoordinateGeodetic::CCoordinateGeodetic;
|
||||
|
||||
//! Radius
|
||||
const PhysicalQuantities::CLength &getRadius() const { return m_radius; }
|
||||
|
||||
Reference in New Issue
Block a user