mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 01:45:38 +08:00
Simulator driver fetches and injects weather from weather manager
This commit is contained in:
@@ -97,10 +97,6 @@ namespace BlackSimPlugin
|
||||
m_simconnectTimerId = startTimer(10);
|
||||
m_simConnected = true;
|
||||
emitSimulatorCombinedStatus();
|
||||
|
||||
// Pull weather data from core.
|
||||
// Since we don't get weather data from core yet, use hard coded weather.
|
||||
injectWeatherGrid(CWeatherGrid::getCavokGrid());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -431,6 +427,14 @@ namespace BlackSimPlugin
|
||||
{
|
||||
--m_skipCockpitUpdateCycles;
|
||||
}
|
||||
|
||||
const auto currentPosition = CCoordinateGeodetic { aircraftSituation.latitude(), aircraftSituation.longitude(), {0} };
|
||||
if (calculateGreatCircleDistance(m_lastWeatherPosition, currentPosition).value(CLengthUnit::mi()) > 20 )
|
||||
{
|
||||
m_lastWeatherPosition = currentPosition;
|
||||
const auto weatherGrid = CWeatherGrid { { "GLOB", currentPosition } };
|
||||
requestWeatherGrid(weatherGrid, { this, &CSimulatorFsx::injectWeatherGrid });
|
||||
}
|
||||
}
|
||||
|
||||
void CSimulatorFsx::updateOwnAircraftFromSimulator(DataDefinitionClientAreaSb sbDataArea)
|
||||
|
||||
@@ -201,6 +201,8 @@ namespace BlackSimPlugin
|
||||
qint64 m_statsUpdateAircraftTimeTotal = 0;
|
||||
qint64 m_statsUpdateAircraftTimeAvg = 0;
|
||||
int m_statsUpdateAircraftCount = 0;
|
||||
|
||||
BlackMisc::Geo::CCoordinateGeodetic m_lastWeatherPosition; //!< Own aircraft position at which weather was fetched and injected last
|
||||
};
|
||||
|
||||
//! Listener for FSX
|
||||
|
||||
Reference in New Issue
Block a user