mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-14 00:25:35 +08:00
Send distance if own aircraft has been moved
This commit is contained in:
committed by
Mat Sutcliffe
parent
8278a7d5e6
commit
668659248e
@@ -197,6 +197,17 @@ namespace BlackMisc
|
||||
return closest;
|
||||
}
|
||||
|
||||
template<class OBJ, class CONTAINER>
|
||||
CONTAINER IGeoObjectList<OBJ, CONTAINER>::findFarthest(int number, const ICoordinateGeodetic &coordinate) const
|
||||
{
|
||||
CONTAINER farthest = this->container().partiallySorted(number, [ & ](const OBJ & a, const OBJ & b)
|
||||
{
|
||||
return calculateEuclideanDistanceSquared(a, coordinate) > calculateEuclideanDistanceSquared(b, coordinate);
|
||||
});
|
||||
farthest.truncate(number);
|
||||
return farthest;
|
||||
}
|
||||
|
||||
template<class OBJ, class CONTAINER>
|
||||
OBJ IGeoObjectList<OBJ, CONTAINER>::findClosestWithinRange(const ICoordinateGeodetic &coordinate, const CLength &range) const
|
||||
{
|
||||
@@ -225,7 +236,7 @@ namespace BlackMisc
|
||||
}
|
||||
|
||||
template<class OBJ, class CONTAINER>
|
||||
CONTAINER IGeoObjectList<OBJ, CONTAINER>::sortedByEuclideanDistanceSquared(const ICoordinateGeodetic &coordinate)
|
||||
CONTAINER IGeoObjectList<OBJ, CONTAINER>::sortedByEuclideanDistanceSquared(const ICoordinateGeodetic &coordinate) const
|
||||
{
|
||||
CONTAINER copy(this->container());
|
||||
copy.sortByEuclideanDistanceSquared(coordinate);
|
||||
|
||||
@@ -103,6 +103,9 @@ namespace BlackMisc
|
||||
//! Find 0..n objects closest to the given coordinate.
|
||||
CONTAINER findClosest(int number, const ICoordinateGeodetic &coordinate) const;
|
||||
|
||||
//! Find 0..n objects farthest to the given coordinate.
|
||||
CONTAINER findFarthest(int number, const ICoordinateGeodetic &coordinate) const;
|
||||
|
||||
//! Find closest within range to the given coordinate
|
||||
OBJ findClosestWithinRange(const ICoordinateGeodetic &coordinate, const PhysicalQuantities::CLength &range) const;
|
||||
|
||||
@@ -110,7 +113,7 @@ namespace BlackMisc
|
||||
void sortByEuclideanDistanceSquared(const ICoordinateGeodetic &coordinate);
|
||||
|
||||
//! Sorted by distance
|
||||
CONTAINER sortedByEuclideanDistanceSquared(const ICoordinateGeodetic &coordinate);
|
||||
CONTAINER sortedByEuclideanDistanceSquared(const ICoordinateGeodetic &coordinate) const;
|
||||
|
||||
protected:
|
||||
//! Constructor
|
||||
|
||||
Reference in New Issue
Block a user