File: qgsprocessingalgorithm.sip.in

package info (click to toggle)
qgis 3.40.11%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,183,800 kB
  • sloc: cpp: 1,595,841; python: 372,637; xml: 23,474; sh: 3,761; perl: 3,664; ansic: 2,257; sql: 2,137; yacc: 1,068; lex: 577; javascript: 540; lisp: 411; makefile: 154
file content (1479 lines) | stat: -rw-r--r-- 58,092 bytes parent folder | download | duplicates (14)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/processing/qgsprocessingalgorithm.h                         *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/





%ModuleHeaderCode
#include <qgsprocessingmodelalgorithm.h>
%End

class QgsProcessingAlgorithm
{
%Docstring(signature="appended")
Abstract base class for processing algorithms.
%End

%TypeHeaderCode
#include "qgsprocessingalgorithm.h"
%End
%ConvertToSubClassCode
    if ( dynamic_cast< QgsProcessingModelAlgorithm * >( sipCpp ) != NULL )
      sipType = sipType_QgsProcessingModelAlgorithm;
    else if ( dynamic_cast< QgsProcessingFeatureBasedAlgorithm * >( sipCpp ) != NULL )
      sipType = sipType_QgsProcessingFeatureBasedAlgorithm;
    else
      sipType = sipType_QgsProcessingAlgorithm;
%End
  public:

    QgsProcessingAlgorithm();
%Docstring
Constructor for QgsProcessingAlgorithm.

:py:func:`~QgsProcessingAlgorithm.initAlgorithm` should be called after
creating an algorithm to ensure it can correctly configure its
:py:func:`~QgsProcessingAlgorithm.parameterDefinitions` and
:py:func:`~QgsProcessingAlgorithm.outputDefinitions`. Alternatively,
calling :py:func:`~QgsProcessingAlgorithm.create` will return a
pre-initialized copy of the algorithm.
%End

    virtual ~QgsProcessingAlgorithm();



    QgsProcessingAlgorithm *create( const QVariantMap &configuration = QVariantMap() ) const throw( QgsProcessingException ) /TransferBack/;
%Docstring
Creates a copy of the algorithm, ready for execution.

This method returns a new, preinitialized copy of the algorithm, ready
for executing.

The ``configuration`` argument allows passing of a map of configuration
settings to the algorithm, allowing it to dynamically adjust its
initialized parameters and outputs according to this configuration. This
is generally used only for algorithms in a model, allowing them to
adjust their behavior at run time according to some user configuration.

Raises a :py:class:`QgsProcessingException` if a new algorithm instance
could not be created, e.g. if there is an issue with the subclass'
:py:func:`~QgsProcessingAlgorithm.createInstance` method.

.. seealso:: :py:func:`initAlgorithm`
%End

    virtual QString name() const = 0 /HoldGIL/;
%Docstring
Returns the algorithm name, used for identifying the algorithm. This
string should be fixed for the algorithm, and must not be localised. The
name should be unique within each provider. Names should contain
lowercase alphanumeric characters only and no spaces or other formatting
characters.

.. seealso:: :py:func:`displayName`

.. seealso:: :py:func:`group`

.. seealso:: :py:func:`tags`
%End

    QString id() const /HoldGIL/;
%Docstring
Returns the unique ID for the algorithm, which is a combination of the
algorithm provider's ID and the algorithms unique name (e.g.
"qgis:mergelayers" ).

.. seealso:: :py:func:`name`

.. seealso:: :py:func:`provider`
%End

    virtual QString displayName() const = 0 /HoldGIL/;
%Docstring
Returns the translated algorithm name, which should be used for any
user-visible display of the algorithm name.

