/
qgsprocessingparameters.sip.in
4104 lines (2888 loc) · 138 KB
/
qgsprocessingparameters.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
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
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/processing/qgsprocessingparameters.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsProcessingFeatureSourceDefinition
{
%Docstring
Encapsulates settings relating to a feature source input to a processing algorithm.
.. versionadded:: 3.0
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
enum Flag
{
FlagOverrideDefaultGeometryCheck,
FlagCreateIndividualOutputPerInputFeature,
};
typedef QFlags<QgsProcessingFeatureSourceDefinition::Flag> Flags;
QgsProcessingFeatureSourceDefinition( const QString &source = QString(), bool selectedFeaturesOnly = false, long long featureLimit = -1,
QgsProcessingFeatureSourceDefinition::Flags flags = QgsProcessingFeatureSourceDefinition::Flags(), QgsFeatureRequest::InvalidGeometryCheck geometryCheck = QgsFeatureRequest::GeometryAbortOnInvalid );
%Docstring
Constructor for QgsProcessingFeatureSourceDefinition, accepting a static string ``source``.
If ``selectedFeaturesOnly`` is ``True``, then only selected features from the source will be used.
The optional ``featureLimit`` can be set to a value > 0 to place a hard limit on the maximum number
of features which will be read from the source.
The ``flags`` argument can be used to specify flags which dictate the source behavior.
If the QgsProcessingFeatureSourceDefinition.Flag.FlagOverrideDefaultGeometryCheck is set in ``flags``, then the value of ``geometryCheck`` will override
the default geometry check method (as dictated by :py:class:`QgsProcessingContext`) for this source.
%End
QgsProcessingFeatureSourceDefinition( const QgsProperty &source, bool selectedFeaturesOnly = false, long long featureLimit = -1,
QgsProcessingFeatureSourceDefinition::Flags flags = QgsProcessingFeatureSourceDefinition::Flags(), QgsFeatureRequest::InvalidGeometryCheck geometryCheck = QgsFeatureRequest::GeometryAbortOnInvalid );
%Docstring
Constructor for QgsProcessingFeatureSourceDefinition, accepting a QgsProperty source.
If ``selectedFeaturesOnly`` is ``True``, then only selected features from the source will be used.
The optional ``featureLimit`` can be set to a value > 0 to place a hard limit on the maximum number
of features which will be read from the source.
The ``flags`` argument can be used to specify flags which dictate the source behavior.
If the QgsProcessingFeatureSourceDefinition.Flag.FlagOverrideDefaultGeometryCheck is set in ``flags``, then the value of ``geometryCheck`` will override
the default geometry check method (as dictated by :py:class:`QgsProcessingContext`) for this source.
%End
QgsProperty source;
bool selectedFeaturesOnly;
long long featureLimit;
Flags flags;
QgsFeatureRequest::InvalidGeometryCheck geometryCheck;
QVariant toVariant() const;
%Docstring
Saves this source definition to a QVariantMap, wrapped in a QVariant.
You can use QgsXmlUtils.writeVariant to save it to an XML document.
.. seealso:: :py:func:`loadVariant`
.. versionadded:: 3.14
%End
bool loadVariant( const QVariantMap &map );
%Docstring
Loads this source definition from a QVariantMap, wrapped in a QVariant.
You can use QgsXmlUtils.readVariant to load it from an XML document.
.. seealso:: :py:func:`toVariant`
.. versionadded:: 3.14
%End
bool operator==( const QgsProcessingFeatureSourceDefinition &other ) const;
bool operator!=( const QgsProcessingFeatureSourceDefinition &other ) const;
operator QVariant() const;
};
QFlags<QgsProcessingFeatureSourceDefinition::Flag> operator|(QgsProcessingFeatureSourceDefinition::Flag f1, QFlags<QgsProcessingFeatureSourceDefinition::Flag> f2);
class QgsProcessingOutputLayerDefinition
{
%Docstring
Encapsulates settings relating to a feature sink or output raster layer for a processing algorithm.
.. versionadded:: 3.0
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
QgsProcessingOutputLayerDefinition( const QString &sink = QString(), QgsProject *destinationProject = 0 );
%Docstring
Constructor for QgsProcessingOutputLayerDefinition, accepting a static sink/layer string.
The ``destinationProject`` parameter can be set to a QgsProject instance in which
to automatically load the resulting sink/layer after completing processing.
%End
QgsProcessingOutputLayerDefinition( const QgsProperty &sink, QgsProject *destinationProject = 0 );
%Docstring
Constructor for QgsProcessingOutputLayerDefinition, accepting a QgsProperty sink/layer.
The ``destinationProject`` parameter can be set to a QgsProject instance in which
to automatically load the resulting sink/layer after completing processing.
%End
QgsProperty sink;
QgsProject *destinationProject;
QString destinationName;
QVariantMap createOptions;
bool useRemapping() const;
%Docstring
Returns ``True`` if the output uses a remapping definition.
.. seealso:: :py:func:`remappingDefinition`
.. versionadded:: 3.14
%End
QgsRemappingSinkDefinition remappingDefinition() const;
%Docstring
Returns the output remapping definition, if :py:func:`~QgsProcessingOutputLayerDefinition.useRemapping` is ``True``.
.. seealso:: :py:func:`useRemapping`
.. seealso:: :py:func:`setRemappingDefinition`
.. versionadded:: 3.14
%End
void setRemappingDefinition( const QgsRemappingSinkDefinition &definition );
%Docstring
Sets the remapping ``definition`` to use when adding features to the output layer.
Calling this method will set :py:func:`~QgsProcessingOutputLayerDefinition.useRemapping` to ``True``.
.. seealso:: :py:func:`remappingDefinition`
.. seealso:: :py:func:`useRemapping`
.. versionadded:: 3.14
%End
QVariant toVariant() const;
%Docstring
Saves this output layer definition to a QVariantMap, wrapped in a QVariant.
You can use QgsXmlUtils.writeVariant to save it to an XML document.
.. seealso:: :py:func:`loadVariant`
.. versionadded:: 3.2
%End
bool loadVariant( const QVariantMap &map );
%Docstring
Loads this output layer definition from a QVariantMap, wrapped in a QVariant.
You can use QgsXmlUtils.readVariant to load it from an XML document.
.. seealso:: :py:func:`toVariant`
.. versionadded:: 3.2
%End
operator QVariant() const;
bool operator==( const QgsProcessingOutputLayerDefinition &other ) const;
bool operator!=( const QgsProcessingOutputLayerDefinition &other ) const;
};
class QgsProcessingParameterDefinition
{
%Docstring
Base class for the definition of processing parameters.
Parameter definitions encapsulate properties regarding the behavior of parameters,
their acceptable ranges, defaults, etc.
.. versionadded:: 3.0
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
%ConvertToSubClassCode
if ( sipCpp->type() == QgsProcessingParameterBoolean::typeName() )
sipType = sipType_QgsProcessingParameterBoolean;
else if ( sipCpp->type() == QgsProcessingParameterCrs::typeName() )
sipType = sipType_QgsProcessingParameterCrs;
else if ( sipCpp->type() == QgsProcessingParameterMapLayer::typeName() )
sipType = sipType_QgsProcessingParameterMapLayer;
else if ( sipCpp->type() == QgsProcessingParameterExtent::typeName() )
sipType = sipType_QgsProcessingParameterExtent;
else if ( sipCpp->type() == QgsProcessingParameterPoint::typeName() )
sipType = sipType_QgsProcessingParameterPoint;
else if ( sipCpp->type() == QgsProcessingParameterFile::typeName() )
sipType = sipType_QgsProcessingParameterFile;
else if ( sipCpp->type() == QgsProcessingParameterMatrix::typeName() )
sipType = sipType_QgsProcessingParameterMatrix;
else if ( sipCpp->type() == QgsProcessingParameterMultipleLayers::typeName() )
sipType = sipType_QgsProcessingParameterMultipleLayers;
else if ( sipCpp->type() == QgsProcessingParameterNumber::typeName() )
sipType = sipType_QgsProcessingParameterNumber;
else if ( sipCpp->type() == QgsProcessingParameterDistance::typeName() )
sipType = sipType_QgsProcessingParameterDistance;
else if ( sipCpp->type() == QgsProcessingParameterScale::typeName() )
sipType = sipType_QgsProcessingParameterScale;
else if ( sipCpp->type() == QgsProcessingParameterRange::typeName() )
sipType = sipType_QgsProcessingParameterRange;
else if ( sipCpp->type() == QgsProcessingParameterRasterLayer::typeName() )
sipType = sipType_QgsProcessingParameterRasterLayer;
else if ( sipCpp->type() == QgsProcessingParameterMeshLayer::typeName() )
sipType = sipType_QgsProcessingParameterMeshLayer;
else if ( sipCpp->type() == QgsProcessingParameterEnum::typeName() )
sipType = sipType_QgsProcessingParameterEnum;
else if ( sipCpp->type() == QgsProcessingParameterString::typeName() )
sipType = sipType_QgsProcessingParameterString;
else if ( sipCpp->type() == QgsProcessingParameterExpression::typeName() )
sipType = sipType_QgsProcessingParameterExpression;
else if ( sipCpp->type() == QgsProcessingParameterAuthConfig::typeName() )
sipType = sipType_QgsProcessingParameterAuthConfig;
else if ( sipCpp->type() == QgsProcessingParameterVectorLayer::typeName() )
sipType = sipType_QgsProcessingParameterVectorLayer;
else if ( sipCpp->type() == QgsProcessingParameterField::typeName() )
sipType = sipType_QgsProcessingParameterField;
else if ( sipCpp->type() == QgsProcessingParameterFeatureSource::typeName() )
sipType = sipType_QgsProcessingParameterFeatureSource;
else if ( sipCpp->type() == QgsProcessingParameterFeatureSink::typeName() )
sipType = sipType_QgsProcessingParameterFeatureSink;
else if ( sipCpp->type() == QgsProcessingParameterVectorDestination::typeName() )
sipType = sipType_QgsProcessingParameterVectorDestination;
else if ( sipCpp->type() == QgsProcessingParameterRasterDestination::typeName() )
sipType = sipType_QgsProcessingParameterRasterDestination;
else if ( sipCpp->type() == QgsProcessingParameterFileDestination::typeName() )
sipType = sipType_QgsProcessingParameterFileDestination;
else if ( sipCpp->type() == QgsProcessingParameterFolderDestination::typeName() )
sipType = sipType_QgsProcessingParameterFolderDestination;
else if ( sipCpp->type() == QgsProcessingParameterBand::typeName() )
sipType = sipType_QgsProcessingParameterBand;
else if ( sipCpp->type() == QgsProcessingParameterLayout::typeName() )
sipType = sipType_QgsProcessingParameterLayout;
else if ( sipCpp->type() == QgsProcessingParameterLayoutItem::typeName() )
sipType = sipType_QgsProcessingParameterLayoutItem;
else if ( sipCpp->type() == QgsProcessingParameterColor::typeName() )
sipType = sipType_QgsProcessingParameterColor;
else if ( sipCpp->type() == QgsProcessingParameterCoordinateOperation::typeName() )
sipType = sipType_QgsProcessingParameterCoordinateOperation;
else if ( sipCpp->type() == QgsProcessingParameterMapTheme::typeName() )
sipType = sipType_QgsProcessingParameterMapTheme;
else if ( sipCpp->type() == QgsProcessingParameterDateTime::typeName() )
sipType = sipType_QgsProcessingParameterDateTime;
else if ( sipCpp->type() == QgsProcessingParameterProviderConnection::typeName() )
sipType = sipType_QgsProcessingParameterProviderConnection;
else if ( sipCpp->type() == QgsProcessingParameterDatabaseSchema::typeName() )
sipType = sipType_QgsProcessingParameterDatabaseSchema;
else if ( sipCpp->type() == QgsProcessingParameterDatabaseTable::typeName() )
sipType = sipType_QgsProcessingParameterDatabaseTable;
else if ( sipCpp->type() == QgsProcessingParameterFieldMapping::typeName() )
sipType = sipType_QgsProcessingParameterFieldMapping;
else
sipType = nullptr;
%End
public:
enum Flag
{
FlagAdvanced,
FlagHidden,
FlagOptional,
FlagIsModelOutput,
};
typedef QFlags<QgsProcessingParameterDefinition::Flag> Flags;
QgsProcessingParameterDefinition( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
bool optional = false );
%Docstring
Constructor for QgsProcessingParameterDefinition.
%End
virtual ~QgsProcessingParameterDefinition();
virtual QgsProcessingParameterDefinition *clone() const = 0 /Factory/;
%Docstring
Creates a clone of the parameter definition.
%End
virtual QString type() const = 0;
%Docstring
Unique parameter type name.
%End
virtual bool isDestination() const;
%Docstring
Returns ``True`` if this parameter represents a file or layer destination, e.g. parameters
which are used for the destination for layers output by an algorithm will return
``True``.
%End
QString name() const;
%Docstring
Returns the name of the parameter. This is the internal identifier by which
algorithms access this parameter.
.. seealso:: :py:func:`setName`
%End
void setName( const QString &name );
%Docstring
Sets the ``name`` of the parameter. This is the internal identifier by which
algorithms access this parameter.
.. seealso:: :py:func:`name`
%End
QString description() const;
%Docstring
Returns the description for the parameter. This is the user-visible string
used to identify this parameter.
.. seealso:: :py:func:`setDescription`
%End
void setDescription( const QString &description );
%Docstring
Sets the ``description`` for the parameter. This is the user-visible string
used to identify this parameter.
.. seealso:: :py:func:`description`
%End
QVariant defaultValue() const;
%Docstring
Returns the default value for the parameter.
.. seealso:: :py:func:`setDefaultValue`
%End
void setDefaultValue( const QVariant &value );
%Docstring
Sets the default ``value`` for the parameter. Caller takes responsibility
to ensure that ``value`` is a valid input for the parameter subclass.
.. seealso:: :py:func:`defaultValue`
%End
Flags flags() const;
%Docstring
Returns any flags associated with the parameter.
.. seealso:: :py:func:`setFlags`
%End
void setFlags( Flags flags );
%Docstring
Sets the ``flags`` associated with the parameter.
.. seealso:: :py:func:`flags`
%End
virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
%Docstring
Checks whether the specified ``input`` value is acceptable for the
parameter. Returns ``True`` if the value can be accepted.
The optional ``context`` parameter can be specified to allow a more stringent
check to be performed, capable of checking for the presence of required
layers and other factors within the context.
%End
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
%Docstring
Returns a string version of the parameter input ``value``, which is suitable for use as an input
parameter value when running an algorithm directly from a Python command.
%End
virtual QString asScriptCode() const;
%Docstring
Returns the parameter definition encoded in a string which can be used within a
Processing script.
%End
virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const;
%Docstring
Returns the parameter definition as a Python command which can be used within a
Python Processing script.
The ``outputType`` argument specifies the desired output format for the Python string,
i.e. the intended end use of the generated Python code.
.. versionadded:: 3.6
%End
virtual QVariantMap toVariantMap() const;
%Docstring
Saves this parameter to a QVariantMap. Subclasses should ensure that they call the base class
method and then extend the result with additional properties.
.. seealso:: :py:func:`fromVariantMap`
%End
virtual bool fromVariantMap( const QVariantMap &map );
%Docstring
Restores this parameter to a QVariantMap. Subclasses should ensure that they call the base class
method.
.. seealso:: :py:func:`toVariantMap`
%End
QVariantMap &metadata();
%Docstring
Returns the parameter's freeform metadata. This is mostly used by parameter widget wrappers
in order to customize their appearance and behavior.
.. seealso:: :py:func:`setMetadata`
%End
void setMetadata( const QVariantMap &metadata );
%Docstring
Sets the parameter's freeform ``metadata``. This is mostly used by parameter widget wrappers
in order to customize their appearance and behavior.
.. seealso:: :py:func:`metadata`
%End
virtual QStringList dependsOnOtherParameters() const;
%Docstring
Returns a list of other parameter names on which this parameter is dependent (e.g.
field parameters which depend on a parent layer parameter).
%End
QgsProcessingAlgorithm *algorithm() const;
%Docstring
Returns a pointer to the algorithm which owns this parameter. May be ``None``
for non-owned parameters.
.. seealso:: :py:func:`provider`
%End
QgsProcessingProvider *provider() const;
%Docstring
Returns a pointer to the provider for the algorithm which owns this parameter. May be ``None``
for non-owned parameters or algorithms.
.. seealso:: :py:func:`algorithm`
%End
virtual QString toolTip() const;
%Docstring
Returns a formatted tooltip for use with the parameter, which gives helpful information
like parameter description, ID, and extra content like default values (depending on parameter type).
%End
bool isDynamic() const;
%Docstring
Returns ``True`` if the parameter supports is dynamic, and can support data-defined values
(i.e. QgsProperty based values).
.. seealso:: :py:func:`setIsDynamic`
.. seealso:: :py:func:`dynamicPropertyDefinition`
.. seealso:: :py:func:`dynamicLayerParameterName`
%End
void setIsDynamic( bool dynamic );
%Docstring
Sets whether the parameter is ``dynamic``, and can support data-defined values
(i.e. QgsProperty based values).
.. seealso:: :py:func:`isDynamic`
.. seealso:: :py:func:`setDynamicPropertyDefinition`
.. seealso:: :py:func:`setDynamicLayerParameterName`
%End
QgsPropertyDefinition dynamicPropertyDefinition() const;
%Docstring
Returns the property definition for dynamic properties.
.. seealso:: :py:func:`isDynamic`
.. seealso:: :py:func:`setDynamicPropertyDefinition`
.. seealso:: :py:func:`dynamicLayerParameterName`
%End
void setDynamicPropertyDefinition( const QgsPropertyDefinition &definition );
%Docstring
Sets the property ``definition`` for dynamic properties.
.. seealso:: :py:func:`isDynamic`
.. seealso:: :py:func:`dynamicPropertyDefinition`
.. seealso:: :py:func:`setDynamicLayerParameterName`
%End
QString dynamicLayerParameterName() const;
%Docstring
Returns the name of the parameter for a layer linked to a dynamic parameter, or an empty string if this is not set.
Dynamic parameters (see :py:func:`~QgsProcessingParameterDefinition.isDynamic`) can have an optional vector layer parameter linked to them,
which indicates which layer the fields and values will be available from when evaluating
the dynamic parameter.
.. seealso:: :py:func:`setDynamicLayerParameterName`
.. seealso:: :py:func:`isDynamic`
.. seealso:: :py:func:`dynamicPropertyDefinition`
%End
void setDynamicLayerParameterName( const QString &name );
%Docstring
Sets the ``name`` for the parameter for a layer linked to a dynamic parameter, or an empty string if this is not set.
Dynamic parameters (see :py:func:`~QgsProcessingParameterDefinition.isDynamic`) can have an optional vector layer parameter linked to them,
which indicates which layer the fields and values will be available from when evaluating
the dynamic parameter.
.. seealso:: :py:func:`dynamicLayerParameterName`
.. seealso:: :py:func:`isDynamic`
.. seealso:: :py:func:`setDynamicPropertyDefinition`
%End
QStringList additionalExpressionContextVariables() const;
%Docstring
Returns a list of additional expression context variables which are available for use when evaluating
this parameter.
The additional variables will be added to the variables exposed from the usual expression
context available to the parameter. They can be used to expose variables which are ONLY available
to this parameter.
The returned list should contain the variable names only, without the usual "@" prefix.
.. seealso:: :py:func:`setAdditionalExpressionContextVariables`
.. versionadded:: 3.8
%End
void setAdditionalExpressionContextVariables( const QStringList &variables );
%Docstring
Sets a list of additional expression context ``variables`` which are available for use when evaluating
this parameter.
The additional variables will be added to the variables exposed from the usual expression
context available to the parameter. They can be used to expose variables which are ONLY available
to this parameter.
The ``variables`` list should contain the variable names only, without the usual "@" prefix.
.. note::
Specifying variables via this method is for metadata purposes only. It is the algorithm's responsibility
to correctly set the value of these additional variables in all expression context used when evaluating the parameter,
in whichever way is appropriate for that particular variable.
.. seealso:: :py:func:`additionalExpressionContextVariables`
.. versionadded:: 3.8
%End
protected:
};
QFlags<QgsProcessingParameterDefinition::Flag> operator|(QgsProcessingParameterDefinition::Flag f1, QFlags<QgsProcessingParameterDefinition::Flag> f2);
typedef QList< const QgsProcessingParameterDefinition * > QgsProcessingParameterDefinitions;
class QgsProcessingParameters
{
%Docstring
A collection of utilities for working with parameters when running a processing algorithm.
Parameters are stored in a QVariantMap and referenced by a unique string key.
The QVariants in parameters are not usually accessed
directly, and instead the high level API provided through :py:class:`QgsProcessingParameters`
:py:func:`~QgsProcessingParameterDefinition.parameterAsString`, :py:func:`~QgsProcessingParameterDefinition.parameterAsDouble` are used instead.
Parameters are evaluated using a provided :py:class:`QgsProcessingContext`, allowing
the evaluation to understand available map layers and expression contexts
(for expression based parameters).
.. versionadded:: 3.0
%End
%TypeHeaderCode
#include "qgsprocessingparameters.h"
%End
public:
static bool isDynamic( const QVariantMap ¶meters, const QString &name );
%Docstring
Returns ``True`` if the parameter with matching ``name`` is a dynamic parameter, and must
be evaluated once for every input feature processed.
%End
static QString parameterAsString( const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to a static string value.
%End
static QString parameterAsString( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to a static string value.
.. versionadded:: 3.4
%End
static QString parameterAsExpression( const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to an expression.
%End
static QString parameterAsExpression( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definitionand`` ``value`` to an expression.
.. versionadded:: 3.4
%End
static double parameterAsDouble( const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to a static double value.
%End
static double parameterAsDouble( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to a static double value.
.. versionadded:: 3.4
%End
static int parameterAsInt( const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to a static integer value.
%End
static int parameterAsInt( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to a static integer value.
.. versionadded:: 3.4
%End
static QList<int> parameterAsInts( const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to a list of integer values.
.. versionadded:: 3.4
%End
static QList<int> parameterAsInts( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to a list of integer values.
.. versionadded:: 3.4
%End
static QDateTime parameterAsDateTime( const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to a static datetime value.
.. seealso:: :py:func:`parameterAsDate`
.. seealso:: :py:func:`parameterAsTime`
.. versionadded:: 3.14
%End
static QDateTime parameterAsDateTime( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to a static datetime value.
.. seealso:: :py:func:`parameterAsDate`
.. seealso:: :py:func:`parameterAsTime`
.. versionadded:: 3.14
%End
static QDate parameterAsDate( const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to a static date value.
.. seealso:: :py:func:`parameterAsDateTime`
.. seealso:: :py:func:`parameterAsTime`
.. versionadded:: 3.14
%End
static QDate parameterAsDate( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to a static date value.
.. seealso:: :py:func:`parameterAsDateTime`
.. seealso:: :py:func:`parameterAsTime`
.. versionadded:: 3.14
%End
static QTime parameterAsTime( const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to a static time value.
.. seealso:: :py:func:`parameterAsDateTime`
.. seealso:: :py:func:`parameterAsDate`
.. versionadded:: 3.14
%End
static QTime parameterAsTime( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to a static time value.
.. seealso:: :py:func:`parameterAsDateTime`
.. seealso:: :py:func:`parameterAsDate`
.. versionadded:: 3.14
%End
static int parameterAsEnum( const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to a enum value.
%End
static int parameterAsEnum( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to a enum value.
.. versionadded:: 3.4
%End
static QList<int> parameterAsEnums( const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to list of enum values.
%End
static QList<int> parameterAsEnums( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to list of enum values.
.. versionadded:: 3.4
%End
static bool parameterAsBool( const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to a static boolean value.
%End
static bool parameterAsBoolean( const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to a static boolean value.
.. versionadded:: 3.8
%End
static bool parameterAsBool( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to a static boolean value.
.. versionadded:: 3.4
%End
static bool parameterAsBoolean( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to a static boolean value.
.. versionadded:: 3.8
%End
static QgsFeatureSink *parameterAsSink( const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters,
const QgsFields &fields, QgsWkbTypes::Type geometryType, const QgsCoordinateReferenceSystem &crs,
QgsProcessingContext &context, QString &destinationIdentifier /Out/, QgsFeatureSink::SinkFlags sinkFlags = QgsFeatureSink::SinkFlags() ) /Factory/;
%Docstring
Evaluates the parameter with matching ``definition`` to a feature sink.
The ``fields``, ``geometryType`` and ``crs`` parameters dictate the properties
of the resulting feature sink.
Sinks will either be taken from ``context``'s active project, or created from external
providers and stored temporarily in the ``context``. The ``destinationIdentifier``
argument will be set to a string which can be used to retrieve the layer corresponding
to the sink, e.g. via calling :py:func:`QgsProcessingUtils.mapLayerFromString()`.
This function creates a new object and the caller takes responsibility for deleting the returned object.
%End
static QgsFeatureSink *parameterAsSink( const QgsProcessingParameterDefinition *definition, const QVariant &value,
const QgsFields &fields, QgsWkbTypes::Type geometryType, const QgsCoordinateReferenceSystem &crs,
QgsProcessingContext &context, QString &destinationIdentifier /Out/, QgsFeatureSink::SinkFlags sinkFlags = QgsFeatureSink::SinkFlags() ) throw( QgsProcessingException ) /Factory/;
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to a feature sink.
The ``fields``, ``geometryType`` and ``crs`` parameters dictate the properties
of the resulting feature sink.
Sinks will either be taken from ``context``'s active project, or created from external
providers and stored temporarily in the ``context``. The ``destinationIdentifier``
argument will be set to a string which can be used to retrieve the layer corresponding
to the sink, e.g. via calling :py:func:`QgsProcessingUtils.mapLayerFromString()`.
This function creates a new object and the caller takes responsibility for deleting the returned object.
:raises :: py:class:`QgsProcessingException`
.. versionadded:: 3.4
%End
static QgsProcessingFeatureSource *parameterAsSource( const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context ) /Factory/;
%Docstring
Evaluates the parameter with matching ``definition`` to a feature source.
Sources will either be taken from ``context``'s active project, or loaded from external
sources and stored temporarily in the ``context``.
This function creates a new object and the caller takes responsibility for deleting the returned object.
%End
static QgsProcessingFeatureSource *parameterAsSource( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context ) /Factory/;
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to a feature source.
Sources will either be taken from ``context``'s active project, or loaded from external
sources and stored temporarily in the ``context``.
This function creates a new object and the caller takes responsibility for deleting the returned object.
.. versionadded:: 3.4
%End
static QString parameterAsCompatibleSourceLayerPath( const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters,
QgsProcessingContext &context, const QStringList &compatibleFormats, const QString &preferredFormat = QString( "shp" ), QgsProcessingFeedback *feedback = 0 );
%Docstring
Evaluates the parameter with matching ``definition`` to a source vector layer file path of compatible format.
If the parameter is evaluated to an existing layer, and that layer is not of the format listed in the
``compatibleFormats`` argument, then the layer will first be exported to a compatible format
in a temporary location. The function will then return the path to that temporary file.
``compatibleFormats`` should consist entirely of lowercase file extensions, e.g. 'shp'.
The ``preferredFormat`` argument is used to specify to desired file extension to use when a temporary
layer export is required. This defaults to shapefiles, because shapefiles are the future (don't believe the geopackage hype!).
When an algorithm is capable of handling multi-layer input files (such as Geopackage), it is preferable
to use :py:func:`~QgsProcessingParameters.parameterAsCompatibleSourceLayerPathAndLayerName` which may avoid conversion in more situations.
%End
static QString parameterAsCompatibleSourceLayerPathAndLayerName( const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters,
QgsProcessingContext &context, const QStringList &compatibleFormats, const QString &preferredFormat = QString( "shp" ), QgsProcessingFeedback *feedback = 0, QString *layerName /Out/ = 0 );
%Docstring
Evaluates the parameter with matching ``definition`` to a source vector layer file path and layer name of compatible format.
If the parameter is evaluated to an existing layer, and that layer is not of the format listed in the
``compatibleFormats`` argument, then the layer will first be exported to a compatible format
in a temporary location. The function will then return the path to that temporary file.
``compatibleFormats`` should consist entirely of lowercase file extensions, e.g. 'shp'.
The ``preferredFormat`` argument is used to specify to desired file extension to use when a temporary
layer export is required. This defaults to shapefiles, because shapefiles are the future (don't believe the geopackage hype!).
This method should be preferred over :py:func:`~QgsProcessingParameters.parameterAsCompatibleSourceLayerPath` when an algorithm is able
to correctly handle files with multiple layers. Unlike :py:func:`~QgsProcessingParameters.parameterAsCompatibleSourceLayerPath`, it will not force
a conversion in this case and will return the target layer name in the ``layerName`` argument.
:param definition: associated parameter definition
:param parameters: input parameter value map
:param context: processing context
:param compatibleFormats: a list of lowercase file extensions compatible with the algorithm
:param preferredFormat: preferred format extension to use if conversion if required
:param feedback: feedback object
:return: - path to source layer, or nearly converted compatible layer
- layerName: will be set to the target layer name for multi-layer sources (e.g. Geopackage)
.. seealso:: :py:func:`parameterAsCompatibleSourceLayerPath`
.. versionadded:: 3.10
%End
static QgsMapLayer *parameterAsLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, QgsProcessingUtils::LayerHint layerHint = QgsProcessingUtils::LayerHint::UnknownType );
%Docstring
Evaluates the parameter with matching ``definition`` to a map layer.
Layers will either be taken from ``context``'s active project, or loaded from external
sources and stored temporarily in the ``context``. In either case, callers do not
need to handle deletion of the returned layer.
%End
static QgsMapLayer *parameterAsLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context, QgsProcessingUtils::LayerHint layerHint = QgsProcessingUtils::LayerHint::UnknownType );
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to a map layer.
Layers will either be taken from ``context``'s active project, or loaded from external
sources and stored temporarily in the ``context``. In either case, callers do not
need to handle deletion of the returned layer.
.. versionadded:: 3.4
%End
static QgsRasterLayer *parameterAsRasterLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to a raster layer.
Layers will either be taken from ``context``'s active project, or loaded from external
sources and stored temporarily in the ``context``. In either case, callers do not
need to handle deletion of the returned layer.
%End
static QgsRasterLayer *parameterAsRasterLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to a raster layer.
Layers will either be taken from ``context``'s active project, or loaded from external
sources and stored temporarily in the ``context``. In either case, callers do not
need to handle deletion of the returned layer.
.. versionadded:: 3.4
%End
static QString parameterAsOutputLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` to a output layer destination.
%End
static QString parameterAsOutputLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``definition`` and ``value`` to a output layer destination.
.. versionadded:: 3.4
%End