mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 06:45:37 +08:00
Ref T786, used weather data printer code for weather description (to QString)
This commit is contained in:
committed by
Mat Sutcliffe
parent
0bf9ddbe2c
commit
8fe11c7633
@@ -54,49 +54,10 @@ void CWeatherDataPrinter::fetchAndPrintWeatherData(const CCoordinateGeodetic &po
|
||||
m_weatherManger.requestWeatherGrid(weatherGrid, { this, &CWeatherDataPrinter::printWeatherData });
|
||||
}
|
||||
|
||||
void CWeatherDataPrinter::printWeatherData(const BlackMisc::Weather::CWeatherGrid &weatherGrid)
|
||||
void CWeatherDataPrinter::printWeatherData(const CWeatherGrid &weatherGrid)
|
||||
{
|
||||
QTextStream qtout(stdout);
|
||||
qtout << "... finished." << endl;
|
||||
for (const CGridPoint &gridPoint : weatherGrid)
|
||||
{
|
||||
qtout << "Latitude:" << gridPoint.getPosition().latitude().toQString() << endl;
|
||||
qtout << "Longitude:" << gridPoint.getPosition().longitude().toQString() << endl;
|
||||
qtout << " MSL Pressure: " << gridPoint.getPressureAtMsl().toQString() << endl;
|
||||
|
||||
CTemperatureLayerList temperatureLayers = gridPoint.getTemperatureLayers();
|
||||
temperatureLayers.sort([](const CTemperatureLayer & a, const CTemperatureLayer & b) { return a.getLevel() < b.getLevel(); });
|
||||
qtout << " Temperature Layers: " << endl;
|
||||
for (const auto &temperatureLayer : as_const(temperatureLayers))
|
||||
{
|
||||
qtout << " Level: " << temperatureLayer.getLevel().toQString() << endl;
|
||||
qtout << " Temperature: " << temperatureLayer.getTemperature().toQString() << endl;
|
||||
qtout << " Relative Humidity: " << temperatureLayer.getRelativeHumidity() << " %" << endl;
|
||||
}
|
||||
qtout << endl;
|
||||
|
||||
CWindLayerList windLayers = gridPoint.getWindLayers();
|
||||
windLayers.sort([](const CWindLayer & a, const CWindLayer & b) { return a.getLevel() < b.getLevel(); });
|
||||
qtout << " Wind Layers: " << endl;
|
||||
for (const auto &windLayer : as_const(windLayers))
|
||||
{
|
||||
qtout << " Level: " << windLayer.getLevel().toQString() << endl;
|
||||
qtout << " Wind: " << windLayer.getDirection().toQString() << " at " << windLayer.getSpeed().toQString() << endl;
|
||||
}
|
||||
qtout << endl;
|
||||
|
||||
qtout << " Cloud Layers: " << endl;
|
||||
CCloudLayerList cloudLayers = gridPoint.getCloudLayers();
|
||||
cloudLayers.sort([](const CCloudLayer & a, const CCloudLayer & b) { return a.getBase() < b.getBase(); });
|
||||
for (int i = 0; i < cloudLayers.size(); i++)
|
||||
{
|
||||
const CCloudLayer &cloudLayer = cloudLayers[i];
|
||||
qtout << " Top: " << cloudLayer.getTop().toQString() << endl;
|
||||
qtout << " Coverage: " << cloudLayer.getCoveragePercent() << " %" << endl;
|
||||
qtout << " Precipitation type: " << cloudLayer.getPrecipitation() << endl;
|
||||
qtout << " Precipitation rate: " << cloudLayer.getPrecipitationRate() << endl;
|
||||
qtout << " Base: " << cloudLayer.getBase().toQString() << endl;
|
||||
}
|
||||
qtout << endl << endl;
|
||||
}
|
||||
qtout << weatherGrid.getDescription();
|
||||
qtout << endl;
|
||||
}
|
||||
|
||||
@@ -61,8 +61,52 @@ namespace BlackMisc
|
||||
|
||||
QString CWeatherGrid::getDescription(const QString sep) const
|
||||
{
|
||||
Q_UNUSED(sep)
|
||||
return QStringLiteral("Weather grid with %1 entries").arg(this->size());
|
||||
QString s;
|
||||
QTextStream qtout(&s);
|
||||
for (const CGridPoint &gridPoint : *this)
|
||||
{
|
||||
qtout << "Latitude: " << gridPoint.getPosition().latitude().toQString() << sep;
|
||||
qtout << "Longitude: " << gridPoint.getPosition().longitude().toQString() << sep;
|
||||
qtout << " MSL Pressure: " << gridPoint.getPressureAtMsl().toQString() << sep;
|
||||
|
||||
CTemperatureLayerList temperatureLayers = gridPoint.getTemperatureLayers();
|
||||
temperatureLayers.sort([](const CTemperatureLayer & a, const CTemperatureLayer & b) { return a.getLevel() < b.getLevel(); });
|
||||
qtout << " Temperature Layers: " << sep;
|
||||
for (const auto &temperatureLayer : as_const(temperatureLayers))
|
||||
{
|
||||
qtout << " Level: " << temperatureLayer.getLevel().toQString() << sep;
|
||||
qtout << " Temperature: " << temperatureLayer.getTemperature().toQString() << sep;
|
||||
qtout << " Relative Humidity: " << temperatureLayer.getRelativeHumidity() << " %" << sep;
|
||||
}
|
||||
qtout << sep;
|
||||
|
||||
CWindLayerList windLayers = gridPoint.getWindLayers();
|
||||
windLayers.sort([](const CWindLayer & a, const CWindLayer & b) { return a.getLevel() < b.getLevel(); });
|
||||
qtout << " Wind Layers: " << sep;
|
||||
for (const auto &windLayer : as_const(windLayers))
|
||||
{
|
||||
qtout << " Level: " << windLayer.getLevel().toQString() << sep;
|
||||
qtout << " Wind: " << windLayer.getDirection().toQString() << " at " << windLayer.getSpeed().toQString() << sep;
|
||||
}
|
||||
qtout << sep;
|
||||
|
||||
qtout << " Cloud Layers: " << sep;
|
||||
CCloudLayerList cloudLayers = gridPoint.getCloudLayers();
|
||||
cloudLayers.sort([](const CCloudLayer & a, const CCloudLayer & b) { return a.getBase() < b.getBase(); });
|
||||
for (int i = 0; i < cloudLayers.size(); i++)
|
||||
{
|
||||
const CCloudLayer &cloudLayer = cloudLayers[i];
|
||||
qtout << " Top: " << cloudLayer.getTop().toQString() << sep;
|
||||
qtout << " Coverage: " << cloudLayer.getCoveragePercent() << " %" << sep;
|
||||
qtout << " Precipitation type: " << cloudLayer.getPrecipitation() << sep;
|
||||
qtout << " Precipitation rate: " << cloudLayer.getPrecipitationRate() << sep;
|
||||
qtout << " Base: " << cloudLayer.getBase().toQString() << sep;
|
||||
}
|
||||
qtout << sep << sep;
|
||||
}
|
||||
|
||||
qtout.flush();
|
||||
return s;
|
||||
}
|
||||
|
||||
const QVector<CWeatherScenario> &CWeatherGrid::getAllScenarios()
|
||||
|
||||
@@ -125,8 +125,6 @@ namespace BlackSimPlugin
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user