QGIS API Documentation 3.41.0-Master (25ec5511245)
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
QgsProcessingParameters Class Reference

A collection of utilities for working with parameters when running a processing algorithm. More...

#include <qgsprocessingparameters.h>

Static Public Member Functions

static QString descriptionFromName (const QString &name)
 Creates an autogenerated parameter description from a parameter name.
 
static bool isDynamic (const QVariantMap &parameters, const QString &name)
 Returns true if the parameter with matching name is a dynamic parameter, and must be evaluated once for every input feature processed.
 
static QgsAnnotationLayerparameterAsAnnotationLayer (const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context)
 Evaluates the parameter with matching definition and value to an annotation layer.
 
static QgsAnnotationLayerparameterAsAnnotationLayer (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context)
 Evaluates the parameter with matching definition to an annotation layer.
 
static bool parameterAsBool (const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context)
 Evaluates the parameter with matching definition and value to a static boolean value.
 
static bool parameterAsBool (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context)
 Evaluates the parameter with matching definition to a static boolean value.
 
static bool parameterAsBoolean (const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context)
 Evaluates the parameter with matching definition and value to a static boolean value.
 
static bool parameterAsBoolean (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context)
 Evaluates the parameter with matching definition to a static boolean value.
 
static QColor parameterAsColor (const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context)
 Returns the color associated with an color parameter value, or an invalid color if the parameter was not set.
 
static QColor parameterAsColor (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context)
 Returns the color associated with an point parameter value, or an invalid color if the parameter was not set.
 
static QString 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.
 
static QString parameterAsCompatibleSourceLayerPathAndLayerName (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context, const QStringList &compatibleFormats, const QString &preferredFormat=QString("shp"), QgsProcessingFeedback *feedback=nullptr, QString *layerName=nullptr)
 Evaluates the parameter with matching definition to a source vector layer file path and layer name of compatible format.
 
static QString parameterAsConnectionName (const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context)
 Evaluates the parameter with matching definition and value to a connection name string.
 
static QString parameterAsConnectionName (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context)
 Evaluates the parameter with matching definition to a connection name string.
 
static QgsCoordinateReferenceSystem parameterAsCrs (const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context)
 Evaluates the parameter with matching definition and value to a coordinate reference system.
 
static QgsCoordinateReferenceSystem parameterAsCrs (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context)
 Evaluates the parameter with matching definition to a coordinate reference system.
 
static QString parameterAsDatabaseTableName (const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context)
 Evaluates the parameter with matching definition and value to a database table name.
 
static QString parameterAsDatabaseTableName (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context)
 Evaluates the parameter with matching definition to a database table name.
 
static QDate parameterAsDate (const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context)
 Evaluates the parameter with matching definition and value to a static date value.
 
static QDate parameterAsDate (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context)
 Evaluates the parameter with matching definition to a static date value.
 
static QDateTime parameterAsDateTime (const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context)
 Evaluates the parameter with matching definition and value to a static datetime value.
 
static QDateTime parameterAsDateTime (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context)
 Evaluates the parameter with matching definition to a static datetime value.
 
static double parameterAsDouble (const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context)
 Evaluates the parameter with matching definition and value to a static double value.
 
static double parameterAsDouble (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context)
 Evaluates the parameter with matching definition to a static double value.
 
static int parameterAsEnum (const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context)
 Evaluates the parameter with matching definition and value to a enum value.
 
static int parameterAsEnum (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context)
 Evaluates the parameter with matching definition to a enum value.
 
static QList< int > parameterAsEnums (const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context)
 Evaluates the parameter with matching definition and value to list of enum values.
 
static QList< int > parameterAsEnums (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context)
 Evaluates the parameter with matching definition to list of enum values.
 
static QString parameterAsEnumString (const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context)
 Evaluates the parameter with matching definition and value to a static enum string.
 
static QString parameterAsEnumString (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context)
 Evaluates the parameter with matching definition to a static enum string.
 
static QStringList parameterAsEnumStrings (const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context)
 Evaluates the parameter with matching definition and value to list of static enum strings.
 
static QStringList parameterAsEnumStrings (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context)
 Evaluates the parameter with matching definition to list of static enum strings.
 
static QString parameterAsExpression (const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context)
 Evaluates the parameter with matching definitionand value to an expression.
 
static QString parameterAsExpression (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context)
 Evaluates the parameter with matching definition to an expression.
 
static QgsRectangle 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.
 
static QgsRectangle parameterAsExtent (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem())
 Evaluates the parameter with matching definition to a rectangular extent.
 
static QgsCoordinateReferenceSystem parameterAsExtentCrs (const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context)
 Returns the coordinate reference system associated with an extent parameter value.
 
static QgsCoordinateReferenceSystem parameterAsExtentCrs (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context)
 Returns the coordinate reference system associated with an extent parameter value.
 
static QgsGeometry 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.
 
static Q_DECL_DEPRECATED QStringList parameterAsFields (const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context)
 Evaluates the parameter with matching definition and value to a list of fields.
 
static Q_DECL_DEPRECATED QStringList parameterAsFields (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context)
 Evaluates the parameter with matching definition to a list of fields.
 
static QString parameterAsFile (const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context)
 Evaluates the parameter with matching definition and value to a file/folder name.
 
static QString parameterAsFile (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context)
 Evaluates the parameter with matching definition to a file/folder name.
 
static QStringList parameterAsFileList (const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context)
 Evaluates the parameter with matching definition to a list of files (for QgsProcessingParameterMultipleLayers in QgsProcessing:TypeFile mode).
 
static QStringList parameterAsFileList (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context)
 Evaluates the parameter with matching definition to a list of files (for QgsProcessingParameterMultipleLayers in QgsProcessing:TypeFile mode).
 
