16#ifndef QGSSPATIALINDEX_H
17#define QGSSPATIALINDEX_H
25 class IStorageManager;
44#include <QSharedDataPointer>
48class QgsSpatialIndexData;
257 auto g = std::make_unique< QgsGeometry >( sipCpp->geometry( a0 ) );
260 PyErr_SetString( PyExc_KeyError, QStringLiteral(
"No geometry with feature id %1 exists in the index." ).arg( a0 ).toUtf8().constData() );
265 sipRes = sipConvertFromType( g.release(), sipType_QgsGeometry, Py_None );
285 static bool featureInfo(
const QgsFeature &f, SpatialIndex::Region &r,
QgsFeatureId &
id )
SIP_SKIP;
295 static bool featureInfo(
const QgsFeature &f, QgsRectangle &rect,
QgsFeatureId &
id );
301 QSharedDataPointer<QgsSpatialIndexData> d;
Wrapper for iterator of features from vector data provider or vector layer.
An interface for objects which accept features via addFeature(s) methods.
virtual bool addFeature(QgsFeature &feature, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags())
Adds a single feature to the sink.
virtual bool addFeatures(QgsFeatureList &features, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags())=0
Adds a list of features to the sink.
An interface for objects which provide features via a getFeatures method.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Base class for feedback objects to be used for cancellation of something running in a worker thread.
A geometry is the spatial representation of a feature.
A rectangle specified with double values.
Flag
Flags controlling index behavior.
@ FlagStoreFeatureGeometries
Indicates that the spatial index should also store feature geometries. This requires more memory,...
QgsSpatialIndex & operator=(const QgsSpatialIndex &other)
QgsSpatialIndex(QgsSpatialIndex::Flags flags=QgsSpatialIndex::Flags())
Constructor for QgsSpatialIndex.
QList< QgsFeatureId > nearestNeighbor(const QgsPointXY &point, int neighbors=1, double maxDistance=0) const
Returns nearest neighbors to a point.
QList< QgsFeatureId > intersects(const QgsRectangle &rectangle) const
Returns a list of features with a bounding box which intersects the specified rectangle.
friend class QgsFeatureIteratorDataStream
Q_DECL_DEPRECATED bool insertFeature(const QgsFeature &feature)
Adds a feature to the index.
QgsGeometry geometry(QgsFeatureId id) const
Returns the stored geometry for the indexed feature with matching id.
QgsSpatialIndex(const QgsFeatureIterator &fi, const std::function< bool(const QgsFeature &) > &callback, QgsSpatialIndex::Flags flags=QgsSpatialIndex::Flags())
Constructor - creates R-tree and bulk loads it with features from the iterator.
bool deleteFeature(const QgsFeature &feature)
Removes a feature from the index.
#define SIP_TYPEHINT(type)
#define SIP_PYALTERNATIVETYPE(type)
#define SIP_ENUM_BASETYPE(type)
QList< QgsFeature > QgsFeatureList
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features