QGIS/python/core/qgsspatialindex.sip
Nyall Dawson c49b5b777f Change a lot of arguments to const references in core/gui
Rationale:
- there was a lot of large objects passed by value, so potentially
there's a speed bump from this
- even for implicitly shared classes like QString/QList there's still
a (small) cost for copying the objects when there's no reason to
- it's the right thing to do!
2015-10-07 12:02:04 +11:00

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 );
};