static QString parameterAsFileOutput (const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context)
 Evaluates the parameter with matching definition and value to a file based output destination.
 
static QString parameterAsFileOutput (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context)
 Evaluates the parameter with matching definition to a file based output destination.
 
static QgsGeometry parameterAsGeometry (const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem())
 Evaluates the parameter with matching definition and value to a geometry.
 
static QgsGeometry parameterAsGeometry (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem())
 Evaluates the parameter with matching definition to a geometry.
 
static QgsCoordinateReferenceSystem parameterAsGeometryCrs (const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context)
 Returns the coordinate reference system associated with an point parameter value.
 
static QgsCoordinateReferenceSystem parameterAsGeometryCrs (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context)
 Returns the coordinate reference system associated with a geometry parameter value.
 
static int parameterAsInt (const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context)
 Evaluates the parameter with matching definition and value to a static integer value.
 
static int parameterAsInt (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context)
 Evaluates the parameter with matching definition to a static integer value.
 
static QList< int > 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 QList< int > parameterAsInts (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context)
 Evaluates the parameter with matching definition to a list of integer values.
 
static QgsMapLayerparameterAsLayer (const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context, QgsProcessingUtils::LayerHint layerHint=QgsProcessingUtils::LayerHint::UnknownType, QgsProcessing::LayerOptionsFlags flags=QgsProcessing::LayerOptionsFlags())
 Evaluates the parameter with matching definition and value to a map layer.
 
static QgsMapLayerparameterAsLayer (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingUtils::LayerHint layerHint=QgsProcessingUtils::LayerHint::UnknownType, QgsProcessing::LayerOptionsFlags flags=QgsProcessing::LayerOptionsFlags())
 Evaluates the parameter with matching definition to a map layer.
 
static QList< QgsMapLayer * > parameterAsLayerList (const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context, QgsProcessing::LayerOptionsFlags flags=QgsProcessing::LayerOptionsFlags())
 Evaluates the parameter with matching definition and value to a list of map layers.
 
static QList< QgsMapLayer * > parameterAsLayerList (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessing::LayerOptionsFlags flags=QgsProcessing::LayerOptionsFlags())
 Evaluates the parameter with matching definition to a list of map layers.
 
static QgsPrintLayoutparameterAsLayout (const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context)
 Evaluates the parameter with matching definition and value to a print layout.
 
static QgsPrintLayoutparameterAsLayout (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context)
 Evaluates the parameter with matching definition to a print layout.
 
static QgsLayoutItemparameterAsLayoutItem (const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context, QgsPrintLayout *layout)
 Evaluates the parameter with matching definition and value to a print layout, taken from the specified layout.
 
static QgsLayoutItemparameterAsLayoutItem (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context, QgsPrintLayout *layout)
 Evaluates the parameter with matching definition to a print layout item, taken from the specified layout.
 
static QVariantList parameterAsMatrix (const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context)
 Evaluates the parameter with matching definition and value to a matrix/table of values.
 
static QVariantList parameterAsMatrix (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context)
 Evaluates the parameter with matching definition to a matrix/table of values.
 
static QgsMeshLayerparameterAsMeshLayer (const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context)
 Evaluates the parameter with matching definition and value to a mesh layer.
 
static QgsMeshLayerparameterAsMeshLayer (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context)
 Evaluates the parameter with matching definition and value to a mesh layer.
 
static QString parameterAsOutputLayer (const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context, bool testOnly=false)
 Evaluates the parameter with matching definition and value to a output layer destination.
 
static QString parameterAsOutputLayer (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context)
 Evaluates the parameter with matching definition to a output layer destination.
 
static QgsPointXY parameterAsPoint (const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem())
 Evaluates the parameter with matching definition and value to a point.
 
static QgsPointXY parameterAsPoint (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem())
 Evaluates the parameter with matching definition to a point.
 
static QgsPointCloudLayerparameterAsPointCloudLayer (const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context, QgsProcessing::LayerOptionsFlags flags=QgsProcessing::LayerOptionsFlags())
 Evaluates the parameter with matching definition and value to a point cloud layer.
 
static QgsPointCloudLayerparameterAsPointCloudLayer (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessing::LayerOptionsFlags flags=QgsProcessing::LayerOptionsFlags())
 Evaluates the parameter with matching definition to a point cloud layer.
 
static QgsCoordinateReferenceSystem parameterAsPointCrs (const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context)
 Returns the coordinate reference system associated with an point parameter value.
 
static QgsCoordinateReferenceSystem parameterAsPointCrs (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context)
 Returns the coordinate reference system associated with an point parameter value.
 
static QList< double > parameterAsRange (const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context)
 Evaluates the parameter with matching definition and value to a range of values.
 
static QList< double > parameterAsRange (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context)
 Evaluates the parameter with matching definition to a range of values.
 
static QgsRasterLayerparameterAsRasterLayer (const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context)
 Evaluates the parameter with matching definition and value to a raster layer.
 
static QgsRasterLayerparameterAsRasterLayer (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context)
 Evaluates the parameter with matching definition to a raster layer.
 
static QString parameterAsSchema (const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context)
 Evaluates the parameter with matching definition and value to a database schema name.
 
static QString parameterAsSchema (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context)
 Evaluates the parameter with matching definition to a database schema name.
 
static QgsFeatureSinkparameterAsSink (const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsFields &fields, Qgis::WkbType geometryType, const QgsCoordinateReferenceSystem &crs, QgsProcessingContext &context, QString &destinationIdentifier, QgsFeatureSink::SinkFlags sinkFlags=QgsFeatureSink::SinkFlags(), const QVariantMap &createOptions=QVariantMap(), const QStringList &datasourceOptions=QStringList(), const QStringList &layerOptions=QStringList())
 Evaluates the parameter with matching definition and value to a feature sink.
 
