Ref T180, formatting

This commit is contained in:
Klaus Basan
2017-11-09 00:52:13 +01:00
parent 4cb404c91d
commit fa50e6a8ea
7 changed files with 31 additions and 26 deletions

View File

@@ -40,7 +40,7 @@ namespace BlackMisc
static QString getLogCategory() { return "swift.interpolationlogger"; } static QString getLogCategory() { return "swift.interpolationlogger"; }
//! Write a log in background //! Write a log in background
BlackMisc::CWorker *writeLogInBackground(); CWorker *writeLogInBackground();
//! Clear log file //! Clear log file
void clearLog(); void clearLog();

View File

@@ -38,7 +38,8 @@ namespace BlackMisc
} }
CAircraftParts CInterpolatorMulti::getInterpolatedParts( CAircraftParts CInterpolatorMulti::getInterpolatedParts(
qint64 currentTimeSinceEpoc, const CInterpolationAndRenderingSetup &setup, CPartsStatus &partsStatus, bool log) qint64 currentTimeSinceEpoc, const CInterpolationAndRenderingSetup &setup,
CPartsStatus &partsStatus, bool log)
{ {
switch (m_mode) switch (m_mode)
{ {

View File

@@ -28,28 +28,28 @@ namespace BlackMisc
{ {
public: public:
//! Constructor //! Constructor
CInterpolatorMulti(const BlackMisc::Aviation::CCallsign &callsign, QObject *parent = nullptr); CInterpolatorMulti(const Aviation::CCallsign &callsign, QObject *parent = nullptr);
//! \copydoc CInterpolator::getInterpolatedSituation //! \copydoc CInterpolator::getInterpolatedSituation
BlackMisc::Aviation::CAircraftSituation getInterpolatedSituation( Aviation::CAircraftSituation getInterpolatedSituation(
qint64 currentTimeSinceEpoc, qint64 currentTimeSinceEpoc,
const CInterpolationAndRenderingSetup &setup, const CInterpolationAndRenderingSetup &setup,
const CInterpolationHints &hints, CInterpolationStatus &status); const CInterpolationHints &hints, CInterpolationStatus &status);
//! \copydoc CInterpolator::getInterpolatedParts //! \copydoc CInterpolator::getInterpolatedParts
BlackMisc::Aviation::CAircraftParts getInterpolatedParts( Aviation::CAircraftParts getInterpolatedParts(
qint64 currentTimeSinceEpoc, qint64 currentTimeSinceEpoc,
const CInterpolationAndRenderingSetup &setup, const CInterpolationAndRenderingSetup &setup,
CPartsStatus &partsStatus, bool log = false); CPartsStatus &partsStatus, bool log = false);
//! \copydoc CInterpolator::addAircraftSituation //! \copydoc CInterpolator::addAircraftSituation
void addAircraftSituation(const BlackMisc::Aviation::CAircraftSituation &situation); void addAircraftSituation(const Aviation::CAircraftSituation &situation);
//! \copydoc CInterpolator::hasAircraftSituations //! \copydoc CInterpolator::hasAircraftSituations
bool hasAircraftSituations() const; bool hasAircraftSituations() const;
//! \copydoc CInterpolator::addAircraftParts //! \copydoc CInterpolator::addAircraftParts
void addAircraftParts(const BlackMisc::Aviation::CAircraftParts &parts); void addAircraftParts(const Aviation::CAircraftParts &parts);
//! \copydoc CInterpolator::hasAircraftParts //! \copydoc CInterpolator::hasAircraftParts
bool hasAircraftParts() const; bool hasAircraftParts() const;

View File

@@ -122,7 +122,7 @@ namespace BlackSimPlugin
CCallsign CSimConnectObjects::getCallsignForObjectId(DWORD objectId) const CCallsign CSimConnectObjects::getCallsignForObjectId(DWORD objectId) const
{ {
return getSimObjectForObjectId(objectId).getCallsign(); return this->getSimObjectForObjectId(objectId).getCallsign();
} }
CCallsignSet CSimConnectObjects::getAllCallsigns() const CCallsignSet CSimConnectObjects::getAllCallsigns() const

View File

@@ -28,7 +28,7 @@ namespace BlackSimPlugin
//! Constructor //! Constructor
CSimConnectObject(); CSimConnectObject();
//! Constructor, providing initial situation/parts //! Constructor providing initial situation/parts
CSimConnectObject(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, CSimConnectObject(const BlackMisc::Simulation::CSimulatedAircraft &aircraft,
DWORD requestId, DWORD requestId,
BlackMisc::Simulation::CInterpolationLogger *logger); BlackMisc::Simulation::CInterpolationLogger *logger);
@@ -99,7 +99,7 @@ namespace BlackSimPlugin
//! Valid object id? //! Valid object id?
bool hasValidObjectId() const { return m_validObjectId; } bool hasValidObjectId() const { return m_validObjectId; }
//! Object is requested, not yet added //! Object is requested in simulator, not yet confirmed added
bool isPendingAdded() const; bool isPendingAdded() const;
//! Adding is confirmed //! Adding is confirmed
@@ -117,28 +117,30 @@ namespace BlackSimPlugin
//! VTOL? //! VTOL?
bool isVtol() const { return m_aircraft.isVtol(); } bool isVtol() const { return m_aircraft.isVtol(); }
//! Was the object really added to SIM //! Was the object really added to simulator
bool hasValidRequestAndObjectId() const; bool hasValidRequestAndObjectId() const;
//! Toggle interpolator mode //! \copydoc BlackMisc::Simulation::CInterpolatorMulti::toggleMode
void toggleInterpolatorMode(); void toggleInterpolatorMode();
//! Set interpolator mode //! \copydoc BlackMisc::Simulation::CInterpolatorMulti::setMode
bool setInterpolatorMode(BlackMisc::Simulation::CInterpolatorMulti::Mode mode); bool setInterpolatorMode(BlackMisc::Simulation::CInterpolatorMulti::Mode mode);
//! Interpolator info //! \copydoc BlackMisc::Simulation::CInterpolator::getInterpolatorInfo
QString getInterpolatorInfo() const; QString getInterpolatorInfo() const;
//! Interpolator //! \copydoc BlackMisc::Simulation::CInterpolator::attachLogger
BlackMisc::Simulation::CInterpolatorMulti *getInterpolator() const { return m_interpolator.data(); } void attachInterpolatorLogger(BlackMisc::Simulation::CInterpolationLogger *logger);
//! Get interpolated situation //! \copydoc BlackMisc::Simulation::CInterpolator::getInterpolatedSituation
//! \remark return original position if interpolation fails for some reason
BlackMisc::Aviation::CAircraftSituation getInterpolatedSituation( BlackMisc::Aviation::CAircraftSituation getInterpolatedSituation(
qint64 currentTimeSinceEpoc, qint64 currentTimeSinceEpoc,
const BlackMisc::Simulation::CInterpolationAndRenderingSetup &setup, const BlackMisc::Simulation::CInterpolationAndRenderingSetup &setup,
const BlackMisc::Simulation::CInterpolationHints &hints, BlackMisc::Simulation::CInterpolationStatus &status) const; const BlackMisc::Simulation::CInterpolationHints &hints, BlackMisc::Simulation::CInterpolationStatus &status) const;
//! Interpolator
BlackMisc::Simulation::CInterpolatorMulti *getInterpolator() const { return m_interpolator.data(); }
private: private:
BlackMisc::Simulation::CSimulatedAircraft m_aircraft; //!< corresponding aircraft BlackMisc::Simulation::CSimulatedAircraft m_aircraft; //!< corresponding aircraft
DWORD m_requestId = 0; DWORD m_requestId = 0;

View File

@@ -508,7 +508,7 @@ namespace BlackSimPlugin
// we know the object has been created. But it can happen it is directly removed afterwards // we know the object has been created. But it can happen it is directly removed afterwards
QTimer::singleShot(500, this, [ = ] QTimer::singleShot(500, this, [ = ]
{ {
// also triggers new add // also triggers new add if required
this->verifyAddedRemoteAircraft(simObject.getAircraft()); this->verifyAddedRemoteAircraft(simObject.getAircraft());
}); });
return true; return true;
@@ -1059,8 +1059,10 @@ namespace BlackSimPlugin
static_assert(sizeof(DataDefinitionRemoteAircraftPartsWithoutLights) == sizeof(double) * 10, "DataDefinitionRemoteAircraftPartsWithoutLights has an incorrect size."); static_assert(sizeof(DataDefinitionRemoteAircraftPartsWithoutLights) == sizeof(double) * 10, "DataDefinitionRemoteAircraftPartsWithoutLights has an incorrect size.");
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "thread"); Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "thread");
// Freeze interpolation while paused
if (this->isPaused() && m_pausedSimFreezesInterpolation) { return; }
// nothing to do, reset request id and exit // nothing to do, reset request id and exit
if (this->isPaused() && m_pausedSimFreezesInterpolation) { return; } // no interpolation while paused
const int remoteAircraftNo = this->getAircraftInRangeCount(); const int remoteAircraftNo = this->getAircraftInRangeCount();
if (remoteAircraftNo < 1) { m_interpolationRequest = 0; return; } if (remoteAircraftNo < 1) { m_interpolationRequest = 0; return; }
@@ -1071,10 +1073,10 @@ namespace BlackSimPlugin
// values used for position and parts // values used for position and parts
const qint64 currentTimestamp = QDateTime::currentMSecsSinceEpoch(); const qint64 currentTimestamp = QDateTime::currentMSecsSinceEpoch();
const QList<CSimConnectObject> simObjects(m_simConnectObjects.values());
const CCallsignSet callsignsToLog(m_interpolationRenderingSetup.getLogCallsigns()); const CCallsignSet callsignsToLog(m_interpolationRenderingSetup.getLogCallsigns());
// interpolation for all remote aircraft // interpolation for all remote aircraft
const QList<CSimConnectObject> simObjects(m_simConnectObjects.values());
for (const CSimConnectObject &simObject : simObjects) for (const CSimConnectObject &simObject : simObjects)
{ {
// happening if aircraft is not yet added to simulator or to be deleted // happening if aircraft is not yet added to simulator or to be deleted
@@ -1089,7 +1091,7 @@ namespace BlackSimPlugin
// fetch parts, as they are needed for ground interpolation // fetch parts, as they are needed for ground interpolation
const bool useAircraftParts = enableAircraftParts && aircraftWithParts.contains(callsign); const bool useAircraftParts = enableAircraftParts && aircraftWithParts.contains(callsign);
const bool logInterpolationAndParts = callsignsToLog.contains(callsign); const bool logInterpolationAndParts = callsignsToLog.contains(callsign);
const CInterpolationAndRenderingSetup setup(getInterpolationAndRenderingSetup()); const CInterpolationAndRenderingSetup setup(this->getInterpolationAndRenderingSetup());
CPartsStatus partsStatus(useAircraftParts); CPartsStatus partsStatus(useAircraftParts);
const CAircraftParts parts = useAircraftParts ? simObject.getInterpolator()->getInterpolatedParts(-1, setup, partsStatus, logInterpolationAndParts) : CAircraftParts(); const CAircraftParts parts = useAircraftParts ? simObject.getInterpolator()->getInterpolatedParts(-1, setup, partsStatus, logInterpolationAndParts) : CAircraftParts();
@@ -1565,7 +1567,7 @@ namespace BlackSimPlugin
if (toBeRemoved.isEmpty()) { return toBeRemoved; } if (toBeRemoved.isEmpty()) { return toBeRemoved; }
for (const CCallsign &callsign : toBeRemoved) for (const CCallsign &callsign : toBeRemoved)
{ {
physicallyRemoveRemoteAircraft(callsign); this->physicallyRemoveRemoteAircraft(callsign);
} }
if (this->showDebugLogMessage()) { this->debugLogMessage(Q_FUNC_INFO, QString("Cs: '%1'").arg(toBeRemoved.toStringList().join(", "))); } if (this->showDebugLogMessage()) { this->debugLogMessage(Q_FUNC_INFO, QString("Cs: '%1'").arg(toBeRemoved.toStringList().join(", "))); }

View File

@@ -299,7 +299,7 @@ namespace BlackSimPlugin
//! Request data for a simObject (aka remote aircraft) //! Request data for a simObject (aka remote aircraft)
bool requestDataForSimObject(const CSimConnectObject &simObject, SIMCONNECT_PERIOD period = SIMCONNECT_PERIOD_SECOND); bool requestDataForSimObject(const CSimConnectObject &simObject, SIMCONNECT_PERIOD period = SIMCONNECT_PERIOD_SECOND);
//! Request lights for a simObject //! Request lights for a CSimConnectObject
bool requestLightsForSimObject(const CSimConnectObject &simObject); bool requestLightsForSimObject(const CSimConnectObject &simObject);
//! FSX position as string //! FSX position as string