From 28346fbbdc0ea2b6175a70cd4abbbecd7e943aa4 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Wed, 24 Jan 2018 01:49:52 +0100 Subject: [PATCH] Ref T231, set elevation as default for current situation --- src/blackmisc/simulation/interpolator.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/blackmisc/simulation/interpolator.cpp b/src/blackmisc/simulation/interpolator.cpp index f8dcab578..149fb95e6 100644 --- a/src/blackmisc/simulation/interpolator.cpp +++ b/src/blackmisc/simulation/interpolator.cpp @@ -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); }