public class STRtree extends AbstractSTRtree implements SpatialIndex, Serializable
The STR packed R-tree is simple to implement and maximizes space utilization; that is, as many leaves as possible are filled to capacity. Overlap between nodes is far less than in a basic R-tree. However, once the tree has been built (explicitly or on the first call to #query), items may not be added or removed.
Described in: P. Rigaux, Michel Scholl and Agnes Voisard. Spatial Databases With Application To GIS. Morgan Kaufmann, San Francisco, 2002.
AbstractSTRtree.IntersectsOproot| Constructor and Description |
|---|
STRtree()
Constructs an STRtree with the default node capacity.
|
STRtree(int nodeCapacity)
Constructs an STRtree with the given maximum number of child nodes that
a node may have.
|
| Modifier and Type | Method and Description |
|---|---|
protected AbstractNode |
createNode(int level) |
protected List |
createParentBoundables(List childBoundables,
int newLevel)
Creates the parent level for the given child level.
|
protected List |
createParentBoundablesFromVerticalSlice(List childBoundables,
int newLevel) |
int |
depth()
Returns the number of items in the tree.
|
protected Comparator |
getComparator() |
protected AbstractSTRtree.IntersectsOp |
getIntersectsOp() |
void |
insert(BoundingBox itemEnv,
Object item)
Inserts an item having the given bounds into the tree.
|
Object |
nearestNeighbour(BoundingBox env,
Object item,
ItemDistance itemDist)
Finds the item in this tree which is nearest to the given
Object,
using ItemDistance as the distance metric. |
Object[] |
nearestNeighbour(ItemDistance itemDist)
Finds the two nearest items in the tree,
using
ItemDistance as the distance metric. |
Object[] |
nearestNeighbour(STRtree tree,
ItemDistance itemDist)
Finds the two nearest items from this tree
and another tree,
using
ItemDistance as the distance metric. |
List |
query(BoundingBox searchEnv)
Returns items whose bounds intersect the given envelope.
|
void |
query(BoundingBox searchEnv,
ItemVisitor visitor)
Returns items whose bounds intersect the given envelope.
|
boolean |
remove(BoundingBox itemEnv,
Object item)
Removes a single item from the tree.
|
int |
size()
Returns the number of items in the tree.
|
protected List[] |
verticalSlices(List childBoundables,
int sliceCount) |
boundablesAtLevel, build, compareDoubles, depth, getNodeCapacity, getRoot, insert, isEmpty, itemsTree, lastNode, query, query, remove, sizepublic STRtree()
public STRtree(int nodeCapacity)
The minimum recommended capacity setting is 4.
protected AbstractNode createNode(int level)
createNode in class AbstractSTRtreeprotected List createParentBoundables(List childBoundables, int newLevel)
createParentBoundables in class AbstractSTRtreeprotected List createParentBoundablesFromVerticalSlice(List childBoundables, int newLevel)
public int depth()
depth in class AbstractSTRtreeprotected Comparator getComparator()
getComparator in class AbstractSTRtreeprotected AbstractSTRtree.IntersectsOp getIntersectsOp()
getIntersectsOp in class AbstractSTRtreeAbstractSTRtree.IntersectsOppublic void insert(BoundingBox itemEnv, Object item)
insert in interface SpatialIndexpublic Object nearestNeighbour(BoundingBox env, Object item, ItemDistance itemDist)
Object,
using ItemDistance as the distance metric.
A Branch-and-Bound tree traversal algorithm is used
to provide an efficient search.
The query object does not have to be contained in the tree, but it does have to be compatible with the itemDist distance metric.
env - the envelope of the query itemitem - the item to find the nearest neighbour ofitemDist - a distance metric applicable to the items in this tree and the query itempublic Object[] nearestNeighbour(ItemDistance itemDist)
ItemDistance as the distance metric.
A Branch-and-Bound tree traversal algorithm is used
to provide an efficient search.itemDist - a distance metric applicable to the items in this treepublic Object[] nearestNeighbour(STRtree tree, ItemDistance itemDist)
ItemDistance as the distance metric.
A Branch-and-Bound tree traversal algorithm is used
to provide an efficient search.
The result value is a pair of items,
the first from this tree and the second
from the argument tree.tree - another treeitemDist - a distance metric applicable to the items in the treespublic List query(BoundingBox searchEnv)
query in interface SpatialIndexsearchEnv - the envelope to query forpublic void query(BoundingBox searchEnv, ItemVisitor visitor)
public boolean remove(BoundingBox itemEnv, Object item)
remove in interface SpatialIndexitemEnv - the BoundingBoxDoubleGf of the item to removeitem - the item to removetrue if the item was foundpublic int size()
size in class AbstractSTRtreeCopyright © 2015 Revolution Systems Inc.. All rights reserved.