Skip to content

Commit 5075e44

Browse files
agiudiceandreanyalldawson
authored andcommittedMay 25, 2020
Fix QgsGeometry constParts() example code
it wrongly refers to parts() instead of constParts()
1 parent 281fdf1 commit 5075e44

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
@@ -559,17 +559,17 @@ class CORE_EXPORT QgsGeometry
559559
* \code{.py}
560560
* # print the WKT representation of each part in a multi-point geometry
561561
* geometry = QgsGeometry.fromWkt( 'MultiPoint( 0 0, 1 1, 2 2)' )
562-
* for part in geometry.parts():
562+
* for part in geometry.constParts():
563563
* print(part.asWkt())
564564
*
565565
* # single part geometries only have one part - this loop will iterate once only
566566
* geometry = QgsGeometry.fromWkt( 'LineString( 0 0, 10 10 )' )
567-
* for part in geometry.parts():
567+
* for part in geometry.constParts():
568568
* print(part.asWkt())
569569
*
570570
* # part iteration can also be combined with vertex iteration
571571
* 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)))' )
572-
* for part in geometry.parts():
572+
* for part in geometry.constParts():
573573
* for v in part.vertices():
574574
* print(v.x(), v.y())
575575
*

0 commit comments

Comments
 (0)
Please sign in to comment.