mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-25 10:15:43 +08:00
refs #863 Each aircraft gets its own interpolator instance,
so each one can cache calculations from one frame to the next. The recent situations and parts are members of the interpolator.
This commit is contained in:
@@ -381,8 +381,9 @@ namespace BlackCore
|
|||||||
}
|
}
|
||||||
if (p == "clear" || p == "clr")
|
if (p == "clear" || p == "clr")
|
||||||
{
|
{
|
||||||
this->m_interpolator->clearLog();
|
//! \todo refactoring broken by rebase
|
||||||
CStatusMessage(this).info("Cleared interpolation logging");
|
//this->m_interpolator->clearLog();
|
||||||
|
//CStatusMessage(this).info("Cleared interpolation logging");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (p == "write" || p == "save")
|
if (p == "write" || p == "save")
|
||||||
@@ -391,8 +392,9 @@ namespace BlackCore
|
|||||||
this->m_interpolationRenderingSetup.clearInterpolatorLogCallsigns();
|
this->m_interpolationRenderingSetup.clearInterpolatorLogCallsigns();
|
||||||
|
|
||||||
// write
|
// write
|
||||||
this->m_interpolator->writeLogInBackground();
|
//! \todo refactoring broken by rebase
|
||||||
CLogMessage(this).info("Started writing interpolation log");
|
//this->m_interpolator->writeLogInBackground();
|
||||||
|
//CLogMessage(this).info("Started writing interpolation log");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -180,7 +180,6 @@ namespace BlackCore
|
|||||||
//! Parse driver specific details for ISimulator::parseCommandLine
|
//! Parse driver specific details for ISimulator::parseCommandLine
|
||||||
virtual bool parseDetails(const BlackMisc::CSimpleCommandParser &parser);
|
virtual bool parseDetails(const BlackMisc::CSimpleCommandParser &parser);
|
||||||
|
|
||||||
BlackMisc::Simulation::IInterpolator *m_interpolator = nullptr; //!< interpolator instance
|
|
||||||
bool m_pausedSimFreezesInterpolation = false; //!< paused simulator will also pause interpolation (so AI aircraft will hold)
|
bool m_pausedSimFreezesInterpolation = false; //!< paused simulator will also pause interpolation (so AI aircraft will hold)
|
||||||
BlackMisc::Simulation::CAircraftModel m_defaultModel; //!< default model
|
BlackMisc::Simulation::CAircraftModel m_defaultModel; //!< default model
|
||||||
qint64 m_statsUpdateAircraftTimeTotalMs = 0; //!< statistics update time
|
qint64 m_statsUpdateAircraftTimeTotalMs = 0; //!< statistics update time
|
||||||
|
|||||||
@@ -27,24 +27,19 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
namespace Simulation
|
namespace Simulation
|
||||||
{
|
{
|
||||||
IInterpolator::IInterpolator(IRemoteAircraftProvider *provider, const QString &objectName, QObject *parent) :
|
IInterpolator::IInterpolator(const QString &objectName, QObject *parent) :
|
||||||
QObject(parent),
|
QObject(parent)
|
||||||
CRemoteAircraftAware(provider)
|
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(provider, Q_FUNC_INFO, "missing provider");
|
|
||||||
this->setObjectName(objectName);
|
this->setObjectName(objectName);
|
||||||
}
|
}
|
||||||
|
|
||||||
BlackMisc::Aviation::CAircraftSituation IInterpolator::getInterpolatedSituation(
|
BlackMisc::Aviation::CAircraftSituation IInterpolator::getInterpolatedSituation(
|
||||||
const CCallsign &callsign, qint64 currentTimeSinceEpoc, const CInterpolationAndRenderingSetup &setup,
|
qint64 currentTimeSinceEpoc, const CInterpolationAndRenderingSetup &setup,
|
||||||
const CInterpolationHints &hints, InterpolationStatus &status) const
|
const CInterpolationHints &hints, InterpolationStatus &status) const
|
||||||
{
|
{
|
||||||
// has to be thread safe
|
|
||||||
|
|
||||||
status.reset();
|
status.reset();
|
||||||
Q_ASSERT_X(!callsign.isEmpty(), Q_FUNC_INFO, "empty callsign");
|
|
||||||
|
|
||||||
auto currentSituation = this->getInterpolatedSituation(callsign, this->remoteAircraftSituations(callsign), currentTimeSinceEpoc, setup, hints, status);
|
auto currentSituation = this->getInterpolatedSituation(callsign, this->m_aircraftSituations, currentTimeSinceEpoc, setup, hints, status);
|
||||||
currentSituation.setCallsign(callsign); // make sure callsign is correct
|
currentSituation.setCallsign(callsign); // make sure callsign is correct
|
||||||
return currentSituation;
|
return currentSituation;
|
||||||
}
|
}
|
||||||
@@ -116,9 +111,19 @@ namespace BlackMisc
|
|||||||
CAircraftParts IInterpolator::getInterpolatedParts(const CCallsign &callsign, qint64 currentTimeMsSinceEpoch,
|
CAircraftParts IInterpolator::getInterpolatedParts(const CCallsign &callsign, qint64 currentTimeMsSinceEpoch,
|
||||||
const CInterpolationAndRenderingSetup &setup, IInterpolator::PartsStatus &partsStatus, bool log) const
|
const CInterpolationAndRenderingSetup &setup, IInterpolator::PartsStatus &partsStatus, bool log) const
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(!callsign.isEmpty(), Q_FUNC_INFO, "empty callsign");
|
|
||||||
partsStatus.reset();
|
partsStatus.reset();
|
||||||
return this->getInterpolatedParts(callsign, this->remoteAircraftParts(callsign, -1), currentTimeMsSinceEpoch, setup, partsStatus, log);
|
return this->getInterpolatedParts(callsign, this->m_aircraftParts, currentTimeMsSinceEpoch, setup, partsStatus, log);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IInterpolator::addAircraftSituation(const CAircraftSituation &situation)
|
||||||
|
{
|
||||||
|
m_aircraftSituations.push_frontMaxElements(situation, IRemoteAircraftProvider::MaxSituationsPerCallsign);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IInterpolator::addAircraftParts(const CAircraftParts &parts)
|
||||||
|
{
|
||||||
|
m_aircraftParts.push_front(parts);
|
||||||
|
IRemoteAircraftProvider::removeOutdatedParts(m_aircraftParts);
|
||||||
}
|
}
|
||||||
|
|
||||||
CWorker *IInterpolator::writeLogInBackground()
|
CWorker *IInterpolator::writeLogInBackground()
|
||||||
|
|||||||
@@ -32,9 +32,7 @@ namespace BlackMisc
|
|||||||
class CInterpolationHints;
|
class CInterpolationHints;
|
||||||
|
|
||||||
//! Interpolator, calculation inbetween positions
|
//! Interpolator, calculation inbetween positions
|
||||||
class BLACKMISC_EXPORT IInterpolator :
|
class BLACKMISC_EXPORT IInterpolator : public QObject
|
||||||
public QObject,
|
|
||||||
public BlackMisc::Simulation::CRemoteAircraftAware
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@@ -90,32 +88,33 @@ namespace BlackMisc
|
|||||||
};
|
};
|
||||||
|
|
||||||
//! Current interpolated situation
|
//! Current interpolated situation
|
||||||
//! \threadsafe
|
|
||||||
virtual BlackMisc::Aviation::CAircraftSituation getInterpolatedSituation(
|
virtual BlackMisc::Aviation::CAircraftSituation getInterpolatedSituation(
|
||||||
const BlackMisc::Aviation::CCallsign &callsign, qint64 currentTimeSinceEpoc,
|
const BlackMisc::Aviation::CCallsign &callsign, qint64 currentTimeSinceEpoc,
|
||||||
const CInterpolationAndRenderingSetup &setup, const CInterpolationHints &hints, InterpolationStatus &status) const;
|
const CInterpolationAndRenderingSetup &setup, const CInterpolationHints &hints, InterpolationStatus &status) const;
|
||||||
|
|
||||||
//! Current interpolated situation, to be implemented by subclass
|
//! Current interpolated situation, to be implemented by subclass
|
||||||
//! \threadsafe
|
|
||||||
//! \remark public only for XP driver
|
|
||||||
virtual BlackMisc::Aviation::CAircraftSituation getInterpolatedSituation(
|
virtual BlackMisc::Aviation::CAircraftSituation getInterpolatedSituation(
|
||||||
const BlackMisc::Aviation::CCallsign &callsign,
|
const BlackMisc::Aviation::CCallsign &callsign,
|
||||||
const BlackMisc::Aviation::CAircraftSituationList &situations, qint64 currentTimeSinceEpoc,
|
const BlackMisc::Aviation::CAircraftSituationList &situations, qint64 currentTimeSinceEpoc,
|
||||||
const CInterpolationAndRenderingSetup &setup, const CInterpolationHints &hints, InterpolationStatus &status) const = 0;
|
const CInterpolationAndRenderingSetup &setup, const CInterpolationHints &hints, InterpolationStatus &status) const = 0;
|
||||||
|
|
||||||
//! Parts before given offset time (aka pending parts)
|
//! Parts before given offset time (aka pending parts)
|
||||||
//! \threadsafe
|
|
||||||
virtual BlackMisc::Aviation::CAircraftParts getInterpolatedParts(
|
virtual BlackMisc::Aviation::CAircraftParts getInterpolatedParts(
|
||||||
const Aviation::CCallsign &callsign,
|
const Aviation::CCallsign &callsign,
|
||||||
const BlackMisc::Aviation::CAircraftPartsList &parts, qint64 cutoffTime,
|
const BlackMisc::Aviation::CAircraftPartsList &parts, qint64 cutoffTime,
|
||||||
const CInterpolationAndRenderingSetup &setup, PartsStatus &partsStatus, bool log = false) const;
|
const CInterpolationAndRenderingSetup &setup, PartsStatus &partsStatus, bool log = false) const;
|
||||||
|
|
||||||
//! Parts before given offset time (aka pending parts)
|
//! Parts before given offset time (aka pending parts)
|
||||||
//! \threadsafe
|
|
||||||
virtual BlackMisc::Aviation::CAircraftParts getInterpolatedParts(
|
virtual BlackMisc::Aviation::CAircraftParts getInterpolatedParts(
|
||||||
const BlackMisc::Aviation::CCallsign &callsign, qint64 cutoffTime,
|
const BlackMisc::Aviation::CCallsign &callsign, qint64 cutoffTime,
|
||||||
const CInterpolationAndRenderingSetup &setup, PartsStatus &partsStatus, bool log = false) const;
|
const CInterpolationAndRenderingSetup &setup, PartsStatus &partsStatus, bool log = false) const;
|
||||||
|
|
||||||
|
//! Add a new aircraft situation
|
||||||
|
void addAircraftSituation(const BlackMisc::Aviation::CAircraftSituation &situation);
|
||||||
|
|
||||||
|
//! Add a new aircraft parts
|
||||||
|
void addAircraftParts(const BlackMisc::Aviation::CAircraftParts &parts);
|
||||||
|
|
||||||
//! Write a log in background
|
//! Write a log in background
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
BlackMisc::CWorker *writeLogInBackground();
|
BlackMisc::CWorker *writeLogInBackground();
|
||||||
@@ -137,6 +136,9 @@ namespace BlackMisc
|
|||||||
static QStringList getLatestLogFiles();
|
static QStringList getLatestLogFiles();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
BlackMisc::Aviation::CAircraftSituationList m_aircraftSituations; //!< recent situations
|
||||||
|
BlackMisc::Aviation::CAircraftPartsList m_aircraftParts; //!< recent parts
|
||||||
|
|
||||||
//! Log for interpolation
|
//! Log for interpolation
|
||||||
struct InterpolationLog
|
struct InterpolationLog
|
||||||
{
|
{
|
||||||
@@ -163,7 +165,7 @@ namespace BlackMisc
|
|||||||
};
|
};
|
||||||
|
|
||||||
//! Constructor
|
//! Constructor
|
||||||
IInterpolator(BlackMisc::Simulation::IRemoteAircraftProvider *provider, const QString &objectName, QObject *parent);
|
IInterpolator(const QString &objectName, QObject *parent);
|
||||||
|
|
||||||
//! Log current interpolation cycle, only stores in memory, for performance reasons
|
//! Log current interpolation cycle, only stores in memory, for performance reasons
|
||||||
//! \remark const to allow const interpolator functions
|
//! \remark const to allow const interpolator functions
|
||||||
|
|||||||
@@ -43,9 +43,6 @@ namespace BlackMisc
|
|||||||
CAircraftSituation CInterpolatorLinear::getInterpolatedSituation(const CCallsign &callsign, const CAircraftSituationList &situations, qint64 currentTimeMsSinceEpoc,
|
CAircraftSituation CInterpolatorLinear::getInterpolatedSituation(const CCallsign &callsign, const CAircraftSituationList &situations, qint64 currentTimeMsSinceEpoc,
|
||||||
const CInterpolationAndRenderingSetup &setup, const CInterpolationHints &hints, InterpolationStatus &status) const
|
const CInterpolationAndRenderingSetup &setup, const CInterpolationHints &hints, InterpolationStatus &status) const
|
||||||
{
|
{
|
||||||
//
|
|
||||||
// function has to be thread safe
|
|
||||||
//
|
|
||||||
status.reset();
|
status.reset();
|
||||||
|
|
||||||
// any data at all?
|
// any data at all?
|
||||||
|
|||||||
@@ -25,15 +25,13 @@ namespace BlackMisc
|
|||||||
namespace Aviation { class CCallsign; }
|
namespace Aviation { class CCallsign; }
|
||||||
namespace Simulation
|
namespace Simulation
|
||||||
{
|
{
|
||||||
class IRemoteAircraftProvider;
|
|
||||||
|
|
||||||
//! Linear interpolator, calculation inbetween positions
|
//! Linear interpolator, calculation inbetween positions
|
||||||
class BLACKMISC_EXPORT CInterpolatorLinear : public IInterpolator
|
class BLACKMISC_EXPORT CInterpolatorLinear : public IInterpolator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! Constructor
|
//! Constructor
|
||||||
CInterpolatorLinear(BlackMisc::Simulation::IRemoteAircraftProvider *provider, QObject *parent = nullptr) :
|
CInterpolatorLinear(QObject *parent = nullptr) :
|
||||||
IInterpolator(provider, "CInterpolatorLinear", parent)
|
IInterpolator("CInterpolatorLinear", parent)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
// public base class signature
|
// public base class signature
|
||||||
|
|||||||
@@ -119,9 +119,10 @@ namespace BlackSimPlugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
CFs9Client::CFs9Client(const CCallsign &callsign, const QString &modelName,
|
CFs9Client::CFs9Client(const CCallsign &callsign, const QString &modelName,
|
||||||
BlackMisc::Simulation::IInterpolator *interpolator, const CTime &updateInterval, QObject *owner) :
|
const CTime &updateInterval, QObject *owner) :
|
||||||
CDirectPlayPeer(owner, callsign),
|
CDirectPlayPeer(owner, callsign),
|
||||||
m_updateInterval(updateInterval), m_interpolator(interpolator), m_modelName(modelName)
|
m_updateInterval(updateInterval),
|
||||||
|
m_modelName(modelName)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,14 +178,13 @@ namespace BlackSimPlugin
|
|||||||
void CFs9Client::timerEvent(QTimerEvent *event)
|
void CFs9Client::timerEvent(QTimerEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
Q_ASSERT_X(m_interpolator, Q_FUNC_INFO, "Missing interpolator");
|
|
||||||
|
|
||||||
if (m_clientStatus == Disconnected) { return; }
|
if (m_clientStatus == Disconnected) { return; }
|
||||||
|
|
||||||
IInterpolator::InterpolationStatus status;
|
IInterpolator::InterpolationStatus status;
|
||||||
CInterpolationHints hints; // \fixme 201701 #865 KB if there is an elevation provider for FS9 add it here or set elevation
|
CInterpolationHints hints; // \fixme 201701 #865 KB if there is an elevation provider for FS9 add it here or set elevation
|
||||||
hints.setLoggingInterpolation(this->m_interpolator->getInterpolatorSetup().getLogCallsigns().contains(m_callsign));
|
hints.setLoggingInterpolation(this->getInterpolationSetup().getLogCallsigns().contains(m_callsign));
|
||||||
const CAircraftSituation situation = this->m_interpolator->getInterpolatedSituation(m_callsign, -1, this->m_interpolationSetup, hints, status);
|
const CAircraftSituation situation = this->m_interpolator.getInterpolatedSituation(m_callsign, -1, this->m_interpolationSetup, hints, status);
|
||||||
|
|
||||||
// Test only for successful interpolation. FS9 requires constant positions
|
// Test only for successful interpolation. FS9 requires constant positions
|
||||||
if (!status.didInterpolationSucceed()) { return; }
|
if (!status.didInterpolationSucceed()) { return; }
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#define DIRECTPLAY_CLIENT_H
|
#define DIRECTPLAY_CLIENT_H
|
||||||
|
|
||||||
#include "directplaypeer.h"
|
#include "directplaypeer.h"
|
||||||
#include "blackmisc/simulation/interpolator.h"
|
#include "blackmisc/simulation/interpolatorlinear.h"
|
||||||
#include "blackmisc/aviation/aircraftsituation.h"
|
#include "blackmisc/aviation/aircraftsituation.h"
|
||||||
#include "blackmisc/pq/time.h"
|
#include "blackmisc/pq/time.h"
|
||||||
#include "blackmisc/aviation/callsign.h"
|
#include "blackmisc/aviation/callsign.h"
|
||||||
@@ -41,8 +41,7 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
//! Constructor
|
//! Constructor
|
||||||
CFs9Client(const BlackMisc::Aviation::CCallsign &callsign, const QString &modelName,
|
CFs9Client(const BlackMisc::Aviation::CCallsign &callsign, const QString &modelName,
|
||||||
BlackMisc::Simulation::IInterpolator *interpolator, const BlackMisc::PhysicalQuantities::CTime &updateInterval,
|
const BlackMisc::PhysicalQuantities::CTime &updateInterval, QObject *owner);
|
||||||
QObject *owner);
|
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~CFs9Client();
|
virtual ~CFs9Client();
|
||||||
@@ -50,6 +49,9 @@ namespace BlackSimPlugin
|
|||||||
//! Set DirectPlay host address
|
//! Set DirectPlay host address
|
||||||
void setHostAddress(const QString &hostAddress);
|
void setHostAddress(const QString &hostAddress);
|
||||||
|
|
||||||
|
//! Get interpolator
|
||||||
|
BlackMisc::Simulation::IInterpolator *getInterpolator() { return &m_interpolator; }
|
||||||
|
|
||||||
//! Set interpolation setup
|
//! Set interpolation setup
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
void setInterpolationSetup(const BlackMisc::Simulation::CInterpolationAndRenderingSetup &setup);
|
void setInterpolationSetup(const BlackMisc::Simulation::CInterpolationAndRenderingSetup &setup);
|
||||||
@@ -95,7 +97,7 @@ namespace BlackSimPlugin
|
|||||||
BlackMisc::Simulation::CInterpolationAndRenderingSetup getInterpolationSetup() const;
|
BlackMisc::Simulation::CInterpolationAndRenderingSetup getInterpolationSetup() const;
|
||||||
|
|
||||||
BlackMisc::PhysicalQuantities::CTime m_updateInterval;
|
BlackMisc::PhysicalQuantities::CTime m_updateInterval;
|
||||||
BlackMisc::Simulation::IInterpolator *m_interpolator = nullptr;
|
BlackMisc::Simulation::CInterpolatorLinear m_interpolator;
|
||||||
BlackMisc::Simulation::CInterpolationAndRenderingSetup m_interpolationSetup;
|
BlackMisc::Simulation::CInterpolationAndRenderingSetup m_interpolationSetup;
|
||||||
mutable QReadWriteLock m_interpolationSetupMutex;
|
mutable QReadWriteLock m_interpolationSetupMutex;
|
||||||
QString m_modelName;
|
QString m_modelName;
|
||||||
|
|||||||
@@ -112,7 +112,6 @@ namespace BlackSimPlugin
|
|||||||
m_lobbyClient(lobbyClient)
|
m_lobbyClient(lobbyClient)
|
||||||
{
|
{
|
||||||
connect(lobbyClient.data(), &CLobbyClient::disconnected, this, std::bind(&CSimulatorFs9::simulatorStatusChanged, this, 0));
|
connect(lobbyClient.data(), &CLobbyClient::disconnected, this, std::bind(&CSimulatorFs9::simulatorStatusChanged, this, 0));
|
||||||
m_interpolator = new CInterpolatorLinear(remoteAircraftProvider, this);
|
|
||||||
m_defaultModel =
|
m_defaultModel =
|
||||||
{
|
{
|
||||||
"Boeing 737-400",
|
"Boeing 737-400",
|
||||||
@@ -172,7 +171,7 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
bool rendered = true;
|
bool rendered = true;
|
||||||
updateAircraftRendered(callsign, rendered);
|
updateAircraftRendered(callsign, rendered);
|
||||||
CFs9Client *client = new CFs9Client(callsign, newRemoteAircraft.getModelString(), m_interpolator, CTime(25, CTimeUnit::ms()), this);
|
CFs9Client *client = new CFs9Client(callsign, newRemoteAircraft.getModelString(), CTime(25, CTimeUnit::ms()), this);
|
||||||
client->setHostAddress(m_fs9Host->getHostAddress());
|
client->setHostAddress(m_fs9Host->getHostAddress());
|
||||||
client->setPlayerUserId(m_fs9Host->getPlayerUserId());
|
client->setPlayerUserId(m_fs9Host->getPlayerUserId());
|
||||||
client->start();
|
client->start();
|
||||||
@@ -391,6 +390,20 @@ namespace BlackSimPlugin
|
|||||||
m_fsuipc->write(weatherGrid);
|
m_fsuipc->write(weatherGrid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSimulatorFs9::ps_remoteProviderAddAircraftSituation(const CAircraftSituation &situation)
|
||||||
|
{
|
||||||
|
const auto it = m_hashFs9Clients.find(situation.getCallsign());
|
||||||
|
if (it == m_hashFs9Clients.end()) { return; }
|
||||||
|
QTimer::singleShot(0, it->data(), [client = *it, situation] { client->getInterpolator()->addAircraftSituation(situation); });
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSimulatorFs9::ps_remoteProviderAddAircraftParts(const BlackMisc::Aviation::CCallsign &callsign, const CAircraftParts &parts)
|
||||||
|
{
|
||||||
|
const auto it = m_hashFs9Clients.find(callsign);
|
||||||
|
if (it == m_hashFs9Clients.end()) { return; }
|
||||||
|
QTimer::singleShot(0, it->data(), [client = *it, parts] { client->getInterpolator()->addAircraftParts(parts); });
|
||||||
|
}
|
||||||
|
|
||||||
CSimulatorFs9Listener::CSimulatorFs9Listener(const CSimulatorPluginInfo &info,
|
CSimulatorFs9Listener::CSimulatorFs9Listener(const CSimulatorPluginInfo &info,
|
||||||
const QSharedPointer<CFs9Host> &fs9Host,
|
const QSharedPointer<CFs9Host> &fs9Host,
|
||||||
const QSharedPointer<CLobbyClient> &lobbyClient) :
|
const QSharedPointer<CLobbyClient> &lobbyClient) :
|
||||||
|
|||||||
@@ -76,6 +76,8 @@ namespace BlackSimPlugin
|
|||||||
//! \name Base class overrides
|
//! \name Base class overrides
|
||||||
//! @{
|
//! @{
|
||||||
virtual void injectWeatherGrid(const BlackMisc::Weather::CWeatherGrid &weatherGrid) override;
|
virtual void injectWeatherGrid(const BlackMisc::Weather::CWeatherGrid &weatherGrid) override;
|
||||||
|
virtual void ps_remoteProviderAddAircraftSituation(const BlackMisc::Aviation::CAircraftSituation &situation) override;
|
||||||
|
virtual void ps_remoteProviderAddAircraftParts(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CAircraftParts &parts) override;
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "simconnectobject.h"
|
#include "simconnectobject.h"
|
||||||
|
#include "blackmisc/simulation/interpolatorlinear.h"
|
||||||
|
|
||||||
using namespace BlackMisc::Aviation;
|
using namespace BlackMisc::Aviation;
|
||||||
using namespace BlackMisc::Simulation;
|
using namespace BlackMisc::Simulation;
|
||||||
@@ -16,10 +17,12 @@ namespace BlackSimPlugin
|
|||||||
{
|
{
|
||||||
namespace Fsx
|
namespace Fsx
|
||||||
{
|
{
|
||||||
CSimConnectObject::CSimConnectObject() { }
|
CSimConnectObject::CSimConnectObject()
|
||||||
|
{ }
|
||||||
|
|
||||||
CSimConnectObject::CSimConnectObject(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, DWORD requestId) :
|
CSimConnectObject::CSimConnectObject(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, DWORD requestId) :
|
||||||
m_aircraft(aircraft), m_requestId(requestId), m_validRequestId(true)
|
m_aircraft(aircraft), m_requestId(requestId), m_validRequestId(true),
|
||||||
|
m_interpolator(QSharedPointer<BlackMisc::Simulation::CInterpolatorLinear>::create())
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
bool CSimConnectObject::isPendingAdded() const
|
bool CSimConnectObject::isPendingAdded() const
|
||||||
|
|||||||
@@ -43,6 +43,9 @@ namespace BlackSimPlugin
|
|||||||
//! Simulated aircraft model string
|
//! Simulated aircraft model string
|
||||||
const QString &getAircraftModelString() const { return m_aircraft.getModelString(); }
|
const QString &getAircraftModelString() const { return m_aircraft.getModelString(); }
|
||||||
|
|
||||||
|
//! Interpolator
|
||||||
|
BlackMisc::Simulation::IInterpolator *getInterpolator() const { return m_interpolator.data(); }
|
||||||
|
|
||||||
//! Get current lights (requested from simulator)
|
//! Get current lights (requested from simulator)
|
||||||
const BlackMisc::Aviation::CAircraftLights &getCurrentLightsInSimulator() const { return m_currentLightsInSim; }
|
const BlackMisc::Aviation::CAircraftLights &getCurrentLightsInSimulator() const { return m_currentLightsInSim; }
|
||||||
|
|
||||||
@@ -119,6 +122,7 @@ namespace BlackSimPlugin
|
|||||||
BlackMisc::Aviation::CAircraftLights m_currentLightsInSim { nullptr }; //!< current lights to know state for toggling
|
BlackMisc::Aviation::CAircraftLights m_currentLightsInSim { nullptr }; //!< current lights to know state for toggling
|
||||||
BlackMisc::Aviation::CAircraftLights m_lightsAsSent { nullptr }; //!< lights as sent to simulator
|
BlackMisc::Aviation::CAircraftLights m_lightsAsSent { nullptr }; //!< lights as sent to simulator
|
||||||
SIMCONNECT_PERIOD m_requestSimDataPeriod = SIMCONNECT_PERIOD_NEVER; //!< how often do we query ground elevation
|
SIMCONNECT_PERIOD m_requestSimDataPeriod = SIMCONNECT_PERIOD_NEVER; //!< how often do we query ground elevation
|
||||||
|
QSharedPointer<BlackMisc::Simulation::IInterpolator> m_interpolator; //!< shared pointer because CSimConnectObject can be copied
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Simulator objects (aka AI aircraft)
|
//! Simulator objects (aka AI aircraft)
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ namespace BlackSimPlugin
|
|||||||
connect(&m_realityBubbleTimer, &QTimer::timeout, this, &CSimulatorFsx::ps_addAircraftCurrentlyOutOfBubble);
|
connect(&m_realityBubbleTimer, &QTimer::timeout, this, &CSimulatorFsx::ps_addAircraftCurrentlyOutOfBubble);
|
||||||
|
|
||||||
m_useFsuipc = false; // Temporarily enabled until Simconnect Weather is implemented.
|
m_useFsuipc = false; // Temporarily enabled until Simconnect Weather is implemented.
|
||||||
m_interpolator = new CInterpolatorLinear(remoteAircraftProvider, this);
|
|
||||||
m_defaultModel =
|
m_defaultModel =
|
||||||
{
|
{
|
||||||
"Boeing 737-800 Paint1",
|
"Boeing 737-800 Paint1",
|
||||||
@@ -153,9 +152,6 @@ namespace BlackSimPlugin
|
|||||||
CSimulatedAircraft addedAircraft(newRemoteAircraft);
|
CSimulatedAircraft addedAircraft(newRemoteAircraft);
|
||||||
if (isConnected())
|
if (isConnected())
|
||||||
{
|
{
|
||||||
// initial position if interpolator has data, otherwise do nothing
|
|
||||||
setInitialAircraftSituation(addedAircraft); // set interpolated data/parts if available
|
|
||||||
|
|
||||||
const DWORD requestId = obtainRequestIdSimData();
|
const DWORD requestId = obtainRequestIdSimData();
|
||||||
SIMCONNECT_DATA_INITPOSITION initialPosition = aircraftSituationToFsxPosition(addedAircraft.getSituation());
|
SIMCONNECT_DATA_INITPOSITION initialPosition = aircraftSituationToFsxPosition(addedAircraft.getSituation());
|
||||||
const QString modelString(addedAircraft.getModelString());
|
const QString modelString(addedAircraft.getModelString());
|
||||||
@@ -872,7 +868,6 @@ namespace BlackSimPlugin
|
|||||||
void CSimulatorFsx::updateRemoteAircraft()
|
void CSimulatorFsx::updateRemoteAircraft()
|
||||||
{
|
{
|
||||||
static_assert(sizeof(DataDefinitionRemoteAircraftParts) == sizeof(double) * 10, "DataDefinitionRemoteAircraftParts has an incorrect size.");
|
static_assert(sizeof(DataDefinitionRemoteAircraftParts) == sizeof(double) * 10, "DataDefinitionRemoteAircraftParts has an incorrect size.");
|
||||||
Q_ASSERT_X(this->m_interpolator, Q_FUNC_INFO, "missing interpolator");
|
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "thread");
|
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "thread");
|
||||||
|
|
||||||
// nothing to do, reset request id and exit
|
// nothing to do, reset request id and exit
|
||||||
@@ -908,14 +903,14 @@ namespace BlackSimPlugin
|
|||||||
partsStatus.setSupportsParts(useAircraftParts);
|
partsStatus.setSupportsParts(useAircraftParts);
|
||||||
|
|
||||||
const CInterpolationAndRenderingSetup setup(getInterpolationAndRenderingSetup());
|
const CInterpolationAndRenderingSetup setup(getInterpolationAndRenderingSetup());
|
||||||
const CAircraftParts parts = useAircraftParts ? this->m_interpolator->getInterpolatedParts(callsign, -1, setup, partsStatus, logInterpolationAndParts) : CAircraftParts();
|
const CAircraftParts parts = useAircraftParts ? simObj.getInterpolator()->getInterpolatedParts(callsign, -1, setup, partsStatus, logInterpolationAndParts) : CAircraftParts();
|
||||||
|
|
||||||
// get interpolated situation
|
// get interpolated situation
|
||||||
IInterpolator::InterpolationStatus interpolatorStatus;
|
IInterpolator::InterpolationStatus interpolatorStatus;
|
||||||
CInterpolationHints hints(m_hints[simObj.getCallsign()]);
|
CInterpolationHints hints(m_hints[simObj.getCallsign()]);
|
||||||
hints.setAircraftParts(useAircraftParts ? parts : CAircraftParts(), useAircraftParts);
|
hints.setAircraftParts(useAircraftParts ? parts : CAircraftParts(), useAircraftParts);
|
||||||
hints.setLoggingInterpolation(logInterpolationAndParts);
|
hints.setLoggingInterpolation(logInterpolationAndParts);
|
||||||
const CAircraftSituation interpolatedSituation = this->m_interpolator->getInterpolatedSituation(callsign, currentTimestamp, setup, hints, interpolatorStatus);
|
const CAircraftSituation interpolatedSituation = simObj.getInterpolator()->getInterpolatedSituation(callsign, currentTimestamp, setup, hints, interpolatorStatus);
|
||||||
|
|
||||||
if (interpolatorStatus.allTrue())
|
if (interpolatorStatus.allTrue())
|
||||||
{
|
{
|
||||||
@@ -1274,6 +1269,18 @@ namespace BlackSimPlugin
|
|||||||
CSimulatorFsCommon::clearAllAircraft();
|
CSimulatorFsCommon::clearAllAircraft();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSimulatorFsx::ps_remoteProviderAddAircraftSituation(const CAircraftSituation &situation)
|
||||||
|
{
|
||||||
|
if (!m_simConnectObjects.contains(situation.getCallsign())) { return; }
|
||||||
|
m_simConnectObjects[situation.getCallsign()].getInterpolator()->addAircraftSituation(situation);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSimulatorFsx::ps_remoteProviderAddAircraftParts(const BlackMisc::Aviation::CCallsign &callsign, const CAircraftParts &parts)
|
||||||
|
{
|
||||||
|
if (!m_simConnectObjects.contains(callsign)) { return; }
|
||||||
|
m_simConnectObjects[callsign].getInterpolator()->addAircraftParts(parts);
|
||||||
|
}
|
||||||
|
|
||||||
QString CSimulatorFsx::fsxPositionToString(const SIMCONNECT_DATA_INITPOSITION &position)
|
QString CSimulatorFsx::fsxPositionToString(const SIMCONNECT_DATA_INITPOSITION &position)
|
||||||
{
|
{
|
||||||
const QString positionStr("Lat: %1 lng: %2 alt: %3ft pitch: %4 bank: %5 hdg: %6 airspeed: %7kts onGround: %8");
|
const QString positionStr("Lat: %1 lng: %2 alt: %3ft pitch: %4 bank: %5 hdg: %6 airspeed: %7kts onGround: %8");
|
||||||
|
|||||||
@@ -133,6 +133,8 @@ namespace BlackSimPlugin
|
|||||||
virtual void clearAllAircraft() override;
|
virtual void clearAllAircraft() override;
|
||||||
virtual void initSimulatorInternals() override;
|
virtual void initSimulatorInternals() override;
|
||||||
virtual void injectWeatherGrid(const BlackMisc::Weather::CWeatherGrid &weatherGrid) override;
|
virtual void injectWeatherGrid(const BlackMisc::Weather::CWeatherGrid &weatherGrid) override;
|
||||||
|
virtual void ps_remoteProviderAddAircraftSituation(const BlackMisc::Aviation::CAircraftSituation &situation) override;
|
||||||
|
virtual void ps_remoteProviderAddAircraftParts(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CAircraftParts &parts) override;
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
//! Timer event (our SimConnect event loop), runs ps_dispatch
|
//! Timer event (our SimConnect event loop), runs ps_dispatch
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
#include "blackmisc/simulation/interpolator.h"
|
#include "blackmisc/simulation/interpolator.h"
|
||||||
#include "blackmisc/simulation/interpolationhints.h"
|
#include "blackmisc/simulation/interpolationhints.h"
|
||||||
#include "blackmisc/simulation/interpolatorlinear.h"
|
#include "blackmisc/simulation/interpolatorlinear.h"
|
||||||
#include "blackmisc/simulation/remoteaircraftproviderdummy.h"
|
|
||||||
#include "XPMPMultiplayer.h"
|
#include "XPMPMultiplayer.h"
|
||||||
#include <XPLM/XPLMProcessing.h>
|
#include <XPLM/XPLMProcessing.h>
|
||||||
#include <XPLM/XPLMUtilities.h>
|
#include <XPLM/XPLMUtilities.h>
|
||||||
@@ -42,7 +41,7 @@ namespace XBus
|
|||||||
surfaces.lights.timeOffset = static_cast<quint16>(qrand() % 0xffff);
|
surfaces.lights.timeOffset = static_cast<quint16>(qrand() % 0xffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
BlackMisc::Simulation::CInterpolationHints CTraffic::Plane::hints(BlackMisc::Simulation::IInterpolator *interpolator) const
|
BlackMisc::Simulation::CInterpolationHints CTraffic::Plane::hints() const
|
||||||
{
|
{
|
||||||
// \todo MS 865 CInterpolationAndRenderingSetup allows to setup interpolation in the GUI, e.g.
|
// \todo MS 865 CInterpolationAndRenderingSetup allows to setup interpolation in the GUI, e.g.
|
||||||
// also to disable aircraft parts / or logging parts (log file). I wonder if you want to consider it here
|
// also to disable aircraft parts / or logging parts (log file). I wonder if you want to consider it here
|
||||||
@@ -50,8 +49,8 @@ namespace XBus
|
|||||||
// if the setup is needed more than once, store it here to avoid multiple locks
|
// if the setup is needed more than once, store it here to avoid multiple locks
|
||||||
BlackMisc::Simulation::CInterpolationAndRenderingSetup setup;
|
BlackMisc::Simulation::CInterpolationAndRenderingSetup setup;
|
||||||
BlackMisc::Simulation::CInterpolationHints hints;
|
BlackMisc::Simulation::CInterpolationHints hints;
|
||||||
BlackMisc::Simulation::IInterpolator::PartsStatus status;
|
BlackMisc::Simulation::IInterpolator::CPartsStatus status;
|
||||||
hints.setAircraftParts(interpolator->getInterpolatedParts(callsign, parts, -1, setup, status));
|
hints.setAircraftParts(interpolator.getInterpolatedParts(callsign, -1, setup, status));
|
||||||
hints.setElevationProvider([this](const auto & situation)
|
hints.setElevationProvider([this](const auto & situation)
|
||||||
{
|
{
|
||||||
using namespace BlackMisc::PhysicalQuantities;
|
using namespace BlackMisc::PhysicalQuantities;
|
||||||
@@ -68,8 +67,7 @@ namespace XBus
|
|||||||
}
|
}
|
||||||
|
|
||||||
CTraffic::CTraffic(QObject *parent) :
|
CTraffic::CTraffic(QObject *parent) :
|
||||||
QObject(parent),
|
QObject(parent)
|
||||||
m_interpolator(new BlackMisc::Simulation::CInterpolatorLinear(new BlackMisc::Simulation::CRemoteAircraftProviderDummy(this), this))
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,17 +258,16 @@ namespace XBus
|
|||||||
{
|
{
|
||||||
using namespace BlackMisc::PhysicalQuantities;
|
using namespace BlackMisc::PhysicalQuantities;
|
||||||
using namespace BlackMisc::Aviation;
|
using namespace BlackMisc::Aviation;
|
||||||
constexpr int maxSituationCount = 6;
|
CAircraftSituation situation(
|
||||||
plane->situations.push_frontMaxElements(
|
|
||||||
{
|
|
||||||
callsign,
|
callsign,
|
||||||
BlackMisc::Geo::CCoordinateGeodetic(latitude, longitude, altitude),
|
BlackMisc::Geo::CCoordinateGeodetic(latitude, longitude, altitude),
|
||||||
CHeading(heading, CHeading::True, CAngleUnit::deg()),
|
CHeading(heading, CHeading::True, CAngleUnit::deg()),
|
||||||
CAngle(pitch, CAngleUnit::deg()),
|
CAngle(pitch, CAngleUnit::deg()),
|
||||||
CAngle(roll, CAngleUnit::deg()),
|
CAngle(roll, CAngleUnit::deg()),
|
||||||
CSpeed(0, CSpeedUnit::kts())
|
CSpeed(0, CSpeedUnit::kts())
|
||||||
}, maxSituationCount);
|
);
|
||||||
plane->situations.front().setMSecsSinceEpoch(relativeTime + QDateTime::currentMSecsSinceEpoch());
|
situation.setMSecsSinceEpoch(relativeTime + QDateTime::currentMSecsSinceEpoch());
|
||||||
|
plane->interpolator.addAircraftSituation(situation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -297,12 +294,10 @@ namespace XBus
|
|||||||
plane->surfaces.lights.navLights = navLight;
|
plane->surfaces.lights.navLights = navLight;
|
||||||
plane->surfaces.lights.flashPattern = lightPattern;
|
plane->surfaces.lights.flashPattern = lightPattern;
|
||||||
|
|
||||||
plane->parts.push_front({});
|
BlackMisc::Aviation::CAircraftParts parts;
|
||||||
plane->parts.front().setOnGround(onGround);
|
parts.setOnGround(onGround);
|
||||||
plane->parts.front().setMSecsSinceEpoch(relativeTime + QDateTime::currentMSecsSinceEpoch());
|
parts.setMSecsSinceEpoch(relativeTime + QDateTime::currentMSecsSinceEpoch());
|
||||||
|
plane->interpolator.addAircraftParts(parts);
|
||||||
// remove outdated parts (but never remove the most recent one)
|
|
||||||
BlackMisc::Simulation::IRemoteAircraftProvider::removeOutdatedParts(plane->parts);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -337,11 +332,9 @@ namespace XBus
|
|||||||
{
|
{
|
||||||
case xpmpDataType_Position:
|
case xpmpDataType_Position:
|
||||||
{
|
{
|
||||||
if (plane->situations.size() < 3) { return xpmpData_Unavailable; } // avoid sudden movements when a pilot connects
|
|
||||||
|
|
||||||
BlackMisc::Simulation::CInterpolationAndRenderingSetup setup;
|
BlackMisc::Simulation::CInterpolationAndRenderingSetup setup;
|
||||||
BlackMisc::Simulation::IInterpolator::InterpolationStatus status;
|
BlackMisc::Simulation::IInterpolator::CInterpolationStatus status;
|
||||||
const auto situation = m_interpolator->getInterpolatedSituation(plane->callsign, plane->situations, -1, setup, plane->hints(m_interpolator), status);
|
const auto situation = plane->interpolator.getInterpolatedSituation(plane->callsign, -1, setup, plane->hints(), status);
|
||||||
if (! status.didInterpolationSucceed()) { return xpmpData_Unavailable; }
|
if (! status.didInterpolationSucceed()) { return xpmpData_Unavailable; }
|
||||||
if (! status.hasChangedPosition()) { return xpmpData_Unchanged; }
|
if (! status.hasChangedPosition()) { return xpmpData_Unchanged; }
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#include "terrainprobe.h"
|
#include "terrainprobe.h"
|
||||||
#include "blackmisc/aviation/aircraftsituationlist.h"
|
#include "blackmisc/aviation/aircraftsituationlist.h"
|
||||||
#include "blackmisc/aviation/aircraftpartslist.h"
|
#include "blackmisc/aviation/aircraftpartslist.h"
|
||||||
|
#include "blackmisc/simulation/interpolatorlinear.h"
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
@@ -137,10 +138,9 @@ namespace XBus
|
|||||||
bool hasSurfaces = false;
|
bool hasSurfaces = false;
|
||||||
bool hasXpdr = false;
|
bool hasXpdr = false;
|
||||||
char label[32] {};
|
char label[32] {};
|
||||||
BlackMisc::Aviation::CAircraftSituationList situations;
|
BlackMisc::Simulation::CInterpolatorLinear interpolator;
|
||||||
BlackMisc::Aviation::CAircraftPartsList parts;
|
|
||||||
CTerrainProbe terrainProbe;
|
CTerrainProbe terrainProbe;
|
||||||
BlackMisc::Simulation::CInterpolationHints hints(BlackMisc::Simulation::IInterpolator *) const;
|
BlackMisc::Simulation::CInterpolationHints hints() const;
|
||||||
XPMPPlaneSurfaces_t surfaces;
|
XPMPPlaneSurfaces_t surfaces;
|
||||||
XPMPPlaneRadar_t xpdr;
|
XPMPPlaneRadar_t xpdr;
|
||||||
Plane(void *id_, QString callsign_, QString aircraftIcao_, QString airlineIcao_, QString livery_);
|
Plane(void *id_, QString callsign_, QString aircraftIcao_, QString airlineIcao_, QString livery_);
|
||||||
@@ -153,8 +153,6 @@ namespace XBus
|
|||||||
{
|
{
|
||||||
return static_cast<CTraffic *>(self)->getPlaneData(id, dataType, io_data);
|
return static_cast<CTraffic *>(self)->getPlaneData(id, dataType, io_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
BlackMisc::Simulation::IInterpolator *m_interpolator = nullptr;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,6 @@
|
|||||||
#include "blackmisc/pq/units.h"
|
#include "blackmisc/pq/units.h"
|
||||||
#include "blackmisc/simulation/interpolationhints.h"
|
#include "blackmisc/simulation/interpolationhints.h"
|
||||||
#include "blackmisc/simulation/remoteaircraftprovider.h"
|
#include "blackmisc/simulation/remoteaircraftprovider.h"
|
||||||
#include "blackmisc/simulation/remoteaircraftproviderdummy.h"
|
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
@@ -57,8 +56,7 @@ namespace BlackMiscTest
|
|||||||
|
|
||||||
void CTestInterpolator::linearInterpolator()
|
void CTestInterpolator::linearInterpolator()
|
||||||
{
|
{
|
||||||
QScopedPointer<CRemoteAircraftProviderDummy> provider(new CRemoteAircraftProviderDummy());
|
CInterpolatorLinear interpolator;
|
||||||
CInterpolatorLinear interpolator(provider.data());
|
|
||||||
|
|
||||||
// fixed time so everything can be debugged
|
// fixed time so everything can be debugged
|
||||||
const qint64 ts = 1425000000000; // QDateTime::currentMSecsSinceEpoch();
|
const qint64 ts = 1425000000000; // QDateTime::currentMSecsSinceEpoch();
|
||||||
@@ -72,23 +70,19 @@ namespace BlackMiscTest
|
|||||||
// check height above ground
|
// check height above ground
|
||||||
CLength hag = (s.getAltitude() - s.getGroundElevation());
|
CLength hag = (s.getAltitude() - s.getGroundElevation());
|
||||||
QVERIFY2(s.getHeightAboveGround() == hag, "Wrong elevation");
|
QVERIFY2(s.getHeightAboveGround() == hag, "Wrong elevation");
|
||||||
provider->insertNewSituation(s);
|
interpolator.addAircraftSituation(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr int partsCount = 10;
|
constexpr int partsCount = 10;
|
||||||
for (int i = 0; i < partsCount; i++)
|
for (int i = 0; i < partsCount; i++)
|
||||||
{
|
{
|
||||||
CAircraftParts p(getTestParts(i, ts, deltaT));
|
CAircraftParts p(getTestParts(i, ts, deltaT));
|
||||||
provider->insertNewAircraftParts(cs, p);
|
interpolator.addAircraftParts(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
// make sure signals are processed, if the interpolator depends on those signals
|
// make sure signals are processed, if the interpolator depends on those signals
|
||||||
QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
|
QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
|
||||||
|
|
||||||
// check if all situations / parts have been received
|
|
||||||
QVERIFY2(provider->remoteAircraftSituations(cs).size() == IRemoteAircraftProvider::MaxSituationsPerCallsign, "Missing situations");
|
|
||||||
QVERIFY2(provider->remoteAircraftParts(cs).size() == partsCount, "Missing parts");
|
|
||||||
|
|
||||||
// interpolation functional check
|
// interpolation functional check
|
||||||
IInterpolator::InterpolationStatus status;
|
IInterpolator::InterpolationStatus status;
|
||||||
const CInterpolationHints hints;
|
const CInterpolationHints hints;
|
||||||
|
|||||||
Reference in New Issue
Block a user