diff --git a/samples/weatherdata/reader.cpp b/samples/weatherdata/reader.cpp index daf54d26b..d2503b1a2 100644 --- a/samples/weatherdata/reader.cpp +++ b/samples/weatherdata/reader.cpp @@ -41,7 +41,8 @@ void CLineReader::run() longitudeValue += match.captured(4).toDouble() / 10; const CLatitude latitude(latitudeValue, CAngleUnit::deg()); const CLongitude longitude(longitudeValue, CAngleUnit::deg()); - emit weatherDataRequest(latitude, longitude); + const CCoordinateGeodetic position { latitude, longitude, {0} }; + emit weatherDataRequest(position); } else { diff --git a/samples/weatherdata/reader.h b/samples/weatherdata/reader.h index 0c7eeda1c..e084f2efd 100644 --- a/samples/weatherdata/reader.h +++ b/samples/weatherdata/reader.h @@ -13,8 +13,7 @@ //! \file //! \ingroup sampleweatherdata -#include "blackmisc/geo/latitude.h" -#include "blackmisc/geo/longitude.h" +#include "blackmisc/geo/coordinategeodetic.h" #include #include @@ -35,7 +34,7 @@ protected: signals: //! User is asking for weather data - void weatherDataRequest(const BlackMisc::Geo::CLatitude &lat, const BlackMisc::Geo::CLongitude &lon); + void weatherDataRequest(const BlackMisc::Geo::CCoordinateGeodetic &position); //! User is asking to quit void quit(); diff --git a/samples/weatherdata/weatherdataprinter.cpp b/samples/weatherdata/weatherdataprinter.cpp index 7d39dc70d..be949de22 100644 --- a/samples/weatherdata/weatherdataprinter.cpp +++ b/samples/weatherdata/weatherdataprinter.cpp @@ -51,8 +51,8 @@ void CWeatherDataPrinter::ps_printWeatherData() CWeatherGrid weatherGrid = m_weatherData->getWeatherData(); for (const CGridPoint &gridPoint : weatherGrid) { - qtout << "Latitude:" << gridPoint.getLatitude().toQString() << endl; - qtout << "Longitude:" << gridPoint.getLongitude().toQString() << endl; + qtout << "Latitude:" << gridPoint.getPosition().latitude().toQString() << endl; + qtout << "Longitude:" << gridPoint.getPosition().longitude().toQString() << endl; CTemperatureLayerList temperatureLayers = gridPoint.getTemperatureLayers(); temperatureLayers.sort([](const CTemperatureLayer &a, const CTemperatureLayer &b) { return a.getLevel() < b.getLevel(); }); diff --git a/samples/weatherdata/weatherdataprinter.h b/samples/weatherdata/weatherdataprinter.h index 02c5dfa28..3cf17ea17 100644 --- a/samples/weatherdata/weatherdataprinter.h +++ b/samples/weatherdata/weatherdataprinter.h @@ -32,7 +32,7 @@ public: public slots: //! Fetch new weather data for given position and print it once received - void fetchAndPrintWetherData(const BlackMisc::Geo::CLatitude &lat, const BlackMisc::Geo::CLongitude &lon); + void fetchAndPrintWetherData(const BlackMisc::Geo::CCoordinateGeodetic &position); private slots: //! Print weather data to stdout diff --git a/src/blackcore/weatherdata.h b/src/blackcore/weatherdata.h index ec59da503..a7a92e4f0 100644 --- a/src/blackcore/weatherdata.h +++ b/src/blackcore/weatherdata.h @@ -13,8 +13,7 @@ #define BLACKCORE_WEATHERDATA_H #include "blackcoreexport.h" -#include "blackmisc/geo/latitude.h" -#include "blackmisc/geo/longitude.h" +#include "blackmisc/geo/coordinategeodetic.h" #include "blackmisc/weather/gridpoint.h" #include "blackmisc/weather/weathergrid.h" #include diff --git a/src/blackmisc/weather/gridpoint.cpp b/src/blackmisc/weather/gridpoint.cpp index ea83f7327..0146a23e2 100644 --- a/src/blackmisc/weather/gridpoint.cpp +++ b/src/blackmisc/weather/gridpoint.cpp @@ -18,12 +18,12 @@ namespace BlackMisc { namespace Weather { - CGridPoint::CGridPoint(const Geo::CLatitude &latitude, const Geo::CLongitude longitude, + CGridPoint::CGridPoint(const Geo::CCoordinateGeodetic &position, const CCloudLayerList &cloudLayers, const CTemperatureLayerList &temperatureLayers, const CVisibilityLayerList &visibilityLayers, const CWindLayerList &windLayers) : - m_latitude(latitude), m_longitude(longitude), m_cloudLayers(cloudLayers), + m_position(position), m_cloudLayers(cloudLayers), m_temperatureLayers(temperatureLayers), m_visibilityLayers(visibilityLayers), m_windLayers(windLayers) { } @@ -34,10 +34,8 @@ namespace BlackMisc ColumnIndex i = index.frontCasted(); switch (i) { - case IndexLatitude: - return CVariant::fromValue(m_latitude); - case IndexLongitude: - return CVariant::fromValue(m_longitude); + case IndexPosition: + return CVariant::fromValue(m_position); case IndexCloudLayers: return CVariant::fromValue(m_cloudLayers); case IndexTemperatureLayers: @@ -55,11 +53,9 @@ namespace BlackMisc ColumnIndex i = index.frontCasted(); switch (i) { - case IndexLatitude: - setLatitude(variant.value()); + case IndexPosition: + setPosition(variant.value()); break; - case IndexLongitude: - setLongitude(variant.value()); break; case IndexCloudLayers: setCloudLayers(variant.value()); diff --git a/src/blackmisc/weather/gridpoint.h b/src/blackmisc/weather/gridpoint.h index cde2f6c42..e388b70e7 100644 --- a/src/blackmisc/weather/gridpoint.h +++ b/src/blackmisc/weather/gridpoint.h @@ -15,8 +15,7 @@ #include "blackmisc/blackmiscexport.h" #include "blackmisc/valueobject.h" #include "blackmisc/propertyindex.h" -#include "blackmisc/geo/latitude.h" -#include "blackmisc/geo/longitude.h" +#include "blackmisc/geo/coordinategeodetic.h" #include "blackmisc/weather/cloudlayerlist.h" #include "blackmisc/weather/temperaturelayerlist.h" #include "blackmisc/weather/visibilitylayerlist.h" @@ -35,8 +34,7 @@ namespace BlackMisc //! Properties by index enum ColumnIndex { - IndexLatitude = BlackMisc::CPropertyIndex::GlobalIndexCGridPoint, - IndexLongitude, + IndexPosition = BlackMisc::CPropertyIndex::GlobalIndexCGridPoint, IndexCloudLayers, IndexTemperatureLayers, IndexWindLayers @@ -46,23 +44,17 @@ namespace BlackMisc CGridPoint() = default; //! Constructor - CGridPoint(const Geo::CLatitude &latitude, const Geo::CLongitude longitude, + CGridPoint(const Geo::CCoordinateGeodetic &position, const CCloudLayerList &cloudLayers, const CTemperatureLayerList &temperatureLayers, const CVisibilityLayerList &visibilityLayers, const CWindLayerList &windLayers); - //! Set latitude - void setLatitude(const Geo::CLatitude &latitude) { m_latitude = latitude; } + //! Set position + void setPosition(const BlackMisc::Geo::CCoordinateGeodetic &position) { m_position = position; } - //! Get latitude - Geo::CLatitude getLatitude() const { return m_latitude; } - - //! Set longitude - void setLongitude(const Geo::CLongitude &longitude) { m_longitude = longitude; } - - //! Get longitude - Geo::CLongitude getLongitude() const { return m_longitude; } + //! Get position + const BlackMisc::Geo::CCoordinateGeodetic getPosition() const { return m_position; } //! Set cloud layers void setCloudLayers(const CCloudLayerList &cloudLayers) { m_cloudLayers = cloudLayers; } @@ -98,8 +90,7 @@ namespace BlackMisc QString convertToQString(bool i18n = false) const; private: - Geo::CLatitude m_latitude; - Geo::CLongitude m_longitude; + BlackMisc::Geo::CCoordinateGeodetic m_position; CCloudLayerList m_cloudLayers; CTemperatureLayerList m_temperatureLayers; CVisibilityLayerList m_visibilityLayers; @@ -107,8 +98,7 @@ namespace BlackMisc BLACK_METACLASS( CGridPoint, - BLACK_METAMEMBER(latitude), - BLACK_METAMEMBER(longitude), + BLACK_METAMEMBER(position), BLACK_METAMEMBER(cloudLayers), BLACK_METAMEMBER(temperatureLayers), BLACK_METAMEMBER(visibilityLayers), diff --git a/src/blackmisc/weather/weathergrid.cpp b/src/blackmisc/weather/weathergrid.cpp index 72c5bd497..49f45cadb 100644 --- a/src/blackmisc/weather/weathergrid.cpp +++ b/src/blackmisc/weather/weathergrid.cpp @@ -47,7 +47,7 @@ namespace BlackMisc static const CGridPoint gridPointGLOB = { - {}, {}, + {}, CCloudLayerList { cloudLayer }, CTemperatureLayerList { temperatureLayer }, CVisibilityLayerList { visibilityLayer } , @@ -97,7 +97,7 @@ namespace BlackMisc static const CGridPoint gridPointGLOB { - {}, {}, + {}, CCloudLayerList { cloudLayer1, cloudLayer2 }, CTemperatureLayerList { temperatureLayer }, CVisibilityLayerList { visibilityLayer }, diff --git a/src/plugins/weatherdata/gfs/weatherdatagfs.cpp b/src/plugins/weatherdata/gfs/weatherdatagfs.cpp index f106d0cb1..a0c5530ca 100644 --- a/src/plugins/weatherdata/gfs/weatherdatagfs.cpp +++ b/src/plugins/weatherdata/gfs/weatherdatagfs.cpp @@ -270,7 +270,8 @@ namespace BlackWxPlugin CLatitude latitude(gfsGridPoint.latitude, CAngleUnit::deg()); CLongitude longitude(gfsGridPoint.longitude, CAngleUnit::deg()); - BlackMisc::Weather::CGridPoint gridPoint(latitude, longitude, cloudLayers, temperatureLayers, {}, windLayers); + auto position = CCoordinateGeodetic { latitude, longitude, {0} }; + BlackMisc::Weather::CGridPoint gridPoint(position, cloudLayers, temperatureLayers, {}, windLayers); m_weatherGrid.insert(gridPoint); } }