Set weather position and pressure at MSL in Weather Status line

This commit is contained in:
Roland Rossgotterer
2019-02-14 09:14:26 +01:00
committed by Mat Sutcliffe
parent 5c84cff6e4
commit 66f0a27647
3 changed files with 11 additions and 1 deletions

View File

@@ -139,6 +139,7 @@ namespace BlackCore
{ {
const auto nearestGridPoint = fetchedWeatherGrid.findClosest(1, gridPoint.getPosition()).frontOrDefault(); const auto nearestGridPoint = fetchedWeatherGrid.findClosest(1, gridPoint.getPosition()).frontOrDefault();
gridPoint.copyWeatherDataFrom(nearestGridPoint); gridPoint.copyWeatherDataFrom(nearestGridPoint);
gridPoint.setPosition(nearestGridPoint.getPosition());
} }
if (weatherRequest.callback) { weatherRequest.callback(requestedWeatherGrid); } if (weatherRequest.callback) { weatherRequest.callback(requestedWeatherGrid); }

View File

@@ -23,6 +23,7 @@
#include <QCompleter> #include <QCompleter>
#include <QRegExpValidator> #include <QRegExpValidator>
#include <QRegularExpression> #include <QRegularExpression>
#include <QStringView>
using namespace BlackCore; using namespace BlackCore;
using namespace BlackCore::Context; using namespace BlackCore::Context;
@@ -221,10 +222,15 @@ namespace BlackGui
void CWeatherComponent::setWeatherGrid(const CWeatherGrid &weatherGrid) void CWeatherComponent::setWeatherGrid(const CWeatherGrid &weatherGrid)
{ {
auto gridPoint = weatherGrid.frontOrDefault(); CGridPoint gridPoint = weatherGrid.frontOrDefault();
ui->tvp_TemperatureLayers->updateContainer(gridPoint.getTemperatureLayers()); ui->tvp_TemperatureLayers->updateContainer(gridPoint.getTemperatureLayers());
ui->tvp_CloudLayers->updateContainer(gridPoint.getCloudLayers()); ui->tvp_CloudLayers->updateContainer(gridPoint.getCloudLayers());
ui->tvp_WindLayers->updateContainer(gridPoint.getWindLayers()); 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) void CWeatherComponent::requestWeatherGrid(const CCoordinateGeodetic &position)

View File

@@ -121,6 +121,9 @@
<property name="text"> <property name="text">
<string>&lt;status will go here&gt;</string> <string>&lt;status will go here&gt;</string>
</property> </property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
<item> <item>