mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 16:56:53 +08:00
Ref T259, Ref T243 functions for ground factor/underflow interpolation
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user