mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
CWeatherGrid utility classes
Renamed Cavok to ClearWeather since CAVOK does not mean no clouds. Find methods. refs #612
This commit is contained in:
@@ -8,9 +8,11 @@
|
||||
*/
|
||||
|
||||
#include "weathergrid.h"
|
||||
#include "blackmisc/geo/coordinategeodetic.h"
|
||||
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::Geo;
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
@@ -20,7 +22,25 @@ namespace BlackMisc
|
||||
CSequence<CGridPoint>(other)
|
||||
{ }
|
||||
|
||||
const CWeatherGrid &CWeatherGrid::getCavokGrid()
|
||||
CWeatherGrid CWeatherGrid::findWithinRange(const ICoordinateGeodetic &coordinate, const PhysicalQuantities::CLength &range) const
|
||||
{
|
||||
return findBy([&](const CGridPoint & gridPoint)
|
||||
{
|
||||
return calculateGreatCircleDistance(gridPoint.getPosition(), coordinate) <= range;
|
||||
});
|
||||
}
|
||||
|
||||
CWeatherGrid CWeatherGrid::findClosest(int number, const ICoordinateGeodetic &coordinate) const
|
||||
{
|
||||
CWeatherGrid closest = partiallySorted(number, [ & ](const CGridPoint & a, const CGridPoint & b)
|
||||
{
|
||||
return calculateEuclideanDistanceSquared(a.getPosition(), coordinate) < calculateEuclideanDistanceSquared(b.getPosition(), coordinate);
|
||||
});
|
||||
closest.truncate(number);
|
||||
return closest;
|
||||
}
|
||||
|
||||
const CWeatherGrid &CWeatherGrid::getClearWeatherGrid()
|
||||
{
|
||||
static const CVisibilityLayer visibilityLayer(
|
||||
CAltitude(0, CAltitude::MeanSeaLevel, CLengthUnit::m()),
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "gridpoint.h"
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
#include "blackmisc/sequence.h"
|
||||
#include "blackmisc/geo/geoobjectlist.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
@@ -39,8 +40,14 @@ namespace BlackMisc
|
||||
//! Construct from a base class object.
|
||||
CWeatherGrid(const CSequence<CGridPoint> &other);
|
||||
|
||||
//! CAVOK grid
|
||||
static const BlackMisc::Weather::CWeatherGrid &getCavokGrid();
|
||||
//! \copydoc Geo::IGeoObjectList::findWithinRange
|
||||
CWeatherGrid findWithinRange(const BlackMisc::Geo::ICoordinateGeodetic &coordinate, const BlackMisc::PhysicalQuantities::CLength &range) const;
|
||||
|
||||
//! \copydoc Geo::IGeoObjectList::findClosest
|
||||
CWeatherGrid findClosest(int number, const BlackMisc::Geo::ICoordinateGeodetic &coordinate) const;
|
||||
|
||||
//! Clear weather grid
|
||||
static const BlackMisc::Weather::CWeatherGrid &getClearWeatherGrid();
|
||||
|
||||
//! Thunderstorm grid
|
||||
static const BlackMisc::Weather::CWeatherGrid &getThunderStormGrid();
|
||||
|
||||
Reference in New Issue
Block a user