mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 01:05:34 +08:00
Ref T773, if possible skip update of situations with elevation in interpolator
This commit is contained in:
committed by
Mat Sutcliffe
parent
181c2b8061
commit
e21dab0605
@@ -235,8 +235,15 @@ namespace BlackMisc
|
||||
const CLength radius = currentSituation.getDistancePerTime250ms(CElevationPlane::singlePointRadius());
|
||||
if (!m_lastSituation.transferGroundElevationFromThis(currentSituation, radius))
|
||||
{
|
||||
const CElevationPlane groundElevation = this->findClosestElevationWithinRange(currentSituation, radius);
|
||||
m_lastSituation.setGroundElevationChecked(groundElevation, CAircraftSituation::FromCache);
|
||||
if (currentSituation.canLikelySkipNearGroundInterpolation())
|
||||
{
|
||||
// skipped
|
||||
}
|
||||
else
|
||||
{
|
||||
const CElevationPlane groundElevation = this->findClosestElevationWithinRange(currentSituation, radius);
|
||||
m_lastSituation.setGroundElevationChecked(groundElevation, CAircraftSituation::FromCache);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -174,7 +174,7 @@ namespace BlackMisc
|
||||
static const QString vm("Unverified situations, m0-2 (oldest latest) %1 %2 %3");
|
||||
const QString vmValues = vm.arg(olderAdjusted).arg(currentAdjusted).arg(latestAdjusted);
|
||||
CLogMessage(this).warning(vmValues);
|
||||
Q_UNUSED(vmValues);
|
||||
Q_UNUSED(vmValues)
|
||||
}
|
||||
}
|
||||
return hasNewer;
|
||||
@@ -219,7 +219,7 @@ namespace BlackMisc
|
||||
// - on an airport the plane does not move very fast, or not at all
|
||||
// - and the elevation remains (almost) constant for a wider area
|
||||
// - during flying the ground elevation not really matters
|
||||
this->updateElevations();
|
||||
this->updateElevations(true);
|
||||
static const CLengthUnit altUnit = CAltitude::defaultUnit();
|
||||
const CLength cg(this->getModelCG().switchedUnit(altUnit));
|
||||
const double a0 = m_s[0].getCorrectedAltitude(cg).value(altUnit); // oldest
|
||||
@@ -284,14 +284,16 @@ namespace BlackMisc
|
||||
return m_interpolant;
|
||||
}
|
||||
|
||||
bool CInterpolatorSpline::updateElevations()
|
||||
bool CInterpolatorSpline::updateElevations(bool canSkip)
|
||||
{
|
||||
bool updated = false;
|
||||
for (unsigned int i = 0; i < m_s.size(); i++)
|
||||
for (CAircraftSituation &s : m_s)
|
||||
{
|
||||
if (m_s[i].hasGroundElevation()) { continue; } // do not override existing values
|
||||
const CElevationPlane plane = this->findClosestElevationWithinRange(m_s[i], CElevationPlane::singlePointRadius());
|
||||
const bool u = m_s[i].setGroundElevationChecked(plane, CAircraftSituation::FromCache);
|
||||
if (s.hasGroundElevation()) { continue; } // do not override existing values
|
||||
if (canSkip && s.canLikelySkipNearGroundInterpolation()) { continue; }
|
||||
|
||||
const CElevationPlane plane = this->findClosestElevationWithinRange(s, CElevationPlane::singlePointRadius());
|
||||
const bool u = s.setGroundElevationChecked(plane, CAircraftSituation::FromCache);
|
||||
updated |= u;
|
||||
}
|
||||
return updated;
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace BlackMisc
|
||||
|
||||
private:
|
||||
//! Update the elevations used in CInterpolatorSpline::m_s
|
||||
bool updateElevations();
|
||||
bool updateElevations(bool canSkip);
|
||||
|
||||
//! Are any elevations missing in CInterpolatorSpline::m_s
|
||||
bool areAnyElevationsMissing() const;
|
||||
|
||||
Reference in New Issue
Block a user