static QgsFeatureSinkparameterAsSink (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsFields &fields, Qgis::WkbType geometryType, const QgsCoordinateReferenceSystem &crs, QgsProcessingContext &context, QString &destinationIdentifier, QgsFeatureSink::SinkFlags sinkFlags=QgsFeatureSink::SinkFlags(), const QVariantMap &createOptions=QVariantMap(), const QStringList &datasourceOptions=QStringList(), const QStringList &layerOptions=QStringList())
 Evaluates the parameter with matching definition to a feature sink.
 
static QgsProcessingFeatureSourceparameterAsSource (const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context)
 Evaluates the parameter with matching definition and value to a feature source.
 
static QgsProcessingFeatureSourceparameterAsSource (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context)
 Evaluates the parameter with matching definition to a feature source.
 
static QString parameterAsString (const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context)
 Evaluates the parameter with matching definition and value to a static string value.
 
static QString parameterAsString (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context)
 Evaluates the parameter with matching definition to a static string value.
 
static QStringList parameterAsStrings (const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context)
 Evaluates the parameter with matching definition and value to a list of strings (e.g.
 
static QStringList parameterAsStrings (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context)
 Evaluates the parameter with matching definition to a list of strings (e.g.
 
static QTime parameterAsTime (const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context)
 Evaluates the parameter with matching definition and value to a static time value.
 
static QTime parameterAsTime (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context)
 Evaluates the parameter with matching definition to a static time value.
 
static QgsVectorLayerparameterAsVectorLayer (const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context)
 Evaluates the parameter with matching definition and value to a vector layer.
 
static QgsVectorLayerparameterAsVectorLayer (const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context)
 Evaluates the parameter with matching definition to a vector layer.
 
static QgsProcessingParameterDefinitionparameterFromScriptCode (const QString &code)
 Creates a new QgsProcessingParameterDefinition using the configuration from a supplied script code string.
 
static QgsProcessingParameterDefinitionparameterFromVariantMap (const QVariantMap &map)
 Creates a new QgsProcessingParameterDefinition using the configuration from a supplied variant map.
 

Detailed Description

A collection of utilities for working with parameters when running a processing algorithm.

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).

Definition at line 950 of file qgsprocessingparameters.h.

Member Function Documentation

◆ descriptionFromName()

QString QgsProcessingParameters::descriptionFromName ( const QString &  name)
static

Creates an autogenerated parameter description from a parameter name.

Definition at line 2299 of file qgsprocessingparameters.cpp.

◆ isDynamic()

bool QgsProcessingParameters::isDynamic ( const QVariantMap &  parameters,
const QString &  name 
)
static

Returns true if the parameter with matching name is a dynamic parameter, and must be evaluated once for every input feature processed.

Definition at line 117 of file qgsprocessingparameters.cpp.

◆ parameterAsAnnotationLayer() [1/2]

QgsAnnotationLayer * QgsProcessingParameters::parameterAsAnnotationLayer ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition and value to an annotation layer.

Layers will be taken from context's active project. Callers do not need to handle deletion of the returned layer.

Warning
Working with annotation layers is generally not thread safe (unless the layers are from a QgsProject loaded directly in a background thread). Ensure your algorithm returns the QgsProcessingAlgorithm::FlagNoThreading flag or only accesses annotation layers from a prepareAlgorithm() or postProcessAlgorithm() step.
Since
QGIS 3.22

Definition at line 2203 of file qgsprocessingparameters.cpp.

◆ parameterAsAnnotationLayer() [2/2]

QgsAnnotationLayer * QgsProcessingParameters::parameterAsAnnotationLayer ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition to an annotation layer.

Layers will be taken from context's active project. Callers do not need to handle deletion of the returned layer.

Warning
Working with annotation layers is generally not thread safe (unless the layers are from a QgsProject loaded directly in a background thread). Ensure your algorithm returns the QgsProcessingAlgorithm::FlagNoThreading flag or only accesses annotation layers from a prepareAlgorithm() or postProcessAlgorithm() step.
Since
QGIS 3.22

Definition at line 2198 of file qgsprocessingparameters.cpp.

◆ parameterAsBool() [1/2]

bool QgsProcessingParameters::parameterAsBool ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
const QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition and value to a static boolean value.

Since
QGIS 3.4

Definition at line 623 of file qgsprocessingparameters.cpp.

◆ parameterAsBool() [2/2]

bool QgsProcessingParameters::parameterAsBool ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
const QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition to a static boolean value.

Definition at line 607 of file qgsprocessingparameters.cpp.

◆ parameterAsBoolean() [1/2]

bool QgsProcessingParameters::parameterAsBoolean ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
const QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition and value to a static boolean value.

Since
QGIS 3.8

Definition at line 639 of file qgsprocessingparameters.cpp.

◆ parameterAsBoolean() [2/2]

bool QgsProcessingParameters::parameterAsBoolean ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
const QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition to a static boolean value.

Since
QGIS 3.8

Definition at line 615 of file qgsprocessingparameters.cpp.

◆ parameterAsColor() [1/2]

QColor QgsProcessingParameters::parameterAsColor ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
QgsProcessingContext context 
)
static

Returns the color associated with an color parameter value, or an invalid color if the parameter was not set.

Since
QGIS 3.10

Definition at line 2104 of file qgsprocessingparameters.cpp.

◆ parameterAsColor() [2/2]

QColor QgsProcessingParameters::parameterAsColor ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
QgsProcessingContext context 
)
static

Returns the color associated with an point parameter value, or an invalid color if the parameter was not set.

Since
QGIS 3.10

Definition at line 2096 of file qgsprocessingparameters.cpp.

◆ parameterAsCompatibleSourceLayerPath()

QString QgsProcessingParameters::parameterAsCompatibleSourceLayerPath ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
QgsProcessingContext context,
const QStringList &  compatibleFormats,
const QString &  preferredFormat = QString( "shp" ),
QgsProcessingFeedback feedback = nullptr 
)
static

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!).

When an algorithm is capable of handling multi-layer input files (such as Geopackage), it is preferable to use parameterAsCompatibleSourceLayerPathAndLayerName() which may avoid conversion in more situations.

Definition at line 836 of file qgsprocessingparameters.cpp.

◆ parameterAsCompatibleSourceLayerPathAndLayerName()

QString QgsProcessingParameters::parameterAsCompatibleSourceLayerPathAndLayerName ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
QgsProcessingContext context,
const QStringList &  compatibleFormats,
const QString &  preferredFormat = QString( "shp" ),
QgsProcessingFeedback feedback = nullptr,
QString *  layerName = nullptr 
)
static

Evaluates the parameter with matching definition to a source vector layer file path and layer name 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!).

This method should be preferred over parameterAsCompatibleSourceLayerPath() when an algorithm is able to correctly handle files with multiple layers. Unlike parameterAsCompatibleSourceLayerPath(), it will not force a conversion in this case and will return the target layer name in the layerName argument.

Parameters
definitionassociated parameter definition
parametersinput parameter value map
contextprocessing context
compatibleFormatsa list of lowercase file extensions compatible with the algorithm
preferredFormatpreferred format extension to use if conversion if required
feedbackfeedback object
layerNamewill be set to the target layer name for multi-layer sources (e.g. Geopackage)
Returns
path to source layer, or nearly converted compatible layer
See also
parameterAsCompatibleSourceLayerPath()
Since
QGIS 3.10

Definition at line 841 of file qgsprocessingparameters.cpp.

◆ parameterAsConnectionName() [1/2]

QString QgsProcessingParameters::parameterAsConnectionName ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
const QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition and value to a connection name string.

Since
QGIS 3.14

Definition at line 2151 of file qgsprocessingparameters.cpp.

◆ parameterAsConnectionName() [2/2]

QString QgsProcessingParameters::parameterAsConnectionName ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
const QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition to a connection name string.

Since
QGIS 3.14

Definition at line 2143 of file qgsprocessingparameters.cpp.

◆ parameterAsCrs() [1/2]

QgsCoordinateReferenceSystem QgsProcessingParameters::parameterAsCrs ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition and value to a coordinate reference system.

Since
QGIS 3.4

Definition at line 1063 of file qgsprocessingparameters.cpp.

◆ parameterAsCrs() [2/2]

QgsCoordinateReferenceSystem QgsProcessingParameters::parameterAsCrs ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition to a coordinate reference system.

Definition at line 1055 of file qgsprocessingparameters.cpp.

◆ parameterAsDatabaseTableName() [1/2]

QString QgsProcessingParameters::parameterAsDatabaseTableName ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
const QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition and value to a database table name.

Since
QGIS 3.14

Definition at line 2181 of file qgsprocessingparameters.cpp.

◆ parameterAsDatabaseTableName() [2/2]

QString QgsProcessingParameters::parameterAsDatabaseTableName ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
const QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition to a database table name.

Since
QGIS 3.14

Definition at line 2173 of file qgsprocessingparameters.cpp.

◆ parameterAsDate() [1/2]

QDate QgsProcessingParameters::parameterAsDate ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
const QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition and value to a static date value.

See also
parameterAsDateTime()
parameterAsTime()
Since
QGIS 3.14

Definition at line 356 of file qgsprocessingparameters.cpp.

◆ parameterAsDate() [2/2]

QDate QgsProcessingParameters::parameterAsDate ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
const QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition to a static date value.

See also
parameterAsDateTime()
parameterAsTime()
Since
QGIS 3.14

Definition at line 348 of file qgsprocessingparameters.cpp.

◆ parameterAsDateTime() [1/2]

QDateTime QgsProcessingParameters::parameterAsDateTime ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
const QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition and value to a static datetime value.

See also
parameterAsDate()
parameterAsTime()
Since
QGIS 3.14

Definition at line 319 of file qgsprocessingparameters.cpp.

◆ parameterAsDateTime() [2/2]

QDateTime QgsProcessingParameters::parameterAsDateTime ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
const QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition to a static datetime value.

See also
parameterAsDate()
parameterAsTime()
Since
QGIS 3.14

Definition at line 311 of file qgsprocessingparameters.cpp.

◆ parameterAsDouble() [1/2]

double QgsProcessingParameters::parameterAsDouble ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
const QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition and value to a static double value.

Since
QGIS 3.4

Definition at line 194 of file qgsprocessingparameters.cpp.

◆ parameterAsDouble() [2/2]

double QgsProcessingParameters::parameterAsDouble ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
const QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition to a static double value.

Definition at line 186 of file qgsprocessingparameters.cpp.

◆ parameterAsEnum() [1/2]

int QgsProcessingParameters::parameterAsEnum ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
const QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition and value to a enum value.

Since
QGIS 3.4

Definition at line 436 of file qgsprocessingparameters.cpp.

◆ parameterAsEnum() [2/2]

int QgsProcessingParameters::parameterAsEnum ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
const QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition to a enum value.

Definition at line 428 of file qgsprocessingparameters.cpp.

◆ parameterAsEnums() [1/2]

QList< int > QgsProcessingParameters::parameterAsEnums ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
const QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition and value to list of enum values.

Since
QGIS 3.4

Definition at line 458 of file qgsprocessingparameters.cpp.

◆ parameterAsEnums() [2/2]

QList< int > QgsProcessingParameters::parameterAsEnums ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
const QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition to list of enum values.

Definition at line 450 of file qgsprocessingparameters.cpp.

◆ parameterAsEnumString() [1/2]

QString QgsProcessingParameters::parameterAsEnumString ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
const QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition and value to a static enum string.

Since
QGIS 3.18

Definition at line 527 of file qgsprocessingparameters.cpp.

◆ parameterAsEnumString() [2/2]

QString QgsProcessingParameters::parameterAsEnumString ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
const QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition to a static enum string.

Since
QGIS 3.18

Definition at line 519 of file qgsprocessingparameters.cpp.

◆ parameterAsEnumStrings() [1/2]

QStringList QgsProcessingParameters::parameterAsEnumStrings ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
const QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition and value to list of static enum strings.

Since
QGIS 3.18

Definition at line 548 of file qgsprocessingparameters.cpp.

◆ parameterAsEnumStrings() [2/2]

QStringList QgsProcessingParameters::parameterAsEnumStrings ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
const QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition to list of static enum strings.

Since
QGIS 3.18

Definition at line 540 of file qgsprocessingparameters.cpp.

◆ parameterAsExpression() [1/2]

QString QgsProcessingParameters::parameterAsExpression ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
const QgsProcessingContext context 
)
static

Evaluates the parameter with matching definitionand value to an expression.

Since
QGIS 3.4

Definition at line 166 of file qgsprocessingparameters.cpp.

◆ parameterAsExpression() [2/2]

QString QgsProcessingParameters::parameterAsExpression ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
const QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition to an expression.

Definition at line 158 of file qgsprocessingparameters.cpp.

◆ parameterAsExtent() [1/2]

QgsRectangle QgsProcessingParameters::parameterAsExtent ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
QgsProcessingContext context,
const QgsCoordinateReferenceSystem crs = QgsCoordinateReferenceSystem() 
)
static

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.

See also
parameterAsExtentGeometry()
parameterAsExtentCrs()
Since
QGIS 3.4

Definition at line 1080 of file qgsprocessingparameters.cpp.

◆ parameterAsExtent() [2/2]

QgsRectangle QgsProcessingParameters::parameterAsExtent ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
QgsProcessingContext context,
const QgsCoordinateReferenceSystem crs = QgsCoordinateReferenceSystem() 
)
static

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.

See also
parameterAsExtentGeometry()
parameterAsExtentCrs()

Definition at line 1071 of file qgsprocessingparameters.cpp.

◆ parameterAsExtentCrs() [1/2]

QgsCoordinateReferenceSystem QgsProcessingParameters::parameterAsExtentCrs ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
QgsProcessingContext context 
)
static

Returns the coordinate reference system associated with an extent parameter value.

See also
parameterAsExtent()

Definition at line 1328 of file qgsprocessingparameters.cpp.

◆ parameterAsExtentCrs() [2/2]

QgsCoordinateReferenceSystem QgsProcessingParameters::parameterAsExtentCrs ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
QgsProcessingContext context 
)
static

Returns the coordinate reference system associated with an extent parameter value.

See also
parameterAsExtent()

Definition at line 1322 of file qgsprocessingparameters.cpp.

◆ parameterAsExtentGeometry()

QgsGeometry QgsProcessingParameters::parameterAsExtentGeometry ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
QgsProcessingContext context,
const QgsCoordinateReferenceSystem crs = QgsCoordinateReferenceSystem() 
)
static

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).

See also
parameterAsExtent()
parameterAsExtentCrs()

Definition at line 1204 of file qgsprocessingparameters.cpp.

◆ parameterAsFields() [1/2]

QStringList QgsProcessingParameters::parameterAsFields ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition and value to a list of fields.

Since
QGIS 3.4
Deprecated:
QGIS 3.40. Use parameterAsStrings() instead.

Definition at line 1984 of file qgsprocessingparameters.cpp.

◆ parameterAsFields() [2/2]

QStringList QgsProcessingParameters::parameterAsFields ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition to a list of fields.

Deprecated:
QGIS 3.40. Use parameterAsStrings() instead.

Definition at line 1976 of file qgsprocessingparameters.cpp.

◆ parameterAsFile() [1/2]

QString QgsProcessingParameters::parameterAsFile ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition and value to a file/folder name.

Since
QGIS 3.4

Definition at line 1706 of file qgsprocessingparameters.cpp.

◆ parameterAsFile() [2/2]

QString QgsProcessingParameters::parameterAsFile ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition to a file/folder name.

Definition at line 1695 of file qgsprocessingparameters.cpp.

◆ parameterAsFileList() [1/2]

QStringList QgsProcessingParameters::parameterAsFileList ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition to a list of files (for QgsProcessingParameterMultipleLayers in QgsProcessing:TypeFile mode).

Since
QGIS 3.10

Definition at line 1856 of file qgsprocessingparameters.cpp.

◆ parameterAsFileList() [2/2]

QStringList QgsProcessingParameters::parameterAsFileList ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition to a list of files (for QgsProcessingParameterMultipleLayers in QgsProcessing:TypeFile mode).

Since
QGIS 3.10

Definition at line 1902 of file qgsprocessingparameters.cpp.

◆ parameterAsFileOutput() [1/2]

QString QgsProcessingParameters::parameterAsFileOutput ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition and value to a file based output destination.

Since
QGIS 3.4

Definition at line 1012 of file qgsprocessingparameters.cpp.

◆ parameterAsFileOutput() [2/2]

QString QgsProcessingParameters::parameterAsFileOutput ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition to a file based output destination.

Definition at line 1002 of file qgsprocessingparameters.cpp.

◆ parameterAsGeometry() [1/2]

QgsGeometry QgsProcessingParameters::parameterAsGeometry ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
QgsProcessingContext context,
const QgsCoordinateReferenceSystem crs = QgsCoordinateReferenceSystem() 
)
static

Evaluates the parameter with matching definition and value to a geometry.

Since
QGIS 3.16

Definition at line 1530 of file qgsprocessingparameters.cpp.

◆ parameterAsGeometry() [2/2]

QgsGeometry QgsProcessingParameters::parameterAsGeometry ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
QgsProcessingContext context,
const QgsCoordinateReferenceSystem crs = QgsCoordinateReferenceSystem() 
)
static

Evaluates the parameter with matching definition to a geometry.

Since
QGIS 3.16

Definition at line 1522 of file qgsprocessingparameters.cpp.

◆ parameterAsGeometryCrs() [1/2]

QgsCoordinateReferenceSystem QgsProcessingParameters::parameterAsGeometryCrs ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
QgsProcessingContext context 
)
static

Returns the coordinate reference system associated with an point parameter value.

See also
parameterAsGeometry()
Since
QGIS 3.16

Definition at line 1648 of file qgsprocessingparameters.cpp.

◆ parameterAsGeometryCrs() [2/2]

QgsCoordinateReferenceSystem QgsProcessingParameters::parameterAsGeometryCrs ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
QgsProcessingContext context 
)
static

Returns the coordinate reference system associated with a geometry parameter value.

See also
parameterAsGeometry()
Since
QGIS 3.16

Definition at line 1642 of file qgsprocessingparameters.cpp.

◆ parameterAsInt() [1/2]

int QgsProcessingParameters::parameterAsInt ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
const QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition and value to a static integer value.

Since
QGIS 3.4

Definition at line 221 of file qgsprocessingparameters.cpp.

◆ parameterAsInt() [2/2]

int QgsProcessingParameters::parameterAsInt ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
const QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition to a static integer value.

Definition at line 213 of file qgsprocessingparameters.cpp.

◆ parameterAsInts() [1/2]

QList< int > QgsProcessingParameters::parameterAsInts ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
const QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition and value to a list of integer values.

Since
QGIS 3.4

Definition at line 263 of file qgsprocessingparameters.cpp.

◆ parameterAsInts() [2/2]

QList< int > QgsProcessingParameters::parameterAsInts ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
const QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition to a list of integer values.

Since
QGIS 3.4

Definition at line 255 of file qgsprocessingparameters.cpp.

◆ parameterAsLayer() [1/2]

QgsMapLayer * QgsProcessingParameters::parameterAsLayer ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
QgsProcessingContext context,
QgsProcessingUtils::LayerHint  layerHint = QgsProcessingUtils::LayerHint::UnknownType,
QgsProcessing::LayerOptionsFlags  flags = QgsProcessing::LayerOptionsFlags() 
)
static

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.

Since
QGIS 3.4

Definition at line 861 of file qgsprocessingparameters.cpp.

◆ parameterAsLayer() [2/2]

QgsMapLayer * QgsProcessingParameters::parameterAsLayer ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
QgsProcessingContext context,
QgsProcessingUtils::LayerHint  layerHint = QgsProcessingUtils::LayerHint::UnknownType,
QgsProcessing::LayerOptionsFlags  flags = QgsProcessing::LayerOptionsFlags() 
)
static

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.

Definition at line 853 of file qgsprocessingparameters.cpp.

◆ parameterAsLayerList() [1/2]

QList< QgsMapLayer * > QgsProcessingParameters::parameterAsLayerList ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
QgsProcessingContext context,
QgsProcessing::LayerOptionsFlags  flags = QgsProcessing::LayerOptionsFlags() 
)
static

Evaluates the parameter with matching definition and value to a list of map layers.

The flags are used to set options for loading layers (e.g. skip index generation).

Since
QGIS 3.4

Definition at line 1769 of file qgsprocessingparameters.cpp.

◆ parameterAsLayerList() [2/2]

QList< QgsMapLayer * > QgsProcessingParameters::parameterAsLayerList ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
QgsProcessingContext context,
QgsProcessing::LayerOptionsFlags  flags = QgsProcessing::LayerOptionsFlags() 
)
static

Evaluates the parameter with matching definition to a list of map layers.

The flags are used to set options for loading layers (e.g. skip index generation).

Definition at line 1761 of file qgsprocessingparameters.cpp.

◆ parameterAsLayout() [1/2]

QgsPrintLayout * QgsProcessingParameters::parameterAsLayout ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition and value to a print layout.

Warning
This method is not safe to run in a background thread, so it must either be used within a prepareAlgorithm implementation (which runs in the main thread), or the algorithm must return the FlagNoThreading flag.
Since
QGIS 3.8

Definition at line 2054 of file qgsprocessingparameters.cpp.

◆ parameterAsLayout() [2/2]

QgsPrintLayout * QgsProcessingParameters::parameterAsLayout ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition to a print layout.

Warning
This method is not safe to run in a background thread, so it must either be used within a prepareAlgorithm implementation (which runs in the main thread), or the algorithm must return the FlagNoThreading flag.
Since
QGIS 3.8

Definition at line 2046 of file qgsprocessingparameters.cpp.

◆ parameterAsLayoutItem() [1/2]

QgsLayoutItem * QgsProcessingParameters::parameterAsLayoutItem ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
QgsProcessingContext context,
QgsPrintLayout layout 
)
static

Evaluates the parameter with matching definition and value to a print layout, taken from the specified layout.

Warning
This method is not safe to run in a background thread, so it must either be used within a prepareAlgorithm implementation (which runs in the main thread), or the algorithm must return the FlagNoThreading flag.
Since
QGIS 3.8

Definition at line 2078 of file qgsprocessingparameters.cpp.

◆ parameterAsLayoutItem() [2/2]

QgsLayoutItem * QgsProcessingParameters::parameterAsLayoutItem ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
QgsProcessingContext context,
QgsPrintLayout layout 
)
static

Evaluates the parameter with matching definition to a print layout item, taken from the specified layout.

