T
- object-type stored in structure (the payload).public abstract class RTree<T> extends Object
Modifier | Constructor and Description |
---|---|
protected |
RTree(int numberDimensions)
Creates an empty R-Tree.
|
protected |
RTree(int numberDimensions,
int maxNumberEntries)
Creates an empty R-Tree with a specified number of children.
|
Modifier and Type | Method and Description |
---|---|
protected void |
add(com.github.davidmoten.rtreemulti.geometry.Rectangle rectangle,
T payload)
Adds a
Rectangle with a corresponding payload. |
T |
arbitraryElement()
Any arbitrary element from the tree.
|
Set<T> |
asSet()
All elements contained within the tree, as a
Set . |
protected java.util.stream.Stream<T> |
containsStream(com.github.davidmoten.rtreemulti.geometry.Point point)
Which objects contain a particular point?
|
protected java.util.stream.Stream<T> |
intersectsWithStream(com.github.davidmoten.rtreemulti.geometry.Rectangle rectangle)
A stream of the elements that a rectangle intersects with.
|
boolean |
isEmpty()
Returns true if and only if the R-tree is empty of entries.
|
protected void |
remove(com.github.davidmoten.rtreemulti.geometry.Rectangle rectangle,
T payload)
Removes a particular item from the r-tree, identified by its
Rectangle and payload. |
int |
size()
The total number of items stored in the tree.
|
protected RTree(int numberDimensions)
numberDimensions
- the number of spatial dimensions that the bounding boxes are expected
to support.protected RTree(int numberDimensions, int maxNumberEntries)
numberDimensions
- the number of spatial dimensions that the bounding boxes are expected
to support.maxNumberEntries
- maximum number of entries in the r-tree.public int size()
public Set<T> asSet()
Set
.Set
of all the elements, reusing the existing element
objects.public T arbitraryElement()
This method should never be called on an empty tree. Consider checking first with isEmpty()
.
public boolean isEmpty()
protected void add(com.github.davidmoten.rtreemulti.geometry.Rectangle rectangle, T payload)
Rectangle
with a corresponding payload.
Note that the payload must not be unique, and multiple identical elements can exist with the same bounding-box and payload.
rectangle
- the rectangle associated with the payload.payload
- the payload associated with the rectangle.protected java.util.stream.Stream<T> containsStream(com.github.davidmoten.rtreemulti.geometry.Point point)
point
- the point.point
.protected java.util.stream.Stream<T> intersectsWithStream(com.github.davidmoten.rtreemulti.geometry.Rectangle rectangle)
rectangle
- the rectangle associated with the payload.protected void remove(com.github.davidmoten.rtreemulti.geometry.Rectangle rectangle, T payload)
Rectangle
and payload.
If no entry can be found matching exactly the rectangle
and entry
, no
change happens to the r-tree. No error is reported.
If multiple entries exist that match exactly the rectangle
and entry
, then
all entries are removed.
rectangle
- the rectangle.payload
- the payload.Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.