@@ -66,6 +66,7 @@ def processAlgorithm(self, progress):
66
66
allLinesList = []
67
67
features = vector .features (vlayer )
68
68
current = 0
69
+ progress .setInfo ('Processing lines...' )
69
70
total = 40.0 / float (len (features ))
70
71
for inFeat in features :
71
72
inGeom = inFeat .geometry ()
@@ -77,10 +78,19 @@ def processAlgorithm(self, progress):
77
78
progress .setPercentage (int (current * total ))
78
79
progress .setPercentage (40 )
79
80
allLines = MultiLineString (allLinesList )
80
- allLines = allLines .union (Point (0 , 0 ))
81
+ progress .setInfo ('Noding lines...' )
82
+ try :
83
+ from shapely .ops import unary_union
84
+ allLines = unary_union (allLines )
85
+ except ImportError :
86
+ allLines = allLines .union (Point (0 , 0 ))
81
87
progress .setPercentage (45 )
88
+ progress .setInfo ('Polygonizing...' )
82
89
polygons = list (polygonize ([allLines ]))
90
+ if not polygons :
91
+ raise GeoAlgorithmExecutionException ('No polygons were created!' )
83
92
progress .setPercentage (50 )
93
+ progress .setInfo ('Saving polygons...' )
84
94
writer = output .getVectorWriter (fields , QGis .WKBPolygon , vlayer .crs ())
85
95
outFeat = QgsFeature ()
86
96
current = 0
@@ -93,6 +103,7 @@ def processAlgorithm(self, progress):
93
103
writer .addFeature (outFeat )
94
104
current += 1
95
105
progress .setPercentage (50 + int (current * total ))
106
+ progress .setInfo ('Finished' )
96
107
del writer
97
108
98
109
def defineCharacteristics (self ):
0 commit comments