Implement interpolator mode for FS9

Summary:
This implementation will always return true if we were setting the mode,
since we cannot easily access the return value from
CInterpolatorMulti::setMode in a thread safe manner.

Reviewers: #swift_pilot_client, kbasan, msutcliffe

Reviewed By: #swift_pilot_client, kbasan, msutcliffe

Subscribers: kbasan, jenkins

Differential Revision: https://dev.swift-project.org/D52
This commit is contained in:
Roland Winklmeier
2017-08-08 12:57:07 +00:00
committed by Mathew Sutcliffe
parent 09da34d8f0
commit 27f97e8ac8
3 changed files with 10 additions and 7 deletions

View File

@@ -11,7 +11,7 @@
#define DIRECTPLAY_CLIENT_H
#include "directplaypeer.h"
#include "blackmisc/simulation/interpolatorlinear.h"
#include "blackmisc/simulation/interpolatormulti.h"
#include "blackmisc/aviation/aircraftsituation.h"
#include "blackmisc/pq/time.h"
#include "blackmisc/aviation/callsign.h"
@@ -51,7 +51,7 @@ namespace BlackSimPlugin
void setHostAddress(const QString &hostAddress);
//! Get interpolator
BlackMisc::Simulation::CInterpolatorLinear *getInterpolator() { return &m_interpolator; }
BlackMisc::Simulation::CInterpolatorMulti *getInterpolator() { return &m_interpolator; }
//! Set interpolation setup
//! \threadsafe
@@ -94,7 +94,7 @@ namespace BlackSimPlugin
BlackMisc::Simulation::CInterpolationAndRenderingSetup getInterpolationSetup() const;
BlackMisc::PhysicalQuantities::CTime m_updateInterval;
BlackMisc::Simulation::CInterpolatorLinear m_interpolator;
BlackMisc::Simulation::CInterpolatorMulti m_interpolator;
BlackMisc::Simulation::CInterpolationAndRenderingSetup m_interpolationSetup;
mutable QReadWriteLock m_interpolationSetupMutex;
QString m_modelName;

View File

@@ -305,10 +305,12 @@ namespace BlackSimPlugin
bool CSimulatorFs9::setInterpolatorMode(CInterpolatorMulti::Mode mode, const CCallsign &callsign)
{
//! \todo (added by KWB 3/17) interpolator mode for FS9 needs implementation
Q_UNUSED(mode);
Q_UNUSED(callsign);
return false;
const auto it = m_hashFs9Clients.find(callsign);
if (it == m_hashFs9Clients.end()) { return false; }
QTimer::singleShot(0, it->data(), [client = *it, mode] { client->getInterpolator()->setMode(mode); });
// Always return true if we were setting the mode, since we cannot easily access the return value from
// CInterpolatorMulti::setMode in a thread safe manner.
return true;
}
bool CSimulatorFs9::isPhysicallyRenderedAircraft(const CCallsign &callsign) const