18#ifndef QGSPROCESSINGMODELCHILDALGORITHM_H
19#define QGSPROCESSINGMODELCHILDALGORITHM_H
30class QgsProcessingModelAlgorithm;
39class CORE_EXPORT QgsProcessingModelChildAlgorithm :
public QgsProcessingModelComponent
47 QgsProcessingModelChildAlgorithm(
const QString &algorithmId = QString() );
49 QgsProcessingModelChildAlgorithm(
const QgsProcessingModelChildAlgorithm &other );
50 QgsProcessingModelChildAlgorithm &operator=(
const QgsProcessingModelChildAlgorithm &other );
52 QgsProcessingModelChildAlgorithm *clone() const override
SIP_FACTORY;
62 void copyNonDefinitionPropertiesFromModel( QgsProcessingModelAlgorithm *model );
70 QString childId()
const {
return mId; }
78 void setChildId(
const QString &
id ) { mId = id; }
86 void generateChildId(
const QgsProcessingModelAlgorithm &model );
93 QString algorithmId()
const {
return mAlgorithmId; }
105 bool setAlgorithmId(
const QString &algorithmId );
118 bool reattach()
const;
130 QVariantMap configuration()
const;
142 void setConfiguration(
const QVariantMap &configuration );
158 QMap< QString, QList< QgsProcessingModelChildParameterSource > > parameterSources()
const {
return mParams; }
166 void setParameterSources(
const QMap< QString, QList< QgsProcessingModelChildParameterSource > > &sources ) { mParams = sources; }
177 void addParameterSources(
const QString &name,
const QList< QgsProcessingModelChildParameterSource > &source ) { mParams.insert( name, source ); }
183 bool isActive()
const {
return mActive; }
189 void setActive(
bool active ) { mActive = active; }
196 QList< QgsProcessingModelChildDependency > dependencies()
const {
return mDependencies; }
203 void setDependencies(
const QList< QgsProcessingModelChildDependency > &dependencies ) { mDependencies = dependencies; }
212 QMap<QString, QgsProcessingModelOutput> modelOutputs()
const {
return mModelOutputs; }
224 QgsProcessingModelOutput &modelOutput(
const QString &name ) {
return mModelOutputs[ name ]; }
235 void setModelOutputs(
const QMap<QString, QgsProcessingModelOutput> &outputs );
245 bool removeModelOutput(
const QString &name );
251 QVariant toVariant()
const;
257 bool loadVariant(
const QVariant &child );
271 const QMap<QString, QString> &friendlyChildNames,
const QMap<QString, QString> &friendlyOutputNames )
const;
273 SIP_SKIP const QgsProcessingModelComment *comment()
const override {
return &mComment; }
274 QgsProcessingModelComment *comment()
override {
return &mComment; }
275 void setComment(
const QgsProcessingModelComment &comment )
override { mComment = comment; }
281 QString mAlgorithmId;
282 std::unique_ptr< QgsProcessingAlgorithm > mAlgorithm;
284 QVariantMap mConfiguration;
287 QMap< QString, QgsProcessingModelChildParameterSources > mParams;
290 QMap< QString, QgsProcessingModelOutput > mModelOutputs;
295 QList< QgsProcessingModelChildDependency > mDependencies;
297 QgsProcessingModelComment mComment;
299 friend class TestQgsProcessingModelAlgorithm;
Abstract base class for processing algorithms.
PythonOutputType
Available Python output types.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into allowing algorithms to be written in pure substantial changes are required in order to port existing x Processing algorithms for QGIS x The most significant changes are outlined not GeoAlgorithm For algorithms which operate on features one by consider subclassing the QgsProcessingFeatureBasedAlgorithm class This class allows much of the boilerplate code for looping over features from a vector layer to be bypassed and instead requires implementation of a processFeature method Ensure that your algorithm(or algorithm 's parent class) implements the new pure virtual createInstance(self) call
QMap< QString, QString > QgsStringMap