Ref T786, smaller improvements

* allow to use ICoordinateGeodetic, not the CCoordinateGeodetic implementation only
* allow to init weather grid by initial ICoordinateGeodetic
This commit is contained in:
Klaus Basan
2020-04-21 15:37:33 +02:00
committed by Mat Sutcliffe
parent 9235f3232e
commit e63129267d
5 changed files with 16 additions and 7 deletions

View File

@@ -51,7 +51,7 @@ void CWeatherDataPrinter::fetchAndPrintWeatherData(const CCoordinateGeodetic &po
qtout << "Position:" << position.toQString(true) << endl; qtout << "Position:" << position.toQString(true) << endl;
qtout << "Fetching weather data. This may take a while..." << 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 }); m_weatherManger.requestWeatherGrid(weatherGrid, { this, &CWeatherDataPrinter::printWeatherData });
} }

View File

@@ -21,13 +21,13 @@ namespace BlackMisc
namespace Weather namespace Weather
{ {
CGridPoint::CGridPoint(const QString &identifier, CGridPoint::CGridPoint(const QString &identifier,
const Geo::CCoordinateGeodetic &position) : const ICoordinateGeodetic &position) :
m_identifier(identifier), m_identifier(identifier),
m_position(position) m_position(position)
{ } { }
CGridPoint::CGridPoint(const QString &identifier, CGridPoint::CGridPoint(const QString &identifier,
const Geo::CCoordinateGeodetic &position, const Geo::ICoordinateGeodetic &position,
const CCloudLayerList &cloudLayers, const CCloudLayerList &cloudLayers,
const CTemperatureLayerList &temperatureLayers, const CTemperatureLayerList &temperatureLayers,
const CVisibilityLayerList &visibilityLayers, const CVisibilityLayerList &visibilityLayers,

View File

@@ -54,11 +54,11 @@ namespace BlackMisc
//! Constructor //! Constructor
CGridPoint(const QString &identifier, CGridPoint(const QString &identifier,
const Geo::CCoordinateGeodetic &position); const Geo::ICoordinateGeodetic &position);
//! Constructor //! Constructor
CGridPoint(const QString &identifier, CGridPoint(const QString &identifier,
const Geo::CCoordinateGeodetic &position, const Geo::ICoordinateGeodetic &position,
const CCloudLayerList &cloudLayers, const CCloudLayerList &cloudLayers,
const CTemperatureLayerList &temperatureLayers, const CTemperatureLayerList &temperatureLayers,
const CVisibilityLayerList &visibilityLayers, const CVisibilityLayerList &visibilityLayers,

View File

@@ -41,6 +41,12 @@ namespace BlackMisc
CSequence<CGridPoint>(other) CSequence<CGridPoint>(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 CWeatherGrid CWeatherGrid::findWithinRange(const ICoordinateGeodetic &coordinate, const PhysicalQuantities::CLength &range) const
{ {
return findBy([&](const CGridPoint & gridPoint) return findBy([&](const CGridPoint & gridPoint)
@@ -162,7 +168,7 @@ namespace BlackMisc
static const CGridPoint gridPointGLOB = static const CGridPoint gridPointGLOB =
{ {
"GLOB", "GLOB",
{}, CCoordinateGeodetic::null(),
CCloudLayerList { cloudLayer }, CCloudLayerList { cloudLayer },
CTemperatureLayerList { temperatureLayer }, CTemperatureLayerList { temperatureLayer },
CVisibilityLayerList { visibilityLayer }, CVisibilityLayerList { visibilityLayer },
@@ -214,7 +220,7 @@ namespace BlackMisc
static const CGridPoint gridPointGLOB static const CGridPoint gridPointGLOB
{ {
"GLOB", "GLOB",
{}, CCoordinateGeodetic::null(),
CCloudLayerList { cloudLayer1, cloudLayer2 }, CCloudLayerList { cloudLayer1, cloudLayer2 },
CTemperatureLayerList { temperatureLayer }, CTemperatureLayerList { temperatureLayer },
CVisibilityLayerList { visibilityLayer }, CVisibilityLayerList { visibilityLayer },

View File

@@ -43,6 +43,9 @@ namespace BlackMisc
//! Construct from a base class object. //! Construct from a base class object.
CWeatherGrid(const CSequence<CGridPoint> &other); CWeatherGrid(const CSequence<CGridPoint> &other);
//! Grid with an initial point at coordinates given
CWeatherGrid(const BlackMisc::Geo::ICoordinateGeodetic &coordinate);
//! \copydoc Geo::IGeoObjectList::findWithinRange //! \copydoc Geo::IGeoObjectList::findWithinRange
CWeatherGrid findWithinRange(const BlackMisc::Geo::ICoordinateGeodetic &coordinate, const BlackMisc::PhysicalQuantities::CLength &range) const; CWeatherGrid findWithinRange(const BlackMisc::Geo::ICoordinateGeodetic &coordinate, const BlackMisc::PhysicalQuantities::CLength &range) const;