mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 20:15:35 +08:00
Add methods to read weather grid from file
This commit is contained in:
committed by
Klaus Basan
parent
9f1a51fb13
commit
4b888d87f5
@@ -90,6 +90,23 @@ namespace BlackWxPlugin
|
||||
}
|
||||
}
|
||||
|
||||
void CWeatherDataGfs::fetchWeatherDataFromFile(const QString &filePath, const CWeatherGrid &grid, const CLength &range)
|
||||
{
|
||||
m_grid = grid;
|
||||
m_maxRange = range;
|
||||
|
||||
QFile file(filePath);
|
||||
if (!file.exists() || !file.open(QIODevice::ReadOnly)) { return; }
|
||||
m_gribData = file.readAll();
|
||||
|
||||
Q_ASSERT_X(!m_parseGribFileWorker, Q_FUNC_INFO, "Worker already running");
|
||||
m_parseGribFileWorker = BlackMisc::CWorker::fromTask(this, "parseGribFile", [this]()
|
||||
{
|
||||
parseGfsFileImpl(m_gribData);
|
||||
});
|
||||
m_parseGribFileWorker->then(this, &CWeatherDataGfs::fetchingWeatherDataFinished);
|
||||
}
|
||||
|
||||
CWeatherGrid CWeatherDataGfs::getWeatherData() const
|
||||
{
|
||||
QReadLocker l(&m_lockData);
|
||||
|
||||
@@ -50,6 +50,11 @@ namespace BlackWxPlugin
|
||||
virtual void fetchWeatherData(const BlackMisc::Weather::CWeatherGrid &grid,
|
||||
const BlackMisc::PhysicalQuantities::CLength &range) override;
|
||||
|
||||
//! \copydoc BlackCore::IWeatherData::fetchWeatherDataFromFile
|
||||
virtual void fetchWeatherDataFromFile(const QString &filePath,
|
||||
const BlackMisc::Weather::CWeatherGrid &grid,
|
||||
const BlackMisc::PhysicalQuantities::CLength &range) override;
|
||||
|
||||
//! \copydoc BlackCore::IWeatherData::getWeatherData()
|
||||
virtual BlackMisc::Weather::CWeatherGrid getWeatherData() const override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user