From cc77183b059e952ec587338bff9399591b75ca85 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Sun, 19 Apr 2020 02:21:07 +0200 Subject: [PATCH] Ref T786, changed provider interface, addded identifier based version * virtual void requestWeatherGrid(const BlackMisc::Geo::ICoordinateGeodetic &position, const BlackMisc::CIdentifier &identifier) * CWeatherGridAware function do not need to be virtual --- src/blackmisc/weather/weathergridprovider.cpp | 6 ++++++ src/blackmisc/weather/weathergridprovider.h | 17 ++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/blackmisc/weather/weathergridprovider.cpp b/src/blackmisc/weather/weathergridprovider.cpp index 0f3aa6193..53c1395f2 100644 --- a/src/blackmisc/weather/weathergridprovider.cpp +++ b/src/blackmisc/weather/weathergridprovider.cpp @@ -12,6 +12,12 @@ namespace BlackMisc { namespace Weather { + void CWeatherGridAware::requestWeatherGrid(const Geo::ICoordinateGeodetic &position, const CIdentifier &identifier) + { + Q_ASSERT_X(this->hasProvider(), Q_FUNC_INFO, "No object available"); + this->provider()->requestWeatherGrid(position, identifier); + } + void CWeatherGridAware::requestWeatherGrid( const CWeatherGrid &weatherGrid, const CSlot &callback) diff --git a/src/blackmisc/weather/weathergridprovider.h b/src/blackmisc/weather/weathergridprovider.h index ace64127d..422735d89 100644 --- a/src/blackmisc/weather/weathergridprovider.h +++ b/src/blackmisc/weather/weathergridprovider.h @@ -13,8 +13,8 @@ #include "blackmisc/weather/weathergrid.h" #include "blackmisc/provider.h" -#include "blackmisc/blackmiscexport.h" #include "blackmisc/slot.h" +#include "blackmisc/blackmiscexport.h" #include #include @@ -39,9 +39,12 @@ namespace BlackMisc //! Destructor virtual ~IWeatherGridProvider() {} + //! Request weather grid with identifier + virtual void requestWeatherGrid(const BlackMisc::Geo::ICoordinateGeodetic &position, const BlackMisc::CIdentifier &identifier) = 0; + //! Request weather grid - virtual void requestWeatherGrid(const CWeatherGrid &weatherGrid, - const CSlot &callback) = 0; + //! \deprecated Use the position/identifier based version if possible. It will inject the result "in the simulator" + virtual void requestWeatherGrid(const CWeatherGrid &weatherGrid, const CSlot &callback) = 0; //! Request weather grid from file virtual void requestWeatherGridFromFile(const QString &filePath, @@ -54,8 +57,12 @@ namespace BlackMisc { public: //! \copydoc IWeatherGridProvider::requestWeatherGrid - virtual void requestWeatherGrid(const CWeatherGrid &weatherGrid, - const CSlot &callback); + void requestWeatherGrid(const BlackMisc::Geo::ICoordinateGeodetic &position, const BlackMisc::CIdentifier &identifier); + + //! \copydoc IWeatherGridProvider::requestWeatherGrid + //! \deprecated Use the position/identifier based version if possible. It will inject the result "in the simulator" + void requestWeatherGrid(const CWeatherGrid &weatherGrid, const CSlot &callback); + protected: //! Constructor CWeatherGridAware(IWeatherGridProvider *weatherGridProvider) : IProviderAware(weatherGridProvider) { Q_ASSERT(weatherGridProvider); }