File indexing completed on 2024-05-12 15:31:20

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2011 Valery Kharitonov <kharvd@gmail.com>
0004 //
0005 
0006 #ifndef GEONAMESWEATHERSERVICE_H
0007 #define GEONAMESWEATHERSERVICE_H
0008 
0009 #include "AbstractWeatherService.h"
0010 #include "WeatherData.h"
0011 
0012 class QJsonObject;
0013 
0014 namespace Marble
0015 {
0016 
0017 class GeoNamesWeatherService : public AbstractWeatherService
0018 {
0019     Q_OBJECT
0020 
0021  public:
0022     explicit GeoNamesWeatherService( const MarbleModel *model, QObject *parent );
0023     ~GeoNamesWeatherService() override;
0024 
0025  public Q_SLOTS:
0026     void getAdditionalItems( const GeoDataLatLonAltBox& box,
0027                              qint32 number = 10 ) override;
0028     void getItem( const QString &id ) override;
0029     void parseFile( const QByteArray& file ) override;
0030 
0031  private:
0032     AbstractDataPluginItem* parse(const QJsonObject &weatherObservationObject);
0033     static void setupHashes();
0034 
0035     static QHash<QString, WeatherData::WeatherCondition> dayConditions;
0036     static QVector<WeatherData::WindDirection> windDirections;
0037 };
0038 
0039 } // namespace Marble
0040 
0041 #endif // GEONAMESWEATHERSERVICE_H