Skip to content
Permalink
Browse files

Fix multiple enum parameters handling and some ext scripts

  • Loading branch information
Médéric RIBREUX
Médéric RIBREUX committed Dec 27, 2017
1 parent 3fa9e3c commit 36311ff6af89cb2456d97c5645e76ebc3f9ca68c
@@ -524,8 +524,12 @@ def processCommand(self, parameters, context, delOutputs=False):
command += ' {}'.format(paramName)
# For enumeration, we need to grab the string value
elif isinstance(param, QgsProcessingParameterEnum):
idx = self.parameterAsEnum(parameters, paramName, context)
value = '"{}"'.format(param.options()[idx])
# Handle multiple values
if param.allowMultiple():
indexes = self.parameterAsEnums(parameters, paramName, context)
else:
indexes = [self.parameterAsEnum(parameters, paramName, context)]
value = '"{}"'.format(','.join([param.options()[i] for i in indexes]))
# For strings, we just translate as string
elif isinstance(param, QgsProcessingParameterString):
data = self.parameterAsString(parameters, paramName, context)
@@ -14,12 +14,6 @@ QGIS3 Processing Port
* r_mask_vect.py
* r_mask_rast.py
* r_statistics.py
* v_voronoi.py
* v_to_3d.py.
* v_what_rast_points.py.
* v_what_rast_centroids.py.
* v_vect_stats.py
* v_rast_stats.py
* v_net.py
* v_net_alloc.py
* v_net_allpairs.py
@@ -34,6 +34,6 @@ def processCommand(alg, parameters, context):
def processOutputs(alg, parameters, context):
# We need to add the initial vector layer to outputs:
fileName = alg.parameterAsOutputLayer(parameters, 'output', context)
grassName = '{}{}'.format('map', alg.uniqueSuffix)
grassName = alg.exportedLayers['map']
dataType = 'auto'
alg.exportVectorLayer(grassName, fileName, dataType)
@@ -40,6 +40,6 @@ def processInputs(alg, parameters, context):
if 'input' in alg.exportedLayers:
return

# We need to import all the bands and color tables of the input raster
# We need to import the vector layer with v.in.ogr
alg.loadVectorLayerFromParameter('input', parameters, context, False)
alg.postInputs()
@@ -34,6 +34,6 @@ def processCommand(alg, parameters, context):
def processOutputs(alg, parameters, context):
# We need to add the initial vector layer to outputs:
fileName = alg.parameterAsOutputLayer(parameters, 'output', context)
grassName = '{}{}'.format('map', alg.uniqueSuffix)
grassName = alg.exportedLayers['areas']
dataType = 'auto'
alg.exportVectorLayer(grassName, fileName, dataType)
@@ -2,10 +2,10 @@

"""
***************************************************************************
v_what_rast_points.py
v_what_rast.py
---------------------
Date : January 2016
Copyright : (C) 2016 by Médéric Ribreux
Date : December 2017
Copyright : (C) 2017 by Médéric Ribreux
Email : medspx at medspx dot fr
***************************************************************************
* *
@@ -18,8 +18,8 @@
"""

__author__ = 'Médéric Ribreux'
__date__ = 'January 2016'
__copyright__ = '(C) 2016, Médéric Ribreux'
__date__ = 'December 2017'
__copyright__ = '(C) 2017, Médéric Ribreux'

# This will get replaced with a git SHA1 when you do a git archive

@@ -34,6 +34,6 @@ def processCommand(alg, parameters, context):
def processOutputs(alg, parameters, context):
# We need to add the initial vector layer to outputs:
fileName = alg.parameterAsOutputLayer(parameters, 'output', context)
grassName = '{}{}'.format('map', alg.uniqueSuffix)
grassName = alg.exportedLayers['map']
dataType = 'auto'
alg.exportVectorLayer(grassName, fileName, dataType)

This file was deleted.

0 comments on commit 36311ff

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