T
- the type of elements stored in this RTree.public class GenericRTree<T> extends Object implements GenericSpatialIndex<T>, Externalizable
Constructor and Description |
---|
GenericRTree()
default constructor that initializes the underlying tree to have at least
1 and at most 10 childs per node.
|
GenericRTree(int minNodes,
int maxNodes)
This constructor creates a GenericRTree.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Rectangle r,
T thing)
Add
thing to this index with place-occupation specified by
r . |
Set<T> |
contains(Rectangle r)
Acquire a set of all elements contained in the given rectangle
r . |
void |
contains(Rectangle r,
TObjectProcedure<T> procedure)
Calls
procedure on each element that is contained in the
given rectangle r . |
boolean |
delete(Rectangle r,
T thing)
Remove element
thing from spatial index. |
Rectangle |
getBounds() |
List<T> |
intersectionsAsList(Rectangle r)
Acquire a list of all elements intersecting the given rectangle
r . |
Set<T> |
intersects(Rectangle r)
Acquire a set of all elements intersecting the given rectangle
r . |
void |
intersects(Rectangle r,
TObjectProcedure<T> procedure)
Calls
procedure on each element that intersects the given
rectangle r . |
Set<T> |
nearest(Point p,
float distance)
Acquire a set of all elements that are in less or equal distance of
p than distance . |
void |
nearest(Point p,
TObjectProcedure<T> procedure,
float distance)
Execute
procedure on all elements that are in less or equal
distance of p than distance . |
void |
readExternal(ObjectInput oi) |
int |
size()
Returns the number of entries in this index.
|
void |
writeExternal(ObjectOutput oo) |
public GenericRTree(int minNodes, int maxNodes)
minNodes
- the minimum number of childs per node.maxNodes
- the maximum number of childs per node.public GenericRTree()
public void add(Rectangle r, T thing)
GenericSpatialIndex
thing
to this index with place-occupation specified by
r
.add
in interface GenericSpatialIndex<T>
r
- the element's bounding boxthing
- the element to add.public boolean delete(Rectangle r, T thing)
GenericSpatialIndex
thing
from spatial index. The associated
rectangle r
has to be provided.delete
in interface GenericSpatialIndex<T>
r
- the element's bounding box.thing
- the element to remove.public void contains(Rectangle r, TObjectProcedure<T> procedure)
GenericSpatialIndex
procedure
on each element that is contained in the
given rectangle r
.contains
in interface GenericSpatialIndex<T>
r
- the rectangle to query for contained elements.procedure
- the procedure to call on each element.public Set<T> contains(Rectangle r)
GenericSpatialIndex
r
.contains
in interface GenericSpatialIndex<T>
r
- the rectangle to query for contained elements.r
.public void intersects(Rectangle r, TObjectProcedure<T> procedure)
GenericSpatialIndex
procedure
on each element that intersects the given
rectangle r
.intersects
in interface GenericSpatialIndex<T>
r
- the rectangle to query for intersecting elements.procedure
- the procedure to call on each element.public Set<T> intersects(Rectangle r)
GenericSpatialIndex
r
.intersects
in interface GenericSpatialIndex<T>
r
- the rectangle to query for intersecting elements.r
.public List<T> intersectionsAsList(Rectangle r)
GenericSpatialIndex
r
.intersectionsAsList
in interface GenericSpatialIndex<T>
r
- the rectangle to query for intersecting elements.r
public void nearest(Point p, TObjectProcedure<T> procedure, float distance)
GenericSpatialIndex
procedure
on all elements that are in less or equal
distance of p
than distance
.nearest
in interface GenericSpatialIndex<T>
p
- the point from where to measure distance.procedure
- the procedure to call on each element.distance
- the maximum distance from p
of elements.public Set<T> nearest(Point p, float distance)
GenericSpatialIndex
p
than distance
.nearest
in interface GenericSpatialIndex<T>
p
- the point from where to measure distance.distance
- the maximum distance from p
of elements.distance
.public int size()
GenericSpatialIndex
size
in interface GenericSpatialIndex<T>
public Rectangle getBounds()
public void writeExternal(ObjectOutput oo) throws IOException
writeExternal
in interface Externalizable
IOException
public void readExternal(ObjectInput oi) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException