Skip to content
Permalink
Browse files

[processing] Use real map settings scope instead of custom canvasexte…

…nt variables
  • Loading branch information
nyalldawson committed Nov 22, 2016
1 parent 188033a commit 377cba0b74c0ce104acf72282b4cfabec54199a2
Showing with 4 additions and 6 deletions.
  1. +4 −6 python/plugins/processing/core/parameters.py
@@ -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:
@@ -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())

0 comments on commit 377cba0

Please sign in to comment.
You can’t perform that action at this time.