Skip to content

Commit

Permalink
[processing] add cancellation support where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Jul 17, 2017
1 parent 5af177e commit 95de3a4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Expand Up @@ -237,6 +237,9 @@ def processAlgorithm(self, parameters, context, feedback):

total = 100.0 / source.featureCount() if source.featureCount() else 1
for i in range(1, count + 1):
if feedback.isCanceled():
break

idxStart = graph.findVertex(snappedPoints[i])
tree, cost = QgsGraphAnalyzer.dijkstra(graph, idxStart, 0)

Expand Down
Expand Up @@ -238,6 +238,9 @@ def processAlgorithm(self, parameters, context, feedback):

total = 100.0 / source.featureCount() if source.featureCount() else 1
for i in range(1, count + 1):
if feedback.isCanceled():
break

idxEnd = graph.findVertex(snappedPoints[i])

if tree[idxEnd] == -1:
Expand Down

0 comments on commit 95de3a4

Please sign in to comment.