mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 12:55:31 +08:00
Use CApplications QNetworkAccessManager to download GFS data
This commit is contained in:
committed by
Mathew Sutcliffe
parent
115ad150b2
commit
2cea07f174
@@ -8,6 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "weatherdatagfs.h"
|
#include "weatherdatagfs.h"
|
||||||
|
#include "blackcore/application.h"
|
||||||
#include "blackmisc/worker.h"
|
#include "blackmisc/worker.h"
|
||||||
#include "blackmisc/logmessage.h"
|
#include "blackmisc/logmessage.h"
|
||||||
#include "blackmisc/math/mathutils.h"
|
#include "blackmisc/math/mathutils.h"
|
||||||
@@ -51,11 +52,8 @@ namespace BlackWxPlugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
CWeatherDataGfs::CWeatherDataGfs(QObject *parent) :
|
CWeatherDataGfs::CWeatherDataGfs(QObject *parent) :
|
||||||
IWeatherData(parent),
|
IWeatherData(parent)
|
||||||
m_networkAccessManager(this)
|
{ }
|
||||||
{
|
|
||||||
connect(&m_networkAccessManager, &QNetworkAccessManager::finished, this, &CWeatherDataGfs::ps_parseGfsFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CWeatherDataGfs::fetchWeatherData(const CWeatherGrid &grid, const CLength &range)
|
void CWeatherDataGfs::fetchWeatherData(const CWeatherGrid &grid, const CLength &range)
|
||||||
{
|
{
|
||||||
@@ -67,7 +65,7 @@ namespace BlackWxPlugin
|
|||||||
QUrl url = getDownloadUrl();
|
QUrl url = getDownloadUrl();
|
||||||
CLogMessage(this).debug() << "Download url:" << url.toString();
|
CLogMessage(this).debug() << "Download url:" << url.toString();
|
||||||
QNetworkRequest request(url);
|
QNetworkRequest request(url);
|
||||||
m_networkAccessManager.get(request);
|
sApp->getFromNetwork(request, { this, &CWeatherDataGfs::ps_parseGfsFile });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,8 +19,8 @@
|
|||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QNetworkAccessManager>
|
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
|
#include <QNetworkReply>
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
class QNetworkAccessManager;
|
class QNetworkAccessManager;
|
||||||
@@ -157,7 +157,6 @@ namespace BlackWxPlugin
|
|||||||
|
|
||||||
mutable QReadWriteLock m_lockData;
|
mutable QReadWriteLock m_lockData;
|
||||||
QByteArray m_gribData;
|
QByteArray m_gribData;
|
||||||
QNetworkAccessManager m_networkAccessManager;
|
|
||||||
|
|
||||||
QVector<GfsGridPoint> m_gfsWeatherGrid;
|
QVector<GfsGridPoint> m_gfsWeatherGrid;
|
||||||
BlackMisc::Weather::CWeatherGrid m_weatherGrid;
|
BlackMisc::Weather::CWeatherGrid m_weatherGrid;
|
||||||
|
|||||||
Reference in New Issue
Block a user