Add Map Layer input parameter type for models

Since algorithms now use this parameter type (render map alg)
we also need to allow its use in models
This commit is contained in:
Nyall Dawson 2017-08-19 03:45:51 +10:00
parent 7d69e5f5af
commit 355cff191d

View File

@ -78,7 +78,8 @@ class ModelerParameterDefinitionDialog(QDialog):
PARAMETER_POINT = 'Point'
PARAMETER_CRS = 'CRS'
PARAMETER_MULTIPLE = 'Multiple Input'
PARAMETER_BAND = 'Raster band'
PARAMETER_BAND = 'Raster Band'
PARAMETER_MAP_LAYER = 'Map Layer'
paramTypes = [
PARAMETER_BOOLEAN,
@ -88,6 +89,7 @@ class ModelerParameterDefinitionDialog(QDialog):
PARAMETER_RASTER,
PARAMETER_STRING,
PARAMETER_EXPRESSION,
PARAMETER_MAP_LAYER,
PARAMETER_TABLE,
PARAMETER_TABLE_FIELD,
PARAMETER_VECTOR,
@ -346,6 +348,10 @@ class ModelerParameterDefinitionDialog(QDialog):
return
parent = self.parentCombo.currentData()
self.param = QgsProcessingParameterBand(name, description, None, parent)
elif (self.paramType == ModelerParameterDefinitionDialog.PARAMETER_MAP_LAYER or
isinstance(self.param, QgsProcessingParameterMapLayer)):
self.param = QgsProcessingParameterMapLayer(
name, description)
elif (self.paramType == ModelerParameterDefinitionDialog.PARAMETER_RASTER or
isinstance(self.param, QgsProcessingParameterRasterLayer)):
self.param = QgsProcessingParameterRasterLayer(