NetTopologySuite
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Pages
NetTopologySuite.Index.Strtree.STRtree< TItem > Class Template Reference

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. More...

Inheritance diagram for NetTopologySuite.Index.Strtree.STRtree< TItem >:
NetTopologySuite.Index.Strtree.AbstractSTRtree< T, TItem > NetTopologySuite.Index.ISpatialIndex< T >

Public Member Functions

 STRtree ()
 Constructs an STRtree with the default (10) node capacity. More...
 
 STRtree (int nodeCapacity)
 Constructs an STRtree with the given maximum number of child nodes that a node may have. More...
 
new void Insert (Envelope itemEnv, TItem item)
 Inserts an item having the given bounds into the tree. More...
 
new IList< TItem > Query (Envelope searchEnv)
 Returns items whose bounds intersect the given envelope. More...
 
new void Query (Envelope searchEnv, IItemVisitor< TItem > visitor)
 Returns items whose bounds intersect the given envelope. More...
 
new bool Remove (Envelope itemEnv, TItem item)
 Removes a single item from the tree. More...
 
TItem[] NearestNeighbour (IItemDistance< Envelope, TItem > itemDist)
 Finds the two nearest items in the tree, using IItemDistance{Envelope, TItem} as the distance metric. A Branch-and-Bound tree traversal algorithm is used to provide an efficient search. More...
 
TItem NearestNeighbour (Envelope env, TItem item, IItemDistance< Envelope, TItem > itemDist)
 Finds the item in this tree which is nearest to the given item , using IItemDistance{Envelope,TItem} as the distance metric. A Branch-and-Bound tree traversal algorithm is used to provide an efficient search. The query item does not have to be contained in the tree, but it does have to be compatible with the itemDist distance metric. More...
 
TItem[] NearestNeighbour (STRtree< TItem > tree, IItemDistance< Envelope, TItem > itemDist)
 Finds the two nearest items from this tree and another tree, using IItemDistance{Envelope, TItem} 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. More...
 
- Public Member Functions inherited from NetTopologySuite.Index.Strtree.AbstractSTRtree< T, TItem >
void Build ()
 Creates parent nodes, grandparent nodes, and so forth up to the root node, for the data that has been inserted into the tree. Can only be called once, and thus can be called only after all of the data has been inserted into the tree. More...
 
IList ItemsTree ()
 Gets a tree structure (as a nested list) corresponding to the structure of the items and nodes in this tree. The returned Lists contain either Object items, or Lists which correspond to subtrees of the tree Subtrees which do not contain any items are not included. Builds the tree if necessary. More...
 
- Public Member Functions inherited from NetTopologySuite.Index.ISpatialIndex< T >
void Insert (Envelope itemEnv, T item)
 Adds a spatial item with an extent specified by the given Envelope to the index. More...
 
void Query (Envelope searchEnv, IItemVisitor< T > visitor)
 Queries the index for all items whose extents intersect the given search Envelope, and applies an IItemVisitor{T} to them. Note that some kinds of indexes may also return objects which do not in fact intersect the query envelope. More...
 
bool Remove (Envelope itemEnv, T item)
 Removes a single item from the tree. More...
 

Protected Member Functions

override IList< IBoundable
< Envelope, TItem > > 
CreateParentBoundables (IList< IBoundable< Envelope, TItem >> childBoundables, int newLevel)
 Creates the parent level for the given child level. First, orders the items by the x-values of the midpoints, and groups them into vertical slices. For each slice, orders the items by the y-values of the midpoints, and group them into runs of size M (the node capacity). For each run, creates a new (parent) node. More...
 
IList< IBoundable< Envelope,
TItem > > 
CreateParentBoundablesFromVerticalSlice (IList< IBoundable< Envelope, TItem >> childBoundables, int newLevel)
 
IList< IBoundable< Envelope,
TItem > >[] 
VerticalSlices (IList< IBoundable< Envelope, TItem >> childBoundables, int sliceCount)
 
override AbstractNode
< Envelope, TItem > 
CreateNode (int level)
 
override IComparer< IBoundable
< Envelope, TItem > > 
GetComparer ()
 
- Protected Member Functions inherited from NetTopologySuite.Index.Strtree.AbstractSTRtree< T, TItem >
 AbstractSTRtree (int nodeCapacity)
 Constructs an AbstractSTRtree with the specified maximum number of child nodes that a node may have. More...
 
virtual IList< IBoundable< T,
TItem > > 
CreateParentBoundables (IList< IBoundable< T, TItem >> childBoundables, int newLevel)
 Sorts the childBoundables then divides them into groups of size M, where M is the node capacity. More...
 
AbstractNode< T, TItem > LastNode (IList< IBoundable< T, TItem >> nodes)
 
int GetSize (AbstractNode< T, TItem > node)
 
int GetDepth (AbstractNode< T, TItem > node)
 
void Insert (T bounds, TItem item)
 
IList< TItem > Query (T searchBounds)
 Also builds the tree, if necessary. More...
 
void Query (T searchBounds, IItemVisitor< TItem > visitor)
 
bool Remove (T searchBounds, TItem item)
 Removes an item from the tree. (Builds the tree, if necessary.) More...
 
IList< IBoundable< T, TItem > > BoundablesAtLevel (int level)
 

Properties

override IIntersectsOp IntersectsOp [get]
 
- Properties inherited from NetTopologySuite.Index.Strtree.AbstractSTRtree< T, TItem >
AbstractNode< T, TItem > Root [get, set]
 
