mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 04:45:31 +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);
|
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)
|
bool CSimulatorEmulated::changeRemoteAircraftModel(const CSimulatedAircraft &aircraft)
|
||||||
{
|
{
|
||||||
if (canLog()) { m_monitorWidget->appendReceivingCall(Q_FUNC_INFO, aircraft.toQString()); }
|
if (canLog()) { m_monitorWidget->appendReceivingCall(Q_FUNC_INFO, aircraft.toQString()); }
|
||||||
@@ -570,6 +579,17 @@ namespace BlackSimPlugin
|
|||||||
this->finishUpdateRemoteAircraftAndSetStatistics(now);
|
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)
|
CSimulatorEmulatedListener::CSimulatorEmulatedListener(const CSimulatorPluginInfo &info)
|
||||||
: ISimulatorListener(info)
|
: ISimulatorListener(info)
|
||||||
{ }
|
{ }
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ namespace BlackSimPlugin
|
|||||||
virtual bool logicallyAddRemoteAircraft(const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft) override;
|
virtual bool logicallyAddRemoteAircraft(const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft) override;
|
||||||
virtual bool logicallyRemoveRemoteAircraft(const BlackMisc::Aviation::CCallsign &callsign) override;
|
virtual bool logicallyRemoveRemoteAircraft(const BlackMisc::Aviation::CCallsign &callsign) override;
|
||||||
virtual int physicallyRemoveMultipleRemoteAircraft(const BlackMisc::Aviation::CCallsignSet &callsigns) override;
|
virtual int physicallyRemoveMultipleRemoteAircraft(const BlackMisc::Aviation::CCallsignSet &callsigns) override;
|
||||||
|
virtual void injectWeatherGrid(const BlackMisc::Weather::CWeatherGrid &weatherGrid) override;
|
||||||
|
|
||||||
// functions logged and used
|
// functions logged and used
|
||||||
//! \addtogroup swiftdotcommands
|
//! \addtogroup swiftdotcommands
|
||||||
@@ -169,6 +170,9 @@ namespace BlackSimPlugin
|
|||||||
//! \remarks basically does the same as a real driver, obtains data from the interpolator
|
//! \remarks basically does the same as a real driver, obtains data from the interpolator
|
||||||
void updateRemoteAircraft();
|
void updateRemoteAircraft();
|
||||||
|
|
||||||
|
//! Request weather
|
||||||
|
void requestWeather();
|
||||||
|
|
||||||
bool m_log = false; //!< from settings
|
bool m_log = false; //!< from settings
|
||||||
bool m_paused = false;
|
bool m_paused = false;
|
||||||
bool m_connected = true;
|
bool m_connected = true;
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ using namespace BlackConfig;
|
|||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
using namespace BlackMisc::Aviation;
|
using namespace BlackMisc::Aviation;
|
||||||
using namespace BlackMisc::Simulation;
|
using namespace BlackMisc::Simulation;
|
||||||
|
using namespace BlackMisc::Weather;
|
||||||
using namespace BlackGui;
|
using namespace BlackGui;
|
||||||
using namespace BlackGui::Components;
|
using namespace BlackGui::Components;
|
||||||
using namespace BlackGui::Editors;
|
using namespace BlackGui::Editors;
|
||||||
@@ -155,6 +156,11 @@ namespace BlackSimPlugin
|
|||||||
this->setSimulatorUiValues();
|
this->setSimulatorUiValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSimulatorEmulatedMonitorDialog::receivedWeather(const CWeatherGrid &weatherGrid)
|
||||||
|
{
|
||||||
|
Q_UNUSED(weatherGrid)
|
||||||
|
}
|
||||||
|
|
||||||
void CSimulatorEmulatedMonitorDialog::onSimulatorValuesChanged()
|
void CSimulatorEmulatedMonitorDialog::onSimulatorValuesChanged()
|
||||||
{
|
{
|
||||||
m_simulator->setCombinedStatus(
|
m_simulator->setCombinedStatus(
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#define BLACKSIMPLUGIN_EMULATED_SIMULATOREMULATEDMONITORDIALOG_H
|
#define BLACKSIMPLUGIN_EMULATED_SIMULATOREMULATEDMONITORDIALOG_H
|
||||||
|
|
||||||
#include "blackmisc/simulation/simulatedaircraft.h"
|
#include "blackmisc/simulation/simulatedaircraft.h"
|
||||||
|
#include "blackmisc/weather/weathergrid.h"
|
||||||
#include "blackmisc/statusmessagelist.h"
|
#include "blackmisc/statusmessagelist.h"
|
||||||
#include "blackmisc/logcategorylist.h"
|
#include "blackmisc/logcategorylist.h"
|
||||||
#include "blackmisc/identifiable.h"
|
#include "blackmisc/identifiable.h"
|
||||||
@@ -65,6 +66,9 @@ namespace BlackSimPlugin
|
|||||||
//! The title
|
//! The title
|
||||||
void updateWindowTitleAndUiValues(const BlackMisc::Simulation::CSimulatorInfo &info);
|
void updateWindowTitleAndUiValues(const BlackMisc::Simulation::CSimulatorInfo &info);
|
||||||
|
|
||||||
|
//! Display weather grid
|
||||||
|
void receivedWeather(const BlackMisc::Weather::CWeatherGrid &weatherGrid);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static int constexpr MaxLogMessages = 500; //!< desired log message number
|
static int constexpr MaxLogMessages = 500; //!< desired log message number
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user