Use CWeatherManager as weathergrid provider in simulator plugins

refs #612
This commit is contained in:
Roland Winklmeier
2016-03-26 21:14:10 +01:00
parent f6a52874e3
commit dae31a1986
15 changed files with 42 additions and 17 deletions

View File

@@ -332,7 +332,7 @@ namespace BlackCore
Q_ASSERT(this->getIContextNetwork()->isUsingImplementingObject());
IOwnAircraftProvider *ownAircraftProvider = this->getRuntime()->getCContextOwnAircraft();
IRemoteAircraftProvider *renderedAircraftProvider = this->getRuntime()->getCContextNetwork();
ISimulator *simulator = factory->create(simulatorInfo, ownAircraftProvider, renderedAircraftProvider, m_plugins);
ISimulator *simulator = factory->create(simulatorInfo, ownAircraftProvider, renderedAircraftProvider, m_plugins, &m_weatherManager);
Q_ASSERT_X(simulator, Q_FUNC_INFO, "no simulator driver can be created");
bool c = connect(simulator, &ISimulator::simulatorStatusChanged, this, &CContextSimulator::ps_onSimulatorStatusChanged);

View File

@@ -15,6 +15,7 @@
#include "blackcoreexport.h"
#include "blackcore/contextsimulator.h"
#include "blackcore/simulator.h"
#include "blackcore/weathermanager.h"
#include "blackmisc/simulation/simulatorplugininfolist.h"
#include "blackmisc/simulation/simulatedaircraftlist.h"
#include "blackmisc/network/textmessagelist.h"
@@ -179,6 +180,7 @@ namespace BlackCore
QPair<BlackMisc::Simulation::CSimulatorPluginInfo, ISimulator *> m_simulatorPlugin; //!< Currently loaded simulator plugin
CPluginManagerSimulator *m_plugins = nullptr;
BlackMisc::CRegularThread m_listenersThread;
BlackCore::CWeatherManager m_weatherManager { this };
};
} // namespace

View File

@@ -27,6 +27,7 @@
#include "blackmisc/network/client.h"
#include "blackmisc/pixmap.h"
#include "blackmisc/identifiable.h"
#include "blackmisc/weather/weathergridprovider.h"
#include <QObject>
namespace BlackCore
@@ -284,7 +285,8 @@ namespace BlackCore
const BlackMisc::Simulation::CSimulatorPluginInfo &info,
BlackMisc::Simulation::IOwnAircraftProvider *ownAircraftProvider,
BlackMisc::Simulation::IRemoteAircraftProvider *remoteAircraftProvider,
BlackMisc::IPluginStorageProvider *pluginStorageProvider) = 0;
BlackMisc::IPluginStorageProvider *pluginStorageProvider,
BlackMisc::Weather::IWeatherGridProvider *weatherGridProvider) = 0;
//! Simulator listener instance
virtual ISimulatorListener *createListener(const BlackMisc::Simulation::CSimulatorPluginInfo &info) = 0;

View File

@@ -20,17 +20,21 @@ using namespace BlackMisc::Aviation;
using namespace BlackMisc::Simulation;
using namespace BlackMisc::PhysicalQuantities;
using namespace BlackMisc::Simulation;
using namespace BlackMisc::Weather;
namespace BlackCore
{
CSimulatorCommon::CSimulatorCommon(const CSimulatorPluginInfo &info,
BlackMisc::Simulation::IOwnAircraftProvider *ownAircraftProvider,
BlackMisc::Simulation::IRemoteAircraftProvider *remoteAircraftProvider,
IPluginStorageProvider *pluginStorageProvider, QObject *parent)
IPluginStorageProvider *pluginStorageProvider,
IWeatherGridProvider *weatherGridProvider,
QObject *parent)
: ISimulator(parent),
COwnAircraftAware(ownAircraftProvider),
CRemoteAircraftAware(remoteAircraftProvider),
CPluginStorageAware(pluginStorageProvider),
CWeatherGridAware(weatherGridProvider),
m_simulatorPluginInfo(info)
{
this->setObjectName("Simulator: " + info.getIdentifier());

View File

@@ -28,6 +28,7 @@
#include "blackmisc/network/client.h"
#include "blackmisc/pixmap.h"
#include "blackmisc/connectionguard.h"
#include "blackmisc/weather/weathergridprovider.h"
#include <QObject>
namespace BlackCore
@@ -37,7 +38,8 @@ namespace BlackCore
public BlackCore::ISimulator,
public BlackMisc::Simulation::COwnAircraftAware, // gain access to in memory own aircraft data
public BlackMisc::Simulation::CRemoteAircraftAware, // gain access to in memory remote aircraft data
public BlackMisc::CPluginStorageAware // gain access to in memory plugin storage
public BlackMisc::CPluginStorageAware, // gain access to in memory plugin storage
public BlackMisc::Weather::CWeatherGridAware // gain access to in memory weather grid
{
Q_OBJECT
@@ -118,6 +120,7 @@ namespace BlackCore
BlackMisc::Simulation::IOwnAircraftProvider *ownAircraftProvider,
BlackMisc::Simulation::IRemoteAircraftProvider *remoteAircraftProvider,
BlackMisc::IPluginStorageProvider *pluginStorageProvider,
BlackMisc::Weather::IWeatherGridProvider *weatherGridProvider,
QObject *parent);
//! \copydoc ISimulator::logicallyAddRemoteAircraft