mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 04:25:35 +08:00
Weather support in emulated driver
This commit is contained in:
committed by
Mat Sutcliffe
parent
926684fb87
commit
d96c5e51e3
@@ -120,6 +120,15 @@ namespace BlackSimPlugin
|
||||
return ISimulator::physicallyRemoveMultipleRemoteAircraft(callsigns);
|
||||
}
|
||||
|
||||
void CSimulatorEmulated::injectWeatherGrid(const CWeatherGrid &weatherGrid)
|
||||
{
|
||||
const QString wg = QStringLiteral("Weather grid with %1 entries").arg(weatherGrid.size());
|
||||
if (canLog()) m_monitorWidget->appendReceivingCall(Q_FUNC_INFO, wg);
|
||||
m_monitorWidget->receivedWeather(weatherGrid);
|
||||
|
||||
// remark see CWeatherDataPrinter
|
||||
}
|
||||
|
||||
bool CSimulatorEmulated::changeRemoteAircraftModel(const CSimulatedAircraft &aircraft)
|
||||
{
|
||||
if (canLog()) { m_monitorWidget->appendReceivingCall(Q_FUNC_INFO, aircraft.toQString()); }
|
||||
@@ -570,6 +579,17 @@ namespace BlackSimPlugin
|
||||
this->finishUpdateRemoteAircraftAndSetStatistics(now);
|
||||
}
|
||||
|
||||
void CSimulatorEmulated::requestWeather()
|
||||
{
|
||||
if (!m_isWeatherActivated) { return; }
|
||||
|
||||
const CWeatherScenario s = m_weatherScenarioSettings.get();
|
||||
this->getOwnAircraftPosition();
|
||||
const CCoordinateGeodetic currentPosition = this->getOwnAircraftPosition();
|
||||
const auto weatherGrid = CWeatherGrid { { "GLOB", currentPosition } };
|
||||
this->requestWeatherGrid(weatherGrid, { this, &CSimulatorEmulated::injectWeatherGrid });
|
||||
}
|
||||
|
||||
CSimulatorEmulatedListener::CSimulatorEmulatedListener(const CSimulatorPluginInfo &info)
|
||||
: ISimulatorListener(info)
|
||||
{ }
|
||||
|
||||
@@ -80,6 +80,7 @@ namespace BlackSimPlugin
|
||||
virtual bool logicallyAddRemoteAircraft(const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft) override;
|
||||
virtual bool logicallyRemoveRemoteAircraft(const BlackMisc::Aviation::CCallsign &callsign) override;
|
||||
virtual int physicallyRemoveMultipleRemoteAircraft(const BlackMisc::Aviation::CCallsignSet &callsigns) override;
|
||||
virtual void injectWeatherGrid(const BlackMisc::Weather::CWeatherGrid &weatherGrid) override;
|
||||
|
||||
// functions logged and used
|
||||
//! \addtogroup swiftdotcommands
|
||||
@@ -169,6 +170,9 @@ namespace BlackSimPlugin
|
||||
//! \remarks basically does the same as a real driver, obtains data from the interpolator
|
||||
void updateRemoteAircraft();
|
||||
|
||||
//! Request weather
|
||||
void requestWeather();
|
||||
|
||||
bool m_log = false; //!< from settings
|
||||
bool m_paused = false;
|
||||
bool m_connected = true;
|
||||
|
||||
@@ -19,6 +19,7 @@ using namespace BlackConfig;
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::Simulation;
|
||||
using namespace BlackMisc::Weather;
|
||||
using namespace BlackGui;
|
||||
using namespace BlackGui::Components;
|
||||
using namespace BlackGui::Editors;
|
||||
@@ -155,6 +156,11 @@ namespace BlackSimPlugin
|
||||
this->setSimulatorUiValues();
|
||||
}
|
||||
|
||||
void CSimulatorEmulatedMonitorDialog::receivedWeather(const CWeatherGrid &weatherGrid)
|
||||
{
|
||||
Q_UNUSED(weatherGrid)
|
||||
}
|
||||
|
||||
void CSimulatorEmulatedMonitorDialog::onSimulatorValuesChanged()
|
||||
{
|
||||
m_simulator->setCombinedStatus(
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#define BLACKSIMPLUGIN_EMULATED_SIMULATOREMULATEDMONITORDIALOG_H
|
||||
|
||||
#include "blackmisc/simulation/simulatedaircraft.h"
|
||||
#include "blackmisc/weather/weathergrid.h"
|
||||
#include "blackmisc/statusmessagelist.h"
|
||||
#include "blackmisc/logcategorylist.h"
|
||||
#include "blackmisc/identifiable.h"
|
||||
@@ -65,6 +66,9 @@ namespace BlackSimPlugin
|
||||
//! The title
|
||||
void updateWindowTitleAndUiValues(const BlackMisc::Simulation::CSimulatorInfo &info);
|
||||
|
||||
//! Display weather grid
|
||||
void receivedWeather(const BlackMisc::Weather::CWeatherGrid &weatherGrid);
|
||||
|
||||
private:
|
||||
static int constexpr MaxLogMessages = 500; //!< desired log message number
|
||||
|
||||
|
||||
Reference in New Issue
Block a user