2017-05-22 09:01:45 +02:00
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
|
|
|
* src/core/qgsspatialindex.h *
|
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
|
|
|
|
class QgsSpatialIndex
|
|
|
|
{
|
2018-02-09 11:06:29 +10:00
|
|
|
%Docstring
|
|
|
|
|
|
|
|
A spatial index for QgsFeature objects.
|
|
|
|
|
|
|
|
QgsSpatialIndex objects are implicitly shared and can be inexpensively copied.
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
While the underlying libspatialindex is not thread safe on some platforms, the QgsSpatialIndex
|
|
|
|
class implements its own locks and accordingly, a single QgsSpatialIndex object can safely
|
|
|
|
be used across multiple threads.
|
|
|
|
%End
|
2017-05-22 09:01:45 +02:00
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgsspatialindex.h"
|
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
public:
|
2007-01-09 02:39:15 +00:00
|
|
|
|
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
QgsSpatialIndex();
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2018-02-09 11:06:29 +10:00
|
|
|
Constructor for QgsSpatialIndex. Creates an empty R-tree index.
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2017-07-15 16:43:44 +10:00
|
|
|
explicit QgsSpatialIndex( const QgsFeatureIterator &fi, QgsFeedback *feedback = 0 );
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
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.
|
2017-05-22 09:01:45 +02:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
The optional ``feedback`` object can be used to allow cancelation of bulk feature loading. Ownership
|
|
|
|
of ``feedback`` is not transferred, and callers must take care that the lifetime of feedback exceeds
|
|
|
|
that of the spatial index construction.
|
2017-07-15 16:43:44 +10:00
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
.. versionadded:: 2.8
|
2017-06-05 13:57:22 +10:00
|
|
|
%End
|
|
|
|
|
2017-07-15 16:43:44 +10:00
|
|
|
explicit QgsSpatialIndex( const QgsFeatureSource &source, QgsFeedback *feedback = 0 );
|
2017-06-05 13:57:22 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Constructor - creates R-tree and bulk loads it with features from the source.
|
|
|
|
This is much faster approach than creating an empty index and then inserting features one by one.
|
2017-07-15 16:43:44 +10:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
The optional ``feedback`` object can be used to allow cancelation of bulk feature loading. Ownership
|
|
|
|
of ``feedback`` is not transferred, and callers must take care that the lifetime of feedback exceeds
|
|
|
|
that of the spatial index construction.
|
2017-07-15 16:43:44 +10:00
|
|
|
|
2017-06-05 13:57:22 +10:00
|
|
|
.. versionadded:: 3.0
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
2014-12-03 10:52:50 +07:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
QgsSpatialIndex( const QgsSpatialIndex &other );
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
Copy constructor
|
|
|
|
%End
|
2013-12-05 18:27:45 +07:00
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
~QgsSpatialIndex();
|
2007-01-09 02:39:15 +00:00
|
|
|
|
|
|
|
|
2018-02-06 16:23:56 +10:00
|
|
|
|
2018-02-09 11:06:29 +10:00
|
|
|
bool insertFeature( const QgsFeature &feature );
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2018-02-09 11:06:29 +10:00
|
|
|
Adds a ``feature`` to the index.
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2017-06-01 10:03:51 +10:00
|
|
|
bool insertFeature( QgsFeatureId id, const QgsRectangle &bounds );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Add a feature ``id`` to the index with a specified bounding box.
|
|
|
|
|
|
|
|
:return: true if feature was successfully added to index.
|
|
|
|
|
2017-06-01 10:03:51 +10:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
2018-02-09 11:06:29 +10:00
|
|
|
bool deleteFeature( const QgsFeature &feature );
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2018-02-09 11:06:29 +10:00
|
|
|
Removes a ``feature`` from the index.
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
2007-01-09 02:39:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2018-02-09 11:06:29 +10:00
|
|
|
QList<QgsFeatureId> intersects( const QgsRectangle &rectangle ) const;
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2018-02-09 11:06:29 +10:00
|
|
|
Returns a list of features with a bounding box which intersects the specified ``rectangle``.
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
The intersection test is performed based on the feature bounding boxes only, so for non-point
|
|
|
|
geometry features it is necessary to manually test the returned features for exact geometry intersection
|
|
|
|
when required.
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2017-06-01 12:18:43 +02:00
|
|
|
QList<QgsFeatureId> nearestNeighbor( const QgsPointXY &point, int neighbors ) const;
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2018-02-09 11:06:29 +10:00
|
|
|
Returns nearest neighbors to a ``point``. The number of neighbours returned is specified
|
|
|
|
by the ``neighbours`` argument.
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
The nearest neighbour test is performed based on the feature bounding boxes only, so for non-point
|
|
|
|
geometry features this method is not guaranteed to return the actual closest neighbours.
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2014-05-27 23:22:50 +02:00
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
int refs() const;
|
|
|
|
%Docstring
|
|
|
|
get reference count - just for debugging!
|
|
|
|
%End
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
};
|
2017-05-22 09:01:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
|
|
|
* src/core/qgsspatialindex.h *
|
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|