|
QGIS API Documentation 3.99.0-Master (e9821da5c6b)
|
A very fast static spatial index for 2D points based on a flat KD-tree. More...
#include <qgsspatialindexkdbush.h>
Public Member Functions | |
| QgsSpatialIndexKDBush () | |
| Constructs an empty index. | |
| QgsSpatialIndexKDBush (const QgsFeatureSource &source, QgsFeedback *feedback=nullptr) | |
| Constructor - creates KDBush index and bulk loads it with features from the source. | |
| QgsSpatialIndexKDBush (const QgsSpatialIndexKDBush &other) | |
| QgsSpatialIndexKDBush (QgsFeatureIterator &fi, const std::function< bool(const QgsFeature &) > &callback, QgsFeedback *feedback=nullptr) | |
| Constructor - creates KDBush index and bulk loads it with features from the source. | |
| QgsSpatialIndexKDBush (QgsFeatureIterator &fi, QgsFeedback *feedback=nullptr) | |
| Constructor - creates KDBush index and bulk loads it with features from the iterator. | |
| ~QgsSpatialIndexKDBush () | |
| bool | addFeature (QgsFeatureId id, const QgsPointXY &point) |
| Adds a single feature to the index. | |
| void | finalize () |
| Finalizes the index after manually adding features. | |
| QList< QgsSpatialIndexKDBushData > | intersects (const QgsRectangle &rectangle) const |
| Returns the list of features which fall within the specified rectangle. | |
| void | intersects (const QgsRectangle &rectangle, const std::function< void(QgsSpatialIndexKDBushData)> &visitor) const |
| Calls a visitor function for all features which fall within the specified rectangle. | |
| QgsSpatialIndexKDBush & | operator= (const QgsSpatialIndexKDBush &other) |
| qgssize | size () const |
| Returns the size of the index, i.e. | |
| QList< QgsSpatialIndexKDBushData > | within (const QgsPointXY &point, double radius) const |
| Returns the list of features which are within the given search radius of point. | |
| void | within (const QgsPointXY &point, double radius, const std::function< void(QgsSpatialIndexKDBushData)> &visitor) |
| Calls a visitor function for all features which are within the given search radius of point. | |
Friends | |
| class | TestQgsSpatialIndexKdBush |
A very fast static spatial index for 2D points based on a flat KD-tree.
Compared to QgsSpatialIndex, this index:
QgsSpatialIndexKDBush objects are implicitly shared and can be inexpensively copied.
Definition at line 56 of file qgsspatialindexkdbush.h.
|
explicit |
Constructor - creates KDBush index and bulk loads it with features from the iterator.
The optional feedback object can be used to allow cancellation 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.
Any non-single point features encountered during iteration will be ignored and not included in the index.
Definition at line 25 of file qgsspatialindexkdbush.cpp.
|
explicit |
Constructor - creates KDBush index and bulk loads it with features from the source.
The optional feedback object can be used to allow cancellation 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.
Any non-single point features encountered during iteration will be ignored and not included in the index.
Definition at line 31 of file qgsspatialindexkdbush.cpp.
|
explicit |
Constructor - creates KDBush index and bulk loads it with features from the source.
This constructor allows for a callback function to be specified, which is called for each added feature in turn. It allows for bulk spatial index load along with other feature based operations on a single iteration through a feature source. If callback returns false, the load and iteration is canceled.
The optional feedback object can be used to allow cancellation 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.
Any non-single point features encountered during iteration will be ignored and not included in the index.
| QgsSpatialIndexKDBush::QgsSpatialIndexKDBush | ( | ) |
Constructs an empty index.
The index must be manually populated by calls to addFeature() followed by finalize().
Definition at line 44 of file qgsspatialindexkdbush.cpp.
| QgsSpatialIndexKDBush::QgsSpatialIndexKDBush | ( | const QgsSpatialIndexKDBush & | other | ) |
Definition at line 49 of file qgsspatialindexkdbush.cpp.
| QgsSpatialIndexKDBush::~QgsSpatialIndexKDBush | ( | ) |
Definition at line 69 of file qgsspatialindexkdbush.cpp.
| bool QgsSpatialIndexKDBush::addFeature | ( | QgsFeatureId | id, |
| const QgsPointXY & | point ) |
Adds a single feature to the index.
true if feature was successfully added to index. Definition at line 75 of file qgsspatialindexkdbush.cpp.
| void QgsSpatialIndexKDBush::finalize | ( | ) |
Finalizes the index after manually adding features.
This method must be called after adding all features via addFeature() and before performing any queries on the index.
Definition at line 80 of file qgsspatialindexkdbush.cpp.
| QList< QgsSpatialIndexKDBushData > QgsSpatialIndexKDBush::intersects | ( | const QgsRectangle & | rectangle | ) | const |
Returns the list of features which fall within the specified rectangle.
Definition at line 108 of file qgsspatialindexkdbush.cpp.
| void QgsSpatialIndexKDBush::intersects | ( | const QgsRectangle & | rectangle, |
| const std::function< void(QgsSpatialIndexKDBushData)> & | visitor ) const |
Calls a visitor function for all features which fall within the specified rectangle.
Definition at line 121 of file qgsspatialindexkdbush.cpp.
| QgsSpatialIndexKDBush & QgsSpatialIndexKDBush::operator= | ( | const QgsSpatialIndexKDBush & | other | ) |
Definition at line 54 of file qgsspatialindexkdbush.cpp.
| qgssize QgsSpatialIndexKDBush::size | ( | ) | const |
Returns the size of the index, i.e.
the number of points contained within the index.
Definition at line 103 of file qgsspatialindexkdbush.cpp.
| QList< QgsSpatialIndexKDBushData > QgsSpatialIndexKDBush::within | ( | const QgsPointXY & | point, |
| double | radius ) const |
Returns the list of features which are within the given search radius of point.
Definition at line 85 of file qgsspatialindexkdbush.cpp.
| void QgsSpatialIndexKDBush::within | ( | const QgsPointXY & | point, |
| double | radius, | ||
| const std::function< void(QgsSpatialIndexKDBushData)> & | visitor ) |
Calls a visitor function for all features which are within the given search radius of point.
Definition at line 95 of file qgsspatialindexkdbush.cpp.
|
friend |
Definition at line 175 of file qgsspatialindexkdbush.h.