Algorithm display names should be short, e.g. ideally no more than 3 or
4 words. The name should use sentence case (e.g. "Raster layer
statistics", not "Raster Layer Statistics").

.. seealso:: :py:func:`name`

.. seealso:: :py:func:`shortDescription`
%End

    virtual QString shortDescription() const /HoldGIL/;
%Docstring
Returns an optional translated short description of the algorithm. This
should be at most a single sentence, e.g. "Converts 2D features to 3D by
sampling a DEM raster."

.. versionadded:: 3.2
%End

    virtual QStringList tags() const /HoldGIL/;
%Docstring
Returns a list of tags which relate to the algorithm, and are used to
assist users in searching for suitable algorithms. These tags should be
localised.
%End

    virtual QString shortHelpString() const /HoldGIL/;
%Docstring
Returns a localised short helper string for the algorithm. This string
should provide a basic description about what the algorithm does and the
parameters and outputs associated with it.

.. seealso:: :py:func:`helpString`

.. seealso:: :py:func:`helpUrl`
%End

 virtual QString helpString() const /HoldGIL,Deprecated/;
%Docstring
Returns a localised help string for the algorithm. Algorithm subclasses
should implement either :py:func:`~QgsProcessingAlgorithm.helpString` or
:py:func:`~QgsProcessingAlgorithm.helpUrl`.

.. seealso:: :py:func:`helpUrl`

.. seealso:: :py:func:`shortHelpString`

.. deprecated:: 3.40

   Unused, will be removed in QGIS 4.0.
%End

    virtual QString helpUrl() const /HoldGIL/;
%Docstring
Returns a url pointing to the algorithm's help page.

.. seealso:: :py:func:`helpString`

.. seealso:: :py:func:`shortHelpString`
%End

    virtual Qgis::ProcessingAlgorithmDocumentationFlags documentationFlags() const /HoldGIL/;
%Docstring
Returns the flags describing algorithm behavior for documentation
purposes.

The default is to return no flags.

.. versionadded:: 3.40
%End

    virtual QIcon icon() const /HoldGIL/;
%Docstring
Returns an icon for the algorithm.

.. seealso:: :py:func:`svgIconPath`
%End

    virtual QString svgIconPath() const /HoldGIL/;
%Docstring
Returns a path to an SVG version of the algorithm's icon.

.. seealso:: :py:func:`icon`
%End

    virtual QString group() const /HoldGIL/;
%Docstring
Returns the name of the group this algorithm belongs to. This string
should be localised.

.. seealso:: :py:func:`groupId`

.. seealso:: :py:func:`tags`
%End

    virtual QString groupId() const /HoldGIL/;
%Docstring
Returns the unique ID of the group this algorithm belongs to. This
string should be fixed for the algorithm, and must not be localised. The
group id should be unique within each provider. Group id should contain
lowercase alphanumeric characters only and no spaces or other formatting
characters.

.. seealso:: :py:func:`group`
%End

    virtual Qgis::ProcessingAlgorithmFlags flags() const /HoldGIL/;
%Docstring
Returns the flags indicating how and when the algorithm operates and
should be exposed to users. Default flags are FlagSupportsBatch and
FlagCanCancel.
%End

    virtual bool canExecute( QString *errorMessage /Out/ = 0 ) const;
%Docstring
Returns ``True`` if the algorithm can execute. Algorithm subclasses can
return ``False`` here to indicate that they are not able to execute,
e.g. as a result of unmet external dependencies. If specified, the
``errorMessage`` argument will be filled with a localised error message
describing why the algorithm cannot execute.
%End

    virtual bool checkParameterValues( const QVariantMap &parameters,
                                       QgsProcessingContext &context, QString *message /Out/ = 0 ) const;
%Docstring
Checks the supplied ``parameter`` values to verify that they satisfy the
requirements of this algorithm in the supplied ``context``. The
``message`` parameter will be filled with explanatory text if validation
fails. Overridden implementations should also check this base class
implementation.

:return: ``True`` if parameters are acceptable for the algorithm.
%End

    virtual QVariantMap preprocessParameters( const QVariantMap &parameters );
%Docstring
Pre-processes a set of ``parameters``, allowing the algorithm to clean
their values.

This method is automatically called after users enter parameters, e.g.
via the algorithm dialog. This method should NOT be called manually by
algorithms.
%End

    QgsProcessingProvider *provider() const /HoldGIL/;
%Docstring
Returns the provider to which this algorithm belongs.
%End

    QgsProcessingParameterDefinitions parameterDefinitions() const /HoldGIL/;
%Docstring
Returns an ordered list of parameter definitions utilized by the
algorithm.

.. seealso:: :py:func:`addParameter`

.. seealso:: :py:func:`parameterDefinition`

.. seealso:: :py:func:`destinationParameterDefinitions`
%End

    const QgsProcessingParameterDefinition *parameterDefinition( const QString &name ) const /HoldGIL/;
%Docstring
Returns a matching parameter by ``name``. Matching is done in a
case-insensitive manner, but exact case matches will be preferred.

.. seealso:: :py:func:`parameterDefinitions`
%End

    int countVisibleParameters() const /HoldGIL/;
%Docstring
Returns the number of visible (non-hidden) parameters defined by this
algorithm.
%End

    QgsProcessingParameterDefinitions destinationParameterDefinitions() const /HoldGIL/;
%Docstring
Returns a list of destination parameters definitions utilized by the
algorithm.

.. seealso:: :py:func:`QgsProcessingParameterDefinition.isDestination`

.. seealso:: :py:func:`parameterDefinitions`
%End

    QgsProcessingOutputDefinitions outputDefinitions() const /HoldGIL/;
%Docstring
Returns an ordered list of output definitions utilized by the algorithm.

.. seealso:: :py:func:`addOutput`

.. seealso:: :py:func:`outputDefinition`
%End

    const QgsProcessingOutputDefinition *outputDefinition( const QString &name ) const /HoldGIL/;
%Docstring
Returns a matching output by ``name``. Matching is done in a
case-insensitive manner.

.. seealso:: :py:func:`outputDefinitions`
%End

    bool hasHtmlOutputs() const /HoldGIL/;
%Docstring
Returns ``True`` if this algorithm generates HTML outputs.
%End


    struct VectorProperties
    {
      QgsFields fields;

      Qgis::WkbType wkbType;

      QgsCoordinateReferenceSystem crs;

      Qgis::ProcessingPropertyAvailability availability;
    };

    virtual QgsProcessingAlgorithm::VectorProperties sinkProperties( const QString &sink,
        const QVariantMap &parameters,
        QgsProcessingContext &context,
        const QMap< QString, QgsProcessingAlgorithm::VectorProperties > &sourceProperties ) const;
%Docstring
Returns the vector properties which will be used for the ``sink`` with
matching name.

The ``parameters`` argument specifies the values of all parameters which
would be used to generate the sink. These can be used alongside the
provided ``context`` in order to pre-evaluate inputs when required in
order to determine the sink's properties.

The ``sourceProperties`` map will contain the vector properties of the
various sources used as inputs to the algorithm. These will only be
available in certain circumstances (e.g. when the algorithm is used
within a model), so implementations will need to be adaptable to
circumstances when either ``sourceParameters`` is empty or
``parameters`` is empty, and use whatever information is passed in order
to make a best guess determination of the output properties.

.. versionadded:: 3.14
%End

    QVariantMap run( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback, bool *ok /Out/ = 0, const QVariantMap &configuration = QVariantMap(),
                     bool catchExceptions = true ) const throw( QgsProcessingException );
%Docstring
Executes the algorithm using the specified ``parameters``. This method
internally creates a copy of the algorithm before running it, so it is
safe to call on algorithms directly retrieved from
:py:class:`QgsProcessingRegistry` and :py:class:`QgsProcessingProvider`.

The ``context`` argument specifies the context in which the algorithm is
being run.

Algorithm progress should be reported using the supplied ``feedback``
object.

If specified, ``ok`` will be set to ``True`` if algorithm was
successfully run.

If ``catchExceptions`` is set to ``False``, then
:py:class:`QgsProcessingException` raised during the algorithm run will
not be automatically caught and will be raised instead.

:return: A map of algorithm outputs. These may be output layer
         references, or calculated values such as statistical
         calculations.

.. note::

   this method can only be called from the main thread. Use :py:func:`~QgsProcessingAlgorithm.prepare`, :py:func:`~QgsProcessingAlgorithm.runPrepared` and :py:func:`~QgsProcessingAlgorithm.postProcess`
   if you need to run algorithms from a background thread, or use the :py:class:`QgsProcessingAlgRunnerTask` class.
%End

    bool prepare( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback );
%Docstring
Prepares the algorithm for execution. This must be run in the main
thread, and allows the algorithm to pre-evaluate input parameters in a
thread-safe manner. This must be called before calling
:py:func:`~QgsProcessingAlgorithm.runPrepared` (which is safe to do in
any thread).

.. seealso:: :py:func:`runPrepared`

.. seealso:: :py:func:`postProcess`

.. note::

   This method modifies the algorithm instance, so it is not safe to call
   on algorithms directly retrieved from :py:class:`QgsProcessingRegistry` and :py:class:`QgsProcessingProvider`. Instead, a copy
   of the algorithm should be created with :py:func:`~QgsProcessingAlgorithm.clone` and :py:func:`~QgsProcessingAlgorithm.prepare`/:py:func:`~QgsProcessingAlgorithm.runPrepared` called on the copy.
%End

    QVariantMap runPrepared( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) throw( QgsProcessingException );
%Docstring
Runs the algorithm, which has been prepared by an earlier call to
:py:func:`~QgsProcessingAlgorithm.prepare`. This method is safe to call
from any thread. Returns ``True`` if the algorithm was successfully
executed. After :py:func:`~QgsProcessingAlgorithm.runPrepared` has
finished, the :py:func:`~QgsProcessingAlgorithm.postProcess` method
should be called from the main thread to allow the algorithm to perform
any required cleanup tasks and return its final result.

.. seealso:: :py:func:`prepare`

.. seealso:: :py:func:`postProcess`

.. note::

   This method modifies the algorithm instance, so it is not safe to call
   on algorithms directly retrieved from :py:class:`QgsProcessingRegistry` and :py:class:`QgsProcessingProvider`. Instead, a copy
   of the algorithm should be created with :py:func:`~QgsProcessingAlgorithm.clone` and :py:func:`~QgsProcessingAlgorithm.prepare`/:py:func:`~QgsProcessingAlgorithm.runPrepared` called on the copy.
%End

    QVariantMap postProcess( QgsProcessingContext &context, QgsProcessingFeedback *feedback, bool runResult = true );
%Docstring
Should be called in the main thread following the completion of
:py:func:`~QgsProcessingAlgorithm.runPrepared`. This method allows the
algorithm to perform any required cleanup tasks. The returned variant
map includes the results evaluated by the algorithm.

.. note::

   This method modifies the algorithm instance, so it is not safe to call
   on algorithms directly retrieved from :py:class:`QgsProcessingRegistry` and :py:class:`QgsProcessingProvider`. Instead, a copy
   of the algorithm should be created with :py:func:`~QgsProcessingAlgorithm.clone` and :py:func:`~QgsProcessingAlgorithm.prepare`/:py:func:`~QgsProcessingAlgorithm.runPrepared` called on the copy.

Since QGIS 3.38, :py:func:`~QgsProcessingAlgorithm.postProcess` will
always be called even for unsuccessful run executions, to allow the
algorithm to gracefully clean up. The ``runResult`` argument is used to
indicate whether the run was successful. The algorithm's
:py:func:`~QgsProcessingAlgorithm.postProcessAlgorithm` method will only
be called when ``runResult`` is ``True``.
%End

    virtual QWidget *createCustomParametersWidget( QWidget *parent = 0 ) const /Factory/;
%Docstring
If an algorithm subclass implements a custom parameters widget, a copy
of this widget should be constructed and returned by this method. The
base class implementation returns ``None``, which indicates that an
autogenerated parameters widget should be used.
%End

    virtual QgsExpressionContext createExpressionContext( const QVariantMap &parameters,
        QgsProcessingContext &context, QgsProcessingFeatureSource *source = 0 ) const;
%Docstring
Creates an expression context relating to the algorithm. This can be
called by algorithms to create a new expression context ready for
evaluating expressions within the algorithm. Optionally, a ``source``
can be specified which will be used to populate the context if it
implements the :py:class:`QgsExpressionContextGenerator` interface.
%End

    virtual bool validateInputCrs( const QVariantMap &parameters,
                                   QgsProcessingContext &context ) const;
%Docstring
Checks whether the coordinate reference systems for the specified set of
``parameters`` are valid for the algorithm. For instance, the base
implementation performs checks to ensure that all input CRS are equal
Returns ``True`` if ``parameters`` have passed the CRS check.
%End

    virtual QString asPythonCommand( const QVariantMap &parameters, QgsProcessingContext &context ) const;
%Docstring
Returns a Python command string which can be executed to run the
algorithm using the specified ``parameters``.

Algorithms which cannot be run from a Python command should return an
empty string.
%End

    virtual QString asQgisProcessCommand( const QVariantMap &parameters, QgsProcessingContext &context, bool &ok /Out/ ) const;
%Docstring
Returns a command string which will execute the algorithm using the
specified ``parameters`` via the command line qgis_process tool.

Note that some combinations of parameter types and values cannot be
represented as a qgis_process string.

:param parameters: algorithm parameters
:param context: processing context

:return: - equivalent qgis_process command
         - ok: ``True`` if the command was successfully generated

.. versionadded:: 3.24
%End

    virtual QVariantMap asMap( const QVariantMap &parameters, QgsProcessingContext &context ) const;
%Docstring
Returns a JSON serializable variant map containing the specified
``parameters`` and ``context`` settings.

.. versionadded:: 3.24
%End

    void setProvider( QgsProcessingProvider *provider ) /HoldGIL/;
%Docstring
Associates this algorithm with its provider. No transfer of ownership is
involved.
%End

    virtual bool supportInPlaceEdit( const QgsMapLayer *layer ) const;
%Docstring
Checks whether this algorithm supports in-place editing on the given
``layer`` Default implementation returns ``False``.

:return: ``True`` if the algorithm supports in-place editing

.. versionadded:: 3.4
%End

  protected:

    virtual QgsProcessingAlgorithm *createInstance() const = 0 /Factory,VirtualErrorHandler=processing_exception_handler/;
%Docstring
Creates a new instance of the algorithm class.

This method should return a 'pristine' instance of the algorithm class.
%End

    virtual void initAlgorithm( const QVariantMap &configuration = QVariantMap() ) = 0;
%Docstring
Initializes the algorithm using the specified ``configuration``.

This should be called directly after creating algorithms and before
retrieving any :py:func:`~QgsProcessingAlgorithm.parameterDefinitions`
or :py:func:`~QgsProcessingAlgorithm.outputDefinitions`.

Subclasses should use their implementations to add all required input
parameter and output definitions (which can be dynamically adjusted
according to ``configuration``).

Dynamic configuration can be used by algorithms which alter their
behavior when used inside processing models. For instance, a "feature
router" type algorithm which sends input features to one of any number
of outputs sinks based on some preconfigured filter parameters can use
the init method to create these outputs based on the specified
``configuration``.

.. seealso:: :py:func:`addParameter`

.. seealso:: :py:func:`addOutput`
%End

    bool addParameter( QgsProcessingParameterDefinition *parameterDefinition /Transfer/, bool createOutput = true ) /HoldGIL/;
%Docstring
Adds a parameter ``definition`` to the algorithm. Ownership of the
definition is transferred to the algorithm. Returns ``True`` if
parameter could be successfully added, or ``False`` if the parameter
could not be added (e.g. as a result of a duplicate name).

This should usually be called from a subclass'
:py:func:`~QgsProcessingAlgorithm.initAlgorithm` implementation.

If the ``createOutput`` argument is ``True``, then a corresponding
output definition will also be created (and added to the algorithm)
where appropriate. E.g. when adding a
:py:class:`QgsProcessingParameterVectorDestination` and ``createOutput``
is ``True``, then a :py:class:`QgsProcessingOutputVectorLayer` output
will be created and added to the algorithm. There is no need to call
:py:func:`~QgsProcessingAlgorithm.addOutput` to manually add a
corresponding output for this vector. If ``createOutput`` is ``False``
then this automatic output creation will not occur.

.. seealso:: :py:func:`initAlgorithm`

.. seealso:: :py:func:`addOutput`
%End

    void removeParameter( const QString &name ) /HoldGIL/;
%Docstring
Removes the parameter with matching ``name`` from the algorithm, and
deletes any existing definition.
%End

    bool addOutput( QgsProcessingOutputDefinition *outputDefinition /Transfer/ ) /HoldGIL/;
%Docstring
Adds an output ``definition`` to the algorithm. Ownership of the
definition is transferred to the algorithm. Returns ``True`` if the
output could be successfully added, or ``False`` if the output could not
be added (e.g. as a result of a duplicate name).

This should usually be called from a subclass'
:py:func:`~QgsProcessingAlgorithm.initAlgorithm` implementation.

Note that in some cases output creation can be automatically performed
when calling :py:func:`~QgsProcessingAlgorithm.addParameter`. See the
notes in :py:func:`~QgsProcessingAlgorithm.addParameter` for a
description of when this occurs.

.. seealso:: :py:func:`addParameter`

.. seealso:: :py:func:`initAlgorithm`
%End

    virtual bool prepareAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) throw( QgsProcessingException ) /VirtualErrorHandler=processing_exception_handler/;
%Docstring
Prepares the algorithm to run using the specified ``parameters``.
Algorithms should implement their logic for evaluating parameter values
here. The evaluated parameter results should be stored in member
variables ready for a call to
:py:func:`~QgsProcessingAlgorithm.processAlgorithm`.

The ``context`` argument specifies the context in which the algorithm is
being run.

prepareAlgorithm should be used to handle any thread-sensitive
preparation which is required by the algorithm. It will always be called
from the same thread that ``context`` has thread affinity with. While
this will generally be the main thread, it is not guaranteed. For
instance, algorithms which are run as a step in a larger model or as a
subcomponent of a script-based algorithm will call prepareAlgorithm from
the same thread as that model/script it being executed in.

Note that the processAlgorithm step uses a temporary context with
affinity for the thread in which the algorithm is executed, making it
safe for processAlgorithm implementations to load sources and sinks
without issue. Implementing prepareAlgorithm is only required if special
thread safe handling is required by the algorithm.

Algorithm preparation progress should be reported using the supplied
``feedback`` object. Additionally, well-behaved algorithms should
periodically check ``feedback`` to determine whether the algorithm
should be canceled and exited early.

If the preparation was successful algorithms must return ``True``. If a
``False`` value is returned this indicates that the preparation could
not be completed, and the algorithm execution will be canceled.

