Skip to content

Commit 05368e4

Browse files
committed
Rename intersect to intersects for consistency with QgsSpatialIndex
1 parent 38251cb commit 05368e4

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

python/core/auto_generated/qgsspatialindexkdbush.sip.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Copy constructor
6666

6767
~QgsSpatialIndexKDBush();
6868

69-
QList<QgsSpatialIndexKDBushData> intersect( const QgsRectangle &rectangle ) const;
69+
QList<QgsSpatialIndexKDBushData> intersects( const QgsRectangle &rectangle ) const;
7070
%Docstring
7171
Returns the list of features which fall within the specified ``rectangle``.
7272
%End

src/core/qgsspatialindexkdbush.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ qgssize QgsSpatialIndexKDBush::size() const
7373
return d->index->size();
7474
}
7575

76-
QList<QgsSpatialIndexKDBushData> QgsSpatialIndexKDBush::intersect( const QgsRectangle &rectangle ) const
76+
QList<QgsSpatialIndexKDBushData> QgsSpatialIndexKDBush::intersects( const QgsRectangle &rectangle ) const
7777
{
7878
QList<QgsSpatialIndexKDBushData> result;
7979
d->index->range( rectangle.xMinimum(),
@@ -83,7 +83,7 @@ QList<QgsSpatialIndexKDBushData> QgsSpatialIndexKDBush::intersect( const QgsRect
8383
return result;
8484
}
8585

86-
void QgsSpatialIndexKDBush::intersect( const QgsRectangle &rectangle, const std::function<void( QgsSpatialIndexKDBushData )> &visitor ) const
86+
void QgsSpatialIndexKDBush::intersects( const QgsRectangle &rectangle, const std::function<void( QgsSpatialIndexKDBushData )> &visitor ) const
8787
{
8888
d->index->range( rectangle.xMinimum(),
8989
rectangle.yMinimum(),

src/core/qgsspatialindexkdbush.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,14 @@ class CORE_EXPORT QgsSpatialIndexKDBush
8787
/**
8888
* Returns the list of features which fall within the specified \a rectangle.
8989
*/
90-
QList<QgsSpatialIndexKDBushData> intersect( const QgsRectangle &rectangle ) const;
90+
QList<QgsSpatialIndexKDBushData> intersects( const QgsRectangle &rectangle ) const;
9191

9292
/**
9393
* Calls a \a visitor function for all features which fall within the specified \a rectangle.
9494
*
9595
* \note Not available in Python bindings
9696
*/
97-
void intersect( const QgsRectangle &rectangle, const std::function<void( QgsSpatialIndexKDBushData )> &visitor ) const SIP_SKIP;
97+
void intersects( const QgsRectangle &rectangle, const std::function<void( QgsSpatialIndexKDBushData )> &visitor ) const SIP_SKIP;
9898

9999
/**
100100
* Returns the list of features which are within the given search \a radius

tests/src/core/testqgsspatialindexkdbush.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ class TestQgsSpatialIndexKdBush : public QObject
8787
QgsSpatialIndexKDBush index( *vl->dataProvider() );
8888
QVERIFY( index.size() == 4 );
8989

90-
QList<QgsSpatialIndexKDBushData> fids = index.intersect( QgsRectangle( 0, 0, 10, 10 ) );
90+
QList<QgsSpatialIndexKDBushData> fids = index.intersects( QgsRectangle( 0, 0, 10, 10 ) );
9191
QVERIFY( fids.count() == 1 );
9292
QVERIFY( testContains( fids, 1, QgsPointXY( 1, 1 ) ) );
9393

94-
QList<QgsSpatialIndexKDBushData> fids2 = index.intersect( QgsRectangle( -10, -10, 0, 10 ) );
94+
QList<QgsSpatialIndexKDBushData> fids2 = index.intersects( QgsRectangle( -10, -10, 0, 10 ) );
9595
QCOMPARE( fids2.count(), 2 );
9696
QVERIFY( testContains( fids2, 2, QgsPointXY( -1, 1 ) ) );
9797
QVERIFY( testContains( fids2, 3, QgsPointXY( -1, -1 ) ) );
@@ -128,7 +128,7 @@ class TestQgsSpatialIndexKdBush : public QObject
128128
QVERIFY( index->d->ref == 2 );
129129

130130
// test that copied index works
131-
QList<QgsSpatialIndexKDBushData> fids = indexCopy->intersect( QgsRectangle( 0, 0, 10, 10 ) );
131+
QList<QgsSpatialIndexKDBushData> fids = indexCopy->intersects( QgsRectangle( 0, 0, 10, 10 ) );
132132
QVERIFY( fids.count() == 1 );
133133
QVERIFY( testContains( fids, 1, QgsPointXY( 1, 1 ) ) );
134134

@@ -139,7 +139,7 @@ class TestQgsSpatialIndexKdBush : public QObject
139139
index.reset();
140140

141141
// test that copied index still works
142-
fids = indexCopy->intersect( QgsRectangle( 0, 0, 10, 10 ) );
142+
fids = indexCopy->intersects( QgsRectangle( 0, 0, 10, 10 ) );
143143
QVERIFY( fids.count() == 1 );
144144
QVERIFY( testContains( fids, 1, QgsPointXY( 1, 1 ) ) );
145145
QVERIFY( indexCopy->d->ref == 1 );
@@ -148,14 +148,14 @@ class TestQgsSpatialIndexKdBush : public QObject
148148
std::unique_ptr< QgsVectorLayer > vl2 = qgis::make_unique< QgsVectorLayer >( "Point", QString(), QStringLiteral( "memory" ) );
149149
QgsSpatialIndexKDBush index3( *vl2->dataProvider() );
150150
QVERIFY( index3.size() == 0 );
151-
fids = index3.intersect( QgsRectangle( 0, 0, 10, 10 ) );
151+
fids = index3.intersects( QgsRectangle( 0, 0, 10, 10 ) );
152152
QVERIFY( fids.count() == 0 );
153153
QVERIFY( index3.d->ref == 1 );
154154

155155
index3 = *indexCopy;
156156
QVERIFY( index3.d == indexCopy->d );
157157
QVERIFY( index3.d->ref == 2 );
158-
fids = index3.intersect( QgsRectangle( 0, 0, 10, 10 ) );
158+
fids = index3.intersects( QgsRectangle( 0, 0, 10, 10 ) );
159159
QVERIFY( fids.count() == 1 );
160160
QVERIFY( testContains( fids, 1, QgsPointXY( 1, 1 ) ) );
161161

0 commit comments

Comments
 (0)