|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.infomatiq.jsi.rtree.RTree
This is a lightweight RTree implementation, specifically designed for the following features (in order of importance):
The main reason for the high speed of this RTree implementation is the avoidance of the creation of unnecessary objects, mainly achieved by using primitive collections from the trove4j library.
Constructor Summary | |
RTree()
Constructor. |
Method Summary | |
void |
add(Rectangle r,
int id)
Adds a new rectangle to the spatial index |
void |
contains(Rectangle r,
IntProcedure v)
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)
Initialize implementation dependent properties of the RTree. |
void |
intersects(Rectangle r,
IntProcedure v)
Finds all rectangles that intersect the passed rectangle. |
void |
nearest(Point p,
IntProcedure v,
float furthestDistance)
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 |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public RTree()
Method Detail |
public void init(java.util.Properties props)
Initialize implementation dependent properties of the RTree. Currently implemented properties are:
init
in interface SpatialIndex
props
- The set of properties used to initialize the spatial index.SpatialIndex.init(Properties)
public void add(Rectangle r, int id)
SpatialIndex
add
in interface SpatialIndex
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.SpatialIndex.add(Rectangle, int)
public boolean delete(Rectangle r, int id)
SpatialIndex
delete
in interface SpatialIndex
r
- The rectangle to delete from the spatial indexid
- The ID of the rectangle to delete from the spatial
index
SpatialIndex.delete(Rectangle, int)
public void nearest(Point p, IntProcedure v, float furthestDistance)
SpatialIndex
nearest
in interface SpatialIndex
p
- The point for which this method finds the
nearest neighbours.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.SpatialIndex.nearest(Point, IntProcedure, float)
public void intersects(Rectangle r, IntProcedure v)
SpatialIndex
intersects
in interface SpatialIndex
r
- The rectangle for which this method finds
intersecting rectangles.v
- The IntProcedure whose execute() method is is called
for each intersecting rectangle.SpatialIndex.intersects(Rectangle, IntProcedure)
public void contains(Rectangle r, IntProcedure v)
SpatialIndex
contains
in interface SpatialIndex
r
- The rectangle for which this method finds
contained rectangles.SpatialIndex.contains(Rectangle, IntProcedure)
public int size()
SpatialIndex
size
in interface SpatialIndex
SpatialIndex.size()
public java.lang.String getVersion()
SpatialIndex
getVersion
in interface SpatialIndex
SpatialIndex.getVersion()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |