QGIS API Documentation
4.3.0-Master (9dce731a7a1)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
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
21
class
QgsFeatureIterator
;
22
class
QgsFeedback
;
23
class
QgsFeatureSource
;
24
class
QgsSpatialIndexKDBushPrivate;
25
class
QgsRectangle
;
26
class
QgsFeature
;
27
28
#include <functional>
29
#include <memory>
30
31
#include "qgis_core.h"
32
#include "
qgspointxy.h
"
33
#include "
qgsspatialindexkdbushdata.h
"
34
35
#include <QList>
36
56
class
CORE_EXPORT
QgsSpatialIndexKDBush
57
{
58
public
:
68
explicit
QgsSpatialIndexKDBush
(
QgsFeatureIterator
&fi,
QgsFeedback
*feedback =
nullptr
);
69
79
explicit
QgsSpatialIndexKDBush
(
const
QgsFeatureSource
&source,
QgsFeedback
*feedback =
nullptr
);
80
81
#ifndef SIP_RUN
82
100
explicit
QgsSpatialIndexKDBush
(
QgsFeatureIterator
&fi,
const
std::function<
bool
(
const
QgsFeature
& ) > &callback,
QgsFeedback
*feedback =
nullptr
);
101
#endif
102
110
QgsSpatialIndexKDBush
();
111
112
QgsSpatialIndexKDBush
(
const
QgsSpatialIndexKDBush
&other );
113
QgsSpatialIndexKDBush
&
operator=
(
const
QgsSpatialIndexKDBush
&other );
114
115
~QgsSpatialIndexKDBush
();
116
126
bool
addFeature
(
QgsFeatureId
id
,
const
QgsPointXY
&point );
127
136
void
finalize
();
137
141
QList<QgsSpatialIndexKDBushData>
intersects
(
const
QgsRectangle
&rectangle )
const
;
142
148
void
intersects
(
const
QgsRectangle
&rectangle,
const
std::function<
void
(
const
QgsSpatialIndexKDBushData
& )> &visitor )
const
SIP_SKIP
;
149
154
QList<QgsSpatialIndexKDBushData>
within
(
const
QgsPointXY
&point,
double
radius )
const
;
155
162
void
within
(
const
QgsPointXY
&point,
double
radius,
const
std::function<
void
(
const
QgsSpatialIndexKDBushData
& )> &visitor )
const
SIP_SKIP
;
163
167
qgssize
size
()
const
;
168
169
private
:
171
QgsSpatialIndexKDBushPrivate *d =
nullptr
;
172
173
friend
class
TestQgsSpatialIndexKdBush
;
174
};
175
176
#endif
// QGSSPATIALINDEXKDBUSH_H
QgsFeatureIterator
Wrapper for iterator of features from vector data provider or vector layer.
Definition
qgsfeatureiterator.h:284
QgsFeatureSource
An interface for objects which provide features via a getFeatures method.
Definition
qgsfeaturesource.h:37
QgsFeature
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition
qgsfeature.h:60
QgsFeedback
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition
qgsfeedback.h:44
QgsPointXY
Represents a 2D point.
Definition
qgspointxy.h:62
QgsRectangle
A rectangle specified with double values.
Definition
qgsrectangle.h:47
QgsSpatialIndexKDBushData
A container for data stored inside a QgsSpatialIndexKDBush index.
Definition
qgsspatialindexkdbushdata.h:33
QgsSpatialIndexKDBush::finalize
void finalize()
Finalizes the index after manually adding features.
Definition
qgsspatialindexkdbush.cpp:76
QgsSpatialIndexKDBush::QgsSpatialIndexKDBush
QgsSpatialIndexKDBush(QgsFeatureIterator &fi, QgsFeedback *feedback=nullptr)
Constructor - creates KDBush index and bulk loads it with features from the iterator.
Definition
qgsspatialindexkdbush.cpp:25
QgsSpatialIndexKDBush::size
qgssize size() const
Returns the size of the index, i.e.
Definition
qgsspatialindexkdbush.cpp:99
QgsSpatialIndexKDBush::intersects
QList< QgsSpatialIndexKDBushData > intersects(const QgsRectangle &rectangle) const
Returns the list of features which fall within the specified rectangle.
Definition
qgsspatialindexkdbush.cpp:104
QgsSpatialIndexKDBush::addFeature
bool addFeature(QgsFeatureId id, const QgsPointXY &point)
Adds a single feature to the index.
Definition
qgsspatialindexkdbush.cpp:71
QgsSpatialIndexKDBush::QgsSpatialIndexKDBush
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::operator=
QgsSpatialIndexKDBush & operator=(const QgsSpatialIndexKDBush &other)
Definition
qgsspatialindexkdbush.cpp:50
QgsSpatialIndexKDBush::within
QList< QgsSpatialIndexKDBushData > within(const QgsPointXY &point, double radius) const
Returns the list of features which are within the given search radius of point.
Definition
qgsspatialindexkdbush.cpp:81
QgsSpatialIndexKDBush::TestQgsSpatialIndexKdBush
friend class TestQgsSpatialIndexKdBush
Definition
qgsspatialindexkdbush.h:173
qgssize
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:8400
SIP_SKIP
#define SIP_SKIP
Definition
qgis_sip.h:138
QgsFeatureId
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features
Definition
qgsfeatureid.h:32
qgspointxy.h
qgsspatialindexkdbushdata.h
Generated on
for QGIS API Documentation by
1.17.0