本文整理汇总了C++中WeatherData::setPressure方法的典型用法代码示例。如果您正苦于以下问题:C++ WeatherData::setPressure方法的具体用法?C++ WeatherData::setPressure怎么用?C++ WeatherData::setPressure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WeatherData
的用法示例。
在下文中一共展示了WeatherData::setPressure方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: coordinates
AbstractDataPluginItem *GeoNamesWeatherService::parse( const QScriptValue &value )
{
QString condition = value.property( "weatherCondition" ).toString();
QString clouds = value.property( "clouds" ).toString();
int windDirection = value.property( "windDirection" ).toInteger();
QString id = value.property( "ICAO" ).toString();
int temperature = value.property( "temperature" ).toInteger();
int windSpeed = value.property( "windSpeed" ).toInteger();
int humidity = value.property( "humidity" ).toInteger();
double pressure = value.property( "seaLevelPressure" ).toNumber();
QString name = value.property( "stationName" ).toString();
QDateTime date = QDateTime::fromString(
value.property( "datetime" ).toString(), "yyyy-MM-dd hh:mm:ss" );
double longitude = value.property( "lng" ).toNumber();
double latitude = value.property( "lat" ).toNumber();
if ( !id.isEmpty() ) {
WeatherData data;
// Weather condition
if ( clouds != "n/a" && condition != "n/a" ) {
if ( dayConditions.contains( condition ) ) {
data.setCondition( dayConditions[condition] );
} else {
mDebug() << "UNHANDLED GEONAMES WEATHER CONDITION, PLEASE REPORT: " << condition;
}
} else {
if ( dayConditions.contains( clouds ) ) {
data.setCondition( dayConditions[clouds] );
} else {
mDebug() << "UNHANDLED GEONAMES CLOUDS CONDITION, PLEASE REPORT: " << clouds;
}
}
// Wind direction. Finds the closest direction from windDirections array.
if ( windDirection >= 0 ) {
double tickSpacing = 360.0 / windDirections.size();
data.setWindDirection( windDirections[int(( windDirection / tickSpacing ) + 0.5)
% windDirections.size()] );
}
// Wind speed
if ( windSpeed != 0 ) {
data.setWindSpeed( windSpeed, WeatherData::knots );
}
// Temperature
data.setTemperature( temperature, WeatherData::Celsius );
// Humidity
data.setHumidity( humidity );
// Pressure
if ( pressure != 0.0 ) {
data.setPressure( pressure, WeatherData::HectoPascal );
}
// Date
data.setDataDate( date.date() );
data.setPublishingTime( date );
// ID
id = "geonames_" + id;
GeoDataCoordinates coordinates( longitude, latitude, 0.0, GeoDataCoordinates::Degree );
GeoNamesWeatherItem *item = new GeoNamesWeatherItem( this );
item->setMarbleWidget( marbleWidget() );
item->setId( id );
item->setCoordinate( coordinates );
item->setPriority( 0 );
item->setStationName( name );
item->setCurrentWeather( data );
return item;
} else {
return 0;
}
}