Ref T259, Ref T243 functions for ground factor/underflow interpolation

This commit is contained in:
Klaus Basan
2018-03-28 03:55:06 +02:00
parent a7f1e15f39
commit dd9efc9bb1
4 changed files with 58 additions and 7 deletions

View File

@@ -229,9 +229,15 @@ namespace BlackMisc
void CAircraftSituation::setOnGroundFactor(double groundFactor)
{
if (groundFactor < 0.0) { m_onGroundFactor = -1.0; return; }
if (groundFactor > 1.0) { m_onGroundFactor = 1.0; return; }
m_onGroundFactor = groundFactor;
double gf = groundFactor;
do
{
if (groundFactor < 0.0) { gf = -1.0; break; }
if (groundFactor < 0.001) { gf = 0.0; break; }
if (groundFactor > 0.999) { gf = 1.0; break; }
}
while (false);
m_onGroundFactor = gf;
}
bool CAircraftSituation::guessOnGround(bool vtol, const PhysicalQuantities::CLength &cg)
@@ -271,6 +277,29 @@ namespace BlackMisc
return CAircraftSituation::onGroundDetailsToString(this->getOnGroundDetails());
}
bool CAircraftSituation::setOnGroundFromGroundFactorFromInterpolation(double threshold)
{
this->setOnGroundDetails(OnGroundByInterpolation);
if (this->getOnGroundFactor() < 0.0)
{
this->setOnGround(NotSet);
return false;
}
// set on ground but leave factor untouched
const bool og = this->getOnGroundFactor() > threshold; // 1.0 means on ground
m_onGround = og ? OnGround : NotOnGround;
return true;
}
bool CAircraftSituation::setOnGroundByUnderflowDetection(const CLength &cg)
{
IsOnGround og = this->isOnGroundByElevation(cg);
if (og == OnGroundSituationUnknown) { return false; }
this->setOnGround(og, OnGroundByElevationAndCG);
return true;
}
QString CAircraftSituation::getOnGroundInfo() const
{
return this->onGroundAsString() % QLatin1Char(' ') % this->getOnDetailsAsString();