Skip to content

Commit e9ff072

Browse files
author
slarosa
committed
Add Multigeometries support in Simplify tool for geomVertexCount function
1 parent 2607535 commit e9ff072

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

python/plugins/fTools/tools/doSimplify.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,18 @@ def restoreGui( self ):
162162
def geomVertexCount( geometry ):
163163
geomType = geometry.type()
164164
if geomType == 1: # line
165-
points = geometry.asPolyline()
165+
if geometry.isMultipart():
166+
pointsList = geometry.asMultiPolyline()
167+
points=sum(pointsList, [])
168+
else:
169+
points = geometry.asPolyline()
166170
return len( points )
167171
elif geomType == 2: # polygon
168-
polylines = geometry.asPolygon()
172+
if geometry.isMultipart():
173+
polylinesList = geometry.asMultiPolygon()
174+
polylines=sum(polylinesList, [])
175+
else:
176+
polylines = geometry.asPolygon()
169177
points = []
170178
for l in polylines:
171179
points.extend( l )

0 commit comments

Comments
 (0)