mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
61 lines
1.6 KiB
Plaintext
61 lines
1.6 KiB
Plaintext
|
|
class QgsSpatialIndex
|
|
{
|
|
%TypeHeaderCode
|
|
#include "qgsspatialindex.h"
|
|
%End
|
|
|
|
public:
|
|
|
|
/* creation of spatial index */
|
|
|
|
/** Constructor - creates R-tree */
|
|
QgsSpatialIndex();
|
|
|
|
/** 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
|
|
*/
|
|
explicit QgsSpatialIndex( const QgsFeatureIterator &fi );
|
|
|
|
/** Copy constructor */
|
|
QgsSpatialIndex( const QgsSpatialIndex &other );
|
|
|
|
/** Destructor finalizes work with spatial index */
|
|
~QgsSpatialIndex();
|
|
|
|
/** Implement assignment operator */
|
|
// QgsSpatialIndex &operator=( const QgsSpatialIndex &other );
|
|
|
|
/* operations */
|
|
|
|
/** Add feature to index */
|
|
bool insertFeature( const QgsFeature &f );
|
|
|
|
/** Remove feature from index */
|
|
bool deleteFeature( const QgsFeature &f );
|
|
|
|
|
|
/* queries */
|
|
|
|
/** Returns features that intersect the specified rectangle */
|
|
QList<qint64> intersects( const QgsRectangle &rect ) const;
|
|
|
|
/** Returns nearest neighbors (their count is specified by second parameter) */
|
|
QList<qint64> nearestNeighbor( const QgsPoint &point, int neighbors ) const;
|
|
|
|
/* debugging */
|
|
|
|
//! get reference count - just for debugging!
|
|
int refs() const;
|
|
|
|
protected:
|
|
// @note not available in python bindings
|
|
// static SpatialIndex::Region rectToRegion( const QgsRectangle &rect );
|
|
// @note not available in python bindings
|
|
// bool featureInfo( const QgsFeature &f, SpatialIndex::Region &r, QgsFeatureId &id );
|
|
|
|
|
|
};
|