T
- the type of coordinate.public interface CoordinateIndex<T extends Coordinate>
Coordinate
s that can
have points added to it and can be searched in a variety of ways.Modifier and Type | Method and Description |
---|---|
void |
insert(T point)
Insert a single coordinate into the index.
|
void |
kNearestNeighbour(Collection<T> result,
Coordinate query,
int k)
Find the k nearest neighbour points in the index to
the query coordinate.
|
T |
nearestNeighbour(Coordinate query)
Find the nearest coordinate in the index to the query
coordinate.
|
void |
rangeSearch(Collection<T> results,
Coordinate lowerExtreme,
Coordinate upperExtreme)
Search for all the coordinates in the index that
lie in the hyper-rectangle defined by the lower and
upper bound coordinates.
|
void insert(T point)
point
- coordinate to add.void rangeSearch(Collection<T> results, Coordinate lowerExtreme, Coordinate upperExtreme)
results
- Collection to hold the found coordinates.lowerExtreme
- Lower bound of the hyper-rectangle.upperExtreme
- Upper bound of the hyper-rectangle.T nearestNeighbour(Coordinate query)
query
- The query coordinate.void kNearestNeighbour(Collection<T> result, Coordinate query, int k)
result
- Collection to hold the found coordinates.query
- The query coordinate.k
- The number of neighbours to find.