18#ifndef QGSPROCESSINGMODELCHILDALGORITHM_H
19#define QGSPROCESSINGMODELCHILDALGORITHM_H
30class QgsProcessingModelAlgorithm;
40class CORE_EXPORT QgsProcessingModelChildAlgorithm :
public QgsProcessingModelComponent
48 QgsProcessingModelChildAlgorithm(
const QString &algorithmId = QString() );
50 QgsProcessingModelChildAlgorithm(
const QgsProcessingModelChildAlgorithm &other );
51 QgsProcessingModelChildAlgorithm &operator=(
const QgsProcessingModelChildAlgorithm &other );
53 QgsProcessingModelChildAlgorithm *clone() const override
SIP_FACTORY;
63 void copyNonDefinitionPropertiesFromModel( QgsProcessingModelAlgorithm *model );
71 QString childId()
const {
return mId; }
79 void setChildId(
const QString &
id ) { mId = id; }
87 void generateChildId(
const QgsProcessingModelAlgorithm &model );
94 QString algorithmId()
const {
return mAlgorithmId; }
106 bool setAlgorithmId(
const QString &algorithmId );
119 bool reattach()
const;
131 QVariantMap configuration()
const;
143 void setConfiguration(
const QVariantMap &configuration );
159 QMap< QString, QList< QgsProcessingModelChildParameterSource > > parameterSources()
const {
return mParams; }
167 void setParameterSources(
const QMap< QString, QList< QgsProcessingModelChildParameterSource > > &sources ) { mParams = sources; }
178 void addParameterSources(
const QString &name,
const QList< QgsProcessingModelChildParameterSource > &source ) { mParams.insert( name, source ); }
184 bool isActive()
const {
return mActive; }
190 void setActive(
bool active ) { mActive = active; }
197 QList< QgsProcessingModelChildDependency > dependencies()
const {
return mDependencies; }
204 void setDependencies(
const QList< QgsProcessingModelChildDependency > &dependencies ) { mDependencies = dependencies; }
213 QMap<QString, QgsProcessingModelOutput> modelOutputs()
const {
return mModelOutputs; }
225 QgsProcessingModelOutput &modelOutput(
const QString &name ) {
return mModelOutputs[ name ]; }
236 void setModelOutputs(
const QMap<QString, QgsProcessingModelOutput> &outputs );
246 bool removeModelOutput(
const QString &name );
252 QVariant toVariant()
const;
258 bool loadVariant(
const QVariant &child );
272 const QMap<QString, QString> &friendlyChildNames,
const QMap<QString, QString> &friendlyOutputNames )
const;
274 SIP_SKIP const QgsProcessingModelComment *comment()
const override {
return &mComment; }
275 QgsProcessingModelComment *comment()
override {
return &mComment; }
276 void setComment(
const QgsProcessingModelComment &comment )
override { mComment = comment; }
282 QString mAlgorithmId;
283 std::unique_ptr< QgsProcessingAlgorithm > mAlgorithm;
285 QVariantMap mConfiguration;
288 QMap< QString, QgsProcessingModelChildParameterSources > mParams;
291 QMap< QString, QgsProcessingModelOutput > mModelOutputs;
296 QList< QgsProcessingModelChildDependency > mDependencies;
298 QgsProcessingModelComment mComment;
300 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