:return: ``True`` if preparation was successful.

.. seealso:: :py:func:`processAlgorithm`

.. seealso:: :py:func:`postProcessAlgorithm`
%End

    virtual QVariantMap processAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) throw( QgsProcessingException ) = 0 /VirtualErrorHandler=processing_exception_handler/;
%Docstring
Runs the algorithm using the specified ``parameters``. Algorithms should
implement their custom processing logic here.

The ``context`` argument gives a temporary context with thread affinity
matching the thread in which the algorithm is being run. This is a
cut-back copy of the context passed to the
:py:func:`~QgsProcessingAlgorithm.prepareAlgorithm` and
:py:func:`~QgsProcessingAlgorithm.postProcessAlgorithm` steps, but it is
generally safe for most algorithms to utilize this context for loading
layers and creating sinks. Any loaded layers or sinks created within
this temporary context will be transferred back to the main execution
context upon successful completion of the
:py:func:`~QgsProcessingAlgorithm.processAlgorithm` step.

Algorithm progress should be reported using the supplied ``feedback``
object. Additionally, well-behaved algorithms should periodically check
``feedback`` to determine whether the algorithm should be canceled and
exited early.

This method will not be called if the
:py:func:`~QgsProcessingAlgorithm.prepareAlgorithm` step failed
(returned ``False``).

Implementations of processAlgorithm can throw the
:py:class:`QgsProcessingException` exception to indicate that a fatal
error occurred within the execution.

:return: A map of algorithm outputs. These may be output layer
         references, or calculated values such as statistical
         calculations. Unless the algorithm subclass overrides the
         :py:func:`~QgsProcessingAlgorithm.postProcessAlgorithm` step
         this returned map will be used as the output for the algorithm.

.. seealso:: :py:func:`prepareAlgorithm`

.. seealso:: :py:func:`postProcessAlgorithm`
%End

    virtual QVariantMap postProcessAlgorithm( QgsProcessingContext &context, QgsProcessingFeedback *feedback ) throw( QgsProcessingException ) /VirtualErrorHandler=processing_exception_handler/;
%Docstring
Allows the algorithm to perform any required cleanup tasks. The returned
variant map includes the results evaluated by the algorithm. These may
be output layer references, or calculated values such as statistical
calculations.

The ``context`` argument specifies the context in which the algorithm
was run.

Postprocess progress should be reported using the supplied ``feedback``
object. Additionally, well-behaved algorithms should periodically check
``feedback`` to determine whether the post processing should be canceled
and exited early.

postProcessAlgorithm should be used to handle any thread-sensitive
cleanup which is required by the algorithm. It will always be called
from the same thread that ``context`` has thread affinity with. While
this will generally be the main thread, it is not guaranteed. For
instance, algorithms which are run as a step in a larger model or as a
subcomponent of a script-based algorithm will call postProcessAlgorithm
from the same thread as that model/script it being executed in.

postProcessAlgorithm will not be called if the
:py:func:`~QgsProcessingAlgorithm.prepareAlgorithm` step failed
(returned ``False``), or if an exception was raised by the
:py:func:`~QgsProcessingAlgorithm.processAlgorithm` step.

:return: A map of algorithm outputs. These may be output layer
         references, or calculated values such as statistical
         calculations. Implementations which return a non-empty map will
         override any results returned by
         :py:func:`~QgsProcessingAlgorithm.processAlgorithm`.

.. seealso:: :py:func:`prepareAlgorithm`

.. seealso:: :py:func:`processAlgorithm`
%End

    QString parameterAsString( const QVariantMap &parameters, const QString &name, const QgsProcessingContext &context ) const;
%Docstring
Evaluates the parameter with matching ``name`` to a static string value.
%End

    QString parameterAsExpression( const QVariantMap &parameters, const QString &name, const QgsProcessingContext &context ) const;
%Docstring
Evaluates the parameter with matching ``name`` to an expression.
%End

    double parameterAsDouble( const QVariantMap &parameters, const QString &name, const QgsProcessingContext &context ) const;
%Docstring
Evaluates the parameter with matching ``name`` to a static double value.
%End

    int parameterAsInt( const QVariantMap &parameters, const QString &name, const QgsProcessingContext &context ) const;
%Docstring
Evaluates the parameter with matching ``name`` to a static integer
value.
%End

    QList<int> parameterAsInts( const QVariantMap &parameters, const QString &name, const QgsProcessingContext &context ) const;
%Docstring
Evaluates the parameter with matching ``name`` to a list of integer
values.

.. versionadded:: 3.4
%End

    int parameterAsEnum( const QVariantMap &parameters, const QString &name, const QgsProcessingContext &context ) const;
%Docstring
Evaluates the parameter with matching ``name`` to a enum value.
%End

    QList<int> parameterAsEnums( const QVariantMap &parameters, const QString &name, const QgsProcessingContext &context ) const;
%Docstring
Evaluates the parameter with matching ``name`` to list of enum values.
%End

    QString parameterAsEnumString( const QVariantMap &parameters, const QString &name, const QgsProcessingContext &context ) const;
%Docstring
Evaluates the parameter with matching ``name`` to a static enum string.

.. versionadded:: 3.18
%End

    QStringList parameterAsEnumStrings( const QVariantMap &parameters, const QString &name, const QgsProcessingContext &context ) const;
%Docstring
Evaluates the parameter with matching ``name`` to list of static enum
strings.

.. versionadded:: 3.18
%End

    bool parameterAsBool( const QVariantMap &parameters, const QString &name, const QgsProcessingContext &context ) const;
%Docstring
Evaluates the parameter with matching ``name`` to a static boolean
value.
%End

    bool parameterAsBoolean( const QVariantMap &parameters, const QString &name, const QgsProcessingContext &context ) const;
%Docstring
Evaluates the parameter with matching ``name`` to a static boolean
value.

.. versionadded:: 3.8
%End

    QgsFeatureSink *parameterAsSink( const QVariantMap &parameters, const QString &name, QgsProcessingContext &context, QString &destinationIdentifier /Out/,
                                     const QgsFields &fields, Qgis::WkbType geometryType = Qgis::WkbType::NoGeometry, const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem(), QgsFeatureSink::SinkFlags sinkFlags = QgsFeatureSink::SinkFlags(), const QVariantMap &createOptions = QVariantMap(), const QStringList &datasourceOptions = QStringList(), const QStringList &layerOptions = QStringList() ) const throw( QgsProcessingException ) /Factory/;
%Docstring
Evaluates the parameter with matching ``name`` to a feature sink.

Sinks will either be taken from ``context``'s active project, or created
from external providers and stored temporarily in the ``context``.

