mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 15:15:50 +08:00
Ref T259, Ref T243 interpolator changes
* interpolators use providers for client/situations/parts/ground elevation * interpolators do no longer use own situations/parts, but those from provider * interpolators are no longer QObjects (as it is not needed) * use gnd flag from situation for gnd interpolation, there is no longer a parts gnd flag interpolation * guess parts during interpolation * changed iterators to m_s[i] as it makes clearer which values are used ** the flag is transferred from parts -> situation in airspace monitor ** if the other client already provides and gnd.flag in situation this also works * adjusted logging * use providers in unit tests / adjusted tests * improved situation verification/assert
This commit is contained in:
committed by
Roland Winklmeier
parent
5c6a37c669
commit
cd1ce37ec3
@@ -17,10 +17,9 @@ namespace BlackMisc
|
||||
{
|
||||
namespace Simulation
|
||||
{
|
||||
CInterpolatorMulti::CInterpolatorMulti(const CCallsign &callsign, QObject *parent) :
|
||||
QObject(parent),
|
||||
m_spline(callsign, this),
|
||||
m_linear(callsign, this)
|
||||
CInterpolatorMulti::CInterpolatorMulti(const CCallsign &callsign, ISimulationEnvironmentProvider *p1, IInterpolationSetupProvider *p2, IRemoteAircraftProvider *p3, CInterpolationLogger *logger) :
|
||||
m_spline(callsign, p1, p2, p3, logger),
|
||||
m_linear(callsign, p1, p2, p3, logger)
|
||||
{}
|
||||
|
||||
CAircraftSituation CInterpolatorMulti::getInterpolatedSituation(qint64 currentTimeSinceEpoc,
|
||||
@@ -42,6 +41,7 @@ namespace BlackMisc
|
||||
{
|
||||
switch (m_mode)
|
||||
{
|
||||
// currently calls the same interpolation for parts
|
||||
case ModeLinear: return m_linear.getInterpolatedParts(currentTimeSinceEpoc, setup, partsStatus, log);
|
||||
case ModeSpline: return m_spline.getInterpolatedParts(currentTimeSinceEpoc, setup, partsStatus, log);
|
||||
default: break;
|
||||
@@ -49,38 +49,29 @@ namespace BlackMisc
|
||||
return {};
|
||||
}
|
||||
|
||||
void CInterpolatorMulti::addAircraftSituation(const CAircraftSituation &situation)
|
||||
{
|
||||
m_linear.addAircraftSituation(situation);
|
||||
m_spline.addAircraftSituation(situation);
|
||||
}
|
||||
|
||||
bool CInterpolatorMulti::hasAircraftSituations() const
|
||||
CAircraftParts CInterpolatorMulti::getInterpolatedOrGuessedParts(
|
||||
qint64 currentTimeSinceEpoc, const CInterpolationAndRenderingSetupPerCallsign &setup,
|
||||
CPartsStatus &partsStatus, bool log) const
|
||||
{
|
||||
switch (m_mode)
|
||||
{
|
||||
case ModeLinear: return m_linear.hasAircraftSituations();
|
||||
case ModeSpline: return m_spline.hasAircraftSituations();
|
||||
// currently calls the same interpolation for parts
|
||||
case ModeLinear: return m_linear.getInterpolatedOrGuessedParts(currentTimeSinceEpoc, setup, partsStatus, log);
|
||||
case ModeSpline: return m_spline.getInterpolatedOrGuessedParts(currentTimeSinceEpoc, setup, partsStatus, log);
|
||||
default: break;
|
||||
}
|
||||
return false;
|
||||
return {};
|
||||
}
|
||||
|
||||
void CInterpolatorMulti::addAircraftParts(const CAircraftParts &parts)
|
||||
{
|
||||
m_linear.addAircraftParts(parts);
|
||||
m_spline.addAircraftParts(parts);
|
||||
}
|
||||
|
||||
bool CInterpolatorMulti::hasAircraftParts() const
|
||||
const CAircraftSituation &CInterpolatorMulti::getLastInterpolatedSituation() const
|
||||
{
|
||||
switch (m_mode)
|
||||
{
|
||||
case ModeLinear: return m_linear.hasAircraftParts();
|
||||
case ModeSpline: return m_spline.hasAircraftParts();
|
||||
case ModeLinear: return m_linear.getLastInterpolatedSituation();
|
||||
case ModeSpline: return m_spline.getLastInterpolatedSituation();
|
||||
default: break;
|
||||
}
|
||||
return false;
|
||||
return CAircraftSituation::null();
|
||||
}
|
||||
|
||||
void CInterpolatorMulti::attachLogger(CInterpolationLogger *logger)
|
||||
@@ -89,18 +80,17 @@ namespace BlackMisc
|
||||
m_spline.attachLogger(logger);
|
||||
}
|
||||
|
||||
void CInterpolatorMulti::initCorrespondingModel(const CAircraftModel &model)
|
||||
{
|
||||
m_linear.initCorrespondingModel(model);
|
||||
m_spline.initCorrespondingModel(model);
|
||||
}
|
||||
|
||||
bool CInterpolatorMulti::setMode(Mode mode)
|
||||
{
|
||||
#ifdef QT_DEBUG
|
||||
if (m_mode != mode)
|
||||
{
|
||||
m_mode = mode;
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
Q_UNUSED(mode);
|
||||
#endif
|
||||
return false;
|
||||
if (m_mode == mode) { return false; }
|
||||
m_mode = mode;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CInterpolatorMulti::setMode(const QString &mode)
|
||||
@@ -156,14 +146,9 @@ namespace BlackMisc
|
||||
CInterpolatorMultiWrapper::CInterpolatorMultiWrapper()
|
||||
{ }
|
||||
|
||||
CInterpolatorMultiWrapper::CInterpolatorMultiWrapper(const CCallsign &callsign, QObject *parent)
|
||||
CInterpolatorMultiWrapper::CInterpolatorMultiWrapper(const Aviation::CCallsign &callsign, ISimulationEnvironmentProvider *p1, IInterpolationSetupProvider *p2, IRemoteAircraftProvider *p3, CInterpolationLogger *logger)
|
||||
{
|
||||
m_interpolator.reset(new CInterpolatorMulti(callsign, parent));
|
||||
}
|
||||
|
||||
CInterpolatorMultiWrapper::CInterpolatorMultiWrapper(const CCallsign &callsign, CInterpolationLogger *logger, QObject *parent)
|
||||
{
|
||||
m_interpolator.reset(new CInterpolatorMulti(callsign, parent));
|
||||
m_interpolator.reset(new CInterpolatorMulti(callsign, p1, p2, p3));
|
||||
m_interpolator->attachLogger(logger);
|
||||
}
|
||||
} // ns
|
||||
|
||||
Reference in New Issue
Block a user