Skip to content

Commit

Permalink
Add Multigeometries support in Simplify tool for geomVertexCount func…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
slarosa committed May 12, 2012
1 parent 2607535 commit e9ff072
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions python/plugins/fTools/tools/doSimplify.py
Expand Up @@ -162,10 +162,18 @@ def restoreGui( self ):
def geomVertexCount( geometry ):
geomType = geometry.type()
if geomType == 1: # line
points = geometry.asPolyline()
if geometry.isMultipart():
pointsList = geometry.asMultiPolyline()
points=sum(pointsList, [])
else:
points = geometry.asPolyline()
return len( points )
elif geomType == 2: # polygon
polylines = geometry.asPolygon()
if geometry.isMultipart():
polylinesList = geometry.asMultiPolygon()
polylines=sum(polylinesList, [])
else:
polylines = geometry.asPolygon()
points = []
for l in polylines:
points.extend( l )
Expand Down

0 comments on commit e9ff072

Please sign in to comment.