-
-
Notifications
You must be signed in to change notification settings - Fork 3k
/
qgsprocessingmodelalgorithm.sip
955 lines (796 loc) · 29.4 KB
/
qgsprocessingmodelalgorithm.sip
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
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/processing/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:
class ChildParameterSource
{
%Docstring
Source for the value of a parameter for a child algorithm within a model.
.. versionadded:: 3.0
%End
%TypeHeaderCode
#include "qgsprocessingmodelalgorithm.h"
%End
public:
enum Source
{
ModelParameter,
ChildOutput,
StaticValue,
Expression,
};
ChildParameterSource();
%Docstring
Constructor for ChildParameterSource. It is recommended that the static methods
fromStaticValue(), fromModelParameter(), fromChildOutput() and fromExpression() are used instead.
%End
bool operator==( const QgsProcessingModelAlgorithm::ChildParameterSource &other ) const;
bool operator!=( const QgsProcessingModelAlgorithm::ChildParameterSource &other ) const;
%Docstring
:rtype: bool
%End
static QgsProcessingModelAlgorithm::ChildParameterSource fromStaticValue( const QVariant &value );
%Docstring
Returns a new ChildParameterSource which takes its value from a static ``value``.
.. seealso:: fromModelParameter()
.. seealso:: fromChildOutput()
.. seealso:: fromExpression()
:rtype: QgsProcessingModelAlgorithm.ChildParameterSource
%End
static QgsProcessingModelAlgorithm::ChildParameterSource fromModelParameter( const QString ¶meterName );
%Docstring
Returns a new ChildParameterSource which takes its value from a parent model parameter.
.. seealso:: fromStaticValue()
.. seealso:: fromChildOutput()
.. seealso:: fromExpression()
:rtype: QgsProcessingModelAlgorithm.ChildParameterSource
%End
static QgsProcessingModelAlgorithm::ChildParameterSource fromChildOutput( const QString &childId, const QString &outputName );
%Docstring
Returns a new ChildParameterSource which takes its value from an output generated by a child algorithm.
.. seealso:: fromStaticValue()
.. seealso:: fromModelParameter()
.. seealso:: fromExpression()
:rtype: QgsProcessingModelAlgorithm.ChildParameterSource
%End
static QgsProcessingModelAlgorithm::ChildParameterSource fromExpression( const QString &expression );
%Docstring
Returns a new ChildParameterSource which takes its value from an expression. The expression
is evaluated just before the child algorithm executes, and can use functions available
in its expression context to include results calculated from the child algorithms already
executed by the model.
.. seealso:: fromStaticValue()
.. seealso:: fromChildOutput()
.. seealso:: fromModelParameter()
:rtype: QgsProcessingModelAlgorithm.ChildParameterSource
%End
Source source() const;
%Docstring
Returns the parameter value's source.
:rtype: Source
%End
QVariant staticValue() const;
%Docstring
Returns the source's static value. This is only used when the source() is StaticValue.
.. seealso:: setStaticValue()
:rtype: QVariant
%End
void setStaticValue( const QVariant &value );
%Docstring
Sets the source's static value. Calling this will also change the source() to StaticValue.
.. seealso:: staticValue()
%End
QString parameterName() const;
%Docstring
Returns the source's model parameter name. This is only used when the source() is ModelParameter.
.. seealso:: setParameterName()
:rtype: str
%End
void setParameterName( const QString &name );
%Docstring
Sets the source's model parameter ``name``. Calling this will also change the source() to ModelParameter.
.. seealso:: parameterName()
%End
QString outputChildId() const;
%Docstring
Returns the source's child algorithm ID from which the output value will be taken. This is only used when the source() is ChildOutput.
.. seealso:: setOutputChildId()
.. seealso:: outputName()
:rtype: str
%End
void setOutputChildId( const QString &id );
%Docstring
Sets the source's child algorithm ``id`` from which the output value will be taken. Calling this will also change the source() to ChildOutput.
.. seealso:: parameterName()
.. seealso:: setOutputName()
%End
QString outputName() const;
%Docstring
Returns the source's child algorithm output name from which the output value will be taken. This is only used when the source() is ChildOutput.
.. seealso:: setOutputName()
.. seealso:: outputChildId()
:rtype: str
%End
void setOutputName( const QString &name );
%Docstring
Sets the source's child algorithm output ``name`` from which the output value will be taken. Calling this will also change the source() to ChildOutput.
.. seealso:: outputName()
.. seealso:: setOutputChildId()
%End
QString expression() const;
%Docstring
Returns the source's expression. This is only used when the source() is Expression.
.. seealso:: setExpression()
:rtype: str
%End
void setExpression( const QString &expression );
%Docstring
Sets the source's expression. Calling this will also change the source() to Expression.
The expression is evaluated just before the child algorithm executes, and can use functions available
in its expression context to include results calculated from the child algorithms already
executed by the model.
.. seealso:: expression()
%End
QVariant toVariant() const;
%Docstring
Saves this source to a QVariant.
.. seealso:: loadVariant()
:rtype: QVariant
%End
bool loadVariant( const QVariantMap &map );
%Docstring
Loads this source from a QVariantMap.
.. seealso:: toVariant()
:rtype: bool
%End
QString asPythonCode() const;
%Docstring
Attempts to convert the source to executable Python code.
:rtype: str
%End
};
class Component
{
%Docstring
Represents a component of a model algorithm.
.. versionadded:: 3.0
%End
%TypeHeaderCode
#include "qgsprocessingmodelalgorithm.h"
%End
public:
QString description() const;
%Docstring
Returns the friendly description text for the component.
.. seealso:: setDescription()
:rtype: str
%End
void setDescription( const QString &description );
%Docstring
Sets the friendly ``description`` text for the component.
.. seealso:: description()
%End
QPointF position() const;
%Docstring
Returns the position of the model component within the graphical modeler.
.. seealso:: setPosition()
:rtype: QPointF
%End
void setPosition( const QPointF &position );
%Docstring
Sets the ``position`` of the model component within the graphical modeler.
.. seealso:: position()
%End
protected:
Component( const QString &description = QString() );
%Docstring
Only subclasses can be created
%End
Component( const QgsProcessingModelAlgorithm::Component &other );
%Docstring
Copies are protected to avoid slicing
%End
void saveCommonProperties( QVariantMap &map ) const;
%Docstring
Saves the component properties to a QVariantMap.
.. seealso:: restoreCommonProperties()
%End
void restoreCommonProperties( const QVariantMap &map );
%Docstring
Restores the component properties from a QVariantMap.
.. seealso:: saveCommonProperties()
%End
};
class ModelParameter : QgsProcessingModelAlgorithm::Component
{
%Docstring
Represents an input parameter used by the model.
.. versionadded:: 3.0
%End
%TypeHeaderCode
#include "qgsprocessingmodelalgorithm.h"
%End
public:
ModelParameter( const QString ¶meterName = QString() );
%Docstring
Constructor for ModelParameter. The parameter name should match one of the
parameters from the parent model.
%End
QString parameterName() const;
%Docstring
Returns the associated parameter name. The parameter name should match one of the
parameters from the parent model.
.. seealso:: parameterName()
:rtype: str
%End
void setParameterName( const QString &name );
%Docstring
Sets the associated parameter name. The parameter name should match one of the
parameters from the parent model.
.. seealso:: parameterName()
%End
QVariant toVariant() const;
%Docstring
Saves this parameter to a QVariant.
.. seealso:: loadVariant()
:rtype: QVariant
%End
bool loadVariant( const QVariantMap &map );
%Docstring
Loads this parameter from a QVariantMap.
.. seealso:: toVariant()
:rtype: bool
%End
};
class ModelOutput : QgsProcessingModelAlgorithm::Component
{
%Docstring
Represents a final output created by the model.
.. versionadded:: 3.0
%End
%TypeHeaderCode
#include "qgsprocessingmodelalgorithm.h"
%End
public:
ModelOutput( const QString &name = QString(), const QString &description = QString() );
%Docstring
Constructor for ModelOutput with the specified ``name`` and ``description``.
%End
QString name() const;
%Docstring
Returns the model output name.
.. seealso:: setName()
:rtype: str
%End
void setName( const QString &name );
%Docstring
Sets the model output ``name``.
.. seealso:: name()
%End
QString childId() const;
%Docstring
Returns the child algorithm ID from which this output is generated.
.. seealso:: setChildId()
:rtype: str
%End
void setChildId( const QString &id );
%Docstring
Sets the child algorithm ``id`` from which this output is generated.
.. seealso:: childId()
%End
QString childOutputName() const;
%Docstring
Returns the child algorithm output name from which this output is generated.
.. seealso:: setOutputName()
:rtype: str
%End
void setChildOutputName( const QString &name );
%Docstring
Sets the child algorithm output ``name`` from which this output is generated.
.. seealso:: outputName()
%End
QVariant toVariant() const;
%Docstring
Saves this output to a QVariant.
.. seealso:: loadVariant()
:rtype: QVariant
%End
bool loadVariant( const QVariantMap &map );
%Docstring
Loads this output from a QVariantMap.
.. seealso:: toVariant()
:rtype: bool
%End
};
class ChildAlgorithm : QgsProcessingModelAlgorithm::Component
{
%Docstring
Child algorithm representing a single component of a QgsProcessingModelAlgorithm.
.. versionadded:: 3.0
%End
%TypeHeaderCode
#include "qgsprocessingmodelalgorithm.h"
%End
public:
ChildAlgorithm( const QString &algorithmId = QString() );
%Docstring
Constructor for ChildAlgorithm. The ``algorithmId`` parameter
should be set to a QgsProcessingAlgorithm algorithm ID.
%End
QString childId() const;
%Docstring
Returns the child algorithm's unique ID string, used the identify
this child algorithm within its parent model.
.. seealso:: setChildId()
.. seealso:: generateChildId()
:rtype: str
%End
void setChildId( const QString &id );
%Docstring
Sets the child algorithm's unique ``id`` string, used the identify
this child algorithm within its parent model.
.. seealso:: childId()
.. seealso:: generateChildId()
%End
void generateChildId( const QgsProcessingModelAlgorithm &model );
%Docstring
Automatically generates a unique childId() for the algorithm,
avoiding child IDs which are already present in ``model``.
.. seealso:: childId()
.. seealso:: setChildId()
%End
QString algorithmId() const;
%Docstring
Returns the underlying child algorithm's ID.
.. seealso:: algorithm()
.. seealso:: setAlgorithmId()
:rtype: str
%End
void setAlgorithmId( const QString &algorithmId );
%Docstring
Sets the underlying child algorithm's ID. This
should be set to an existing QgsProcessingAlgorithm algorithm ID.
.. seealso:: algorithm()
.. seealso:: algorithmId()
%End
const QgsProcessingAlgorithm *algorithm() const;
%Docstring
Returns the underlying child algorithm, or a None
if a matching algorithm is not available.
.. seealso:: algorithmId()
:rtype: QgsProcessingAlgorithm
%End
QMap< QString, QList< QgsProcessingModelAlgorithm::ChildParameterSource > > parameterSources() const;
%Docstring
Returns a map of parameter sources. The keys are the child algorithm
parameter names, the values are the sources for that parameter.
.. seealso:: setParameterSources()
.. seealso:: addParameterSources()
:rtype: QMap< str, QList< QgsProcessingModelAlgorithm.ChildParameterSource > >
%End
void setParameterSources( const QMap< QString, QList< QgsProcessingModelAlgorithm::ChildParameterSource > > &sources );
%Docstring
Sets the map of parameter ``sources``. The keys are the child algorithm
parameter names, the values are the sources for that parameter.
.. seealso:: parameterSources()
.. seealso:: addParameterSources()
%End
void addParameterSources( const QString &name, const QList< QgsProcessingModelAlgorithm::ChildParameterSource > &source );
%Docstring
Adds a parameter source. The ``name`` argument should match
one of the child algorithm's parameter names, and the ``sources``
argument is used to set the sources for that parameter.
Any existing parameter sources with matching name will be replaced.
.. seealso:: parameterSources()
.. seealso:: setParameterSources()
%End
bool isActive() const;
%Docstring
Returns true if the child algorithm is active.
.. seealso:: setActive()
:rtype: bool
%End
void setActive( bool active );
%Docstring
Sets whether the child algorithm is active.
.. seealso:: isActive()
%End
QStringList dependencies() const;
%Docstring
Returns the list of child algorithms from the parent model on which this
algorithm is dependent. The returned list contains the id() of the
dependent algorithms.
.. seealso:: setDependencies()
:rtype: list of str
%End
void setDependencies( const QStringList &dependencies );
%Docstring
Sets the list of child algorithms from the parent model on which this
algorithm is dependent. The list should contain the id() of the
dependent algorithms.
.. seealso:: dependencies()
%End
bool parametersCollapsed() const;
%Docstring
Returns true if the list of parameters for this algorithm should be collapsed
in the graphical modeller.
.. seealso:: setParametersCollapsed()
.. seealso:: outputsCollapsed()
:rtype: bool
%End
void setParametersCollapsed( bool collapsed );
%Docstring
Sets whether the list of parameters for this algorithm should be collapsed
in the graphical modeller.
.. seealso:: parametersCollapsed()
.. seealso:: setOutputsCollapsed()
%End
bool outputsCollapsed() const;
%Docstring
Returns true if the list of outputs for this algorithm should be collapsed
in the graphical modeller.
.. seealso:: setParametersCollapsed()
.. seealso:: parametersCollapsed()
:rtype: bool
%End
void setOutputsCollapsed( bool collapsed );
%Docstring
Sets whether the list of outputs for this algorithm should be collapsed
in the graphical modeller.
.. seealso:: outputsCollapsed()
.. seealso:: setParametersCollapsed()
%End
QMap<QString, QgsProcessingModelAlgorithm::ModelOutput> modelOutputs() const;
%Docstring
Returns the map of final model outputs which are generated by this child algorithm.
The keys are the output names from this child algorithm. Only outputs which are
part of the final outputs from the model are included in this map.
.. seealso:: setModelOutputs()
.. seealso:: modelOutput()
:rtype: QMap<str, QgsProcessingModelAlgorithm.ModelOutput>
%End
QgsProcessingModelAlgorithm::ModelOutput &modelOutput( const QString &name );
%Docstring
Returns the final model output with matching ``name``. If no output
exists with the name, a new one will be created and returned.
If child model outputs are altered by this method, QgsProcessingModelAlgorithm.updateDestinationParameters()
must be called on the parent model.
.. seealso:: modelOutputs()
.. seealso:: setModelOutputs()
:rtype: QgsProcessingModelAlgorithm.ModelOutput
%End
void setModelOutputs( const QMap<QString, QgsProcessingModelAlgorithm::ModelOutput> &outputs );
%Docstring
Sets the map of final model ``outputs`` which are generated by this child algorithm.
Only outputs which are part of the final outputs from the model should be included in this map.
If child model outputs are altered by this method, QgsProcessingModelAlgorithm.updateDestinationParameters()
must be called on the parent model.
.. seealso:: modelOutputs()
%End
QVariant toVariant() const;
%Docstring
Saves this child to a QVariant.
.. seealso:: loadVariant()
:rtype: QVariant
%End
bool loadVariant( const QVariant &child );
%Docstring
Loads this child from a QVariant.
.. seealso:: toVariant()
:rtype: bool
%End
QString asPythonCode() const;
%Docstring
Attempts to convert the child to executable Python code.
:rtype: str
%End
};
QgsProcessingModelAlgorithm( const QString &name = QString(), const QString &group = QString() );
%Docstring
Constructor for QgsProcessingModelAlgorithm.
%End
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 ¶meters, QgsProcessingContext &context ) const;
virtual QgsProcessingModelAlgorithm *create() const /Factory/;
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, QgsProcessingModelAlgorithm::ChildAlgorithm> 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, QgsProcessingModelAlgorithm.ChildAlgorithm>
%End
void setChildAlgorithms( const QMap<QString, QgsProcessingModelAlgorithm::ChildAlgorithm> &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 QgsProcessingModelAlgorithm::ChildAlgorithm &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( QgsProcessingModelAlgorithm::ChildAlgorithm &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
QgsProcessingModelAlgorithm::ChildAlgorithm &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: QgsProcessingModelAlgorithm.ChildAlgorithm
%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 QgsProcessingModelAlgorithm::ModelParameter &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, QgsProcessingModelAlgorithm::ModelParameter> 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, QgsProcessingModelAlgorithm.ModelParameter>
%End
void setParameterComponents( const QMap<QString, QgsProcessingModelAlgorithm::ModelParameter> ¶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:: parameterComponents()
.. seealso:: setParameterComponent()
.. seealso:: parameterComponent()
%End
void setParameterComponent( const QgsProcessingModelAlgorithm::ModelParameter &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
QgsProcessingModelAlgorithm::ModelParameter ¶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:: parameterComponents()
.. seealso:: setParameterComponents()
.. seealso:: setParameterComponent()
:rtype: QgsProcessingModelAlgorithm.ModelParameter
%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< QgsProcessingModelAlgorithm::ChildParameterSource > 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.
:rtype: list of QgsProcessingModelAlgorithm.ChildParameterSource
%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, const QgsProcessingModelAlgorithm::ChildParameterSource &source, 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
QgsProcessingModelAlgorithm::ChildParameterSource 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 QVariantMap processAlgorithm( const QVariantMap ¶meters, QgsProcessingContext &context, QgsProcessingFeedback *feedback );
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/processing/qgsprocessingmodelalgorithm.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/