Commit 1a4e1a7 1 parent ef2f07b commit 1a4e1a7 Copy full SHA for 1a4e1a7
File tree 6 files changed +38
-0
lines changed
PyQt6/core/auto_generated/geometry
core/auto_generated/geometry
6 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -1322,6 +1322,13 @@ geometries.
1322
1322
bool contains( const QgsPointXY *p ) const;
1323
1323
%Docstring
1324
1324
Returns ``True`` if the geometry contains the point ``p``.
1325
+ %End
1326
+
1327
+ bool contains( double x, double y ) const;
1328
+ %Docstring
1329
+ Returns ``True`` if the geometry contains the point at (``x``, ``y``).
1330
+
1331
+ .. versionadded:: 3.38
1325
1332
%End
1326
1333
1327
1334
bool contains( const QgsGeometry &geometry ) const;
Original file line number Diff line number Diff line change @@ -1322,6 +1322,13 @@ geometries.
1322
1322
bool contains( const QgsPointXY *p ) const;
1323
1323
%Docstring
1324
1324
Returns ``True`` if the geometry contains the point ``p``.
1325
+ %End
1326
+
1327
+ bool contains( double x, double y ) const;
1328
+ %Docstring
1329
+ Returns ``True`` if the geometry contains the point at (``x``, ``y``).
1330
+
1331
+ .. versionadded:: 3.38
1325
1332
%End
1326
1333
1327
1334
bool contains( const QgsGeometry &geometry ) const;
Original file line number Diff line number Diff line change @@ -1492,6 +1492,19 @@ bool QgsGeometry::contains( const QgsPointXY *p ) const
1492
1492
return geos.contains ( &pt, &mLastError );
1493
1493
}
1494
1494
1495
+ bool QgsGeometry::contains ( double x, double y ) const
1496
+ {
1497
+ if ( !d->geometry )
1498
+ {
1499
+ return false ;
1500
+ }
1501
+
1502
+ QgsPoint pt ( x, y );
1503
+ QgsGeos geos ( d->geometry .get () );
1504
+ mLastError .clear ();
1505
+ return geos.contains ( &pt, &mLastError );
1506
+ }
1507
+
1495
1508
bool QgsGeometry::contains ( const QgsGeometry &geometry ) const
1496
1509
{
1497
1510
if ( !d->geometry || geometry.isNull () )
Original file line number Diff line number Diff line change @@ -1417,6 +1417,13 @@ class CORE_EXPORT QgsGeometry
1417
1417
*/
1418
1418
bool contains ( const QgsPointXY *p ) const ;
1419
1419
1420
+ /* *
1421
+ * Returns TRUE if the geometry contains the point at (\a x, \a y).
1422
+ *
1423
+ * \since QGIS 3.38
1424
+ */
1425
+ bool contains ( double x, double y ) const ;
1426
+
1420
1427
/* *
1421
1428
* Returns TRUE if the geometry completely contains another \a geometry.
1422
1429
*
Original file line number Diff line number Diff line change @@ -2085,10 +2085,12 @@ void TestQgsGeometry::contains()
2085
2085
QgsPointXY pointInside ( 1 , 2 );
2086
2086
QVERIFY ( geomTest.contains ( &pointInside ) );
2087
2087
QVERIFY ( geomTest.contains ( QgsGeometry::fromWkt ( QStringLiteral ( " Point(1 2)" ) ) ) );
2088
+ QVERIFY ( geomTest.contains ( pointInside.x (), pointInside.y () ) );
2088
2089
2089
2090
QgsPointXY pointOutside ( 3 , 1 );
2090
2091
QVERIFY ( !geomTest.contains ( &pointOutside ) );
2091
2092
QVERIFY ( !geomTest.contains ( QgsGeometry::fromWkt ( QStringLiteral ( " Point(3 1)" ) ) ) );
2093
+ QVERIFY ( !geomTest.contains ( pointOutside.x (), pointOutside.y () ) );
2092
2094
}
2093
2095
2094
2096
void TestQgsGeometry::reshapeGeometryLineMerge ()
Original file line number Diff line number Diff line change @@ -1116,10 +1116,12 @@ def testContains(self):
1116
1116
pointInside = QgsPointXY(1, 1)
1117
1117
self.assertTrue(myPoly.contains(pointInside))
1118
1118
self.assertTrue(myPoly.contains(QgsGeometry.fromPointXY(pointInside)))
1119
+ self.assertTrue(myPoly.contains(pointInside.x(), pointInside.y()))
1119
1120
1120
1121
pointOutside = QgsPointXY(3, 3)
1121
1122
self.assertFalse(myPoly.contains(pointOutside))
1122
1123
self.assertFalse(myPoly.contains(QgsGeometry.fromPointXY(pointOutside)))
1124
+ self.assertFalse(myPoly.contains(pointOutside.x(), pointOutside.y()))
1123
1125
1124
1126
def testTouches(self):
1125
1127
myLine = QgsGeometry.fromPolylineXY([
You can’t perform that action at this time.
0 commit comments