Count and report progress based on expected total

Algorithm appears to freeze without progress while `extent_engine.intersects(geom.constGet())` returns false. 

This keeps the progress bar continuous and smooth, even if the feature ends up not being added.

(noticed this because the algo hangs for 2 mins while processing a large dataset which I think is outside the extent somehow. None of the points going in. No apparent progress.)
This commit is contained in:
Jordan Feldstein 2018-08-04 15:15:59 -07:00 committed by Nyall Dawson
parent 553090b17a
commit 93ee06247d

View File

@ -155,8 +155,10 @@ class RegularPoints(QgisAlgorithm):
f.setGeometry(geom)
sink.addFeature(f, QgsFeatureSink.FastInsert)
x += pSpacing
count += 1
feedback.setProgress(int(count * total))
count += 1
feedback.setProgress(int(count * total))
y = y - pSpacing
return {self.OUTPUT: dest_id}