Skip to content

Commit

Permalink
[processing] Use real map settings scope instead of custom canvasexte…
Browse files Browse the repository at this point in the history
…nt variables
  • Loading branch information
nyalldawson committed Nov 22, 2016
1 parent 188033a commit 377cba0
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions python/plugins/processing/core/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ def _expressionContext():
context = QgsExpressionContext()
context.appendScope(QgsExpressionContextUtils.globalScope())
context.appendScope(QgsExpressionContextUtils.projectScope())

if iface.mapCanvas():
context.appendScope(QgsExpressionContextUtils.mapSettingsScope(iface.mapCanvas().mapSettings()))

processingScope = QgsExpressionContextScope()
layers = dataobjects.getAllLayers()
for layer in layers:
Expand All @@ -93,12 +97,6 @@ def _expressionContext():
processingScope.setVariable('%s_band%i_min' % (name, i + 1), stats.minimumValue)
processingScope.setVariable('%s_band%i_max' % (name, i + 1), stats.maximumValue)

extent = iface.mapCanvas().extent()
processingScope.setVariable('canvasextent_minx', extent.xMinimum())
processingScope.setVariable('canvasextent_miny', extent.yMinimum())
processingScope.setVariable('canvasextent_maxx', extent.xMaximum())
processingScope.setVariable('canvasextent_maxy', extent.yMaximum())

extent = iface.mapCanvas().fullExtent()
processingScope.setVariable('fullextent_minx', extent.xMinimum())
processingScope.setVariable('fullextent_miny', extent.yMinimum())
Expand Down

0 comments on commit 377cba0

Please sign in to comment.