QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
qgsprocessingparameters.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsprocessingparameters.h
3 -------------------------
4 begin : April 2017
5 copyright : (C) 2017 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSPROCESSINGPARAMETERS_H
19#define QGSPROCESSINGPARAMETERS_H
20
21#include "qgis_core.h"
22#include "qgis.h"
23#include "qgsprocessing.h"
24#include "qgsproperty.h"
26#include "qgsprocessingutils.h"
29#include <QMap>
30#include <limits>
31
34class QgsRasterLayer;
35class QgsMeshLayer;
36class QgsVectorLayer;
37class QgsFeatureSink;
42class QgsPrintLayout;
43class QgsLayoutItem;
46
56{
57 public:
58
75 QgsProcessingFeatureSourceDefinition( const QString &source = QString(), bool selectedFeaturesOnly = false, long long featureLimit = -1,
77 : source( QgsProperty::fromValue( source ) )
78 , selectedFeaturesOnly( selectedFeaturesOnly )
79 , featureLimit( featureLimit )
80 , filterExpression( filterExpression )
81 , flags( flags )
82 , geometryCheck( geometryCheck )
83 {}
84
101 QgsProcessingFeatureSourceDefinition( const QgsProperty &source, bool selectedFeaturesOnly = false, long long featureLimit = -1,
103 : source( source )
104 , selectedFeaturesOnly( selectedFeaturesOnly )
105 , featureLimit( featureLimit )
106 , filterExpression( filterExpression )
107 , flags( flags )
108 , geometryCheck( geometryCheck )
109 {}
110
115
120
127 long long featureLimit = -1;
128
135
142
151
158 QVariant toVariant() const;
159
166 bool loadVariant( const QVariantMap &map );
167
168 // TODO c++20 - replace with = default
170 {
171 return source == other.source
172 && selectedFeaturesOnly == other.selectedFeaturesOnly
173 && featureLimit == other.featureLimit
174 && filterExpression == other.filterExpression
175 && flags == other.flags
176 && geometryCheck == other.geometryCheck;
177 }
178
180 {
181 return !( *this == other );
182 }
183
185 operator QVariant() const
186 {
187 return QVariant::fromValue( *this );
188 }
189
190};
191
193
194
203{
204 public:
205
211 QgsProcessingOutputLayerDefinition( const QString &sink = QString(), QgsProject *destinationProject = nullptr )
212 : sink( QgsProperty::fromValue( sink ) )
213 , destinationProject( destinationProject )
214 {}
215
221 QgsProcessingOutputLayerDefinition( const QgsProperty &sink, QgsProject *destinationProject = nullptr )
222 : sink( sink )
223 , destinationProject( destinationProject )
224 {}
225
230
236 QgsProject *destinationProject = nullptr;
237
242
249 QVariantMap createOptions;
250
257 bool useRemapping() const { return mUseRemapping; }
258
266 QgsRemappingSinkDefinition remappingDefinition() const { return mRemappingDefinition; }
267
278 void setRemappingDefinition( const QgsRemappingSinkDefinition &definition );
279
286 QVariant toVariant() const;
287
294 bool loadVariant( const QVariantMap &map );
295
297 operator QVariant() const
298 {
299 return QVariant::fromValue( *this );
300 }
301
302 // TODO c++20 - replace with = default
303 bool operator==( const QgsProcessingOutputLayerDefinition &other ) const;
304 bool operator!=( const QgsProcessingOutputLayerDefinition &other ) const;
305
306 private:
307
308 bool mUseRemapping = false;
310
311};
312
314
315
316
317
318//
319// Parameter definitions
320//
321
322
334{
335
336#ifdef SIP_RUN
337 % TypeHeaderCode
344 % End
346 if ( sipCpp->type() == QgsProcessingParameterBoolean::typeName() )
347 sipType = sipType_QgsProcessingParameterBoolean;
348 else if ( sipCpp->type() == QgsProcessingParameterCrs::typeName() )
349 sipType = sipType_QgsProcessingParameterCrs;
350 else if ( sipCpp->type() == QgsProcessingParameterMapLayer::typeName() )
351 sipType = sipType_QgsProcessingParameterMapLayer;
352 else if ( sipCpp->type() == QgsProcessingParameterExtent::typeName() )
353 sipType = sipType_QgsProcessingParameterExtent;
354 else if ( sipCpp->type() == QgsProcessingParameterPoint::typeName() )
355 sipType = sipType_QgsProcessingParameterPoint;
356 else if ( sipCpp->type() == QgsProcessingParameterGeometry::typeName() )
357 sipType = sipType_QgsProcessingParameterGeometry;
358 else if ( sipCpp->type() == QgsProcessingParameterFile::typeName() )
359 sipType = sipType_QgsProcessingParameterFile;
360 else if ( sipCpp->type() == QgsProcessingParameterMatrix::typeName() )
361 sipType = sipType_QgsProcessingParameterMatrix;
362 else if ( sipCpp->type() == QgsProcessingParameterMultipleLayers::typeName() )
363 sipType = sipType_QgsProcessingParameterMultipleLayers;
364 else if ( sipCpp->type() == QgsProcessingParameterNumber::typeName() )
365 sipType = sipType_QgsProcessingParameterNumber;
366 else if ( sipCpp->type() == QgsProcessingParameterDistance::typeName() )
367 sipType = sipType_QgsProcessingParameterDistance;
368 else if ( sipCpp->type() == QgsProcessingParameterArea::typeName() )
369 sipType = sipType_QgsProcessingParameterArea;
370 else if ( sipCpp->type() == QgsProcessingParameterVolume::typeName() )
371 sipType = sipType_QgsProcessingParameterVolume;
372 else if ( sipCpp->type() == QgsProcessingParameterDuration::typeName() )
373 sipType = sipType_QgsProcessingParameterDuration;
374 else if ( sipCpp->type() == QgsProcessingParameterScale::typeName() )
375 sipType = sipType_QgsProcessingParameterScale;
376 else if ( sipCpp->type() == QgsProcessingParameterRange::typeName() )
377 sipType = sipType_QgsProcessingParameterRange;
378 else if ( sipCpp->type() == QgsProcessingParameterRasterLayer::typeName() )
379 sipType = sipType_QgsProcessingParameterRasterLayer;
380 else if ( sipCpp->type() == QgsProcessingParameterMeshLayer::typeName() )
381 sipType = sipType_QgsProcessingParameterMeshLayer;
382 else if ( sipCpp->type() == QgsProcessingParameterEnum::typeName() )
383 sipType = sipType_QgsProcessingParameterEnum;
384 else if ( sipCpp->type() == QgsProcessingParameterString::typeName() )
385 sipType = sipType_QgsProcessingParameterString;
386 else if ( sipCpp->type() == QgsProcessingParameterExpression::typeName() )
387 sipType = sipType_QgsProcessingParameterExpression;
388 else if ( sipCpp->type() == QgsProcessingParameterAuthConfig::typeName() )
389 sipType = sipType_QgsProcessingParameterAuthConfig;
390 else if ( sipCpp->type() == QgsProcessingParameterVectorLayer::typeName() )
391 sipType = sipType_QgsProcessingParameterVectorLayer;
392 else if ( sipCpp->type() == QgsProcessingParameterField::typeName() )
393 sipType = sipType_QgsProcessingParameterField;
394 else if ( sipCpp->type() == QgsProcessingParameterFeatureSource::typeName() )
395 sipType = sipType_QgsProcessingParameterFeatureSource;
396 else if ( sipCpp->type() == QgsProcessingParameterFeatureSink::typeName() )
397 sipType = sipType_QgsProcessingParameterFeatureSink;
398 else if ( sipCpp->type() == QgsProcessingParameterVectorDestination::typeName() )
399 sipType = sipType_QgsProcessingParameterVectorDestination;
400 else if ( sipCpp->type() == QgsProcessingParameterRasterDestination::typeName() )
401 sipType = sipType_QgsProcessingParameterRasterDestination;
402 else if ( sipCpp->type() == QgsProcessingParameterPointCloudDestination::typeName() )
403 sipType = sipType_QgsProcessingParameterPointCloudDestination;
404 else if ( sipCpp->type() == QgsProcessingParameterFileDestination::typeName() )
405 sipType = sipType_QgsProcessingParameterFileDestination;
406 else if ( sipCpp->type() == QgsProcessingParameterFolderDestination::typeName() )
407 sipType = sipType_QgsProcessingParameterFolderDestination;
408 else if ( sipCpp->type() == QgsProcessingParameterBand::typeName() )
409 sipType = sipType_QgsProcessingParameterBand;
410 else if ( sipCpp->type() == QgsProcessingParameterLayout::typeName() )
411 sipType = sipType_QgsProcessingParameterLayout;
412 else if ( sipCpp->type() == QgsProcessingParameterLayoutItem::typeName() )
413 sipType = sipType_QgsProcessingParameterLayoutItem;
414 else if ( sipCpp->type() == QgsProcessingParameterColor::typeName() )
415 sipType = sipType_QgsProcessingParameterColor;
416 else if ( sipCpp->type() == QgsProcessingParameterCoordinateOperation::typeName() )
417 sipType = sipType_QgsProcessingParameterCoordinateOperation;
418 else if ( sipCpp->type() == QgsProcessingParameterMapTheme::typeName() )
419 sipType = sipType_QgsProcessingParameterMapTheme;
420 else if ( sipCpp->type() == QgsProcessingParameterDateTime::typeName() )
421 sipType = sipType_QgsProcessingParameterDateTime;
422 else if ( sipCpp->type() == QgsProcessingParameterProviderConnection::typeName() )
423 sipType = sipType_QgsProcessingParameterProviderConnection;
424 else if ( sipCpp->type() == QgsProcessingParameterDatabaseSchema::typeName() )
425 sipType = sipType_QgsProcessingParameterDatabaseSchema;
426 else if ( sipCpp->type() == QgsProcessingParameterDatabaseTable::typeName() )
427 sipType = sipType_QgsProcessingParameterDatabaseTable;
428 else if ( sipCpp->type() == QgsProcessingParameterFieldMapping::typeName() )
429 sipType = sipType_QgsProcessingParameterFieldMapping;
430 else if ( sipCpp->type() == QgsProcessingParameterTinInputLayers::typeName() )
431 sipType = sipType_QgsProcessingParameterTinInputLayers;
432 else if ( sipCpp->type() == QgsProcessingParameterVectorTileWriterLayers::typeName() )
433 sipType = sipType_QgsProcessingParameterVectorTileWriterLayers;
434 else if ( sipCpp->type() == QgsProcessingParameterDxfLayers::typeName() )
435 sipType = sipType_QgsProcessingParameterDxfLayers;
436 else if ( sipCpp->type() == QgsProcessingParameterMeshDatasetGroups::typeName() )
437 sipType = sipType_QgsProcessingParameterMeshDatasetGroups;
438 else if ( sipCpp->type() == QgsProcessingParameterMeshDatasetTime::typeName() )
439 sipType = sipType_QgsProcessingParameterMeshDatasetTime;
440 else if ( sipCpp->type() == QgsProcessingParameterPointCloudLayer::typeName() )
441 sipType = sipType_QgsProcessingParameterPointCloudLayer;
442 else if ( sipCpp->type() == QgsProcessingParameterAnnotationLayer::typeName() )
443 sipType = sipType_QgsProcessingParameterAnnotationLayer;
444 else if ( sipCpp->type() == QgsProcessingParameterPointCloudAttribute::typeName() )
445 sipType = sipType_QgsProcessingParameterPointCloudAttribute;
446 else if ( sipCpp->type() == QgsProcessingParameterVectorTileDestination::typeName() )
447 sipType = sipType_QgsProcessingParameterVectorTileDestination;
448 else
449 sipType = nullptr;
450 SIP_END
451#endif
452
453 public:
454
458 QgsProcessingParameterDefinition( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
459 bool optional = false, const QString &help = QString() );
460
462
467
471 virtual QString type() const = 0;
472
478 virtual bool isDestination() const { return false; }
479
485 QString name() const { return mName; }
486
492 void setName( const QString &name ) { mName = name; }
493
499 QString description() const { return mDescription; }
500
506 void setDescription( const QString &description ) { mDescription = description; }
507
517 QString help() const { return mHelp; }
518
528 void setHelp( const QString &help ) { mHelp = help; }
529
536 QVariant defaultValue() const { return mDefault; }
537
544 void setDefaultValue( const QVariant &value ) { mDefault = value; }
545
558 QVariant guiDefaultValueOverride() const;
559
575 void setGuiDefaultValueOverride( const QVariant &value ) { mGuiDefault = value; }
576
585 QVariant defaultValueForGui() const;
586
591 Qgis::ProcessingParameterFlags flags() const { return mFlags; }
592
597 void setFlags( Qgis::ProcessingParameterFlags flags ) { mFlags = flags; }
598
606 virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const;
607
615 virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
616
628 virtual QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const;
629
643 virtual QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const;
644
658 virtual QStringList valueAsStringList( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const;
659
665 virtual QString valueAsPythonComment( const QVariant &value, QgsProcessingContext &context ) const;
666
671 virtual QString asScriptCode() const;
672
683
689 virtual QVariantMap toVariantMap() const;
690
696 virtual bool fromVariantMap( const QVariantMap &map );
697
704 SIP_SKIP QVariantMap metadata() const { return mMetadata; }
705
711 QVariantMap &metadata() { return mMetadata; }
712
718 void setMetadata( const QVariantMap &metadata ) { mMetadata = metadata; }
719
724 virtual QStringList dependsOnOtherParameters() const { return QStringList(); }
725
732
738 QgsProcessingProvider *provider() const;
739
744 virtual QString toolTip() const;
745
753 bool isDynamic() const { return mIsDynamic; }
754
762 void setIsDynamic( bool dynamic ) { mIsDynamic = dynamic; }
763
770 QgsPropertyDefinition dynamicPropertyDefinition() const { return mPropertyDefinition; }
771
778 void setDynamicPropertyDefinition( const QgsPropertyDefinition &definition ) { mPropertyDefinition = definition; }
779
791 QString dynamicLayerParameterName() const { return mDynamicLayerParameterName; }
792
804 void setDynamicLayerParameterName( const QString &name ) { mDynamicLayerParameterName = name; }
805
819 QStringList additionalExpressionContextVariables() const { return mAdditionalExpressionVariables; }
820
838 void setAdditionalExpressionContextVariables( const QStringList &variables ) { mAdditionalExpressionVariables = variables; }
839
840#ifndef SIP_RUN
841
849 enum class ValueAsStringFlag : int
850 {
851 AllowMapLayerValues = 1 << 0,
852 };
854#endif
855
856 protected:
857
858#ifndef SIP_RUN
859
866 QString valueAsStringPrivate( const QVariant &value, QgsProcessingContext &context, bool &ok, ValueAsStringFlags flags ) const;
867
874 QVariant valueAsJsonObjectPrivate( const QVariant &value, QgsProcessingContext &context, ValueAsStringFlags flags ) const;
875#endif
876
883 QVariant defaultGuiValueFromSetting() const;
884
886 QString mName;
887
890
892 QString mHelp;
893
895 QVariant mDefault;
896
898 QVariant mGuiDefault;
899
902
904 QVariantMap mMetadata;
905
907 QgsProcessingAlgorithm *mAlgorithm = nullptr;
908
910 bool mIsDynamic = false;
911
914
917
920
921 // To allow access to mAlgorithm. We don't want a public setter for this!
923
924};
925
926#ifndef SIP_RUN
928#endif
929
931typedef QList< const QgsProcessingParameterDefinition * > QgsProcessingParameterDefinitions;
932
950class CORE_EXPORT QgsProcessingParameters
951{
952
953 public:
954
959 static bool isDynamic( const QVariantMap &parameters, const QString &name );
960
964 static QString parameterAsString( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
965
970 static QString parameterAsString( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
971
975 static QString parameterAsExpression( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
976
981 static QString parameterAsExpression( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
982
986 static double parameterAsDouble( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
987
992 static double parameterAsDouble( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
993
997 static int parameterAsInt( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
998
1003 static int parameterAsInt( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1004
1009 static QList<int> parameterAsInts( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1010
1015 static QList<int> parameterAsInts( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1016
1025 static QDateTime parameterAsDateTime( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1026
1035 static QDateTime parameterAsDateTime( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1036
1045 static QDate parameterAsDate( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1046
1055 static QDate parameterAsDate( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1056
1065 static QTime parameterAsTime( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1066
1075 static QTime parameterAsTime( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1076
1080 static int parameterAsEnum( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1081
1086 static int parameterAsEnum( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1087
1091 static QList<int> parameterAsEnums( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1092
1097 static QList<int> parameterAsEnums( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1098
1103 static QString parameterAsEnumString( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1104
1109 static QString parameterAsEnumString( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1110
1115 static QStringList parameterAsEnumStrings( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1116
1121 static QStringList parameterAsEnumStrings( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1122
1126 static bool parameterAsBool( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1127
1133 static bool parameterAsBoolean( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1134
1139 static bool parameterAsBool( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1140
1145 static bool parameterAsBoolean( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1146
1164 static QgsFeatureSink *parameterAsSink( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters,
1165 const QgsFields &fields, Qgis::WkbType geometryType, const QgsCoordinateReferenceSystem &crs,
1166 QgsProcessingContext &context, QString &destinationIdentifier SIP_OUT, QgsFeatureSink::SinkFlags sinkFlags = QgsFeatureSink::SinkFlags(), const QVariantMap &createOptions = QVariantMap(), const QStringList &datasourceOptions = QStringList(), const QStringList &layerOptions = QStringList() ) SIP_FACTORY;
1167
1187 static QgsFeatureSink *parameterAsSink( const QgsProcessingParameterDefinition *definition, const QVariant &value,
1188 const QgsFields &fields, Qgis::WkbType geometryType, const QgsCoordinateReferenceSystem &crs,
1189 QgsProcessingContext &context, QString &destinationIdentifier SIP_OUT, QgsFeatureSink::SinkFlags sinkFlags = QgsFeatureSink::SinkFlags(), const QVariantMap &createOptions = QVariantMap(), const QStringList &datasourceOptions = QStringList(), const QStringList &layerOptions = QStringList() ) SIP_THROW( QgsProcessingException ) SIP_FACTORY;
1190
1199 static QgsProcessingFeatureSource *parameterAsSource( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context ) SIP_FACTORY;
1200
1211 static QgsProcessingFeatureSource *parameterAsSource( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context ) SIP_FACTORY;
1212
1228 static QString parameterAsCompatibleSourceLayerPath( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters,
1229 QgsProcessingContext &context, const QStringList &compatibleFormats, const QString &preferredFormat = QString( "shp" ), QgsProcessingFeedback *feedback = nullptr );
1230
1260 static QString parameterAsCompatibleSourceLayerPathAndLayerName( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters,
1261 QgsProcessingContext &context, const QStringList &compatibleFormats, const QString &preferredFormat = QString( "shp" ), QgsProcessingFeedback *feedback = nullptr, QString *layerName SIP_OUT = nullptr );
1262
1271
1282
1290 static QgsRasterLayer *parameterAsRasterLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1291
1301 static QgsRasterLayer *parameterAsRasterLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1302
1306 static QString parameterAsOutputLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1307
1316 static QString parameterAsOutputLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context, bool testOnly = false );
1317
1321 static QString parameterAsFileOutput( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1322
1327 static QString parameterAsFileOutput( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1328
1336 static QgsVectorLayer *parameterAsVectorLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1337
1347 static QgsVectorLayer *parameterAsVectorLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1348
1358 static QgsMeshLayer *parameterAsMeshLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1359
1369 static QgsMeshLayer *parameterAsMeshLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1370
1374 static QgsCoordinateReferenceSystem parameterAsCrs( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1375
1380 static QgsCoordinateReferenceSystem parameterAsCrs( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1381
1391 static QgsRectangle parameterAsExtent( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context,
1393
1405 static QgsRectangle parameterAsExtent( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context,
1407
1419 static QgsGeometry parameterAsExtentGeometry( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context,
1421
1427 static QgsCoordinateReferenceSystem parameterAsExtentCrs( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1428
1434 static QgsCoordinateReferenceSystem parameterAsExtentCrs( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1435
1436
1444 static QgsPointXY parameterAsPoint( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context,
1446
1455 static QgsPointXY parameterAsPoint( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context,
1457
1463 static QgsCoordinateReferenceSystem parameterAsPointCrs( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1464
1471 static QgsCoordinateReferenceSystem parameterAsPointCrs( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1472
1478 static QgsGeometry parameterAsGeometry( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem() );
1479
1485 static QgsGeometry parameterAsGeometry( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem() );
1486
1493 static QgsCoordinateReferenceSystem parameterAsGeometryCrs( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1494
1501 static QgsCoordinateReferenceSystem parameterAsGeometryCrs( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1502
1506 static QString parameterAsFile( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1507
1512 static QString parameterAsFile( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1513
1518 static QVariantList parameterAsMatrix( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1519
1525 static QVariantList parameterAsMatrix( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1526
1531 static QList< QgsMapLayer *> parameterAsLayerList( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessing::LayerOptionsFlags flags = QgsProcessing::LayerOptionsFlags() );
1532
1538 static QList< QgsMapLayer *> parameterAsLayerList( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context, QgsProcessing::LayerOptionsFlags flags = QgsProcessing::LayerOptionsFlags() );
1539
1545 static QStringList parameterAsFileList( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1546
1552 static QStringList parameterAsFileList( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1553
1557 static QList<double> parameterAsRange( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1558
1563 static QList<double> parameterAsRange( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1564
1570 Q_DECL_DEPRECATED static QStringList parameterAsFields( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context ) SIP_DEPRECATED;
1571
1578 Q_DECL_DEPRECATED static QStringList parameterAsFields( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context ) SIP_DEPRECATED;
1579
1585 static QStringList parameterAsStrings( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1586
1592 static QStringList parameterAsStrings( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1593
1602 static QgsPrintLayout *parameterAsLayout( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1603
1612 static QgsPrintLayout *parameterAsLayout( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1613
1622 static QgsLayoutItem *parameterAsLayoutItem( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context, QgsPrintLayout *layout );
1623
1632 static QgsLayoutItem *parameterAsLayoutItem( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context, QgsPrintLayout *layout );
1633
1639 static QColor parameterAsColor( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1640
1646 static QColor parameterAsColor( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1647
1653 static QString parameterAsConnectionName( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1654
1660 static QString parameterAsConnectionName( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1661
1667 static QString parameterAsSchema( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1668
1674 static QString parameterAsSchema( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1675
1681 static QString parameterAsDatabaseTableName( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1682
1688 static QString parameterAsDatabaseTableName( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1689
1700 static QgsPointCloudLayer *parameterAsPointCloudLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessing::LayerOptionsFlags flags = QgsProcessing::LayerOptionsFlags() );
1701
1712 static QgsPointCloudLayer *parameterAsPointCloudLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context, QgsProcessing::LayerOptionsFlags flags = QgsProcessing::LayerOptionsFlags() );
1713
1727 static QgsAnnotationLayer *parameterAsAnnotationLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1728
1742 static QgsAnnotationLayer *parameterAsAnnotationLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1743
1749 static QgsProcessingParameterDefinition *parameterFromVariantMap( const QVariantMap &map ) SIP_FACTORY;
1750
1754 static QString descriptionFromName( const QString &name );
1755
1761 static QgsProcessingParameterDefinition *parameterFromScriptCode( const QString &code ) SIP_FACTORY;
1762
1763 private:
1764
1765 static bool parseScriptCodeParameterOptions( const QString &code, bool &isOptional, QString &name, QString &type, QString &definition );
1766};
1767
1768
1769
1776{
1777 public:
1778
1782 QgsProcessingParameterBoolean( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
1783 bool optional = false );
1784
1788 static QString typeName() { return QStringLiteral( "boolean" ); }
1789 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1790 QString type() const override { return typeName(); }
1791 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1792 QString asScriptCode() const override;
1793
1797 static QgsProcessingParameterBoolean *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1798};
1799
1806{
1807 public:
1808
1812 QgsProcessingParameterCrs( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
1813 bool optional = false );
1814
1818 static QString typeName() { return QStringLiteral( "crs" ); }
1819 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1820 QString type() const override { return typeName(); }
1821 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
1822 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1823 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
1824 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
1825
1829 static QgsProcessingParameterCrs *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1830
1831};
1832
1839{
1840 public:
1841
1845 QgsProcessingParameterExtent( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
1846 bool optional = false );
1847
1851 static QString typeName() { return QStringLiteral( "extent" ); }
1852 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1853 QString type() const override { return typeName(); }
1854 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
1855 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1856 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
1857 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
1858
1862 static QgsProcessingParameterExtent *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1863
1864 private:
1865
1871 static bool variantIsValidStringForExtent( const QVariant &value );
1872
1873};
1874
1875
1882{
1883 public:
1884
1888 QgsProcessingParameterPoint( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
1889 bool optional = false );
1890
1894 static QString typeName() { return QStringLiteral( "point" ); }
1895 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1896 QString type() const override { return typeName(); }
1897 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
1898 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1899
1903 static QgsProcessingParameterPoint *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1904
1905};
1906
1914{
1915 public:
1916
1924 QgsProcessingParameterGeometry( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(), bool optional = false, const QList< int > &geometryTypes = QList< int >(), bool allowMultipart = true );
1925
1929 static QString typeName() { return QStringLiteral( "geometry" ); }
1930 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1931 QString type() const override { return typeName(); }
1932 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
1933 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1934 QString asScriptCode() const override;
1936 QVariantMap toVariantMap() const override;
1937 bool fromVariantMap( const QVariantMap &map ) override;
1938
1943 QList<int> geometryTypes() const { return mGeomTypes; }
1944
1949 void setGeometryTypes( const QList<int> &geometryTypes ) { mGeomTypes = geometryTypes; }
1950
1955 bool allowMultipart() const { return mAllowMultipart; }
1956
1961 void setAllowMultipart( bool allowMultipart ) { mAllowMultipart = allowMultipart; }
1962
1963
1964
1968 static QgsProcessingParameterGeometry *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1969
1970 private:
1971
1972 QList<int> mGeomTypes;
1973 bool mAllowMultipart;
1974
1975};
1976
1983{
1984 public:
1985
1993 QgsProcessingParameterFile( const QString &name, const QString &description = QString(), Qgis::ProcessingFileParameterBehavior behavior = Qgis::ProcessingFileParameterBehavior::File, const QString &extension = QString(), const QVariant &defaultValue = QVariant(),
1994 bool optional = false, const QString &fileFilter = QString() );
1995
1999 static QString typeName() { return QStringLiteral( "file" ); }
2000 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2001 QString type() const override { return typeName(); }
2002 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2003 QString asScriptCode() const override;
2005 QString createFileFilter() const override;
2006
2012
2017 void setBehavior( Qgis::ProcessingFileParameterBehavior behavior ) { mBehavior = behavior; }
2018
2026 QString extension() const { return mExtension; }
2027
2037 void setExtension( const QString &extension );
2038
2045 QString fileFilter() const;
2046
2056 void setFileFilter( const QString &filter );
2057
2058 QVariantMap toVariantMap() const override;
2059 bool fromVariantMap( const QVariantMap &map ) override;
2060
2064 static QgsProcessingParameterFile *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition, Qgis::ProcessingFileParameterBehavior behavior = Qgis::ProcessingFileParameterBehavior::File ) SIP_FACTORY;
2065
2066 private:
2067
2069 QString mExtension;
2070 QString mFileFilter;
2071};
2072
2079{
2080 public:
2081
2085 QgsProcessingParameterMatrix( const QString &name, const QString &description = QString(), int numberRows = 3,
2086 bool hasFixedNumberRows = false, const QStringList &headers = QStringList(),
2087 const QVariant &defaultValue = QVariant(),
2088 bool optional = false );
2089
2093 static QString typeName() { return QStringLiteral( "matrix" ); }
2094 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2095 QString type() const override { return typeName(); }
2096 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2097 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2099
2104 QStringList headers() const;
2105
2110 void setHeaders( const QStringList &headers );
2111
2118 int numberRows() const;
2119
2126 void setNumberRows( int rows );
2127
2133 bool hasFixedNumberRows() const;
2134
2140 void setHasFixedNumberRows( bool hasFixedNumberRows );
2141
2142 QVariantMap toVariantMap() const override;
2143 bool fromVariantMap( const QVariantMap &map ) override;
2144
2148 static QgsProcessingParameterMatrix *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2149
2150 private:
2151
2152 QStringList mHeaders;
2153 int mNumberRows = 3;
2154 bool mFixedNumberRows = false;
2155
2156};
2157
2164{
2165 public:
2166
2170 QgsProcessingParameterMultipleLayers( const QString &name, const QString &description = QString(), Qgis::ProcessingSourceType layerType = Qgis::ProcessingSourceType::VectorAnyGeometry,
2171 const QVariant &defaultValue = QVariant(),
2172 bool optional = false );
2173
2177 static QString typeName() { return QStringLiteral( "multilayer" ); }
2178 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2179 QString type() const override { return typeName(); }
2180 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2181 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2182 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
2183 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
2184 QString asScriptCode() const override;
2186 QString createFileFilter() const override;
2187
2192 Qgis::ProcessingSourceType layerType() const;
2193
2198 void setLayerType( Qgis::ProcessingSourceType type );
2199
2205 int minimumNumberInputs() const;
2206
2212 void setMinimumNumberInputs( int minimum );
2213
2214 QVariantMap toVariantMap() const override;
2215 bool fromVariantMap( const QVariantMap &map ) override;
2216
2220 static QgsProcessingParameterMultipleLayers *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2221
2222 private:
2223
2225 int mMinimumNumberInputs = 0;
2226
2227};
2228
2247{
2248 public:
2249
2253 explicit QgsProcessingParameterNumber( const QString &name, const QString &description = QString(),
2255 const QVariant &defaultValue = QVariant(),
2256 bool optional = false,
2257 double minValue = std::numeric_limits<double>::lowest() + 1,
2258 double maxValue = std::numeric_limits<double>::max()
2259 );
2260
2264 static QString typeName() { return QStringLiteral( "number" ); }
2265 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2266 QString type() const override { return typeName(); }
2267 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2268 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2269 QString toolTip() const override;
2271
2276 double minimum() const;
2277
2282 void setMinimum( double minimum );
2283
2288 double maximum() const;
2289
2294 void setMaximum( double maximum );
2295
2300 Qgis::ProcessingNumberParameterType dataType() const;
2301
2306 void setDataType( Qgis::ProcessingNumberParameterType type );
2307
2308 QVariantMap toVariantMap() const override;
2309 bool fromVariantMap( const QVariantMap &map ) override;
2310
2314 static QgsProcessingParameterNumber *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2315
2316 private:
2317
2318 double mMin = std::numeric_limits<double>::lowest() + 1;
2319 double mMax = std::numeric_limits<double>::max();
2321};
2322
2343{
2344 public:
2345
2349 explicit QgsProcessingParameterDistance( const QString &name, const QString &description = QString(),
2350 const QVariant &defaultValue = QVariant(),
2351 const QString &parentParameterName = QString(),
2352 bool optional = false,
2353 double minValue = std::numeric_limits<double>::lowest() + 1,
2354 double maxValue = std::numeric_limits<double>::max() );
2355
2359 static QString typeName() { return QStringLiteral( "distance" ); } // cppcheck-suppress duplInheritedMember
2360
2361 QgsProcessingParameterDistance *clone() const override SIP_FACTORY;
2362
2363 QString type() const override;
2364 QStringList dependsOnOtherParameters() const override;
2365 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const override;
2366
2371 QString parentParameterName() const;
2372
2377 void setParentParameterName( const QString &parentParameterName );
2378
2385 Qgis::DistanceUnit defaultUnit() const { return mDefaultUnit; }
2386
2393 void setDefaultUnit( Qgis::DistanceUnit unit ) { mDefaultUnit = unit; }
2394
2395 QVariantMap toVariantMap() const override;
2396 bool fromVariantMap( const QVariantMap &map ) override;
2397
2398 private:
2399
2400 QString mParentParameterName;
2402
2403};
2404
2405
2426{
2427 public:
2428
2432 explicit QgsProcessingParameterArea( const QString &name, const QString &description = QString(),
2433 const QVariant &defaultValue = QVariant(),
2434 const QString &parentParameterName = QString(),
2435 bool optional = false,
2436 double minValue = 0,
2437 double maxValue = std::numeric_limits<double>::max() );
2438
2442 static QString typeName() { return QStringLiteral( "area" ); } // cppcheck-suppress duplInheritedMember
2443
2444 QgsProcessingParameterArea *clone() const override SIP_FACTORY;
2445
2446 QString type() const override;
2447 QStringList dependsOnOtherParameters() const override;
2448 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const override;
2449
2454 QString parentParameterName() const;
2455
2460 void setParentParameterName( const QString &parentParameterName );
2461
2467 Qgis::AreaUnit defaultUnit() const { return mDefaultUnit; }
2468
2474 void setDefaultUnit( Qgis::AreaUnit unit ) { mDefaultUnit = unit; }
2475
2476 QVariantMap toVariantMap() const override;
2477 bool fromVariantMap( const QVariantMap &map ) override;
2478
2479 private:
2480
2481 QString mParentParameterName;
2483
2484};
2485
2486
2507{
2508 public:
2509
2513 explicit QgsProcessingParameterVolume( const QString &name, const QString &description = QString(),
2514 const QVariant &defaultValue = QVariant(),
2515 const QString &parentParameterName = QString(),
2516 bool optional = false,
2517 double minValue = 0,
2518 double maxValue = std::numeric_limits<double>::max() );
2519
2523 static QString typeName() { return QStringLiteral( "volume" ); } // cppcheck-suppress duplInheritedMember
2524
2525 QgsProcessingParameterVolume *clone() const override SIP_FACTORY;
2526
2527 QString type() const override;
2528 QStringList dependsOnOtherParameters() const override;
2529 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const override;
2530
2535 QString parentParameterName() const;
2536
2541 void setParentParameterName( const QString &parentParameterName );
2542
2548 Qgis::VolumeUnit defaultUnit() const { return mDefaultUnit; }
2549
2555 void setDefaultUnit( Qgis::VolumeUnit unit ) { mDefaultUnit = unit; }
2556
2557 QVariantMap toVariantMap() const override;
2558 bool fromVariantMap( const QVariantMap &map ) override;
2559
2560 private:
2561
2562 QString mParentParameterName;
2564
2565};
2566
2567
2576{
2577 public:
2578
2582 explicit QgsProcessingParameterDuration( const QString &name, const QString &description = QString(),
2583 const QVariant &defaultValue = QVariant(),
2584 bool optional = false,
2585 double minValue = std::numeric_limits<double>::lowest() + 1,
2586 double maxValue = std::numeric_limits<double>::max() );
2587
2591 static QString typeName() { return QStringLiteral( "duration" ); } // cppcheck-suppress duplInheritedMember
2592
2593 QgsProcessingParameterDuration *clone() const override SIP_FACTORY;
2594
2595 QString type() const override;
2596 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const override;
2597
2603 Qgis::TemporalUnit defaultUnit() const { return mDefaultUnit; }
2604
2610 void setDefaultUnit( Qgis::TemporalUnit unit ) { mDefaultUnit = unit; }
2611
2612 QVariantMap toVariantMap() const override;
2613 bool fromVariantMap( const QVariantMap &map ) override;
2614
2615 private:
2616
2618
2619};
2620
2632{
2633 public:
2634
2638 explicit QgsProcessingParameterScale( const QString &name, const QString &description = QString(),
2639 const QVariant &defaultValue = QVariant(),
2640 bool optional = false );
2641
2645 static QString typeName() { return QStringLiteral( "scale" ); } // cppcheck-suppress duplInheritedMember
2646
2647 QgsProcessingParameterScale *clone() const override SIP_FACTORY;
2648
2649 QString type() const override;
2650 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const override;
2651
2655 static QgsProcessingParameterScale *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY; // cppcheck-suppress duplInheritedMember
2656
2657};
2658
2665{
2666 public:
2667
2671 QgsProcessingParameterRange( const QString &name, const QString &description = QString(),
2673 const QVariant &defaultValue = QVariant(),
2674 bool optional = false );
2675
2679 static QString typeName() { return QStringLiteral( "range" ); }
2680 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2681 QString type() const override { return typeName(); }
2682 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2683 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2685
2690 Qgis::ProcessingNumberParameterType dataType() const;
2691
2696 void setDataType( Qgis::ProcessingNumberParameterType dataType );
2697
2698 QVariantMap toVariantMap() const override;
2699 bool fromVariantMap( const QVariantMap &map ) override;
2700
2704 static QgsProcessingParameterRange *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2705
2706 private:
2707
2709};
2710
2717{
2718 public:
2719
2723 QgsProcessingParameterRasterLayer( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
2724 bool optional = false );
2725
2729 static QString typeName() { return QStringLiteral( "raster" ); }
2730 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2731 QString type() const override { return typeName(); }
2732 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2733 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2734 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
2735 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
2736 QString createFileFilter() const override;
2737
2741 static QgsProcessingParameterRasterLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2742
2743};
2744
2763{
2764 public:
2765
2769 QgsProcessingParameterEnum( const QString &name, const QString &description = QString(), const QStringList &options = QStringList(),
2770 bool allowMultiple = false,
2771 const QVariant &defaultValue = QVariant(),
2772 bool optional = false,
2773 bool usesStaticStrings = false );
2774
2778 static QString typeName() { return QStringLiteral( "enum" ); }
2779 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2780 QString type() const override { return typeName(); }
2781 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2782 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2783 QString valueAsPythonComment( const QVariant &value, QgsProcessingContext &context ) const override;
2784 QString asScriptCode() const override;
2786
2791 QStringList options() const;
2792
2797 void setOptions( const QStringList &options );
2798
2803 bool allowMultiple() const;
2804
2809 void setAllowMultiple( bool allowMultiple );
2810
2817 bool usesStaticStrings() const;
2818
2825 void setUsesStaticStrings( bool usesStaticStrings );
2826
2827 QVariantMap toVariantMap() const override;
2828 bool fromVariantMap( const QVariantMap &map ) override;
2829
2833 static QgsProcessingParameterEnum *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2834
2835 private:
2836
2837 QStringList mOptions;
2838 bool mAllowMultiple = false;
2839 bool mUsesStaticStrings = false;
2840};
2841
2869{
2870 public:
2871
2875 QgsProcessingParameterString( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
2876 bool multiLine = false,
2877 bool optional = false );
2878
2882 static QString typeName() { return QStringLiteral( "string" ); }
2883 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2884 QString type() const override { return typeName(); }
2885 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2886 QString asScriptCode() const override;
2888
2893 bool multiLine() const;
2894
2899 void setMultiLine( bool multiLine );
2900
2901 QVariantMap toVariantMap() const override;
2902 bool fromVariantMap( const QVariantMap &map ) override;
2903
2907 static QgsProcessingParameterString *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2908
2909 private:
2910
2911 bool mMultiLine = false;
2912
2913};
2914
2915
2929{
2930 public:
2931
2935 QgsProcessingParameterAuthConfig( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
2936 bool optional = false );
2937
2941 static QString typeName() { return QStringLiteral( "authcfg" ); }
2942 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2943 QString type() const override { return typeName(); }
2944 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2945 QString asScriptCode() const override;
2946
2950 static QgsProcessingParameterAuthConfig *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2951
2952};
2953
2960{
2961 public:
2962
2966 QgsProcessingParameterExpression( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
2967 const QString &parentLayerParameterName = QString(),
2968 bool optional = false, Qgis::ExpressionType type = Qgis::ExpressionType::Qgis );
2969
2973 static QString typeName() { return QStringLiteral( "expression" ); }
2974 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2975 QString type() const override { return typeName(); }
2976 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2977 QStringList dependsOnOtherParameters() const override;
2979
2984 QString parentLayerParameterName() const;
2985
2990 void setParentLayerParameterName( const QString &parentLayerParameterName );
2991
2998 Qgis::ExpressionType expressionType() const;
2999
3006 void setExpressionType( Qgis::ExpressionType type );
3007
3008 QVariantMap toVariantMap() const override;
3009 bool fromVariantMap( const QVariantMap &map ) override;
3010
3014 static QgsProcessingParameterExpression *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3015
3016 private:
3017
3018 QString mParentLayerParameterName;
3020};
3021
3022
3029{
3030 public:
3031
3035 QgsProcessingParameterLimitedDataTypes( const QList< int > &types = QList< int >() );
3036
3041 QList< int > dataTypes() const;
3042
3047 void setDataTypes( const QList< int > &types );
3048
3049 protected:
3050
3052 QList< int > mDataTypes;
3053};
3054
3062{
3063 public:
3064
3068 QgsProcessingParameterVectorLayer( const QString &name,
3069 const QString &description = QString(),
3070 const QList< int > &types = QList< int >(),
3071 const QVariant &defaultValue = QVariant(),
3072 bool optional = false );
3073
3077 static QString typeName() { return QStringLiteral( "vector" ); }
3078 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3079 QString type() const override { return typeName(); }
3080 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3081 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3082 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
3083 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
3085 QString createFileFilter() const override;
3086
3087 QVariantMap toVariantMap() const override;
3088 bool fromVariantMap( const QVariantMap &map ) override;
3089
3093 static QgsProcessingParameterVectorLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3094
3095};
3096
3104{
3105 public:
3106
3110 QgsProcessingParameterMeshLayer( const QString &name,
3111 const QString &description = QString(),
3112 const QVariant &defaultValue = QVariant(),
3113 bool optional = false );
3114
3118 static QString typeName() { return QStringLiteral( "mesh" ); }
3119 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3120 QString type() const override { return typeName(); }
3121 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3122 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3123 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
3124 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
3125 QString createFileFilter() const override;
3126
3130 static QgsProcessingParameterMeshLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3131};
3132
3139{
3140 public:
3141
3145 QgsProcessingParameterMapLayer( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
3146 bool optional = false,
3147 const QList< int > &types = QList< int >() );
3148
3152 static QString typeName() { return QStringLiteral( "layer" ); }
3153 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3154 QString type() const override { return typeName(); }
3155 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3156 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3157 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
3158 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
3159 QString asScriptCode() const override;
3161 QString createFileFilter() const override;
3162
3163 QVariantMap toVariantMap() const override;
3164 bool fromVariantMap( const QVariantMap &map ) override;
3165
3169 static QgsProcessingParameterMapLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3170
3171};
3172
3179{
3180 public:
3181
3185 QgsProcessingParameterField( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
3186 const QString &parentLayerParameterName = QString(),
3188 bool allowMultiple = false,
3189 bool optional = false,
3190 bool defaultToAllFields = false );
3191
3195 static QString typeName() { return QStringLiteral( "field" ); }
3196 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3197 QString type() const override { return typeName(); }
3198 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3199 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3200 QString asScriptCode() const override;
3202 QStringList dependsOnOtherParameters() const override;
3203
3208 QString parentLayerParameterName() const;
3209
3214 void setParentLayerParameterName( const QString &parentLayerParameterName );
3215
3221
3226 void setDataType( Qgis::ProcessingFieldParameterDataType type );
3227
3232 bool allowMultiple() const;
3233
3238 void setAllowMultiple( bool allowMultiple );
3239
3249 bool defaultToAllFields() const;
3250
3260 void setDefaultToAllFields( bool enabled );
3261
3262 QVariantMap toVariantMap() const override;
3263 bool fromVariantMap( const QVariantMap &map ) override;
3264
3268 static QgsProcessingParameterField *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3269
3270 private:
3271
3272 QString mParentLayerParameterName;
3274 bool mAllowMultiple = false;
3275 bool mDefaultToAllFields = false;
3276
3277};
3278
3279
3286{
3287 public:
3288
3292 QgsProcessingParameterFeatureSource( const QString &name, const QString &description = QString(),
3293 const QList< int > &types = QList< int >(),
3294 const QVariant &defaultValue = QVariant(), bool optional = false );
3295
3299 static QString typeName() { return QStringLiteral( "source" ); }
3300 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3301 QString type() const override { return typeName(); }
3302 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3303 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3304 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
3305 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
3306 QString asScriptCode() const override;
3308 QString createFileFilter() const override;
3309
3310 QVariantMap toVariantMap() const override;
3311 bool fromVariantMap( const QVariantMap &map ) override;
3312
3316 static QgsProcessingParameterFeatureSource *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3317
3318};
3319
3327{
3328 public:
3329
3336 QgsProcessingDestinationParameter( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
3337 bool optional = false, bool createByDefault = true );
3338
3339 bool isDestination() const override { return true; }
3340 QVariantMap toVariantMap() const override;
3341 bool fromVariantMap( const QVariantMap &map ) override;
3343 QString createFileFilter() const override;
3344
3350
3356 bool supportsNonFileBasedOutput() const { return mSupportsNonFileBasedOutputs; }
3357
3363 void setSupportsNonFileBasedOutput( bool supportsNonFileBasedOutput ) { mSupportsNonFileBasedOutputs = supportsNonFileBasedOutput; }
3364
3369 virtual QString defaultFileExtension() const = 0;
3370
3376 virtual QString generateTemporaryDestination( const QgsProcessingContext *context = nullptr ) const;
3377
3392 virtual bool isSupportedOutputValue( const QVariant &value, QgsProcessingContext &context, QString &error SIP_OUT ) const;
3393
3399 bool createByDefault() const;
3400
3406 void setCreateByDefault( bool createByDefault );
3407
3408 protected:
3409
3418 QgsProcessingProvider *originalProvider() const { return mOriginalProvider; }
3419
3420 private:
3421
3429 QgsProcessingProvider *mOriginalProvider = nullptr;
3430
3431 bool mSupportsNonFileBasedOutputs = true;
3432 bool mCreateByDefault = true;
3433
3434 friend class QgsProcessingModelAlgorithm;
3435 friend class TestQgsProcessing;
3436 friend class TestQgsProcessingModelAlgorithm;
3437};
3438
3439
3448{
3449 public:
3450
3457 QgsProcessingParameterFeatureSink( const QString &name, const QString &description = QString(), Qgis::ProcessingSourceType type = Qgis::ProcessingSourceType::VectorAnyGeometry, const QVariant &defaultValue = QVariant(),
3458 bool optional = false, bool createByDefault = true, bool supportsAppend = false );
3459
3463 static QString typeName() { return QStringLiteral( "sink" ); }
3464 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3465 QString type() const override { return typeName(); }
3466 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3467 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3468 QString asScriptCode() const override;
3469 QgsProcessingOutputDefinition *toOutputDefinition() const override SIP_FACTORY;
3470 QString defaultFileExtension() const override;
3471 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const override;
3472 QString createFileFilter() const override;
3473
3479 virtual QStringList supportedOutputVectorLayerExtensions() const;
3480
3485 Qgis::ProcessingSourceType dataType() const;
3486
3491 bool hasGeometry() const;
3492
3497 void setDataType( Qgis::ProcessingSourceType type );
3498
3507 bool supportsAppend() const;
3508
3517 void setSupportsAppend( bool supportsAppend );
3518
3519 QVariantMap toVariantMap() const override;
3520 bool fromVariantMap( const QVariantMap &map ) override;
3521 QString generateTemporaryDestination( const QgsProcessingContext *context = nullptr ) const override;
3522
3526 static QgsProcessingParameterFeatureSink *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3527
3528 private:
3529
3530 Qgis::ProcessingSourceType mDataType = Qgis::ProcessingSourceType::VectorAnyGeometry;
3531 bool mSupportsAppend = false;
3532};
3533
3534
3545{
3546 public:
3547
3554 QgsProcessingParameterVectorDestination( const QString &name, const QString &description = QString(), Qgis::ProcessingSourceType type = Qgis::ProcessingSourceType::VectorAnyGeometry, const QVariant &defaultValue = QVariant(),
3555 bool optional = false, bool createByDefault = true );
3556
3560 static QString typeName() { return QStringLiteral( "vectorDestination" ); }
3561 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3562 QString type() const override { return typeName(); }
3563 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3564 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3565 QString asScriptCode() const override;
3566 QgsProcessingOutputDefinition *toOutputDefinition() const override SIP_FACTORY;
3567 QString defaultFileExtension() const override;
3568 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const override;
3569 QString createFileFilter() const override;
3570
3576 virtual QStringList supportedOutputVectorLayerExtensions() const;
3577
3582 Qgis::ProcessingSourceType dataType() const;
3583
3588 bool hasGeometry() const;
3589
3594 void setDataType( Qgis::ProcessingSourceType type );
3595
3596 QVariantMap toVariantMap() const override;
3597 bool fromVariantMap( const QVariantMap &map ) override;
3598
3602 static QgsProcessingParameterVectorDestination *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3603
3604
3605 private:
3606
3607 Qgis::ProcessingSourceType mDataType = Qgis::ProcessingSourceType::VectorAnyGeometry;
3608};
3609
3617{
3618 public:
3619
3626 QgsProcessingParameterRasterDestination( const QString &name, const QString &description = QString(),
3627 const QVariant &defaultValue = QVariant(),
3628 bool optional = false,
3629 bool createByDefault = true );
3630
3634 static QString typeName() { return QStringLiteral( "rasterDestination" ); }
3635 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3636 QString type() const override { return typeName(); }
3637 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3638 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3639 QgsProcessingOutputDefinition *toOutputDefinition() const override SIP_FACTORY;
3640 QString defaultFileExtension() const override;
3641 QString createFileFilter() const override;
3642
3648 virtual QStringList supportedOutputRasterLayerExtensions() const;
3649
3653 static QgsProcessingParameterRasterDestination *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3654};
3655
3677{
3678 public:
3679
3686 QgsProcessingParameterFileDestination( const QString &name, const QString &description = QString(),
3687 const QString &fileFilter = QString(),
3688 const QVariant &defaultValue = QVariant(),
3689 bool optional = false,
3690 bool createByDefault = true );
3691
3695 static QString typeName() { return QStringLiteral( "fileDestination" ); }
3696 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3697 QString type() const override { return typeName(); }
3698 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3699 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3700 QgsProcessingOutputDefinition *toOutputDefinition() const override SIP_FACTORY;
3701 QString defaultFileExtension() const override;
3702 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const override;
3703 QString createFileFilter() const override;
3704
3709 QString fileFilter() const;
3710
3715 void setFileFilter( const QString &filter );
3716
3717 QVariantMap toVariantMap() const override;
3718 bool fromVariantMap( const QVariantMap &map ) override;
3719
3723 static QgsProcessingParameterFileDestination *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3724
3725
3726 private:
3727
3728 QString mFileFilter;
3729};
3730
3738{
3739 public:
3740
3744 QgsProcessingParameterFolderDestination( const QString &name, const QString &description = QString(),
3745 const QVariant &defaultValue = QVariant(),
3746 bool optional = false,
3747 bool createByDefault = true );
3748
3752 static QString typeName() { return QStringLiteral( "folderDestination" ); }
3753 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3754 QString type() const override { return typeName(); }
3755 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3756 QgsProcessingOutputDefinition *toOutputDefinition() const override SIP_FACTORY;
3757 QString defaultFileExtension() const override;
3758
3762 static QgsProcessingParameterFolderDestination *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3763
3764};
3765
3772{
3773 public:
3774
3778 QgsProcessingParameterBand( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
3779 const QString &parentLayerParameterName = QString(),
3780 bool optional = false,
3781 bool allowMultiple = false );
3782
3786 static QString typeName() { return QStringLiteral( "band" ); }
3787 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3788 QString type() const override { return typeName(); }
3789 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3790 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3791 QString asScriptCode() const override;
3792 QStringList dependsOnOtherParameters() const override;
3794
3799 QString parentLayerParameterName() const;
3800
3805 void setParentLayerParameterName( const QString &parentLayerParameterName );
3806
3807 QVariantMap toVariantMap() const override;
3808 bool fromVariantMap( const QVariantMap &map ) override;
3809
3813 static QgsProcessingParameterBand *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3814
3820 bool allowMultiple() const;
3821
3827 void setAllowMultiple( bool allowMultiple );
3828
3829 private:
3830
3831 QString mParentLayerParameterName;
3832 bool mAllowMultiple = false;
3833};
3834
3847{
3848 public:
3849
3853 QgsProcessingParameterLayout( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
3854 bool optional = false );
3855
3859 static QString typeName() { return QStringLiteral( "layout" ); }
3860 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3861 QString type() const override { return typeName(); }
3862 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3863 QString asScriptCode() const override;
3865
3869 static QgsProcessingParameterLayout *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3870
3871};
3872
3885{
3886 public:
3887
3891 QgsProcessingParameterLayoutItem( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
3892 const QString &parentLayoutParameterName = QString(),
3893 int itemType = -1,
3894 bool optional = false );
3895
3899 static QString typeName() { return QStringLiteral( "layoutitem" ); }
3900 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3901 QString type() const override { return typeName(); }
3902 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3903 QString asScriptCode() const override;
3905 QVariantMap toVariantMap() const override;
3906 bool fromVariantMap( const QVariantMap &map ) override;
3907 QStringList dependsOnOtherParameters() const override;
3908
3912 static QgsProcessingParameterLayoutItem *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3913
3918 QString parentLayoutParameterName() const;
3919
3924 void setParentLayoutParameterName( const QString &name );
3925
3933 int itemType() const;
3934
3942 void setItemType( int type );
3943
3944 private:
3945 QString mParentLayoutParameterName;
3946 int mItemType = -1;
3947};
3948
3959{
3960 public:
3961
3967 QgsProcessingParameterColor( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
3968 bool opacityEnabled = true,
3969 bool optional = false );
3970
3974 static QString typeName() { return QStringLiteral( "color" ); }
3975 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3976 QString type() const override { return typeName(); }
3977 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3978 QString asScriptCode() const override;
3980 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3981 QVariantMap toVariantMap() const override;
3982 bool fromVariantMap( const QVariantMap &map ) override;
3983
3990 bool opacityEnabled() const;
3991
3999 void setOpacityEnabled( bool enabled );
4000
4004 static QgsProcessingParameterColor *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4005
4006 private:
4007
4008 bool mAllowOpacity = true;
4009
4010};
4011
4012
4023{
4024 public:
4025
4029 QgsProcessingParameterCoordinateOperation( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
4030 const QString &sourceCrsParameterName = QString(), const QString &destinationCrsParameterName = QString(),
4031 const QVariant &staticSourceCrs = QVariant(), const QVariant &staticDestinationCrs = QVariant(),
4032 bool optional = false );
4033
4037 static QString typeName() { return QStringLiteral( "coordinateoperation" ); }
4038 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4039 QString type() const override { return typeName(); }
4040 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4041 QString asScriptCode() const override;
4043 QStringList dependsOnOtherParameters() const override;
4044
4045 QVariantMap toVariantMap() const override;
4046 bool fromVariantMap( const QVariantMap &map ) override;
4047
4051 static QgsProcessingParameterCoordinateOperation *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4052
4058 QString sourceCrsParameterName() const { return mSourceParameterName; }
4059
4065 void setSourceCrsParameterName( const QString &name ) { mSourceParameterName = name; }
4066
4072 QString destinationCrsParameterName() const { return mDestParameterName; }
4073
4079 void setDestinationCrsParameterName( const QString &name ) { mDestParameterName = name; }
4080
4086 QVariant sourceCrs() const { return mSourceCrs; }
4087
4093 void setSourceCrs( const QVariant &crs ) { mSourceCrs = crs; }
4094
4100 QVariant destinationCrs() const { return mDestCrs; }
4101
4107 void setDestinationCrs( const QVariant &crs ) { mDestCrs = crs; }
4108
4109 private:
4110 QString valueAsPythonStringPrivate( const QVariant &value, QgsProcessingContext &context, bool allowNonStringValues ) const ;
4111
4112 QString mSourceParameterName;
4113 QString mDestParameterName;
4114 QVariant mSourceCrs;
4115 QVariant mDestCrs;
4116
4117};
4118
4119
4130{
4131 public:
4132
4136 QgsProcessingParameterMapTheme( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
4137 bool optional = false );
4138
4142 static QString typeName() { return QStringLiteral( "maptheme" ); }
4143 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4144 QString type() const override { return typeName(); }
4145 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4146 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4147 QString asScriptCode() const override;
4149 QVariantMap toVariantMap() const override;
4150 bool fromVariantMap( const QVariantMap &map ) override;
4151
4155 static QgsProcessingParameterMapTheme *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4156
4157 private:
4158
4159};
4160
4161
4173{
4174 public:
4175
4179 explicit QgsProcessingParameterDateTime( const QString &name, const QString &description = QString(),
4181 const QVariant &defaultValue = QVariant(),
4182 bool optional = false,
4183 const QDateTime &minValue = QDateTime(),
4184 const QDateTime &maxValue = QDateTime()
4185 );
4186
4190 static QString typeName() { return QStringLiteral( "datetime" ); }
4191 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4192 QString type() const override { return typeName(); }
4193 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4194 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4195 QString toolTip() const override;
4197
4205 QDateTime minimum() const;
4206
4218 void setMinimum( const QDateTime &minimum );
4219
4227 QDateTime maximum() const;
4228
4240 void setMaximum( const QDateTime &maximum );
4241
4247
4252 void setDataType( Qgis::ProcessingDateTimeParameterDataType type );
4253
4254 QVariantMap toVariantMap() const override;
4255 bool fromVariantMap( const QVariantMap &map ) override;
4256
4260 static QgsProcessingParameterDateTime *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4261
4262 private:
4263
4264 QDateTime mMin;
4265 QDateTime mMax;
4267};
4268
4269
4281{
4282 public:
4283
4290 QgsProcessingParameterProviderConnection( const QString &name, const QString &description, const QString &provider, const QVariant &defaultValue = QVariant(),
4291 bool optional = false );
4292
4296 static QString typeName() { return QStringLiteral( "providerconnection" ); }
4297 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4298 QString type() const override { return typeName(); }
4299 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4300 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4301 QString asScriptCode() const override;
4303 QVariantMap toVariantMap() const override;
4304 bool fromVariantMap( const QVariantMap &map ) override;
4305
4310 QString providerId() const { return mProviderId; }
4311
4316 void setProviderId( const QString &provider ) { mProviderId = provider; }
4317
4321 static QgsProcessingParameterProviderConnection *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4322
4323 private:
4324
4325 QString mProviderId;
4326};
4327
4328
4340{
4341 public:
4342
4351 QgsProcessingParameterDatabaseSchema( const QString &name, const QString &description, const QString &connectionParameterName = QString(), const QVariant &defaultValue = QVariant(),
4352 bool optional = false );
4353
4357 static QString typeName() { return QStringLiteral( "databaseschema" ); }
4358 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4359 QString type() const override { return typeName(); }
4360 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4361 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4362 QString asScriptCode() const override;
4364 QVariantMap toVariantMap() const override;
4365 bool fromVariantMap( const QVariantMap &map ) override;
4366 QStringList dependsOnOtherParameters() const override;
4367
4372 QString parentConnectionParameterName() const;
4373
4378 void setParentConnectionParameterName( const QString &name );
4379
4383 static QgsProcessingParameterDatabaseSchema *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4384
4385 private:
4386
4387 QString mParentConnectionParameterName;
4388};
4389
4390
4402{
4403 public:
4404
4414 QgsProcessingParameterDatabaseTable( const QString &name, const QString &description,
4415 const QString &connectionParameterName = QString(),
4416 const QString &schemaParameterName = QString(),
4417 const QVariant &defaultValue = QVariant(),
4418 bool optional = false,
4419 bool allowNewTableNames = false );
4420
4424 static QString typeName() { return QStringLiteral( "databasetable" ); }
4425 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4426 QString type() const override { return typeName(); }
4427 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4428 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4429 QString asScriptCode() const override;
4431 QVariantMap toVariantMap() const override;
4432 bool fromVariantMap( const QVariantMap &map ) override;
4433 QStringList dependsOnOtherParameters() const override;
4434
4439 QString parentConnectionParameterName() const;
4440
4445 void setParentConnectionParameterName( const QString &name );
4446
4451 QString parentSchemaParameterName() const;
4452
4457 void setParentSchemaParameterName( const QString &name );
4458
4462 static QgsProcessingParameterDatabaseTable *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4463
4470 bool allowNewTableNames() const;
4471
4478 void setAllowNewTableNames( bool allowed );
4479
4480 private:
4481
4482 QString mParentConnectionParameterName;
4483 QString mParentSchemaParameterName;
4484 bool mAllowNewTableNames = false;
4485};
4486
4487
4495{
4496 public:
4497
4501 QgsProcessingParameterPointCloudLayer( const QString &name, const QString &description = QString(),
4502 const QVariant &defaultValue = QVariant(), bool optional = false );
4503
4507 static QString typeName() { return QStringLiteral( "pointcloud" ); }
4508 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4509 QString type() const override { return typeName(); }
4510 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4511 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4512 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
4513 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
4514 QString createFileFilter() const override;
4515
4519 static QgsProcessingParameterPointCloudLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4520};
4521
4522
4530{
4531 public:
4532
4536 QgsProcessingParameterAnnotationLayer( const QString &name, const QString &description = QString(),
4537 const QVariant &defaultValue = QVariant(), bool optional = false );
4538
4542 static QString typeName() { return QStringLiteral( "annotation" ); }
4543 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4544 QString type() const override { return typeName(); }
4545 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4546 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4547 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
4548 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
4549
4553 static QgsProcessingParameterAnnotationLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4554};
4555
4564{
4565 public:
4566
4573 QgsProcessingParameterPointCloudDestination( const QString &name, const QString &description = QString(),
4574 const QVariant &defaultValue = QVariant(),
4575 bool optional = false,
4576 bool createByDefault = true );
4577
4581 static QString typeName() { return QStringLiteral( "pointCloudDestination" ); }
4582 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4583 QString type() const override { return typeName(); }
4584 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4585 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4586 QgsProcessingOutputDefinition *toOutputDefinition() const override SIP_FACTORY;
4587 QString defaultFileExtension() const override;
4588 QString createFileFilter() const override;
4589
4594 virtual QStringList supportedOutputPointCloudLayerExtensions() const;
4595
4599 static QgsProcessingParameterPointCloudDestination *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4600};
4601
4609{
4610 public:
4611
4615 QgsProcessingParameterPointCloudAttribute( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
4616 const QString &parentLayerParameterName = QString(),
4617 bool allowMultiple = false,
4618 bool optional = false,
4619 bool defaultToAllAttributes = false );
4620
4624 static QString typeName() { return QStringLiteral( "attribute" ); }
4625 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4626 QString type() const override { return typeName(); }
4627 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4628 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4629 QString asScriptCode() const override;
4631 QStringList dependsOnOtherParameters() const override;
4632
4637 QString parentLayerParameterName() const;
4638
4643 void setParentLayerParameterName( const QString &parentLayerParameterName );
4644
4649 bool allowMultiple() const;
4650
4655 void setAllowMultiple( bool allowMultiple );
4656
4665 bool defaultToAllAttributes() const;
4666
4675 void setDefaultToAllAttributes( bool enabled );
4676
4677 QVariantMap toVariantMap() const override;
4678 bool fromVariantMap( const QVariantMap &map ) override;
4679
4683 static QgsProcessingParameterPointCloudAttribute *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4684
4685 private:
4686
4687 QString mParentLayerParameterName;
4688 bool mAllowMultiple = false;
4689 bool mDefaultToAllAttributes = false;
4690};
4691
4700{
4701 public:
4702
4709 QgsProcessingParameterVectorTileDestination( const QString &name, const QString &description = QString(),
4710 const QVariant &defaultValue = QVariant(),
4711 bool optional = false,
4712 bool createByDefault = true );
4713
4717 static QString typeName() { return QStringLiteral( "vectorTileDestination" ); }
4718 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4719 QString type() const override { return typeName(); }
4720 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4721 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4722 QgsProcessingOutputDefinition *toOutputDefinition() const override SIP_FACTORY;
4723 QString defaultFileExtension() const override;
4724 QString createFileFilter() const override;
4725
4730 virtual QStringList supportedOutputVectorTileLayerExtensions() const;
4731
4735 static QgsProcessingParameterVectorTileDestination *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4736};
4737
4738// clazy:excludeall=qstring-allocations
4739
4740#endif // QGSPROCESSINGPARAMETERS_H
4741
4742
The Qgis class provides global constants for use throughout the application.
Definition qgis.h:54
ProcessingSourceType
Processing data source types.
Definition qgis.h:3270
@ VectorAnyGeometry
Any vector layer with geometry.
ProcessingFileParameterBehavior
Flags which dictate the behavior of QgsProcessingParameterFile.
Definition qgis.h:3510
@ File
Parameter is a single file.
ExpressionType
Expression types.
Definition qgis.h:5140
@ Qgis
Native QGIS expression.
DistanceUnit
Units of distance.
Definition qgis.h:4677
@ Unknown
Unknown distance unit.
ProcessingFieldParameterDataType
Processing field parameter data types.
Definition qgis.h:3538
AreaUnit
Units of area.
Definition qgis.h:4754
@ Unknown
Unknown areal unit.
TemporalUnit
Temporal units.
Definition qgis.h:4823
@ Milliseconds
Milliseconds.
QFlags< ProcessingParameterFlag > ProcessingParameterFlags
Flags which dictate the behavior of Processing parameters.
Definition qgis.h:3499
VolumeUnit
Units of volume.
Definition qgis.h:4779
@ Unknown
Unknown volume unit.
InvalidGeometryCheck
Methods for handling of features with invalid geometries.
Definition qgis.h:2072
@ AbortOnInvalid
Close iterator on encountering any features with invalid geometry. This requires a slow geometry vali...
QFlags< ProcessingFeatureSourceDefinitionFlag > ProcessingFeatureSourceDefinitionFlags
Flags which control behavior for a Processing feature source.
Definition qgis.h:3421
WkbType
The WKB type describes the number of dimensions a geometry has.
Definition qgis.h:256
ProcessingDateTimeParameterDataType
Processing date time parameter data types.
Definition qgis.h:3556
ProcessingNumberParameterType
Processing numeric parameter data types.
Definition qgis.h:3524
Represents a map layer containing a set of georeferenced annotations, e.g.
This class represents a coordinate reference system (CRS).
An interface for objects which accept features via addFeature(s) methods.
QFlags< SinkFlag > SinkFlags
Container of fields for a vector layer.
Definition qgsfields.h:46
Abstract interface for classes which generate a file filter string.
A geometry is the spatial representation of a feature.
Base class for graphical items within a QgsLayout.
Base class for all map layer types.
Definition qgsmaplayer.h:76
Represents a mesh layer supporting display of data on structured or unstructured meshes.
Represents a map layer supporting display of point clouds.
A class to represent a 2D point.
Definition qgspointxy.h:60
Print layout, a QgsLayout subclass for static or atlas-based layouts.
Abstract base class for processing algorithms.
Contains information about the context in which a processing algorithm is executed.
Base class for all parameter definitions which represent file or layer destinations,...
virtual QString defaultFileExtension() const =0
Returns the default file extension for destination file paths associated with this parameter.
bool supportsNonFileBasedOutput() const
Returns true if the destination parameter supports non filed-based outputs, such as memory layers or ...
bool isDestination() const override
Returns true if this parameter represents a file or layer destination, e.g.
virtual QgsProcessingOutputDefinition * toOutputDefinition() const =0
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
QgsProcessingProvider * originalProvider() const
Original (source) provider which this parameter has been derived from.
void setSupportsNonFileBasedOutput(bool supportsNonFileBasedOutput)
Sets whether the destination parameter supports non filed-based outputs, such as memory layers or dir...
Custom exception class for processing related exceptions.
Encapsulates settings relating to a feature source input to a processing algorithm.
bool operator!=(const QgsProcessingFeatureSourceDefinition &other) const
bool selectedFeaturesOnly
true if only selected features in the source should be used by algorithms.
bool operator==(const QgsProcessingFeatureSourceDefinition &other) const
Qgis::InvalidGeometryCheck geometryCheck
Geometry check method to apply to this source.
QgsProcessingFeatureSourceDefinition(const QgsProperty &source, bool selectedFeaturesOnly=false, long long featureLimit=-1, Qgis::ProcessingFeatureSourceDefinitionFlags flags=Qgis::ProcessingFeatureSourceDefinitionFlags(), Qgis::InvalidGeometryCheck geometryCheck=Qgis::InvalidGeometryCheck::AbortOnInvalid, const QString &filterExpression=QString())
Constructor for QgsProcessingFeatureSourceDefinition, accepting a QgsProperty source.
QgsProcessingFeatureSourceDefinition(const QString &source=QString(), bool selectedFeaturesOnly=false, long long featureLimit=-1, Qgis::ProcessingFeatureSourceDefinitionFlags flags=Qgis::ProcessingFeatureSourceDefinitionFlags(), Qgis::InvalidGeometryCheck geometryCheck=Qgis::InvalidGeometryCheck::AbortOnInvalid, const QString &filterExpression=QString())
Constructor for QgsProcessingFeatureSourceDefinition, accepting a static string source.
Qgis::ProcessingFeatureSourceDefinitionFlags flags
Flags which dictate source behavior.
long long featureLimit
If set to a value > 0, places a limit on the maximum number of features which will be read from the s...
QString filterExpression
Optional expression filter to use for filtering features which will be read from the source.
QgsFeatureSource subclass which proxies methods to an underlying QgsFeatureSource,...
Base class for providing feedback from a processing algorithm.
Base class for the definition of processing outputs.
Encapsulates settings relating to a feature sink or output raster layer for a processing algorithm.
QgsProcessingOutputLayerDefinition(const QgsProperty &sink, QgsProject *destinationProject=nullptr)
Constructor for QgsProcessingOutputLayerDefinition, accepting a QgsProperty sink/layer.
QgsProperty sink
Sink/layer definition.
bool useRemapping() const
Returns true if the output uses a remapping definition.
QgsProcessingOutputLayerDefinition(const QString &sink=QString(), QgsProject *destinationProject=nullptr)
Constructor for QgsProcessingOutputLayerDefinition, accepting a static sink/layer string.
QgsRemappingSinkDefinition remappingDefinition() const
Returns the output remapping definition, if useRemapping() is true.
QString destinationName
Name to use for sink if it's to be loaded into a destination project.
QVariantMap createOptions
Map of optional sink/layer creation options, which are passed to the underlying provider when creatin...
An annotation layer parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A double numeric parameter for area values.
void setDefaultUnit(Qgis::AreaUnit unit)
Sets the default area unit for the parameter.
static QString typeName()
Returns the type name for the parameter class.
A string parameter for authentication configuration ID values.
static QString typeName()
Returns the type name for the parameter class.
A raster band parameter for Processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A boolean parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A color parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A coordinate operation parameter for processing algorithms, for selection between available coordinat...
static QString typeName()
Returns the type name for the parameter class.
QVariant sourceCrs() const
Returns the static source CRS, or an invalid value if this is not set.
QString destinationCrsParameterName() const
Returns the name of the destination CRS parameter, or an empty string if this is not set.
void setDestinationCrsParameterName(const QString &name)
Sets the name of the destination CRS parameter.
void setSourceCrs(const QVariant &crs)
Sets the static source crs.
QVariant destinationCrs() const
Returns the static destination CRS, or an invalid value if this is not set.
void setDestinationCrs(const QVariant &crs)
Sets the static destination crs.
void setSourceCrsParameterName(const QString &name)
Sets the name of the source CRS parameter.
QString sourceCrsParameterName() const
Returns the name of the source CRS parameter, or an empty string if this is not set.
A coordinate reference system parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A database schema parameter for processing algorithms, allowing users to select from existing schemas...
static QString typeName()
Returns the type name for the parameter class.
A database table name parameter for processing algorithms, allowing users to select from existing dat...
static QString typeName()
Returns the type name for the parameter class.
A datetime (or pure date or time) parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
Base class for the definition of processing parameters.
QVariant defaultValue() const
Returns the default value for the parameter.
void setDefaultValue(const QVariant &value)
Sets the default value for the parameter.
QStringList additionalExpressionContextVariables() const
Returns a list of additional expression context variables which are available for use when evaluating...
QStringList mAdditionalExpressionVariables
Additional expression context variables exposed for use by this parameter.
QString help() const
Returns the help for the parameter.
Qgis::ProcessingParameterFlags mFlags
Parameter flags.
QFlags< ValueAsStringFlag > ValueAsStringFlags
void setMetadata(const QVariantMap &metadata)
Sets the parameter's freeform metadata.
void setFlags(Qgis::ProcessingParameterFlags flags)
Sets the flags associated with the parameter.
ValueAsStringFlag
Flags for passing to the valueAsStringPrivate() method.
void setGuiDefaultValueOverride(const QVariant &value)
Sets the default value to use for the parameter in GUI widgets.
QVariantMap metadata() const
Returns the parameter's freeform metadata.
QString description() const
Returns the description for the parameter.
QString mDynamicLayerParameterName
Linked vector layer parameter name for dynamic properties.
virtual bool isDestination() const
Returns true if this parameter represents a file or layer destination, e.g.
void setDescription(const QString &description)
Sets the description for the parameter.
void setDynamicLayerParameterName(const QString &name)
Sets the name for the parameter for a layer linked to a dynamic parameter, or an empty string if this...
QString dynamicLayerParameterName() const
Returns the name of the parameter for a layer linked to a dynamic parameter, or an empty string if th...
void setAdditionalExpressionContextVariables(const QStringList &variables)
Sets a list of additional expression context variables which are available for use when evaluating th...
QVariantMap mMetadata
Freeform metadata for parameter. Mostly used by widget wrappers to customize their appearance and beh...
void setName(const QString &name)
Sets the name of the parameter.
QString mDescription
Parameter description.
virtual QgsProcessingParameterDefinition * clone() const =0
Creates a clone of the parameter definition.
virtual QString type() const =0
Unique parameter type name.
void setDynamicPropertyDefinition(const QgsPropertyDefinition &definition)
Sets the property definition for dynamic properties.
void setHelp(const QString &help)
Sets the help for the parameter.
QString name() const
Returns the name of the parameter.
QVariant mDefault
Default value for parameter.
virtual QStringList dependsOnOtherParameters() const
Returns a list of other parameter names on which this parameter is dependent (e.g.
void setIsDynamic(bool dynamic)
Sets whether the parameter is dynamic, and can support data-defined values (i.e.
Qgis::ProcessingParameterFlags flags() const
Returns any flags associated with the parameter.
QVariant mGuiDefault
Default value for parameter in GUI.
QgsPropertyDefinition mPropertyDefinition
Data defined property definition.
bool isDynamic() const
Returns true if the parameter supports is dynamic, and can support data-defined values (i....
virtual ~QgsProcessingParameterDefinition()=default
QVariantMap & metadata()
Returns the parameter's freeform metadata.
QgsPropertyDefinition dynamicPropertyDefinition() const
Returns the property definition for dynamic properties.
A double numeric parameter for distance values.
static QString typeName()
Returns the type name for the parameter class.
void setDefaultUnit(Qgis::DistanceUnit unit)
Sets the default distance unit for the parameter.
A double numeric parameter for duration values.
void setDefaultUnit(Qgis::TemporalUnit unit)
Sets the default duration unit for the parameter.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
An enum based parameter for processing algorithms, allowing for selection from predefined values.
static QString typeName()
Returns the type name for the parameter class.
An expression parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A rectangular map extent parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A feature sink output for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
An input feature source (such as vector layers) parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
A vector layer or feature source field parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A generic file based destination parameter, for specifying the destination path for a file (non-map l...
static QString typeName()
Returns the type name for the parameter class.
An input file or folder parameter for processing algorithms.
QString extension() const
Returns any specified file extension for the parameter.
static QString typeName()
Returns the type name for the parameter class.
void setBehavior(Qgis::ProcessingFileParameterBehavior behavior)
Sets the parameter behavior (e.g.
Qgis::ProcessingFileParameterBehavior behavior() const
Returns the parameter behavior (e.g.
A folder destination parameter, for specifying the destination path for a folder created by the algor...
static QString typeName()
Returns the type name for the parameter class.
A geometry parameter for processing algorithms.
void setGeometryTypes(const QList< int > &geometryTypes)
Sets the allowed geometryTypes, as a list of Qgis::GeometryType values.
bool allowMultipart() const
Returns the parameter allow multipart geometries.
QList< int > geometryTypes() const
Returns the parameter allowed geometries, as a list of Qgis::GeometryType values.
void setAllowMultipart(bool allowMultipart)
Sets the allow multipart geometries.
static QString typeName()
Returns the type name for the parameter class.
A print layout item parameter, allowing users to select a particular item from a print layout.
static QString typeName()
Returns the type name for the parameter class.
A print layout parameter, allowing users to select a print layout.
static QString typeName()
Returns the type name for the parameter class.
Can be inherited by parameters which require limits to their acceptable data types.
QList< int > mDataTypes
List of acceptable data types for the parameter.
A map layer parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A map theme parameter for processing algorithms, allowing users to select an existing map theme from ...
static QString typeName()
Returns the type name for the parameter class.
A table (matrix) parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
A mesh layer parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A parameter for processing algorithms which accepts multiple map layers.
static QString typeName()
Returns the type name for the parameter class.
A numeric parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A point cloud layer attribute parameter for Processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A point cloud layer destination parameter, for specifying the destination path for a point cloud laye...
static QString typeName()
Returns the type name for the parameter class.
A point cloud layer parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A point parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A data provider connection parameter for processing algorithms, allowing users to select from availab...
static QString typeName()
Returns the type name for the parameter class.
void setProviderId(const QString &provider)
Sets the ID of the provider associated with the connections.
QString providerId() const
Returns the ID of the provider associated with the connections.
A numeric range parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A raster layer destination parameter, for specifying the destination path for a raster layer created ...
static QString typeName()
Returns the type name for the parameter class.
A raster layer parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A double numeric parameter for map scale values.
static QString typeName()
Returns the type name for the parameter class.
A string parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
A vector layer destination parameter, for specifying the destination path for a vector layer created ...
static QString typeName()
Returns the type name for the parameter class.
A vector layer (with or without geometry) parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A vector tile layer destination parameter, for specifying the destination path for a vector tile laye...
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
A double numeric parameter for volume values.
static QString typeName()
Returns the type name for the parameter class.
void setDefaultUnit(Qgis::VolumeUnit unit)
Sets the default volume unit for the parameter.
A collection of utilities for working with parameters when running a processing algorithm.
Abstract base class for processing providers.
LayerHint
Layer type hints.
@ UnknownType
Unknown layer type.
Contains enumerations and other constants for use in processing algorithms and parameters.
QFlags< LayerOptionsFlag > LayerOptionsFlags
PythonOutputType
Available Python output types.
@ PythonQgsProcessingAlgorithmSubclass
Full Python QgsProcessingAlgorithm subclass.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition qgsproject.h:107
Definition for a property.
Definition qgsproperty.h:45
A store for object properties.
Represents a raster layer.
A rectangle specified with double values.
Defines the parameters used to remap features when creating a QgsRemappingProxyFeatureSink.
Represents a vector layer which manages a vector based data sets.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into allowing algorithms to be written in pure substantial changes are required in order to port existing x Processing algorithms for QGIS x The most significant changes are outlined not GeoAlgorithm For algorithms which operate on features one by consider subclassing the QgsProcessingFeatureBasedAlgorithm class This class allows much of the boilerplate code for looping over features from a vector layer to be bypassed and instead requires implementation of a processFeature method Ensure that your algorithm(or algorithm 's parent class) implements the new pure virtual createInstance(self) call
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition qgis_sip.h:191
#define SIP_DEPRECATED
Definition qgis_sip.h:106
#define SIP_SKIP
Definition qgis_sip.h:126
#define SIP_OUT
Definition qgis_sip.h:58
#define SIP_FACTORY
Definition qgis_sip.h:76
#define SIP_THROW(name,...)
Definition qgis_sip.h:203
#define SIP_END
Definition qgis_sip.h:208
Q_DECLARE_METATYPE(QgsDatabaseQueryLogEntry)
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
QList< const QgsProcessingParameterDefinition * > QgsProcessingParameterDefinitions
List of processing parameters.
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsTextRendererUtils::CurvedTextFlags)
const QgsCoordinateReferenceSystem & crs
const QString & typeName