CWeatherGrid utility classes

Renamed Cavok to ClearWeather since CAVOK does not mean no clouds.
Find methods.

refs #612
This commit is contained in:
Roland Winklmeier
2016-03-26 21:24:49 +01:00
parent 5d93144c3c
commit a2de3a16e4
2 changed files with 30 additions and 3 deletions

View File

@@ -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()),