mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-14 08:45:36 +08:00
Ref T231, set elevation as default for current situation
This commit is contained in:
@@ -64,10 +64,19 @@ namespace BlackMisc
|
|||||||
if (m_aircraftSituations.isEmpty()) { return {}; }
|
if (m_aircraftSituations.isEmpty()) { return {}; }
|
||||||
CAircraftSituation currentSituation = m_aircraftSituations.front();
|
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
|
// data, split situations by time
|
||||||
if (currentTimeMsSinceEpoc < 0) { currentTimeMsSinceEpoc = QDateTime::currentMSecsSinceEpoch(); }
|
if (currentTimeMsSinceEpoc < 0) { currentTimeMsSinceEpoc = QDateTime::currentMSecsSinceEpoch(); }
|
||||||
|
|
||||||
// interpolant function from derived class
|
// interpolant function from derived class
|
||||||
|
// CInterpolatorLinear::Interpolant or CInterpolatorSpline::Interpolant
|
||||||
const auto interpolant = derived()->getInterpolant(currentTimeMsSinceEpoc, setup, hints, status, log);
|
const auto interpolant = derived()->getInterpolant(currentTimeMsSinceEpoc, setup, hints, status, log);
|
||||||
|
|
||||||
// succeeded so far?
|
// succeeded so far?
|
||||||
@@ -93,13 +102,6 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
m_isFirstInterpolation = false;
|
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
|
// Interpolate between altitude and ground elevation, with proportions weighted according to interpolated onGround flag
|
||||||
if (hints.hasAircraftParts())
|
if (hints.hasAircraftParts())
|
||||||
{
|
{
|
||||||
@@ -126,7 +128,6 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
// guess ground flag
|
// guess ground flag
|
||||||
constexpr double NoGroundFactor = -1;
|
constexpr double NoGroundFactor = -1;
|
||||||
currentSituation.setGroundElevation(currentGroundElevation);
|
|
||||||
CInterpolator::setGroundFlagFromInterpolator(hints, NoGroundFactor, currentSituation);
|
CInterpolator::setGroundFlagFromInterpolator(hints, NoGroundFactor, currentSituation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user