refs #484 Optimize getClosestObjects by using CSequence::partiallySort.

This commit is contained in:
Mathew Sutcliffe
2015-10-19 02:07:21 +01:00
parent eb45d7a409
commit c45157078f
2 changed files with 26 additions and 1 deletions

View File

@@ -50,6 +50,11 @@ namespace BlackMisc
*/
CONTAINER findWithinRange(const BlackMisc::Geo::ICoordinateGeodetic &coordinate, const BlackMisc::PhysicalQuantities::CLength &range) const;
/*!
* Find 0..n objects closest to the given coordinate.
*/
CONTAINER findClosest(int number, const BlackMisc::Geo::ICoordinateGeodetic &coordinate) const;
protected:
//! Constructor
IGeoObjectList();
@@ -79,6 +84,9 @@ namespace BlackMisc
//! If distance is already set, just sort
void sortByDistanceToOwnAircraft();
//! Sort the first n closest objects
void partiallySortByDistanceToOwnAircraft(int number);
//! Get n closest objects
CONTAINER getClosestObjects(int number) const;