The ``fields``, ``geometryType`` and ``crs`` parameters dictate the
properties of the resulting feature sink.

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()`.

The ``createOptions`` argument is used to pass on creation options such
as layer name.

The ``datasourceOptions`` and ``layerOptions`` arguments is used to pass
on GDAL-specific format driver options.

This function creates a new object and the caller takes responsibility
for deleting the returned object.

:raises QgsProcessingException: 
%End

    QgsProcessingFeatureSource *parameterAsSource( const QVariantMap &parameters, const QString &name, QgsProcessingContext &context ) const /Factory/;
%Docstring
Evaluates the parameter with matching ``name`` 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

    QString parameterAsCompatibleSourceLayerPath( const QVariantMap &parameters, const QString &name,
        QgsProcessingContext &context, const QStringList &compatibleFormats, const QString &preferredFormat = QString( "shp" ), QgsProcessingFeedback *feedback = 0 ) const;
%Docstring
Evaluates the parameter with matching ``name`` 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.

When an algorithm is capable of handling multi-layer input files (such
as Geopackage), it is preferable to use
:py:func:`~QgsProcessingAlgorithm.parameterAsCompatibleSourceLayerPathAndLayerName`
which may avoid conversion in more situations.
%End

    QString parameterAsCompatibleSourceLayerPathAndLayerName( const QVariantMap &parameters, const QString &name,
        QgsProcessingContext &context, const QStringList &compatibleFormats, const QString &preferredFormat = QString( "shp" ), QgsProcessingFeedback *feedback = 0, QString *layerName /Out/ = 0 ) const;
%Docstring
Evaluates the parameter with matching ``name`` 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:`~QgsProcessingAlgorithm.parameterAsCompatibleSourceLayerPath`
when an algorithm is able to correctly handle files with multiple
layers. Unlike
:py:func:`~QgsProcessingAlgorithm.parameterAsCompatibleSourceLayerPath`,
it will not force a conversion in this case and will return the target
layer name in the ``layerName`` argument.

:param parameters: input parameter value map
:param name: name of target parameter
: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: the target layer name for multi-layer sources
           (e.g. Geopackage)

.. seealso:: :py:func:`parameterAsCompatibleSourceLayerPath`

.. versionadded:: 3.10
%End

    QgsMapLayer *parameterAsLayer( const QVariantMap &parameters, const QString &name, QgsProcessingContext &context ) const;
%Docstring
Evaluates the parameter with matching ``name`` 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

    QgsRasterLayer *parameterAsRasterLayer( const QVariantMap &parameters, const QString &name, QgsProcessingContext &context ) const;
%Docstring
Evaluates the parameter with matching ``name`` 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

    QgsMeshLayer *parameterAsMeshLayer( const QVariantMap &parameters, const QString &name, QgsProcessingContext &context ) const;
%Docstring
Evaluates the parameter with matching ``name`` to a mesh 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.6
%End

    QString parameterAsOutputLayer( const QVariantMap &parameters, const QString &name, QgsProcessingContext &context ) const;
%Docstring
Evaluates the parameter with matching ``name`` to a output layer
destination.
%End

    QString parameterAsFileOutput( const QVariantMap &parameters, const QString &name, QgsProcessingContext &context ) const;
%Docstring
Evaluates the parameter with matching ``name`` to a file based output
destination.
%End

    QgsVectorLayer *parameterAsVectorLayer( const QVariantMap &parameters, const QString &name, QgsProcessingContext &context ) const;
%Docstring
Evaluates the parameter with matching ``name`` to a vector 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

    QgsCoordinateReferenceSystem parameterAsCrs( const QVariantMap &parameters, const QString &name, QgsProcessingContext &context ) const;
%Docstring
Evaluates the parameter with matching ``name`` to a coordinate reference
system.
%End

    QgsRectangle parameterAsExtent( const QVariantMap &parameters, const QString &name, QgsProcessingContext &context,
                                    const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem() ) const;
%Docstring
Evaluates the parameter with matching ``name`` to a rectangular extent.

If ``crs`` is set, and the original coordinate reference system of the
parameter can be determined, then the extent will be automatically
reprojected so that it is in the specified ``crs``. In this case the
extent of the reproject rectangle will be returned.

.. seealso:: :py:func:`parameterAsExtentGeometry`
%End

    QgsGeometry parameterAsExtentGeometry( const QVariantMap &parameters, const QString &name, QgsProcessingContext &context,
                                           const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem() ) const;
%Docstring
Evaluates the parameter with matching ``name`` to a rectangular extent,
and returns a geometry covering this extent.

If ``crs`` is set, and the original coordinate reference system of the
parameter can be determined, then the extent will be automatically
reprojected so that it is in the specified ``crs``. Unlike
:py:func:`~QgsProcessingAlgorithm.parameterAsExtent`, the reprojected
rectangle returned by this function will no longer be a rectangle itself
(i.e. this method returns the geometry of the actual reprojected
rectangle, while :py:func:`~QgsProcessingAlgorithm.parameterAsExtent`
returns just the extent of the reprojected rectangle).

.. seealso:: :py:func:`parameterAsExtent`
%End

    QgsCoordinateReferenceSystem parameterAsExtentCrs( const QVariantMap &parameters, const QString &name, QgsProcessingContext &context ) const;
%Docstring
Returns the coordinate reference system associated with an extent
parameter value.

.. seealso:: :py:func:`parameterAsExtent`
%End

    QgsPointXY parameterAsPoint( const QVariantMap &parameters, const QString &name, QgsProcessingContext &context,
                                 const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem() ) const;
%Docstring
Evaluates the parameter with matching ``name`` to a point.

If ``crs`` is set then the point will be automatically reprojected so
that it is in the specified ``crs``.

.. seealso:: :py:func:`parameterAsPointCrs`
%End

    QgsCoordinateReferenceSystem parameterAsPointCrs( const QVariantMap &parameters, const QString &name, QgsProcessingContext &context ) const;
%Docstring
Returns the coordinate reference system associated with an point
parameter value.

.. seealso:: :py:func:`parameterAsPoint`
%End

    QgsGeometry parameterAsGeometry( const QVariantMap &parameters, const QString &name, QgsProcessingContext &context,
                                     const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem() ) const;
%Docstring
Evaluates the parameter with matching ``name`` to a geometry.

If ``crs`` is set then the geometry will be automatically reprojected so
that it is in the specified ``crs``.

.. seealso:: :py:func:`parameterAsGeometryCrs`
%End

    QgsCoordinateReferenceSystem parameterAsGeometryCrs( const QVariantMap &parameters, const QString &name, QgsProcessingContext &context ) const;
%Docstring
Returns the coordinate reference system associated with a geometry
parameter value.

.. seealso:: :py:func:`parameterAsGeometry`
%End

    QString parameterAsFile( const QVariantMap &parameters, const QString &name, QgsProcessingContext &context ) const;
%Docstring
Evaluates the parameter with matching ``name`` to a file/folder name.
%End

    QVariantList parameterAsMatrix( const QVariantMap &parameters, const QString &name, QgsProcessingContext &context ) const;
%Docstring
Evaluates the parameter with matching ``name`` to a matrix/table of
values. Tables are collapsed to a 1 dimensional list.
%End

    QList< QgsMapLayer *> parameterAsLayerList( const QVariantMap &parameters, const QString &name, QgsProcessingContext &context, QgsProcessing::LayerOptionsFlags flags = QgsProcessing::LayerOptionsFlags() ) const;
%Docstring
Evaluates the parameter with matching ``name`` to a list of map layers.
The ``flags`` are used to set options for loading layers (e.g. skip
index generation).
%End

    QStringList parameterAsFileList( const QVariantMap &parameters, const QString &name, QgsProcessingContext &context ) const;
%Docstring
Evaluates the parameter with matching ``name`` to a list of files (for
:py:class:`QgsProcessingParameterMultipleLayers` in
:py:class:`QgsProcessing`:TypeFile mode).

.. versionadded:: 3.10
%End

    QList<double> parameterAsRange( const QVariantMap &parameters, const QString &name, QgsProcessingContext &context ) const;
%Docstring
Evaluates the parameter with matching ``name`` to a range of values.
%End

 QStringList parameterAsFields( const QVariantMap &parameters, const QString &name, QgsProcessingContext &context ) const /Deprecated/;
%Docstring
Evaluates the parameter with matching ``name`` to a list of fields.

.. deprecated:: 3.40

   Use :py:func:`~QgsProcessingAlgorithm.parameterAsStrings` instead.
%End

    QStringList parameterAsStrings( const QVariantMap &parameters, const QString &name, QgsProcessingContext &context ) const;
%Docstring
Evaluates the parameter with matching ``name`` to a list of strings
(e.g. field names or point cloud attributes).

.. versionadded:: 3.32
%End

    QgsPrintLayout *parameterAsLayout( const QVariantMap &parameters, const QString &name, QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``name`` to a print layout.

.. warning::

   This method is not safe to run in a background thread, so it must either be used within a prepareAlgorithm
   implementation (which runs in the main thread), or the algorithm must return the FlagNoThreading flag.

.. versionadded:: 3.8
%End

    QgsLayoutItem *parameterAsLayoutItem( const QVariantMap &parameters, const QString &name, QgsProcessingContext &context, QgsPrintLayout *layout );
%Docstring
Evaluates the parameter with matching ``name`` to a print layout item,
taken from the specified ``layout``.

.. warning::

   This method is not safe to run in a background thread, so it must either be used within a prepareAlgorithm
   implementation (which runs in the main thread), or the algorithm must return the FlagNoThreading flag.

.. versionadded:: 3.8
%End

    QColor parameterAsColor( const QVariantMap &parameters, const QString &name, QgsProcessingContext &context ) const;
%Docstring
Evaluates the parameter with matching ``name`` to a color, or returns an
invalid color if the parameter was not set.

.. versionadded:: 3.10
%End

    QString parameterAsConnectionName( const QVariantMap &parameters, const QString &name, QgsProcessingContext &context ) const;
%Docstring
Evaluates the parameter with matching ``name`` to a connection name
string.

.. versionadded:: 3.14
%End

    QString parameterAsSchema( const QVariantMap &parameters, const QString &name, QgsProcessingContext &context ) const;
%Docstring
Evaluates the parameter with matching ``name`` to a database schema name
string.

.. versionadded:: 3.14
%End

    QString parameterAsDatabaseTableName( const QVariantMap &parameters, const QString &name, QgsProcessingContext &context ) const;
%Docstring
Evaluates the parameter with matching ``name`` to a database table name
string.

.. versionadded:: 3.14
%End

    QDateTime parameterAsDateTime( const QVariantMap &parameters, const QString &name, QgsProcessingContext &context ) const;
%Docstring
Evaluates the parameter with matching ``name`` to a DateTime, or returns
an invalid date time if the parameter was not set.

.. versionadded:: 3.14
%End

    QgsPointCloudLayer *parameterAsPointCloudLayer( const QVariantMap &parameters, const QString &name, QgsProcessingContext &context, QgsProcessing::LayerOptionsFlags flags = QgsProcessing::LayerOptionsFlags() ) const;
%Docstring
Evaluates the parameter with matching ``name`` to a point cloud layer.
The ``flags`` are used to set options for loading layer (e.g. skip index
generation).

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.22
%End

    QgsAnnotationLayer *parameterAsAnnotationLayer( const QVariantMap &parameters, const QString &name, QgsProcessingContext &context ) const;
%Docstring
Evaluates the parameter with matching ``name`` to an annotation layer.

Annotation layers will be taken from ``context``'s active project.
Callers do not need to handle deletion of the returned layer.

.. warning::

   Working with annotation layers is generally not thread safe (unless the layers are from
   a :py:class:`QgsProject` loaded directly in a background thread). Ensure your algorithm returns the
   QgsProcessingAlgorithm.FlagNoThreading flag or only accesses annotation layers from a :py:func:`~QgsProcessingAlgorithm.prepareAlgorithm`
   or :py:func:`~QgsProcessingAlgorithm.postProcessAlgorithm` step.

.. versionadded:: 3.22
%End

    static QString invalidSourceError( const QVariantMap &parameters, const QString &name );
%Docstring
Returns a user-friendly string to use as an error when a source
parameter could not be loaded.

The ``parameters`` argument should give the algorithms parameter map,
and the ``name`` should correspond to the invalid source parameter name.

.. seealso:: :py:func:`invalidRasterError`

.. seealso:: :py:func:`invalidSinkError`

.. seealso:: :py:func:`invalidPointCloudError`

.. versionadded:: 3.2
%End

    static QString invalidRasterError( const QVariantMap &parameters, const QString &name );
%Docstring
Returns a user-friendly string to use as an error when a raster layer
input could not be loaded.

The ``parameters`` argument should give the algorithms parameter map,
and the ``name`` should correspond to the invalid raster parameter name.

.. seealso:: :py:func:`invalidSourceError`

.. seealso:: :py:func:`invalidSinkError`

.. seealso:: :py:func:`invalidPointCloudError`

.. versionadded:: 3.2
%End

    static QString invalidSinkError( const QVariantMap &parameters, const QString &name );
%Docstring
Returns a user-friendly string to use as an error when a sink parameter
could not be created.

The ``parameters`` argument should give the algorithms parameter map,
and the ``name`` should correspond to the invalid sink parameter name.

.. seealso:: :py:func:`invalidSourceError`

.. seealso:: :py:func:`invalidRasterError`

.. seealso:: :py:func:`invalidPointCloudError`

.. versionadded:: 3.2
%End

    static QString invalidPointCloudError( const QVariantMap &parameters, const QString &name );
%Docstring
Returns a user-friendly string to use as an error when a point cloud
layer input could not be loaded.

The ``parameters`` argument should give the algorithms parameter map,
and the ``name`` should correspond to the invalid point cloud parameter
name.

.. seealso:: :py:func:`invalidSourceError`

.. seealso:: :py:func:`invalidSinkError`

.. seealso:: :py:func:`invalidRasterError`

.. versionadded:: 3.32
%End

    static QString writeFeatureError( QgsFeatureSink *sink, const QVariantMap &parameters, const QString &name );
%Docstring
Returns a user-friendly string to use as an error when a feature cannot
be written into a sink.

The ``sink`` argument is the sink into which the feature cannot be
written.

The ``parameters`` argument should give the algorithms parameter map,
and the ``name`` should correspond to the sink parameter name.

.. versionadded:: 3.22
%End

  private:
    QgsProcessingAlgorithm( const QgsProcessingAlgorithm &other );
};



class QgsProcessingFeatureBasedAlgorithm : QgsProcessingAlgorithm
{
%Docstring(signature="appended")
An abstract :py:class:`QgsProcessingAlgorithm` base class for processing
algorithms which operate "feature-by-feature".

Feature based algorithms are algorithms which operate on individual
features in isolation. These are algorithms where one feature is output
for each input feature, and the output feature result for each input
feature is not dependent on any other features present in the source.

For instance, algorithms like "centroids" and "buffers" are feature
based algorithms since the centroid or buffer of a feature is calculated
for each feature in isolation. An algorithm like "dissolve" is NOT
suitable for a feature based algorithm as the dissolved output depends
on multiple input features and these features cannot be processed in
isolation.

Using :py:class:`QgsProcessingFeatureBasedAlgorithm` as the base class
for feature based algorithms allows shortcutting much of the common
algorithm code for handling iterating over sources and pushing features
to output sinks. It also allows the algorithm execution to be optimised
in future (for instance allowing automatic multi-thread processing of
the algorithm, or use of the algorithm in "chains", avoiding the need
for temporary outputs in multi-step models).
%End

%TypeHeaderCode
#include "qgsprocessingalgorithm.h"
%End
  public:

    QgsProcessingFeatureBasedAlgorithm();

    virtual Qgis::ProcessingAlgorithmFlags flags() const /HoldGIL/;


    virtual QgsFeatureList processFeature( const QgsFeature &feature, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) throw( QgsProcessingException ) = 0 /VirtualErrorHandler=processing_exception_handler/;
%Docstring
Processes an individual input ``feature`` from the source. Algorithms
should implement their logic in this method for performing the
algorithm's operation (e.g. replacing the feature's geometry with the
centroid of the original feature geometry for a 'centroid' type
algorithm).

Implementations should return a list containing the modified feature.
Returning an empty an list will indicate that this feature should be
'skipped', and will not be added to the algorithm's output. Subclasses
can use this approach to filter the incoming features as desired.

Additionally, multiple features can be returned for a single input
feature. Each returned feature will be added to the algorithm's output.
This allows for "explode" type algorithms where a single input feature
results in multiple output features.

The provided ``feedback`` object can be used to push messages to the log
and for giving feedback to users. Note that handling of progress reports
and algorithm cancellation is handled by the base class and subclasses
do not need to reimplement this logic.

Algorithms can throw a :py:class:`QgsProcessingException` if a fatal
error occurred which should prevent the algorithm execution from
continuing. This can be annoying for users though as it can break valid
model execution - so use with extreme caution, and consider using
``feedback`` to instead report non-fatal processing failures for
features instead.
%End

    virtual bool supportInPlaceEdit( const QgsMapLayer *layer ) const;

%Docstring
Checks whether this algorithm supports in-place editing on the given
``layer`` Default implementation for feature based algorithms run some
basic compatibility checks based on the geometry type of the layer.

:return: ``True`` if the algorithm supports in-place editing

.. versionadded:: 3.4
%End

    virtual QString inputParameterName() const /HoldGIL/;
%Docstring
Returns the name of the parameter corresponding to the input layer.

By default this is the standard "INPUT" parameter name.

.. versionadded:: 3.12
%End

    virtual QString inputParameterDescription() const /HoldGIL/;
%Docstring
Returns the translated description of the parameter corresponding to the
input layer.

By default this is a translated "Input layer" string.

.. versionadded:: 3.12
%End

  protected:

    virtual void initAlgorithm( const QVariantMap &configuration = QVariantMap() );


    virtual QString outputName() const = 0 /HoldGIL/;
%Docstring
Returns the translated, user visible name for any layers created by this
algorithm. This name will be used as the default name when loading the
resultant layer into a QGIS project.
%End

    virtual QList<int> inputLayerTypes() const /HoldGIL/;
%Docstring
Returns the valid input layer types for the source layer for this
algorithm. By default vector layers with any geometry types (excluding
non-spatial, geometryless layers) are accepted.
%End

    virtual Qgis::ProcessingSourceType outputLayerType() const /HoldGIL/;
%Docstring
Returns the layer type for layers generated by this algorithm, if this
is possible to determine in advance.
%End

    virtual Qgis::ProcessingFeatureSourceFlags sourceFlags() const /HoldGIL/;
%Docstring
Returns the processing feature source flags to be used in the algorithm.
%End

    virtual QgsFeatureSink::SinkFlags sinkFlags() const /HoldGIL/;
%Docstring
Returns the feature sink flags to be used for the output.

.. versionadded:: 3.4.1
%End

    virtual Qgis::WkbType outputWkbType( Qgis::WkbType inputWkbType ) const /HoldGIL/;
%Docstring
Maps the input WKB geometry type (``inputWkbType``) to the corresponding
output WKB type generated by the algorithm. The default behavior is that
the algorithm maintains the same WKB type. This is called once by the
base class when creating the output sink for the algorithm (i.e. it is
not called once per feature processed).
%End

    virtual QgsFields outputFields( const QgsFields &inputFields ) const /HoldGIL/;
%Docstring
Maps the input source fields (``inputFields``) to corresponding output
fields generated by the algorithm. The default behavior is that the
algorithm maintains the same fields as are input. Algorithms which add,
remove or modify existing fields should override this method and
implement logic here to indicate which fields are output by the
algorithm.

This is called once by the base class when creating the output sink for
the algorithm (i.e. it is not called once per feature processed).
%End

    virtual QgsCoordinateReferenceSystem outputCrs( const QgsCoordinateReferenceSystem &inputCrs ) const /HoldGIL/;
%Docstring
Maps the input source coordinate reference system (``inputCrs``) to a
corresponding output CRS generated by the algorithm. The default
behavior is that the algorithm maintains the same CRS as the input
source.

This is called once by the base class when creating the output sink for
the algorithm (i.e. it is not called once per feature processed).
%End

    virtual void initParameters( const QVariantMap &configuration = QVariantMap() );
%Docstring
Initializes any extra parameters added by the algorithm subclass. There
is no need to declare the input source or output sink, as these are
automatically created by QgsProcessingFeatureBasedAlgorithm.
%End

    QgsCoordinateReferenceSystem sourceCrs() const /HoldGIL/;
%Docstring
Returns the source's coordinate reference system. This will only return
a valid CRS when called from a subclasses'
:py:func:`~QgsProcessingFeatureBasedAlgorithm.processFeature`
implementation.
%End


    virtual QVariantMap processAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) throw( QgsProcessingException );


    virtual QgsFeatureRequest request() const;
%Docstring
Returns the feature request used for fetching features to process from
the source layer. The default implementation requests all attributes and
geometry.
%End

    void prepareSource( const QVariantMap &parameters, QgsProcessingContext &context );
%Docstring
Read the source from ``parameters`` and ``context`` and set it

.. versionadded:: 3.4
%End

     virtual QgsProcessingAlgorithm::VectorProperties sinkProperties( const QString &sink,
        const QVariantMap &parameters,
        QgsProcessingContext &context,
        const QMap< QString, QgsProcessingAlgorithm::VectorProperties > &sourceProperties ) const;

};


/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/processing/qgsprocessingalgorithm.h                         *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/