Skip to content
Permalink
Browse files

[processing][grass] Allow use of feature sources as vector inputs

(cherry-picked from 92634a9)
  • Loading branch information
nyalldawson committed Apr 9, 2018
1 parent 865968d commit 5bb4b3e0e6e40187ba856394f8226869b812930b
Showing with 6 additions and 3 deletions.
  1. +6 −3 python/plugins/processing/algs/grass7/Grass7Algorithm.py
@@ -51,6 +51,7 @@
QgsProcessingParameterField,
QgsProcessingParameterPoint,
QgsProcessingParameterBoolean,
QgsProcessingParameterFeatureSource,
QgsProcessingParameterVectorLayer,
QgsProcessingParameterRasterLayer,
QgsProcessingParameterMultipleLayers,
@@ -213,7 +214,7 @@ def defineCharacteristicsFromFile(self):
parameter = getParameterFromString(line)
if parameter is not None:
self.params.append(parameter)
if isinstance(parameter, QgsProcessingParameterVectorLayer):
if isinstance(parameter, (QgsProcessingParameterVectorLayer, QgsProcessingParameterFeatureSource)):
hasVectorInput = True
elif isinstance(parameter, QgsProcessingParameterRasterLayer):
hasRasterInput = True
@@ -404,6 +405,7 @@ def processInputs(self, parameters, context, feedback):
"""Prepare the GRASS import commands"""
inputs = [p for p in self.parameterDefinitions()
if isinstance(p, (QgsProcessingParameterVectorLayer,
QgsProcessingParameterFeatureSource,
QgsProcessingParameterRasterLayer,
QgsProcessingParameterMultipleLayers))]
for param in inputs:
@@ -422,7 +424,7 @@ def processInputs(self, parameters, context, feedback):
self.loadRasterLayerFromParameter(
paramName, parameters, context)
# Vector inputs needs to be imported into temp GRASS DB
elif isinstance(param, QgsProcessingParameterVectorLayer):
elif isinstance(param, (QgsProcessingParameterFeatureSource, QgsProcessingParameterVectorLayer)):
if paramName not in self.exportedLayers:
# Attribute tables are also vector inputs
if QgsProcessing.TypeFile in param.dataTypes():
@@ -505,7 +507,8 @@ def processCommand(self, parameters, context, feedback, delOutputs=False):

# Raster and vector layers
if isinstance(param, (QgsProcessingParameterRasterLayer,
QgsProcessingParameterVectorLayer)):
QgsProcessingParameterVectorLayer,
QgsProcessingParameterFeatureSource)):
if paramName in self.exportedLayers:
value = self.exportedLayers[paramName]
else:

0 comments on commit 5bb4b3e

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