mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-15 01:05:35 +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)
|
void CAircraftSituation::setOnGroundFactor(double groundFactor)
|
||||||
{
|
{
|
||||||
if (groundFactor < 0.0) { m_onGroundFactor = -1.0; return; }
|
double gf = groundFactor;
|
||||||
if (groundFactor > 1.0) { m_onGroundFactor = 1.0; return; }
|
do
|
||||||
m_onGroundFactor = groundFactor;
|
{
|
||||||
|
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)
|
bool CAircraftSituation::guessOnGround(bool vtol, const PhysicalQuantities::CLength &cg)
|
||||||
@@ -271,6 +277,29 @@ namespace BlackMisc
|
|||||||
return CAircraftSituation::onGroundDetailsToString(this->getOnGroundDetails());
|
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
|
QString CAircraftSituation::getOnGroundInfo() const
|
||||||
{
|
{
|
||||||
return this->onGroundAsString() % QLatin1Char(' ') % this->getOnDetailsAsString();
|
return this->onGroundAsString() % QLatin1Char(' ') % this->getOnDetailsAsString();
|
||||||
|
|||||||
@@ -188,6 +188,12 @@ namespace BlackMisc
|
|||||||
//! On ground details
|
//! On ground details
|
||||||
void setOnGroundDetails(CAircraftSituation::OnGroundDetails details) { m_onGroundDetails = static_cast<int>(details); }
|
void setOnGroundDetails(CAircraftSituation::OnGroundDetails details) { m_onGroundDetails = static_cast<int>(details); }
|
||||||
|
|
||||||
|
//! Set on ground as interpolated from ground fatcor
|
||||||
|
bool setOnGroundFromGroundFactorFromInterpolation(double threshold = 0.5);
|
||||||
|
|
||||||
|
//! Set on ground by underflow detection, detects below ground scenarios
|
||||||
|
bool setOnGroundByUnderflowDetection(const PhysicalQuantities::CLength &cg);
|
||||||
|
|
||||||
//! On ground info as string
|
//! On ground info as string
|
||||||
QString getOnGroundInfo() const;
|
QString getOnGroundInfo() const;
|
||||||
|
|
||||||
|
|||||||
@@ -108,6 +108,19 @@ namespace BlackMisc
|
|||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CSimulatedAircraftList::setFastPositionUpdates(const CCallsign &callsign, bool fastPositions, bool onlyFirst)
|
||||||
|
{
|
||||||
|
int c = 0;
|
||||||
|
for (CSimulatedAircraft &aircraft : (*this))
|
||||||
|
{
|
||||||
|
if (aircraft.getCallsign() != callsign) { continue; }
|
||||||
|
aircraft.setFastPositionUpdates(fastPositions);
|
||||||
|
c++;
|
||||||
|
if (onlyFirst) break;
|
||||||
|
}
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
int CSimulatedAircraftList::setEnabled(const CCallsign &callsign, bool enabled, bool onlyFirst)
|
int CSimulatedAircraftList::setEnabled(const CCallsign &callsign, bool enabled, bool onlyFirst)
|
||||||
{
|
{
|
||||||
int c = 0;
|
int c = 0;
|
||||||
@@ -134,7 +147,7 @@ namespace BlackMisc
|
|||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CSimulatedAircraftList::setAircraftParts(const CCallsign &callsign, const CAircraftParts &parts, bool onlyFirst)
|
int CSimulatedAircraftList::setAircraftPartsSynchronized(const CCallsign &callsign, const CAircraftParts &parts, bool onlyFirst)
|
||||||
{
|
{
|
||||||
int c = 0;
|
int c = 0;
|
||||||
for (CSimulatedAircraft &aircraft : (*this))
|
for (CSimulatedAircraft &aircraft : (*this))
|
||||||
|
|||||||
@@ -79,13 +79,16 @@ namespace BlackMisc
|
|||||||
int setRendered(const Aviation::CCallsign &callsign, bool rendered, bool onlyFirst = true);
|
int setRendered(const Aviation::CCallsign &callsign, bool rendered, bool onlyFirst = true);
|
||||||
|
|
||||||
//! Mark given callsign as enabled
|
//! Mark given callsign as enabled
|
||||||
int setEnabled(const Aviation::CCallsign &callsign, bool enabled, bool onlyFirst = true);
|
int setEnabled(const Aviation::CCallsign &callsign, bool enabled, bool onlyFirst);
|
||||||
|
|
||||||
|
//! Mark as fast position enabled
|
||||||
|
int setFastPositionUpdates(const Aviation::CCallsign &callsign, bool fastPositions, bool onlyFirst = true);
|
||||||
|
|
||||||
//! Set model
|
//! Set model
|
||||||
int setAircraftModel(const Aviation::CCallsign &callsign, const CAircraftModel &model, bool onlyFirst = true);
|
int setAircraftModel(const Aviation::CCallsign &callsign, const CAircraftModel &model, bool onlyFirst = true);
|
||||||
|
|
||||||
//! Set aircraft parts
|
//! Set aircraft parts and mark as synchronized
|
||||||
int setAircraftParts(const Aviation::CCallsign &callsign, const Aviation::CAircraftParts &parts, bool onlyFirst = true);
|
int setAircraftPartsSynchronized(const Aviation::CCallsign &callsign, const Aviation::CAircraftParts &parts, bool onlyFirst = true);
|
||||||
|
|
||||||
//! Set aircraft parts
|
//! Set aircraft parts
|
||||||
int setAircraftSituation(const Aviation::CCallsign &callsign, const Aviation::CAircraftSituation &situation, bool onlyFirst = true);
|
int setAircraftSituation(const Aviation::CCallsign &callsign, const Aviation::CAircraftSituation &situation, bool onlyFirst = true);
|
||||||
|
|||||||
Reference in New Issue
Block a user