|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface SpatialIndex
Defines methods that must be implemented by all spatial indexes. This includes the RTree and its variants.
Method Summary | |
---|---|
void |
add(Rectangle r,
int id)
Adds a new rectangle to the spatial index |
void |
contains(Rectangle r,
gnu.trove.TIntProcedure ip)
Finds all rectangles contained by the passed rectangle. |
boolean |
delete(Rectangle r,
int id)
Deletes a rectangle from the spatial index |
Rectangle |
getBounds()
Returns the bounds of all the entries in the spatial index, or null if there are no entries. |
String |
getVersion()
Returns a string identifying the type of spatial index, and the version number, eg "SimpleIndex-0.1" |
void |
init(Properties props)
Initializes any implementation dependent properties of the spatial index. |
void |
intersects(Rectangle r,
gnu.trove.TIntProcedure ip)
Finds all rectangles that intersect the passed rectangle. |
void |
nearest(Point p,
gnu.trove.TIntProcedure v,
float furthestDistance)
Finds the nearest rectangles to the passed rectangle and calls v.execute(id) for each one. |
void |
nearestN(Point p,
gnu.trove.TIntProcedure v,
int n,
float distance)
Finds the N nearest rectangles to the passed rectangle, and calls execute(id, distance) on each one, in order of increasing distance. |
void |
nearestNUnsorted(Point p,
gnu.trove.TIntProcedure v,
int n,
float distance)
Same as nearestN, except the found rectangles are not returned in sorted order. |
int |
size()
Returns the number of entries in the spatial index |
Method Detail |
---|
void init(Properties props)
props
- The set of properties used to initialize the spatial index.void add(Rectangle r, int id)
r
- The rectangle to add to the spatial index.id
- The ID of the rectangle to add to the spatial index.
The result of adding more than one rectangle with
the same ID is undefined.boolean delete(Rectangle r, int id)
r
- The rectangle to delete from the spatial indexid
- The ID of the rectangle to delete from the spatial
index
void nearest(Point p, gnu.trove.TIntProcedure v, float furthestDistance)
p
- The point for which this method finds the
nearest neighbours.v
- The IntProcedure whose execute() method is is called
for each nearest neighbour.furthestDistance
- The furthest distance away from the rectangle
to search. Rectangles further than this will not be found.
This should be as small as possible to minimise
the search time.
Use Float.POSITIVE_INFINITY to guarantee that the nearest rectangle is found,
no matter how far away, although this will slow down the algorithm.void nearestN(Point p, gnu.trove.TIntProcedure v, int n, float distance)
p
- The point for which this method finds the
nearest neighbours.v
- The IntfloatProcedure whose execute() method is is called
for each nearest neighbour.n
- The desired number of rectangles to find (but note that
fewer or more may be returned)distance
- The furthest distance away from the rectangle
to search. Rectangles further than this will not be found.
This should be as small as possible to minimise
the search time.
Use Float.POSITIVE_INFINITY to guarantee that the nearest rectangle is found,
no matter how far away, although this will slow down the algorithm.void nearestNUnsorted(Point p, gnu.trove.TIntProcedure v, int n, float distance)
void intersects(Rectangle r, gnu.trove.TIntProcedure ip)
r
- The rectangle for which this method finds
intersecting rectangles.ip
- The IntProcedure whose execute() method is is called
for each intersecting rectangle.void contains(Rectangle r, gnu.trove.TIntProcedure ip)
r
- The rectangle for which this method finds
contained rectangles.ip
- The procedure whose visit() method is is called
for each contained rectangle.int size()
Rectangle getBounds()
String getVersion()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |