QGIS/python/core/auto_generated/processing/qgsprocessingparameters.sip.in
Nyall Dawson 3f6b490218 Sipify
2025-04-02 11:11:10 +10:00

5367 lines
177 KiB
Plaintext

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/processing/qgsprocessingparameters.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
class QgsProcessingFeatureSourceDefinition
{
%Docstring(signature="appended")
Encapsulates settings relating to a feature source input to a processing
algorithm.
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingFeatureSourceDefinition( const QString &source = QString(), bool selectedFeaturesOnly = false, long long featureLimit = -1,
Qgis::ProcessingFeatureSourceDefinitionFlags flags = Qgis::ProcessingFeatureSourceDefinitionFlags(), Qgis::InvalidGeometryCheck geometryCheck = Qgis::InvalidGeometryCheck::AbortOnInvalid, const QString &filterExpression = QString() );
%Docstring
Constructor for QgsProcessingFeatureSourceDefinition, accepting a static
string ``source``.
If ``selectedFeaturesOnly`` is ``True``, then only selected features
from the source will be used.
The optional ``featureLimit`` can be set to a value > 0 to place a hard
limit on the maximum number of features which will be read from the
source.
Since QGIS 3.32, the optional ``filterExpression`` argument can be used
to specify a expression to use to filter the features read from the
source.
The ``flags`` argument can be used to specify flags which dictate the
source behavior.
If the
:py:class:`Qgis`.ProcessingFeatureSourceDefinitionFlag.OverrideDefaultGeometryCheck
is set in ``flags``, then the value of ``geometryCheck`` will override
the default geometry check method (as dictated by
:py:class:`QgsProcessingContext`) for this source.
%End
QgsProcessingFeatureSourceDefinition( const QgsProperty &source, bool selectedFeaturesOnly = false, long long featureLimit = -1,
Qgis::ProcessingFeatureSourceDefinitionFlags flags = Qgis::ProcessingFeatureSourceDefinitionFlags(), Qgis::InvalidGeometryCheck geometryCheck = Qgis::InvalidGeometryCheck::AbortOnInvalid, const QString &filterExpression = QString() );
%Docstring
Constructor for QgsProcessingFeatureSourceDefinition, accepting a
QgsProperty source.
If ``selectedFeaturesOnly`` is ``True``, then only selected features
from the source will be used.
The optional ``featureLimit`` can be set to a value > 0 to place a hard
limit on the maximum number of features which will be read from the
source.
Since QGIS 3.32, the optional ``filterExpression`` argument can be used
to specify a expression to use to filter the features read from the
source.
The ``flags`` argument can be used to specify flags which dictate the
source behavior.
If the
:py:class:`Qgis`.ProcessingFeatureSourceDefinitionFlag.OverrideDefaultGeometryCheck
is set in ``flags``, then the value of ``geometryCheck`` will override
the default geometry check method (as dictated by
:py:class:`QgsProcessingContext`) for this source.
%End
QgsProperty source;
bool selectedFeaturesOnly;
long long featureLimit;
QString filterExpression;
Qgis::ProcessingFeatureSourceDefinitionFlags flags;
Qgis::InvalidGeometryCheck geometryCheck;
QVariant toVariant() const;
%Docstring
Saves this source definition to a QVariantMap, wrapped in a QVariant.
You can use :py:class:`QgsXmlUtils`.writeVariant to save it to an XML
document.
.. seealso:: :py:func:`loadVariant`
.. versionadded:: 3.14
%End
bool loadVariant( const QVariantMap &map );
%Docstring
Loads this source definition from a QVariantMap, wrapped in a QVariant.
You can use :py:class:`QgsXmlUtils`.readVariant to load it from an XML
document.
.. seealso:: :py:func:`toVariant`
.. versionadded:: 3.14
%End
bool operator==( const QgsProcessingFeatureSourceDefinition &other ) const;
bool operator!=( const QgsProcessingFeatureSourceDefinition &other ) const;
operator QVariant() const;
};
class QgsProcessingOutputLayerDefinition
{
%Docstring(signature="appended")
Encapsulates settings relating to a feature sink or output raster layer
for a processing algorithm.
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingOutputLayerDefinition( const QString &sink = QString(), QgsProject *destinationProject = 0 );
%Docstring
Constructor for QgsProcessingOutputLayerDefinition, accepting a static
sink/layer string. The ``destinationProject`` parameter can be set to a
:py:class:`QgsProject` instance in which to automatically load the
resulting sink/layer after completing processing.
%End
QgsProcessingOutputLayerDefinition( const QgsProperty &sink, QgsProject *destinationProject = 0 );
%Docstring
Constructor for QgsProcessingOutputLayerDefinition, accepting a
QgsProperty sink/layer. The ``destinationProject`` parameter can be set
to a :py:class:`QgsProject` instance in which to automatically load the
resulting sink/layer after completing processing.
%End
QgsProperty sink;
QgsProject *destinationProject;
QString destinationName;
QVariantMap createOptions;
bool useRemapping() const;
%Docstring
Returns ``True`` if the output uses a remapping definition.
.. seealso:: :py:func:`remappingDefinition`
.. versionadded:: 3.14
%End
QgsRemappingSinkDefinition remappingDefinition() const;
%Docstring
Returns the output remapping definition, if
:py:func:`~QgsProcessingOutputLayerDefinition.useRemapping` is ``True``.
.. seealso:: :py:func:`useRemapping`
.. seealso:: :py:func:`setRemappingDefinition`
.. versionadded:: 3.14
%End
void setRemappingDefinition( const QgsRemappingSinkDefinition &definition );
%Docstring
Sets the remapping ``definition`` to use when adding features to the
output layer.
Calling this method will set
:py:func:`~QgsProcessingOutputLayerDefinition.useRemapping` to ``True``.
.. seealso:: :py:func:`remappingDefinition`
.. seealso:: :py:func:`useRemapping`
.. versionadded:: 3.14
%End
QVariant toVariant() const;
%Docstring
Saves this output layer definition to a QVariantMap, wrapped in a
QVariant. You can use :py:class:`QgsXmlUtils`.writeVariant to save it to
an XML document.
.. seealso:: :py:func:`loadVariant`
.. versionadded:: 3.2
%End
bool loadVariant( const QVariantMap &map );
%Docstring
Loads this output layer definition from a QVariantMap, wrapped in a
QVariant. You can use :py:class:`QgsXmlUtils`.readVariant to load it
from an XML document.
.. seealso:: :py:func:`toVariant`
.. versionadded:: 3.2
%End
operator QVariant() const;
bool operator==( const QgsProcessingOutputLayerDefinition &other ) const;
bool operator!=( const QgsProcessingOutputLayerDefinition &other ) const;
};
class QgsProcessingParameterDefinition
{
%Docstring(signature="appended")
Base class for the definition of processing parameters.
Parameter definitions encapsulate properties regarding the behavior of
parameters, their acceptable ranges, defaults, etc.
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
%TypeHeaderCode
#include "qgsprocessingparameteraggregate.h"
#include "qgsprocessingparameterdxflayers.h"
#include "qgsprocessingparameterfieldmap.h"
#include "qgsprocessingparametertininputlayers.h"
#include "qgsprocessingparametervectortilewriterlayers.h"
#include "qgsprocessingparametermeshdataset.h"
%End
%ConvertToSubClassCode
if ( sipCpp->type() == QgsProcessingParameterBoolean::typeName() )
sipType = sipType_QgsProcessingParameterBoolean;
else if ( sipCpp->type() == QgsProcessingParameterCrs::typeName() )
sipType = sipType_QgsProcessingParameterCrs;
else if ( sipCpp->type() == QgsProcessingParameterMapLayer::typeName() )
sipType = sipType_QgsProcessingParameterMapLayer;
else if ( sipCpp->type() == QgsProcessingParameterExtent::typeName() )
sipType = sipType_QgsProcessingParameterExtent;
else if ( sipCpp->type() == QgsProcessingParameterPoint::typeName() )
sipType = sipType_QgsProcessingParameterPoint;
else if ( sipCpp->type() == QgsProcessingParameterGeometry::typeName() )
sipType = sipType_QgsProcessingParameterGeometry;
else if ( sipCpp->type() == QgsProcessingParameterFile::typeName() )
sipType = sipType_QgsProcessingParameterFile;
else if ( sipCpp->type() == QgsProcessingParameterMatrix::typeName() )
sipType = sipType_QgsProcessingParameterMatrix;
else if ( sipCpp->type() == QgsProcessingParameterMultipleLayers::typeName() )
sipType = sipType_QgsProcessingParameterMultipleLayers;
else if ( sipCpp->type() == QgsProcessingParameterNumber::typeName() )
sipType = sipType_QgsProcessingParameterNumber;
else if ( sipCpp->type() == QgsProcessingParameterDistance::typeName() )
sipType = sipType_QgsProcessingParameterDistance;
else if ( sipCpp->type() == QgsProcessingParameterArea::typeName() )
sipType = sipType_QgsProcessingParameterArea;
else if ( sipCpp->type() == QgsProcessingParameterVolume::typeName() )
sipType = sipType_QgsProcessingParameterVolume;
else if ( sipCpp->type() == QgsProcessingParameterDuration::typeName() )
sipType = sipType_QgsProcessingParameterDuration;
else if ( sipCpp->type() == QgsProcessingParameterScale::typeName() )
sipType = sipType_QgsProcessingParameterScale;
else if ( sipCpp->type() == QgsProcessingParameterRange::typeName() )
sipType = sipType_QgsProcessingParameterRange;
else if ( sipCpp->type() == QgsProcessingParameterRasterLayer::typeName() )
sipType = sipType_QgsProcessingParameterRasterLayer;
else if ( sipCpp->type() == QgsProcessingParameterMeshLayer::typeName() )
sipType = sipType_QgsProcessingParameterMeshLayer;
else if ( sipCpp->type() == QgsProcessingParameterEnum::typeName() )
sipType = sipType_QgsProcessingParameterEnum;
else if ( sipCpp->type() == QgsProcessingParameterString::typeName() )
sipType = sipType_QgsProcessingParameterString;
else if ( sipCpp->type() == QgsProcessingParameterExpression::typeName() )
sipType = sipType_QgsProcessingParameterExpression;
else if ( sipCpp->type() == QgsProcessingParameterAuthConfig::typeName() )
sipType = sipType_QgsProcessingParameterAuthConfig;
else if ( sipCpp->type() == QgsProcessingParameterVectorLayer::typeName() )
sipType = sipType_QgsProcessingParameterVectorLayer;
else if ( sipCpp->type() == QgsProcessingParameterField::typeName() )
sipType = sipType_QgsProcessingParameterField;
else if ( sipCpp->type() == QgsProcessingParameterFeatureSource::typeName() )
sipType = sipType_QgsProcessingParameterFeatureSource;
else if ( sipCpp->type() == QgsProcessingParameterFeatureSink::typeName() )
sipType = sipType_QgsProcessingParameterFeatureSink;
else if ( sipCpp->type() == QgsProcessingParameterVectorDestination::typeName() )
sipType = sipType_QgsProcessingParameterVectorDestination;
else if ( sipCpp->type() == QgsProcessingParameterRasterDestination::typeName() )
sipType = sipType_QgsProcessingParameterRasterDestination;
else if ( sipCpp->type() == QgsProcessingParameterPointCloudDestination::typeName() )
sipType = sipType_QgsProcessingParameterPointCloudDestination;
else if ( sipCpp->type() == QgsProcessingParameterFileDestination::typeName() )
sipType = sipType_QgsProcessingParameterFileDestination;
else if ( sipCpp->type() == QgsProcessingParameterFolderDestination::typeName() )
sipType = sipType_QgsProcessingParameterFolderDestination;
else if ( sipCpp->type() == QgsProcessingParameterBand::typeName() )
sipType = sipType_QgsProcessingParameterBand;
else if ( sipCpp->type() == QgsProcessingParameterLayout::typeName() )
sipType = sipType_QgsProcessingParameterLayout;
else if ( sipCpp->type() == QgsProcessingParameterLayoutItem::typeName() )
sipType = sipType_QgsProcessingParameterLayoutItem;
else if ( sipCpp->type() == QgsProcessingParameterColor::typeName() )
sipType = sipType_QgsProcessingParameterColor;
else if ( sipCpp->type() == QgsProcessingParameterCoordinateOperation::typeName() )
sipType = sipType_QgsProcessingParameterCoordinateOperation;
else if ( sipCpp->type() == QgsProcessingParameterMapTheme::typeName() )
sipType = sipType_QgsProcessingParameterMapTheme;
else if ( sipCpp->type() == QgsProcessingParameterDateTime::typeName() )
sipType = sipType_QgsProcessingParameterDateTime;
else if ( sipCpp->type() == QgsProcessingParameterProviderConnection::typeName() )
sipType = sipType_QgsProcessingParameterProviderConnection;
else if ( sipCpp->type() == QgsProcessingParameterDatabaseSchema::typeName() )
sipType = sipType_QgsProcessingParameterDatabaseSchema;
else if ( sipCpp->type() == QgsProcessingParameterDatabaseTable::typeName() )
sipType = sipType_QgsProcessingParameterDatabaseTable;
else if ( sipCpp->type() == QgsProcessingParameterFieldMapping::typeName() )
sipType = sipType_QgsProcessingParameterFieldMapping;
else if ( sipCpp->type() == QgsProcessingParameterTinInputLayers::typeName() )
sipType = sipType_QgsProcessingParameterTinInputLayers;
else if ( sipCpp->type() == QgsProcessingParameterVectorTileWriterLayers::typeName() )
sipType = sipType_QgsProcessingParameterVectorTileWriterLayers;
else if ( sipCpp->type() == QgsProcessingParameterDxfLayers::typeName() )
sipType = sipType_QgsProcessingParameterDxfLayers;
else if ( sipCpp->type() == QgsProcessingParameterMeshDatasetGroups::typeName() )
sipType = sipType_QgsProcessingParameterMeshDatasetGroups;
else if ( sipCpp->type() == QgsProcessingParameterMeshDatasetTime::typeName() )
sipType = sipType_QgsProcessingParameterMeshDatasetTime;
else if ( sipCpp->type() == QgsProcessingParameterPointCloudLayer::typeName() )
sipType = sipType_QgsProcessingParameterPointCloudLayer;
else if ( sipCpp->type() == QgsProcessingParameterAnnotationLayer::typeName() )
sipType = sipType_QgsProcessingParameterAnnotationLayer;
else if ( sipCpp->type() == QgsProcessingParameterPointCloudAttribute::typeName() )
sipType = sipType_QgsProcessingParameterPointCloudAttribute;
else if ( sipCpp->type() == QgsProcessingParameterVectorTileDestination::typeName() )
sipType = sipType_QgsProcessingParameterVectorTileDestination;
else
sipType = nullptr;
%End
public:
QgsProcessingParameterDefinition( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
bool optional = false, const QString &help = QString() );
%Docstring
Constructor for QgsProcessingParameterDefinition.
%End
virtual ~QgsProcessingParameterDefinition();
virtual QgsProcessingParameterDefinition *clone() const = 0 /Factory/;
%Docstring
Creates a clone of the parameter definition.
%End
virtual QString type() const = 0;
%Docstring
Unique parameter type name.
%End
virtual bool isDestination() const;
%Docstring
Returns ``True`` if this parameter represents a file or layer
destination, e.g. parameters which are used for the destination for
layers output by an algorithm will return ``True``.
%End
QString name() const;
%Docstring
Returns the name of the parameter. This is the internal identifier by
which algorithms access this parameter.
.. seealso:: :py:func:`setName`
%End
void setName( const QString &name );
%Docstring
Sets the ``name`` of the parameter. This is the internal identifier by
which algorithms access this parameter.
.. seealso:: :py:func:`name`
%End
QString description() const;
%Docstring
Returns the description for the parameter. This is the user-visible
string used to identify this parameter.
.. seealso:: :py:func:`setDescription`
%End
void setDescription( const QString &description );
%Docstring
Sets the ``description`` for the parameter. This is the user-visible
string used to identify this parameter.
.. seealso:: :py:func:`description`
%End
QString help() const;
%Docstring
Returns the help for the parameter.
This is a descriptive (possibly lengthy), translated string explaining
the parameter's behavior and use in depth.
.. seealso:: :py:func:`setHelp`
.. versionadded:: 3.16
%End
void setHelp( const QString &help );
%Docstring
Sets the ``help`` for the parameter.
The ``help`` string should be a descriptive, translated string
explaining the parameter's behavior and use in depth.
.. seealso:: :py:func:`help`
.. versionadded:: 3.16
%End
QVariant defaultValue() const;
%Docstring
Returns the default value for the parameter.
.. seealso:: :py:func:`setDefaultValue`
.. seealso:: :py:func:`defaultValueForGui`
.. seealso:: :py:func:`guiDefaultValueOverride`
%End
void setDefaultValue( const QVariant &value );
%Docstring
Sets the default ``value`` for the parameter. Caller takes
responsibility to ensure that ``value`` is a valid input for the
parameter subclass.
.. seealso:: :py:func:`defaultValue`
.. seealso:: :py:func:`setGuiDefaultValueOverride`
%End
QVariant guiDefaultValueOverride() const;
%Docstring
Returns the default value to use in the GUI for the parameter.
Usually this will return an invalid variant, which indicates that the
standard :py:func:`~QgsProcessingParameterDefinition.defaultValue` will
be used in the GUI.
.. seealso:: :py:func:`defaultValue`
.. seealso:: :py:func:`setGuiDefaultValueOverride`
.. seealso:: :py:func:`defaultValueForGui`
.. versionadded:: 3.18
%End
void setGuiDefaultValueOverride( const QVariant &value );
%Docstring
Sets the default ``value`` to use for the parameter in GUI widgets.
Caller takes responsibility to ensure that ``value`` is a valid input
for the parameter subclass.
Usually the
:py:func:`~QgsProcessingParameterDefinition.guiDefaultValueOverride` is
a invalid variant, which indicates that the standard
:py:func:`~QgsProcessingParameterDefinition.defaultValue` should be used
in the GUI. In cases where it is decided that a previous default value
was inappropriate, setting a non-invalid default GUI value can be used
to change the default value for the parameter shown to users when
running algorithms without changing the actual
:py:func:`~QgsProcessingParameterDefinition.defaultValue` and
potentially breaking third party scripts.
.. seealso:: :py:func:`guiDefaultValueOverride`
.. seealso:: :py:func:`setDefaultValue`
.. versionadded:: 3.18
%End
QVariant defaultValueForGui() const;
%Docstring
Returns the default value to use for the parameter in a GUI.
This will be the parameter's
:py:func:`~QgsProcessingParameterDefinition.defaultValue`, unless a
:py:func:`~QgsProcessingParameterDefinition.guiDefaultValueOverride` is
set to override that.
.. versionadded:: 3.18
%End
Qgis::ProcessingParameterFlags flags() const;
%Docstring
Returns any flags associated with the parameter.
.. seealso:: :py:func:`setFlags`
%End
void setFlags( Qgis::ProcessingParameterFlags flags );
%Docstring
Sets the ``flags`` associated with the parameter.
.. seealso:: :py:func:`flags`
%End
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
%Docstring
Checks whether the specified ``input`` value is acceptable for the
parameter. Returns ``True`` if the value can be accepted. The optional
``context`` parameter can be specified to allow a more stringent check
to be performed, capable of checking for the presence of required layers
and other factors within the context.
%End
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
%Docstring
Returns a string version of the parameter input ``value``, which is
suitable for use as an input parameter value when running an algorithm
directly from a Python command.
.. seealso:: :py:func:`valueAsJsonObject`
.. seealso:: :py:func:`valueAsString`
%End
virtual QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const;
%Docstring
Returns a version of the parameter input ``value``, which is suitable
for use in a JSON object.
This method must return only simple values which can be losslessly
encapsulated in a serialized JSON map. For instance, any QGIS class
values (such as :py:class:`QgsCoordinateReferenceSystem`) must be
converted to a simple string or numeric value equivalent.
.. seealso:: :py:func:`valueAsPythonString`
.. seealso:: :py:func:`valueAsString`
.. versionadded:: 3.24
%End
virtual QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok /Out/ ) const;
%Docstring
Returns a string version of the parameter input ``value`` (if possible).
:param value: value to convert
:param context: processing context
:return: - value converted to string
- ok: ``True`` if value could be represented as a string.
.. seealso:: :py:func:`valueAsStringList`
.. seealso:: :py:func:`valueAsJsonObject`
.. seealso:: :py:func:`valueAsPythonString`
.. versionadded:: 3.24
%End
virtual QStringList valueAsStringList( const QVariant &value, QgsProcessingContext &context, bool &ok /Out/ ) const;
%Docstring
Returns a string list version of the parameter input ``value`` (if
possible).
:param value: value to convert
:param context: processing context
:return: - value converted to string list
- ok: ``True`` if value could be represented as a string list
.. seealso:: :py:func:`valueAsString`
.. seealso:: :py:func:`valueAsJsonObject`
.. seealso:: :py:func:`valueAsPythonString`
.. versionadded:: 3.24
%End
virtual QString valueAsPythonComment( const QVariant &value, QgsProcessingContext &context ) const;
%Docstring
Returns a Python comment explaining a parameter ``value``, or an empty
string if no comment is required.
.. versionadded:: 3.20
%End
virtual QString asScriptCode() const;
%Docstring
Returns the parameter definition encoded in a string which can be used
within a Processing script.
%End
virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const;
%Docstring
Returns the parameter definition as a Python command which can be used
within a Python Processing script.
The ``outputType`` argument specifies the desired output format for the
Python string, i.e. the intended end use of the generated Python code.
.. versionadded:: 3.6
%End
virtual QVariantMap toVariantMap() const;
%Docstring
Saves this parameter to a QVariantMap. Subclasses should ensure that
they call the base class method and then extend the result with
additional properties.
.. seealso:: :py:func:`fromVariantMap`
%End
virtual bool fromVariantMap( const QVariantMap &map );
%Docstring
Restores this parameter to a QVariantMap. Subclasses should ensure that
they call the base class method.
.. seealso:: :py:func:`toVariantMap`
%End
QVariantMap &metadata();
%Docstring
Returns the parameter's freeform metadata. This is mostly used by
parameter widget wrappers in order to customize their appearance and
behavior.
.. seealso:: :py:func:`setMetadata`
%End
void setMetadata( const QVariantMap &metadata );
%Docstring
Sets the parameter's freeform ``metadata``. This is mostly used by
parameter widget wrappers in order to customize their appearance and
behavior.
.. seealso:: :py:func:`metadata`
%End
virtual QStringList dependsOnOtherParameters() const;
%Docstring
Returns a list of other parameter names on which this parameter is
dependent (e.g. field parameters which depend on a parent layer
parameter).
%End
QgsProcessingAlgorithm *algorithm() const;
%Docstring
Returns a pointer to the algorithm which owns this parameter. May be
``None`` for non-owned parameters.
.. seealso:: :py:func:`provider`
%End
QgsProcessingProvider *provider() const;
%Docstring
Returns a pointer to the provider for the algorithm which owns this
parameter. May be ``None`` for non-owned parameters or algorithms.
.. seealso:: :py:func:`algorithm`
%End
virtual QString toolTip() const;
%Docstring
Returns a formatted tooltip for use with the parameter, which gives
helpful information like parameter description, ID, and extra content
like default values (depending on parameter type).
%End
bool isDynamic() const;
%Docstring
Returns ``True`` if the parameter supports is dynamic, and can support
data-defined values (i.e. :py:class:`QgsProperty` based values).
.. seealso:: :py:func:`setIsDynamic`
.. seealso:: :py:func:`dynamicPropertyDefinition`
.. seealso:: :py:func:`dynamicLayerParameterName`
%End
void setIsDynamic( bool dynamic );
%Docstring
Sets whether the parameter is ``dynamic``, and can support data-defined
values (i.e. :py:class:`QgsProperty` based values).
.. seealso:: :py:func:`isDynamic`
.. seealso:: :py:func:`setDynamicPropertyDefinition`
.. seealso:: :py:func:`setDynamicLayerParameterName`
%End
QgsPropertyDefinition dynamicPropertyDefinition() const;
%Docstring
Returns the property definition for dynamic properties.
.. seealso:: :py:func:`isDynamic`
.. seealso:: :py:func:`setDynamicPropertyDefinition`
.. seealso:: :py:func:`dynamicLayerParameterName`
%End
void setDynamicPropertyDefinition( const QgsPropertyDefinition &definition );
%Docstring
Sets the property ``definition`` for dynamic properties.
.. seealso:: :py:func:`isDynamic`
.. seealso:: :py:func:`dynamicPropertyDefinition`
.. seealso:: :py:func:`setDynamicLayerParameterName`
%End
QString dynamicLayerParameterName() const;
%Docstring
Returns the name of the parameter for a layer linked to a dynamic
parameter, or an empty string if this is not set.
Dynamic parameters (see
:py:func:`~QgsProcessingParameterDefinition.isDynamic`) can have an
optional vector layer parameter linked to them, which indicates which
layer the fields and values will be available from when evaluating the
dynamic parameter.
.. seealso:: :py:func:`setDynamicLayerParameterName`
.. seealso:: :py:func:`isDynamic`
.. seealso:: :py:func:`dynamicPropertyDefinition`
%End
void setDynamicLayerParameterName( const QString &name );
%Docstring
Sets the ``name`` for the parameter for a layer linked to a dynamic
parameter, or an empty string if this is not set.
Dynamic parameters (see
:py:func:`~QgsProcessingParameterDefinition.isDynamic`) can have an
optional vector layer parameter linked to them, which indicates which
layer the fields and values will be available from when evaluating the
dynamic parameter.
.. seealso:: :py:func:`dynamicLayerParameterName`
.. seealso:: :py:func:`isDynamic`
.. seealso:: :py:func:`setDynamicPropertyDefinition`
%End
QStringList additionalExpressionContextVariables() const;
%Docstring
Returns a list of additional expression context variables which are
available for use when evaluating this parameter.
The additional variables will be added to the variables exposed from the
usual expression context available to the parameter. They can be used to
expose variables which are ONLY available to this parameter.
The returned list should contain the variable names only, without the
usual "@" prefix.
.. seealso:: :py:func:`setAdditionalExpressionContextVariables`
.. versionadded:: 3.8
%End
void setAdditionalExpressionContextVariables( const QStringList &variables );
%Docstring
Sets a list of additional expression context ``variables`` which are
available for use when evaluating this parameter.
The additional variables will be added to the variables exposed from the
usual expression context available to the parameter. They can be used to
expose variables which are ONLY available to this parameter.
The ``variables`` list should contain the variable names only, without
the usual "@" prefix.
.. note::
Specifying variables via this method is for metadata purposes only. It is the algorithm's responsibility
to correctly set the value of these additional variables in all expression context used when evaluating the parameter,
in whichever way is appropriate for that particular variable.
.. seealso:: :py:func:`additionalExpressionContextVariables`
.. versionadded:: 3.8
%End
protected:
QVariant defaultGuiValueFromSetting() const;
%Docstring
Default gui value for an algorithm parameter from settings
:return: default value from settings or invalid QVariant if there is no
default value defined in the settings
.. versionadded:: 3.34
%End
};
typedef QList< const QgsProcessingParameterDefinition * > QgsProcessingParameterDefinitions;
class QgsProcessingParameters
{
%Docstring(signature="appended")
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
:py:class:`QgsProcessingParameters` :py:func:`~parameterAsString`,
:py:func:`~parameterAsDouble` are used instead.
Parameters are evaluated using a provided
:py:class:`QgsProcessingContext`, allowing the evaluation to understand
available map layers and expression contexts (for expression based
parameters).
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
static bool isDynamic( const QVariantMap &parameters, const QString &name );
%Docstring
Returns ``True`` if the parameter with matching ``name`` is a dynamic
parameter, and must be evaluated once for every input feature processed.
%End
static QString parameterAsString( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to a static string
value.
%End
static QString parameterAsString( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to a
static string value.
.. versionadded:: 3.4
%End
static QString parameterAsExpression( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to an expression.
%End
static QString parameterAsExpression( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definitionand`` ``value`` to an
expression.
.. versionadded:: 3.4
%End
static double parameterAsDouble( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to a static double
value.
%End
static double parameterAsDouble( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to a
static double value.
.. versionadded:: 3.4
%End
static int parameterAsInt( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to a static integer
value.
%End
static int parameterAsInt( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to a
static integer value.
.. versionadded:: 3.4
%End
static QList<int> parameterAsInts( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to a list of
integer values.
.. versionadded:: 3.4
%End
static QList<int> parameterAsInts( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to a
list of integer values.
.. versionadded:: 3.4
%End
static QDateTime parameterAsDateTime( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to a static
datetime value.
.. seealso:: :py:func:`parameterAsDate`
.. seealso:: :py:func:`parameterAsTime`
.. versionadded:: 3.14
%End
static QDateTime parameterAsDateTime( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to a
static datetime value.
.. seealso:: :py:func:`parameterAsDate`
.. seealso:: :py:func:`parameterAsTime`
.. versionadded:: 3.14
%End
static QDate parameterAsDate( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to a static date
value.
.. seealso:: :py:func:`parameterAsDateTime`
.. seealso:: :py:func:`parameterAsTime`
.. versionadded:: 3.14
%End
static QDate parameterAsDate( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to a
static date value.
.. seealso:: :py:func:`parameterAsDateTime`
.. seealso:: :py:func:`parameterAsTime`
.. versionadded:: 3.14
%End
static QTime parameterAsTime( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to a static time
value.
.. seealso:: :py:func:`parameterAsDateTime`
.. seealso:: :py:func:`parameterAsDate`
.. versionadded:: 3.14
%End
static QTime parameterAsTime( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to a
static time value.
.. seealso:: :py:func:`parameterAsDateTime`
.. seealso:: :py:func:`parameterAsDate`
.. versionadded:: 3.14
%End
static int parameterAsEnum( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to a enum value.
%End
static int parameterAsEnum( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to a
enum value.
.. versionadded:: 3.4
%End
static QList<int> parameterAsEnums( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to list of enum
values.
%End
static QList<int> parameterAsEnums( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to
list of enum values.
.. versionadded:: 3.4
%End
static QString parameterAsEnumString( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to a static enum
string.
.. versionadded:: 3.18
%End
static QString parameterAsEnumString( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to a
static enum string.
.. versionadded:: 3.18
%End
static QStringList parameterAsEnumStrings( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to list of static
enum strings.
.. versionadded:: 3.18
%End
static QStringList parameterAsEnumStrings( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to
list of static enum strings.
.. versionadded:: 3.18
%End
static bool parameterAsBool( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to a static boolean
value.
%End
static bool parameterAsBoolean( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to a static boolean
value.
.. versionadded:: 3.8
%End
static bool parameterAsBool( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to a
static boolean value.
.. versionadded:: 3.4
%End
static bool parameterAsBoolean( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to a
static boolean value.
.. versionadded:: 3.8
%End
static QgsFeatureSink *parameterAsSink( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters,
const QgsFields &fields, Qgis::WkbType geometryType, const QgsCoordinateReferenceSystem &crs,
QgsProcessingContext &context, QString &destinationIdentifier /Out/, QgsFeatureSink::SinkFlags sinkFlags = QgsFeatureSink::SinkFlags(), const QVariantMap &createOptions = QVariantMap(), const QStringList &datasourceOptions = QStringList(), const QStringList &layerOptions = QStringList() ) /Factory/;
%Docstring
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
:py:func:`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.
%End
static QgsFeatureSink *parameterAsSink( const QgsProcessingParameterDefinition *definition, const QVariant &value,
const QgsFields &fields, Qgis::WkbType geometryType, const QgsCoordinateReferenceSystem &crs,
QgsProcessingContext &context, QString &destinationIdentifier /Out/, QgsFeatureSink::SinkFlags sinkFlags = QgsFeatureSink::SinkFlags(), const QVariantMap &createOptions = QVariantMap(), const QStringList &datasourceOptions = QStringList(), const QStringList &layerOptions = QStringList() ) throw( QgsProcessingException ) /Factory/;
%Docstring
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
:py:func:`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.
:raises QgsProcessingException:
.. versionadded:: 3.4
%End
static QgsProcessingFeatureSource *parameterAsSource( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context ) /Factory/;
%Docstring
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.
%End
static QgsProcessingFeatureSource *parameterAsSource( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context ) /Factory/;
%Docstring
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.
.. versionadded:: 3.4
%End
static QString parameterAsCompatibleSourceLayerPath( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters,
QgsProcessingContext &context, const QStringList &compatibleFormats, const QString &preferredFormat = QString( "shp" ), QgsProcessingFeedback *feedback = 0 );
%Docstring
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
:py:func:`~QgsProcessingParameters.parameterAsCompatibleSourceLayerPathAndLayerName`
which may avoid conversion in more situations.
%End
static QString parameterAsCompatibleSourceLayerPathAndLayerName( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters,
QgsProcessingContext &context, const QStringList &compatibleFormats, const QString &preferredFormat = QString( "shp" ), QgsProcessingFeedback *feedback = 0, QString *layerName /Out/ = 0 );
%Docstring
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
:py:func:`~QgsProcessingParameters.parameterAsCompatibleSourceLayerPath`
when an algorithm is able to correctly handle files with multiple
layers. Unlike
:py:func:`~QgsProcessingParameters.parameterAsCompatibleSourceLayerPath`,
it will not force a conversion in this case and will return the target
layer name in the ``layerName`` argument.
:param definition: associated parameter definition
:param parameters: input parameter value map
:param context: processing context
:param compatibleFormats: a list of lowercase file extensions compatible
with the algorithm
:param preferredFormat: preferred format extension to use if conversion
if required
:param feedback: feedback object
:return: - path to source layer, or nearly converted compatible layer
- layerName: the target layer name for multi-layer sources
(e.g. Geopackage)
.. seealso:: :py:func:`parameterAsCompatibleSourceLayerPath`
.. versionadded:: 3.10
%End
static QgsMapLayer *parameterAsLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingUtils::LayerHint layerHint = QgsProcessingUtils::LayerHint::UnknownType, QgsProcessing::LayerOptionsFlags flags = QgsProcessing::LayerOptionsFlags() );
%Docstring
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.
%End
static QgsMapLayer *parameterAsLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context, QgsProcessingUtils::LayerHint layerHint = QgsProcessingUtils::LayerHint::UnknownType, QgsProcessing::LayerOptionsFlags flags = QgsProcessing::LayerOptionsFlags() );
%Docstring
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.
.. versionadded:: 3.4
%End
static QgsRasterLayer *parameterAsRasterLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
%Docstring
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.
%End
static QgsRasterLayer *parameterAsRasterLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
%Docstring
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.
.. versionadded:: 3.4
%End
static QString parameterAsOutputLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to a output layer
destination.
%End
static QString parameterAsOutputLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context, bool testOnly = false );
%Docstring
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.
.. versionadded:: 3.4
%End
static QString parameterAsFileOutput( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to a file based
output destination.
%End
static QString parameterAsFileOutput( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to a
file based output destination.
.. versionadded:: 3.4
%End
static QgsVectorLayer *parameterAsVectorLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
%Docstring
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.
%End
static QgsVectorLayer *parameterAsVectorLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
%Docstring
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.
.. versionadded:: 3.4
%End
static QgsMeshLayer *parameterAsMeshLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
%Docstring
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.
.. versionadded:: 3.6
%End
static QgsMeshLayer *parameterAsMeshLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
%Docstring
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.
.. versionadded:: 3.6
%End
static QgsCoordinateReferenceSystem parameterAsCrs( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to a coordinate
reference system.
%End
static QgsCoordinateReferenceSystem parameterAsCrs( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to a
coordinate reference system.
.. versionadded:: 3.4
%End
static QgsRectangle parameterAsExtent( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context,
const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem() );
%Docstring
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.
.. seealso:: :py:func:`parameterAsExtentGeometry`
.. seealso:: :py:func:`parameterAsExtentCrs`
%End
static QgsRectangle parameterAsExtent( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context,
const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem() );
%Docstring
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.
.. seealso:: :py:func:`parameterAsExtentGeometry`
.. seealso:: :py:func:`parameterAsExtentCrs`
.. versionadded:: 3.4
%End
static QgsGeometry parameterAsExtentGeometry( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context,
const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem() );
%Docstring
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
:py:func:`~QgsProcessingParameters.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 :py:func:`~QgsProcessingParameters.parameterAsExtent`
returns just the extent of the reprojected rectangle).
.. seealso:: :py:func:`parameterAsExtent`
.. seealso:: :py:func:`parameterAsExtentCrs`
%End
static QgsCoordinateReferenceSystem parameterAsExtentCrs( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
%Docstring
Returns the coordinate reference system associated with an extent
parameter value.
.. seealso:: :py:func:`parameterAsExtent`
%End
static QgsCoordinateReferenceSystem parameterAsExtentCrs( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
%Docstring
Returns the coordinate reference system associated with an extent
parameter value.
.. seealso:: :py:func:`parameterAsExtent`
%End
static QgsPointXY parameterAsPoint( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context,
const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem() );
%Docstring
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``.
.. seealso:: :py:func:`parameterAsPointCrs`
%End
static QgsPointXY parameterAsPoint( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context,
const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem() );
%Docstring
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``.
.. seealso:: :py:func:`parameterAsPointCrs`
.. versionadded:: 3.4
%End
static QgsCoordinateReferenceSystem parameterAsPointCrs( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
%Docstring
Returns the coordinate reference system associated with an point
parameter value.
.. seealso:: :py:func:`parameterAsPoint`
%End
static QgsCoordinateReferenceSystem parameterAsPointCrs( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
%Docstring
Returns the coordinate reference system associated with an point
parameter value.
.. seealso:: :py:func:`parameterAsPoint`
.. versionadded:: 3.8
%End
static QgsGeometry parameterAsGeometry( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem() );
%Docstring
Evaluates the parameter with matching ``definition`` to a geometry.
.. versionadded:: 3.16
%End
static QgsGeometry parameterAsGeometry( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem() );
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to a
geometry.
.. versionadded:: 3.16
%End
static QgsCoordinateReferenceSystem parameterAsGeometryCrs( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
%Docstring
Returns the coordinate reference system associated with a geometry
parameter value.
.. seealso:: :py:func:`parameterAsGeometry`
.. versionadded:: 3.16
%End
static QgsCoordinateReferenceSystem parameterAsGeometryCrs( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
%Docstring
Returns the coordinate reference system associated with an point
parameter value.
.. seealso:: :py:func:`parameterAsGeometry`
.. versionadded:: 3.16
%End
static QString parameterAsFile( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to a file/folder
name.
%End
static QString parameterAsFile( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to a
file/folder name.
.. versionadded:: 3.4
%End
static QVariantList parameterAsMatrix( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to a matrix/table
of values. Tables are collapsed to a 1 dimensional list.
%End
static QVariantList parameterAsMatrix( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to a
matrix/table of values. Tables are collapsed to a 1 dimensional list.
.. versionadded:: 3.4
%End
static QList< QgsMapLayer *> parameterAsLayerList( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessing::LayerOptionsFlags flags = QgsProcessing::LayerOptionsFlags() );
%Docstring
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).
%End
static QList< QgsMapLayer *> parameterAsLayerList( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context, QgsProcessing::LayerOptionsFlags flags = QgsProcessing::LayerOptionsFlags() );
%Docstring
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).
.. versionadded:: 3.4
%End
static QStringList parameterAsFileList( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to a list of files
(for :py:class:`QgsProcessingParameterMultipleLayers` in
:py:class:`QgsProcessing`:TypeFile mode).
.. versionadded:: 3.10
%End
static QStringList parameterAsFileList( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to a list of files
(for :py:class:`QgsProcessingParameterMultipleLayers` in
:py:class:`QgsProcessing`:TypeFile mode).
.. versionadded:: 3.10
%End
static QList<double> parameterAsRange( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to a range of
values.
%End
static QList<double> parameterAsRange( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to a
range of values.
.. versionadded:: 3.4
%End
static QStringList parameterAsFields( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context ) /Deprecated="Since 3.40. Use parameterAsStrings() instead."/;
%Docstring
Evaluates the parameter with matching ``definition`` to a list of
fields.
.. deprecated:: 3.40
Use :py:func:`~QgsProcessingParameters.parameterAsStrings` instead.
%End
static QStringList parameterAsFields( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context ) /Deprecated="Since 3.40. Use parameterAsStrings() instead."/;
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to a
list of fields.
.. versionadded:: 3.4
.. deprecated:: 3.40
Use :py:func:`~QgsProcessingParameters.parameterAsStrings` instead.
%End
static QStringList parameterAsStrings( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to a list of
strings (e.g. field names or point cloud attributes).
.. versionadded:: 3.32
%End
static QStringList parameterAsStrings( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to a
list of strings (e.g. field names or point cloud attributes).
.. versionadded:: 3.32
%End
static QgsPrintLayout *parameterAsLayout( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
%Docstring
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.
.. versionadded:: 3.8
%End
static QgsPrintLayout *parameterAsLayout( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
%Docstring
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.
.. versionadded:: 3.8
%End
static QgsLayoutItem *parameterAsLayoutItem( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context, QgsPrintLayout *layout );
%Docstring
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.
.. versionadded:: 3.8
%End
static QgsLayoutItem *parameterAsLayoutItem( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context, QgsPrintLayout *layout );
%Docstring
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.
.. versionadded:: 3.8
%End
static QColor parameterAsColor( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
%Docstring
Returns the color associated with an point parameter value, or an
invalid color if the parameter was not set.
.. versionadded:: 3.10
%End
static QColor parameterAsColor( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
%Docstring
Returns the color associated with an color parameter value, or an
invalid color if the parameter was not set.
.. versionadded:: 3.10
%End
static QString parameterAsConnectionName( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to a connection
name string.
.. versionadded:: 3.14
%End
static QString parameterAsConnectionName( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to a
connection name string.
.. versionadded:: 3.14
%End
static QString parameterAsSchema( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to a database
schema name.
.. versionadded:: 3.14
%End
static QString parameterAsSchema( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to a
database schema name.
.. versionadded:: 3.14
%End
static QString parameterAsDatabaseTableName( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to a database table
name.
.. versionadded:: 3.14
%End
static QString parameterAsDatabaseTableName( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to a
database table name.
.. versionadded:: 3.14
%End
static QgsPointCloudLayer *parameterAsPointCloudLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessing::LayerOptionsFlags flags = QgsProcessing::LayerOptionsFlags() );
%Docstring
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.
.. versionadded:: 3.22
%End
static QgsPointCloudLayer *parameterAsPointCloudLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context, QgsProcessing::LayerOptionsFlags flags = QgsProcessing::LayerOptionsFlags() );
%Docstring
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.
.. versionadded:: 3.22
%End
static QgsAnnotationLayer *parameterAsAnnotationLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
%Docstring
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 :py:class:`QgsProject` loaded directly in a background thread). Ensure your algorithm returns the
:py:class:`QgsProcessingAlgorithm`.FlagNoThreading flag or only accesses annotation layers from a :py:func:`~QgsProcessingParameters.prepareAlgorithm`
or :py:func:`~QgsProcessingParameters.postProcessAlgorithm` step.
.. versionadded:: 3.22
%End
static QgsAnnotationLayer *parameterAsAnnotationLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
%Docstring
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 :py:class:`QgsProject` loaded directly in a background thread). Ensure your algorithm returns the
:py:class:`QgsProcessingAlgorithm`.FlagNoThreading flag or only accesses annotation layers from a :py:func:`~QgsProcessingParameters.prepareAlgorithm`
or :py:func:`~QgsProcessingParameters.postProcessAlgorithm` step.
.. versionadded:: 3.22
%End
static QgsProcessingParameterDefinition *parameterFromVariantMap( const QVariantMap &map ) /Factory/;
%Docstring
Creates a new :py:class:`QgsProcessingParameterDefinition` using the
configuration from a supplied variant ``map``. The caller takes
responsibility for deleting the returned object.
%End
static QString descriptionFromName( const QString &name );
%Docstring
Creates an autogenerated parameter description from a parameter
``name``.
%End
static QgsProcessingParameterDefinition *parameterFromScriptCode( const QString &code ) /Factory/;
%Docstring
Creates a new :py:class:`QgsProcessingParameterDefinition` using the
configuration from a supplied script ``code`` string. The caller takes
responsibility for deleting the returned object.
%End
};
class QgsProcessingParameterBoolean : QgsProcessingParameterDefinition
{
%Docstring(signature="appended")
A boolean parameter for processing algorithms.
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterBoolean( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
bool optional = false );
%Docstring
Constructor for QgsProcessingParameterBoolean.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString asScriptCode() const;
static QgsProcessingParameterBoolean *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
};
class QgsProcessingParameterCrs : QgsProcessingParameterDefinition
{
%Docstring(signature="appended")
A coordinate reference system parameter for processing algorithms.
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterCrs( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
bool optional = false );
%Docstring
Constructor for QgsProcessingParameterCrs.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok /Out/ ) const;
virtual QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const;
static QgsProcessingParameterCrs *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
};
class QgsProcessingParameterExtent : QgsProcessingParameterDefinition
{
%Docstring(signature="appended")
A rectangular map extent parameter for processing algorithms.
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterExtent( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
bool optional = false );
%Docstring
Constructor for QgsProcessingParameterExtent.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok /Out/ ) const;
virtual QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const;
static QgsProcessingParameterExtent *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
};
class QgsProcessingParameterPoint : QgsProcessingParameterDefinition
{
%Docstring(signature="appended")
A point parameter for processing algorithms.
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterPoint( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
bool optional = false );
%Docstring
Constructor for QgsProcessingParameterPoint.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
static QgsProcessingParameterPoint *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
};
class QgsProcessingParameterGeometry : QgsProcessingParameterDefinition
{
%Docstring(signature="appended")
A geometry parameter for processing algorithms.
.. versionadded:: 3.16
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterGeometry( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(), bool optional = false, const QList< int > &geometryTypes = QList< int >(), bool allowMultipart = true );
%Docstring
Constructor for QgsProcessingParameterGeometry.
The ``geometryTypes`` argument allows for specifying a list of geometry
types (see :py:class:`Qgis`.GeometryType) acceptable for this parameter.
Passing a empty list will allow for any type of geometry. The
``allowMultiPart`` argument allows specifying a multi part geometry
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString asScriptCode() const;
virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const;
virtual QVariantMap toVariantMap() const;
virtual bool fromVariantMap( const QVariantMap &map );
QList<int> geometryTypes() const;
%Docstring
Returns the parameter allowed geometries, as a list of
:py:class:`Qgis`.GeometryType values.
.. seealso:: :py:func:`setGeometryTypes`
%End
void setGeometryTypes( const QList<int> &geometryTypes );
%Docstring
Sets the allowed ``geometryTypes``, as a list of
:py:class:`Qgis`.GeometryType values.
.. seealso:: :py:func:`geometryTypes`
%End
bool allowMultipart() const;
%Docstring
Returns the parameter allow multipart geometries.
.. seealso:: :py:func:`setAllowMultipart`
%End
void setAllowMultipart( bool allowMultipart );
%Docstring
Sets the allow multipart geometries
.. seealso:: :py:func:`allowMultipart`
%End
static QgsProcessingParameterGeometry *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
};
class QgsProcessingParameterFile : QgsProcessingParameterDefinition, QgsFileFilterGenerator
{
%Docstring(signature="appended")
An input file or folder parameter for processing algorithms.
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterFile( const QString &name, const QString &description = QString(), Qgis::ProcessingFileParameterBehavior behavior = Qgis::ProcessingFileParameterBehavior::File, const QString &extension = QString(), const QVariant &defaultValue = QVariant(),
bool optional = false, const QString &fileFilter = QString() );
%Docstring
Constructor for QgsProcessingParameterFile.
The ``extension`` argument allows for specifying a file extension
associated with the parameter (e.g. "html"). Use ``fileFilter`` for a
more flexible approach which allows for multiple file extensions. Only
one of ``extension`` or ``fileFilter`` should be specified, if both are
specified then ``fileFilter`` takes precedence.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
virtual QString asScriptCode() const;
virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const;
virtual QString createFileFilter() const;
Qgis::ProcessingFileParameterBehavior behavior() const;
%Docstring
Returns the parameter behavior (e.g. File or Folder).
.. seealso:: :py:func:`setBehavior`
%End
void setBehavior( Qgis::ProcessingFileParameterBehavior behavior );
%Docstring
Sets the parameter ``behavior`` (e.g. File or Folder).
.. seealso:: :py:func:`behavior`
%End
QString extension() const;
%Docstring
Returns any specified file extension for the parameter.
.. note::
See :py:func:`~QgsProcessingParameterFile.fileFilter` for a more flexible approach.
.. seealso:: :py:func:`setExtension`
%End
void setExtension( const QString &extension );
%Docstring
Sets a file ``extension`` for the parameter.
Calling this method resets any existing
:py:func:`~QgsProcessingParameterFile.fileFilter`.
.. note::
See :py:func:`~QgsProcessingParameterFile.setFileFilter` for a more flexible approach.
.. seealso:: :py:func:`extension`
%End
QString fileFilter() const;
%Docstring
Returns the file filter string for file destinations compatible with
this parameter.
.. seealso:: :py:func:`setFileFilter`
.. seealso:: :py:func:`extension`
.. versionadded:: 3.10
%End
void setFileFilter( const QString &filter );
%Docstring
Sets the file ``filter`` string for file destinations compatible with
this parameter.
Calling this method resets any existing
:py:func:`~QgsProcessingParameterFile.extension` setting.
.. seealso:: :py:func:`fileFilter`
.. seealso:: :py:func:`setExtension`
.. versionadded:: 3.10
%End
virtual QVariantMap toVariantMap() const;
virtual bool fromVariantMap( const QVariantMap &map );
static QgsProcessingParameterFile *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition, Qgis::ProcessingFileParameterBehavior behavior = Qgis::ProcessingFileParameterBehavior::File ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
};
class QgsProcessingParameterMatrix : QgsProcessingParameterDefinition
{
%Docstring(signature="appended")
A table (matrix) parameter for processing algorithms.
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterMatrix( const QString &name, const QString &description = QString(), int numberRows = 3,
bool hasFixedNumberRows = false, const QStringList &headers = QStringList(),
const QVariant &defaultValue = QVariant(),
bool optional = false );
%Docstring
Constructor for QgsProcessingParameterMatrix.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const;
QStringList headers() const;
%Docstring
Returns a list of column headers (if set).
.. seealso:: :py:func:`setHeaders`
%End
void setHeaders( const QStringList &headers );
%Docstring
Sets the list of column ``headers``.
.. seealso:: :py:func:`headers`
%End
int numberRows() const;
%Docstring
Returns the fixed number of rows in the table. This parameter only has
an effect if :py:func:`~QgsProcessingParameterMatrix.hasFixedNumberRows`
is ``True``.
.. seealso:: :py:func:`setNumberRows`
.. seealso:: :py:func:`setHasFixedNumberRows`
%End
void setNumberRows( int rows );
%Docstring
Sets the fixed number of ``rows`` in the table. This parameter only has
an effect if :py:func:`~QgsProcessingParameterMatrix.hasFixedNumberRows`
is ``True``.
.. seealso:: :py:func:`numberRows`
.. seealso:: :py:func:`setHasFixedNumberRows`
%End
bool hasFixedNumberRows() const;
%Docstring
Returns whether the table has a fixed number of rows.
.. seealso:: :py:func:`numberRows`
.. seealso:: :py:func:`setHasFixedNumberRows`
%End
void setHasFixedNumberRows( bool hasFixedNumberRows );
%Docstring
Sets whether the table has a fixed number of rows.
.. seealso:: :py:func:`setNumberRows`
.. seealso:: :py:func:`hasFixedNumberRows`
%End
virtual QVariantMap toVariantMap() const;
virtual bool fromVariantMap( const QVariantMap &map );
static QgsProcessingParameterMatrix *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
};
class QgsProcessingParameterMultipleLayers : QgsProcessingParameterDefinition, QgsFileFilterGenerator
{
%Docstring(signature="appended")
A parameter for processing algorithms which accepts multiple map layers.
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterMultipleLayers( const QString &name, const QString &description = QString(), Qgis::ProcessingSourceType layerType = Qgis::ProcessingSourceType::VectorAnyGeometry,
const QVariant &defaultValue = QVariant(),
bool optional = false );
%Docstring
Constructor for QgsProcessingParameterMultipleLayers.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok /Out/ ) const;
virtual QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString asScriptCode() const;
virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const;
virtual QString createFileFilter() const;
Qgis::ProcessingSourceType layerType() const;
%Docstring
Returns the layer type for layers acceptable by the parameter.
.. seealso:: :py:func:`setLayerType`
%End
void setLayerType( Qgis::ProcessingSourceType type );
%Docstring
Sets the layer ``type`` for layers acceptable by the parameter.
.. seealso:: :py:func:`layerType`
%End
int minimumNumberInputs() const;
%Docstring
Returns the minimum number of layers required for the parameter. If the
return value is < 1 then the parameter accepts any number of layers.
.. seealso:: :py:func:`setMinimumNumberInputs`
%End
void setMinimumNumberInputs( int minimum );
%Docstring
Sets the ``minimum`` number of layers required for the parameter. The
minimum must be >= 1 if the parameter is not optional.
.. seealso:: :py:func:`minimumNumberInputs`
%End
virtual QVariantMap toVariantMap() const;
virtual bool fromVariantMap( const QVariantMap &map );
static QgsProcessingParameterMultipleLayers *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
};
class QgsProcessingParameterNumber : QgsProcessingParameterDefinition
{
%Docstring(signature="appended")
A numeric parameter for processing algorithms.
For numeric parameters with a :py:func:`~dataType` of Double, the number
of decimals places shown in the parameter's widget can be specified by
setting the parameter's metadata. For example:
.. code-block:: python
param = QgsProcessingParameterNumber( 'VAL', 'Threshold', type=QgsProcessingParameterNumber.Double)
# only show two decimal places in parameter's widgets, not 6:
param.setMetadata( {'widget_wrapper':
{ 'decimals': 2 }
})
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
explicit QgsProcessingParameterNumber( const QString &name, const QString &description = QString(),
Qgis::ProcessingNumberParameterType type = Qgis::ProcessingNumberParameterType::Integer,
const QVariant &defaultValue = QVariant(),
bool optional = false,
double minValue = -DBL_MAX + 1,
double maxValue = DBL_MAX
);
%Docstring
Constructor for QgsProcessingParameterNumber.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString toolTip() const;
virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const;
double minimum() const;
%Docstring
Returns the minimum value acceptable by the parameter.
.. seealso:: :py:func:`setMinimum`
%End
void setMinimum( double minimum );
%Docstring
Sets the ``minimum`` value acceptable by the parameter.
.. seealso:: :py:func:`minimum`
%End
double maximum() const;
%Docstring
Returns the maximum value acceptable by the parameter.
.. seealso:: :py:func:`setMaximum`
%End
void setMaximum( double maximum );
%Docstring
Sets the ``maximum`` value acceptable by the parameter.
.. seealso:: :py:func:`maximum`
%End
Qgis::ProcessingNumberParameterType dataType() const;
%Docstring
Returns the acceptable data type for the parameter.
.. seealso:: :py:func:`setDataType`
%End
void setDataType( Qgis::ProcessingNumberParameterType type );
%Docstring
Sets the acceptable data ``type`` for the parameter.
.. seealso:: :py:func:`dataType`
%End
virtual QVariantMap toVariantMap() const;
virtual bool fromVariantMap( const QVariantMap &map );
static QgsProcessingParameterNumber *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
};
class QgsProcessingParameterDistance : QgsProcessingParameterNumber
{
%Docstring(signature="appended")
A double numeric parameter for distance values.
Linked to a source layer or CRS parameter to determine what units the
distance values are in.
The number of decimals places shown in a distance parameter's widget can
be specified by setting the parameter's metadata. For example:
.. code-block:: python
param = QgsProcessingParameterDistance( 'VAL', 'Threshold')
# only show two decimal places in parameter's widgets, not 6:
param.setMetadata( {'widget_wrapper':
{ 'decimals': 2 }
})
.. versionadded:: 3.2
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
explicit QgsProcessingParameterDistance( const QString &name, const QString &description = QString(),
const QVariant &defaultValue = QVariant(),
const QString &parentParameterName = QString(),
bool optional = false,
double minValue = -DBL_MAX + 1,
double maxValue = DBL_MAX );
%Docstring
Constructor for QgsProcessingParameterDistance.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDistance *clone() const /Factory/;
virtual QString type() const;
virtual QStringList dependsOnOtherParameters() const;
virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const;
QString parentParameterName() const;
%Docstring
Returns the name of the parent parameter, or an empty string if this is
not set.
.. seealso:: :py:func:`setParentParameterName`
%End
void setParentParameterName( const QString &parentParameterName );
%Docstring
Sets the name of the parent layer parameter. Use an empty string if this
is not required.
.. seealso:: :py:func:`parentParameterName`
%End
Qgis::DistanceUnit defaultUnit() const;
%Docstring
Returns the default distance unit for the parameter.
.. seealso:: :py:func:`setDefaultUnit`
.. versionadded:: 3.4.3
%End
void setDefaultUnit( Qgis::DistanceUnit unit );
%Docstring
Sets the default distance ``unit`` for the parameter.
.. seealso:: :py:func:`defaultUnit`
.. versionadded:: 3.4.3
%End
virtual QVariantMap toVariantMap() const;
virtual bool fromVariantMap( const QVariantMap &map );
};
class QgsProcessingParameterArea : QgsProcessingParameterNumber
{
%Docstring(signature="appended")
A double numeric parameter for area values.
Linked to a source layer or CRS parameter to determine what units the
area values are in.
The number of decimals places shown in a area parameter's widget can be
specified by setting the parameter's metadata. For example:
.. code-block:: python
param = QgsProcessingParameterArea( 'VAL', 'Threshold')
# only show two decimal places in parameter's widgets, not 6:
param.setMetadata( {'widget_wrapper':
{ 'decimals': 2 }
})
.. versionadded:: 3.40
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
explicit QgsProcessingParameterArea( const QString &name, const QString &description = QString(),
const QVariant &defaultValue = QVariant(),
const QString &parentParameterName = QString(),
bool optional = false,
double minValue = 0,
double maxValue = DBL_MAX );
%Docstring
Constructor for QgsProcessingParameterArea.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterArea *clone() const /Factory/;
virtual QString type() const;
virtual QStringList dependsOnOtherParameters() const;
virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const;
QString parentParameterName() const;
%Docstring
Returns the name of the parent parameter, or an empty string if this is
not set.
.. seealso:: :py:func:`setParentParameterName`
%End
void setParentParameterName( const QString &parentParameterName );
%Docstring
Sets the name of the parent layer parameter. Use an empty string if this
is not required.
.. seealso:: :py:func:`parentParameterName`
%End
Qgis::AreaUnit defaultUnit() const;
%Docstring
Returns the default area unit for the parameter.
.. seealso:: :py:func:`setDefaultUnit`
%End
void setDefaultUnit( Qgis::AreaUnit unit );
%Docstring
Sets the default area ``unit`` for the parameter.
.. seealso:: :py:func:`defaultUnit`
%End
virtual QVariantMap toVariantMap() const;
virtual bool fromVariantMap( const QVariantMap &map );
};
class QgsProcessingParameterVolume : QgsProcessingParameterNumber
{
%Docstring(signature="appended")
A double numeric parameter for volume values.
Linked to a source layer or CRS parameter to determine what units the
volume values are in.
The number of decimals places shown in a volume parameter's widget can
be specified by setting the parameter's metadata. For example:
.. code-block:: python
param = QgsProcessingParameterVolume( 'VAL', 'Threshold')
# only show two decimal places in parameter's widgets, not 6:
param.setMetadata( {'widget_wrapper':
{ 'decimals': 2 }
})
.. versionadded:: 3.40
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
explicit QgsProcessingParameterVolume( const QString &name, const QString &description = QString(),
const QVariant &defaultValue = QVariant(),
const QString &parentParameterName = QString(),
bool optional = false,
double minValue = 0,
double maxValue = DBL_MAX );
%Docstring
Constructor for QgsProcessingParameterVolume.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterVolume *clone() const /Factory/;
virtual QString type() const;
virtual QStringList dependsOnOtherParameters() const;
virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const;
QString parentParameterName() const;
%Docstring
Returns the name of the parent parameter, or an empty string if this is
not set.
.. seealso:: :py:func:`setParentParameterName`
%End
void setParentParameterName( const QString &parentParameterName );
%Docstring
Sets the name of the parent layer parameter. Use an empty string if this
is not required.
.. seealso:: :py:func:`parentParameterName`
%End
Qgis::VolumeUnit defaultUnit() const;
%Docstring
Returns the default volume unit for the parameter.
.. seealso:: :py:func:`setDefaultUnit`
%End
void setDefaultUnit( Qgis::VolumeUnit unit );
%Docstring
Sets the default volume ``unit`` for the parameter.
.. seealso:: :py:func:`defaultUnit`
%End
virtual QVariantMap toVariantMap() const;
virtual bool fromVariantMap( const QVariantMap &map );
};
class QgsProcessingParameterDuration : QgsProcessingParameterNumber
{
%Docstring(signature="appended")
A double numeric parameter for duration values.
The returned value will always be in milliseconds.
.. versionadded:: 3.22
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
explicit QgsProcessingParameterDuration( const QString &name, const QString &description = QString(),
const QVariant &defaultValue = QVariant(),
bool optional = false,
double minValue = -DBL_MAX + 1,
double maxValue = DBL_MAX );
%Docstring
Constructor for QgsProcessingParameterDuration.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDuration *clone() const /Factory/;
virtual QString type() const;
virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const;
Qgis::TemporalUnit defaultUnit() const;
%Docstring
Returns the default duration unit for the parameter.
.. seealso:: :py:func:`setDefaultUnit`
%End
void setDefaultUnit( Qgis::TemporalUnit unit );
%Docstring
Sets the default duration ``unit`` for the parameter.
.. seealso:: :py:func:`defaultUnit`
%End
virtual QVariantMap toVariantMap() const;
virtual bool fromVariantMap( const QVariantMap &map );
};
class QgsProcessingParameterScale : QgsProcessingParameterNumber
{
%Docstring(signature="appended")
A double numeric parameter for map scale values.
:py:class:`QgsProcessingParameterScale` should be evaluated by calling
:py:func:`QgsProcessingAlgorithm.parameterAsDouble()`, which will return
a numeric value representing the scale denominator.
.. versionadded:: 3.8
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
explicit QgsProcessingParameterScale( const QString &name, const QString &description = QString(),
const QVariant &defaultValue = QVariant(),
bool optional = false );
%Docstring
Constructor for QgsProcessingParameterScale.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterScale *clone() const /Factory/;
virtual QString type() const;
virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const;
static QgsProcessingParameterScale *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
};
class QgsProcessingParameterRange : QgsProcessingParameterDefinition
{
%Docstring(signature="appended")
A numeric range parameter for processing algorithms.
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterRange( const QString &name, const QString &description = QString(),
Qgis::ProcessingNumberParameterType type = Qgis::ProcessingNumberParameterType::Integer,
const QVariant &defaultValue = QVariant(),
bool optional = false );
%Docstring
Constructor for QgsProcessingParameterRange.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const;
Qgis::ProcessingNumberParameterType dataType() const;
%Docstring
Returns the acceptable data type for the range.
.. seealso:: :py:func:`setDataType`
%End
void setDataType( Qgis::ProcessingNumberParameterType dataType );
%Docstring
Sets the acceptable data ``type`` for the range.
.. seealso:: :py:func:`dataType`
%End
virtual QVariantMap toVariantMap() const;
virtual bool fromVariantMap( const QVariantMap &map );
static QgsProcessingParameterRange *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
};
class QgsProcessingParameterRasterLayer : QgsProcessingParameterDefinition, QgsFileFilterGenerator
{
%Docstring(signature="appended")
A raster layer parameter for processing algorithms.
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterRasterLayer( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
bool optional = false );
%Docstring
Constructor for QgsProcessingParameterRasterLayer.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok /Out/ ) const;
virtual QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString createFileFilter() const;
static QgsProcessingParameterRasterLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
};
class QgsProcessingParameterEnum : QgsProcessingParameterDefinition
{
%Docstring(signature="appended")
An enum based parameter for processing algorithms, allowing for
selection from predefined values.
Since QGIS 3.24 a list of icons corresponding to the enum values can be
specified by setting the widget wrapper metadata "icons" option, as
demonstrated below. The "icons" value should be set to a list of QIcon
values.
.. code-block:: python
param = QgsProcessingParameterEnum( 'FIELD_TYPE', 'Field type', ['Integer', 'String'])
param.setMetadata( {'widget_wrapper':
{ 'icons': [QIcon('integer.svg'), QIcon('string.svg')] }
})
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterEnum( const QString &name, const QString &description = QString(), const QStringList &options = QStringList(),
bool allowMultiple = false,
const QVariant &defaultValue = QVariant(),
bool optional = false,
bool usesStaticStrings = false );
%Docstring
Constructor for QgsProcessingParameterEnum.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString valueAsPythonComment( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString asScriptCode() const;
virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const;
QStringList options() const;
%Docstring
Returns the list of acceptable options for the parameter.
.. seealso:: :py:func:`setOptions`
%End
void setOptions( const QStringList &options );
%Docstring
Sets the list of acceptable ``options`` for the parameter.
.. seealso:: :py:func:`options`
%End
bool allowMultiple() const;
%Docstring
Returns ``True`` if the parameter allows multiple selected values.
.. seealso:: :py:func:`setAllowMultiple`
%End
void setAllowMultiple( bool allowMultiple );
%Docstring
Sets whether the parameter allows multiple selected values.
.. seealso:: :py:func:`allowMultiple`
%End
bool usesStaticStrings() const;
%Docstring
Returns ``True`` if the parameter uses static (non-translated) string
values for its enumeration choice list.
.. seealso:: :py:func:`setUsesStaticStrings`
.. versionadded:: 3.18
%End
void setUsesStaticStrings( bool usesStaticStrings );
%Docstring
Sets whether the parameter uses static (non-translated) string values
for its enumeration choice list.
.. seealso:: :py:func:`usesStaticStrings`
.. versionadded:: 3.18
%End
virtual QVariantMap toVariantMap() const;
virtual bool fromVariantMap( const QVariantMap &map );
static QgsProcessingParameterEnum *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
};
class QgsProcessingParameterString : QgsProcessingParameterDefinition
{
%Docstring(signature="appended")
A string parameter for processing algorithms.
A parameter type which allows users to enter any string value.
In some circumstances it is desirable to restrict the values available
when a user is asked to enter a string parameter to a list of
predetermined "valid" values. Since QGIS 3.22 this can be done by
setting the widget wrapper metadata "value_hints" option, as
demonstrated below. (While this provides a mechanism for guiding users
to select from valid string values when running a Processing algorithm
through the GUI, it does not place any limits on the string values
accepted via PyQGIS codes or when running the algorithm via other
non-gui means. Algorithms should gracefully handle other values
accordingly.)
.. code-block:: python
param = QgsProcessingParameterString( 'PRINTER_NAME', 'Printer name')
# show only printers which are available on the current system as options
# for the string input.
param.setMetadata( {'widget_wrapper':
{ 'value_hints': ['Inkjet printer', 'Laser printer'] }
})
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterString( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
bool multiLine = false,
bool optional = false );
%Docstring
Constructor for QgsProcessingParameterString.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString asScriptCode() const;
virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const;
bool multiLine() const;
%Docstring
Returns ``True`` if the parameter allows multiline strings.
.. seealso:: :py:func:`setMultiLine`
%End
void setMultiLine( bool multiLine );
%Docstring
Sets whether the parameter allows multiline strings.
.. seealso:: :py:func:`multiLine`
%End
virtual QVariantMap toVariantMap() const;
virtual bool fromVariantMap( const QVariantMap &map );
static QgsProcessingParameterString *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
};
class QgsProcessingParameterAuthConfig : QgsProcessingParameterDefinition
{
%Docstring(signature="appended")
A string parameter for authentication configuration ID values.
This parameter allows for users to select from available authentication
configurations, or create new authentication configurations as required.
:py:class:`QgsProcessingParameterAuthConfig` should be evaluated by
calling :py:func:`QgsProcessingAlgorithm.parameterAsString()`.
.. versionadded:: 3.6
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterAuthConfig( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
bool optional = false );
%Docstring
Constructor for QgsProcessingParameterAuthConfig.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString asScriptCode() const;
static QgsProcessingParameterAuthConfig *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
};
class QgsProcessingParameterExpression : QgsProcessingParameterDefinition
{
%Docstring(signature="appended")
An expression parameter for processing algorithms.
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterExpression( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
const QString &parentLayerParameterName = QString(),
bool optional = false, Qgis::ExpressionType type = Qgis::ExpressionType::Qgis );
%Docstring
Constructor for QgsProcessingParameterExpression.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
virtual QStringList dependsOnOtherParameters() const;
virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const;
QString parentLayerParameterName() const;
%Docstring
Returns the name of the parent layer parameter, or an empty string if
this is not set.
.. seealso:: :py:func:`setParentLayerParameterName`
%End
void setParentLayerParameterName( const QString &parentLayerParameterName );
%Docstring
Sets the name of the parent layer parameter. Use an empty string if this
is not required.
.. seealso:: :py:func:`parentLayerParameterName`
%End
Qgis::ExpressionType expressionType() const;
%Docstring
Returns the parameter's expression type.
.. seealso:: :py:func:`setExpressionType`
.. versionadded:: 3.32
%End
void setExpressionType( Qgis::ExpressionType type );
%Docstring
Sets the parameter's expression ``type``.
.. seealso:: :py:func:`expressionType`
.. versionadded:: 3.32
%End
virtual QVariantMap toVariantMap() const;
virtual bool fromVariantMap( const QVariantMap &map );
static QgsProcessingParameterExpression *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
};
class QgsProcessingParameterLimitedDataTypes
{
%Docstring(signature="appended")
Can be inherited by parameters which require limits to their acceptable
data types.
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterLimitedDataTypes( const QList< int > &types = QList< int >() );
%Docstring
Constructor for QgsProcessingParameterLimitedDataTypes, with a list of
acceptable data ``types``.
%End
QList< int > dataTypes() const;
%Docstring
Returns the geometry types for sources acceptable by the parameter.
.. seealso:: :py:func:`setDataTypes`
%End
void setDataTypes( const QList< int > &types );
%Docstring
Sets the geometry ``types`` for sources acceptable by the parameter.
.. seealso:: :py:func:`dataTypes`
%End
protected:
};
class QgsProcessingParameterVectorLayer : QgsProcessingParameterDefinition, QgsProcessingParameterLimitedDataTypes, QgsFileFilterGenerator
{
%Docstring(signature="appended")
A vector layer (with or without geometry) parameter for processing
algorithms.
Consider using the more versatile
:py:class:`QgsProcessingParameterFeatureSource` wherever possible.
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterVectorLayer( const QString &name,
const QString &description = QString(),
const QList< int > &types = QList< int >(),
const QVariant &defaultValue = QVariant(),
bool optional = false );
%Docstring
Constructor for QgsProcessingParameterVectorLayer.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok /Out/ ) const;
virtual QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const;
virtual QString createFileFilter() const;
virtual QVariantMap toVariantMap() const;
virtual bool fromVariantMap( const QVariantMap &map );
static QgsProcessingParameterVectorLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
};
class QgsProcessingParameterMeshLayer : QgsProcessingParameterDefinition, QgsFileFilterGenerator
{
%Docstring(signature="appended")
A mesh layer parameter for processing algorithms.
.. versionadded:: 3.6
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterMeshLayer( const QString &name,
const QString &description = QString(),
const QVariant &defaultValue = QVariant(),
bool optional = false );
%Docstring
Constructor for QgsProcessingParameterMeshLayer.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok /Out/ ) const;
virtual QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString createFileFilter() const;
static QgsProcessingParameterMeshLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
};
class QgsProcessingParameterMapLayer : QgsProcessingParameterDefinition, QgsProcessingParameterLimitedDataTypes, QgsFileFilterGenerator
{
%Docstring(signature="appended")
A map layer parameter for processing algorithms.
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterMapLayer( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
bool optional = false,
const QList< int > &types = QList< int >() );
%Docstring
Constructor for QgsProcessingParameterMapLayer.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok /Out/ ) const;
virtual QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString asScriptCode() const;
virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const;
virtual QString createFileFilter() const;
virtual QVariantMap toVariantMap() const;
virtual bool fromVariantMap( const QVariantMap &map );
static QgsProcessingParameterMapLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
};
class QgsProcessingParameterField : QgsProcessingParameterDefinition
{
%Docstring(signature="appended")
A vector layer or feature source field parameter for processing
algorithms.
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterField( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
const QString &parentLayerParameterName = QString(),
Qgis::ProcessingFieldParameterDataType type = Qgis::ProcessingFieldParameterDataType::Any,
bool allowMultiple = false,
bool optional = false,
bool defaultToAllFields = false );
%Docstring
Constructor for QgsProcessingParameterField.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString asScriptCode() const;
virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const;
virtual QStringList dependsOnOtherParameters() const;
QString parentLayerParameterName() const;
%Docstring
Returns the name of the parent layer parameter, or an empty string if
this is not set.
.. seealso:: :py:func:`setParentLayerParameterName`
%End
void setParentLayerParameterName( const QString &parentLayerParameterName );
%Docstring
Sets the name of the parent layer parameter. Use an empty string if this
is not required.
.. seealso:: :py:func:`parentLayerParameterName`
%End
Qgis::ProcessingFieldParameterDataType dataType() const;
%Docstring
Returns the acceptable data type for the field.
.. seealso:: :py:func:`setDataType`
%End
void setDataType( Qgis::ProcessingFieldParameterDataType type );
%Docstring
Sets the acceptable data ``type`` for the field.
.. seealso:: :py:func:`dataType`
%End
bool allowMultiple() const;
%Docstring
Returns whether multiple field selections are permitted.
.. seealso:: :py:func:`setAllowMultiple`
%End
void setAllowMultiple( bool allowMultiple );
%Docstring
Sets whether multiple field selections are permitted.
.. seealso:: :py:func:`allowMultiple`
%End
bool defaultToAllFields() const;
%Docstring
Returns whether a parameter which allows multiple selections (see
:py:func:`~QgsProcessingParameterField.allowMultiple`) should
automatically select all fields as the default value.
If ``True``, this will override any existing
:py:func:`~QgsProcessingParameterField.defaultValue` set on the
parameter.
.. seealso:: :py:func:`setDefaultToAllFields`
.. versionadded:: 3.12
%End
void setDefaultToAllFields( bool enabled );
%Docstring
Sets whether a parameter which allows multiple selections (see
:py:func:`~QgsProcessingParameterField.allowMultiple`) should
automatically select all fields as the default value.
If ``True``, this will override any existing
:py:func:`~QgsProcessingParameterField.defaultValue` set on the
parameter.
.. seealso:: :py:func:`defaultToAllFields`
.. versionadded:: 3.12
%End
virtual QVariantMap toVariantMap() const;
virtual bool fromVariantMap( const QVariantMap &map );
static QgsProcessingParameterField *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
};
class QgsProcessingParameterFeatureSource : QgsProcessingParameterDefinition, QgsProcessingParameterLimitedDataTypes, QgsFileFilterGenerator
{
%Docstring(signature="appended")
An input feature source (such as vector layers) parameter for processing
algorithms.
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterFeatureSource( const QString &name, const QString &description = QString(),
const QList< int > &types = QList< int >(),
const QVariant &defaultValue = QVariant(), bool optional = false );
%Docstring
Constructor for QgsProcessingParameterFeatureSource.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok /Out/ ) const;
virtual QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString asScriptCode() const;
virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const;
virtual QString createFileFilter() const;
virtual QVariantMap toVariantMap() const;
virtual bool fromVariantMap( const QVariantMap &map );
static QgsProcessingParameterFeatureSource *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
};
class QgsProcessingDestinationParameter : QgsProcessingParameterDefinition, QgsFileFilterGenerator
{
%Docstring(signature="appended")
Base class for all parameter definitions which represent file or layer
destinations, e.g. parameters which are used for the destination for
layers output by an algorithm.
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingDestinationParameter( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
bool optional = false, bool createByDefault = true );
%Docstring
Constructor for QgsProcessingDestinationParameter.
If ``createByDefault`` is ``False`` and the parameter is ``optional``,
then the destination output will not be created by default.
%End
virtual bool isDestination() const;
virtual QVariantMap toVariantMap() const;
virtual bool fromVariantMap( const QVariantMap &map );
virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const;
virtual QString createFileFilter() const;
virtual QgsProcessingOutputDefinition *toOutputDefinition() const = 0 /Factory/;
%Docstring
Returns a new :py:class:`QgsProcessingOutputDefinition` corresponding to
the definition of the destination parameter.
%End
bool supportsNonFileBasedOutput() const;
%Docstring
Returns ``True`` if the destination parameter supports non filed-based
outputs, such as memory layers or direct database outputs.
.. seealso:: :py:func:`setSupportsNonFileBasedOutput`
%End
void setSupportsNonFileBasedOutput( bool supportsNonFileBasedOutput );
%Docstring
Sets whether the destination parameter supports non filed-based outputs,
such as memory layers or direct database outputs.
.. seealso:: :py:func:`supportsNonFileBasedOutput`
%End
virtual QString defaultFileExtension() const = 0;
%Docstring
Returns the default file extension for destination file paths associated
with this parameter.
%End
virtual QString generateTemporaryDestination( const QgsProcessingContext *context = 0 ) const;
%Docstring
Generates a temporary destination value for this parameter. The returned
value will be a file path or QGIS data provider URI suitable for
temporary storage of created layers and files.
%End
virtual bool isSupportedOutputValue( const QVariant &value, QgsProcessingContext &context, QString &error /Out/ ) const;
%Docstring
Tests whether a ``value`` is a supported value for this parameter.
Will return ``False`` when a ``value`` with an unsupported file
extension is specified. The default implementation calls
:py:func:`QgsProcessingProvider.isSupportedOutputValue()` to test
compatibility.
:param value: value to test
:param context: Processing context
:return: - ``True`` if ``value`` is supported.
- error: a descriptive error string
.. versionadded:: 3.14
%End
bool createByDefault() const;
%Docstring
Returns ``True`` if the destination should be created by default. For
optional parameters, a return value of ``False`` indicates that the
destination should not be created by default.
.. seealso:: :py:func:`setCreateByDefault`
%End
void setCreateByDefault( bool createByDefault );
%Docstring
Sets whether the destination should be created by default. For optional
parameters, a value of ``False`` indicates that the destination should
not be created by default.
.. seealso:: :py:func:`createByDefault`
%End
protected:
QgsProcessingProvider *originalProvider() const;
%Docstring
Original (source) provider which this parameter has been derived from.
In the case of destination parameters which are part of model
algorithms, this will reflect the child algorithm's provider which
actually generates the parameter, as opposed to the provider which this
parameter belongs to (i.e. the model provider)
.. versionadded:: 3.2
%End
};
class QgsProcessingParameterFeatureSink : QgsProcessingDestinationParameter
{
%Docstring(signature="appended")
A feature sink output for processing algorithms.
A parameter which represents the destination feature sink for features
created by an algorithm.
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterFeatureSink( const QString &name, const QString &description = QString(), Qgis::ProcessingSourceType type = Qgis::ProcessingSourceType::VectorAnyGeometry, const QVariant &defaultValue = QVariant(),
bool optional = false, bool createByDefault = true, bool supportsAppend = false );
%Docstring
Constructor for QgsProcessingParameterFeatureSink.
If ``createByDefault`` is ``False`` and the parameter is ``optional``,
then this destination output will not be created by default.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString asScriptCode() const;
virtual QgsProcessingOutputDefinition *toOutputDefinition() const /Factory/;
virtual QString defaultFileExtension() const;
virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const;
virtual QString createFileFilter() const;
virtual QStringList supportedOutputVectorLayerExtensions() const;
%Docstring
Returns a list of the vector format file extensions supported by this
parameter.
.. seealso:: :py:func:`defaultFileExtension`
.. versionadded:: 3.2
%End
Qgis::ProcessingSourceType dataType() const;
%Docstring
Returns the layer type for sinks associated with the parameter.
.. seealso:: :py:func:`setDataType`
%End
bool hasGeometry() const;
%Docstring
Returns ``True`` if sink is likely to include geometries. In cases were
presence of geometry cannot be reliably determined in advance, this
method will default to returning ``True``.
%End
void setDataType( Qgis::ProcessingSourceType type );
%Docstring
Sets the layer ``type`` for the sinks associated with the parameter.
.. seealso:: :py:func:`dataType`
%End
bool supportsAppend() const;
%Docstring
Returns ``True`` if the sink supports appending features to an existing
table.
A sink only supports appending if the algorithm implements
:py:class:`QgsProcessingAlgorithm`.sinkProperties for the sink
parameter.
.. seealso:: :py:func:`setSupportsAppend`
.. versionadded:: 3.14
%End
void setSupportsAppend( bool supportsAppend );
%Docstring
Sets whether the sink supports appending features to an existing table.
.. warning::
A sink only supports appending if the algorithm implements :py:class:`QgsProcessingAlgorithm`.sinkProperties for the sink parameter.
.. seealso:: :py:func:`supportsAppend`
.. versionadded:: 3.14
%End
virtual QVariantMap toVariantMap() const;
virtual bool fromVariantMap( const QVariantMap &map );
virtual QString generateTemporaryDestination( const QgsProcessingContext *context = 0 ) const;
static QgsProcessingParameterFeatureSink *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
};
class QgsProcessingParameterVectorDestination : QgsProcessingDestinationParameter
{
%Docstring(signature="appended")
A vector layer destination parameter, for specifying the destination
path for a vector layer created by the algorithm.
.. note::
Consider using the more flexible :py:class:`QgsProcessingParameterFeatureSink` wherever
possible.
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterVectorDestination( const QString &name, const QString &description = QString(), Qgis::ProcessingSourceType type = Qgis::ProcessingSourceType::VectorAnyGeometry, const QVariant &defaultValue = QVariant(),
bool optional = false, bool createByDefault = true );
%Docstring
Constructor for QgsProcessingParameterVectorDestination.
If ``createByDefault`` is ``False`` and the parameter is ``optional``,
then this destination output will not be created by default.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString asScriptCode() const;
virtual QgsProcessingOutputDefinition *toOutputDefinition() const /Factory/;
virtual QString defaultFileExtension() const;
virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const;
virtual QString createFileFilter() const;
virtual QStringList supportedOutputVectorLayerExtensions() const;
%Docstring
Returns a list of the vector format file extensions supported by this
parameter.
.. seealso:: :py:func:`defaultFileExtension`
.. versionadded:: 3.2
%End
Qgis::ProcessingSourceType dataType() const;
%Docstring
Returns the layer type for this created vector layer.
.. seealso:: :py:func:`setDataType`
%End
bool hasGeometry() const;
%Docstring
Returns ``True`` if the created layer is likely to include geometries.
In cases were presence of geometry cannot be reliably determined in
advance, this method will default to returning ``True``.
%End
void setDataType( Qgis::ProcessingSourceType type );
%Docstring
Sets the layer ``type`` for the created vector layer.
.. seealso:: :py:func:`dataType`
%End
virtual QVariantMap toVariantMap() const;
virtual bool fromVariantMap( const QVariantMap &map );
static QgsProcessingParameterVectorDestination *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
};
class QgsProcessingParameterRasterDestination : QgsProcessingDestinationParameter
{
%Docstring(signature="appended")
A raster layer destination parameter, for specifying the destination
path for a raster layer created by the algorithm.
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterRasterDestination( const QString &name, const QString &description = QString(),
const QVariant &defaultValue = QVariant(),
bool optional = false,
bool createByDefault = true );
%Docstring
Constructor for QgsProcessingParameterRasterDestination.
If ``createByDefault`` is ``False`` and the parameter is ``optional``,
then this destination output will not be created by default.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
virtual QgsProcessingOutputDefinition *toOutputDefinition() const /Factory/;
virtual QString defaultFileExtension() const;
virtual QString createFileFilter() const;
virtual QStringList supportedOutputRasterLayerExtensions() const;
%Docstring
Returns a list of the raster format file extensions supported for this
parameter.
.. seealso:: :py:func:`defaultFileExtension`
.. versionadded:: 3.2
%End
static QgsProcessingParameterRasterDestination *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
};
class QgsProcessingParameterFileDestination : QgsProcessingDestinationParameter
{
%Docstring(signature="appended")
A generic file based destination parameter, for specifying the
destination path for a file (non-map layer) created by the algorithm.
In some circumstances it is desirable to avoid the usual file
overwriting confirmation prompt when users select an existing
destination file for this parameter type (e.g., for algorithms which
append to an existing destination file instead of overwriting them.).
This can be done by setting the widget wrapper metadata
"dontconfirmoverwrite" option:
.. code-block:: python
param = QgsProcessingParameterFileDestination( 'OUTPUT', 'Destination file')
# don't show the file overwrite warning when users select a destination file:
param.setMetadata( {'widget_wrapper':
{ 'dontconfirmoverwrite': True }
})
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterFileDestination( const QString &name, const QString &description = QString(),
const QString &fileFilter = QString(),
const QVariant &defaultValue = QVariant(),
bool optional = false,
bool createByDefault = true );
%Docstring
Constructor for QgsProcessingParameterFileDestination.
If ``createByDefault`` is ``False`` and the parameter is ``optional``,
then this destination output will not be created by default.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
virtual QgsProcessingOutputDefinition *toOutputDefinition() const /Factory/;
virtual QString defaultFileExtension() const;
virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const;
virtual QString createFileFilter() const;
QString fileFilter() const;
%Docstring
Returns the file filter string for file destinations compatible with
this parameter.
.. seealso:: :py:func:`setFileFilter`
%End
void setFileFilter( const QString &filter );
%Docstring
Sets the file ``filter`` string for file destinations compatible with
this parameter.
.. seealso:: :py:func:`fileFilter`
%End
virtual QVariantMap toVariantMap() const;
virtual bool fromVariantMap( const QVariantMap &map );
static QgsProcessingParameterFileDestination *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
};
class QgsProcessingParameterFolderDestination : QgsProcessingDestinationParameter
{
%Docstring(signature="appended")
A folder destination parameter, for specifying the destination path for
a folder created by the algorithm or used for creating new files within
the algorithm.
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterFolderDestination( const QString &name, const QString &description = QString(),
const QVariant &defaultValue = QVariant(),
bool optional = false,
bool createByDefault = true );
%Docstring
Constructor for QgsProcessingParameterFolderDestination.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
virtual QgsProcessingOutputDefinition *toOutputDefinition() const /Factory/;
virtual QString defaultFileExtension() const;
static QgsProcessingParameterFolderDestination *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
};
class QgsProcessingParameterBand : QgsProcessingParameterDefinition
{
%Docstring(signature="appended")
A raster band parameter for Processing algorithms.
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterBand( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
const QString &parentLayerParameterName = QString(),
bool optional = false,
bool allowMultiple = false );
%Docstring
Constructor for QgsProcessingParameterBand.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString asScriptCode() const;
virtual QStringList dependsOnOtherParameters() const;
virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const;
QString parentLayerParameterName() const;
%Docstring
Returns the name of the parent layer parameter, or an empty string if
this is not set.
.. seealso:: :py:func:`setParentLayerParameterName`
%End
void setParentLayerParameterName( const QString &parentLayerParameterName );
%Docstring
Sets the name of the parent layer parameter. Use an empty string if this
is not required.
.. seealso:: :py:func:`parentLayerParameterName`
%End
virtual QVariantMap toVariantMap() const;
virtual bool fromVariantMap( const QVariantMap &map );
static QgsProcessingParameterBand *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
bool allowMultiple() const;
%Docstring
Returns whether multiple band selections are permitted.
.. seealso:: :py:func:`setAllowMultiple`
.. versionadded:: 3.4
%End
void setAllowMultiple( bool allowMultiple );
%Docstring
Sets whether multiple band selections are permitted.
.. seealso:: :py:func:`allowMultiple`
.. versionadded:: 3.4
%End
};
class QgsProcessingParameterLayout : QgsProcessingParameterDefinition
{
%Docstring(signature="appended")
A print layout parameter, allowing users to select a print layout.
:py:class:`QgsProcessingParameterLayout` should be evaluated by calling
:py:func:`QgsProcessingAlgorithm.parameterAsLayout()`. This will return
the matching layout from the context's current project. Alternatively,
calling :py:func:`QgsProcessingAlgorithm.parameterAsString()` will
return the name of the target print layout.
.. versionadded:: 3.8
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterLayout( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
bool optional = false );
%Docstring
Constructor for QgsProcessingParameterLayout.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString asScriptCode() const;
virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const;
static QgsProcessingParameterLayout *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
};
class QgsProcessingParameterLayoutItem : QgsProcessingParameterDefinition
{
%Docstring(signature="appended")
A print layout item parameter, allowing users to select a particular
item from a print layout.
:py:class:`QgsProcessingParameterLayoutItem` should be evaluated by
calling :py:func:`QgsProcessingAlgorithm.parameterAsLayoutItem()`.
Internally, :py:class:`QgsProcessingParameterLayoutItems` are string
parameters, storing references to items either by their UUID
(:py:func:`QgsLayoutItem.uuid()`) or ID (:py:func:`QgsLayoutItem.id()`).
.. versionadded:: 3.8
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterLayoutItem( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
const QString &parentLayoutParameterName = QString(),
int itemType = -1,
bool optional = false );
%Docstring
Constructor for QgsProcessingParameterLayoutItem.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString asScriptCode() const;
virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const;
virtual QVariantMap toVariantMap() const;
virtual bool fromVariantMap( const QVariantMap &map );
virtual QStringList dependsOnOtherParameters() const;
static QgsProcessingParameterLayoutItem *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
QString parentLayoutParameterName() const;
%Docstring
Returns the name of the parent layout parameter, or an empty string if
this is not set.
.. seealso:: :py:func:`setParentLayoutParameterName`
%End
void setParentLayoutParameterName( const QString &name );
%Docstring
Sets the ``name`` of the parent layout parameter. Use an empty string if
this is not required.
.. seealso:: :py:func:`parentLayoutParameterName`
%End
int itemType() const;
%Docstring
Returns the acceptable item type, or -1 if any item type is allowed.
These values correspond to the registered item types from
:py:class:`QgsLayoutItemRegistry`.
.. seealso:: :py:func:`setItemType`
%End
void setItemType( int type );
%Docstring
Sets the acceptable item ``type``, or -1 if any item type is allowed.
These values correspond to the registered item types from
:py:class:`QgsLayoutItemRegistry`.
.. seealso:: :py:func:`itemType`
%End
};
class QgsProcessingParameterColor : QgsProcessingParameterDefinition
{
%Docstring(signature="appended")
A color parameter for processing algorithms.
:py:class:`QgsProcessingParameterColor` should be evaluated by calling
:py:func:`QgsProcessingAlgorithm.parameterAsColor()`.
.. versionadded:: 3.10
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterColor( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
bool opacityEnabled = true,
bool optional = false );
%Docstring
Constructor for QgsProcessingParameterColor.
If ``opacityEnabled`` is ``True``, then users will have the option of
varying color opacity.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString asScriptCode() const;
virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
virtual QVariantMap toVariantMap() const;
virtual bool fromVariantMap( const QVariantMap &map );
bool opacityEnabled() const;
%Docstring
Returns ``True`` if the parameter allows opacity control.
The default behavior is to allow users to set opacity for the color.
.. seealso:: :py:func:`setOpacityEnabled`
%End
void setOpacityEnabled( bool enabled );
%Docstring
Sets whether the parameter allows opacity control.
The default behavior is to allow users to set opacity for the color.
.. seealso:: :py:func:`opacityEnabled`
%End
static QgsProcessingParameterColor *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
};
class QgsProcessingParameterCoordinateOperation : QgsProcessingParameterDefinition
{
%Docstring(signature="appended")
A coordinate operation parameter for processing algorithms.
This parameter allows selection between available coordinate operations
to use when projecting between a source and destination coordinate
reference system.
:py:class:`QgsProcessingParameterCoordinateOperation` should be
evaluated by calling
:py:func:`QgsProcessingAlgorithm.parameterAsString()`.
.. versionadded:: 3.12
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterCoordinateOperation( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
const QString &sourceCrsParameterName = QString(), const QString &destinationCrsParameterName = QString(),
const QVariant &staticSourceCrs = QVariant(), const QVariant &staticDestinationCrs = QVariant(),
bool optional = false );
%Docstring
Constructor for QgsProcessingParameterCoordinateOperation.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString asScriptCode() const;
virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const;
virtual QStringList dependsOnOtherParameters() const;
virtual QVariantMap toVariantMap() const;
virtual bool fromVariantMap( const QVariantMap &map );
static QgsProcessingParameterCoordinateOperation *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
QString sourceCrsParameterName() const;
%Docstring
Returns the name of the source CRS parameter, or an empty string if this
is not set.
.. seealso:: :py:func:`setSourceCrsParameterName`
.. seealso:: :py:func:`destinationCrsParameterName`
%End
void setSourceCrsParameterName( const QString &name );
%Docstring
Sets the ``name`` of the source CRS parameter. Use an empty string if
this is not required.
.. seealso:: :py:func:`sourceCrsParameterName`
.. seealso:: :py:func:`setDestinationCrsParameterName`
%End
QString destinationCrsParameterName() const;
%Docstring
Returns the name of the destination CRS parameter, or an empty string if
this is not set.
.. seealso:: :py:func:`setDestinationCrsParameterName`
.. seealso:: :py:func:`sourceCrsParameterName`
%End
void setDestinationCrsParameterName( const QString &name );
%Docstring
Sets the ``name`` of the destination CRS parameter. Use an empty string
if this is not required.
.. seealso:: :py:func:`destinationCrsParameterName`
.. seealso:: :py:func:`setSourceCrsParameterName`
%End
QVariant sourceCrs() const;
%Docstring
Returns the static source CRS, or an invalid value if this is not set.
.. seealso:: :py:func:`setSourceCrs`
.. seealso:: :py:func:`destinationCrs`
%End
void setSourceCrs( const QVariant &crs );
%Docstring
Sets the static source ``crs``.
.. seealso:: :py:func:`sourceCrs`
.. seealso:: :py:func:`setDestinationCrs`
%End
QVariant destinationCrs() const;
%Docstring
Returns the static destination CRS, or an invalid value if this is not
set.
.. seealso:: :py:func:`setDestinationCrs`
.. seealso:: :py:func:`sourceCrs`
%End
void setDestinationCrs( const QVariant &crs );
%Docstring
Sets the static destination ``crs``.
.. seealso:: :py:func:`destinationCrs`
.. seealso:: :py:func:`setSourceCrs`
%End
};
class QgsProcessingParameterMapTheme : QgsProcessingParameterDefinition
{
%Docstring(signature="appended")
A map theme parameter for processing algorithms, allowing users to
select an existing map theme from a project.
:py:class:`QgsProcessingParameterMapTheme` should be evaluated by
calling :py:func:`QgsProcessingAlgorithm.parameterAsString()`.
.. versionadded:: 3.12
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterMapTheme( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
bool optional = false );
%Docstring
Constructor for QgsProcessingParameterMapTheme.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString asScriptCode() const;
virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const;
virtual QVariantMap toVariantMap() const;
virtual bool fromVariantMap( const QVariantMap &map );
static QgsProcessingParameterMapTheme *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
};
class QgsProcessingParameterDateTime : QgsProcessingParameterDefinition
{
%Docstring(signature="appended")
A datetime (or pure date or time) parameter for processing algorithms.
:py:class:`QgsProcessingParameterDateTime` should be evaluated by
calling :py:func:`QgsProcessingAlgorithm.parameterAsDateTime()`, which
will return a date time value.
.. versionadded:: 3.14
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
explicit QgsProcessingParameterDateTime( const QString &name, const QString &description = QString(),
Qgis::ProcessingDateTimeParameterDataType type = Qgis::ProcessingDateTimeParameterDataType::DateTime,
const QVariant &defaultValue = QVariant(),
bool optional = false,
const QDateTime &minValue = QDateTime(),
const QDateTime &maxValue = QDateTime()
);
%Docstring
Constructor for QgsProcessingParameterDateTime.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString toolTip() const;
virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const;
QDateTime minimum() const;
%Docstring
Returns the minimum value acceptable by the parameter.
An invalid QDateTime value indicates no minimum value.
.. seealso:: :py:func:`setMinimum`
%End
void setMinimum( const QDateTime &minimum );
%Docstring
Sets the ``minimum`` value acceptable by the parameter.
An invalid QDateTime value indicates no minimum value.
If the :py:func:`~QgsProcessingParameterDateTime.dataType` is
QgsProcessingParameterDateTime.Time, then the date component of
``minimum`` must be set to any valid date (but this date will not
actually be considered when comparing parameter values to the specified
minimum value, only the time component will be considered).
.. seealso:: :py:func:`minimum`
%End
QDateTime maximum() const;
%Docstring
Returns the maximum value acceptable by the parameter.
An invalid QDateTime value indicates no maximum value.
.. seealso:: :py:func:`setMaximum`
%End
void setMaximum( const QDateTime &maximum );
%Docstring
Sets the ``maximum`` value acceptable by the parameter.
An invalid QDateTime value indicates no maximum value.
If the :py:func:`~QgsProcessingParameterDateTime.dataType` is
QgsProcessingParameterDateTime.Time, then the date component of
``maximum`` must be set to any valid date (but this date will not
actually be considered when comparing parameter values to the specified
maximum value, only the time component will be considered).
.. seealso:: :py:func:`maximum`
%End
Qgis::ProcessingDateTimeParameterDataType dataType() const;
%Docstring
Returns the acceptable data type for the parameter.
.. seealso:: :py:func:`setDataType`
%End
void setDataType( Qgis::ProcessingDateTimeParameterDataType type );
%Docstring
Sets the acceptable data ``type`` for the parameter.
.. seealso:: :py:func:`dataType`
%End
virtual QVariantMap toVariantMap() const;
virtual bool fromVariantMap( const QVariantMap &map );
static QgsProcessingParameterDateTime *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
};
class QgsProcessingParameterProviderConnection : QgsProcessingParameterDefinition
{
%Docstring(signature="appended")
A data provider connection parameter for processing algorithms, allowing
users to select from available registered connections for a particular
data provider.
:py:class:`QgsProcessingParameterProviderConnection` should be evaluated
by calling
:py:func:`QgsProcessingAlgorithm.parameterAsConnectionName()`.
.. versionadded:: 3.14
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterProviderConnection( const QString &name, const QString &description, const QString &provider, const QVariant &defaultValue = QVariant(),
bool optional = false );
%Docstring
Constructor for QgsProcessingParameterProviderConnection, for the
specified ``provider`` type.
.. warning::
The provider must support the connection API methods in its :py:class:`QgsProviderMetadata` implementation
in order for the model to work correctly. This is only implemented for a subset of current data providers.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString asScriptCode() const;
virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const;
virtual QVariantMap toVariantMap() const;
virtual bool fromVariantMap( const QVariantMap &map );
QString providerId() const;
%Docstring
Returns the ID of the provider associated with the connections.
.. seealso:: :py:func:`setProviderId`
%End
void setProviderId( const QString &provider );
%Docstring
Sets the ID of the ``provider`` associated with the connections.
.. seealso:: :py:func:`providerId`
%End
static QgsProcessingParameterProviderConnection *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
};
class QgsProcessingParameterDatabaseSchema : QgsProcessingParameterDefinition
{
%Docstring(signature="appended")
A database schema parameter for processing algorithms, allowing users to
select from existing schemas on a registered database connection.
:py:class:`QgsProcessingParameterDatabaseSchema` should be evaluated by
calling :py:func:`QgsProcessingAlgorithm.parameterAsSchema()`.
.. versionadded:: 3.14
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterDatabaseSchema( const QString &name, const QString &description, const QString &connectionParameterName = QString(), const QVariant &defaultValue = QVariant(),
bool optional = false );
%Docstring
Constructor for QgsProcessingParameterDatabaseSchema.
The ``connectionParameterName`` specifies the name of the parent
:py:class:`QgsProcessingParameterProviderConnection` parameter.
.. warning::
The provider must support the connection API methods in its :py:class:`QgsProviderMetadata` implementation
in order for the model to work correctly. This is only implemented for a subset of current data providers.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString asScriptCode() const;
virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const;
virtual QVariantMap toVariantMap() const;
virtual bool fromVariantMap( const QVariantMap &map );
virtual QStringList dependsOnOtherParameters() const;
QString parentConnectionParameterName() const;
%Docstring
Returns the name of the parent connection parameter, or an empty string
if this is not set.
.. seealso:: :py:func:`setParentConnectionParameterName`
%End
void setParentConnectionParameterName( const QString &name );
%Docstring
Sets the ``name`` of the parent connection parameter. Use an empty
string if this is not required.
.. seealso:: :py:func:`parentConnectionParameterName`
%End
static QgsProcessingParameterDatabaseSchema *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
};
class QgsProcessingParameterDatabaseTable : QgsProcessingParameterDefinition
{
%Docstring(signature="appended")
A database table name parameter for processing algorithms.
This parameter allows users to select from existing database tables on a
registered database connection (or optionally to enter a new table
name).
:py:class:`QgsProcessingParameterDatabaseTable` should be evaluated by
calling
:py:func:`QgsProcessingAlgorithm.parameterAsDatabaseTableName()`.
.. versionadded:: 3.14
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterDatabaseTable( const QString &name, const QString &description,
const QString &connectionParameterName = QString(),
const QString &schemaParameterName = QString(),
const QVariant &defaultValue = QVariant(),
bool optional = false,
bool allowNewTableNames = false );
%Docstring
Constructor for QgsProcessingParameterDatabaseTable.
The ``connectionParameterName`` specifies the name of the parent
:py:class:`QgsProcessingParameterProviderConnection` parameter. The
``schemaParameterName`` specifies the name of the parent
:py:class:`QgsProcessingParameterDatabaseSchema` parameter.
.. warning::
The provider must support the connection API methods in its :py:class:`QgsProviderMetadata` implementation
in order for the model to work correctly. This is only implemented for a subset of current data providers.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString asScriptCode() const;
virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const;
virtual QVariantMap toVariantMap() const;
virtual bool fromVariantMap( const QVariantMap &map );
virtual QStringList dependsOnOtherParameters() const;
QString parentConnectionParameterName() const;
%Docstring
Returns the name of the parent connection parameter, or an empty string
if this is not set.
.. seealso:: :py:func:`setParentConnectionParameterName`
%End
void setParentConnectionParameterName( const QString &name );
%Docstring
Sets the ``name`` of the parent connection parameter. Use an empty
string if this is not required.
.. seealso:: :py:func:`parentConnectionParameterName`
%End
QString parentSchemaParameterName() const;
%Docstring
Returns the name of the parent schema parameter, or an empty string if
this is not set.
.. seealso:: :py:func:`setParentSchemaParameterName`
%End
void setParentSchemaParameterName( const QString &name );
%Docstring
Sets the ``name`` of the parent schema parameter. Use an empty string if
this is not required.
.. seealso:: :py:func:`parentSchemaParameterName`
%End
static QgsProcessingParameterDatabaseTable *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
bool allowNewTableNames() const;
%Docstring
Returns ``True`` if the parameter allows users to enter names for a new
(non-existing) tables.
.. seealso:: :py:func:`setAllowNewTableNames`
%End
void setAllowNewTableNames( bool allowed );
%Docstring
Sets whether the parameter allows users to enter names for a new
(non-existing) tables.
.. seealso:: :py:func:`allowNewTableNames`
%End
};
class QgsProcessingParameterPointCloudLayer : QgsProcessingParameterDefinition, QgsFileFilterGenerator
{
%Docstring(signature="appended")
A point cloud layer parameter for processing algorithms.
.. versionadded:: 3.22
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterPointCloudLayer( const QString &name, const QString &description = QString(),
const QVariant &defaultValue = QVariant(), bool optional = false );
%Docstring
Constructor for QgsProcessingParameterPointCloudLayer.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok /Out/ ) const;
virtual QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString createFileFilter() const;
static QgsProcessingParameterPointCloudLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
};
class QgsProcessingParameterAnnotationLayer : QgsProcessingParameterDefinition
{
%Docstring(signature="appended")
An annotation layer parameter for processing algorithms.
.. versionadded:: 3.22
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterAnnotationLayer( const QString &name, const QString &description = QString(),
const QVariant &defaultValue = QVariant(), bool optional = false );
%Docstring
Constructor for QgsProcessingParameterAnnotationLayer.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok /Out/ ) const;
virtual QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const;
static QgsProcessingParameterAnnotationLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
};
class QgsProcessingParameterPointCloudDestination : QgsProcessingDestinationParameter
{
%Docstring(signature="appended")
A point cloud layer destination parameter, for specifying the
destination path for a point cloud layer created by the algorithm.
.. versionadded:: 3.24
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterPointCloudDestination( const QString &name, const QString &description = QString(),
const QVariant &defaultValue = QVariant(),
bool optional = false,
bool createByDefault = true );
%Docstring
Constructor for QgsProcessingParameterPointCloudDestination.
If ``createByDefault`` is ``False`` and the parameter is ``optional``,
then this destination output will not be created by default.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
virtual QgsProcessingOutputDefinition *toOutputDefinition() const /Factory/;
virtual QString defaultFileExtension() const;
virtual QString createFileFilter() const;
virtual QStringList supportedOutputPointCloudLayerExtensions() const;
%Docstring
Returns a list of the point cloud format file extensions supported for
this parameter.
.. seealso:: :py:func:`defaultFileExtension`
%End
static QgsProcessingParameterPointCloudDestination *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
};
class QgsProcessingParameterPointCloudAttribute : QgsProcessingParameterDefinition
{
%Docstring(signature="appended")
A point cloud layer attribute parameter for Processing algorithms.
.. versionadded:: 3.32
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterPointCloudAttribute( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
const QString &parentLayerParameterName = QString(),
bool allowMultiple = false,
bool optional = false,
bool defaultToAllAttributes = false );
%Docstring
Constructor for :py:class:`QgsProcessingParameterField`.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
virtual QString asScriptCode() const;
virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const;
virtual QStringList dependsOnOtherParameters() const;
QString parentLayerParameterName() const;
%Docstring
Returns the name of the parent layer parameter, or an empty string if
this is not set.
.. seealso:: :py:func:`setParentLayerParameterName`
%End
void setParentLayerParameterName( const QString &parentLayerParameterName );
%Docstring
Sets the name of the parent layer parameter. Use an empty string if this
is not required.
.. seealso:: :py:func:`parentLayerParameterName`
%End
bool allowMultiple() const;
%Docstring
Returns whether multiple field selections are permitted.
.. seealso:: :py:func:`setAllowMultiple`
%End
void setAllowMultiple( bool allowMultiple );
%Docstring
Sets whether multiple field selections are permitted.
.. seealso:: :py:func:`allowMultiple`
%End
bool defaultToAllAttributes() const;
%Docstring
Returns whether a parameter which allows multiple selections (see
:py:func:`~QgsProcessingParameterPointCloudAttribute.allowMultiple`)
should automatically select all attributes as the default value.
If ``True``, this will override any existing
:py:func:`~QgsProcessingParameterPointCloudAttribute.defaultValue` set
on the parameter.
.. seealso:: :py:func:`setDefaultToAllAttributes`
%End
void setDefaultToAllAttributes( bool enabled );
%Docstring
Sets whether a parameter which allows multiple selections (see
:py:func:`~QgsProcessingParameterPointCloudAttribute.allowMultiple`)
should automatically select all attributes as the default value.
If ``True``, this will override any existing
:py:func:`~QgsProcessingParameterPointCloudAttribute.defaultValue` set
on the parameter.
.. seealso:: :py:func:`defaultToAllAttributes`
%End
virtual QVariantMap toVariantMap() const;
virtual bool fromVariantMap( const QVariantMap &map );
static QgsProcessingParameterPointCloudAttribute *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
};
class QgsProcessingParameterVectorTileDestination : QgsProcessingDestinationParameter
{
%Docstring(signature="appended")
A vector tile layer destination parameter, for specifying the
destination path for a vector tile layer created by the algorithm.
.. versionadded:: 3.32
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingParameterVectorTileDestination( const QString &name, const QString &description = QString(),
const QVariant &defaultValue = QVariant(),
bool optional = false,
bool createByDefault = true );
%Docstring
Constructor for QgsProcessingParameterVectorTileDestination.
If ``createByDefault`` is ``False`` and the parameter is ``optional``,
then this destination output will not be created by default.
%End
static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
virtual QgsProcessingOutputDefinition *toOutputDefinition() const /Factory/;
virtual QString defaultFileExtension() const;
virtual QString createFileFilter() const;
virtual QStringList supportedOutputVectorTileLayerExtensions() const;
%Docstring
Returns a list of the point cloud format file extensions supported for
this parameter.
.. seealso:: :py:func:`defaultFileExtension`
%End
static QgsProcessingParameterVectorTileDestination *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring
Creates a new parameter using the definition from a script code.
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/processing/qgsprocessingparameters.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/