From 66f0a27647684288068c183237cf327c845ec935 Mon Sep 17 00:00:00 2001 From: Roland Rossgotterer Date: Thu, 14 Feb 2019 09:14:26 +0100 Subject: [PATCH] Set weather position and pressure at MSL in Weather Status line --- src/blackcore/weathermanager.cpp | 1 + src/blackgui/components/weathercomponent.cpp | 8 +++++++- src/blackgui/components/weathercomponent.ui | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/blackcore/weathermanager.cpp b/src/blackcore/weathermanager.cpp index e2193b687..edb301c65 100644 --- a/src/blackcore/weathermanager.cpp +++ b/src/blackcore/weathermanager.cpp @@ -139,6 +139,7 @@ namespace BlackCore { const auto nearestGridPoint = fetchedWeatherGrid.findClosest(1, gridPoint.getPosition()).frontOrDefault(); gridPoint.copyWeatherDataFrom(nearestGridPoint); + gridPoint.setPosition(nearestGridPoint.getPosition()); } if (weatherRequest.callback) { weatherRequest.callback(requestedWeatherGrid); } diff --git a/src/blackgui/components/weathercomponent.cpp b/src/blackgui/components/weathercomponent.cpp index bb9f91cfc..31d5591f8 100644 --- a/src/blackgui/components/weathercomponent.cpp +++ b/src/blackgui/components/weathercomponent.cpp @@ -23,6 +23,7 @@ #include #include #include +#include using namespace BlackCore; using namespace BlackCore::Context; @@ -221,10 +222,15 @@ namespace BlackGui void CWeatherComponent::setWeatherGrid(const CWeatherGrid &weatherGrid) { - auto gridPoint = weatherGrid.frontOrDefault(); + CGridPoint gridPoint = weatherGrid.frontOrDefault(); ui->tvp_TemperatureLayers->updateContainer(gridPoint.getTemperatureLayers()); ui->tvp_CloudLayers->updateContainer(gridPoint.getCloudLayers()); ui->tvp_WindLayers->updateContainer(gridPoint.getWindLayers()); + CCoordinateGeodetic position = gridPoint.getPosition(); + double pressureAtMsl = gridPoint.getPressureAtMsl().value(CPressureUnit::hPa()); + QString status = QString("Weather Position: %1 %2").arg(position.latitude().toWgs84(), position.longitude().toWgs84()); + status += QString("\nPressure (MSL): %1 hPa").arg(pressureAtMsl); + ui->lbl_Status->setText(status); } void CWeatherComponent::requestWeatherGrid(const CCoordinateGeodetic &position) diff --git a/src/blackgui/components/weathercomponent.ui b/src/blackgui/components/weathercomponent.ui index 42a097dce..84bc52aee 100644 --- a/src/blackgui/components/weathercomponent.ui +++ b/src/blackgui/components/weathercomponent.ui @@ -121,6 +121,9 @@ <status will go here> + + true +