QGIS API Documentation  2.15.0-Master (94d88e6)
Public Member Functions | Static Protected Member Functions | Friends | List of all members
QgsSpatialIndex Class Reference

#include <qgsspatialindex.h>

Public Member Functions

 QgsSpatialIndex ()
 Constructor - creates R-tree. More...
 
 QgsSpatialIndex (const QgsFeatureIterator &fi)
 Constructor - creates R-tree and bulk loads it with features from the iterator. More...
 
 QgsSpatialIndex (const QgsSpatialIndex &other)
 Copy constructor. More...
 
 ~QgsSpatialIndex ()
 Destructor finalizes work with spatial index. More...
 
bool deleteFeature (const QgsFeature &f)
 Remove feature from index. More...
 
bool insertFeature (const QgsFeature &f)
 Add feature to index. More...
 
QList< QgsFeatureIdintersects (const QgsRectangle &rect) const
 Returns features that intersect the specified rectangle. More...
 
QList< QgsFeatureIdnearestNeighbor (const QgsPoint &point, int neighbors) const
 Returns nearest neighbors (their count is specified by second parameter) More...
 
QgsSpatialIndexoperator= (const QgsSpatialIndex &other)
 Implement assignment operator. More...
 
QAtomicInt refs () const
 get reference count - just for debugging! More...
 

Static Protected Member Functions

static bool featureInfo (const QgsFeature &f, SpatialIndex::Region &r, QgsFeatureId &id)
 
static SpatialIndex::Region rectToRegion (const QgsRectangle &rect)
 

Friends

class QgsFeatureIteratorDataStream
 

Detailed Description

Definition at line 45 of file qgsspatialindex.h.

Constructor & Destructor Documentation

QgsSpatialIndex::QgsSpatialIndex ( )

Constructor - creates R-tree.

Definition at line 219 of file qgsspatialindex.cpp.

QgsSpatialIndex::QgsSpatialIndex ( const QgsFeatureIterator fi)
explicit

Constructor - creates R-tree and bulk loads it with features from the iterator.

This is much faster approach than creating an empty index and then inserting features one by one.

Note
added in 2.8

Definition at line 224 of file qgsspatialindex.cpp.

QgsSpatialIndex::QgsSpatialIndex ( const QgsSpatialIndex other)

Copy constructor.

Definition at line 229 of file qgsspatialindex.cpp.

QgsSpatialIndex::~QgsSpatialIndex ( )

Destructor finalizes work with spatial index.

Definition at line 234 of file qgsspatialindex.cpp.

Member Function Documentation

bool QgsSpatialIndex::deleteFeature ( const QgsFeature f)

Remove feature from index.

Definition at line 296 of file qgsspatialindex.cpp.

bool QgsSpatialIndex::featureInfo ( const QgsFeature f,
SpatialIndex::Region &  r,
QgsFeatureId id 
)
staticprotected
Note
not available in python bindings

Definition at line 252 of file qgsspatialindex.cpp.

bool QgsSpatialIndex::insertFeature ( const QgsFeature f)

Add feature to index.

Definition at line 265 of file qgsspatialindex.cpp.

QList< QgsFeatureId > QgsSpatialIndex::intersects ( const QgsRectangle rect) const

Returns features that intersect the specified rectangle.

Definition at line 307 of file qgsspatialindex.cpp.

QList< QgsFeatureId > QgsSpatialIndex::nearestNeighbor ( const QgsPoint point,
int  neighbors 
) const

Returns nearest neighbors (their count is specified by second parameter)

Definition at line 319 of file qgsspatialindex.cpp.

QgsSpatialIndex & QgsSpatialIndex::operator= ( const QgsSpatialIndex other)

Implement assignment operator.

Definition at line 238 of file qgsspatialindex.cpp.

SpatialIndex::Region QgsSpatialIndex::rectToRegion ( const QgsRectangle rect)
staticprotected
Note
not available in python bindings

Definition at line 245 of file qgsspatialindex.cpp.

QAtomicInt QgsSpatialIndex::refs ( ) const

get reference count - just for debugging!

Definition at line 332 of file qgsspatialindex.cpp.

Friends And Related Function Documentation

friend class QgsFeatureIteratorDataStream
friend

Definition at line 99 of file qgsspatialindex.h.


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