Skip to content

Commit 99f88b3

Browse files
alexbruyjef-n
authored andcommittedMay 17, 2012
add MultiLineString support to Densify geometries tool (addresses #5577)
1 parent 3b0d3db commit 99f88b3

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed
 

‎python/plugins/fTools/tools/doSimplify.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,17 +194,23 @@ def densify( polyline, pointsNumber ):
194194
return output
195195

196196
def densifyGeometry( geometry, pointsNumber, isPolygon ):
197+
output = []
197198
if isPolygon:
198199
rings = geometry.asPolygon()
199-
output = []
200200
for ring in rings:
201201
ring = densify( ring, pointsNumber )
202202
output.append( ring )
203203
return QgsGeometry.fromPolygon( output )
204204
else:
205-
points = geometry.asPolyline()
206-
output = densify( points, pointsNumber )
207-
return QgsGeometry.fromPolyline( output )
205+
if geometry.isMultipart():
206+
lines = geometry.asMultiPolyline()
207+
for points in lines:
208+
output.append( densify( points, pointsNumber ) )
209+
return QgsGeometry.fromMultiPolyline( output )
210+
else:
211+
points = geometry.asPolyline()
212+
output = densify( points, pointsNumber )
213+
return QgsGeometry.fromPolyline( output )
208214

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

0 commit comments

Comments
 (0)
Please sign in to comment.