mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-02 15:15:39 +08:00
@@ -72,6 +72,7 @@ namespace BlackMisc
|
|||||||
GlobalIndexCWindLayer = 4300,
|
GlobalIndexCWindLayer = 4300,
|
||||||
GlobalIndexCTemperatureLayer = 4400,
|
GlobalIndexCTemperatureLayer = 4400,
|
||||||
GlobalIndexCGridPoint = 4500,
|
GlobalIndexCGridPoint = 4500,
|
||||||
|
GlobalIndexCVisibilityLayer = 4600,
|
||||||
GlobalIndexICoordinateGeodetic = 5000,
|
GlobalIndexICoordinateGeodetic = 5000,
|
||||||
GlobalIndexCCoordinateGeodetic = 5100,
|
GlobalIndexCCoordinateGeodetic = 5100,
|
||||||
GlobalIndexCClient = 6000,
|
GlobalIndexCClient = 6000,
|
||||||
|
|||||||
@@ -23,9 +23,11 @@ namespace BlackMisc
|
|||||||
CGridPoint::CGridPoint(const Geo::CLatitude &latitude, const Geo::CLongitude longitude,
|
CGridPoint::CGridPoint(const Geo::CLatitude &latitude, const Geo::CLongitude longitude,
|
||||||
const CCloudLayerList &cloudLayers,
|
const CCloudLayerList &cloudLayers,
|
||||||
const CTemperatureLayerList &temperatureLayers,
|
const CTemperatureLayerList &temperatureLayers,
|
||||||
|
const CVisibilityLayerList &visibilityLayers,
|
||||||
const CWindLayerList &windLayers) :
|
const CWindLayerList &windLayers) :
|
||||||
m_latitude(latitude), m_longitude(longitude), m_cloudLayers(cloudLayers),
|
m_latitude(latitude), m_longitude(longitude), m_cloudLayers(cloudLayers),
|
||||||
m_temperatureLayers(temperatureLayers), m_windLayers(windLayers)
|
m_temperatureLayers(temperatureLayers), m_visibilityLayers(visibilityLayers),
|
||||||
|
m_windLayers(windLayers)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
CVariant CGridPoint::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
CVariant CGridPoint::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include "blackmisc/geo/longitude.h"
|
#include "blackmisc/geo/longitude.h"
|
||||||
#include "blackmisc/weather/cloudlayerlist.h"
|
#include "blackmisc/weather/cloudlayerlist.h"
|
||||||
#include "blackmisc/weather/temperaturelayerlist.h"
|
#include "blackmisc/weather/temperaturelayerlist.h"
|
||||||
|
#include "blackmisc/weather/visibilitylayerlist.h"
|
||||||
#include "blackmisc/weather/windlayerlist.h"
|
#include "blackmisc/weather/windlayerlist.h"
|
||||||
|
|
||||||
namespace BlackMisc
|
namespace BlackMisc
|
||||||
@@ -49,6 +50,7 @@ namespace BlackMisc
|
|||||||
CGridPoint(const Geo::CLatitude &latitude, const Geo::CLongitude longitude,
|
CGridPoint(const Geo::CLatitude &latitude, const Geo::CLongitude longitude,
|
||||||
const CCloudLayerList &cloudLayers,
|
const CCloudLayerList &cloudLayers,
|
||||||
const CTemperatureLayerList &temperatureLayers,
|
const CTemperatureLayerList &temperatureLayers,
|
||||||
|
const CVisibilityLayerList &visibilityLayers,
|
||||||
const CWindLayerList &windLayers);
|
const CWindLayerList &windLayers);
|
||||||
|
|
||||||
//! Set latitude
|
//! Set latitude
|
||||||
@@ -75,6 +77,12 @@ namespace BlackMisc
|
|||||||
//! Get temperature layers
|
//! Get temperature layers
|
||||||
CTemperatureLayerList getTemperatureLayers() const { return m_temperatureLayers; }
|
CTemperatureLayerList getTemperatureLayers() const { return m_temperatureLayers; }
|
||||||
|
|
||||||
|
//! Set visibility layers
|
||||||
|
void setVisibilityLayers(const CVisibilityLayerList &visibilityLayers) { m_visibilityLayers = visibilityLayers; }
|
||||||
|
|
||||||
|
//! Get visibility layers
|
||||||
|
CVisibilityLayerList getVisibilityLayers() const { return m_visibilityLayers; }
|
||||||
|
|
||||||
//! Set wind layers
|
//! Set wind layers
|
||||||
void setWindLayers(const CWindLayerList &windLayers) { m_windLayers = windLayers; }
|
void setWindLayers(const CWindLayerList &windLayers) { m_windLayers = windLayers; }
|
||||||
|
|
||||||
@@ -96,7 +104,9 @@ namespace BlackMisc
|
|||||||
Geo::CLongitude m_longitude;
|
Geo::CLongitude m_longitude;
|
||||||
CCloudLayerList m_cloudLayers;
|
CCloudLayerList m_cloudLayers;
|
||||||
CTemperatureLayerList m_temperatureLayers;
|
CTemperatureLayerList m_temperatureLayers;
|
||||||
|
CVisibilityLayerList m_visibilityLayers;
|
||||||
CWindLayerList m_windLayers;
|
CWindLayerList m_windLayers;
|
||||||
|
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
@@ -107,6 +117,7 @@ BLACK_DECLARE_TUPLE_CONVERSION(BlackMisc::Weather::CGridPoint, (
|
|||||||
attr(o.m_longitude),
|
attr(o.m_longitude),
|
||||||
attr(o.m_cloudLayers),
|
attr(o.m_cloudLayers),
|
||||||
attr(o.m_temperatureLayers),
|
attr(o.m_temperatureLayers),
|
||||||
|
attr(o.m_visibilityLayers),
|
||||||
attr(o.m_windLayers)
|
attr(o.m_windLayers)
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ namespace BlackMisc
|
|||||||
CPresentWeatherList::registerMetadata();
|
CPresentWeatherList::registerMetadata();
|
||||||
CTemperatureLayer::registerMetadata();
|
CTemperatureLayer::registerMetadata();
|
||||||
CTemperatureLayerList::registerMetadata();
|
CTemperatureLayerList::registerMetadata();
|
||||||
|
CVisibilityLayer::registerMetadata();
|
||||||
|
CVisibilityLayerList::registerMetadata();
|
||||||
CWeatherDataPluginInfo::registerMetadata();
|
CWeatherDataPluginInfo::registerMetadata();
|
||||||
CWeatherDataPluginInfoList::registerMetadata();
|
CWeatherDataPluginInfoList::registerMetadata();
|
||||||
CWeatherGrid::registerMetadata();
|
CWeatherGrid::registerMetadata();
|
||||||
|
|||||||
75
src/blackmisc/weather/visibilitylayer.cpp
Normal file
75
src/blackmisc/weather/visibilitylayer.cpp
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
/* Copyright (C) 2016
|
||||||
|
* swift project Community / Contributors
|
||||||
|
*
|
||||||
|
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||||
|
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||||
|
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||||
|
* contained in the LICENSE file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "blackmisc/weather/visibilitylayer.h"
|
||||||
|
#include "blackmisc/propertyindex.h"
|
||||||
|
#include "blackmisc/blackmiscfreefunctions.h"
|
||||||
|
#include "blackmisc/variant.h"
|
||||||
|
|
||||||
|
using namespace BlackMisc::PhysicalQuantities;
|
||||||
|
using namespace BlackMisc::Aviation;
|
||||||
|
|
||||||
|
namespace BlackMisc
|
||||||
|
{
|
||||||
|
namespace Weather
|
||||||
|
{
|
||||||
|
|
||||||
|
CVisibilityLayer::CVisibilityLayer(const BlackMisc::Aviation::CAltitude &base,
|
||||||
|
const BlackMisc::Aviation::CAltitude &top,
|
||||||
|
const PhysicalQuantities::CLength &visibility) :
|
||||||
|
m_base(base), m_top(top), m_visibility(visibility)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
CVariant CVisibilityLayer::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||||
|
{
|
||||||
|
if (index.isMyself()) { return CVariant::from(*this); }
|
||||||
|
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||||
|
switch (i)
|
||||||
|
{
|
||||||
|
case IndexBase:
|
||||||
|
return CVariant::fromValue(m_base);
|
||||||
|
case IndexTop:
|
||||||
|
return CVariant::fromValue(m_top);
|
||||||
|
case IndexVisibility:
|
||||||
|
return CVariant::fromValue(m_visibility);
|
||||||
|
default:
|
||||||
|
return CValueObject::propertyByIndex(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CVisibilityLayer::setPropertyByIndex(const CVariant &variant, const BlackMisc::CPropertyIndex &index)
|
||||||
|
{
|
||||||
|
if (index.isMyself()) { (*this) = variant.to<CVisibilityLayer>(); return; }
|
||||||
|
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||||
|
switch (i)
|
||||||
|
{
|
||||||
|
case IndexBase:
|
||||||
|
setBase(variant.value<CAltitude>());
|
||||||
|
break;
|
||||||
|
case IndexTop:
|
||||||
|
setTop(variant.value<CAltitude>());
|
||||||
|
break;
|
||||||
|
case IndexVisibility:
|
||||||
|
setVisibility(variant.value<CLength>());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
CValueObject::setPropertyByIndex(variant, index);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CVisibilityLayer::convertToQString(bool /** i18n **/) const
|
||||||
|
{
|
||||||
|
QString visibilityAsString = QString("Visibility: %1 from %2 to %3");
|
||||||
|
visibilityAsString = visibilityAsString.arg(m_visibility.toQString(), m_base.toQString(), m_top.toQString());
|
||||||
|
return visibilityAsString;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
} // namespace
|
||||||
91
src/blackmisc/weather/visibilitylayer.h
Normal file
91
src/blackmisc/weather/visibilitylayer.h
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
/* Copyright (C) 2015
|
||||||
|
* swift project Community / Contributors
|
||||||
|
*
|
||||||
|
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||||
|
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||||
|
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||||
|
* contained in the LICENSE file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
//! \file
|
||||||
|
|
||||||
|
#ifndef BLACKMISC_WEATHER_VISIBILITYLAYER_H
|
||||||
|
#define BLACKMISC_WEATHER_VISIBILITYLAYER_H
|
||||||
|
|
||||||
|
#include "blackmisc/blackmiscexport.h"
|
||||||
|
#include "blackmisc/valueobject.h"
|
||||||
|
#include "blackmisc/propertyindex.h"
|
||||||
|
#include "blackmisc/aviation/altitude.h"
|
||||||
|
#include "blackmisc/pq/length.h"
|
||||||
|
|
||||||
|
namespace BlackMisc
|
||||||
|
{
|
||||||
|
namespace Weather
|
||||||
|
{
|
||||||
|
/*!
|
||||||
|
* Value object for a visibility layer
|
||||||
|
*/
|
||||||
|
class BLACKMISC_EXPORT CVisibilityLayer : public CValueObject<CVisibilityLayer>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Properties by index
|
||||||
|
enum ColumnIndex
|
||||||
|
{
|
||||||
|
IndexBase = BlackMisc::CPropertyIndex::GlobalIndexCVisibilityLayer,
|
||||||
|
IndexTop,
|
||||||
|
IndexVisibility,
|
||||||
|
};
|
||||||
|
|
||||||
|
//! Default constructor.
|
||||||
|
CVisibilityLayer() = default;
|
||||||
|
|
||||||
|
//! Constructor
|
||||||
|
CVisibilityLayer(const BlackMisc::Aviation::CAltitude &base,
|
||||||
|
const BlackMisc::Aviation::CAltitude &top,
|
||||||
|
const PhysicalQuantities::CLength &visibility);
|
||||||
|
|
||||||
|
//! Set base
|
||||||
|
void setBase(const BlackMisc::Aviation::CAltitude &base) { m_base = base; }
|
||||||
|
|
||||||
|
//! Get base
|
||||||
|
BlackMisc::Aviation::CAltitude getBase() const { return m_base; }
|
||||||
|
|
||||||
|
//! Set top
|
||||||
|
void setTop(const BlackMisc::Aviation::CAltitude &top) { m_top = top; }
|
||||||
|
|
||||||
|
//! Get top
|
||||||
|
BlackMisc::Aviation::CAltitude getTop() const { return m_top; }
|
||||||
|
|
||||||
|
//! Set visibility
|
||||||
|
void setVisibility(const PhysicalQuantities::CLength &visibility) { m_visibility = visibility; }
|
||||||
|
|
||||||
|
//! Get visibility
|
||||||
|
PhysicalQuantities::CLength getVisibility() const { return m_visibility; }
|
||||||
|
|
||||||
|
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
||||||
|
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
||||||
|
|
||||||
|
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
||||||
|
void setPropertyByIndex(const CVariant &variant, const BlackMisc::CPropertyIndex &index);
|
||||||
|
|
||||||
|
//! \copydoc BlackMisc::Mixin::String::toQString
|
||||||
|
QString convertToQString(bool i18n = false) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
BLACK_ENABLE_TUPLE_CONVERSION(CVisibilityLayer)
|
||||||
|
BlackMisc::Aviation::CAltitude m_base;
|
||||||
|
BlackMisc::Aviation::CAltitude m_top;
|
||||||
|
PhysicalQuantities::CLength m_visibility;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE(BlackMisc::Weather::CVisibilityLayer)
|
||||||
|
BLACK_DECLARE_TUPLE_CONVERSION(BlackMisc::Weather::CVisibilityLayer, (
|
||||||
|
attr(o.m_base),
|
||||||
|
attr(o.m_top),
|
||||||
|
attr(o.m_visibility)
|
||||||
|
))
|
||||||
|
|
||||||
|
#endif // guard
|
||||||
33
src/blackmisc/weather/visibilitylayerlist.cpp
Normal file
33
src/blackmisc/weather/visibilitylayerlist.cpp
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
/* Copyright (C) 2016
|
||||||
|
* swift project Community / Contributors
|
||||||
|
*
|
||||||
|
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||||
|
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||||
|
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||||
|
* contained in the LICENSE file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "visibilitylayerlist.h"
|
||||||
|
|
||||||
|
using namespace BlackMisc::Aviation;
|
||||||
|
|
||||||
|
namespace BlackMisc
|
||||||
|
{
|
||||||
|
namespace Weather
|
||||||
|
{
|
||||||
|
CVisibilityLayerList::CVisibilityLayerList(const CSequence<CVisibilityLayer> &other) :
|
||||||
|
CSequence<CVisibilityLayer>(other)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
bool CVisibilityLayerList::containsBase(const CAltitude &base) const
|
||||||
|
{
|
||||||
|
return contains(&CVisibilityLayer::getBase, base);
|
||||||
|
}
|
||||||
|
|
||||||
|
CVisibilityLayer CVisibilityLayerList::findByBase(const CAltitude &base) const
|
||||||
|
{
|
||||||
|
return findFirstByOrDefault(&CVisibilityLayer::getBase, base);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
} // namespace
|
||||||
55
src/blackmisc/weather/visibilitylayerlist.h
Normal file
55
src/blackmisc/weather/visibilitylayerlist.h
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
/* Copyright (C) 2016
|
||||||
|
* swift project Community / Contributors
|
||||||
|
*
|
||||||
|
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||||
|
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||||
|
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||||
|
* contained in the LICENSE file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
//! \file
|
||||||
|
|
||||||
|
#ifndef BLACKMISC_WEATHER_VISIBILITYLAYERLIST_H
|
||||||
|
#define BLACKMISC_WEATHER_VISIBILITYLAYERLIST_H
|
||||||
|
|
||||||
|
#include "visibilitylayer.h"
|
||||||
|
#include "blackmisc/blackmiscexport.h"
|
||||||
|
#include "blackmisc/sequence.h"
|
||||||
|
|
||||||
|
namespace BlackMisc
|
||||||
|
{
|
||||||
|
namespace Weather
|
||||||
|
{
|
||||||
|
/*!
|
||||||
|
* Value object encapsulating a set of visibility layers
|
||||||
|
*/
|
||||||
|
class BLACKMISC_EXPORT CVisibilityLayerList :
|
||||||
|
public CSequence<CVisibilityLayer>,
|
||||||
|
public BlackMisc::Mixin::MetaType<CVisibilityLayerList>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BLACKMISC_DECLARE_USING_MIXIN_METATYPE(CVisibilityLayerList)
|
||||||
|
|
||||||
|
//! Default constructor.
|
||||||
|
CVisibilityLayerList() = default;
|
||||||
|
|
||||||
|
//! Initializer list constructor.
|
||||||
|
CVisibilityLayerList(std::initializer_list<CVisibilityLayer> il) : CSequence<CVisibilityLayer>(il) {}
|
||||||
|
|
||||||
|
//! Construct from a base class object.
|
||||||
|
CVisibilityLayerList(const CSequence<CVisibilityLayer> &other);
|
||||||
|
|
||||||
|
//! Contains visibility layer with base?
|
||||||
|
bool containsBase(const BlackMisc::Aviation::CAltitude &base) const;
|
||||||
|
|
||||||
|
//! Find visibility layer by base
|
||||||
|
CVisibilityLayer findByBase(const BlackMisc::Aviation::CAltitude &base) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
} //namespace
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE(BlackMisc::Weather::CVisibilityLayerList)
|
||||||
|
Q_DECLARE_METATYPE(BlackMisc::CSequence<BlackMisc::Weather::CVisibilityLayer>)
|
||||||
|
|
||||||
|
#endif //guard
|
||||||
@@ -26,6 +26,8 @@
|
|||||||
#include "blackmisc/weather/presentweatherlist.h"
|
#include "blackmisc/weather/presentweatherlist.h"
|
||||||
#include "blackmisc/weather/temperaturelayer.h"
|
#include "blackmisc/weather/temperaturelayer.h"
|
||||||
#include "blackmisc/weather/temperaturelayerlist.h"
|
#include "blackmisc/weather/temperaturelayerlist.h"
|
||||||
|
#include "blackmisc/weather/visibilitylayer.h"
|
||||||
|
#include "blackmisc/weather/visibilitylayerlist.h"
|
||||||
#include "blackmisc/weather/weatherdataplugininfo.h"
|
#include "blackmisc/weather/weatherdataplugininfo.h"
|
||||||
#include "blackmisc/weather/weatherdataplugininfolist.h"
|
#include "blackmisc/weather/weatherdataplugininfolist.h"
|
||||||
#include "blackmisc/weather/weathergrid.h"
|
#include "blackmisc/weather/weathergrid.h"
|
||||||
|
|||||||
@@ -270,7 +270,7 @@ namespace BlackWxPlugin
|
|||||||
|
|
||||||
CLatitude latitude(gfsGridPoint.latitude, CAngleUnit::deg());
|
CLatitude latitude(gfsGridPoint.latitude, CAngleUnit::deg());
|
||||||
CLongitude longitude(gfsGridPoint.longitude, CAngleUnit::deg());
|
CLongitude longitude(gfsGridPoint.longitude, CAngleUnit::deg());
|
||||||
BlackMisc::Weather::CGridPoint gridPoint(latitude, longitude, cloudLayers, temperatureLayers, windLayers);
|
BlackMisc::Weather::CGridPoint gridPoint(latitude, longitude, cloudLayers, temperatureLayers, {}, windLayers);
|
||||||
m_weatherGrid.insert(gridPoint);
|
m_weatherGrid.insert(gridPoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user