QGIS API Documentation
3.14.0-Pi (9f7028fd23)
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
w
z
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
w
z
Variables
Typedefs
Enumerations
Enumerator
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
2
3
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
2
3
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
c
e
f
g
h
k
l
m
o
p
r
s
t
u
v
w
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Properties
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
y
z
Related Functions
a
c
d
e
f
g
i
l
m
n
o
p
q
r
s
t
v
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
z
Variables
a
b
c
d
e
f
g
h
i
l
n
o
p
q
r
s
t
u
w
Typedefs
a
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
Enumerations
Enumerator
Macros
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
w
y
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
src
core
qgsspatialindexkdbush.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgsspatialindexkdbush.cpp
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
#include "
qgsspatialindexkdbush.h
"
19
#include "
qgsfeatureiterator.h
"
20
#include "
qgsfeedback.h
"
21
#include "
qgsfeaturesource.h
"
22
#include "
qgsspatialindexkdbush_p.h
"
23
24
QgsSpatialIndexKDBush::QgsSpatialIndexKDBush
(
QgsFeatureIterator
&fi,
QgsFeedback
*feedback )
25
: d( new QgsSpatialIndexKDBushPrivate( fi, feedback ) )
26
{
27
28
}
29
30
QgsSpatialIndexKDBush::QgsSpatialIndexKDBush
(
const
QgsFeatureSource
&source,
QgsFeedback
*feedback )
31
: d( new QgsSpatialIndexKDBushPrivate( source, feedback ) )
32
{
33
}
34
35
QgsSpatialIndexKDBush::QgsSpatialIndexKDBush
(
const
QgsSpatialIndexKDBush
&other ): d( other.d )
36
{
37
d->ref.ref();
38
}
39
40
QgsSpatialIndexKDBush
&
QgsSpatialIndexKDBush::operator=
(
const
QgsSpatialIndexKDBush
&other )
41
{
42
if
(
this
!= &other )
43
{
44
if
( !d->ref.deref() )
45
{
46
delete
d;
47
}
48
49
d = other.d;
50
d->ref.ref();
51
}
52
return
*
this
;
53
}
54
55
QgsSpatialIndexKDBush::~QgsSpatialIndexKDBush
()
56
{
57
if
( !d->ref.deref() )
58
delete
d;
59
}
60
61
QList<QgsSpatialIndexKDBushData>
QgsSpatialIndexKDBush::within
(
const
QgsPointXY
&point,
double
radius )
const
62
{
63
QList<QgsSpatialIndexKDBushData> result;
64
d->index->within( point.
x
(), point.
y
(), radius, [&result](
const
QgsSpatialIndexKDBushData
& p ) { result << p; } );
65
return
result;
66
}
67
68
void
QgsSpatialIndexKDBush::within
(
const
QgsPointXY
&point,
double
radius,
const
std::function<
void
(
QgsSpatialIndexKDBushData
)> &visitor )
69
{
70
d->index->within( point.
x
(), point.
y
(), radius, visitor );
71
}
72
73
qgssize
QgsSpatialIndexKDBush::size
()
const
74
{
75
return
d->index->size();
76
}
77
78
QList<QgsSpatialIndexKDBushData>
QgsSpatialIndexKDBush::intersects
(
const
QgsRectangle
&rectangle )
const
79
{
80
QList<QgsSpatialIndexKDBushData> result;
81
d->index->range( rectangle.
xMinimum
(),
82
rectangle.
yMinimum
(),
83
rectangle.
xMaximum
(),
84
rectangle.
yMaximum
(), [&result](
const
QgsSpatialIndexKDBushData
& p ) { result << p; } );
85
return
result;
86
}
87
88
void
QgsSpatialIndexKDBush::intersects
(
const
QgsRectangle
&rectangle,
const
std::function<
void
(
QgsSpatialIndexKDBushData
)> &visitor )
const
89
{
90
d->index->range( rectangle.
xMinimum
(),
91
rectangle.
yMinimum
(),
92
rectangle.
xMaximum
(),
93
rectangle.
yMaximum
(), visitor );
94
}
qgsspatialindexkdbush_p.h
QgsPointXY::y
double y
Definition:
qgspointxy.h:48
QgsRectangle::xMaximum
double xMaximum() const
Returns the x maximum value (right side of rectangle).
Definition:
qgsrectangle.h:162
qgsfeatureiterator.h
QgsFeatureSource
Definition:
qgsfeaturesource.h:37
QgsRectangle
Definition:
qgsrectangle.h:41
QgsSpatialIndexKDBush::intersects
QList< QgsSpatialIndexKDBushData > intersects(const QgsRectangle &rectangle) const
Returns the list of features which fall within the specified rectangle.
Definition:
qgsspatialindexkdbush.cpp:78
qgsspatialindexkdbush.h
QgsSpatialIndexKDBush::size
qgssize size() const
Returns the size of the index, i.e.
Definition:
qgsspatialindexkdbush.cpp:73
QgsFeedback
Definition:
qgsfeedback.h:43
QgsSpatialIndexKDBush::QgsSpatialIndexKDBush
QgsSpatialIndexKDBush(QgsFeatureIterator &fi, QgsFeedback *feedback=nullptr)
Constructor - creates KDBush index and bulk loads it with features from the iterator.
Definition:
qgsspatialindexkdbush.cpp:24
QgsSpatialIndexKDBush::~QgsSpatialIndexKDBush
~QgsSpatialIndexKDBush()
Definition:
qgsspatialindexkdbush.cpp:55
qgsfeaturesource.h
QgsRectangle::yMaximum
double yMaximum() const
Returns the y maximum value (top side of rectangle).
Definition:
qgsrectangle.h:172
QgsPointXY
Definition:
qgspointxy.h:43
QgsPointXY::x
double x
Definition:
qgspointxy.h:47
QgsRectangle::yMinimum
double yMinimum() const
Returns the y minimum value (bottom side of rectangle).
Definition:
qgsrectangle.h:177
QgsSpatialIndexKDBush::operator=
QgsSpatialIndexKDBush & operator=(const QgsSpatialIndexKDBush &other)
Assignment operator.
Definition:
qgsspatialindexkdbush.cpp:40
QgsFeatureIterator
Definition:
qgsfeatureiterator.h:263
qgsfeedback.h
QgsSpatialIndexKDBush
Definition:
qgsspatialindexkdbush.h:53
QgsRectangle::xMinimum
double xMinimum() const
Returns the x minimum value (left side of rectangle).
Definition:
qgsrectangle.h:167
QgsSpatialIndexKDBushData
Definition:
qgsspatialindexkdbushdata.h:32
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:723
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:61
Generated on Mon Jun 22 2020 05:14:09 for QGIS API Documentation by
1.8.17