|
JTS Topology Suite version 1.12 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.vividsolutions.jts.index.strtree.AbstractSTRtree com.vividsolutions.jts.index.strtree.STRtree
public class STRtree
A query-only R-tree created using the Sort-Tile-Recursive (STR) algorithm. For two-dimensional spatial data.
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.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.vividsolutions.jts.index.strtree.AbstractSTRtree |
---|
AbstractSTRtree.IntersectsOp |
Field Summary |
---|
Fields inherited from class com.vividsolutions.jts.index.strtree.AbstractSTRtree |
---|
root |
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
protected AbstractNode |
createNode(int level)
|
protected java.util.List |
createParentBoundables(java.util.List childBoundables,
int newLevel)
Creates the parent level for the given child level. |
protected java.util.List |
createParentBoundablesFromVerticalSlice(java.util.List childBoundables,
int newLevel)
|
int |
depth()
Returns the number of items in the tree. |
protected java.util.Comparator |
getComparator()
|
protected AbstractSTRtree.IntersectsOp |
getIntersectsOp()
|
void |
insert(Envelope itemEnv,
java.lang.Object item)
Inserts an item having the given bounds into the tree. |
java.lang.Object |
nearestNeighbour(Envelope env,
java.lang.Object item,
ItemDistance itemDist)
Finds the nearest item to the given object in this tree, using ItemDistance as the distance metric. |
java.lang.Object[] |
nearestNeighbour(ItemDistance itemDist)
Finds the two nearest items in the tree, using ItemDistance as the distance metric. |
java.lang.Object[] |
nearestNeighbour(STRtree tree,
ItemDistance itemDist)
Finds the two nearest items from this tree and another tree, using ItemDistance as the distance metric. |
java.util.List |
query(Envelope searchEnv)
Returns items whose bounds intersect the given envelope. |
void |
query(Envelope searchEnv,
ItemVisitor visitor)
Returns items whose bounds intersect the given envelope. |
boolean |
remove(Envelope itemEnv,
java.lang.Object item)
Removes a single item from the tree. |
int |
size()
Returns the number of items in the tree. |
protected java.util.List[] |
verticalSlices(java.util.List childBoundables,
int sliceCount)
|
Methods inherited from class com.vividsolutions.jts.index.strtree.AbstractSTRtree |
---|
boundablesAtLevel, build, compareDoubles, depth, getNodeCapacity, getRoot, insert, itemsTree, lastNode, query, query, remove, size |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public STRtree()
public STRtree(int nodeCapacity)
The minimum recommended capacity setting is 4.
Method Detail |
---|
protected java.util.List createParentBoundables(java.util.List childBoundables, int newLevel)
createParentBoundables
in class AbstractSTRtree
protected java.util.List createParentBoundablesFromVerticalSlice(java.util.List childBoundables, int newLevel)
protected java.util.List[] verticalSlices(java.util.List childBoundables, int sliceCount)
childBoundables
- Must be sorted by the x-value of the envelope midpointsprotected AbstractNode createNode(int level)
createNode
in class AbstractSTRtree
protected AbstractSTRtree.IntersectsOp getIntersectsOp()
getIntersectsOp
in class AbstractSTRtree
AbstractSTRtree.IntersectsOp
public void insert(Envelope itemEnv, java.lang.Object item)
insert
in interface SpatialIndex
public java.util.List query(Envelope searchEnv)
query
in interface SpatialIndex
searchEnv
- the envelope to query for
public void query(Envelope searchEnv, ItemVisitor visitor)
query
in interface SpatialIndex
searchEnv
- the envelope to query forvisitor
- a visitor object to apply to the items foundpublic boolean remove(Envelope itemEnv, java.lang.Object item)
remove
in interface SpatialIndex
itemEnv
- the Envelope of the item to removeitem
- the item to remove
true
if the item was foundpublic int size()
size
in class AbstractSTRtree
public int depth()
depth
in class AbstractSTRtree
protected java.util.Comparator getComparator()
getComparator
in class AbstractSTRtree
public java.lang.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 tree
public java.lang.Object nearestNeighbour(Envelope env, java.lang.Object item, ItemDistance itemDist)
ItemDistance
as the distance metric.
A Branch-and-Bound tree traversal algorithm is used
to provide an efficient search.
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 item
public java.lang.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 trees
|
JTS Topology Suite version 1.12 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |