mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 11:55:35 +08:00
Use models from centralized model cache
* no copy needed * cache is synchronized when loading models
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "blackcore/simulator.h"
|
||||
#include "blackcore/webdataservices.h"
|
||||
#include "blackcore/application.h"
|
||||
#include "blackmisc/simulation/data/modelcaches.h"
|
||||
#include "blackmisc/directoryutils.h"
|
||||
#include "blackmisc/threadutils.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
@@ -34,6 +35,7 @@ using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::Geo;
|
||||
using namespace BlackMisc::Math;
|
||||
using namespace BlackMisc::Simulation;
|
||||
using namespace BlackMisc::Simulation::Data;
|
||||
using namespace BlackMisc::Simulation::Settings;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
using namespace BlackMisc::Network;
|
||||
@@ -1052,6 +1054,15 @@ namespace BlackCore
|
||||
// can be overridden
|
||||
}
|
||||
|
||||
CAircraftModelList ISimulator::getModelSet() const
|
||||
{
|
||||
const CSimulatorInfo simulator = this->getSimulatorInfo();
|
||||
if (!simulator.isSingleSimulator()) { return CAircraftModelList(); }
|
||||
|
||||
CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance().synchronizeCache(simulator);
|
||||
return CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance().getCachedModels(simulator);
|
||||
}
|
||||
|
||||
QString ISimulator::latestLoggedDataFormatted(const CCallsign &cs) const
|
||||
{
|
||||
const SituationLog s = m_interpolationLogger.getLastSituationLog(cs);
|
||||
|
||||
@@ -535,6 +535,9 @@ namespace BlackCore
|
||||
//! Own model has been changed
|
||||
virtual void onOwnModelChanged(const BlackMisc::Simulation::CAircraftModel &newModel);
|
||||
|
||||
//! Get the model set
|
||||
BlackMisc::Simulation::CAircraftModelList getModelSet() const;
|
||||
|
||||
//! Lookup against DB data
|
||||
static BlackMisc::Simulation::CAircraftModel reverseLookupModel(const BlackMisc::Simulation::CAircraftModel &model);
|
||||
|
||||
|
||||
@@ -540,7 +540,7 @@ namespace BlackSimPlugin
|
||||
QList<Prefix> packages;
|
||||
|
||||
Q_ASSERT(isConnected());
|
||||
const CAircraftModelList models = m_modelSet.getThreadLocal();
|
||||
const CAircraftModelList models = this->getModelSet();
|
||||
for (const auto &model : models)
|
||||
{
|
||||
const QString &modelFile = model.getFileName();
|
||||
|
||||
@@ -235,7 +235,6 @@ namespace BlackSimPlugin
|
||||
QTimer m_airportUpdater;
|
||||
QTimer m_pendingAddedTimer;
|
||||
BlackMisc::Aviation::CAirportList m_airportsInRange; //!< aiports in range of own aircraft
|
||||
BlackMisc::CData<BlackMisc::Simulation::Data::TModelSetCacheXP> m_modelSet { this }; //!< XPlane model set
|
||||
BlackMisc::Simulation::CSimulatedAircraftList m_pendingToBeAddedAircraft; //!< aircraft to be added
|
||||
QHash<BlackMisc::Aviation::CCallsign, qint64> m_addingInProgressAircraft; //!< aircraft just adding
|
||||
BlackMisc::Simulation::CSimulatedAircraftList m_aircraftAddedFailed; //! aircraft for which adding failed
|
||||
|
||||
Reference in New Issue
Block a user