QGIS/python/core/processing/models/qgsprocessingmodelalgorithm.sip
Nyall Dawson e6d86bba53 [processing] Generalise modeler multi-step feedback proxy for use
outside of modeler

This can be useful too for individual algorithms
2017-11-23 10:01:13 +10:00

384 lines
13 KiB
Plaintext

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/processing/models/qgsprocessingmodelalgorithm.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsProcessingModelAlgorithm : QgsProcessingAlgorithm
{
%Docstring
Model based algorithm with processing.
.. versionadded:: 3.0
%End
%TypeHeaderCode
#include "qgsprocessingmodelalgorithm.h"
%End
public:
QgsProcessingModelAlgorithm( const QString &name = QString(), const QString &group = QString() );
%Docstring
Constructor for QgsProcessingModelAlgorithm.
%End
virtual void initAlgorithm( const QVariantMap &configuration = QVariantMap() ); //#spellok
virtual QString name() const;
virtual QString displayName() const;
virtual QString group() const;
virtual QIcon icon() const;
virtual QString svgIconPath() const;
virtual QString shortHelpString() const;
virtual QString helpUrl() const;
virtual bool canExecute( QString *errorMessage /Out/ = 0 ) const;
virtual QString asPythonCommand( const QVariantMap &parameters, QgsProcessingContext &context ) const;
void setName( const QString &name );
%Docstring
Sets the model ``name``.
.. seealso:: name()
%End
void setGroup( const QString &group );
%Docstring
Sets the model ``group``.
.. seealso:: group()
%End
QMap<QString, QgsProcessingModelChildAlgorithm> childAlgorithms() const;
%Docstring
Returns the map of child algorithms contained in the model. The keys
are the child algorithm ids (see QgsProcessingModelAlgorithm.ChildAlgorithm.childId()).
.. seealso:: childAlgorithm()
.. seealso:: setChildAlgorithms()
.. seealso:: addChildAlgorithm()
:rtype: QMap<str, QgsProcessingModelChildAlgorithm>
%End
void setChildAlgorithms( const QMap<QString, QgsProcessingModelChildAlgorithm> &childAlgorithms );
%Docstring
Sets the map of child algorithms contained in the model. The keys
are the child algorithm ids (see QgsProcessingModelAlgorithm.ChildAlgorithm.childId()).
All existing child algorithms will be replaced.
.. seealso:: childAlgorithms()
.. seealso:: childAlgorithm()
.. seealso:: setChildAlgorithm()
.. seealso:: addChildAlgorithm()
%End
void setChildAlgorithm( const QgsProcessingModelChildAlgorithm &algorithm );
%Docstring
Sets the child ``algorithm`` within the model. If a child algorithm already
exists in the model with the same child ID then that algorithm will be replaced.
.. seealso:: addChildAlgorithm()
.. seealso:: setChildAlgorithms()
%End
QString addChildAlgorithm( QgsProcessingModelChildAlgorithm &algorithm );
%Docstring
Adds a new child ``algorithm`` to the model. If a child algorithm already exists
in the model with the same child ID then ``algorithm`` will be assigned a new
autogenerated unique ID.
The assigned child ID will be returned.
.. seealso:: childAlgorithms()
.. seealso:: childAlgorithm()
.. seealso:: setChildAlgorithm()
.. seealso:: setChildAlgorithms()
:rtype: str
%End
QgsProcessingModelChildAlgorithm &childAlgorithm( const QString &id );
%Docstring
Returns the child algorithm with matching ``id``. If no child algorithm exists with
this ID a new algorithm will be added to the model and returned.
.. seealso:: addChildAlgorithm()
.. seealso:: childAlgorithms()
:rtype: QgsProcessingModelChildAlgorithm
%End
bool removeChildAlgorithm( const QString &id );
%Docstring
Attempts to remove the child algorithm with matching ``id``.
Returns true if the algorithm could be removed, or false
if the algorithm could not be removed (e.g. due to other
child algorithms depending on it).
.. seealso:: deactivateChildAlgorithm()
:rtype: bool
%End
void deactivateChildAlgorithm( const QString &id );
%Docstring
Deactivates the child algorithm with matching ``id``.
All other child algorithms which depend on the child
algorithm will also be deactivated.
.. seealso:: removeChildAlgorithm()
.. seealso:: activateChildAlgorithm()
%End
bool activateChildAlgorithm( const QString &id );
%Docstring
Attempts to activate the child algorithm with matching ``id``.
If any child algorithms on which the child depends are not active,
then the child will not be activated and false will be returned.
.. seealso:: deactivateChildAlgorithm()
:rtype: bool
%End
QSet< QString > dependentChildAlgorithms( const QString &childId ) const;
%Docstring
Returns a list of the child algorithm IDs depending on the child
algorithm with the specified ``childId``.
.. seealso:: dependsOnChildAlgorithms()
:rtype: set of str
%End
QSet< QString > dependsOnChildAlgorithms( const QString &childId ) const;
%Docstring
Returns a list of the child algorithm IDs on which the child
algorithm with the specified ``childId`` depends upon.
.. seealso:: dependentChildAlgorithms()
:rtype: set of str
%End
void addModelParameter( QgsProcessingParameterDefinition *definition /Transfer/, const QgsProcessingModelParameter &component );
%Docstring
Adds a new parameter to the model, with the specified ``definition`` and graphical ``component``.
Ownership of ``definition`` is transferred to the model.
.. seealso:: updateModelParameter()
.. seealso:: removeModelParameter()
%End
void updateModelParameter( QgsProcessingParameterDefinition *definition /Transfer/ );
%Docstring
Replaces the definition of an existing parameter (by parameter name) with a new ``definition``. Ownership of
``definition`` is transferred to the model, and any existing parameter is deleted.
.. seealso:: addModelParameter()
.. seealso:: removeModelParameter()
%End
void removeModelParameter( const QString &name );
%Docstring
Removes an existing model parameter by ``name``. The definition of the matching parameter
is deleted.
.. seealso:: addModelParameter()
.. seealso:: updateModelParameter()
%End
bool childAlgorithmsDependOnParameter( const QString &name ) const;
%Docstring
Returns true if any child algorithms depend on the model parameter
with the specified ``name``.
.. seealso:: otherParametersDependOnParameter()
:rtype: bool
%End
bool otherParametersDependOnParameter( const QString &name ) const;
%Docstring
Returns true if any other model parameters depend on the parameter
with the specified ``name`` (e.g. field parameters where ``name``
is the parent layer parameter).
.. seealso:: childAlgorithmsDependOnParameter()
:rtype: bool
%End
QMap<QString, QgsProcessingModelParameter> parameterComponents() const;
%Docstring
Returns the map of parameter components used by the model. The keys
should match the algorithm's parameter names (see parameterDefinitions() ).
.. seealso:: setParameterComponent()
.. seealso:: parameterComponent()
:rtype: QMap<str, QgsProcessingModelParameter>
%End
void setParameterComponents( const QMap<QString, QgsProcessingModelParameter> &parameterComponents );
%Docstring
Sets the map of parameter components used by the model. The keys
should match the algorithm's parameter names (see parameterDefinitions() ).
All existing parameter components will be replaced.
.. seealso:: parameterComponents()
.. seealso:: setParameterComponent()
.. seealso:: parameterComponent()
%End
void setParameterComponent( const QgsProcessingModelParameter &component );
%Docstring
Sets a parameter ``component`` for the model. If a parameter component already
exists in the model with the same parameter name then that component will be replaced.
.. seealso:: parameterComponents()
.. seealso:: setParameterComponents()
.. seealso:: parameterComponent()
%End
QgsProcessingModelParameter &parameterComponent( const QString &name );
%Docstring
Returns the parameter component with matching ``name``. If no parameter component exists with
this name a new component will be added to the model and returned.
.. seealso:: parameterComponents()
.. seealso:: setParameterComponents()
.. seealso:: setParameterComponent()
:rtype: QgsProcessingModelParameter
%End
void updateDestinationParameters();
%Docstring
Updates the model's parameter definitions to include all relevant destination
parameters as required by child algorithm ModelOutputs.
Must be called whenever child algorithm ModelOutputs are altered.
%End
bool toFile( const QString &path ) const;
%Docstring
Writes the model to a file, at the specified ``path``.
.. seealso:: fromFile()
:rtype: bool
%End
bool fromFile( const QString &path );
%Docstring
Reads the model from a file, at the specified ``path``.
.. seealso:: toFile()
:rtype: bool
%End
QVariantMap &helpContent();
%Docstring
Returns the model's help contents (a free-form map of values describing the algorithm's
use and metadata).
.. seealso:: setHelpContent()
:rtype: QVariantMap
%End
void setHelpContent( const QVariantMap &contents );
%Docstring
Sets the model's help ``contents`` (a free-form map of values describing the algorithm's
use and metadata).
.. seealso:: helpContent()
%End
QString sourceFilePath() const;
%Docstring
Returns the source file path for the model, if available.
.. seealso:: setSourceFilePath()
:rtype: str
%End
void setSourceFilePath( const QString &path );
%Docstring
Sets the source file ``path`` for the model, if available.
.. seealso:: sourceFilePath()
%End
QString asPythonCode() const;
%Docstring
Attempts to convert the model to executable Python code.
:rtype: str
%End
QList< QgsProcessingModelChildParameterSource > availableSourcesForChild( const QString &childId, const QStringList &parameterTypes = QStringList(),
const QStringList &outputTypes = QStringList(), const QList< int > &dataTypes = QList< int >() ) const;
%Docstring
Returns a list of possible sources which can be used for the parameters for a child
algorithm in the model. Returned sources are those which match either one of the
specified ``parameterTypes`` (see QgsProcessingParameterDefinition.type() ) or
on of the specified ``outputTypes`` (see QgsProcessingOutputDefinition.type() ).
If specified, an optional list of ``dataTypes`` can be used to filter the returned
sources to those with compatible data types for the parameter/outputs.
:rtype: list of QgsProcessingModelChildParameterSource
%End
class VariableDefinition
{
%Docstring
Definition of a expression context variable available during model execution.
.. versionadded:: 3.0
%End
%TypeHeaderCode
#include "qgsprocessingmodelalgorithm.h"
%End
public:
VariableDefinition( const QVariant &value = QVariant(), const QgsProcessingModelChildParameterSource &source = QgsProcessingModelChildParameterSource::fromStaticValue( QVariant() ), const QString &description = QString() );
%Docstring
Constructor for a new VariableDefinition with the specified ``value`` and original
parameter ``source``, and ``description``.
%End
QVariant value;
%Docstring
Value of variable
%End
QgsProcessingModelChildParameterSource source;
%Docstring
Original source of variable's value
%End
QString description;
%Docstring
Translated description of variable
%End
};
QMap< QString, QgsProcessingModelAlgorithm::VariableDefinition > variablesForChildAlgorithm( const QString &childId, QgsProcessingContext &context, const QVariantMap &modelParameters = QVariantMap(),
const QVariantMap &results = QVariantMap() ) const;
%Docstring
Returns a map of variable name to variable definition for expression context variables which are available
for use by child algorithm during model execution.
The child algorithm ``childId`` and processing ``context``
are manadatory. If ``modelParameters`` and ``results`` are not specified, then only the variable names and sources
will be returned, but all variable values will be null. This can be used to determine in advance which variables
will be available for a specific child algorithm, e.g. for use in expression builder widgets.
In order to calculate the actual variable value, the input model ``modelParameters`` and already executed child
algorithm ``results`` must be passed.
.. seealso:: createExpressionContextScopeForChildAlgorithm()
:rtype: QMap< str, QgsProcessingModelAlgorithm.VariableDefinition >
%End
QgsExpressionContextScope *createExpressionContextScopeForChildAlgorithm( const QString &childId, QgsProcessingContext &context, const QVariantMap &modelParameters = QVariantMap(),
const QVariantMap &results = QVariantMap() ) const /Factory/;
%Docstring
Creates a new expression context scope for a child algorithm within the model.
.. seealso:: variablesForChildAlgorithm()
:rtype: QgsExpressionContextScope
%End
protected:
virtual QgsProcessingAlgorithm *createInstance() const /Factory/;
virtual QVariantMap processAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback );
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/processing/models/qgsprocessingmodelalgorithm.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/