QGIS API Documentation 3.32.0-Lima (311a8cb8a6)
qgsspatialindexkdbush.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsspatialindexkdbush.h
3 -----------------
4 begin : July 2018
5 copyright : (C) 2018 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSSPATIALINDEXKDBUSH_H
19#define QGSSPATIALINDEXKDBUSH_H
20
22class QgsFeedback;
24class QgsSpatialIndexKDBushPrivate;
25class QgsRectangle;
26class QgsFeature;
27
28#include "qgis_core.h"
30#include "qgspointxy.h"
31#include <memory>
32#include <QList>
33#include <functional>
34
54class CORE_EXPORT QgsSpatialIndexKDBush
55{
56 public:
57
67 explicit QgsSpatialIndexKDBush( QgsFeatureIterator &fi, QgsFeedback *feedback = nullptr );
68
78 explicit QgsSpatialIndexKDBush( const QgsFeatureSource &source, QgsFeedback *feedback = nullptr );
79
80#ifndef SIP_RUN
81
99 explicit QgsSpatialIndexKDBush( QgsFeatureIterator &fi, const std::function< bool( const QgsFeature & ) > &callback, QgsFeedback *feedback = nullptr );
100#endif
101
104
106 QgsSpatialIndexKDBush &operator=( const QgsSpatialIndexKDBush &other );
107
109
113 QList<QgsSpatialIndexKDBushData> intersects( const QgsRectangle &rectangle ) const;
114
120 void intersects( const QgsRectangle &rectangle, const std::function<void( QgsSpatialIndexKDBushData )> &visitor ) const SIP_SKIP;
121
126 QList<QgsSpatialIndexKDBushData> within( const QgsPointXY &point, double radius ) const;
127
134 void within( const QgsPointXY &point, double radius, const std::function<void( QgsSpatialIndexKDBushData )> &visitor ) SIP_SKIP;
135
139 qgssize size() const;
140
141 private:
142
144 QgsSpatialIndexKDBushPrivate *d = nullptr;
145
146 friend class TestQgsSpatialIndexKdBush;
147};
148
149#endif // QGSSPATIALINDEXKDBUSH_H
Wrapper for iterator of features from vector data provider or vector layer.
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...
Definition: qgsfeature.h:56
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition: qgsfeedback.h:45
A class to represent a 2D point.
Definition: qgspointxy.h:59
A rectangle specified with double values.
Definition: qgsrectangle.h:42
A container for data stored inside a QgsSpatialIndexKDBush index.
A very fast static spatial index for 2D points based on a flat KD-tree.
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.
unsigned long long qgssize
Qgssize is used instead of size_t, because size_t is stdlib type, unknown by SIP, and it would be har...
Definition: qgis.h:4543
#define SIP_SKIP
Definition: qgis_sip.h:126