From e63129267d747445d1b27a8646cf29589fc6d61c Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Tue, 21 Apr 2020 15:37:33 +0200 Subject: [PATCH] Ref T786, smaller improvements * allow to use ICoordinateGeodetic, not the CCoordinateGeodetic implementation only * allow to init weather grid by initial ICoordinateGeodetic --- samples/weatherdata/weatherdataprinter.cpp | 2 +- src/blackmisc/weather/gridpoint.cpp | 4 ++-- src/blackmisc/weather/gridpoint.h | 4 ++-- src/blackmisc/weather/weathergrid.cpp | 10 ++++++++-- src/blackmisc/weather/weathergrid.h | 3 +++ 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/samples/weatherdata/weatherdataprinter.cpp b/samples/weatherdata/weatherdataprinter.cpp index 280bcef34..62622040e 100644 --- a/samples/weatherdata/weatherdataprinter.cpp +++ b/samples/weatherdata/weatherdataprinter.cpp @@ -51,7 +51,7 @@ void CWeatherDataPrinter::fetchAndPrintWeatherData(const CCoordinateGeodetic &po qtout << "Position:" << position.toQString(true) << endl; qtout << "Fetching weather data. This may take a while..." << endl; - CWeatherGrid weatherGrid { { "", position } }; + const CWeatherGrid weatherGrid { { "", position } }; m_weatherManger.requestWeatherGrid(weatherGrid, { this, &CWeatherDataPrinter::printWeatherData }); } diff --git a/src/blackmisc/weather/gridpoint.cpp b/src/blackmisc/weather/gridpoint.cpp index 4e03ff6fa..b9e32459f 100644 --- a/src/blackmisc/weather/gridpoint.cpp +++ b/src/blackmisc/weather/gridpoint.cpp @@ -21,13 +21,13 @@ namespace BlackMisc namespace Weather { CGridPoint::CGridPoint(const QString &identifier, - const Geo::CCoordinateGeodetic &position) : + const ICoordinateGeodetic &position) : m_identifier(identifier), m_position(position) { } CGridPoint::CGridPoint(const QString &identifier, - const Geo::CCoordinateGeodetic &position, + const Geo::ICoordinateGeodetic &position, const CCloudLayerList &cloudLayers, const CTemperatureLayerList &temperatureLayers, const CVisibilityLayerList &visibilityLayers, diff --git a/src/blackmisc/weather/gridpoint.h b/src/blackmisc/weather/gridpoint.h index 0b5268630..1f9cf39fc 100644 --- a/src/blackmisc/weather/gridpoint.h +++ b/src/blackmisc/weather/gridpoint.h @@ -54,11 +54,11 @@ namespace BlackMisc //! Constructor CGridPoint(const QString &identifier, - const Geo::CCoordinateGeodetic &position); + const Geo::ICoordinateGeodetic &position); //! Constructor CGridPoint(const QString &identifier, - const Geo::CCoordinateGeodetic &position, + const Geo::ICoordinateGeodetic &position, const CCloudLayerList &cloudLayers, const CTemperatureLayerList &temperatureLayers, const CVisibilityLayerList &visibilityLayers, diff --git a/src/blackmisc/weather/weathergrid.cpp b/src/blackmisc/weather/weathergrid.cpp index 4fe5916be..92c70071f 100644 --- a/src/blackmisc/weather/weathergrid.cpp +++ b/src/blackmisc/weather/weathergrid.cpp @@ -41,6 +41,12 @@ namespace BlackMisc CSequence(other) { } + CWeatherGrid::CWeatherGrid(const ICoordinateGeodetic &coordinate) + { + const CGridPoint p("GLOB", coordinate); + this->push_back(p); + } + CWeatherGrid CWeatherGrid::findWithinRange(const ICoordinateGeodetic &coordinate, const PhysicalQuantities::CLength &range) const { return findBy([&](const CGridPoint & gridPoint) @@ -162,7 +168,7 @@ namespace BlackMisc static const CGridPoint gridPointGLOB = { "GLOB", - {}, + CCoordinateGeodetic::null(), CCloudLayerList { cloudLayer }, CTemperatureLayerList { temperatureLayer }, CVisibilityLayerList { visibilityLayer }, @@ -214,7 +220,7 @@ namespace BlackMisc static const CGridPoint gridPointGLOB { "GLOB", - {}, + CCoordinateGeodetic::null(), CCloudLayerList { cloudLayer1, cloudLayer2 }, CTemperatureLayerList { temperatureLayer }, CVisibilityLayerList { visibilityLayer }, diff --git a/src/blackmisc/weather/weathergrid.h b/src/blackmisc/weather/weathergrid.h index f9a252404..08cf299a8 100644 --- a/src/blackmisc/weather/weathergrid.h +++ b/src/blackmisc/weather/weathergrid.h @@ -43,6 +43,9 @@ namespace BlackMisc //! Construct from a base class object. CWeatherGrid(const CSequence &other); + //! Grid with an initial point at coordinates given + CWeatherGrid(const BlackMisc::Geo::ICoordinateGeodetic &coordinate); + //! \copydoc Geo::IGeoObjectList::findWithinRange CWeatherGrid findWithinRange(const BlackMisc::Geo::ICoordinateGeodetic &coordinate, const BlackMisc::PhysicalQuantities::CLength &range) const;