# geos::index::SpatialIndex Class Reference

Abstract class defines basic insertion and query operations supported by classes implementing spatial index algorithms. More...

`#include <SpatialIndex.h>`

Inheritance diagram for geos::index::SpatialIndex:

List of all members.

## Public Member Functions

virtual void | insert (const geom::Envelope *itemEnv, void *item)=0
| Adds a spatial item with an extent specified by the given Envelope to the index.
virtual void | query (const geom::Envelope *searchEnv, std::vector< void * > &)=0
| Queries the index for all items whose extents intersect the given search Envelope.
virtual void | query (const geom::Envelope *searchEnv, ItemVisitor &visitor)=0
| Queries the index for all items whose extents intersect the given search Envelope and applies an ItemVisitor to them.
virtual bool | remove (const geom::Envelope *itemEnv, void *item)=0
| Removes a single item from the tree.

## Detailed Description

Abstract class defines basic insertion and query operations supported by classes implementing spatial index algorithms.

A spatial index typically provides a primary filter for range rectangle queries. A secondary filter is required to test for exact intersection. Of course, this secondary filter may consist of other tests besides intersection, such as testing other kinds of spatial relationships.

Last port: index/SpatialIndex.java rev. 1.11 (JTS-1.7)

## Member Function Documentation

virtual void geos::index::SpatialIndex::insert | ( | const geom::Envelope * | itemEnv,
|  | void * | item
| ) |  | `[pure 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.

Implemented in geos::index::quadtree::Quadtree, and geos::index::strtree::STRtree.

virtual void geos::index::SpatialIndex::query | ( | const geom::Envelope * | searchEnv,
|  | std::vector< void * > & |
| ) |  | `[pure 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

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

Implemented in geos::index::quadtree::Quadtree, and geos::index::strtree::STRtree.

virtual void geos::index::SpatialIndex::query | ( | const geom::Envelope * | searchEnv,
|  | ItemVisitor & | visitor
| ) |  | `[pure 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

Implemented in geos::index::quadtree::Quadtree, and geos::index::strtree::STRtree.

virtual bool geos::index::SpatialIndex::remove | ( | const geom::Envelope * | itemEnv,
|  | void * | item
| ) |  | `[pure 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

Implemented in geos::index::quadtree::Quadtree, and geos::index::strtree::STRtree.

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

- SpatialIndex.h