mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-04 00:30:59 -05:00
This commit adds the virtual method for running processing algs to the base c++ class, and adds the initial framework for c++ algorithm parameters. When running an algorithm, a QVariantMap is passed as the algorithm parameters. The high level API provided by QgsProcessingParameters should be used to retrieve strings/layers/doubles/etc from this QVariantMap. This allows advanced use cases, such as passing QgsProperty with the QVariantMap for "dynamic" parameters, where the value should be evaluated for every feature processed. E.g. if the buffer algorithm uses a dynamic property for distance, then the distance could be bound to either a field value or to a custom expression. This gets evaluated before buffering each feature to allow for advanced variable buffering. Support for dynamic parameters will be "opt in", and non default. So algorithms will need to specifically add support for dynamic properties as required.
90 lines
3.3 KiB
Plaintext
90 lines
3.3 KiB
Plaintext
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/processing/qgsprocessingparameters.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class QgsProcessingParameters
|
|
{
|
|
%Docstring
|
|
|
|
A collection of utilities for working with parameters when running a processing algorithm.
|
|
|
|
Parameters are stored in a QVariantMap and referenced by a unique string key.
|
|
The QVariants in parameters are not usually accessed
|
|
directly, and instead the high level API provided through QgsProcessingParameters
|
|
parameterAsString(), parameterAsDouble() are used instead.
|
|
|
|
Parameters are evaluated using a provided QgsProcessingContext, allowing
|
|
the evaluation to understand available map layers and expression contexts
|
|
(for expression based parameters).
|
|
|
|
.. versionadded:: 3.0
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgsprocessingparameters.h"
|
|
%End
|
|
public:
|
|
|
|
static bool isDynamic( const QVariantMap ¶meters, 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.
|
|
:rtype: bool
|
|
%End
|
|
|
|
static QString parameterAsString( const QVariantMap ¶meters, const QString &name, const QgsProcessingContext &context );
|
|
%Docstring
|
|
Evaluates the parameter with matching ``name`` to a static string value.
|
|
:rtype: str
|
|
%End
|
|
|
|
static double parameterAsDouble( const QVariantMap ¶meters, const QString &name, const QgsProcessingContext &context );
|
|
%Docstring
|
|
Evaluates the parameter with matching ``name`` to a static double value.
|
|
:rtype: float
|
|
%End
|
|
|
|
static int parameterAsInt( const QVariantMap ¶meters, const QString &name, const QgsProcessingContext &context );
|
|
%Docstring
|
|
Evaluates the parameter with matching ``name`` to a static integer value.
|
|
:rtype: int
|
|
%End
|
|
|
|
static bool parameterAsBool( const QVariantMap ¶meters, const QString &name, const QgsProcessingContext &context );
|
|
%Docstring
|
|
Evaluates the parameter with matching ``name`` to a static boolean value.
|
|
:rtype: bool
|
|
%End
|
|
|
|
static QgsMapLayer *parameterAsLayer( const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context );
|
|
%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
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/processing/qgsprocessingparameters.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
************************************************************************/
|