|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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,
IntProcedure ip)
Finds all rectangles contained by the passed rectangle. |
boolean |
delete(Rectangle r,
int id)
Deletes a rectangle from the spatial index |
java.lang.String |
getVersion()
Returns a string identifying the type of spatial index, and the version number, eg "SimpleIndex-1.0b1" |
void |
init(java.util.Properties props)
Initializes any implementation dependent properties of the spatial index. |
void |
intersects(Rectangle r,
IntProcedure ip)
Finds all rectangles that intersect the passed rectangle. |
void |
nearest(Point p,
IntProcedure v,
float distance)
Finds all rectangles that are nearest to the passed rectangle, and calls execute() on the passed IntProcedure for each one. |
int |
size()
Returns the number of entries in the spatial index |
Method Detail |
public void init(java.util.Properties props)
props
- The set of properties used to initialize the spatial index.public 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.public 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
public void nearest(Point p, IntProcedure v, float distance)
p
- The point for which this method finds the
nearest neighbours.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.public void intersects(Rectangle r, IntProcedure ip)
r
- The rectangle for which this method finds
intersecting rectangles.ip
- The IntProcedure whose execute() method is is called
for each intersecting rectangle.public void contains(Rectangle r, IntProcedure ip)
r
- The rectangle for which this method finds
contained rectangles.public int size()
public java.lang.String getVersion()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |