QgsProcessingParameters class
A collection of utilities for working with parameters when running a processing algorithm.
Contents
- Reference
Parameters are stored in a QVariantMap and referenced by a unique string key. The QVariants in parameters are not usually accessed directly, and instead the high level API provided through QgsProcessingParameters parameterAsString(), parameterAsDouble() are used instead.
Parameters are evaluated using a provided QgsProcessingContext, allowing the evaluation to understand available map layers and expression contexts (for expression based parameters).
Public static functions
- static auto descriptionFromName(const QString& name) -> QString
- Creates an autogenerated parameter description from a parameter name.
- static auto isDynamic(const QVariantMap& parameters, const QString& name) -> bool
- Returns true if the parameter with matching name is a dynamic parameter, and must be evaluated once for every input feature processed.
- static auto parameterAsBool(const QgsProcessingParameterDefinition* definition, const QVariantMap& parameters, const QgsProcessingContext& context) -> bool
- Evaluates the parameter with matching definition to a static boolean value.
- static auto parameterAsBool(const QgsProcessingParameterDefinition* definition, const QVariant& value, const QgsProcessingContext& context) -> bool
- Evaluates the parameter with matching definition and value to a static boolean value.
- static auto parameterAsCompatibleSourceLayerPath(const QgsProcessingParameterDefinition* definition, const QVariantMap& parameters, QgsProcessingContext& context, const QStringList& compatibleFormats, const QString& preferredFormat = QString("shp"), QgsProcessingFeedback* feedback = nullptr) -> QString
- Evaluates the parameter with matching definition to a source vector layer file path of compatible format.
- static auto parameterAsCrs(const QgsProcessingParameterDefinition* definition, const QVariantMap& parameters, QgsProcessingContext& context) -> QgsCoordinateReferenceSystem
- Evaluates the parameter with matching definition to a coordinate reference system.
- static auto parameterAsCrs(const QgsProcessingParameterDefinition* definition, const QVariant& value, QgsProcessingContext& context) -> QgsCoordinateReferenceSystem
- Evaluates the parameter with matching definition and value to a coordinate reference system.
- static auto parameterAsDouble(const QgsProcessingParameterDefinition* definition, const QVariantMap& parameters, const QgsProcessingContext& context) -> double
- Evaluates the parameter with matching definition to a static double value.
- static auto parameterAsDouble(const QgsProcessingParameterDefinition* definition, const QVariant& value, const QgsProcessingContext& context) -> double
- Evaluates the parameter with matching definition and value to a static double value.
- static auto parameterAsEnum(const QgsProcessingParameterDefinition* definition, const QVariantMap& parameters, const QgsProcessingContext& context) -> int
- Evaluates the parameter with matching definition to a enum value.
- static auto parameterAsEnum(const QgsProcessingParameterDefinition* definition, const QVariant& value, const QgsProcessingContext& context) -> int
- Evaluates the parameter with matching definition and value to a enum value.
- static auto parameterAsEnums(const QgsProcessingParameterDefinition* definition, const QVariantMap& parameters, const QgsProcessingContext& context) -> QList<int>
- Evaluates the parameter with matching definition to list of enum values.
- static auto parameterAsEnums(const QgsProcessingParameterDefinition* definition, const QVariant& value, const QgsProcessingContext& context) -> QList<int>
- Evaluates the parameter with matching definition and value to list of enum values.
- static auto parameterAsExpression(const QgsProcessingParameterDefinition* definition, const QVariantMap& parameters, const QgsProcessingContext& context) -> QString
- Evaluates the parameter with matching definition to an expression.
- static auto parameterAsExpression(const QgsProcessingParameterDefinition* definition, const QVariant& value, const QgsProcessingContext& context) -> QString
- Evaluates the parameter with matching definitionand value to an expression.
- static auto parameterAsExtent(const QgsProcessingParameterDefinition* definition, const QVariantMap& parameters, QgsProcessingContext& context, const QgsCoordinateReferenceSystem& crs = QgsCoordinateReferenceSystem()) -> QgsRectangle
- Evaluates the parameter with matching definition to a rectangular extent.
- static auto parameterAsExtent(const QgsProcessingParameterDefinition* definition, const QVariant& value, QgsProcessingContext& context, const QgsCoordinateReferenceSystem& crs = QgsCoordinateReferenceSystem()) -> QgsRectangle
- Evaluates the parameter with matching definition and value to a rectangular extent.
- static auto parameterAsExtentCrs(const QgsProcessingParameterDefinition* definition, const QVariantMap& parameters, QgsProcessingContext& context) -> QgsCoordinateReferenceSystem
- Returns the coordinate reference system associated with an extent parameter value.
- static auto parameterAsExtentGeometry(const QgsProcessingParameterDefinition* definition, const QVariantMap& parameters, QgsProcessingContext& context, const QgsCoordinateReferenceSystem& crs = QgsCoordinateReferenceSystem()) -> QgsGeometry
- Evaluates the parameter with matching definition to a rectangular extent, and returns a geometry covering this extent.
- static auto parameterAsFields(const QgsProcessingParameterDefinition* definition, const QVariantMap& parameters, QgsProcessingContext& context) -> QStringList
- Evaluates the parameter with matching definition to a list of fields.
- static auto parameterAsFields(const QgsProcessingParameterDefinition* definition, const QVariant& value, QgsProcessingContext& context) -> QStringList
- Evaluates the parameter with matching definition and value to a list of fields.
- static auto parameterAsFile(const QgsProcessingParameterDefinition* definition, const QVariantMap& parameters, QgsProcessingContext& context) -> QString
- Evaluates the parameter with matching definition to a file/folder name.
- static auto parameterAsFile(const QgsProcessingParameterDefinition* definition, const QVariant& value, QgsProcessingContext& context) -> QString
- Evaluates the parameter with matching definition and value to a file/folder name.
- static auto parameterAsFileOutput(const QgsProcessingParameterDefinition* definition, const QVariantMap& parameters, QgsProcessingContext& context) -> QString
- Evaluates the parameter with matching definition to a file based output destination.
- static auto parameterAsFileOutput(const QgsProcessingParameterDefinition* definition, const QVariant& value, QgsProcessingContext& context) -> QString
- Evaluates the parameter with matching definition and value to a file based output destination.
- static auto parameterAsInt(const QgsProcessingParameterDefinition* definition, const QVariantMap& parameters, const QgsProcessingContext& context) -> int
- Evaluates the parameter with matching definition to a static integer value.
- static auto parameterAsInt(const QgsProcessingParameterDefinition* definition, const QVariant& value, const QgsProcessingContext& context) -> int
- Evaluates the parameter with matching definition and value to a static integer value.
- static auto parameterAsInts(const QgsProcessingParameterDefinition* definition, const QVariantMap& parameters, const QgsProcessingContext& context) -> QList<int>
- Evaluates the parameter with matching definition to a list of integer values.
- static auto parameterAsInts(const QgsProcessingParameterDefinition* definition, const QVariant& value, const QgsProcessingContext& context) -> QList<int>
- Evaluates the parameter with matching definition and value to a list of integer values.
- static auto parameterAsLayer(const QgsProcessingParameterDefinition* definition, const QVariantMap& parameters, QgsProcessingContext& context) -> QgsMapLayer*
- Evaluates the parameter with matching definition to a map layer.
- static auto parameterAsLayer(const QgsProcessingParameterDefinition* definition, const QVariant& value, QgsProcessingContext& context) -> QgsMapLayer*
- Evaluates the parameter with matching definition and value to a map layer.
- static auto parameterAsLayerList(const QgsProcessingParameterDefinition* definition, const QVariantMap& parameters, QgsProcessingContext& context) -> QList<QgsMapLayer*>
- Evaluates the parameter with matching definition to a list of map layers.
- static auto parameterAsLayerList(const QgsProcessingParameterDefinition* definition, const QVariant& value, QgsProcessingContext& context) -> QList<QgsMapLayer*>
- Evaluates the parameter with matching definition and value to a list of map layers.
- static auto parameterAsMatrix(const QgsProcessingParameterDefinition* definition, const QVariantMap& parameters, QgsProcessingContext& context) -> QVariantList
- Evaluates the parameter with matching definition to a matrix/table of values.
- static auto parameterAsMatrix(const QgsProcessingParameterDefinition* definition, const QVariant& value, QgsProcessingContext& context) -> QVariantList
- Evaluates the parameter with matching definition and value to a matrix/table of values.
- static auto parameterAsMeshLayer(const QgsProcessingParameterDefinition* definition, const QVariantMap& parameters, QgsProcessingContext& context) -> QgsMeshLayer*
- Evaluates the parameter with matching definition and value to a mesh layer.
- static auto parameterAsMeshLayer(const QgsProcessingParameterDefinition* definition, const QVariant& value, QgsProcessingContext& context) -> QgsMeshLayer*
- Evaluates the parameter with matching definition and value to a mesh layer.
- static auto parameterAsOutputLayer(const QgsProcessingParameterDefinition* definition, const QVariantMap& parameters, QgsProcessingContext& context) -> QString
- Evaluates the parameter with matching definition to a output layer destination.
- static auto parameterAsOutputLayer(const QgsProcessingParameterDefinition* definition, const QVariant& value, QgsProcessingContext& context) -> QString
- Evaluates the parameter with matching definition and value to a output layer destination.
- static auto parameterAsPoint(const QgsProcessingParameterDefinition* definition, const QVariantMap& parameters, QgsProcessingContext& context, const QgsCoordinateReferenceSystem& crs = QgsCoordinateReferenceSystem()) -> QgsPointXY
- Evaluates the parameter with matching definition to a point.
- static auto parameterAsPoint(const QgsProcessingParameterDefinition* definition, const QVariant& value, QgsProcessingContext& context, const QgsCoordinateReferenceSystem& crs = QgsCoordinateReferenceSystem()) -> QgsPointXY
- Evaluates the parameter with matching definition and value to a point.
- static auto parameterAsPointCrs(const QgsProcessingParameterDefinition* definition, const QVariantMap& parameters, QgsProcessingContext& context) -> QgsCoordinateReferenceSystem
- Returns the coordinate reference system associated with an point parameter value.
- static auto parameterAsRange(const QgsProcessingParameterDefinition* definition, const QVariantMap& parameters, QgsProcessingContext& context) -> QList<double>
- Evaluates the parameter with matching definition to a range of values.
- static auto parameterAsRange(const QgsProcessingParameterDefinition* definition, const QVariant& value, QgsProcessingContext& context) -> QList<double>
- Evaluates the parameter with matching definition and value to a range of values.
- static auto parameterAsRasterLayer(const QgsProcessingParameterDefinition* definition, const QVariantMap& parameters, QgsProcessingContext& context) -> QgsRasterLayer*
- Evaluates the parameter with matching definition to a raster layer.
- static auto parameterAsRasterLayer(const QgsProcessingParameterDefinition* definition, const QVariant& value, QgsProcessingContext& context) -> QgsRasterLayer*
- Evaluates the parameter with matching definition and value to a raster layer.
-
static auto parameterAsSink(const QgsProcessingParameterDefinition* definition,
const QVariantMap& parameters,
const QgsFields& fields,
QgsWkbTypes::
Type geometryType, const QgsCoordinateReferenceSystem& crs, QgsProcessingContext& context, QString& destinationIdentifier, QgsFeatureSink::SinkFlags sinkFlags = nullptr) -> QgsFeatureSink* - Evaluates the parameter with matching definition to a feature sink.
-
static auto parameterAsSink(const QgsProcessingParameterDefinition* definition,
const QVariant& value,
const QgsFields& fields,
QgsWkbTypes::
Type geometryType, const QgsCoordinateReferenceSystem& crs, QgsProcessingContext& context, QString& destinationIdentifier, QgsFeatureSink::SinkFlags sinkFlags = nullptr) -> QgsFeatureSink* - Evaluates the parameter with matching definition and value to a feature sink.
- static auto parameterAsSource(const QgsProcessingParameterDefinition* definition, const QVariantMap& parameters, QgsProcessingContext& context) -> QgsProcessingFeatureSource*
- Evaluates the parameter with matching definition to a feature source.
- static auto parameterAsSource(const QgsProcessingParameterDefinition* definition, const QVariant& value, QgsProcessingContext& context) -> QgsProcessingFeatureSource*
- Evaluates the parameter with matching definition and value to a feature source.
- static auto parameterAsString(const QgsProcessingParameterDefinition* definition, const QVariantMap& parameters, const QgsProcessingContext& context) -> QString
- Evaluates the parameter with matching definition to a static string value.
- static auto parameterAsString(const QgsProcessingParameterDefinition* definition, const QVariant& value, const QgsProcessingContext& context) -> QString
- Evaluates the parameter with matching definition and value to a static string value.
- static auto parameterAsVectorLayer(const QgsProcessingParameterDefinition* definition, const QVariantMap& parameters, QgsProcessingContext& context) -> QgsVectorLayer*
- Evaluates the parameter with matching definition to a vector layer.
- static auto parameterAsVectorLayer(const QgsProcessingParameterDefinition* definition, const QVariant& value, QgsProcessingContext& context) -> QgsVectorLayer*
- Evaluates the parameter with matching definition and value to a vector layer.
- static auto parameterFromScriptCode(const QString& code) -> QgsProcessingParameterDefinition*
- Creates a new QgsProcessingParameterDefinition using the configuration from a supplied script code string.
- static auto parameterFromVariantMap(const QVariantMap& map) -> QgsProcessingParameterDefinition*
- Creates a new QgsProcessingParameterDefinition using the configuration from a supplied variant map.
Function documentation
static bool QgsProcessingParameters:: parameterAsBool(const QgsProcessingParameterDefinition* definition,
const QVariant& value,
const QgsProcessingContext& context)
Evaluates the parameter with matching definition and value to a static boolean value.
static QString QgsProcessingParameters:: parameterAsCompatibleSourceLayerPath(const QgsProcessingParameterDefinition* definition,
const QVariantMap& parameters,
QgsProcessingContext& context,
const QStringList& compatibleFormats,
const QString& preferredFormat = QString("shp"),
QgsProcessingFeedback* feedback = nullptr)
Evaluates the parameter with matching definition to a source vector layer file path of compatible format.
If the parameter is evaluated to an existing layer, and that layer is not of the format listed in the compatibleFormats argument, then the layer will first be exported to a compatible format in a temporary location. The function will then return the path to that temporary file.
compatibleFormats should consist entirely of lowercase file extensions, e.g. 'shp'.
The preferredFormat argument is used to specify to desired file extension to use when a temporary layer export is required. This defaults to shapefiles, because shapefiles are the future (don't believe the geopackage hype!).
static QgsCoordinateReferenceSystem QgsProcessingParameters:: parameterAsCrs(const QgsProcessingParameterDefinition* definition,
const QVariant& value,
QgsProcessingContext& context)
Evaluates the parameter with matching definition and value to a coordinate reference system.
static double QgsProcessingParameters:: parameterAsDouble(const QgsProcessingParameterDefinition* definition,
const QVariant& value,
const QgsProcessingContext& context)
Evaluates the parameter with matching definition and value to a static double value.
static int QgsProcessingParameters:: parameterAsEnum(const QgsProcessingParameterDefinition* definition,
const QVariant& value,
const QgsProcessingContext& context)
Evaluates the parameter with matching definition and value to a enum value.
static QList<int> QgsProcessingParameters:: parameterAsEnums(const QgsProcessingParameterDefinition* definition,
const QVariant& value,
const QgsProcessingContext& context)
Evaluates the parameter with matching definition and value to list of enum values.
static QString QgsProcessingParameters:: parameterAsExpression(const QgsProcessingParameterDefinition* definition,
const QVariant& value,
const QgsProcessingContext& context)
Evaluates the parameter with matching definitionand value to an expression.
static QgsRectangle QgsProcessingParameters:: parameterAsExtent(const QgsProcessingParameterDefinition* definition,
const QVariantMap& parameters,
QgsProcessingContext& context,
const QgsCoordinateReferenceSystem& crs = QgsCoordinateReferenceSystem())
Evaluates the parameter with matching definition to a rectangular extent.
If crs is set, and the original coordinate reference system of the parameter can be determined, then the extent will be automatically reprojected so that it is in the specified crs. In this case the extent of the reproject rectangle will be returned.
static QgsRectangle QgsProcessingParameters:: parameterAsExtent(const QgsProcessingParameterDefinition* definition,
const QVariant& value,
QgsProcessingContext& context,
const QgsCoordinateReferenceSystem& crs = QgsCoordinateReferenceSystem())
Evaluates the parameter with matching definition and value to a rectangular extent.
If crs is set, and the original coordinate reference system of the parameter can be determined, then the extent will be automatically reprojected so that it is in the specified crs. In this case the extent of the reproject rectangle will be returned.
static QgsCoordinateReferenceSystem QgsProcessingParameters:: parameterAsExtentCrs(const QgsProcessingParameterDefinition* definition,
const QVariantMap& parameters,
QgsProcessingContext& context)
Returns the coordinate reference system associated with an extent parameter value.
static QgsGeometry QgsProcessingParameters:: parameterAsExtentGeometry(const QgsProcessingParameterDefinition* definition,
const QVariantMap& parameters,
QgsProcessingContext& context,
const QgsCoordinateReferenceSystem& crs = QgsCoordinateReferenceSystem())
Evaluates the parameter with matching definition to a rectangular extent, and returns a geometry covering this extent.
If crs is set, and the original coordinate reference system of the parameter can be determined, then the extent will be automatically reprojected so that it is in the specified crs. Unlike parameterAsExtent(), the reprojected rectangle returned by this function will no longer be a rectangle itself (i.e. this method returns the geometry of the actual reprojected rectangle, while parameterAsExtent() returns just the extent of the reprojected rectangle).
static QStringList QgsProcessingParameters:: parameterAsFields(const QgsProcessingParameterDefinition* definition,
const QVariant& value,
QgsProcessingContext& context)
Evaluates the parameter with matching definition and value to a list of fields.
static QString QgsProcessingParameters:: parameterAsFile(const QgsProcessingParameterDefinition* definition,
const QVariant& value,
QgsProcessingContext& context)
Evaluates the parameter with matching definition and value to a file/folder name.
static QString QgsProcessingParameters:: parameterAsFileOutput(const QgsProcessingParameterDefinition* definition,
const QVariant& value,
QgsProcessingContext& context)
Evaluates the parameter with matching definition and value to a file based output destination.
static int QgsProcessingParameters:: parameterAsInt(const QgsProcessingParameterDefinition* definition,
const QVariant& value,
const QgsProcessingContext& context)
Evaluates the parameter with matching definition and value to a static integer value.
static QList<int> QgsProcessingParameters:: parameterAsInts(const QgsProcessingParameterDefinition* definition,
const QVariantMap& parameters,
const QgsProcessingContext& context)
Evaluates the parameter with matching definition to a list of integer values.
static QList<int> QgsProcessingParameters:: parameterAsInts(const QgsProcessingParameterDefinition* definition,
const QVariant& value,
const QgsProcessingContext& context)
Evaluates the parameter with matching definition and value to a list of integer values.
static QgsMapLayer* QgsProcessingParameters:: parameterAsLayer(const QgsProcessingParameterDefinition* definition,
const QVariantMap& parameters,
QgsProcessingContext& context)
Evaluates the parameter with matching definition to a map layer.
Layers will either be taken from context's active project, or loaded from external sources and stored temporarily in the context. In either case, callers do not need to handle deletion of the returned layer.
static QgsMapLayer* QgsProcessingParameters:: parameterAsLayer(const QgsProcessingParameterDefinition* definition,
const QVariant& value,
QgsProcessingContext& context)
Evaluates the parameter with matching definition and value to a map layer.
Layers will either be taken from context's active project, or loaded from external sources and stored temporarily in the context. In either case, callers do not need to handle deletion of the returned layer.
static QList<QgsMapLayer*> QgsProcessingParameters:: parameterAsLayerList(const QgsProcessingParameterDefinition* definition,
const QVariant& value,
QgsProcessingContext& context)
Evaluates the parameter with matching definition and value to a list of map layers.
static QVariantList QgsProcessingParameters:: parameterAsMatrix(const QgsProcessingParameterDefinition* definition,
const QVariantMap& parameters,
QgsProcessingContext& context)
Evaluates the parameter with matching definition to a matrix/table of values.
Tables are collapsed to a 1 dimensional list.
static QVariantList QgsProcessingParameters:: parameterAsMatrix(const QgsProcessingParameterDefinition* definition,
const QVariant& value,
QgsProcessingContext& context)
Evaluates the parameter with matching definition and value to a matrix/table of values.
Tables are collapsed to a 1 dimensional list.
static QgsMeshLayer* QgsProcessingParameters:: parameterAsMeshLayer(const QgsProcessingParameterDefinition* definition,
const QVariantMap& parameters,
QgsProcessingContext& context)
Evaluates the parameter with matching definition and value to a mesh layer.
Layers will either be taken from context's active project, or loaded from external sources and stored temporarily in the context. In either case, callers do not need to handle deletion of the returned layer.
static QgsMeshLayer* QgsProcessingParameters:: parameterAsMeshLayer(const QgsProcessingParameterDefinition* definition,
const QVariant& value,
QgsProcessingContext& context)
Evaluates the parameter with matching definition and value to a mesh layer.
Layers will either be taken from context's active project, or loaded from external sources and stored temporarily in the context. In either case, callers do not need to handle deletion of the returned layer.
static QString QgsProcessingParameters:: parameterAsOutputLayer(const QgsProcessingParameterDefinition* definition,
const QVariant& value,
QgsProcessingContext& context)
Evaluates the parameter with matching definition and value to a output layer destination.
static QgsPointXY QgsProcessingParameters:: parameterAsPoint(const QgsProcessingParameterDefinition* definition,
const QVariantMap& parameters,
QgsProcessingContext& context,
const QgsCoordinateReferenceSystem& crs = QgsCoordinateReferenceSystem())
Evaluates the parameter with matching definition to a point.
If crs is set then the point will be automatically reprojected so that it is in the specified crs.
static QgsPointXY QgsProcessingParameters:: parameterAsPoint(const QgsProcessingParameterDefinition* definition,
const QVariant& value,
QgsProcessingContext& context,
const QgsCoordinateReferenceSystem& crs = QgsCoordinateReferenceSystem())
Evaluates the parameter with matching definition and value to a point.
If crs is set then the point will be automatically reprojected so that it is in the specified crs.
static QgsCoordinateReferenceSystem QgsProcessingParameters:: parameterAsPointCrs(const QgsProcessingParameterDefinition* definition,
const QVariantMap& parameters,
QgsProcessingContext& context)
Returns the coordinate reference system associated with an point parameter value.
static QList<double> QgsProcessingParameters:: parameterAsRange(const QgsProcessingParameterDefinition* definition,
const QVariant& value,
QgsProcessingContext& context)
Evaluates the parameter with matching definition and value to a range of values.
static QgsRasterLayer* QgsProcessingParameters:: parameterAsRasterLayer(const QgsProcessingParameterDefinition* definition,
const QVariantMap& parameters,
QgsProcessingContext& context)
Evaluates the parameter with matching definition to a raster layer.
Layers will either be taken from context's active project, or loaded from external sources and stored temporarily in the context. In either case, callers do not need to handle deletion of the returned layer.
static QgsRasterLayer* QgsProcessingParameters:: parameterAsRasterLayer(const QgsProcessingParameterDefinition* definition,
const QVariant& value,
QgsProcessingContext& context)
Evaluates the parameter with matching definition and value to a raster layer.
Layers will either be taken from context's active project, or loaded from external sources and stored temporarily in the context. In either case, callers do not need to handle deletion of the returned layer.
static QgsFeatureSink* QgsProcessingParameters:: parameterAsSink(const QgsProcessingParameterDefinition* definition,
const QVariantMap& parameters,
const QgsFields& fields,
QgsWkbTypes:: Type geometryType,
const QgsCoordinateReferenceSystem& crs,
QgsProcessingContext& context,
QString& destinationIdentifier,
QgsFeatureSink::SinkFlags sinkFlags = nullptr)
Evaluates the parameter with matching definition to a feature sink.
The fields, geometryType and crs parameters dictate the properties of the resulting feature sink.
Sinks will either be taken from context's active project, or created from external providers and stored temporarily in the context. The destinationIdentifier argument will be set to a string which can be used to retrieve the layer corresponding to the sink, e.g. via calling QgsProcessingUtils::
This function creates a new object and the caller takes responsibility for deleting the returned object.
static QgsFeatureSink* QgsProcessingParameters:: parameterAsSink(const QgsProcessingParameterDefinition* definition,
const QVariant& value,
const QgsFields& fields,
QgsWkbTypes:: Type geometryType,
const QgsCoordinateReferenceSystem& crs,
QgsProcessingContext& context,
QString& destinationIdentifier,
QgsFeatureSink::SinkFlags sinkFlags = nullptr)
Evaluates the parameter with matching definition and value to a feature sink.
The fields, geometryType and crs parameters dictate the properties of the resulting feature sink.
Sinks will either be taken from context's active project, or created from external providers and stored temporarily in the context. The destinationIdentifier argument will be set to a string which can be used to retrieve the layer corresponding to the sink, e.g. via calling QgsProcessingUtils::
This function creates a new object and the caller takes responsibility for deleting the returned object.
static QgsProcessingFeatureSource* QgsProcessingParameters:: parameterAsSource(const QgsProcessingParameterDefinition* definition,
const QVariantMap& parameters,
QgsProcessingContext& context)
Evaluates the parameter with matching definition to a feature source.
Sources will either be taken from context's active project, or loaded from external sources and stored temporarily in the context.
This function creates a new object and the caller takes responsibility for deleting the returned object.
static QgsProcessingFeatureSource* QgsProcessingParameters:: parameterAsSource(const QgsProcessingParameterDefinition* definition,
const QVariant& value,
QgsProcessingContext& context)
Evaluates the parameter with matching definition and value to a feature source.
Sources will either be taken from context's active project, or loaded from external sources and stored temporarily in the context.
This function creates a new object and the caller takes responsibility for deleting the returned object.
static QString QgsProcessingParameters:: parameterAsString(const QgsProcessingParameterDefinition* definition,
const QVariant& value,
const QgsProcessingContext& context)
Evaluates the parameter with matching definition and value to a static string value.
static QgsVectorLayer* QgsProcessingParameters:: parameterAsVectorLayer(const QgsProcessingParameterDefinition* definition,
const QVariantMap& parameters,
QgsProcessingContext& context)
Evaluates the parameter with matching definition to a vector layer.
Layers will either be taken from context's active project, or loaded from external sources and stored temporarily in the context. In either case, callers do not need to handle deletion of the returned layer.
static QgsVectorLayer* QgsProcessingParameters:: parameterAsVectorLayer(const QgsProcessingParameterDefinition* definition,
const QVariant& value,
QgsProcessingContext& context)
Evaluates the parameter with matching definition and value to a vector layer.
Layers will either be taken from context's active project, or loaded from external sources and stored temporarily in the context. In either case, callers do not need to handle deletion of the returned layer.
static QgsProcessingParameterDefinition* QgsProcessingParameters:: parameterFromScriptCode(const QString& code)
Creates a new QgsProcessingParameterDefinition using the configuration from a supplied script code string.
The caller takes responsibility for deleting the returned object.
static QgsProcessingParameterDefinition* QgsProcessingParameters:: parameterFromVariantMap(const QVariantMap& map)
Creates a new QgsProcessingParameterDefinition using the configuration from a supplied variant map.
The caller takes responsibility for deleting the returned object.