Skip to content

Commit 5bb4b3e

Browse files
committed
[processing][grass] Allow use of feature sources as vector inputs
(cherry-picked from 92634a9)
1 parent 865968d commit 5bb4b3e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

python/plugins/processing/algs/grass7/Grass7Algorithm.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
QgsProcessingParameterField,
5252
QgsProcessingParameterPoint,
5353
QgsProcessingParameterBoolean,
54+
QgsProcessingParameterFeatureSource,
5455
QgsProcessingParameterVectorLayer,
5556
QgsProcessingParameterRasterLayer,
5657
QgsProcessingParameterMultipleLayers,
@@ -213,7 +214,7 @@ def defineCharacteristicsFromFile(self):
213214
parameter = getParameterFromString(line)
214215
if parameter is not None:
215216
self.params.append(parameter)
216-
if isinstance(parameter, QgsProcessingParameterVectorLayer):
217+
if isinstance(parameter, (QgsProcessingParameterVectorLayer, QgsProcessingParameterFeatureSource)):
217218
hasVectorInput = True
218219
elif isinstance(parameter, QgsProcessingParameterRasterLayer):
219220
hasRasterInput = True
@@ -404,6 +405,7 @@ def processInputs(self, parameters, context, feedback):
404405
"""Prepare the GRASS import commands"""
405406
inputs = [p for p in self.parameterDefinitions()
406407
if isinstance(p, (QgsProcessingParameterVectorLayer,
408+
QgsProcessingParameterFeatureSource,
407409
QgsProcessingParameterRasterLayer,
408410
QgsProcessingParameterMultipleLayers))]
409411
for param in inputs:
@@ -422,7 +424,7 @@ def processInputs(self, parameters, context, feedback):
422424
self.loadRasterLayerFromParameter(
423425
paramName, parameters, context)
424426
# Vector inputs needs to be imported into temp GRASS DB
425-
elif isinstance(param, QgsProcessingParameterVectorLayer):
427+
elif isinstance(param, (QgsProcessingParameterFeatureSource, QgsProcessingParameterVectorLayer)):
426428
if paramName not in self.exportedLayers:
427429
# Attribute tables are also vector inputs
428430
if QgsProcessing.TypeFile in param.dataTypes():
@@ -505,7 +507,8 @@ def processCommand(self, parameters, context, feedback, delOutputs=False):
505507

506508
# Raster and vector layers
507509
if isinstance(param, (QgsProcessingParameterRasterLayer,
508-
QgsProcessingParameterVectorLayer)):
510+
QgsProcessingParameterVectorLayer,
511+
QgsProcessingParameterFeatureSource)):
509512
if paramName in self.exportedLayers:
510513
value = self.exportedLayers[paramName]
511514
else:

0 commit comments

Comments
 (0)