/
qgsprocessingmodelalgorithm.sip.in
411 lines (288 loc) · 13.2 KB
/
qgsprocessingmodelalgorithm.sip.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
/************************************************************************
* 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(), const QString &groupId = 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 QString groupId() const;
virtual QIcon icon() const;
virtual QString svgIconPath() const;
virtual QString shortHelpString() const;
virtual QString helpUrl() const;
virtual Flags flags() const;
virtual bool canExecute( QString *errorMessage /Out/ = 0 ) const;
virtual QString asPythonCommand( const QVariantMap ¶meters, QgsProcessingContext &context ) const;
void setName( const QString &name );
%Docstring
Sets the model ``name``.
.. seealso:: :py:func:`name`
%End
void setGroup( const QString &group );
%Docstring
Sets the model ``group``.
.. seealso:: :py:func:`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:: :py:func:`childAlgorithm`
.. seealso:: :py:func:`setChildAlgorithms`
.. seealso:: :py:func:`addChildAlgorithm`
%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:: :py:func:`childAlgorithms`
.. seealso:: :py:func:`childAlgorithm`
.. seealso:: :py:func:`setChildAlgorithm`
.. seealso:: :py:func:`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:: :py:func:`addChildAlgorithm`
.. seealso:: :py:func:`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:: :py:func:`childAlgorithms`
.. seealso:: :py:func:`childAlgorithm`
.. seealso:: :py:func:`setChildAlgorithm`
.. seealso:: :py:func:`setChildAlgorithms`
%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:: :py:func:`addChildAlgorithm`
.. seealso:: :py:func:`childAlgorithms`
%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:: :py:func:`deactivateChildAlgorithm`
%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:: :py:func:`removeChildAlgorithm`
.. seealso:: :py:func:`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:: :py:func:`deactivateChildAlgorithm`
%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:: :py:func:`dependsOnChildAlgorithms`
%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:: :py:func:`dependentChildAlgorithms`
%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:: :py:func:`updateModelParameter`
.. seealso:: :py:func:`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:: :py:func:`addModelParameter`
.. seealso:: :py:func:`removeModelParameter`
%End
void removeModelParameter( const QString &name );
%Docstring
Removes an existing model parameter by ``name``. The definition of the matching parameter
is deleted.
.. seealso:: :py:func:`addModelParameter`
.. seealso:: :py:func:`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:: :py:func:`otherParametersDependOnParameter`
%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:: :py:func:`childAlgorithmsDependOnParameter`
%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:: :py:func:`setParameterComponent`
.. seealso:: :py:func:`parameterComponent`
%End
void setParameterComponents( const QMap<QString, QgsProcessingModelParameter> ¶meterComponents );
%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:: :py:func:`parameterComponents`
.. seealso:: :py:func:`setParameterComponent`
.. seealso:: :py:func:`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:: :py:func:`parameterComponents`
.. seealso:: :py:func:`setParameterComponents`
.. seealso:: :py:func:`parameterComponent`
%End
QgsProcessingModelParameter ¶meterComponent( 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:: :py:func:`parameterComponents`
.. seealso:: :py:func:`setParameterComponents`
.. seealso:: :py:func:`setParameterComponent`
%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:: :py:func:`fromFile`
%End
bool fromFile( const QString &path );
%Docstring
Reads the model from a file, at the specified ``path``.
.. seealso:: :py:func:`toFile`
%End
QVariantMap &helpContent();
%Docstring
Returns the model's help contents (a free-form map of values describing the algorithm's
use and metadata).
.. seealso:: :py:func:`setHelpContent`
%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:: :py:func:`helpContent`
%End
QString sourceFilePath() const;
%Docstring
Returns the source file path for the model, if available.
.. seealso:: :py:func:`setSourceFilePath`
%End
void setSourceFilePath( const QString &path );
%Docstring
Sets the source file ``path`` for the model, if available.
.. seealso:: :py:func:`sourceFilePath`
%End
QString asPythonCode() const;
%Docstring
Attempts to convert the model to executable Python code.
%End
QList< QgsProcessingModelChildParameterSource > availableSourcesForChild( const QString &childId, const QStringList ¶meterTypes = 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.
%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;
QgsProcessingModelChildParameterSource source;
QString description;
};
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:: :py:func:`createExpressionContextScopeForChildAlgorithm`
%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:: :py:func:`variablesForChildAlgorithm`
%End
protected:
virtual QgsProcessingAlgorithm *createInstance() const /Factory/;
virtual QVariantMap processAlgorithm( const QVariantMap ¶meters, 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 *
************************************************************************/