Extend GFS data and CGridPoint with surface pressure and temperature

This commit is contained in:
Roland Winklmeier
2016-03-28 21:09:01 +02:00
parent 9c869a16df
commit 5801962a99
6 changed files with 88 additions and 25 deletions

View File

@@ -30,13 +30,15 @@ namespace BlackMisc
const CCloudLayerList &cloudLayers,
const CTemperatureLayerList &temperatureLayers,
const CVisibilityLayerList &visibilityLayers,
const CWindLayerList &windLayers) :
const CWindLayerList &windLayers,
const CPressure &surfacePressure) :
m_identifier(identifier),
m_position(position),
m_cloudLayers(cloudLayers),
m_temperatureLayers(temperatureLayers),
m_visibilityLayers(visibilityLayers),
m_windLayers(windLayers)
m_windLayers(windLayers),
m_surfacePressure(surfacePressure)
{ }
void CGridPoint::copyWeatherDataFrom(const CGridPoint &other)
@@ -45,6 +47,7 @@ namespace BlackMisc
setTemperatureLayers(other.getTemperatureLayers());
setVisibilityLayers(other.getVisibilityLayers());
setWindLayers(other.getWindLayers());
setSurfacePressure(other.getSurfacePressure());
}
CVariant CGridPoint::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
@@ -63,6 +66,8 @@ namespace BlackMisc
return CVariant::fromValue(m_temperatureLayers);
case IndexWindLayers:
return CVariant::fromValue(m_windLayers);
case IndexSurfacePressure:
return CVariant::fromValue(m_surfacePressure);
default:
return CValueObject::propertyByIndex(index);
}
@@ -80,7 +85,6 @@ namespace BlackMisc
case IndexPosition:
setPosition(variant.value<CCoordinateGeodetic>());
break;
break;
case IndexCloudLayers:
setCloudLayers(variant.value<CCloudLayerList>());
break;
@@ -90,6 +94,9 @@ namespace BlackMisc
case IndexWindLayers:
setWindLayers(variant.value<CWindLayerList>());
break;
case IndexSurfacePressure:
setSurfacePressure(variant.value<CPressure>());
break;
default:
CValueObject::setPropertyByIndex(variant, index);
break;

View File

@@ -20,6 +20,7 @@
#include "blackmisc/weather/temperaturelayerlist.h"
#include "blackmisc/weather/visibilitylayerlist.h"
#include "blackmisc/weather/windlayerlist.h"
#include "blackmisc/pq/pressure.h"
namespace BlackMisc
{
@@ -38,7 +39,8 @@ namespace BlackMisc
IndexPosition,
IndexCloudLayers,
IndexTemperatureLayers,
IndexWindLayers
IndexWindLayers,
IndexSurfacePressure
};
//! Default constructor.
@@ -54,7 +56,8 @@ namespace BlackMisc
const CCloudLayerList &cloudLayers,
const CTemperatureLayerList &temperatureLayers,
const CVisibilityLayerList &visibilityLayers,
const CWindLayerList &windLayers);
const CWindLayerList &windLayers,
const PhysicalQuantities::CPressure &surfacePressure);
//! Set identifier
void setIdentifier(const QString &identifier) { m_identifier = identifier; }
@@ -95,6 +98,12 @@ namespace BlackMisc
//! Copies all weather data from other without modifying identifier and position.
void copyWeatherDataFrom(const CGridPoint &other);
//! Set surface pressure
void setSurfacePressure(const PhysicalQuantities::CPressure &pressure) { m_surfacePressure = pressure; }
//! Get surface pressure
PhysicalQuantities::CPressure getSurfacePressure() const { return m_surfacePressure; }
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
@@ -112,6 +121,7 @@ namespace BlackMisc
CTemperatureLayerList m_temperatureLayers;
CVisibilityLayerList m_visibilityLayers;
CWindLayerList m_windLayers;
PhysicalQuantities::CPressure m_surfacePressure = { 1013.25, PhysicalQuantities::CPressureUnit::hPa() };
BLACK_METACLASS(
CGridPoint,
@@ -120,7 +130,8 @@ namespace BlackMisc
BLACK_METAMEMBER(cloudLayers),
BLACK_METAMEMBER(temperatureLayers),
BLACK_METAMEMBER(visibilityLayers),
BLACK_METAMEMBER(windLayers)
BLACK_METAMEMBER(windLayers),
BLACK_METAMEMBER(surfacePressure)
);
};
} // namespace

View File

@@ -72,7 +72,8 @@ namespace BlackMisc
CCloudLayerList { cloudLayer },
CTemperatureLayerList { temperatureLayer },
CVisibilityLayerList { visibilityLayer } ,
CWindLayerList { windLayer }
CWindLayerList { windLayer },
{ 1013.25, PhysicalQuantities::CPressureUnit::hPa() }
};
static const CWeatherGrid weatherGrid = { gridPointGLOB };
@@ -123,7 +124,8 @@ namespace BlackMisc
CCloudLayerList { cloudLayer1, cloudLayer2 },
CTemperatureLayerList { temperatureLayer },
CVisibilityLayerList { visibilityLayer },
CWindLayerList { windLayer1, windLayer2 }
CWindLayerList { windLayer1, windLayer2 },
{ 1013.25, PhysicalQuantities::CPressureUnit::hPa() }
};
static const CWeatherGrid weatherGrid({ gridPointGLOB });