mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
Fix multiple enum parameters handling and some ext scripts
This commit is contained in:
parent
3fa9e3c9f8
commit
36311ff6af
@ -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)
|
||||
|
@ -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)
|
@ -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)
|
Loading…
x
Reference in New Issue
Block a user