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

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2009 Bastian Holst <bastianholst@gmx.de>
0004 //
0005 
0006 // Self
0007 #include "FakeWeatherService.h"
0008 
0009 // Marble
0010 #include "FakeWeatherItem.h"
0011 #include "GeoDataCoordinates.h"
0012 #include "GeoDataLatLonAltBox.h"
0013 #include "WeatherData.h"
0014 #include "WeatherModel.h"
0015 
0016 using namespace Marble;
0017 
0018 FakeWeatherService::FakeWeatherService( const MarbleModel *model, QObject *parent )
0019     : AbstractWeatherService( model, parent )
0020 {
0021 }
0022 
0023 FakeWeatherService::~FakeWeatherService()
0024 {
0025 }
0026     
0027 void FakeWeatherService::getAdditionalItems( const GeoDataLatLonAltBox& box,
0028                          qint32 number )
0029 {
0030     Q_UNUSED( box );
0031     Q_UNUSED( number );
0032 
0033     FakeWeatherItem *item = new FakeWeatherItem( this );
0034     item->setStationName( "Fake" );
0035     item->setPriority( 0 );
0036     item->setCoordinate( GeoDataCoordinates( 1, 1 ) );
0037     item->setId( "fake1" );
0038     
0039     WeatherData data;
0040     data.setCondition( WeatherData::ClearDay );
0041     data.setTemperature( 14.0, WeatherData::Celsius );
0042     item->setCurrentWeather( data );
0043         
0044     emit createdItems( QList<AbstractDataPluginItem*>() << item );
0045 }
0046 
0047 void FakeWeatherService::getItem( const QString & )
0048 {
0049     getAdditionalItems( GeoDataLatLonAltBox(), 1 );
0050 }
0051 
0052 #include "moc_FakeWeatherService.cpp"