mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-10 00:13:55 -04:00
This somewhat changes the meaning of outputs from processing 2.x. In 2.x processing outputs were used both as a method of specifying inputs to algorithms (file paths to destination layers created by the algorithm) AND pure outputs (such as statistics calculated by the algorithm). This is now split. The old input-type-outputs (destination layers) are now input parameters (since the parameter value IS an input to the algorithm). To differentiate them from parameters indicating pure input layers a new "isDestination()" method was added to QgsProcessingParameterDefinition. Output definitions are now purely indications of values CREATED by the algorithms. Suitable candidates are the existing calculated stats and actual file path/URI of any layers created by the algorithm. Moving forward we should ensure all algorithms output as much useful information as possible - e.g. number of features processed, number of skipped features, count null geometries encountered, etc...
344 lines
12 KiB
Plaintext
344 lines
12 KiB
Plaintext
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/processing/qgsprocessingalgorithm.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
class QgsProcessingAlgorithm
|
|
{
|
|
%Docstring
|
|
Abstract base class for processing algorithms.
|
|
.. versionadded:: 3.0
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgsprocessingalgorithm.h"
|
|
%End
|
|
public:
|
|
|
|
enum Flag
|
|
{
|
|
FlagHideFromToolbox,
|
|
FlagHideFromModeler,
|
|
FlagSupportsBatch,
|
|
FlagDeprecated,
|
|
};
|
|
typedef QFlags<QgsProcessingAlgorithm::Flag> Flags;
|
|
|
|
|
|
QgsProcessingAlgorithm();
|
|
%Docstring
|
|
Constructor for QgsProcessingAlgorithm.
|
|
%End
|
|
|
|
virtual ~QgsProcessingAlgorithm();
|
|
|
|
|
|
virtual QString name() const = 0;
|
|
%Docstring
|
|
Returns the algorithm name, used for identifying the algorithm. This string
|
|
should be fixed for the algorithm, and must not be localised. The name should
|
|
be unique within each provider. Names should contain lowercase alphanumeric characters
|
|
only and no spaces or other formatting characters.
|
|
.. seealso:: displayName()
|
|
.. seealso:: group()
|
|
.. seealso:: tags()
|
|
:rtype: str
|
|
%End
|
|
|
|
QString id() const;
|
|
%Docstring
|
|
Returns the unique ID for the algorithm, which is a combination of the algorithm
|
|
provider's ID and the algorithms unique name (e.g. "qgis:mergelayers" ).
|
|
.. seealso:: name()
|
|
.. seealso:: provider()
|
|
:rtype: str
|
|
%End
|
|
|
|
virtual QString displayName() const = 0;
|
|
%Docstring
|
|
Returns the translated algorithm name, which should be used for any user-visible display
|
|
of the algorithm name.
|
|
.. seealso:: name()
|
|
:rtype: str
|
|
%End
|
|
|
|
virtual QStringList tags() const;
|
|
%Docstring
|
|
Returns a list of tags which relate to the algorithm, and are used to assist users in searching
|
|
for suitable algorithms. These tags should be localised.
|
|
:rtype: list of str
|
|
%End
|
|
|
|
virtual QIcon icon() const;
|
|
%Docstring
|
|
Returns an icon for the algorithm.
|
|
.. seealso:: svgIconPath()
|
|
:rtype: QIcon
|
|
%End
|
|
|
|
virtual QString svgIconPath() const;
|
|
%Docstring
|
|
Returns a path to an SVG version of the algorithm's icon.
|
|
.. seealso:: icon()
|
|
:rtype: str
|
|
%End
|
|
|
|
virtual QString group() const;
|
|
%Docstring
|
|
Returns the name of the group this algorithm belongs to. This string
|
|
should be localised.
|
|
.. seealso:: tags()
|
|
:rtype: str
|
|
%End
|
|
|
|
virtual Flags flags() const;
|
|
%Docstring
|
|
Returns the flags indicating how and when the algorithm operates and should be exposed to users.
|
|
:rtype: Flags
|
|
%End
|
|
|
|
virtual bool canExecute( QString *errorMessage /Out/ = 0 ) const;
|
|
%Docstring
|
|
Returns true if the algorithm can execute. Algorithm subclasses can return false
|
|
here to indicate that they are not able to execute, e.g. as a result of unmet
|
|
external dependencies. If specified, the ``errorMessage`` argument will be filled
|
|
with a localised error message describing why the algorithm cannot execute.
|
|
:rtype: bool
|
|
%End
|
|
|
|
QgsProcessingProvider *provider() const;
|
|
%Docstring
|
|
Returns the provider to which this algorithm belongs.
|
|
:rtype: QgsProcessingProvider
|
|
%End
|
|
|
|
QgsProcessingParameterDefinitions parameterDefinitions() const;
|
|
%Docstring
|
|
Returns an ordered list of parameter definitions utilized by the algorithm.
|
|
.. seealso:: addParameter()
|
|
.. seealso:: parameterDefinition()
|
|
.. seealso:: destinationParameterDefinitions()
|
|
:rtype: QgsProcessingParameterDefinitions
|
|
%End
|
|
|
|
const QgsProcessingParameterDefinition *parameterDefinition( const QString &name ) const;
|
|
%Docstring
|
|
Returns a matching parameter by ``name``. Matching is done in a case-insensitive
|
|
manner.
|
|
.. seealso:: parameterDefinitions()
|
|
:rtype: QgsProcessingParameterDefinition
|
|
%End
|
|
|
|
int countVisibleParameters() const;
|
|
%Docstring
|
|
Returns the number of visible (non-hidden) parameters defined by this
|
|
algorithm.
|
|
:rtype: int
|
|
%End
|
|
|
|
QgsProcessingParameterDefinitions destinationParameterDefinitions() const;
|
|
%Docstring
|
|
Returns a list of destination parameters definitions utilized by the algorithm.
|
|
.. seealso:: QgsProcessingParameterDefinition.isDestination()
|
|
.. seealso:: parameterDefinitions()
|
|
:rtype: QgsProcessingParameterDefinitions
|
|
%End
|
|
|
|
QgsProcessingOutputDefinitions outputDefinitions() const;
|
|
%Docstring
|
|
Returns an ordered list of output definitions utilized by the algorithm.
|
|
.. seealso:: addOutput()
|
|
.. seealso:: outputDefinition()
|
|
:rtype: QgsProcessingOutputDefinitions
|
|
%End
|
|
|
|
const QgsProcessingOutputDefinition *outputDefinition( const QString &name ) const;
|
|
%Docstring
|
|
Returns a matching output by ``name``. Matching is done in a case-insensitive
|
|
manner.
|
|
.. seealso:: outputDefinitions()
|
|
:rtype: QgsProcessingOutputDefinition
|
|
%End
|
|
|
|
virtual QVariantMap run( const QVariantMap ¶meters,
|
|
QgsProcessingContext &context, QgsProcessingFeedback *feedback ) const;
|
|
%Docstring
|
|
Runs the algorithm using the specified ``parameters``. Algorithms should implement
|
|
their custom processing logic here.
|
|
|
|
The ``context`` argument specifies the context in which the algorithm is being run.
|
|
|
|
Algorithm progress should be reported using the supplied ``feedback`` object. Additionally,
|
|
well-behaved algorithms should periodically check ``feedback`` to determine whether the
|
|
algorithm should be canceled and exited early.
|
|
|
|
:return: A map of algorithm outputs. These may be output layer references, or calculated
|
|
values such as statistical calculations.
|
|
:rtype: QVariantMap
|
|
%End
|
|
|
|
protected:
|
|
|
|
bool addParameter( QgsProcessingParameterDefinition *parameterDefinition /Transfer/ );
|
|
%Docstring
|
|
Adds a parameter ``definition`` to the algorithm. Ownership of the definition is transferred to the algorithm.
|
|
Returns true if parameter could be successfully added, or false if the parameter could not be added (e.g.
|
|
as a result of a duplicate name).
|
|
.. seealso:: addOutput()
|
|
:rtype: bool
|
|
%End
|
|
|
|
bool addOutput( QgsProcessingOutputDefinition *outputDefinition /Transfer/ );
|
|
%Docstring
|
|
Adds an output ``definition`` to the algorithm. Ownership of the definition is transferred to the algorithm.
|
|
Returns true if the output could be successfully added, or false if the output could not be added (e.g.
|
|
as a result of a duplicate name).
|
|
.. seealso:: addParameter()
|
|
:rtype: bool
|
|
%End
|
|
|
|
QString parameterAsString( const QVariantMap ¶meters, const QString &name, const QgsProcessingContext &context ) const;
|
|
%Docstring
|
|
Evaluates the parameter with matching ``name`` to a static string value.
|
|
:rtype: str
|
|
%End
|
|
|
|
QString parameterAsExpression( const QVariantMap ¶meters, const QString &name, const QgsProcessingContext &context ) const;
|
|
%Docstring
|
|
Evaluates the parameter with matching ``name`` to an expression.
|
|
:rtype: str
|
|
%End
|
|
|
|
double parameterAsDouble( const QVariantMap ¶meters, const QString &name, const QgsProcessingContext &context ) const;
|
|
%Docstring
|
|
Evaluates the parameter with matching ``name`` to a static double value.
|
|
:rtype: float
|
|
%End
|
|
|
|
int parameterAsInt( const QVariantMap ¶meters, const QString &name, const QgsProcessingContext &context ) const;
|
|
%Docstring
|
|
Evaluates the parameter with matching ``name`` to a static integer value.
|
|
:rtype: int
|
|
%End
|
|
|
|
int parameterAsEnum( const QVariantMap ¶meters, const QString &name, const QgsProcessingContext &context ) const;
|
|
%Docstring
|
|
Evaluates the parameter with matching ``name`` to a enum value.
|
|
:rtype: int
|
|
%End
|
|
|
|
QList<int> parameterAsEnums( const QVariantMap ¶meters, const QString &name, const QgsProcessingContext &context ) const;
|
|
%Docstring
|
|
Evaluates the parameter with matching ``name`` to list of enum values.
|
|
:rtype: list of int
|
|
%End
|
|
|
|
bool parameterAsBool( const QVariantMap ¶meters, const QString &name, const QgsProcessingContext &context ) const;
|
|
%Docstring
|
|
Evaluates the parameter with matching ``name`` to a static boolean value.
|
|
:rtype: bool
|
|
%End
|
|
|
|
QgsMapLayer *parameterAsLayer( const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context ) const;
|
|
%Docstring
|
|
Evaluates the parameter with matching ``name`` 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.
|
|
:rtype: QgsMapLayer
|
|
%End
|
|
|
|
QgsRasterLayer *parameterAsRasterLayer( const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context ) const;
|
|
%Docstring
|
|
Evaluates the parameter with matching ``name`` 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.
|
|
:rtype: QgsRasterLayer
|
|
%End
|
|
|
|
QgsVectorLayer *parameterAsVectorLayer( const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context ) const;
|
|
%Docstring
|
|
Evaluates the parameter with matching ``name`` 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.
|
|
:rtype: QgsVectorLayer
|
|
%End
|
|
|
|
QgsCoordinateReferenceSystem parameterAsCrs( const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context ) const;
|
|
%Docstring
|
|
Evaluates the parameter with matching ``name`` to a coordinate reference system.
|
|
:rtype: QgsCoordinateReferenceSystem
|
|
%End
|
|
|
|
QgsRectangle parameterAsExtent( const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context ) const;
|
|
%Docstring
|
|
Evaluates the parameter with matching ``name`` to a rectangular extent.
|
|
:rtype: QgsRectangle
|
|
%End
|
|
|
|
QgsPointXY parameterAsPoint( const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context ) const;
|
|
%Docstring
|
|
Evaluates the parameter with matching ``name`` to a point.
|
|
:rtype: QgsPointXY
|
|
%End
|
|
|
|
QString parameterAsFile( const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context ) const;
|
|
%Docstring
|
|
Evaluates the parameter with matching ``name`` to a file/folder name.
|
|
:rtype: str
|
|
%End
|
|
|
|
QVariantList parameterAsMatrix( const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context ) const;
|
|
%Docstring
|
|
Evaluates the parameter with matching ``name`` to a matrix/table of values.
|
|
Tables are collapsed to a 1 dimensional list.
|
|
:rtype: QVariantList
|
|
%End
|
|
|
|
QList< QgsMapLayer *> parameterAsLayerList( const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context ) const;
|
|
%Docstring
|
|
Evaluates the parameter with matching ``name`` to a list of map layers.
|
|
:rtype: list of QgsMapLayer
|
|
%End
|
|
|
|
QList<double> parameterAsRange( const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context ) const;
|
|
%Docstring
|
|
Evaluates the parameter with matching ``name`` to a range of values.
|
|
:rtype: list of float
|
|
%End
|
|
|
|
QStringList parameterAsFields( const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context ) const;
|
|
%Docstring
|
|
Evaluates the parameter with matching ``name`` to a list of fields.
|
|
:rtype: list of str
|
|
%End
|
|
|
|
|
|
private:
|
|
QgsProcessingAlgorithm( const QgsProcessingAlgorithm &other );
|
|
};
|
|
QFlags<QgsProcessingAlgorithm::Flag> operator|(QgsProcessingAlgorithm::Flag f1, QFlags<QgsProcessingAlgorithm::Flag> f2);
|
|
|
|
|
|
|
|
|
|
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/processing/qgsprocessingalgorithm.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
************************************************************************/
|