int NodeCapacity [get]
 Returns the maximum number of child nodes that a node may have. More...
 
bool IsEmpty [get]
 Tests whether the index contains any items. This method does not build the index, so items can still be inserted after it has been called. More...
 
int Count [get]
 
int Depth [get]
 
abstract IIntersectsOp IntersectsOp [get]
 

Additional Inherited Members

- Static Protected Member Functions inherited from NetTopologySuite.Index.Strtree.AbstractSTRtree< T, TItem >
static int CompareDoubles (double a, double b)
 

Detailed Description

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.

Constructor & Destructor Documentation

NetTopologySuite.Index.Strtree.STRtree< TItem >.STRtree ( )

Constructs an STRtree with the default (10) node capacity.

NetTopologySuite.Index.Strtree.STRtree< TItem >.STRtree ( int  nodeCapacity)

Constructs an STRtree with the given maximum number of child nodes that a node may have.

The minimum recommended capacity setting is 4.

Member Function Documentation

override AbstractNode<Envelope, TItem> NetTopologySuite.Index.Strtree.STRtree< TItem >.CreateNode ( int  level)
protectedvirtual

Parameters
level
Returns

Implements NetTopologySuite.Index.Strtree.AbstractSTRtree< T, TItem >.

override IList<IBoundable<Envelope, TItem> > NetTopologySuite.Index.Strtree.STRtree< TItem >.CreateParentBoundables ( IList< IBoundable< Envelope, TItem >>  childBoundables,
int  newLevel 
)
protected

Creates the parent level for the given child level. First, orders the items by the x-values of the midpoints, and groups them into vertical slices. For each slice, orders the items by the y-values of the midpoints, and group them into runs of size M (the node capacity). For each run, creates a new (parent) node.

Parameters
childBoundables
newLevel
IList<IBoundable<Envelope, TItem> > NetTopologySuite.Index.Strtree.STRtree< TItem >.CreateParentBoundablesFromVerticalSlice ( IList< IBoundable< Envelope, TItem >>  childBoundables,
int  newLevel 
)
protected

Parameters
childBoundables
newLevel
Returns
override IComparer<IBoundable<Envelope, TItem> > NetTopologySuite.Index.Strtree.STRtree< TItem >.GetComparer ( )
protectedvirtual
new void NetTopologySuite.Index.Strtree.STRtree< TItem >.Insert ( Envelope  itemEnv,
TItem  item 
)

Inserts an item having the given bounds into the tree.

Parameters
itemEnv
item
TItem [] NetTopologySuite.Index.Strtree.STRtree< TItem >.NearestNeighbour ( IItemDistance< Envelope, TItem >  itemDist)

Finds the two nearest items in the tree, using IItemDistance{Envelope, TItem} as the distance metric. A Branch-and-Bound tree traversal algorithm is used to provide an efficient search.

Parameters
itemDistA distance metric applicable to the items in this tree
Returns
The pair of the nearest items
TItem NetTopologySuite.Index.Strtree.STRtree< TItem >.NearestNeighbour ( Envelope  env,
TItem  item,
IItemDistance< Envelope, TItem >  itemDist 
)

Finds the item in this tree which is nearest to the given item , using IItemDistance{Envelope,TItem} as the distance metric. A Branch-and-Bound tree traversal algorithm is used to provide an efficient search. The query item does not have to be contained in the tree, but it does have to be compatible with the itemDist distance metric.

Parameters
envThe envelope of the query item
itemThe item to find the nearest neighbour of
itemDistA distance metric applicable to the items in this tree and the query item
Returns
The nearest item in this tree
TItem [] NetTopologySuite.Index.Strtree.STRtree< TItem >.NearestNeighbour ( STRtree< TItem >  tree,
IItemDistance< Envelope, TItem >  itemDist 
)

Finds the two nearest items from this tree and another tree, using IItemDistance{Envelope, TItem} 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.

Parameters
treeAnother tree
itemDistA distance metric applicable to the items in the trees
Returns
The pair of the nearest items, one from each tree
new IList<TItem> NetTopologySuite.Index.Strtree.STRtree< TItem >.Query ( Envelope  searchEnv)

Returns items whose bounds intersect the given envelope.

Parameters
searchEnv

Implements NetTopologySuite.Index.ISpatialIndex< T >.

new void NetTopologySuite.Index.Strtree.STRtree< TItem >.Query ( Envelope  searchEnv,
IItemVisitor< TItem >  visitor 
)

Returns items whose bounds intersect the given envelope.

Parameters
searchEnv
visitor
new bool NetTopologySuite.Index.Strtree.STRtree< TItem >.Remove ( Envelope  itemEnv,
TItem  item 
)

Removes a single item from the tree.

Parameters
itemEnvThe Envelope of the item to remove.
itemThe item to remove.
Returns
true if the item was found.
IList<IBoundable<Envelope, TItem> > [] NetTopologySuite.Index.Strtree.STRtree< TItem >.VerticalSlices ( IList< IBoundable< Envelope, TItem >>  childBoundables,
int  sliceCount 
)
protected

Parameters
childBoundablesMust be sorted by the x-value of the envelope midpoints.
sliceCount

Property Documentation

override IIntersectsOp NetTopologySuite.Index.Strtree.STRtree< TItem >.IntersectsOp
getprotected


The documentation for this class was generated from the following file: