Skip to content

Commit 26646d6

Browse files
github-actions[bot]nyalldawson
authored andcommittedMay 25, 2020
Fix QgsGeometry constParts() example code
1 parent 1a1aa62 commit 26646d6

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed
 

‎python/core/auto_generated/geometry/qgsgeometry.sip.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -481,17 +481,17 @@ iteration only is required.
481481

482482
# print the WKT representation of each part in a multi-point geometry
483483
geometry = QgsGeometry.fromWkt( 'MultiPoint( 0 0, 1 1, 2 2)' )
484-
for part in geometry.parts():
484+
for part in geometry.constParts():
485485
print(part.asWkt())
486486

487487
# single part geometries only have one part - this loop will iterate once only
488488
geometry = QgsGeometry.fromWkt( 'LineString( 0 0, 10 10 )' )
489-
for part in geometry.parts():
489+
for part in geometry.constParts():
490490
print(part.asWkt())
491491

492492
# part iteration can also be combined with vertex iteration
493493
geometry = QgsGeometry.fromWkt( 'MultiPolygon((( 0 0, 0 10, 10 10, 10 0, 0 0 ),( 5 5, 5 6, 6 6, 6 5, 5 5)),((20 2, 22 2, 22 4, 20 4, 20 2)))' )
494-
for part in geometry.parts():
494+
for part in geometry.constParts():
495495
for v in part.vertices():
496496
print(v.x(), v.y())
497497

‎src/core/geometry/qgsgeometry.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -558,17 +558,17 @@ class CORE_EXPORT QgsGeometry
558558
* \code{.py}
559559
* # print the WKT representation of each part in a multi-point geometry
560560
* geometry = QgsGeometry.fromWkt( 'MultiPoint( 0 0, 1 1, 2 2)' )
561-
* for part in geometry.parts():
561+
* for part in geometry.constParts():
562562
* print(part.asWkt())
563563
*
564564
* # single part geometries only have one part - this loop will iterate once only
565565
* geometry = QgsGeometry.fromWkt( 'LineString( 0 0, 10 10 )' )
566-
* for part in geometry.parts():
566+
* for part in geometry.constParts():
567567
* print(part.asWkt())
568568
*
569569
* # part iteration can also be combined with vertex iteration
570570
* geometry = QgsGeometry.fromWkt( 'MultiPolygon((( 0 0, 0 10, 10 10, 10 0, 0 0 ),( 5 5, 5 6, 6 6, 6 5, 5 5)),((20 2, 22 2, 22 4, 20 4, 20 2)))' )
571-
* for part in geometry.parts():
571+
* for part in geometry.constParts():
572572
* for v in part.vertices():
573573
* print(v.x(), v.y())
574574
*

0 commit comments

Comments
 (0)
Please sign in to comment.