Warning
This method is not safe to run in a background thread, so it must either be used within a prepareAlgorithm implementation (which runs in the main thread), or the algorithm must return the FlagNoThreading flag.
Since
QGIS 3.8

Definition at line 2070 of file qgsprocessingparameters.cpp.

◆ parameterAsMatrix() [1/2]

QVariantList QgsProcessingParameters::parameterAsMatrix ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition and value to a matrix/table of values.

Tables are collapsed to a 1 dimensional list.

Since
QGIS 3.4

Definition at line 1725 of file qgsprocessingparameters.cpp.

◆ parameterAsMatrix() [2/2]

QVariantList QgsProcessingParameters::parameterAsMatrix ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition to a matrix/table of values.

Tables are collapsed to a 1 dimensional list.

Definition at line 1717 of file qgsprocessingparameters.cpp.

◆ parameterAsMeshLayer() [1/2]

QgsMeshLayer * QgsProcessingParameters::parameterAsMeshLayer ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
QgsProcessingContext context 
)
static

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.

Since
QGIS 3.6

Definition at line 925 of file qgsprocessingparameters.cpp.

◆ parameterAsMeshLayer() [2/2]

QgsMeshLayer * QgsProcessingParameters::parameterAsMeshLayer ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
QgsProcessingContext context 
)
static

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.

Since
QGIS 3.6

Definition at line 920 of file qgsprocessingparameters.cpp.

◆ parameterAsOutputLayer() [1/2]

QString QgsProcessingParameters::parameterAsOutputLayer ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
QgsProcessingContext context,
bool  testOnly = false 
)
static

Evaluates the parameter with matching definition and value to a output layer destination.

Since QGIS 3.38 the testOnly argument can be set to true to evaluate the parameter to an output layer destination for advance testing only. This prevents default behavior such as output post-processing which would otherwise occur.

Since
QGIS 3.4

Definition at line 940 of file qgsprocessingparameters.cpp.

◆ parameterAsOutputLayer() [2/2]

QString QgsProcessingParameters::parameterAsOutputLayer ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition to a output layer destination.

Definition at line 930 of file qgsprocessingparameters.cpp.

◆ parameterAsPoint() [1/2]

QgsPointXY QgsProcessingParameters::parameterAsPoint ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
QgsProcessingContext context,
const QgsCoordinateReferenceSystem crs = QgsCoordinateReferenceSystem() 
)
static

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.

See also
parameterAsPointCrs()
Since
QGIS 3.4

Definition at line 1412 of file qgsprocessingparameters.cpp.

◆ parameterAsPoint() [2/2]

QgsPointXY QgsProcessingParameters::parameterAsPoint ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
QgsProcessingContext context,
const QgsCoordinateReferenceSystem crs = QgsCoordinateReferenceSystem() 
)
static

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.

See also
parameterAsPointCrs()

Definition at line 1404 of file qgsprocessingparameters.cpp.

◆ parameterAsPointCloudLayer() [1/2]

QgsPointCloudLayer * QgsProcessingParameters::parameterAsPointCloudLayer ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
QgsProcessingContext context,
QgsProcessing::LayerOptionsFlags  flags = QgsProcessing::LayerOptionsFlags() 
)
static

Evaluates the parameter with matching definition and value to a point cloud layer.

The flags are used to set options for loading layer (e.g. skip index generation).

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.

Since
QGIS 3.22

Definition at line 2193 of file qgsprocessingparameters.cpp.

◆ parameterAsPointCloudLayer() [2/2]

QgsPointCloudLayer * QgsProcessingParameters::parameterAsPointCloudLayer ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
QgsProcessingContext context,
QgsProcessing::LayerOptionsFlags  flags = QgsProcessing::LayerOptionsFlags() 
)
static

Evaluates the parameter with matching definition to a point cloud layer.

The flags are used to set options for loading layer (e.g. skip index generation).

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.

Since
QGIS 3.22

Definition at line 2188 of file qgsprocessingparameters.cpp.

◆ parameterAsPointCrs() [1/2]

QgsCoordinateReferenceSystem QgsProcessingParameters::parameterAsPointCrs ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
QgsProcessingContext context 
)
static

Returns the coordinate reference system associated with an point parameter value.

See also
parameterAsPoint()
Since
QGIS 3.8

Definition at line 1494 of file qgsprocessingparameters.cpp.

◆ parameterAsPointCrs() [2/2]

QgsCoordinateReferenceSystem QgsProcessingParameters::parameterAsPointCrs ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
QgsProcessingContext context 
)
static

Returns the coordinate reference system associated with an point parameter value.

See also
parameterAsPoint()

Definition at line 1488 of file qgsprocessingparameters.cpp.

◆ parameterAsRange() [1/2]

QList< double > QgsProcessingParameters::parameterAsRange ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition and value to a range of values.

Since
QGIS 3.4

Definition at line 1918 of file qgsprocessingparameters.cpp.

◆ parameterAsRange() [2/2]

QList< double > QgsProcessingParameters::parameterAsRange ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition to a range of values.

Definition at line 1910 of file qgsprocessingparameters.cpp.

◆ parameterAsRasterLayer() [1/2]

QgsRasterLayer * QgsProcessingParameters::parameterAsRasterLayer ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
QgsProcessingContext context 
)
static

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.

Since
QGIS 3.4

Definition at line 915 of file qgsprocessingparameters.cpp.

◆ parameterAsRasterLayer() [2/2]

QgsRasterLayer * QgsProcessingParameters::parameterAsRasterLayer ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
QgsProcessingContext context 
)
static

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.

Definition at line 910 of file qgsprocessingparameters.cpp.

◆ parameterAsSchema() [1/2]

QString QgsProcessingParameters::parameterAsSchema ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
const QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition and value to a database schema name.

