Ref T259, Ref T243 renaming to CInterpolationAndRenderingSetupPerCallsign

This commit is contained in:
Klaus Basan
2018-03-19 20:07:31 +01:00
parent f5d1217b48
commit 333a92ff63
18 changed files with 48 additions and 50 deletions

View File

@@ -47,7 +47,7 @@ namespace BlackMisc
Aviation::CAircraftSituationList interpolationSituations; //!< the interpolator uses 2, 3 situations (oldest at end)
Aviation::CAircraftSituation situationCurrent; //!< interpolated situation
PhysicalQuantities::CLength cgAboveGround; //!< center of gravity
CInterpolationAndRenderingSetup usedSetup; //!< used setup
CInterpolationAndRenderingSetupPerCallsign usedSetup; //!< used setup
CInterpolationHints usedHints; //!< hints
//! Delta time between interpolation and current time

View File

@@ -54,7 +54,7 @@ namespace BlackMisc
template <typename Derived>
CAircraftSituation CInterpolator<Derived>::getInterpolatedSituation(
qint64 currentTimeMsSinceEpoc,
const CInterpolationAndRenderingSetup &setup, const CInterpolationHints &hints,
const CInterpolationAndRenderingSetupPerCallsign &setup, const CInterpolationHints &hints,
CInterpolationStatus &status)
{
Q_ASSERT_X(!m_callsign.isEmpty(), Q_FUNC_INFO, "Missing callsign");
@@ -224,9 +224,8 @@ namespace BlackMisc
}
template <typename Derived>
CAircraftParts CInterpolator<Derived>::getInterpolatedParts(
qint64 currentTimeMsSinceEpoch,
const CInterpolationAndRenderingSetup &setup, CPartsStatus &partsStatus, bool log) const
CAircraftParts CInterpolator<Derived>::getInterpolatedParts(qint64 currentTimeMsSinceEpoch,
const CInterpolationAndRenderingSetupPerCallsign &setup, CPartsStatus &partsStatus, bool log) const
{
// (!) this code is used by linear and spline interpolator
Q_UNUSED(setup);

View File

@@ -45,12 +45,11 @@ namespace BlackMisc
const CLogCategoryList &getLogCategories();
//! Current interpolated situation
Aviation::CAircraftSituation getInterpolatedSituation(
qint64 currentTimeSinceEpoc, const CInterpolationAndRenderingSetup &setup, const CInterpolationHints &hints, CInterpolationStatus &status);
Aviation::CAircraftSituation getInterpolatedSituation(qint64 currentTimeSinceEpoc, const CInterpolationAndRenderingSetupPerCallsign &setup, const CInterpolationHints &hints, CInterpolationStatus &status);
//! Parts before given offset time (aka pending parts)
Aviation::CAircraftParts getInterpolatedParts(
qint64 currentTimeSinceEpoc, const CInterpolationAndRenderingSetup &setup, CPartsStatus &partsStatus, bool log = false) const;
qint64 currentTimeSinceEpoc, const CInterpolationAndRenderingSetupPerCallsign &setup, CPartsStatus &partsStatus, bool log = false) const;
//! Add a new aircraft situation
void addAircraftSituation(const Aviation::CAircraftSituation &situation);

View File

@@ -38,11 +38,11 @@ namespace BlackMisc
//! \copydoc CInterpolator::getInterpolatedSituation
BlackMisc::Aviation::CAircraftSituation getInterpolatedSituation(
qint64, const CInterpolationAndRenderingSetup &, const CInterpolationHints &, CInterpolationStatus &) { return {}; }
qint64, const CInterpolationAndRenderingSetupGlobal &, const CInterpolationHints &, CInterpolationStatus &) { return {}; }
//! \copydoc CInterpolator::getInterpolatedParts
BlackMisc::Aviation::CAircraftParts getInterpolatedParts(
qint64, const CInterpolationAndRenderingSetup &, CPartsStatus &, bool = false) const { return {}; }
qint64, const CInterpolationAndRenderingSetupGlobal &, CPartsStatus &, bool = false) const { return {}; }
//! \copydoc CInterpolator::addAircraftSituation
void addAircraftSituation(const BlackMisc::Aviation::CAircraftSituation &) {}

View File

