Skip to content
Permalink
Browse files

Fix QgsGeometry constParts() example code

it wrongly refers to parts() instead of constParts()
  • Loading branch information
agiudiceandrea authored and nyalldawson committed May 25, 2020
1 parent 281fdf1 commit 5075e4433b86ccde214a185db77d70dfa83dea14
Showing with 6 additions and 6 deletions.
  1. +3 −3 python/core/auto_generated/geometry/qgsgeometry.sip.in
  2. +3 −3 src/core/geometry/qgsgeometry.h
@@ -481,17 +481,17 @@ iteration only is required.

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

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

# part iteration can also be combined with vertex iteration
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)))' )
for part in geometry.parts():
for part in geometry.constParts():
for v in part.vertices():
print(v.x(), v.y())

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

0 comments on commit 5075e44

Please sign in to comment.
You can’t perform that action at this time.