Skip to content

Commit

Permalink
also add MultiPolygon support in Densify geometry
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy authored and jef-n committed May 17, 2012
1 parent 99f88b3 commit 32cd9b5
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions python/plugins/fTools/tools/doSimplify.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,19 @@ def densify( polyline, pointsNumber ):
def densifyGeometry( geometry, pointsNumber, isPolygon ):
output = []
if isPolygon:
rings = geometry.asPolygon()
for ring in rings:
ring = densify( ring, pointsNumber )
output.append( ring )
return QgsGeometry.fromPolygon( output )
if geometry.isMultipart():
polygons = geometry.asMultiPolygon()
for poly in polygons:
p = []
for ring in poly:
p.append( densify( ring, pointsNumber ) )
output.append( p )
return QgsGeometry.fromMultiPolygon( output )
else:
rings = geometry.asPolygon()
for ring in rings:
output.append( densify( ring, pointsNumber ) )
return QgsGeometry.fromPolygon( output )
else:
if geometry.isMultipart():
lines = geometry.asMultiPolyline()
Expand Down

0 comments on commit 32cd9b5

Please sign in to comment.