Ref T231, set elevation as default for current situation

This commit is contained in:
Klaus Basan
2018-01-24 01:49:52 +01:00
parent 3da834e964
commit 28346fbbdc

View File

@@ -64,10 +64,19 @@ namespace BlackMisc
if (m_aircraftSituations.isEmpty()) { return {}; }
CAircraftSituation currentSituation = m_aircraftSituations.front();
// Update current position by hints' elevation
// * for XP provided by hints.getElevationProvider at current position
// * for FSX/P3D provided as hints.getElevation which is set to current position of remote aircraft in simulator
// * As XP uses lazy init we will call getGroundElevation only when needed
// * default here via getElevationPlane
CAltitude currentGroundElevation(hints.getElevationPlane().getAltitudeIfWithinRadius(currentSituation));
currentSituation.setGroundElevationChecked(currentGroundElevation); // set as default
// data, split situations by time
if (currentTimeMsSinceEpoc < 0) { currentTimeMsSinceEpoc = QDateTime::currentMSecsSinceEpoch(); }
// interpolant function from derived class
// CInterpolatorLinear::Interpolant or CInterpolatorSpline::Interpolant
const auto interpolant = derived()->getInterpolant(currentTimeMsSinceEpoc, setup, hints, status, log);
// succeeded so far?
@@ -93,13 +102,6 @@ namespace BlackMisc
}
m_isFirstInterpolation = false;
// Update current position by hints' elevation
// * for XP provided by hints.getElevationProvider at current position
// * for FSX/P3D provided as hints.getElevation which is set to current position of remote aircraft in simulator
// * As XP uses lazy init we will call getGroundElevation only when needed
// * default here via getElevationPlane
CAltitude currentGroundElevation(hints.getElevationPlane().getAltitudeIfWithinRadius(currentSituation));
// Interpolate between altitude and ground elevation, with proportions weighted according to interpolated onGround flag
if (hints.hasAircraftParts())
{
@@ -126,7 +128,6 @@ namespace BlackMisc
{
// guess ground flag
constexpr double NoGroundFactor = -1;
currentSituation.setGroundElevation(currentGroundElevation);
CInterpolator::setGroundFlagFromInterpolator(hints, NoGroundFactor, currentSituation);
}