T
- public class RStarTree<T extends RNode> extends AbstractRTree<T> implements RTreeInterface<T>, java.io.Serializable
All items must have the same dimension.
Only leaf nodes may be inserted.
AbstractRTree.PairDebug<P,Q>
Constructor and Description |
---|
RStarTree(int dim) |
RStarTree(int dim,
java.util.Collection<? extends T> c) |
RStarTree(int dim,
int minFill,
int maxFill) |
RStarTree(int dim,
java.util.stream.Stream<? extends T> preload) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(T node)
Insert a new node into an RTree.
|
oracle.spatial.geometry.RStarTree.RStarInternal |
getRoot() |
java.util.Iterator<T> |
iterator() |
boolean |
remove(java.lang.Object obj) |
boolean |
removeIf(java.util.function.Predicate<? super Mer> merFilter,
java.util.function.Predicate<? super T> filter)
Remove all nodes for which merFilter and filter are both true.
|
int |
size()
Gives the size of the tree.
|
contains, containsAll, forEach, isEmpty, join, search, search, searchMer, searchNearest, searchNearest
addAll, clear, removeAll, retainAll, toArray, toArray, toString
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, forEach, join, join, join, removeIf, search, search, search, searchMer, searchMer, searchNearest, searchNearest, searchNearest
public RStarTree(int dim, int minFill, int maxFill)
public RStarTree(int dim)
public RStarTree(int dim, java.util.stream.Stream<? extends T> preload)
public RStarTree(int dim, java.util.Collection<? extends T> c)
public int size()
RTreeInterface
public oracle.spatial.geometry.RStarTree.RStarInternal getRoot()
public boolean add(T node) throws java.lang.UnsupportedOperationException
RTreeInterface
Note that node.getMer() will be called repeatedly during RTree operations and should be efficient, typically implemented by the node caching a Mer which it returns on each call.
node.isData() must return true.
add
in interface java.util.Collection<T extends RNode>
add
in interface RTreeInterface<T extends RNode>
add
in class java.util.AbstractCollection<T extends RNode>
node
- the node to insertjava.lang.UnsupportedOperationException
- if the tree does not support insertionspublic boolean remove(java.lang.Object obj) throws java.lang.UnsupportedOperationException, java.util.NoSuchElementException
public java.util.Iterator<T> iterator()
public boolean removeIf(java.util.function.Predicate<? super Mer> merFilter, java.util.function.Predicate<? super T> filter) throws java.lang.UnsupportedOperationException
RTreeInterface
Most users should instead use the simpler removeIf(Mer, Predicate).
For example, if tree is an RTree<JGeometry>
, we could remove all geometries smaller than 1000 m^2 that are
completely contained in the Western hemisphere:
Mer westHemi = new Mer(2);
westHemi.extend(-180, -90);
westHemi.extend( 0, +90);
tree.removeIf(x -> westHemi.interacts(x), x -> westHemi.covers(x) && x.area(0.001) < 1000);
Note that westHemi.covers(x)
violates the merFilter requirements and must be put in the filter predicate
instead.
removeIf
in interface RTreeInterface<T extends RNode>
merFilter
- restricts the search areafilter
- the test for determining whether to remove a nodejava.lang.UnsupportedOperationException
- if remove is not supported