Skip to content
Permalink
Browse files
Add Multigeometries support in Simplify tool for geomVertexCount func…
…tion
  • Loading branch information
slarosa authored and jef-n committed May 17, 2012
1 parent 32cd9b5 commit f48a4bf60f78b57afdc52691bcdfbb10117012b0
Showing with 10 additions and 2 deletions.
  1. +10 −2 python/plugins/fTools/tools/doSimplify.py
@@ -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 )

0 comments on commit f48a4bf

Please sign in to comment.