diff --git a/python/plugins/processing/algs/grass7/Grass7Algorithm.py b/python/plugins/processing/algs/grass7/Grass7Algorithm.py index 8bea5db880c..20ece40df39 100644 --- a/python/plugins/processing/algs/grass7/Grass7Algorithm.py +++ b/python/plugins/processing/algs/grass7/Grass7Algorithm.py @@ -524,8 +524,12 @@ class Grass7Algorithm(QgsProcessingAlgorithm): 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) diff --git a/python/plugins/processing/algs/grass7/TODO.md b/python/plugins/processing/algs/grass7/TODO.md index 7f5447bbc5a..076eb14dd0d 100644 --- a/python/plugins/processing/algs/grass7/TODO.md +++ b/python/plugins/processing/algs/grass7/TODO.md @@ -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 diff --git a/python/plugins/processing/algs/grass7/ext/v_rast_stats.py b/python/plugins/processing/algs/grass7/ext/v_rast_stats.py index 670c7cb278d..caec5834c0a 100644 --- a/python/plugins/processing/algs/grass7/ext/v_rast_stats.py +++ b/python/plugins/processing/algs/grass7/ext/v_rast_stats.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) diff --git a/python/plugins/processing/algs/grass7/ext/v_to_3d.py b/python/plugins/processing/algs/grass7/ext/v_to_3d.py index d5a6d0353d8..ef885522f5f 100644 --- a/python/plugins/processing/algs/grass7/ext/v_to_3d.py +++ b/python/plugins/processing/algs/grass7/ext/v_to_3d.py @@ -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() diff --git a/python/plugins/processing/algs/grass7/ext/v_vect_stats.py b/python/plugins/processing/algs/grass7/ext/v_vect_stats.py index 8a916c73080..700e890b382 100644 --- a/python/plugins/processing/algs/grass7/ext/v_vect_stats.py +++ b/python/plugins/processing/algs/grass7/ext/v_vect_stats.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['areas'] dataType = 'auto' alg.exportVectorLayer(grassName, fileName, dataType) diff --git a/python/plugins/processing/algs/grass7/ext/v_what_rast_points.py b/python/plugins/processing/algs/grass7/ext/v_what_rast.py similarity index 84% rename from python/plugins/processing/algs/grass7/ext/v_what_rast_points.py rename to python/plugins/processing/algs/grass7/ext/v_what_rast.py index 97fc693f694..5186efd9a6e 100644 --- a/python/plugins/processing/algs/grass7/ext/v_what_rast_points.py +++ b/python/plugins/processing/algs/grass7/ext/v_what_rast.py @@ -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) diff --git a/python/plugins/processing/algs/grass7/ext/v_what_rast_centroids.py b/python/plugins/processing/algs/grass7/ext/v_what_rast_centroids.py deleted file mode 100644 index ee8c178eed5..00000000000 --- a/python/plugins/processing/algs/grass7/ext/v_what_rast_centroids.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -*************************************************************************** - v_what_rast_centroids.py - ------------------------ - Date : January 2016 - Copyright : (C) 2016 by Médéric Ribreux - Email : medspx at medspx dot fr -*************************************************************************** -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -*************************************************************************** -""" - -__author__ = 'Médéric Ribreux' -__date__ = 'January 2016' -__copyright__ = '(C) 2016, Médéric Ribreux' - -# This will get replaced with a git SHA1 when you do a git archive - -__revision__ = '$Format:%H$' - - -def processCommand(alg, parameters, context): - # Exclude outputs from commands - alg.processCommand(parameters, context, True) - - -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) - dataType = 'auto' - alg.exportVectorLayer(grassName, fileName, dataType)