diff --git a/src/Airmap/AirMapWeatherInfoManager.cc b/src/Airmap/AirMapWeatherInfoManager.cc index 62dbd9ba51aa3ff713fcfdd9cf6276c77b931702..00537c1a26ccc07126f389f778dc983d5ed54770 100644 --- a/src/Airmap/AirMapWeatherInfoManager.cc +++ b/src/Airmap/AirMapWeatherInfoManager.cc @@ -10,6 +10,7 @@ #include "AirMapWeatherInfoManager.h" #include "AirMapManager.h" + #define WEATHER_UPDATE_DISTANCE 50000 //-- 50km threshold for weather updates #define WEATHER_UPDATE_TIME 30 * 60 * 60 * 1000 //-- 30 minutes threshold for weather updates @@ -49,18 +50,17 @@ AirMapWeatherInfoManager::_requestWeatherUpdate(const QGeoCoordinate& coordinate emit weatherChanged(); return; } - Status::GetStatus::Parameters params; - params.longitude= coordinate.longitude(); - params.latitude = coordinate.latitude(); - params.weather = true; - _shared.client()->status().get_status_by_point(params, [this, coordinate](const Status::GetStatus::Result& result) { + Advisory::ReportWeather::Parameters params; + params.longitude= static_cast(coordinate.longitude()); + params.latitude = static_cast(coordinate.latitude()); + _shared.client()->advisory().report_weather(params, [this, coordinate](const Advisory::ReportWeather::Result& result) { if (result) { - _weather = result.value().weather; + _weather = result.value(); _valid = true; if(_weather.icon.empty()) { _icon = QStringLiteral("qrc:/airmapweather/unknown.svg"); } else { - _icon = QStringLiteral("qrc:/airmapweather/") + QString::fromStdString(_weather.icon) + QStringLiteral(".svg"); + _icon = QStringLiteral("qrc:/airmapweather/") + QString::fromStdString(_weather.icon).replace("-", "_") + QStringLiteral(".svg"); } qCDebug(AirMapManagerLog) << "Weather Info: " << _valid << "Icon:" << QString::fromStdString(_weather.icon) << "Condition:" << QString::fromStdString(_weather.condition) << "Temp:" << _weather.temperature; } else { diff --git a/src/Airmap/AirMapWeatherInfoManager.h b/src/Airmap/AirMapWeatherInfoManager.h index 9f7a34104989031a97b110ebaa02641e600301e5..b54b3916724e3f8eaa75090299b7d08a9edd518a 100644 --- a/src/Airmap/AirMapWeatherInfoManager.h +++ b/src/Airmap/AirMapWeatherInfoManager.h @@ -18,7 +18,7 @@ #include #include -#include "airmap/status.h" +#include "airmap/advisory.h" /** * @file AirMapWeatherInfoManager.h @@ -35,12 +35,12 @@ public: QString condition () override { return QString::fromStdString(_weather.condition); } QString icon () override { return _icon; } quint32 windHeading () override { return _weather.wind.heading; } - quint32 windSpeed () override { return _weather.wind.speed; } + float windSpeed () override { return _weather.wind.speed; } quint32 windGusting () override { return _weather.wind.gusting; } - qint32 temperature () override { return _weather.temperature; } + float temperature () override { return _weather.temperature; } float humidity () override { return _weather.humidity; } - quint32 visibility () override { return _weather.visibility; } - quint32 precipitation () override { return _weather.precipitation; } + float visibility () override { return _weather.visibility; } + float precipitation () override { return _weather.precipitation; } void setROI (const QGCGeoBoundingCube& roi) override; @@ -53,7 +53,7 @@ private: private: bool _valid; QString _icon; - airmap::Status::Weather _weather; + airmap::Advisory::Weather _weather; //-- Don't check the weather every time the user moves the map AirMapSharedState& _shared; QGeoCoordinate _lastRoiCenter; diff --git a/src/AirspaceManagement/AirspaceWeatherInfoProvider.h b/src/AirspaceManagement/AirspaceWeatherInfoProvider.h index 5e0de6660db1dfb97a537ccf2f73c4bb091e97ae..c1ec41d03c2918f6d224def08e5406ab9f6e4013 100644 --- a/src/AirspaceManagement/AirspaceWeatherInfoProvider.h +++ b/src/AirspaceManagement/AirspaceWeatherInfoProvider.h @@ -29,23 +29,23 @@ public: Q_PROPERTY(QString condition READ condition NOTIFY weatherChanged) Q_PROPERTY(QString icon READ icon NOTIFY weatherChanged) Q_PROPERTY(quint32 windHeading READ windHeading NOTIFY weatherChanged) - Q_PROPERTY(quint32 windSpeed READ windSpeed NOTIFY weatherChanged) + Q_PROPERTY(float windSpeed READ windSpeed NOTIFY weatherChanged) Q_PROPERTY(quint32 windGusting READ windGusting NOTIFY weatherChanged) - Q_PROPERTY(qint32 temperature READ temperature NOTIFY weatherChanged) + Q_PROPERTY(float temperature READ temperature NOTIFY weatherChanged) Q_PROPERTY(float humidity READ humidity NOTIFY weatherChanged) - Q_PROPERTY(quint32 visibility READ visibility NOTIFY weatherChanged) - Q_PROPERTY(quint32 precipitation READ precipitation NOTIFY weatherChanged) + Q_PROPERTY(float visibility READ visibility NOTIFY weatherChanged) + Q_PROPERTY(float precipitation READ precipitation NOTIFY weatherChanged) virtual bool valid () = 0; ///< Current weather data is valid virtual QString condition () = 0; ///< The overall weather condition. virtual QString icon () = 0; ///< 2:1 Aspect ratio icon url ready to be used by an Image QML Item virtual quint32 windHeading () = 0; ///< The heading in [°]. - virtual quint32 windSpeed () = 0; ///< The speed in [°]. + virtual float windSpeed () = 0; ///< The speed in [°]. virtual quint32 windGusting () = 0; - virtual qint32 temperature () = 0; ///< The temperature in [°C]. + virtual float temperature () = 0; ///< The temperature in [°C]. virtual float humidity () = 0; - virtual quint32 visibility () = 0; ///< Visibility in [m]. - virtual quint32 precipitation () = 0; ///< The probability of precipitation in [%]. + virtual float visibility () = 0; ///< Visibility in [m]. + virtual float precipitation () = 0; ///< The probability of precipitation in [%]. /** * Set region of interest that should be queried. When finished, the weatherChanged() signal will be emmited.