mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 10:55:32 +08:00
Ref T681, preparations to use CG from DB
* renamed to "getSimulatorCG" ... * pass simulator settings to sim.env.provider to decide what CG to use * store DB CG and init it when aircraft is added * style
This commit is contained in:
@@ -885,12 +885,21 @@ namespace BlackCore
|
|||||||
newAircraft.setRendered(false); // reset rendering
|
newAircraft.setRendered(false); // reset rendering
|
||||||
newAircraft.calculcateAndUpdateRelativeDistanceAndBearing(this->getOwnAircraftPosition()); // distance from myself
|
newAircraft.calculcateAndUpdateRelativeDistanceAndBearing(this->getOwnAircraftPosition()); // distance from myself
|
||||||
|
|
||||||
Q_ASSERT_X(sApp->hasWebDataServices(), Q_FUNC_INFO, "No web services");
|
|
||||||
if (this->getConnectedServer().getEcosystem() == CEcosystem::vatsim())
|
if (this->getConnectedServer().getEcosystem() == CEcosystem::vatsim())
|
||||||
{
|
{
|
||||||
sApp->getWebDataServices()->updateWithVatsimDataFileData(newAircraft);
|
sApp->getWebDataServices()->updateWithVatsimDataFileData(newAircraft);
|
||||||
}
|
}
|
||||||
return CRemoteAircraftProvider::addNewAircraftInRange(newAircraft);
|
const bool added = CRemoteAircraftProvider::addNewAircraftInRange(newAircraft);
|
||||||
|
if (added && aircraft.hasModelString())
|
||||||
|
{
|
||||||
|
// most likely I could take the CG at this time from aircraft
|
||||||
|
// to make sure it is really the DB value i query again
|
||||||
|
const CAircraftModel model = sApp->getWebDataServices()->getModelForModelString(aircraft.getModelString());
|
||||||
|
const CLength cg = model.hasValidDbKey() ? model.getCG() : CLength::null();
|
||||||
|
this->rememberCGFromDB(cg, aircraft.getModelString());
|
||||||
|
this->rememberCGFromDB(cg, aircraft.getCallsign());
|
||||||
|
}
|
||||||
|
return added;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAirspaceMonitor::asyncAddNewAircraftInRange(const CSimulatedAircraftList &aircraft, bool readyForModelMatching)
|
void CAirspaceMonitor::asyncAddNewAircraftInRange(const CSimulatedAircraftList &aircraft, bool readyForModelMatching)
|
||||||
@@ -1184,7 +1193,7 @@ namespace BlackCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CG from provider
|
// CG from provider
|
||||||
const CLength cg = this->getCG(callsign); // always x-check against simulator to override guessed values and reflect changed CGs
|
const CLength cg = this->getSimulatorCG(callsign); // always x-check against simulator to override guessed values and reflect changed CGs
|
||||||
if (!cg.isNull()) { correctedSituation.setCG(cg); }
|
if (!cg.isNull()) { correctedSituation.setCG(cg); }
|
||||||
|
|
||||||
// store corrected situation
|
// store corrected situation
|
||||||
|
|||||||
@@ -970,6 +970,26 @@ namespace BlackCore
|
|||||||
m_airspace->updateMarkAllAsNotRendered();
|
m_airspace->updateMarkAllAsNotRendered();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CLength CContextNetwork::getCGFromDB(const CCallsign &callsign) const
|
||||||
|
{
|
||||||
|
return m_airspace->getCGFromDB(callsign);
|
||||||
|
}
|
||||||
|
|
||||||
|
CLength CContextNetwork::getCGFromDB(const QString &modelString) const
|
||||||
|
{
|
||||||
|
return m_airspace->getCGFromDB(modelString);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CContextNetwork::rememberCGFromDB(const CLength &cgFromDB, const CCallsign &callsign)
|
||||||
|
{
|
||||||
|
m_airspace->rememberCGFromDB(cgFromDB, callsign);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CContextNetwork::rememberCGFromDB(const CLength &cgFromDB, const QString &modelString)
|
||||||
|
{
|
||||||
|
m_airspace->rememberCGFromDB(cgFromDB, modelString);
|
||||||
|
}
|
||||||
|
|
||||||
int CContextNetwork::reInitializeAllAircraft()
|
int CContextNetwork::reInitializeAllAircraft()
|
||||||
{
|
{
|
||||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||||
|
|||||||
@@ -109,6 +109,10 @@ namespace BlackCore
|
|||||||
virtual int updateMultipleAircraftEnabled(const BlackMisc::Aviation::CCallsignSet &callsigns, bool enabled) override;
|
virtual int updateMultipleAircraftEnabled(const BlackMisc::Aviation::CCallsignSet &callsigns, bool enabled) override;
|
||||||
virtual int updateAircraftGroundElevation(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Geo::CElevationPlane &elevation, BlackMisc::Aviation::CAircraftSituation::GndElevationInfo info) override;
|
virtual int updateAircraftGroundElevation(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Geo::CElevationPlane &elevation, BlackMisc::Aviation::CAircraftSituation::GndElevationInfo info) override;
|
||||||
virtual void updateMarkAllAsNotRendered() override;
|
virtual void updateMarkAllAsNotRendered() override;
|
||||||
|
virtual BlackMisc::PhysicalQuantities::CLength getCGFromDB(const BlackMisc::Aviation::CCallsign &callsign) const override;
|
||||||
|
virtual BlackMisc::PhysicalQuantities::CLength getCGFromDB(const QString &modelString) const override;
|
||||||
|
virtual void rememberCGFromDB(const BlackMisc::PhysicalQuantities::CLength &cgFromDB, const BlackMisc::Aviation::CCallsign &callsign) override;
|
||||||
|
virtual void rememberCGFromDB(const BlackMisc::PhysicalQuantities::CLength &cgFromDB, const QString &modelString) override;
|
||||||
virtual BlackMisc::Simulation::CAirspaceAircraftSnapshot getLatestAirspaceAircraftSnapshot() const override;
|
virtual BlackMisc::Simulation::CAirspaceAircraftSnapshot getLatestAirspaceAircraftSnapshot() const override;
|
||||||
virtual BlackMisc::Geo::CElevationPlane averageElevationOfNonMovingAircraft(const BlackMisc::Aviation::CAircraftSituation &reference, const BlackMisc::PhysicalQuantities::CLength &range, int minValues = 1) const override;
|
virtual BlackMisc::Geo::CElevationPlane averageElevationOfNonMovingAircraft(const BlackMisc::Aviation::CAircraftSituation &reference, const BlackMisc::PhysicalQuantities::CLength &range, int minValues = 1) const override;
|
||||||
virtual QList<QMetaObject::Connection> connectRemoteAircraftProviderSignals(
|
virtual QList<QMetaObject::Connection> connectRemoteAircraftProviderSignals(
|
||||||
|
|||||||
@@ -638,7 +638,7 @@ namespace BlackCore
|
|||||||
CStatusMessageList *pMatchingMessages = m_logMatchingMessages > 0 ? &matchingMessages : nullptr;
|
CStatusMessageList *pMatchingMessages = m_logMatchingMessages > 0 ? &matchingMessages : nullptr;
|
||||||
CAircraftModel aircraftModel = m_aircraftMatcher.getClosestMatch(remoteAircraft, whatToLog, pMatchingMessages, true);
|
CAircraftModel aircraftModel = m_aircraftMatcher.getClosestMatch(remoteAircraft, whatToLog, pMatchingMessages, true);
|
||||||
Q_ASSERT_X(remoteAircraft.getCallsign() == aircraftModel.getCallsign(), Q_FUNC_INFO, "Mismatching callsigns");
|
Q_ASSERT_X(remoteAircraft.getCallsign() == aircraftModel.getCallsign(), Q_FUNC_INFO, "Mismatching callsigns");
|
||||||
const CLength cg = m_simulatorPlugin.second->getCGPerModelString(aircraftModel.getModelString());
|
const CLength cg = m_simulatorPlugin.second->getSimulatorCGPerModelString(aircraftModel.getModelString());
|
||||||
if (!cg.isNull()) { aircraftModel.setCG(cg); }
|
if (!cg.isNull()) { aircraftModel.setCG(cg); }
|
||||||
this->updateAircraftModel(callsign, aircraftModel, this->identifier());
|
this->updateAircraftModel(callsign, aircraftModel, this->identifier());
|
||||||
|
|
||||||
|
|||||||
@@ -649,11 +649,11 @@ namespace BlackCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
ISimulator::ISimulator(const CSimulatorPluginInfo &pluginInfo,
|
ISimulator::ISimulator(const CSimulatorPluginInfo &pluginInfo,
|
||||||
IOwnAircraftProvider *ownAircraftProvider,
|
IOwnAircraftProvider *ownAircraftProvider,
|
||||||
IRemoteAircraftProvider *remoteAircraftProvider,
|
IRemoteAircraftProvider *remoteAircraftProvider,
|
||||||
IWeatherGridProvider *weatherGridProvider,
|
IWeatherGridProvider *weatherGridProvider,
|
||||||
IClientProvider *clientProvider,
|
IClientProvider *clientProvider,
|
||||||
QObject *parent) :
|
QObject *parent) :
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
COwnAircraftAware(ownAircraftProvider),
|
COwnAircraftAware(ownAircraftProvider),
|
||||||
CRemoteAircraftAware(remoteAircraftProvider),
|
CRemoteAircraftAware(remoteAircraftProvider),
|
||||||
@@ -688,9 +688,11 @@ namespace BlackCore
|
|||||||
connect(sApp->getWebDataServices(), &CWebDataServices::swiftDbAirportsRead, this, &ISimulator::onSwiftDbAirportsRead, Qt::QueuedConnection);
|
connect(sApp->getWebDataServices(), &CWebDataServices::swiftDbAirportsRead, this, &ISimulator::onSwiftDbAirportsRead, Qt::QueuedConnection);
|
||||||
connect(sApp->getWebDataServices(), &CWebDataServices::swiftDbModelMatchingEntitiesRead, this, &ISimulator::onSwiftDbModelMatchingEntitiesRead, Qt::QueuedConnection);
|
connect(sApp->getWebDataServices(), &CWebDataServices::swiftDbModelMatchingEntitiesRead, this, &ISimulator::onSwiftDbModelMatchingEntitiesRead, Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(sApp, &CApplication::aboutToShutdown, this, &ISimulator::unload, Qt::QueuedConnection);
|
connect(sApp, &CApplication::aboutToShutdown, this, &ISimulator::unload, Qt::QueuedConnection);
|
||||||
|
|
||||||
|
// provider
|
||||||
|
this->setNewPluginInfo(pluginInfo, m_multiSettings.getSettings(pluginInfo.getSimulatorInfo()));
|
||||||
|
|
||||||
// info data
|
// info data
|
||||||
m_simulatorInternals.setSimulatorName(this->getSimulatorName());
|
m_simulatorInternals.setSimulatorName(this->getSimulatorName());
|
||||||
m_simulatorInternals.setSwiftPluginName(this->getSimulatorPluginInfo().toQString());
|
m_simulatorInternals.setSwiftPluginName(this->getSimulatorPluginInfo().toQString());
|
||||||
@@ -833,7 +835,7 @@ namespace BlackCore
|
|||||||
m_simulatorInternals.setSimulatorInstallationDirectory(s.getSimulatorDirectoryOrDefault());
|
m_simulatorInternals.setSimulatorInstallationDirectory(s.getSimulatorDirectoryOrDefault());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ISimulator::rememberElevationAndCG(const CCallsign &callsign, const QString &modelString, const Geo::CElevationPlane &elevation, const CLength &cg)
|
void ISimulator::rememberElevationAndCG(const CCallsign &callsign, const QString &modelString, const CElevationPlane &elevation, const CLength &cg)
|
||||||
{
|
{
|
||||||
if (callsign.isEmpty()) { return; }
|
if (callsign.isEmpty()) { return; }
|
||||||
if (!elevation.isNull())
|
if (!elevation.isNull())
|
||||||
@@ -844,7 +846,7 @@ namespace BlackCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
const CLength cgO = this->overriddenCGorDefault(cg, modelString);
|
const CLength cgO = this->overriddenCGorDefault(cg, modelString);
|
||||||
if (!cgO.isNull() && !this->hasSameCG(cgO, callsign))
|
if (!cgO.isNull() && !this->hasSameSimulatorCG(cgO, callsign))
|
||||||
{
|
{
|
||||||
this->insertCG(cgO, modelString, callsign); // per model string and CG
|
this->insertCG(cgO, modelString, callsign); // per model string and CG
|
||||||
|
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ namespace BlackCore
|
|||||||
void reloadWeatherSettings();
|
void reloadWeatherSettings();
|
||||||
|
|
||||||
//! Settings for current simulator
|
//! Settings for current simulator
|
||||||
BlackMisc::Simulation::Settings::CSpecializedSimulatorSettings getSimulatorSettings() const { return m_settings.getSpecializedSettings(this->getSimulatorInfo()); }
|
BlackMisc::Simulation::Settings::CSpecializedSimulatorSettings getSimulatorSettings() const { return m_multiSettings.getSpecializedSettings(this->getSimulatorInfo()); }
|
||||||
|
|
||||||
//! Driver will be unloaded
|
//! Driver will be unloaded
|
||||||
virtual void unload();
|
virtual void unload();
|
||||||
@@ -574,7 +574,7 @@ namespace BlackCore
|
|||||||
bool m_limitUpdateAircraft = false; //!< limit the update frequency by using BlackMisc::CTokenBucket
|
bool m_limitUpdateAircraft = false; //!< limit the update frequency by using BlackMisc::CTokenBucket
|
||||||
|
|
||||||
// general settings
|
// general settings
|
||||||
BlackMisc::Simulation::Settings::CMultiSimulatorSettings m_settings { this }; //!< simulator settings for all simulators
|
BlackMisc::Simulation::Settings::CMultiSimulatorSettings m_multiSettings { this }; //!< simulator settings for all simulators
|
||||||
|
|
||||||
// weather
|
// weather
|
||||||
bool m_isWeatherActivated = false; //!< Is simulator weather activated?
|
bool m_isWeatherActivated = false; //!< Is simulator weather activated?
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
else if (ui->tw_LogTabs->currentWidget() == ui->tb_DataFlow)
|
else if (ui->tw_LogTabs->currentWidget() == ui->tb_DataFlow)
|
||||||
{
|
{
|
||||||
ui->le_CG->setText(m_airspaceMonitor->getCG(m_callsign).valueRoundedWithUnit(CLengthUnit::ft(), 1));
|
ui->le_CG->setText(m_airspaceMonitor->getSimulatorCG(m_callsign).valueRoundedWithUnit(CLengthUnit::ft(), 1));
|
||||||
ui->le_CG->home(false);
|
ui->le_CG->home(false);
|
||||||
ui->le_Parts->setText(boolToYesNo(m_airspaceMonitor->isRemoteAircraftSupportingParts(m_callsign)));
|
ui->le_Parts->setText(boolToYesNo(m_airspaceMonitor->isRemoteAircraftSupportingParts(m_callsign)));
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ namespace BlackMisc
|
|||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
CLength CInterpolator<Derived>::getAndFetchModelCG()
|
CLength CInterpolator<Derived>::getAndFetchModelCG()
|
||||||
{
|
{
|
||||||
const CLength cg = this->getCG(m_callsign);
|
const CLength cg = this->getSimulatorCG(m_callsign); // simulation environment
|
||||||
m_model.setCG(cg);
|
m_model.setCG(cg);
|
||||||
m_model.setCallsign(m_callsign);
|
m_model.setCallsign(m_callsign);
|
||||||
return cg;
|
return cg;
|
||||||
|
|||||||
@@ -192,7 +192,11 @@ namespace BlackMisc
|
|||||||
|
|
||||||
{ QWriteLocker l(&m_lockPartsHistory); m_aircraftPartsMessages.clear(); }
|
{ QWriteLocker l(&m_lockPartsHistory); m_aircraftPartsMessages.clear(); }
|
||||||
{ QWriteLocker l(&m_lockMessages); m_reverseLookupMessages.clear(); }
|
{ QWriteLocker l(&m_lockMessages); m_reverseLookupMessages.clear(); }
|
||||||
{ QWriteLocker l(&m_lockAircraft); m_aircraftInRange.clear(); }
|
{
|
||||||
|
QWriteLocker l(&m_lockAircraft);
|
||||||
|
m_aircraftInRange.clear();
|
||||||
|
m_dbCGPerCallsign.clear();
|
||||||
|
}
|
||||||
|
|
||||||
for (const CCallsign &cs : callsigns)
|
for (const CCallsign &cs : callsigns)
|
||||||
{
|
{
|
||||||
@@ -603,6 +607,30 @@ namespace BlackMisc
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CLength CRemoteAircraftProvider::getCGFromDB(const CCallsign &callsign) const
|
||||||
|
{
|
||||||
|
QReadLocker l(&m_lockAircraft);
|
||||||
|
return m_dbCGPerCallsign.contains(callsign) ? m_dbCGPerCallsign[callsign] : CLength::null();
|
||||||
|
}
|
||||||
|
|
||||||
|
CLength CRemoteAircraftProvider::getCGFromDB(const QString &modelString) const
|
||||||
|
{
|
||||||
|
QReadLocker l(&m_lockAircraft);
|
||||||
|
return m_dbCGPerCallsign.contains(modelString) ? m_dbCGPerCallsign[modelString] : CLength::null();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRemoteAircraftProvider::rememberCGFromDB(const CLength &cgFromDB, const CCallsign &callsign)
|
||||||
|
{
|
||||||
|
QWriteLocker l(&m_lockAircraft);
|
||||||
|
m_dbCGPerCallsign[callsign] = cgFromDB;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRemoteAircraftProvider::rememberCGFromDB(const CLength &cgFromDB, const QString &modelString)
|
||||||
|
{
|
||||||
|
QWriteLocker l(&m_lockAircraft);
|
||||||
|
m_dbCGPerModelString[modelString] = cgFromDB;
|
||||||
|
}
|
||||||
|
|
||||||
void CRemoteAircraftProvider::updateMarkAllAsNotRendered()
|
void CRemoteAircraftProvider::updateMarkAllAsNotRendered()
|
||||||
{
|
{
|
||||||
const CCallsignSet callsigns = this->getAircraftInRangeCallsigns();
|
const CCallsignSet callsigns = this->getAircraftInRangeCallsigns();
|
||||||
@@ -816,6 +844,7 @@ namespace BlackMisc
|
|||||||
bool removedCallsign = false;
|
bool removedCallsign = false;
|
||||||
{
|
{
|
||||||
QWriteLocker l(&m_lockAircraft);
|
QWriteLocker l(&m_lockAircraft);
|
||||||
|
m_dbCGPerCallsign.remove(callsign);
|
||||||
const int c = m_aircraftInRange.remove(callsign);
|
const int c = m_aircraftInRange.remove(callsign);
|
||||||
removedCallsign = c > 0;
|
removedCallsign = c > 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace BlackMisc
|
|||||||
static constexpr int MaxPartsAgePerCallsignSecs = 60; //!< How many seconds to keep parts for interpolation
|
static constexpr int MaxPartsAgePerCallsignSecs = 60; //!< How many seconds to keep parts for interpolation
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~IRemoteAircraftProvider();
|
virtual ~IRemoteAircraftProvider() override;
|
||||||
|
|
||||||
//! Copy constructor
|
//! Copy constructor
|
||||||
IRemoteAircraftProvider(const IRemoteAircraftProvider &) = delete;
|
IRemoteAircraftProvider(const IRemoteAircraftProvider &) = delete;
|
||||||
@@ -200,6 +200,14 @@ namespace BlackMisc
|
|||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
virtual bool updateCGAndModelString(const Aviation::CCallsign &callsign, const PhysicalQuantities::CLength &cg, const QString &modelString) = 0;
|
virtual bool updateCGAndModelString(const Aviation::CCallsign &callsign, const PhysicalQuantities::CLength &cg, const QString &modelString) = 0;
|
||||||
|
|
||||||
|
//! CG values from DB @{
|
||||||
|
//! \threadsafe
|
||||||
|
virtual PhysicalQuantities::CLength getCGFromDB(const Aviation::CCallsign &callsign) const = 0;
|
||||||
|
virtual PhysicalQuantities::CLength getCGFromDB(const QString &modelString) const = 0;
|
||||||
|
virtual void rememberCGFromDB(const PhysicalQuantities::CLength &cgFromDB, const Aviation::CCallsign &callsign) = 0;
|
||||||
|
virtual void rememberCGFromDB(const PhysicalQuantities::CLength &cgFromDB, const QString &modelString) = 0;
|
||||||
|
//! @}
|
||||||
|
|
||||||
//! Get reverse lookup meesages
|
//! Get reverse lookup meesages
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
virtual CStatusMessageList getReverseLookupMessages(const Aviation::CCallsign &callsign) const = 0;
|
virtual CStatusMessageList getReverseLookupMessages(const Aviation::CCallsign &callsign) const = 0;
|
||||||
@@ -323,6 +331,10 @@ namespace BlackMisc
|
|||||||
virtual int updateAircraftGroundElevation(const Aviation::CCallsign &callsign, const Geo::CElevationPlane &elevation, Aviation::CAircraftSituation::GndElevationInfo info) override;
|
virtual int updateAircraftGroundElevation(const Aviation::CCallsign &callsign, const Geo::CElevationPlane &elevation, Aviation::CAircraftSituation::GndElevationInfo info) override;
|
||||||
virtual bool updateCG(const Aviation::CCallsign &callsign, const PhysicalQuantities::CLength &cg) override;
|
virtual bool updateCG(const Aviation::CCallsign &callsign, const PhysicalQuantities::CLength &cg) override;
|
||||||
virtual bool updateCGAndModelString(const Aviation::CCallsign &callsign, const PhysicalQuantities::CLength &cg, const QString &modelString) override;
|
virtual bool updateCGAndModelString(const Aviation::CCallsign &callsign, const PhysicalQuantities::CLength &cg, const QString &modelString) override;
|
||||||
|
virtual PhysicalQuantities::CLength getCGFromDB(const Aviation::CCallsign &callsign) const override;
|
||||||
|
virtual PhysicalQuantities::CLength getCGFromDB(const QString &modelString) const override;
|
||||||
|
virtual void rememberCGFromDB(const PhysicalQuantities::CLength &cgFromDB, const Aviation::CCallsign &callsign) override;
|
||||||
|
virtual void rememberCGFromDB(const PhysicalQuantities::CLength &cgFromDB, const QString &modelString) override;
|
||||||
virtual void updateMarkAllAsNotRendered() override;
|
virtual void updateMarkAllAsNotRendered() override;
|
||||||
virtual CStatusMessageList getAircraftPartsHistory(const Aviation::CCallsign &callsign) const override;
|
virtual CStatusMessageList getAircraftPartsHistory(const Aviation::CCallsign &callsign) const override;
|
||||||
virtual bool isAircraftPartsHistoryEnabled() const override;
|
virtual bool isAircraftPartsHistoryEnabled() const override;
|
||||||
@@ -467,15 +479,17 @@ namespace BlackMisc
|
|||||||
Aviation::CAircraftSituationChangeListPerCallsign m_changesByCallsign; //!< changes, for performance reasons per callsign, thread safe access required (same timestamps as corresponding situations)
|
Aviation::CAircraftSituationChangeListPerCallsign m_changesByCallsign; //!< changes, for performance reasons per callsign, thread safe access required (same timestamps as corresponding situations)
|
||||||
Aviation::CCallsignSet m_aircraftWithParts; //!< aircraft supporting parts, thread safe access required
|
Aviation::CCallsignSet m_aircraftWithParts; //!< aircraft supporting parts, thread safe access required
|
||||||
int m_situationsAdded = 0; //!< total number of situations added, thread safe access required
|
int m_situationsAdded = 0; //!< total number of situations added, thread safe access required
|
||||||
int m_partsAdded = 0; //!< total number of parts added, thread safe access required
|
int m_partsAdded = 0; //!< total number of parts added, thread safe access required
|
||||||
|
|
||||||
ReverseLookupLogging m_enableReverseLookupMsgs = RevLogSimplifiedInfo; //!< shall we log. information about the matching process
|
ReverseLookupLogging m_enableReverseLookupMsgs = RevLogSimplifiedInfo; //!< shall we log. information about the matching process
|
||||||
Simulation::CSimulatedAircraftPerCallsign m_aircraftInRange; //!< aircraft, thread safe access required
|
Simulation::CSimulatedAircraftPerCallsign m_aircraftInRange; //!< aircraft, thread safe access required
|
||||||
Aviation::CStatusMessageListPerCallsign m_reverseLookupMessages; //!< reverse lookup messages
|
Aviation::CStatusMessageListPerCallsign m_reverseLookupMessages; //!< reverse lookup messages
|
||||||
Aviation::CStatusMessageListPerCallsign m_aircraftPartsMessages; //!< status messages for parts history
|
Aviation::CStatusMessageListPerCallsign m_aircraftPartsMessages; //!< status messages for parts history
|
||||||
Aviation::CTimestampPerCallsign m_situationsLastModified; //!< when situations last modified
|
Aviation::CTimestampPerCallsign m_situationsLastModified; //!< when situations last modified
|
||||||
Aviation::CTimestampPerCallsign m_partsLastModified; //!< when parts last modified
|
Aviation::CTimestampPerCallsign m_partsLastModified; //!< when parts last modified
|
||||||
Aviation::CLengthPerCallsign m_testOffset; //!< offsets
|
Aviation::CLengthPerCallsign m_testOffset; //!< offsets
|
||||||
|
Aviation::CLengthPerCallsign m_dbCGPerCallsign; //!< DB CG per callsign
|
||||||
|
QHash<QString, PhysicalQuantities::CLength> m_dbCGPerModelString; //!< DB CG per model string
|
||||||
|
|
||||||
bool m_enableAircraftPartsHistory = true; //!< shall we keep a history of aircraft parts
|
bool m_enableAircraftPartsHistory = true; //!< shall we keep a history of aircraft parts
|
||||||
|
|
||||||
@@ -483,7 +497,7 @@ namespace BlackMisc
|
|||||||
mutable QReadWriteLock m_lockSituations; //!< lock for situations: m_situationsByCallsign
|
mutable QReadWriteLock m_lockSituations; //!< lock for situations: m_situationsByCallsign
|
||||||
mutable QReadWriteLock m_lockParts; //!< lock for parts: m_partsByCallsign, m_aircraftSupportingParts
|
mutable QReadWriteLock m_lockParts; //!< lock for parts: m_partsByCallsign, m_aircraftSupportingParts
|
||||||
mutable QReadWriteLock m_lockChanges; //!< lock for changes: m_changesByCallsign
|
mutable QReadWriteLock m_lockChanges; //!< lock for changes: m_changesByCallsign
|
||||||
mutable QReadWriteLock m_lockAircraft; //!< lock aircraft: m_aircraftInRange
|
mutable QReadWriteLock m_lockAircraft; //!< lock aircraft: m_aircraftInRange, m_dbCGPerCallsign
|
||||||
mutable QReadWriteLock m_lockMessages; //!< lock for messages
|
mutable QReadWriteLock m_lockMessages; //!< lock for messages
|
||||||
mutable QReadWriteLock m_lockPartsHistory; //!< lock for aircraft parts
|
mutable QReadWriteLock m_lockPartsHistory; //!< lock for aircraft parts
|
||||||
};
|
};
|
||||||
@@ -493,7 +507,7 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~CRemoteAircraftAware();
|
virtual ~CRemoteAircraftAware() override;
|
||||||
|
|
||||||
//! \copydoc IRemoteAircraftProvider::getAircraftInRange
|
//! \copydoc IRemoteAircraftProvider::getAircraftInRange
|
||||||
CSimulatedAircraftList getAircraftInRange() const;
|
CSimulatedAircraftList getAircraftInRange() const;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include "simulationenvironmentprovider.h"
|
#include "simulationenvironmentprovider.h"
|
||||||
#include <QStringBuilder>
|
#include <QStringBuilder>
|
||||||
|
|
||||||
|
using namespace BlackMisc::Simulation::Settings;
|
||||||
using namespace BlackMisc::Aviation;
|
using namespace BlackMisc::Aviation;
|
||||||
using namespace BlackMisc::Geo;
|
using namespace BlackMisc::Geo;
|
||||||
using namespace BlackMisc::PhysicalQuantities;
|
using namespace BlackMisc::PhysicalQuantities;
|
||||||
@@ -116,7 +117,7 @@ namespace BlackMisc
|
|||||||
return m_cgsPerModelOverridden[modelString.toUpper()];
|
return m_cgsPerModelOverridden[modelString.toUpper()];
|
||||||
}
|
}
|
||||||
|
|
||||||
int ISimulationEnvironmentProvider::removeCG(const CCallsign &cs)
|
int ISimulationEnvironmentProvider::removeSimulatorCG(const CCallsign &cs)
|
||||||
{
|
{
|
||||||
QWriteLocker l(&m_lockCG);
|
QWriteLocker l(&m_lockCG);
|
||||||
return m_cgsPerCallsign.remove(cs);
|
return m_cgsPerCallsign.remove(cs);
|
||||||
@@ -124,7 +125,7 @@ namespace BlackMisc
|
|||||||
|
|
||||||
CLength ISimulationEnvironmentProvider::minRange(const CLength &range)
|
CLength ISimulationEnvironmentProvider::minRange(const CLength &range)
|
||||||
{
|
{
|
||||||
return (range < CElevationPlane::singlePointRadius()) ?
|
return (range.isNull() || range < CElevationPlane::singlePointRadius()) ?
|
||||||
CElevationPlane::singlePointRadius() :
|
CElevationPlane::singlePointRadius() :
|
||||||
range;
|
range;
|
||||||
}
|
}
|
||||||
@@ -271,16 +272,25 @@ namespace BlackMisc
|
|||||||
return m_defaultModel;
|
return m_defaultModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
CLength ISimulationEnvironmentProvider::getCG(const Aviation::CCallsign &callsign) const
|
CLength ISimulationEnvironmentProvider::getSimulatorCG(const Aviation::CCallsign &callsign) const
|
||||||
{
|
{
|
||||||
if (callsign.isEmpty()) { return CLength::null(); }
|
if (callsign.isEmpty()) { return CLength::null(); }
|
||||||
|
|
||||||
QReadLocker l(&m_lockCG);
|
QReadLocker l(&m_lockCG);
|
||||||
if (!m_enableCG || !m_cgsPerCallsign.contains(callsign)) { return CLength::null(); }
|
if (!m_enableCG || !m_cgsPerCallsign.contains(callsign)) { return CLength::null(); }
|
||||||
return m_cgsPerCallsign.value(callsign);
|
return m_cgsPerCallsign.value(callsign);
|
||||||
}
|
}
|
||||||
|
|
||||||
CLength ISimulationEnvironmentProvider::getCGPerModelString(const QString &modelString) const
|
CLength ISimulationEnvironmentProvider::getSimulatorOrDbCG(const CCallsign &callsign, const CLength &dbCG) const
|
||||||
|
{
|
||||||
|
if (callsign.isEmpty()) { return CLength::null(); }
|
||||||
|
const CSimulatorSettings::CGSource source = m_settings.getCGSource();
|
||||||
|
if (source == CSimulatorSettings::CGFromDBOnly || (!dbCG.isNull() && source == CSimulatorSettings::CGFromDBFirst)) { return dbCG; }
|
||||||
|
const CLength simCG = this->getSimulatorCG(callsign);
|
||||||
|
if (source == CSimulatorSettings::CGFromSimulatorOnly || (source == CSimulatorSettings::CGFromSimulatorFirst && simCG.isNull())) { return simCG; }
|
||||||
|
return dbCG;
|
||||||
|
}
|
||||||
|
|
||||||
|
CLength ISimulationEnvironmentProvider::getSimulatorCGPerModelString(const QString &modelString) const
|
||||||
{
|
{
|
||||||
if (modelString.isEmpty()) { return CLength::null(); }
|
if (modelString.isEmpty()) { return CLength::null(); }
|
||||||
const QString ms = modelString.toUpper();
|
const QString ms = modelString.toUpper();
|
||||||
@@ -290,14 +300,29 @@ namespace BlackMisc
|
|||||||
return m_cgsPerModel.value(ms);
|
return m_cgsPerModel.value(ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ISimulationEnvironmentProvider::hasCG(const Aviation::CCallsign &callsign) const
|
CLength ISimulationEnvironmentProvider::getSimulatorOrDbCGPerModelString(const QString &modelString, const CLength &dbCG) const
|
||||||
|
{
|
||||||
|
if (modelString.isEmpty()) { return CLength::null(); }
|
||||||
|
const CSimulatorSettings::CGSource source = m_settings.getCGSource();
|
||||||
|
const QString ms = modelString.toUpper();
|
||||||
|
{
|
||||||
|
QReadLocker l(&m_lockCG);
|
||||||
|
if (m_cgsPerModelOverridden.contains(ms)) { return m_cgsPerModelOverridden.value(ms); }
|
||||||
|
}
|
||||||
|
if (source == CSimulatorSettings::CGFromDBOnly || (!dbCG.isNull() && source == CSimulatorSettings::CGFromDBFirst)) { return dbCG; }
|
||||||
|
const CLength simCG = this->getSimulatorCGPerModelString(modelString);
|
||||||
|
if (source == CSimulatorSettings::CGFromSimulatorOnly || (source == CSimulatorSettings::CGFromSimulatorFirst && simCG.isNull())) { return simCG; }
|
||||||
|
return dbCG;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ISimulationEnvironmentProvider::hasSimulatorCG(const Aviation::CCallsign &callsign) const
|
||||||
{
|
{
|
||||||
if (callsign.isEmpty()) { return false; }
|
if (callsign.isEmpty()) { return false; }
|
||||||
QReadLocker l(&m_lockCG);
|
QReadLocker l(&m_lockCG);
|
||||||
return m_enableCG && m_cgsPerCallsign.contains(callsign);
|
return m_enableCG && m_cgsPerCallsign.contains(callsign);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ISimulationEnvironmentProvider::hasSameCG(const CLength &cg, const CCallsign &callsign) const
|
bool ISimulationEnvironmentProvider::hasSameSimulatorCG(const CLength &cg, const CCallsign &callsign) const
|
||||||
{
|
{
|
||||||
if (callsign.isEmpty()) { return false; }
|
if (callsign.isEmpty()) { return false; }
|
||||||
QReadLocker l(&m_lockCG);
|
QReadLocker l(&m_lockCG);
|
||||||
@@ -326,11 +351,12 @@ namespace BlackMisc
|
|||||||
m_elvFound = m_elvMissed = 0;
|
m_elvFound = m_elvMissed = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ISimulationEnvironmentProvider::ISimulationEnvironmentProvider(const CSimulatorPluginInfo &pluginInfo) : m_simulatorPluginInfo(pluginInfo)
|
ISimulationEnvironmentProvider::ISimulationEnvironmentProvider(const CSimulatorPluginInfo &pluginInfo) :
|
||||||
|
m_simulatorPluginInfo(pluginInfo)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
ISimulationEnvironmentProvider::ISimulationEnvironmentProvider(const CSimulatorPluginInfo &pluginInfo, bool supportElevation, bool supportCG) :
|
ISimulationEnvironmentProvider::ISimulationEnvironmentProvider(const CSimulatorPluginInfo &pluginInfo, const CSimulatorSettings &settings, bool supportElevation, bool supportCG) :
|
||||||
m_simulatorPluginInfo(pluginInfo), m_enableElevation(supportElevation), m_enableCG(supportCG)
|
m_simulatorPluginInfo(pluginInfo), m_settings(settings), m_enableElevation(supportElevation), m_enableCG(supportCG)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
bool ISimulationEnvironmentProvider::isCgProviderEnabled() const
|
bool ISimulationEnvironmentProvider::isCgProviderEnabled() const
|
||||||
@@ -363,15 +389,19 @@ namespace BlackMisc
|
|||||||
setCgProviderEnabled(cgEnabled);
|
setCgProviderEnabled(cgEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ISimulationEnvironmentProvider::setNewPluginInfo(const CSimulatorPluginInfo &info, const CAircraftModel &defaultModel)
|
void ISimulationEnvironmentProvider::setNewPluginInfo(const CSimulatorPluginInfo &info, const CSimulatorSettings &settings, const CAircraftModel &defaultModel)
|
||||||
{
|
{
|
||||||
{
|
this->setNewPluginInfo(info, settings);
|
||||||
QWriteLocker l1(&m_lockSimInfo);
|
|
||||||
m_simulatorPluginInfo = info;
|
|
||||||
}
|
|
||||||
this->setDefaultModel(defaultModel);
|
this->setDefaultModel(defaultModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ISimulationEnvironmentProvider::setNewPluginInfo(const CSimulatorPluginInfo &info, const CSimulatorSettings &settings)
|
||||||
|
{
|
||||||
|
QWriteLocker l(&m_lockSimInfo);
|
||||||
|
m_simulatorPluginInfo = info;
|
||||||
|
m_settings = settings;
|
||||||
|
}
|
||||||
|
|
||||||
void ISimulationEnvironmentProvider::setSimulatorDetails(const QString &name, const QString &details, const QString &version)
|
void ISimulationEnvironmentProvider::setSimulatorDetails(const QString &name, const QString &details, const QString &version)
|
||||||
{
|
{
|
||||||
QWriteLocker l(&m_lockSimInfo);
|
QWriteLocker l(&m_lockSimInfo);
|
||||||
@@ -416,7 +446,7 @@ namespace BlackMisc
|
|||||||
m_elvCoordinates.clear();
|
m_elvCoordinates.clear();
|
||||||
m_pendingElevationRequests.clear();
|
m_pendingElevationRequests.clear();
|
||||||
m_statsCurrentElevRequestTimeMs = -1;
|
m_statsCurrentElevRequestTimeMs = -1;
|
||||||
m_statsMaxElevRequestTimeMs = -1;
|
m_statsMaxElevRequestTimeMs = -1;
|
||||||
m_elvFound = m_elvMissed = 0;
|
m_elvFound = m_elvMissed = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -510,16 +540,22 @@ namespace BlackMisc
|
|||||||
return this->provider()->getDefaultModel();
|
return this->provider()->getDefaultModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
CLength CSimulationEnvironmentAware::getCG(const CCallsign &callsign) const
|
CLength CSimulationEnvironmentAware::getSimulatorCG(const CCallsign &callsign) const
|
||||||
{
|
{
|
||||||
if (!this->hasProvider()) { return CLength::null(); }
|
if (!this->hasProvider()) { return CLength::null(); }
|
||||||
return this->provider()->getCG(callsign);
|
return this->provider()->getSimulatorCG(callsign);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSimulationEnvironmentAware::hasCG(const CCallsign &callsign) const
|
CLength CSimulationEnvironmentAware::getSimulatorOrDbCG(const CCallsign &callsign, const CLength &dbCG) const
|
||||||
|
{
|
||||||
|
if (!this->hasProvider()) { return CLength::null(); }
|
||||||
|
return this->provider()->getSimulatorOrDbCG(callsign, dbCG);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CSimulationEnvironmentAware::hasSimulatorCG(const CCallsign &callsign) const
|
||||||
{
|
{
|
||||||
if (!this->hasProvider()) { return false; }
|
if (!this->hasProvider()) { return false; }
|
||||||
return this->provider()->hasCG(callsign);
|
return this->provider()->hasSimulatorCG(callsign);
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include "simulatorplugininfo.h"
|
#include "simulatorplugininfo.h"
|
||||||
#include "aircraftmodel.h"
|
#include "aircraftmodel.h"
|
||||||
|
#include "blackmisc/simulation/settings/simulatorsettings.h"
|
||||||
#include "blackmisc/aviation/aircraftsituation.h"
|
#include "blackmisc/aviation/aircraftsituation.h"
|
||||||
#include "blackmisc/aviation/percallsign.h"
|
#include "blackmisc/aviation/percallsign.h"
|
||||||
#include "blackmisc/geo/coordinategeodeticlist.h"
|
#include "blackmisc/geo/coordinategeodeticlist.h"
|
||||||
@@ -37,11 +38,11 @@ namespace BlackMisc
|
|||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
Geo::CCoordinateGeodeticList getElevationCoordinates() const;
|
Geo::CCoordinateGeodeticList getElevationCoordinates() const;
|
||||||
|
|
||||||
//! Find closest elevation
|
//! Find closest elevation (or return NULL)
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
Geo::CElevationPlane findClosestElevationWithinRange(const Geo::ICoordinateGeodetic &reference, const PhysicalQuantities::CLength &range) const;
|
Geo::CElevationPlane findClosestElevationWithinRange(const Geo::ICoordinateGeodetic &reference, const PhysicalQuantities::CLength &range) const;
|
||||||
|
|
||||||
//! Find closest elevation
|
//! Find closest elevation or request elevation
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
Geo::CElevationPlane findClosestElevationWithinRangeOrRequest(const Geo::ICoordinateGeodetic &reference, const PhysicalQuantities::CLength &range, const Aviation::CCallsign &callsign);
|
Geo::CElevationPlane findClosestElevationWithinRangeOrRequest(const Geo::ICoordinateGeodetic &reference, const PhysicalQuantities::CLength &range, const Aviation::CCallsign &callsign);
|
||||||
|
|
||||||
@@ -87,19 +88,27 @@ namespace BlackMisc
|
|||||||
|
|
||||||
//! Get CG per callsign, NULL if not found
|
//! Get CG per callsign, NULL if not found
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
PhysicalQuantities::CLength getCG(const Aviation::CCallsign &callsign) const;
|
PhysicalQuantities::CLength getSimulatorCG(const Aviation::CCallsign &callsign) const;
|
||||||
|
|
||||||
|
//! Get CG per callsign, NULL if not found
|
||||||
|
//! \threadsafe
|
||||||
|
PhysicalQuantities::CLength getSimulatorOrDbCG(const Aviation::CCallsign &callsign, const PhysicalQuantities::CLength &dbCG) const;
|
||||||
|
|
||||||
//! Get CG per model string, NULL if not found
|
//! Get CG per model string, NULL if not found
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
PhysicalQuantities::CLength getCGPerModelString(const QString &modelString) const;
|
PhysicalQuantities::CLength getSimulatorCGPerModelString(const QString &modelString) const;
|
||||||
|
|
||||||
|
//! Get CG per model string, NULL if not found
|
||||||
|
//! \threadsafe
|
||||||
|
PhysicalQuantities::CLength getSimulatorOrDbCGPerModelString(const QString &modelString, const PhysicalQuantities::CLength &dbCG) const;
|
||||||
|
|
||||||
//! Has a CG?
|
//! Has a CG?
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
bool hasCG(const Aviation::CCallsign &callsign) const;
|
bool hasSimulatorCG(const Aviation::CCallsign &callsign) const;
|
||||||
|
|
||||||
//! Has the same CG?
|
//! Has the same CG?
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
bool hasSameCG(const PhysicalQuantities::CLength &cg, const Aviation::CCallsign &callsign) const;
|
bool hasSameSimulatorCG(const PhysicalQuantities::CLength &cg, const Aviation::CCallsign &callsign) const;
|
||||||
|
|
||||||
//! Set number of elevations kept
|
//! Set number of elevations kept
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
@@ -118,7 +127,7 @@ namespace BlackMisc
|
|||||||
ISimulationEnvironmentProvider(const CSimulatorPluginInfo &pluginInfo);
|
ISimulationEnvironmentProvider(const CSimulatorPluginInfo &pluginInfo);
|
||||||
|
|
||||||
//! Ctor
|
//! Ctor
|
||||||
ISimulationEnvironmentProvider(const CSimulatorPluginInfo &pluginInfo, bool supportElevation, bool supportCG);
|
ISimulationEnvironmentProvider(const CSimulatorPluginInfo &pluginInfo, const Settings::CSimulatorSettings &settings, bool supportElevation, bool supportCG);
|
||||||
|
|
||||||
//! Provider enabled
|
//! Provider enabled
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
@@ -137,7 +146,11 @@ namespace BlackMisc
|
|||||||
//! New plugin info and default model
|
//! New plugin info and default model
|
||||||
//! \remark normally only used by emulated driver
|
//! \remark normally only used by emulated driver
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
void setNewPluginInfo(const CSimulatorPluginInfo &info, const CAircraftModel &defaultModel);
|
void setNewPluginInfo(const CSimulatorPluginInfo &info, const Settings::CSimulatorSettings &settings, const CAircraftModel &defaultModel);
|
||||||
|
|
||||||
|
//! New plugin info and default model
|
||||||
|
//! \threadsafe
|
||||||
|
void setNewPluginInfo(const CSimulatorPluginInfo &info, const Settings::CSimulatorSettings &settings);
|
||||||
|
|
||||||
//! Set version and simulator details from running simulator
|
//! Set version and simulator details from running simulator
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
@@ -215,16 +228,17 @@ namespace BlackMisc
|
|||||||
|
|
||||||
//! Remove a CG
|
//! Remove a CG
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
int removeCG(const Aviation::CCallsign &cs);
|
int removeSimulatorCG(const Aviation::CCallsign &cs);
|
||||||
|
|
||||||
//! Min.range considered as single point
|
//! Min.range considered as single point
|
||||||
static PhysicalQuantities::CLength minRange(const PhysicalQuantities::CLength &range);
|
static PhysicalQuantities::CLength minRange(const PhysicalQuantities::CLength &range);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CSimulatorPluginInfo m_simulatorPluginInfo; //!< info object
|
CSimulatorPluginInfo m_simulatorPluginInfo; //!< info object
|
||||||
|
Settings::CSimulatorSettings m_settings; //!< simulator settings
|
||||||
QString m_simulatorName; //!< name of simulator
|
QString m_simulatorName; //!< name of simulator
|
||||||
QString m_simulatorDetails; //!< describes version etc.
|
QString m_simulatorDetails; //!< describes version etc.
|
||||||
QString m_simulatorVersion; //!< Simulator version
|
QString m_simulatorVersion; //!< simulator version
|
||||||
CAircraftModel m_defaultModel; //!< default model
|
CAircraftModel m_defaultModel; //!< default model
|
||||||
int m_maxElevations = 100; //!< How many elevations we keep
|
int m_maxElevations = 100; //!< How many elevations we keep
|
||||||
Geo::CCoordinateGeodeticList m_elvCoordinates; //!< elevation cache
|
Geo::CCoordinateGeodeticList m_elvCoordinates; //!< elevation cache
|
||||||
@@ -292,11 +306,14 @@ namespace BlackMisc
|
|||||||
//! \copydoc ISimulationEnvironmentProvider::getDefaultModel
|
//! \copydoc ISimulationEnvironmentProvider::getDefaultModel
|
||||||
CAircraftModel getDefaultModel() const;
|
CAircraftModel getDefaultModel() const;
|
||||||
|
|
||||||
//! \copydoc ISimulationEnvironmentProvider::getCG
|
//! \copydoc ISimulationEnvironmentProvider::getSimulatorCG
|
||||||
PhysicalQuantities::CLength getCG(const Aviation::CCallsign &callsign) const;
|
PhysicalQuantities::CLength getSimulatorCG(const Aviation::CCallsign &callsign) const;
|
||||||
|
|
||||||
//! \copydoc ISimulationEnvironmentProvider::hasCG
|
//! \copydoc ISimulationEnvironmentProvider::getSimulatorOrDbCG
|
||||||
bool hasCG(const Aviation::CCallsign &callsign) const;
|
PhysicalQuantities::CLength getSimulatorOrDbCG(const Aviation::CCallsign &callsign, const PhysicalQuantities::CLength &dbCG) const;
|
||||||
|
|
||||||
|
//! \copydoc ISimulationEnvironmentProvider::hasSimulatorCG
|
||||||
|
bool hasSimulatorCG(const Aviation::CCallsign &callsign) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! Default constructor
|
//! Default constructor
|
||||||
|
|||||||
@@ -380,15 +380,15 @@ namespace BlackSimPlugin
|
|||||||
if (plugin.isValid())
|
if (plugin.isValid())
|
||||||
{
|
{
|
||||||
// ? restart driver, disconnect/reconnect
|
// ? restart driver, disconnect/reconnect
|
||||||
this->setNewPluginInfo(plugin, settings.getDefaultModel());
|
this->setNewPluginInfo(plugin, m_multiSettings.getSettings(simulator), settings.getDefaultModel());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// not all drivers are installed
|
// not all drivers are installed, like FS9/FSX on x64
|
||||||
CLogMessage(this).validationError(u"No valid plugin in emulated driver for '%1'") << simulator.toQString();
|
CLogMessage(this).validationError(u"No valid plugin in emulated driver for '%1'") << simulator.toQString();
|
||||||
const QString sn = simulator.toQString(true);
|
const QString sn = simulator.toQString(true);
|
||||||
const CSimulatorPluginInfo fakedPlugin = CSimulatorPluginInfo(simulator.toPluginIdentifier(), sn, sn, QStringLiteral("Emulated, but uninstalled '%1'").arg(sn), false);
|
const CSimulatorPluginInfo fakedPlugin = CSimulatorPluginInfo(simulator.toPluginIdentifier(), sn, sn, QStringLiteral("Emulated, but uninstalled '%1'").arg(sn), false);
|
||||||
this->setNewPluginInfo(fakedPlugin, settings.getDefaultModel());
|
this->setNewPluginInfo(fakedPlugin, m_multiSettings.getSettings(simulator), settings.getDefaultModel());
|
||||||
}
|
}
|
||||||
|
|
||||||
// update provider, own name, title
|
// update provider, own name, title
|
||||||
|
|||||||
@@ -170,6 +170,7 @@ namespace BlackSimPlugin
|
|||||||
QScopedPointer<CSimulatorEmulatedMonitorDialog> m_monitorWidget; //!< parent will be main window, so we need to destroy widget when destroyed
|
QScopedPointer<CSimulatorEmulatedMonitorDialog> m_monitorWidget; //!< parent will be main window, so we need to destroy widget when destroyed
|
||||||
BlackMisc::CConnectionGuard m_connectionGuard; //!< connected with provider
|
BlackMisc::CConnectionGuard m_connectionGuard; //!< connected with provider
|
||||||
BlackMisc::CSettingReadOnly<BlackMisc::Simulation::Settings::TSwiftPlugin> m_pluginSettings { this, &CSimulatorEmulated::onSettingsChanged };
|
BlackMisc::CSettingReadOnly<BlackMisc::Simulation::Settings::TSwiftPlugin> m_pluginSettings { this, &CSimulatorEmulated::onSettingsChanged };
|
||||||
|
BlackMisc::Simulation::Settings::CMultiSimulatorSettings m_multiSettings { this };
|
||||||
QMap<BlackMisc::Aviation::CCallsign, BlackMisc::Simulation::CInterpolatorMultiWrapper> m_interpolators; //!< interpolators per callsign
|
QMap<BlackMisc::Aviation::CCallsign, BlackMisc::Simulation::CInterpolatorMultiWrapper> m_interpolators; //!< interpolators per callsign
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user