@@ -50,7 +50,7 @@ namespace BlackMisc
{}
CInterpolatorLinear::Interpolant CInterpolatorLinear::getInterpolant(qint64 currentTimeMsSinceEpoc,
const CInterpolationAndRenderingSetup &setup, const CInterpolationHints &hints, CInterpolationStatus &status, SituationLog &log) const
const CInterpolationAndRenderingSetupPerCallsign &setup, const CInterpolationHints &hints, CInterpolationStatus &status, SituationLog &log) const
{
Q_UNUSED(setup);
Q_UNUSED(hints);
@@ -68,7 +68,7 @@ namespace BlackMisc
// find the first situation earlier than the current time
const CAircraftSituationList &validSituations = m_aircraftSituations; // if needed, we could also copy here
const auto pivot = std::partition_point(validSituations.begin(), validSituations.end(), [ = ](auto && s) { return s.getAdjustedMSecsSinceEpoch() > currentTimeMsSinceEpoc; });
const auto pivot = std::partition_point(validSituations.begin(), validSituations.end(), [ = ](auto &&s) { return s.getAdjustedMSecsSinceEpoch() > currentTimeMsSinceEpoc; });
const auto situationsNewer = makeRange(validSituations.begin(), pivot);
const auto situationsOlder = makeRange(pivot, validSituations.end());
@@ -159,7 +159,7 @@ namespace BlackMisc
return { oldSituation, newSituation, simulationTimeFraction, interpolatedTime };
}
CCoordinateGeodetic CInterpolatorLinear::Interpolant::interpolatePosition(const CInterpolationAndRenderingSetup &setup, const CInterpolationHints &hints) const
CCoordinateGeodetic CInterpolatorLinear::Interpolant::interpolatePosition(const CInterpolationAndRenderingSetupPerCallsign &setup, const CInterpolationHints &hints) const
{
Q_UNUSED(setup);
Q_UNUSED(hints);
@@ -175,7 +175,7 @@ namespace BlackMisc
return currentPosition;
}
CAltitude CInterpolatorLinear::Interpolant::interpolateAltitude(const CInterpolationAndRenderingSetup &setup, const CInterpolationHints &hints) const
CAltitude CInterpolatorLinear::Interpolant::interpolateAltitude(const CInterpolationAndRenderingSetupPerCallsign &setup, const CInterpolationHints &hints) const
{
Q_UNUSED(setup);
Q_UNUSED(hints);

View File

@@ -49,8 +49,8 @@ namespace BlackMisc
//! Perform the interpolation
//! @{
Geo::CCoordinateGeodetic interpolatePosition(const CInterpolationAndRenderingSetup &setup, const CInterpolationHints &hints) const;
Aviation::CAltitude interpolateAltitude(const CInterpolationAndRenderingSetup &setup, const CInterpolationHints &hints) const;
Geo::CCoordinateGeodetic interpolatePosition(const CInterpolationAndRenderingSetupPerCallsign &setup, const CInterpolationHints &hints) const;
Aviation::CAltitude interpolateAltitude(const CInterpolationAndRenderingSetupPerCallsign &setup, const CInterpolationHints &hints) const;
//! @}
//! Interpolator for pitch, bank, heading, groundspeed
@@ -75,7 +75,7 @@ namespace BlackMisc
};
//! Get the interpolant for the given time point
Interpolant getInterpolant(qint64 currentTimeMsSinceEpoc, const CInterpolationAndRenderingSetup &setup,
Interpolant getInterpolant(qint64 currentTimeMsSinceEpoc, const CInterpolationAndRenderingSetupPerCallsign &setup,
const CInterpolationHints &hints, CInterpolationStatus &status, SituationLog &log) const;
};
} // ns

View File

