mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 05:26:45 +08:00
refs #863 Move interpolator logging into a separate class.
A single logger instance can be shared between multiple interpolator instances.
This commit is contained in:
@@ -118,13 +118,14 @@ namespace BlackSimPlugin
|
||||
return positionSlewMode;
|
||||
}
|
||||
|
||||
CFs9Client::CFs9Client(const CCallsign &callsign, const QString &modelName,
|
||||
const CTime &updateInterval, QObject *owner) :
|
||||
CFs9Client::CFs9Client(const CCallsign &callsign, const QString &modelName, const CTime &updateInterval,
|
||||
BlackMisc::Simulation::CInterpolationLogger *logger, QObject *owner) :
|
||||
CDirectPlayPeer(owner, callsign),
|
||||
m_updateInterval(updateInterval),
|
||||
m_interpolator(callsign),
|
||||
m_modelName(modelName)
|
||||
{
|
||||
m_interpolator.attachLogger(logger);
|
||||
}
|
||||
|
||||
CFs9Client::~CFs9Client()
|
||||
|
||||
@@ -41,7 +41,8 @@ namespace BlackSimPlugin
|
||||
|
||||
//! Constructor
|
||||
CFs9Client(const BlackMisc::Aviation::CCallsign &callsign, const QString &modelName,
|
||||
const BlackMisc::PhysicalQuantities::CTime &updateInterval, QObject *owner);
|
||||
const BlackMisc::PhysicalQuantities::CTime &updateInterval,
|
||||
BlackMisc::Simulation::CInterpolationLogger *logger, QObject *owner);
|
||||
|
||||
//! Destructor
|
||||
virtual ~CFs9Client();
|
||||
|
||||
@@ -171,7 +171,7 @@ namespace BlackSimPlugin
|
||||
|
||||
bool rendered = true;
|
||||
updateAircraftRendered(callsign, rendered);
|
||||
CFs9Client *client = new CFs9Client(callsign, newRemoteAircraft.getModelString(), CTime(25, CTimeUnit::ms()), this);
|
||||
CFs9Client *client = new CFs9Client(callsign, newRemoteAircraft.getModelString(), CTime(25, CTimeUnit::ms()), &m_interpolationLogger, this);
|
||||
client->setHostAddress(m_fs9Host->getHostAddress());
|
||||
client->setPlayerUserId(m_fs9Host->getPlayerUserId());
|
||||
client->start();
|
||||
|
||||
@@ -20,10 +20,13 @@ namespace BlackSimPlugin
|
||||
CSimConnectObject::CSimConnectObject()
|
||||
{ }
|
||||
|
||||
CSimConnectObject::CSimConnectObject(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, DWORD requestId) :
|
||||
CSimConnectObject::CSimConnectObject(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, DWORD requestId,
|
||||
BlackMisc::Simulation::CInterpolationLogger *logger) :
|
||||
m_aircraft(aircraft), m_requestId(requestId), m_validRequestId(true),
|
||||
m_interpolator(QSharedPointer<BlackMisc::Simulation::CInterpolatorLinear>::create(aircraft.getCallsign()))
|
||||
{ }
|
||||
{
|
||||
m_interpolator->attachLogger(logger);
|
||||
}
|
||||
|
||||
bool CSimConnectObject::isPendingAdded() const
|
||||
{
|
||||
|
||||
@@ -16,7 +16,14 @@
|
||||
#include "simconnectdatadefinition.h"
|
||||
#include <QSharedPointer>
|
||||
|
||||
namespace BlackMisc { namespace Simulation { class CInterpolatorLinear; } }
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Simulation
|
||||
{
|
||||
class CInterpolatorLinear;
|
||||
class CInterpolationLogger;
|
||||
}
|
||||
}
|
||||
namespace BlackSimPlugin
|
||||
{
|
||||
namespace Fsx
|
||||
@@ -29,7 +36,8 @@ namespace BlackSimPlugin
|
||||
CSimConnectObject();
|
||||
|
||||
//! Constructor
|
||||
CSimConnectObject(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, DWORD requestId);
|
||||
CSimConnectObject(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, DWORD requestId,
|
||||
BlackMisc::Simulation::CInterpolationLogger *logger);
|
||||
|
||||
//! Destructor
|
||||
~CSimConnectObject() {}
|
||||
|
||||
@@ -174,7 +174,7 @@ namespace BlackSimPlugin
|
||||
// we will request a new aircraft by request ID, later we will receive its object id
|
||||
// so far this object id is -1
|
||||
addedAircraft.setRendered(false);
|
||||
const CSimConnectObject simObject(addedAircraft, requestId);
|
||||
const CSimConnectObject simObject(addedAircraft, requestId, &m_interpolationLogger);
|
||||
m_simConnectObjects.insert(callsign, simObject);
|
||||
adding = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user