GEOS: geos::index::strtree::STRtree Class Reference

GEOS 3.3.8

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
geos::index::strtree::STRtree Class Reference

A query-only R-tree created using the Sort-Tile-Recursive (STR) algorithm. For two-dimensional spatial data. More...

`#include <STRtree.h>`

Inheritance diagram for geos::index::strtree::STRtree:

## Public Member Functions
| STRtree (std::size_t nodeCapacity=10)
void | insert (const geom::Envelope *itemEnv, void *item)
| Adds a spatial item with an extent specified by the given Envelope to the index.
void | query (const geom::Envelope *searchEnv, std::vector< void * > &matches)
| Queries the index for all items whose extents intersect the given search Envelope.
void | query (const geom::Envelope *searchEnv, ItemVisitor &visitor)
| Queries the index for all items whose extents intersect the given search Envelope and applies an ItemVisitor to them.
bool | remove (const geom::Envelope *itemEnv, void *item)
| Removes a single item from the tree.
Public Member Functions inherited from geos::index::strtree::AbstractSTRtree
| AbstractSTRtree (std::size_t newNodeCapacity)
virtual void | build ()
virtual std::size_t | getNodeCapacity ()
virtual void | query (const void *searchBounds, const AbstractNode *node, std::vector< void * > *matches)
void | iterate (ItemVisitor &visitor)
virtual void | boundablesAtLevel (int level, AbstractNode *top, BoundableList *boundables)
ItemsList * | itemsTree ()

## Static Public Member Functions
static double | avg (double a, double b)
static double | centreY (const geom::Envelope *e)
Static Public Member Functions inherited from geos::index::strtree::AbstractSTRtree
static bool | compareDoubles (double a, double b)

## Protected Member Functions
AbstractNode * | createNode (int level)
IntersectsOp * | getIntersectsOp ()
Protected Member Functions inherited from geos::index::strtree::AbstractSTRtree
virtual AbstractNode * | lastNode (BoundableList *nodes)
virtual AbstractNode * | getRoot ()
virtual void | insert (const void *bounds, void *item)
| Also builds the tree, if necessary.
void | query (const void *searchBounds, std::vector< void * > &foundItems)
| Also builds the tree, if necessary.
void | query (const void *searchBounds, ItemVisitor &visitor)
| Also builds the tree, if necessary.
void | query (const void *searchBounds, const AbstractNode &node, ItemVisitor &visitor)
bool | remove (const void *itemEnv, void *item)
| Also builds the tree, if necessary.
std::auto_ptr< BoundableList > | boundablesAtLevel (int level)

## Additional Inherited Members
Protected Attributes inherited from geos::index::strtree::AbstractSTRtree
AbstractNode * | root
std::vector< AbstractNode * > * | nodes
std::size_t | nodeCapacity

## 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

geos::index::strtree::STRtree::STRtree | ( | std::size_t | nodeCapacity = `10` | ) |

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

## Member Function Documentation

IntersectsOp* geos::index::strtree::STRtree::getIntersectsOp | ( |  | ) |
| inlineprotectedvirtual

Returns
  a test for intersection between two bounds, necessary because subclasses of AbstractSTRtree have different implementations of bounds.

See Also
  IntersectsOp

Implements geos::index::strtree::AbstractSTRtree.

void geos::index::strtree::STRtree::insert | ( | const geom::Envelope * | itemEnv,
|  | void * | item
| ) |  |
| virtual

Adds a spatial item with an extent specified by the given Envelope to the index.

Parameters

  itemEnv | Envelope of the item, ownership left to caller. TODO: Reference hold by this class ?
  item | Opaque item, ownership left to caller. Reference hold by this class.

Implements geos::index::SpatialIndex.

void geos::index::strtree::STRtree::query | ( | const geom::Envelope * | searchEnv,
|  | std::vector< void * > & |
| ) |  |
| inlinevirtual

Queries the index for all items whose extents intersect the given search Envelope.

Note that some kinds of indexes may also return objects which do not in fact intersect the query envelope.

Parameters

  searchEnv | the envelope to query for

Returns
  a list of the items found by the query in a newly allocated vector

Implements geos::index::SpatialIndex.

References geos::index::strtree::AbstractSTRtree::query().

void geos::index::strtree::STRtree::query | ( | const geom::Envelope * | searchEnv,
|  | ItemVisitor & | visitor
| ) |  |
| inlinevirtual

Queries the index for all items whose extents intersect the given search Envelope and applies an ItemVisitor to them.

Note that some kinds of indexes may also return objects which do not in fact intersect the query envelope.

Parameters

  searchEnv | the envelope to query for
  visitor | a visitor object to apply to the items found

Implements geos::index::SpatialIndex.

References geos::index::strtree::AbstractSTRtree::query().

bool geos::index::strtree::STRtree::remove | ( | const geom::Envelope * | itemEnv,
|  | void * | item
| ) |  |
| inlinevirtual

Removes a single item from the tree.

Parameters

  itemEnv | the Envelope of the item to remove
  item | the item to remove

Returns
  `true` if the item was found

Implements geos::index::SpatialIndex.

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

- STRtree.h