@@ -23,9 +23,8 @@ namespace BlackMisc
m_linear(callsign, this)
{}
CAircraftSituation CInterpolatorMulti::getInterpolatedSituation(
qint64 currentTimeSinceEpoc,
const CInterpolationAndRenderingSetup &setup,
CAircraftSituation CInterpolatorMulti::getInterpolatedSituation(qint64 currentTimeSinceEpoc,
const CInterpolationAndRenderingSetupPerCallsign &setup,
const CInterpolationHints &hints, CInterpolationStatus &status)
{
switch (m_mode)
@@ -38,7 +37,7 @@ namespace BlackMisc
}
CAircraftParts CInterpolatorMulti::getInterpolatedParts(
qint64 currentTimeSinceEpoc, const CInterpolationAndRenderingSetup &setup,
qint64 currentTimeSinceEpoc, const CInterpolationAndRenderingSetupPerCallsign &setup,
CPartsStatus &partsStatus, bool log) const
{
switch (m_mode)

View File

@@ -33,13 +33,12 @@ namespace BlackMisc
//! \copydoc CInterpolator::getInterpolatedSituation
Aviation::CAircraftSituation getInterpolatedSituation(
qint64 currentTimeSinceEpoc,
const CInterpolationAndRenderingSetup &setup,
const CInterpolationAndRenderingSetupPerCallsign &setup,
const CInterpolationHints &hints, CInterpolationStatus &status);
//! \copydoc CInterpolator::getInterpolatedParts
Aviation::CAircraftParts getInterpolatedParts(
qint64 currentTimeSinceEpoc,
const CInterpolationAndRenderingSetup &setup,
Aviation::CAircraftParts getInterpolatedParts(qint64 currentTimeSinceEpoc,
const CInterpolationAndRenderingSetupPerCallsign &setup,
CPartsStatus &partsStatus, bool log = false) const;
//! \copydoc CInterpolator::addAircraftSituation

View File

@@ -96,7 +96,7 @@ namespace BlackMisc
}
CInterpolatorSpline::Interpolant CInterpolatorSpline::getInterpolant(qint64 currentTimeMsSinceEpoc,
const CInterpolationAndRenderingSetup &setup, const CInterpolationHints &hints, CInterpolationStatus &status,
const CInterpolationAndRenderingSetupPerCallsign &setup, const CInterpolationHints &hints, CInterpolationStatus &status,
SituationLog &log)
{
Q_UNUSED(hints);
@@ -117,7 +117,7 @@ namespace BlackMisc
// find the first situation earlier than the current time
const CAircraftSituationList &validSituations = m_aircraftSituations; // if needed, we could also copy here
const auto pivot = std::partition_point(validSituations.begin(), validSituations.end(), [ = ](auto && s) { return s.getAdjustedMSecsSinceEpoch() > currentTimeMsSinceEpoc; });
const auto pivot = std::partition_point(validSituations.begin(), validSituations.end(), [ = ](auto &&s) { return s.getAdjustedMSecsSinceEpoch() > currentTimeMsSinceEpoc; });
const auto situationsNewer = makeRange(validSituations.begin(), pivot);
const auto situationsOlder = makeRange(pivot, validSituations.end());
@@ -205,7 +205,7 @@ namespace BlackMisc
return m_interpolant;
}
CCoordinateGeodetic CInterpolatorSpline::Interpolant::interpolatePosition(const CInterpolationAndRenderingSetup &setup, const CInterpolationHints &hints) const
CCoordinateGeodetic CInterpolatorSpline::Interpolant::interpolatePosition(const CInterpolationAndRenderingSetupPerCallsign &setup, const CInterpolationHints &hints) const
{
Q_UNUSED(setup);
Q_UNUSED(hints);
@@ -219,7 +219,7 @@ namespace BlackMisc
return currentPosition;
}
CAltitude CInterpolatorSpline::Interpolant::interpolateAltitude(const CInterpolationAndRenderingSetup &setup, const CInterpolationHints &hints) const
CAltitude CInterpolatorSpline::Interpolant::interpolateAltitude(const CInterpolationAndRenderingSetupPerCallsign &setup, const CInterpolationHints &hints) const
{
Q_UNUSED(setup);
Q_UNUSED(hints);

View File

@@ -63,8 +63,8 @@ namespace BlackMisc
//! Perform the interpolation
//! @{
Geo::CCoordinateGeodetic interpolatePosition(const CInterpolationAndRenderingSetup &setup, const CInterpolationHints &hints) const;
Aviation::CAltitude interpolateAltitude(const CInterpolationAndRenderingSetup &setup, const CInterpolationHints &hints) const;
Geo::CCoordinateGeodetic interpolatePosition(const CInterpolationAndRenderingSetupPerCallsign &setup, const CInterpolationHints &hints) const;
Aviation::CAltitude interpolateAltitude(const CInterpolationAndRenderingSetupPerCallsign &setup, const CInterpolationHints &hints) const;
//! @}
//! Interpolator for pitch, bank, heading, groundspeed
@@ -91,10 +91,9 @@ namespace BlackMisc
};
//! Strategy used by CInterpolator::getInterpolatedSituation
Interpolant getInterpolant(
qint64 currentTimeMsSinceEpoc,
const CInterpolationAndRenderingSetup &setup,
const CInterpolationHints &hints, CInterpolationStatus &status, SituationLog &log);
Interpolant getInterpolant(qint64 currentTimeMsSinceEpoc,
const CInterpolationAndRenderingSetupPerCallsign &setup,
const CInterpolationHints &hints, CInterpolationStatus &status, SituationLog &log);
private:
qint64 m_prevSampleAdjustedTime = 0; //!< previous sample time + offset