Ref T259, Ref T243 access to last interpolated situation to check if near ground

This commit is contained in:
Klaus Basan
2018-03-29 00:49:46 +02:00
parent 9d484df5ed
commit 52dd7a754c
9 changed files with 53 additions and 6 deletions

View File

@@ -10,7 +10,7 @@
#include "blackmisc/aviation/aircraftsituation.h"
#include "blackmisc/aviation/aircraftpartslist.h"
#include "blackmisc/geo/elevationplane.h"
#include "blackmisc/pq/physicalquantity.h"
#include "blackmisc/pq/length.h"
#include "blackmisc/pq/units.h"
#include "blackmisc/propertyindex.h"
#include "blackmisc/comparefunctions.h"
@@ -108,6 +108,18 @@ namespace BlackMisc
return small;
}
const CAircraftSituation &CAircraftSituation::null()
{
static const CAircraftSituation n;
return n;
}
const CLength &CAircraftSituation::defaultCG()
{
static const CLength cg(2.5, CLengthUnit::m());
return cg;
}
CVariant CAircraftSituation::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
{
if (index.isMyself()) { return CVariant::from(*this); }
@@ -412,7 +424,19 @@ namespace BlackMisc
bool CAircraftSituation::canLikelySkipNearGroundInterpolation() const
{
// those we can exclude
if (this->isOnGround() && this->hasInboundGroundInformation()) { return false; }
// cases where we can skip
if (this->isNull()) { return true; }
if (this->getGroundSpeed().value(CSpeedUnit::kts()) > 250) { return true; }
if (this->hasGroundElevation())
{
static const CLength threshold(400, CLengthUnit::m());
const CLength a = this->getHeightAboveGround();
if (!a.isNull() && a >= threshold) { return true; } // too high for ground
}
return false;
}