Ref T275, added "latestOnGroundProviderElevation" to improve average elevation

This commit is contained in:
Klaus Basan
2018-06-18 19:03:45 +02:00
parent 2c55015d26
commit 7cc350974c
6 changed files with 62 additions and 10 deletions

View File

@@ -540,6 +540,7 @@ namespace BlackMisc
if (this->size() < minValues) { return CElevationPlane::null(); } // no change to succeed
QList<double> valuesInFt;
int count = 0;
for (const CAircraftSituation &situation : *this)
{
if (situation.getGroundElevationInfo() != CAircraftSituation::FromProvider) { continue; }
@@ -548,8 +549,11 @@ namespace BlackMisc
if (!situation.isWithinRange(reference, range)) { continue; }
const double elvFt = situation.getGroundElevationPlane().getAltitude().value(CLengthUnit::ft());
valuesInFt.push_back(elvFt);
count++;
if (count > 5 && valuesInFt.size() > 3 * minValues) { break; }
}
if (valuesInFt.size() < minValues) { return CElevationPlane::null(); }
if (count < minValues) { return CElevationPlane::null(); }
static const double MaxDevFt = CAircraftSituationChange::allowedAltitudeDeviation().value(CLengthUnit::ft());
const QPair<double, double> elvStdDevMean = CMathUtils::standardDeviationAndMean(valuesInFt);