geos::index::strtree::SimpleSTRtree Class Reference

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

`#include <SimpleSTRtree.h>`

Inheritance diagram for geos::index::strtree::SimpleSTRtree:

## Public Member Functions

| SimpleSTRtree (std::size_t capacity=10)
std::size_t | getNodeCapacity () const
std::size_t | getNumLeafNodes () const
bool | getBuilt () const
SimpleSTRnode * | getRoot ()
void | insert (geom::Geometry *geom)
void | insert (const geom::Envelope *itemEnv, void *item) override
| Adds a spatial item with an extent specified by the given Envelope to the index.
void | iterate (ItemVisitor &visitor)
void | query (const geom::Envelope *searchEnv, std::vector< void * > &matches) override
| Queries the index for all items whose extents intersect the given search Envelope.
void | query (const geom::Envelope *searchEnv, ItemVisitor &visitor) override
| Queries the index for all items whose extents intersect the given search Envelope and applies an ItemVisitor to them.
bool | remove (const geom::Envelope *searchBounds, void *item) override
| Removes a single item from the tree.
std::pair< const void *, const void * > | nearestNeighbour (ItemDistance *itemDist)
const void * | nearestNeighbour (const geom::Envelope *env, const void *item, ItemDistance *itemDist)
std::pair< const void *, const void * > | nearestNeighbour (SimpleSTRtree &tree, ItemDistance *itemDist)
bool | isWithinDistance (SimpleSTRtree &tree, ItemDistance *itemDist, double maxDistance)

## Public Attributes

SimpleSTRnode * | root

## Friends

std::ostream & | operator<< (std::ostream &os, const SimpleSTRtree &tree)

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

## SimpleSTRtree()

geos::index::strtree::SimpleSTRtree::SimpleSTRtree | ( | std::size_t | capacity = 10 | ) |

inline

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

## Member Function Documentation

## insert()

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

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

## query() [1/2]

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

override virtual

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.

## query() [2/2]

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

override virtual

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

Implements geos::index::SpatialIndex.

## remove()

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

override virtual

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:

- SimpleSTRtree.h