Skip to content

Commit 95de3a4

Browse files
committed
[processing] add cancellation support where possible
1 parent 5af177e commit 95de3a4

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

python/plugins/processing/algs/qgis/ShortestPathLayerToPoint.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,9 @@ def processAlgorithm(self, parameters, context, feedback):
237237

238238
total = 100.0 / source.featureCount() if source.featureCount() else 1
239239
for i in range(1, count + 1):
240+
if feedback.isCanceled():
241+
break
242+
240243
idxStart = graph.findVertex(snappedPoints[i])
241244
tree, cost = QgsGraphAnalyzer.dijkstra(graph, idxStart, 0)
242245

python/plugins/processing/algs/qgis/ShortestPathPointToLayer.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,9 @@ def processAlgorithm(self, parameters, context, feedback):
238238

239239
total = 100.0 / source.featureCount() if source.featureCount() else 1
240240
for i in range(1, count + 1):
241+
if feedback.isCanceled():
242+
break
243+
241244
idxEnd = graph.findVertex(snappedPoints[i])
242245

243246
if tree[idxEnd] == -1:

0 commit comments

Comments
 (0)