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:
Klaus Basan
2019-06-10 19:54:35 +02:00
parent c89aa553d8
commit 86431a46c7
14 changed files with 196 additions and 64 deletions

View File

@@ -649,11 +649,11 @@ namespace BlackCore
}
ISimulator::ISimulator(const CSimulatorPluginInfo &pluginInfo,
IOwnAircraftProvider *ownAircraftProvider,
IRemoteAircraftProvider *remoteAircraftProvider,
IWeatherGridProvider *weatherGridProvider,
IClientProvider *clientProvider,
QObject *parent) :
IOwnAircraftProvider *ownAircraftProvider,
IRemoteAircraftProvider *remoteAircraftProvider,
IWeatherGridProvider *weatherGridProvider,
IClientProvider *clientProvider,
QObject *parent) :
QObject(parent),
COwnAircraftAware(ownAircraftProvider),
CRemoteAircraftAware(remoteAircraftProvider),
@@ -688,9 +688,11 @@ namespace BlackCore
connect(sApp->getWebDataServices(), &CWebDataServices::swiftDbAirportsRead, this, &ISimulator::onSwiftDbAirportsRead, Qt::QueuedConnection);
connect(sApp->getWebDataServices(), &CWebDataServices::swiftDbModelMatchingEntitiesRead, this, &ISimulator::onSwiftDbModelMatchingEntitiesRead, Qt::QueuedConnection);
}
connect(sApp, &CApplication::aboutToShutdown, this, &ISimulator::unload, Qt::QueuedConnection);
// provider
this->setNewPluginInfo(pluginInfo, m_multiSettings.getSettings(pluginInfo.getSimulatorInfo()));
// info data
m_simulatorInternals.setSimulatorName(this->getSimulatorName());
m_simulatorInternals.setSwiftPluginName(this->getSimulatorPluginInfo().toQString());
@@ -833,7 +835,7 @@ namespace BlackCore
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 (!elevation.isNull())
@@ -844,7 +846,7 @@ namespace BlackCore
}
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