Since
QGIS 3.14

Definition at line 2166 of file qgsprocessingparameters.cpp.

◆ parameterAsSchema() [2/2]

QString QgsProcessingParameters::parameterAsSchema ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
const QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition to a database schema name.

Since
QGIS 3.14

Definition at line 2158 of file qgsprocessingparameters.cpp.

◆ parameterAsSink() [1/2]

QgsFeatureSink * QgsProcessingParameters::parameterAsSink ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
const QgsFields fields,
Qgis::WkbType  geometryType,
const QgsCoordinateReferenceSystem crs,
QgsProcessingContext context,
QString &  destinationIdentifier,
QgsFeatureSink::SinkFlags  sinkFlags = QgsFeatureSink::SinkFlags(),
const QVariantMap &  createOptions = QVariantMap(),
const QStringList &  datasourceOptions = QStringList(),
const QStringList &  layerOptions = QStringList() 
)
static

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::mapLayerFromString().

The createOptions argument is used to pass on creation options such as layer name.

The datasourceOptions and layerOptions arguments is used to pass on GDAL-specific format driver options.

This function creates a new object and the caller takes responsibility for deleting the returned object.

Exceptions
QgsProcessingException
Since
QGIS 3.4

Definition at line 669 of file qgsprocessingparameters.cpp.

◆ parameterAsSink() [2/2]

QgsFeatureSink * QgsProcessingParameters::parameterAsSink ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
const QgsFields fields,
Qgis::WkbType  geometryType,
const QgsCoordinateReferenceSystem crs,
QgsProcessingContext context,
QString &  destinationIdentifier,
QgsFeatureSink::SinkFlags  sinkFlags = QgsFeatureSink::SinkFlags(),
const QVariantMap &  createOptions = QVariantMap(),
const QStringList &  datasourceOptions = QStringList(),
const QStringList &  layerOptions = QStringList() 
)
static

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::mapLayerFromString().

The createOptions argument is used to pass on creation options such as layer name.

The datasourceOptions and layerOptions arguments is used to pass on GDAL-specific format driver options.

This function creates a new object and the caller takes responsibility for deleting the returned object.

Definition at line 655 of file qgsprocessingparameters.cpp.

◆ parameterAsSource() [1/2]

QgsProcessingFeatureSource * QgsProcessingParameters::parameterAsSource ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
QgsProcessingContext context 
)
static

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.

Since
QGIS 3.4

Definition at line 752 of file qgsprocessingparameters.cpp.

◆ parameterAsSource() [2/2]

QgsProcessingFeatureSource * QgsProcessingParameters::parameterAsSource ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
QgsProcessingContext context 
)
static

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.

Definition at line 744 of file qgsprocessingparameters.cpp.

◆ parameterAsString() [1/2]

QString QgsProcessingParameters::parameterAsString ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
const QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition and value to a static string value.

Since
QGIS 3.4

Definition at line 134 of file qgsprocessingparameters.cpp.

◆ parameterAsString() [2/2]

QString QgsProcessingParameters::parameterAsString ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
const QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition to a static string value.

Definition at line 126 of file qgsprocessingparameters.cpp.

◆ parameterAsStrings() [1/2]

QStringList QgsProcessingParameters::parameterAsStrings ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition and value to a list of strings (e.g.

field names or point cloud attributes).

Since
QGIS 3.32

Definition at line 1997 of file qgsprocessingparameters.cpp.

◆ parameterAsStrings() [2/2]

QStringList QgsProcessingParameters::parameterAsStrings ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition to a list of strings (e.g.

field names or point cloud attributes).

Since
QGIS 3.32

Definition at line 1989 of file qgsprocessingparameters.cpp.

◆ parameterAsTime() [1/2]

QTime QgsProcessingParameters::parameterAsTime ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
const QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition and value to a static time value.

See also
parameterAsDateTime()
parameterAsDate()
Since
QGIS 3.14

Definition at line 393 of file qgsprocessingparameters.cpp.

◆ parameterAsTime() [2/2]

QTime QgsProcessingParameters::parameterAsTime ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
const QgsProcessingContext context 
)
static

Evaluates the parameter with matching definition to a static time value.

See also
parameterAsDateTime()
parameterAsDate()
Since
QGIS 3.14

Definition at line 385 of file qgsprocessingparameters.cpp.

◆ parameterAsVectorLayer() [1/2]

QgsVectorLayer * QgsProcessingParameters::parameterAsVectorLayer ( const QgsProcessingParameterDefinition definition,
const QVariant &  value,
QgsProcessingContext context 
)
static

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.

Since
QGIS 3.4

Definition at line 1050 of file qgsprocessingparameters.cpp.

◆ parameterAsVectorLayer() [2/2]

QgsVectorLayer * QgsProcessingParameters::parameterAsVectorLayer ( const QgsProcessingParameterDefinition definition,
const QVariantMap &  parameters,
QgsProcessingContext context 
)
static

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.

Definition at line 1045 of file qgsprocessingparameters.cpp.

◆ parameterFromScriptCode()

QgsProcessingParameterDefinition * QgsProcessingParameters::parameterFromScriptCode ( const QString &  code)
static

Creates a new QgsProcessingParameterDefinition using the configuration from a supplied script code string.

The caller takes responsibility for deleting the returned object.

Definition at line 2306 of file qgsprocessingparameters.cpp.

◆ parameterFromVariantMap()

QgsProcessingParameterDefinition * QgsProcessingParameters::parameterFromVariantMap ( const QVariantMap &  map)
static

Creates a new QgsProcessingParameterDefinition using the configuration from a supplied variant map.

The caller takes responsibility for deleting the returned object.

Definition at line 2208 of file qgsprocessingparameters.cpp.


The documentation for this class was generated from the following files: