mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-25 02:05:43 +08:00
@@ -41,7 +41,8 @@ void CLineReader::run()
|
|||||||
longitudeValue += match.captured(4).toDouble() / 10;
|
longitudeValue += match.captured(4).toDouble() / 10;
|
||||||
const CLatitude latitude(latitudeValue, CAngleUnit::deg());
|
const CLatitude latitude(latitudeValue, CAngleUnit::deg());
|
||||||
const CLongitude longitude(longitudeValue, CAngleUnit::deg());
|
const CLongitude longitude(longitudeValue, CAngleUnit::deg());
|
||||||
emit weatherDataRequest(latitude, longitude);
|
const CCoordinateGeodetic position { latitude, longitude, {0} };
|
||||||
|
emit weatherDataRequest(position);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,8 +13,7 @@
|
|||||||
//! \file
|
//! \file
|
||||||
//! \ingroup sampleweatherdata
|
//! \ingroup sampleweatherdata
|
||||||
|
|
||||||
#include "blackmisc/geo/latitude.h"
|
#include "blackmisc/geo/coordinategeodetic.h"
|
||||||
#include "blackmisc/geo/longitude.h"
|
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
@@ -35,7 +34,7 @@ protected:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
//! User is asking for weather data
|
//! 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
|
//! User is asking to quit
|
||||||
void quit();
|
void quit();
|
||||||
|
|||||||
@@ -51,8 +51,8 @@ void CWeatherDataPrinter::ps_printWeatherData()
|
|||||||
CWeatherGrid weatherGrid = m_weatherData->getWeatherData();
|
CWeatherGrid weatherGrid = m_weatherData->getWeatherData();
|
||||||
for (const CGridPoint &gridPoint : weatherGrid)
|
for (const CGridPoint &gridPoint : weatherGrid)
|
||||||
{
|
{
|
||||||
qtout << "Latitude:" << gridPoint.getLatitude().toQString() << endl;
|
qtout << "Latitude:" << gridPoint.getPosition().latitude().toQString() << endl;
|
||||||
qtout << "Longitude:" << gridPoint.getLongitude().toQString() << endl;
|
qtout << "Longitude:" << gridPoint.getPosition().longitude().toQString() << endl;
|
||||||
|
|
||||||
CTemperatureLayerList temperatureLayers = gridPoint.getTemperatureLayers();
|
CTemperatureLayerList temperatureLayers = gridPoint.getTemperatureLayers();
|
||||||
temperatureLayers.sort([](const CTemperatureLayer &a, const CTemperatureLayer &b) { return a.getLevel() < b.getLevel(); });
|
temperatureLayers.sort([](const CTemperatureLayer &a, const CTemperatureLayer &b) { return a.getLevel() < b.getLevel(); });
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
//! Fetch new weather data for given position and print it once received
|
//! 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:
|
private slots:
|
||||||
//! Print weather data to stdout
|
//! Print weather data to stdout
|
||||||
|
|||||||
@@ -13,8 +13,7 @@
|
|||||||
#define BLACKCORE_WEATHERDATA_H
|
#define BLACKCORE_WEATHERDATA_H
|
||||||
|
|
||||||
#include "blackcoreexport.h"
|
#include "blackcoreexport.h"
|
||||||
#include "blackmisc/geo/latitude.h"
|
#include "blackmisc/geo/coordinategeodetic.h"
|
||||||
#include "blackmisc/geo/longitude.h"
|
|
||||||
#include "blackmisc/weather/gridpoint.h"
|
#include "blackmisc/weather/gridpoint.h"
|
||||||
#include "blackmisc/weather/weathergrid.h"
|
#include "blackmisc/weather/weathergrid.h"
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|||||||
@@ -18,12 +18,12 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
namespace Weather
|
namespace Weather
|
||||||
{
|
{
|
||||||
CGridPoint::CGridPoint(const Geo::CLatitude &latitude, const Geo::CLongitude longitude,
|
CGridPoint::CGridPoint(const Geo::CCoordinateGeodetic &position,
|
||||||
const CCloudLayerList &cloudLayers,
|
const CCloudLayerList &cloudLayers,
|
||||||
const CTemperatureLayerList &temperatureLayers,
|
const CTemperatureLayerList &temperatureLayers,
|
||||||
const CVisibilityLayerList &visibilityLayers,
|
const CVisibilityLayerList &visibilityLayers,
|
||||||
const CWindLayerList &windLayers) :
|
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_temperatureLayers(temperatureLayers), m_visibilityLayers(visibilityLayers),
|
||||||
m_windLayers(windLayers)
|
m_windLayers(windLayers)
|
||||||
{ }
|
{ }
|
||||||
@@ -34,10 +34,8 @@ namespace BlackMisc
|
|||||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case IndexLatitude:
|
case IndexPosition:
|
||||||
return CVariant::fromValue(m_latitude);
|
return CVariant::fromValue(m_position);
|
||||||
case IndexLongitude:
|
|
||||||
return CVariant::fromValue(m_longitude);
|
|
||||||
case IndexCloudLayers:
|
case IndexCloudLayers:
|
||||||
return CVariant::fromValue(m_cloudLayers);
|
return CVariant::fromValue(m_cloudLayers);
|
||||||
case IndexTemperatureLayers:
|
case IndexTemperatureLayers:
|
||||||
@@ -55,11 +53,9 @@ namespace BlackMisc
|
|||||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case IndexLatitude:
|
case IndexPosition:
|
||||||
setLatitude(variant.value<CLatitude>());
|
setPosition(variant.value<CCoordinateGeodetic>());
|
||||||
break;
|
break;
|
||||||
case IndexLongitude:
|
|
||||||
setLongitude(variant.value<CLongitude>());
|
|
||||||
break;
|
break;
|
||||||
case IndexCloudLayers:
|
case IndexCloudLayers:
|
||||||
setCloudLayers(variant.value<CCloudLayerList>());
|
setCloudLayers(variant.value<CCloudLayerList>());
|
||||||
|
|||||||
@@ -15,8 +15,7 @@
|
|||||||
#include "blackmisc/blackmiscexport.h"
|
#include "blackmisc/blackmiscexport.h"
|
||||||
#include "blackmisc/valueobject.h"
|
#include "blackmisc/valueobject.h"
|
||||||
#include "blackmisc/propertyindex.h"
|
#include "blackmisc/propertyindex.h"
|
||||||
#include "blackmisc/geo/latitude.h"
|
#include "blackmisc/geo/coordinategeodetic.h"
|
||||||
#include "blackmisc/geo/longitude.h"
|
|
||||||
#include "blackmisc/weather/cloudlayerlist.h"
|
#include "blackmisc/weather/cloudlayerlist.h"
|
||||||
#include "blackmisc/weather/temperaturelayerlist.h"
|
#include "blackmisc/weather/temperaturelayerlist.h"
|
||||||
#include "blackmisc/weather/visibilitylayerlist.h"
|
#include "blackmisc/weather/visibilitylayerlist.h"
|
||||||
@@ -35,8 +34,7 @@ namespace BlackMisc
|
|||||||
//! Properties by index
|
//! Properties by index
|
||||||
enum ColumnIndex
|
enum ColumnIndex
|
||||||
{
|
{
|
||||||
IndexLatitude = BlackMisc::CPropertyIndex::GlobalIndexCGridPoint,
|
IndexPosition = BlackMisc::CPropertyIndex::GlobalIndexCGridPoint,
|
||||||
IndexLongitude,
|
|
||||||
IndexCloudLayers,
|
IndexCloudLayers,
|
||||||
IndexTemperatureLayers,
|
IndexTemperatureLayers,
|
||||||
IndexWindLayers
|
IndexWindLayers
|
||||||
@@ -46,23 +44,17 @@ namespace BlackMisc
|
|||||||
CGridPoint() = default;
|
CGridPoint() = default;
|
||||||
|
|
||||||
//! Constructor
|
//! Constructor
|
||||||
CGridPoint(const Geo::CLatitude &latitude, const Geo::CLongitude longitude,
|
CGridPoint(const Geo::CCoordinateGeodetic &position,
|
||||||
const CCloudLayerList &cloudLayers,
|
const CCloudLayerList &cloudLayers,
|
||||||
const CTemperatureLayerList &temperatureLayers,
|
const CTemperatureLayerList &temperatureLayers,
|
||||||
const CVisibilityLayerList &visibilityLayers,
|
const CVisibilityLayerList &visibilityLayers,
|
||||||
const CWindLayerList &windLayers);
|
const CWindLayerList &windLayers);
|
||||||
|
|
||||||
//! Set latitude
|
//! Set position
|
||||||
void setLatitude(const Geo::CLatitude &latitude) { m_latitude = latitude; }
|
void setPosition(const BlackMisc::Geo::CCoordinateGeodetic &position) { m_position = position; }
|
||||||
|
|
||||||
//! Get latitude
|
//! Get position
|
||||||
Geo::CLatitude getLatitude() const { return m_latitude; }
|
const BlackMisc::Geo::CCoordinateGeodetic getPosition() const { return m_position; }
|
||||||
|
|
||||||
//! Set longitude
|
|
||||||
void setLongitude(const Geo::CLongitude &longitude) { m_longitude = longitude; }
|
|
||||||
|
|
||||||
//! Get longitude
|
|
||||||
Geo::CLongitude getLongitude() const { return m_longitude; }
|
|
||||||
|
|
||||||
//! Set cloud layers
|
//! Set cloud layers
|
||||||
void setCloudLayers(const CCloudLayerList &cloudLayers) { m_cloudLayers = cloudLayers; }
|
void setCloudLayers(const CCloudLayerList &cloudLayers) { m_cloudLayers = cloudLayers; }
|
||||||
@@ -98,8 +90,7 @@ namespace BlackMisc
|
|||||||
QString convertToQString(bool i18n = false) const;
|
QString convertToQString(bool i18n = false) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Geo::CLatitude m_latitude;
|
BlackMisc::Geo::CCoordinateGeodetic m_position;
|
||||||
Geo::CLongitude m_longitude;
|
|
||||||
CCloudLayerList m_cloudLayers;
|
CCloudLayerList m_cloudLayers;
|
||||||
CTemperatureLayerList m_temperatureLayers;
|
CTemperatureLayerList m_temperatureLayers;
|
||||||
CVisibilityLayerList m_visibilityLayers;
|
CVisibilityLayerList m_visibilityLayers;
|
||||||
@@ -107,8 +98,7 @@ namespace BlackMisc
|
|||||||
|
|
||||||
BLACK_METACLASS(
|
BLACK_METACLASS(
|
||||||
CGridPoint,
|
CGridPoint,
|
||||||
BLACK_METAMEMBER(latitude),
|
BLACK_METAMEMBER(position),
|
||||||
BLACK_METAMEMBER(longitude),
|
|
||||||
BLACK_METAMEMBER(cloudLayers),
|
BLACK_METAMEMBER(cloudLayers),
|
||||||
BLACK_METAMEMBER(temperatureLayers),
|
BLACK_METAMEMBER(temperatureLayers),
|
||||||
BLACK_METAMEMBER(visibilityLayers),
|
BLACK_METAMEMBER(visibilityLayers),
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace BlackMisc
|
|||||||
|
|
||||||
static const CGridPoint gridPointGLOB =
|
static const CGridPoint gridPointGLOB =
|
||||||
{
|
{
|
||||||
{}, {},
|
{},
|
||||||
CCloudLayerList { cloudLayer },
|
CCloudLayerList { cloudLayer },
|
||||||
CTemperatureLayerList { temperatureLayer },
|
CTemperatureLayerList { temperatureLayer },
|
||||||
CVisibilityLayerList { visibilityLayer } ,
|
CVisibilityLayerList { visibilityLayer } ,
|
||||||
@@ -97,7 +97,7 @@ namespace BlackMisc
|
|||||||
|
|
||||||
static const CGridPoint gridPointGLOB
|
static const CGridPoint gridPointGLOB
|
||||||
{
|
{
|
||||||
{}, {},
|
{},
|
||||||
CCloudLayerList { cloudLayer1, cloudLayer2 },
|
CCloudLayerList { cloudLayer1, cloudLayer2 },
|
||||||
CTemperatureLayerList { temperatureLayer },
|
CTemperatureLayerList { temperatureLayer },
|
||||||
CVisibilityLayerList { visibilityLayer },
|
CVisibilityLayerList { visibilityLayer },
|
||||||
|
|||||||
@@ -270,7 +270,8 @@ namespace BlackWxPlugin
|
|||||||
|
|
||||||
CLatitude latitude(gfsGridPoint.latitude, CAngleUnit::deg());
|
CLatitude latitude(gfsGridPoint.latitude, CAngleUnit::deg());
|
||||||
CLongitude longitude(gfsGridPoint.longitude, 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);
|
m_weatherGrid.insert(gridPoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user