35 if ( input.userType() != QMetaType::Type::QVariantList )
38 const QVariantList variantLayers = input.toList();
40 if ( variantLayers.isEmpty() )
43 for (
const QVariant &variantLayer : variantLayers )
45 if ( variantLayer.userType() != QMetaType::Type::QVariantMap )
47 const QVariantMap layerMap = variantLayer.toMap();
49 if ( !layerMap.contains( QStringLiteral(
"source" ) ) ||
50 !layerMap.contains( QStringLiteral(
"type" ) ) ||
51 !layerMap.contains( QStringLiteral(
"attributeIndex" ) ) )
63 if ( layerMap.value( QStringLiteral(
"attributeIndex" ) ).toInt() >= vectorLayer->
fields().
count() )
74 const QVariantList variantLayers = value.toList();
75 for (
const QVariant &variantLayer : variantLayers )
77 const QVariantMap layerMap = variantLayer.toMap();
78 QStringList layerDefParts;
82 const QString layerDef = QStringLiteral(
"{%1}" ).arg( layerDefParts.join(
',' ) );
83 parts.append( layerDef );
85 return parts.join(
',' ).prepend(
'[' ).append(
']' );
100 switch ( outputType )
104 QString code = QStringLiteral(
"QgsProcessingParameterTinInputLayers('%1', %2)" )
Base class for all map layer types.
Contains information about the context in which a processing algorithm is executed.
Base class for the definition of processing parameters.
QString valueAsStringPrivate(const QVariant &value, QgsProcessingContext &context, bool &ok, ValueAsStringFlags flags) const
Internal method for evaluating values as string.
@ AllowMapLayerValues
Enable map layer value handling.
QString description() const
Returns the description for the parameter.
QString name() const
Returns the name of the parameter.
QVariant valueAsJsonObjectPrivate(const QVariant &value, QgsProcessingContext &context, ValueAsStringFlags flags) const
Internal method for evaluating values as JSON objects.
static QString stringToPythonLiteral(const QString &string)
Converts a string to a Python string literal.
static QString variantToPythonLiteral(const QVariant &value)
Converts a variant to a Python literal.
static QgsMapLayer * mapLayerFromString(const QString &string, QgsProcessingContext &context, bool allowLoadingNewLayers=true, QgsProcessingUtils::LayerHint typeHint=QgsProcessingUtils::LayerHint::UnknownType, QgsProcessing::LayerOptionsFlags flags=QgsProcessing::LayerOptionsFlags())
Interprets a string as a map layer within the supplied context.
PythonOutputType
Available Python output types.
@ PythonQgsProcessingAlgorithmSubclass
Full Python QgsProcessingAlgorithm subclass.
Represents a vector layer which manages a vector based data sets.