Skip to content

Commit

Permalink
add MultiLineString support to Densify geometries tool (addresses #5577)
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 3b0d3db commit 99f88b3
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions python/plugins/fTools/tools/doSimplify.py
Expand Up @@ -194,17 +194,23 @@ def densify( polyline, pointsNumber ):
return output

def densifyGeometry( geometry, pointsNumber, isPolygon ):
output = []
if isPolygon:
rings = geometry.asPolygon()
output = []
for ring in rings:
ring = densify( ring, pointsNumber )
output.append( ring )
return QgsGeometry.fromPolygon( output )
else:
points = geometry.asPolyline()
output = densify( points, pointsNumber )
return QgsGeometry.fromPolyline( output )
if geometry.isMultipart():
lines = geometry.asMultiPolyline()
for points in lines:
output.append( densify( points, pointsNumber ) )
return QgsGeometry.fromMultiPolyline( output )
else:
points = geometry.asPolyline()
output = densify( points, pointsNumber )
return QgsGeometry.fromPolyline( output )

class GeomThread( QThread ):
def __init__( self, function, inputLayer, useSelection, tolerance, writeShape, shapePath, shapeEncoding ):
Expand Down

0 comments on commit 99f88b3

Please sign in to comment.