Simulator driver fetches and injects weather from weather manager

This commit is contained in:
Roland Winklmeier
2016-03-28 20:57:39 +02:00
parent 5801962a99
commit 781707fb7e
9 changed files with 100 additions and 37 deletions

View File

@@ -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)

View File

@@ -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