Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #8785 from elpaso/bugfix-20601-processing-side
Pick up all layer entries references from the project context
  • Loading branch information
elpaso committed Jan 3, 2019
2 parents f4aa9a4 + ecb6cde commit a7c3aad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions python/plugins/processing/algs/qgis/RasterCalculator.py
Expand Up @@ -166,6 +166,11 @@ def _cellsize(layer):
entry.bandNumber = n + 1
entries.append(entry)

# Append any missing entry from the current project
for entry in QgsRasterCalculatorEntry.rasterEntries():
if not [e for e in entries if e.ref == entry.ref]:
entries.append(entry)

output = self.parameterAsOutputLayer(parameters, self.OUTPUT, context)

width = round((bbox.xMaximum() - bbox.xMinimum()) / cellsize)
Expand Down Expand Up @@ -230,8 +235,8 @@ def mappedNameToLayer(self, lyr, expression, layersDict, context):
expContextAlgInputsScope = context.expressionContext().scope(indexOfScope)

# check for the layers that are mapped as input in a model
# to do this check in the latest scope all passed variables
# to look for a variable that is a layer or a string filename ç
# to do this check in the latest scope all passed variables
# to look for a variable that is a layer or a string filename
# to a layer
varDescription = None
for varName in expContextAlgInputsScope.variableNames():
Expand All @@ -257,7 +262,7 @@ def mappedNameToLayer(self, lyr, expression, layersDict, context):
# but var in expression is called simply
# 'Output' from algorithm 'calc1'

# get the translatin string to use to parse the description
# get the translation string to use to parse the description
# HAVE to use the same translated string as in
# https://github.com/qgis/QGIS/blob/master/src/core/processing/models/qgsprocessingmodelalgorithm.cpp#L516
translatedDesc = self.tr("Output '%1' from algorithm '%2'")
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/raster/qgsrastercalculator.cpp
Expand Up @@ -443,7 +443,7 @@ QgsRasterCalculator::Result QgsRasterCalculator::processCalculationGPU( std::uni
programTemplate = programTemplate.replace( QStringLiteral( "##EXPRESSION##" ), cExpression );
programTemplate = programTemplate.replace( QStringLiteral( "##EXPRESSION_ORIGINAL##" ), calcNode->toString( ) );

qDebug() << programTemplate;
// qDebug() << programTemplate;

// Create a program from the kernel source
cl::Program program( QgsOpenClUtils::buildProgram( programTemplate, QgsOpenClUtils::ExceptionBehavior::Throw ) );
Expand Down

0 comments on commit a7c3aad

Please sign in to comment.