QGIS API Documentation 3.29.0-Master (006c3c0232)
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
57{
58 public:
59
64 enum Flag
65 {
66 FlagOverrideDefaultGeometryCheck = 1 << 0,
67 FlagCreateIndividualOutputPerInputFeature = 1 << 1,
68 };
69 Q_DECLARE_FLAGS( Flags, Flag )
70
71
84 QgsProcessingFeatureSourceDefinition( const QString &source = QString(), bool selectedFeaturesOnly = false, long long featureLimit = -1,
85 QgsProcessingFeatureSourceDefinition::Flags flags = QgsProcessingFeatureSourceDefinition::Flags(), QgsFeatureRequest::InvalidGeometryCheck geometryCheck = QgsFeatureRequest::GeometryAbortOnInvalid )
86 : source( QgsProperty::fromValue( source ) )
87 , selectedFeaturesOnly( selectedFeaturesOnly )
88 , featureLimit( featureLimit )
89 , flags( flags )
90 , geometryCheck( geometryCheck )
91 {}
92
106 QgsProcessingFeatureSourceDefinition( const QgsProperty &source, bool selectedFeaturesOnly = false, long long featureLimit = -1,
107 QgsProcessingFeatureSourceDefinition::Flags flags = QgsProcessingFeatureSourceDefinition::Flags(), QgsFeatureRequest::InvalidGeometryCheck geometryCheck = QgsFeatureRequest::GeometryAbortOnInvalid )
108 : source( source )
109 , selectedFeaturesOnly( selectedFeaturesOnly )
110 , featureLimit( featureLimit )
111 , flags( flags )
112 , geometryCheck( geometryCheck )
113 {}
114
119
124
131 long long featureLimit = -1;
132
138 Flags flags = Flags();
139
149
156 QVariant toVariant() const;
157
164 bool loadVariant( const QVariantMap &map );
165
166 // TODO c++20 - replace with = default
168 {
169 return source == other.source
170 && selectedFeaturesOnly == other.selectedFeaturesOnly
171 && featureLimit == other.featureLimit
172 && flags == other.flags
173 && geometryCheck == other.geometryCheck;
174 }
175
177 {
178 return !( *this == other );
179 }
180
182 operator QVariant() const
183 {
184 return QVariant::fromValue( *this );
185 }
186
187};
188
190Q_DECLARE_OPERATORS_FOR_FLAGS( QgsProcessingFeatureSourceDefinition::Flags )
191
192
202{
203 public:
204
210 QgsProcessingOutputLayerDefinition( const QString &sink = QString(), QgsProject *destinationProject = nullptr )
211 : sink( QgsProperty::fromValue( sink ) )
212 , destinationProject( destinationProject )
213 {}
214
220 QgsProcessingOutputLayerDefinition( const QgsProperty &sink, QgsProject *destinationProject = nullptr )
221 : sink( sink )
222 , destinationProject( destinationProject )
223 {}
224
229
235 QgsProject *destinationProject = nullptr;
236
241
248 QVariantMap createOptions;
249
256 bool useRemapping() const { return mUseRemapping; }
257
265 QgsRemappingSinkDefinition remappingDefinition() const { return mRemappingDefinition; }
266
277 void setRemappingDefinition( const QgsRemappingSinkDefinition &definition );
278
285 QVariant toVariant() const;
286
293 bool loadVariant( const QVariantMap &map );
294
296 operator QVariant() const
297 {
298 return QVariant::fromValue( *this );
299 }
300
301 // TODO c++20 - replace with = default
302 bool operator==( const QgsProcessingOutputLayerDefinition &other ) const;
303 bool operator!=( const QgsProcessingOutputLayerDefinition &other ) const;
304
305 private:
306
307 bool mUseRemapping = false;
308 QgsRemappingSinkDefinition mRemappingDefinition;
309
310};
311
313
314
315
316
317//
318// Parameter definitions
319//
320
321
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() == QgsProcessingParameterDuration::typeName() )
369 sipType = sipType_QgsProcessingParameterDuration;
370 else if ( sipCpp->type() == QgsProcessingParameterScale::typeName() )
371 sipType = sipType_QgsProcessingParameterScale;
372 else if ( sipCpp->type() == QgsProcessingParameterRange::typeName() )
373 sipType = sipType_QgsProcessingParameterRange;
374 else if ( sipCpp->type() == QgsProcessingParameterRasterLayer::typeName() )
375 sipType = sipType_QgsProcessingParameterRasterLayer;
376 else if ( sipCpp->type() == QgsProcessingParameterMeshLayer::typeName() )
377 sipType = sipType_QgsProcessingParameterMeshLayer;
378 else if ( sipCpp->type() == QgsProcessingParameterEnum::typeName() )
379 sipType = sipType_QgsProcessingParameterEnum;
380 else if ( sipCpp->type() == QgsProcessingParameterString::typeName() )
381 sipType = sipType_QgsProcessingParameterString;
382 else if ( sipCpp->type() == QgsProcessingParameterExpression::typeName() )
383 sipType = sipType_QgsProcessingParameterExpression;
384 else if ( sipCpp->type() == QgsProcessingParameterAuthConfig::typeName() )
385 sipType = sipType_QgsProcessingParameterAuthConfig;
386 else if ( sipCpp->type() == QgsProcessingParameterVectorLayer::typeName() )
387 sipType = sipType_QgsProcessingParameterVectorLayer;
388 else if ( sipCpp->type() == QgsProcessingParameterField::typeName() )
389 sipType = sipType_QgsProcessingParameterField;
390 else if ( sipCpp->type() == QgsProcessingParameterFeatureSource::typeName() )
391 sipType = sipType_QgsProcessingParameterFeatureSource;
392 else if ( sipCpp->type() == QgsProcessingParameterFeatureSink::typeName() )
393 sipType = sipType_QgsProcessingParameterFeatureSink;
394 else if ( sipCpp->type() == QgsProcessingParameterVectorDestination::typeName() )
395 sipType = sipType_QgsProcessingParameterVectorDestination;
396 else if ( sipCpp->type() == QgsProcessingParameterRasterDestination::typeName() )
397 sipType = sipType_QgsProcessingParameterRasterDestination;
398 else if ( sipCpp->type() == QgsProcessingParameterPointCloudDestination::typeName() )
399 sipType = sipType_QgsProcessingParameterPointCloudDestination;
400 else if ( sipCpp->type() == QgsProcessingParameterFileDestination::typeName() )
401 sipType = sipType_QgsProcessingParameterFileDestination;
402 else if ( sipCpp->type() == QgsProcessingParameterFolderDestination::typeName() )
403 sipType = sipType_QgsProcessingParameterFolderDestination;
404 else if ( sipCpp->type() == QgsProcessingParameterBand::typeName() )
405 sipType = sipType_QgsProcessingParameterBand;
406 else if ( sipCpp->type() == QgsProcessingParameterLayout::typeName() )
407 sipType = sipType_QgsProcessingParameterLayout;
408 else if ( sipCpp->type() == QgsProcessingParameterLayoutItem::typeName() )
409 sipType = sipType_QgsProcessingParameterLayoutItem;
410 else if ( sipCpp->type() == QgsProcessingParameterColor::typeName() )
411 sipType = sipType_QgsProcessingParameterColor;
412 else if ( sipCpp->type() == QgsProcessingParameterCoordinateOperation::typeName() )
413 sipType = sipType_QgsProcessingParameterCoordinateOperation;
414 else if ( sipCpp->type() == QgsProcessingParameterMapTheme::typeName() )
415 sipType = sipType_QgsProcessingParameterMapTheme;
416 else if ( sipCpp->type() == QgsProcessingParameterDateTime::typeName() )
417 sipType = sipType_QgsProcessingParameterDateTime;
418 else if ( sipCpp->type() == QgsProcessingParameterProviderConnection::typeName() )
419 sipType = sipType_QgsProcessingParameterProviderConnection;
420 else if ( sipCpp->type() == QgsProcessingParameterDatabaseSchema::typeName() )
421 sipType = sipType_QgsProcessingParameterDatabaseSchema;
422 else if ( sipCpp->type() == QgsProcessingParameterDatabaseTable::typeName() )
423 sipType = sipType_QgsProcessingParameterDatabaseTable;
424 else if ( sipCpp->type() == QgsProcessingParameterFieldMapping::typeName() )
425 sipType = sipType_QgsProcessingParameterFieldMapping;
426 else if ( sipCpp->type() == QgsProcessingParameterTinInputLayers::typeName() )
427 sipType = sipType_QgsProcessingParameterTinInputLayers;
428 else if ( sipCpp->type() == QgsProcessingParameterVectorTileWriterLayers::typeName() )
429 sipType = sipType_QgsProcessingParameterVectorTileWriterLayers;
430 else if ( sipCpp->type() == QgsProcessingParameterDxfLayers::typeName() )
431 sipType = sipType_QgsProcessingParameterDxfLayers;
432 else if ( sipCpp->type() == QgsProcessingParameterMeshDatasetGroups::typeName() )
433 sipType = sipType_QgsProcessingParameterMeshDatasetGroups;
434 else if ( sipCpp->type() == QgsProcessingParameterMeshDatasetTime::typeName() )
435 sipType = sipType_QgsProcessingParameterMeshDatasetTime;
436 else if ( sipCpp->type() == QgsProcessingParameterPointCloudLayer::typeName() )
437 sipType = sipType_QgsProcessingParameterPointCloudLayer;
438 else if ( sipCpp->type() == QgsProcessingParameterAnnotationLayer::typeName() )
439 sipType = sipType_QgsProcessingParameterAnnotationLayer;
440 else
441 sipType = nullptr;
442 SIP_END
443#endif
444
445 public:
446
448 enum Flag
449 {
450 FlagAdvanced = 1 << 1,
451 FlagHidden = 1 << 2,
452 FlagOptional = 1 << 3,
453 FlagIsModelOutput = 1 << 4,
454 };
455 Q_DECLARE_FLAGS( Flags, Flag )
456
457
460 QgsProcessingParameterDefinition( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
461 bool optional = false, const QString &help = QString() );
462
464
469
473 virtual QString type() const = 0;
474
480 virtual bool isDestination() const { return false; }
481
487 QString name() const { return mName; }
488
494 void setName( const QString &name ) { mName = name; }
495
501 QString description() const { return mDescription; }
502
508 void setDescription( const QString &description ) { mDescription = description; }
509
519 QString help() const { return mHelp; }
520
530 void setHelp( const QString &help ) { mHelp = help; }
531
538 QVariant defaultValue() const { return mDefault; }
539
546 void setDefaultValue( const QVariant &value ) { mDefault = value; }
547
560 QVariant guiDefaultValueOverride() const { return mGuiDefault; }
561
577 void setGuiDefaultValueOverride( const QVariant &value ) { mGuiDefault = value; }
578
587 QVariant defaultValueForGui() const { return mGuiDefault.isValid() ? mGuiDefault : mDefault; }
588
593 Flags flags() const { return mFlags; }
594
599 void setFlags( Flags flags ) { mFlags = flags; }
600
608 virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const;
609
617 virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
618
630 virtual QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const;
631
645 virtual QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const;
646
660 virtual QStringList valueAsStringList( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const;
661
667 virtual QString valueAsPythonComment( const QVariant &value, QgsProcessingContext &context ) const;
668
673 virtual QString asScriptCode() const;
674
684 virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const;
685
691 virtual QVariantMap toVariantMap() const;
692
698 virtual bool fromVariantMap( const QVariantMap &map );
699
706 SIP_SKIP QVariantMap metadata() const { return mMetadata; }
707
713 QVariantMap &metadata() { return mMetadata; }
714
720 void setMetadata( const QVariantMap &metadata ) { mMetadata = metadata; }
721
726 virtual QStringList dependsOnOtherParameters() const { return QStringList(); }
727
734
740 QgsProcessingProvider *provider() const;
741
746 virtual QString toolTip() const;
747
755 bool isDynamic() const { return mIsDynamic; }
756
764 void setIsDynamic( bool dynamic ) { mIsDynamic = dynamic; }
765
772 QgsPropertyDefinition dynamicPropertyDefinition() const { return mPropertyDefinition; }
773
780 void setDynamicPropertyDefinition( const QgsPropertyDefinition &definition ) { mPropertyDefinition = definition; }
781
793 QString dynamicLayerParameterName() const { return mDynamicLayerParameterName; }
794
806 void setDynamicLayerParameterName( const QString &name ) { mDynamicLayerParameterName = name; }
807
821 QStringList additionalExpressionContextVariables() const { return mAdditionalExpressionVariables; }
822
840 void setAdditionalExpressionContextVariables( const QStringList &variables ) { mAdditionalExpressionVariables = variables; }
841
842#ifndef SIP_RUN
843
851 enum class ValueAsStringFlag : int
852 {
853 AllowMapLayerValues = 1 << 0,
854 };
855 Q_DECLARE_FLAGS( ValueAsStringFlags, ValueAsStringFlag )
856#endif
857
858 protected:
859
860#ifndef SIP_RUN
861
868 QString valueAsStringPrivate( const QVariant &value, QgsProcessingContext &context, bool &ok, ValueAsStringFlags flags ) const;
869
876 QVariant valueAsJsonObjectPrivate( const QVariant &value, QgsProcessingContext &context, ValueAsStringFlags flags ) const;
877#endif
878
880 QString mName;
881
884
886 QString mHelp;
887
889 QVariant mDefault;
890
892 QVariant mGuiDefault;
893
895 Flags mFlags;
896
898 QVariantMap mMetadata;
899
901 QgsProcessingAlgorithm *mAlgorithm = nullptr;
902
904 bool mIsDynamic = false;
905
908
911
914
915 // To allow access to mAlgorithm. We don't want a public setter for this!
917
918};
919
920Q_DECLARE_OPERATORS_FOR_FLAGS( QgsProcessingParameterDefinition::Flags )
921
922#ifndef SIP_RUN
923Q_DECLARE_OPERATORS_FOR_FLAGS( QgsProcessingParameterDefinition::ValueAsStringFlags )
924#endif
925
927typedef QList< const QgsProcessingParameterDefinition * > QgsProcessingParameterDefinitions;
928
947class CORE_EXPORT QgsProcessingParameters
948{
949
950 public:
951
956 static bool isDynamic( const QVariantMap &parameters, const QString &name );
957
961 static QString parameterAsString( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
962
967 static QString parameterAsString( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
968
972 static QString parameterAsExpression( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
973
978 static QString parameterAsExpression( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
979
983 static double parameterAsDouble( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
984
989 static double parameterAsDouble( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
990
994 static int parameterAsInt( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
995
1000 static int parameterAsInt( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1001
1006 static QList<int> parameterAsInts( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1007
1012 static QList<int> parameterAsInts( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1013
1022 static QDateTime parameterAsDateTime( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1023
1032 static QDateTime parameterAsDateTime( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1033
1042 static QDate parameterAsDate( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1043
1052 static QDate parameterAsDate( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1053
1062 static QTime parameterAsTime( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1063
1072 static QTime parameterAsTime( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1073
1077 static int parameterAsEnum( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1078
1083 static int parameterAsEnum( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1084
1088 static QList<int> parameterAsEnums( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1089
1094 static QList<int> parameterAsEnums( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1095
1100 static QString parameterAsEnumString( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1101
1106 static QString parameterAsEnumString( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1107
1112 static QStringList parameterAsEnumStrings( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1113
1118 static QStringList parameterAsEnumStrings( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1119
1123 static bool parameterAsBool( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1124
1130 static bool parameterAsBoolean( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1131
1136 static bool parameterAsBool( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1137
1142 static bool parameterAsBoolean( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1143
1161 static QgsFeatureSink *parameterAsSink( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters,
1162 const QgsFields &fields, QgsWkbTypes::Type geometryType, const QgsCoordinateReferenceSystem &crs,
1163 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;
1164
1184 static QgsFeatureSink *parameterAsSink( const QgsProcessingParameterDefinition *definition, const QVariant &value,
1185 const QgsFields &fields, QgsWkbTypes::Type geometryType, const QgsCoordinateReferenceSystem &crs,
1186 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;
1187
1196 static QgsProcessingFeatureSource *parameterAsSource( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context ) SIP_FACTORY;
1197
1208 static QgsProcessingFeatureSource *parameterAsSource( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context ) SIP_FACTORY;
1209
1225 static QString parameterAsCompatibleSourceLayerPath( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters,
1226 QgsProcessingContext &context, const QStringList &compatibleFormats, const QString &preferredFormat = QString( "shp" ), QgsProcessingFeedback *feedback = nullptr );
1227
1257 static QString parameterAsCompatibleSourceLayerPathAndLayerName( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters,
1258 QgsProcessingContext &context, const QStringList &compatibleFormats, const QString &preferredFormat = QString( "shp" ), QgsProcessingFeedback *feedback = nullptr, QString *layerName SIP_OUT = nullptr );
1259
1267 static QgsMapLayer *parameterAsLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingUtils::LayerHint layerHint = QgsProcessingUtils::LayerHint::UnknownType );
1268
1278 static QgsMapLayer *parameterAsLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context, QgsProcessingUtils::LayerHint layerHint = QgsProcessingUtils::LayerHint::UnknownType );
1279
1287 static QgsRasterLayer *parameterAsRasterLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1288
1298 static QgsRasterLayer *parameterAsRasterLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1299
1303 static QString parameterAsOutputLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1304
1309 static QString parameterAsOutputLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1310
1314 static QString parameterAsFileOutput( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1315
1320 static QString parameterAsFileOutput( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1321
1329 static QgsVectorLayer *parameterAsVectorLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1330
1340 static QgsVectorLayer *parameterAsVectorLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1341
1351 static QgsMeshLayer *parameterAsMeshLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1352
1362 static QgsMeshLayer *parameterAsMeshLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1363
1367 static QgsCoordinateReferenceSystem parameterAsCrs( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1368
1373 static QgsCoordinateReferenceSystem parameterAsCrs( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1374
1384 static QgsRectangle parameterAsExtent( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context,
1386
1398 static QgsRectangle parameterAsExtent( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context,
1400
1412 static QgsGeometry parameterAsExtentGeometry( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context,
1414
1420 static QgsCoordinateReferenceSystem parameterAsExtentCrs( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1421
1427 static QgsCoordinateReferenceSystem parameterAsExtentCrs( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1428
1429
1437 static QgsPointXY parameterAsPoint( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context,
1439
1448 static QgsPointXY parameterAsPoint( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context,
1450
1456 static QgsCoordinateReferenceSystem parameterAsPointCrs( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1457
1464 static QgsCoordinateReferenceSystem parameterAsPointCrs( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1465
1471 static QgsGeometry parameterAsGeometry( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem() );
1472
1478 static QgsGeometry parameterAsGeometry( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem() );
1479
1486 static QgsCoordinateReferenceSystem parameterAsGeometryCrs( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1487
1494 static QgsCoordinateReferenceSystem parameterAsGeometryCrs( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1495
1499 static QString parameterAsFile( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1500
1505 static QString parameterAsFile( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1506
1511 static QVariantList parameterAsMatrix( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1512
1518 static QVariantList parameterAsMatrix( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1519
1523 static QList< QgsMapLayer *> parameterAsLayerList( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1524
1529 static QList< QgsMapLayer *> parameterAsLayerList( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1530
1536 static QStringList parameterAsFileList( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1537
1543 static QStringList parameterAsFileList( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1544
1548 static QList<double> parameterAsRange( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1549
1554 static QList<double> parameterAsRange( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1555
1559 static QStringList parameterAsFields( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1560
1565 static QStringList parameterAsFields( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1566
1575 static QgsPrintLayout *parameterAsLayout( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1576
1585 static QgsPrintLayout *parameterAsLayout( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1586
1595 static QgsLayoutItem *parameterAsLayoutItem( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context, QgsPrintLayout *layout );
1596
1605 static QgsLayoutItem *parameterAsLayoutItem( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context, QgsPrintLayout *layout );
1606
1612 static QColor parameterAsColor( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1613
1619 static QColor parameterAsColor( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1620
1626 static QString parameterAsConnectionName( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1627
1633 static QString parameterAsConnectionName( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1634
1640 static QString parameterAsSchema( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1641
1647 static QString parameterAsSchema( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1648
1654 static QString parameterAsDatabaseTableName( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1655
1661 static QString parameterAsDatabaseTableName( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1662
1672 static QgsPointCloudLayer *parameterAsPointCloudLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1673
1683 static QgsPointCloudLayer *parameterAsPointCloudLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1684
1698 static QgsAnnotationLayer *parameterAsAnnotationLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1699
1713 static QgsAnnotationLayer *parameterAsAnnotationLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1714
1720 static QgsProcessingParameterDefinition *parameterFromVariantMap( const QVariantMap &map ) SIP_FACTORY;
1721
1725 static QString descriptionFromName( const QString &name );
1726
1732 static QgsProcessingParameterDefinition *parameterFromScriptCode( const QString &code ) SIP_FACTORY;
1733
1734 private:
1735
1736 static bool parseScriptCodeParameterOptions( const QString &code, bool &isOptional, QString &name, QString &type, QString &definition );
1737};
1738
1739
1740
1748{
1749 public:
1750
1754 QgsProcessingParameterBoolean( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
1755 bool optional = false );
1756
1760 static QString typeName() { return QStringLiteral( "boolean" ); }
1761 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1762 QString type() const override { return typeName(); }
1763 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1764 QString asScriptCode() const override;
1765
1769 static QgsProcessingParameterBoolean *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1770};
1771
1779{
1780 public:
1781
1785 QgsProcessingParameterCrs( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
1786 bool optional = false );
1787
1791 static QString typeName() { return QStringLiteral( "crs" ); }
1792 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1793 QString type() const override { return typeName(); }
1794 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
1795 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1796 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
1797 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
1798
1802 static QgsProcessingParameterCrs *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1803
1804};
1805
1813{
1814 public:
1815
1819 QgsProcessingParameterExtent( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
1820 bool optional = false );
1821
1825 static QString typeName() { return QStringLiteral( "extent" ); }
1826 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1827 QString type() const override { return typeName(); }
1828 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
1829 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1830 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
1831 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
1832
1836 static QgsProcessingParameterExtent *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1837
1838};
1839
1840
1848{
1849 public:
1850
1854 QgsProcessingParameterPoint( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
1855 bool optional = false );
1856
1860 static QString typeName() { return QStringLiteral( "point" ); }
1861 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1862 QString type() const override { return typeName(); }
1863 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
1864 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1865
1869 static QgsProcessingParameterPoint *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1870
1871};
1872
1880{
1881 public:
1882
1890 QgsProcessingParameterGeometry( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(), bool optional = false, const QList< int > &geometryTypes = QList< int >(), bool allowMultipart = true );
1891
1895 static QString typeName() { return QStringLiteral( "geometry" ); }
1896 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1897 QString type() const override { return typeName(); }
1898 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
1899 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1900 QString asScriptCode() const override;
1901 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
1902 QVariantMap toVariantMap() const override;
1903 bool fromVariantMap( const QVariantMap &map ) override;
1904
1909 QList<int> geometryTypes() const { return mGeomTypes; }
1910
1915 void setGeometryTypes( const QList<int> &geometryTypes ) { mGeomTypes = geometryTypes; }
1916
1921 bool allowMultipart() const { return mAllowMultipart; }
1922
1927 void setAllowMultipart( bool allowMultipart ) { mAllowMultipart = allowMultipart; }
1928
1929
1930
1934 static QgsProcessingParameterGeometry *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1935
1936 private:
1937
1938 QList<int> mGeomTypes;
1939 bool mAllowMultipart;
1940
1941};
1942
1950{
1951 public:
1952
1955 {
1956 File = 0,
1958 };
1959
1967 QgsProcessingParameterFile( const QString &name, const QString &description = QString(), Behavior behavior = File, const QString &extension = QString(), const QVariant &defaultValue = QVariant(),
1968 bool optional = false, const QString &fileFilter = QString() );
1969
1973 static QString typeName() { return QStringLiteral( "file" ); }
1974 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1975 QString type() const override { return typeName(); }
1976 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
1977 QString asScriptCode() const override;
1978 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
1979 QString createFileFilter() const override;
1980
1985 Behavior behavior() const { return mBehavior; }
1986
1991 void setBehavior( Behavior behavior ) { mBehavior = behavior; }
1992
2000 QString extension() const { return mExtension; }
2001
2011 void setExtension( const QString &extension );
2012
2019 QString fileFilter() const;
2020
2030 void setFileFilter( const QString &filter );
2031
2032 QVariantMap toVariantMap() const override;
2033 bool fromVariantMap( const QVariantMap &map ) override;
2034
2038 static QgsProcessingParameterFile *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition, Behavior behavior = File ) SIP_FACTORY;
2039
2040 private:
2041
2042 Behavior mBehavior = File;
2043 QString mExtension;
2044 QString mFileFilter;
2045};
2046
2054{
2055 public:
2056
2060 QgsProcessingParameterMatrix( const QString &name, const QString &description = QString(), int numberRows = 3,
2061 bool hasFixedNumberRows = false, const QStringList &headers = QStringList(),
2062 const QVariant &defaultValue = QVariant(),
2063 bool optional = false );
2064
2068 static QString typeName() { return QStringLiteral( "matrix" ); }
2069 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2070 QString type() const override { return typeName(); }
2071 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2072 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2073 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2074
2079 QStringList headers() const;
2080
2085 void setHeaders( const QStringList &headers );
2086
2093 int numberRows() const;
2094
2101 void setNumberRows( int rows );
2102
2108 bool hasFixedNumberRows() const;
2109
2115 void setHasFixedNumberRows( bool hasFixedNumberRows );
2116
2117 QVariantMap toVariantMap() const override;
2118 bool fromVariantMap( const QVariantMap &map ) override;
2119
2123 static QgsProcessingParameterMatrix *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2124
2125 private:
2126
2127 QStringList mHeaders;
2128 int mNumberRows = 3;
2129 bool mFixedNumberRows = false;
2130
2131};
2132
2140{
2141 public:
2142
2146 QgsProcessingParameterMultipleLayers( const QString &name, const QString &description = QString(), QgsProcessing::SourceType layerType = QgsProcessing::TypeVectorAnyGeometry,
2147 const QVariant &defaultValue = QVariant(),
2148 bool optional = false );
2149
2153 static QString typeName() { return QStringLiteral( "multilayer" ); }
2154 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2155 QString type() const override { return typeName(); }
2156 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2157 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2158 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
2159 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
2160 QString asScriptCode() const override;
2161 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2162 QString createFileFilter() const override;
2163
2168 QgsProcessing::SourceType layerType() const;
2169
2174 void setLayerType( QgsProcessing::SourceType type );
2175
2181 int minimumNumberInputs() const;
2182
2188 void setMinimumNumberInputs( int minimum );
2189
2190 QVariantMap toVariantMap() const override;
2191 bool fromVariantMap( const QVariantMap &map ) override;
2192
2196 static QgsProcessingParameterMultipleLayers *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2197
2198 private:
2199
2201 int mMinimumNumberInputs = 0;
2202
2203};
2204
2224{
2225 public:
2226
2228 enum Type
2229 {
2232 };
2233
2237 explicit QgsProcessingParameterNumber( const QString &name, const QString &description = QString(),
2238 Type type = Integer,
2239 const QVariant &defaultValue = QVariant(),
2240 bool optional = false,
2241 double minValue = std::numeric_limits<double>::lowest() + 1,
2242 double maxValue = std::numeric_limits<double>::max()
2243 );
2244
2248 static QString typeName() { return QStringLiteral( "number" ); }
2249 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2250 QString type() const override { return typeName(); }
2251 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2252 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2253 QString toolTip() const override;
2254 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2255
2260 double minimum() const;
2261
2266 void setMinimum( double minimum );
2267
2272 double maximum() const;
2273
2278 void setMaximum( double maximum );
2279
2284 Type dataType() const;
2285
2290 void setDataType( Type type );
2291
2292 QVariantMap toVariantMap() const override;
2293 bool fromVariantMap( const QVariantMap &map ) override;
2294
2298 static QgsProcessingParameterNumber *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2299
2300 private:
2301
2302 double mMin = std::numeric_limits<double>::lowest() + 1;
2303 double mMax = std::numeric_limits<double>::max();
2304 Type mDataType = Integer;
2305};
2306
2327{
2328 public:
2329
2333 explicit QgsProcessingParameterDistance( const QString &name, const QString &description = QString(),
2334 const QVariant &defaultValue = QVariant(),
2335 const QString &parentParameterName = QString(),
2336 bool optional = false,
2337 double minValue = std::numeric_limits<double>::lowest() + 1,
2338 double maxValue = std::numeric_limits<double>::max() );
2339
2343 static QString typeName() { return QStringLiteral( "distance" ); }
2344
2345 QgsProcessingParameterDistance *clone() const override SIP_FACTORY;
2346
2347 QString type() const override;
2348 QStringList dependsOnOtherParameters() const override;
2349 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2350
2355 QString parentParameterName() const;
2356
2361 void setParentParameterName( const QString &parentParameterName );
2362
2369 QgsUnitTypes::DistanceUnit defaultUnit() const { return mDefaultUnit; }
2370
2377 void setDefaultUnit( QgsUnitTypes::DistanceUnit unit ) { mDefaultUnit = unit; }
2378
2379 QVariantMap toVariantMap() const override;
2380 bool fromVariantMap( const QVariantMap &map ) override;
2381
2382 private:
2383
2384 QString mParentParameterName;
2386
2387};
2388
2397{
2398 public:
2399
2403 explicit QgsProcessingParameterDuration( const QString &name, const QString &description = QString(),
2404 const QVariant &defaultValue = QVariant(),
2405 bool optional = false,
2406 double minValue = std::numeric_limits<double>::lowest() + 1,
2407 double maxValue = std::numeric_limits<double>::max() );
2408
2412 static QString typeName() { return QStringLiteral( "duration" ); }
2413
2414 QgsProcessingParameterDuration *clone() const override SIP_FACTORY;
2415
2416 QString type() const override;
2417 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2418
2424 QgsUnitTypes::TemporalUnit defaultUnit() const { return mDefaultUnit; }
2425
2431 void setDefaultUnit( QgsUnitTypes::TemporalUnit unit ) { mDefaultUnit = unit; }
2432
2433 QVariantMap toVariantMap() const override;
2434 bool fromVariantMap( const QVariantMap &map ) override;
2435
2436 private:
2437
2439
2440};
2441
2453{
2454 public:
2455
2459 explicit QgsProcessingParameterScale( const QString &name, const QString &description = QString(),
2460 const QVariant &defaultValue = QVariant(),
2461 bool optional = false );
2462
2466 static QString typeName() { return QStringLiteral( "scale" ); }
2467
2468 QgsProcessingParameterScale *clone() const override SIP_FACTORY;
2469
2470 QString type() const override;
2471 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2472
2476 static QgsProcessingParameterScale *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2477
2478};
2479
2487{
2488 public:
2489
2493 QgsProcessingParameterRange( const QString &name, const QString &description = QString(),
2495 const QVariant &defaultValue = QVariant(),
2496 bool optional = false );
2497
2501 static QString typeName() { return QStringLiteral( "range" ); }
2502 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2503 QString type() const override { return typeName(); }
2504 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2505 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2506 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2507
2512 QgsProcessingParameterNumber::Type dataType() const;
2513
2518 void setDataType( QgsProcessingParameterNumber::Type dataType );
2519
2520 QVariantMap toVariantMap() const override;
2521 bool fromVariantMap( const QVariantMap &map ) override;
2522
2526 static QgsProcessingParameterRange *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2527
2528 private:
2529
2531};
2532
2540{
2541 public:
2542
2546 QgsProcessingParameterRasterLayer( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
2547 bool optional = false );
2548
2552 static QString typeName() { return QStringLiteral( "raster" ); }
2553 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2554 QString type() const override { return typeName(); }
2555 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2556 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2557 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
2558 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
2559 QString createFileFilter() const override;
2560
2564 static QgsProcessingParameterRasterLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2565
2566};
2567
2587{
2588 public:
2589
2593 QgsProcessingParameterEnum( const QString &name, const QString &description = QString(), const QStringList &options = QStringList(),
2594 bool allowMultiple = false,
2595 const QVariant &defaultValue = QVariant(),
2596 bool optional = false,
2597 bool usesStaticStrings = false );
2598
2602 static QString typeName() { return QStringLiteral( "enum" ); }
2603 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2604 QString type() const override { return typeName(); }
2605 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2606 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2607 QString valueAsPythonComment( const QVariant &value, QgsProcessingContext &context ) const override;
2608 QString asScriptCode() const override;
2609 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2610
2615 QStringList options() const;
2616
2621 void setOptions( const QStringList &options );
2622
2627 bool allowMultiple() const;
2628
2633 void setAllowMultiple( bool allowMultiple );
2634
2641 bool usesStaticStrings() const;
2642
2649 void setUsesStaticStrings( bool usesStaticStrings );
2650
2651 QVariantMap toVariantMap() const override;
2652 bool fromVariantMap( const QVariantMap &map ) override;
2653
2657 static QgsProcessingParameterEnum *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2658
2659 private:
2660
2661 QStringList mOptions;
2662 bool mAllowMultiple = false;
2663 bool mUsesStaticStrings = false;
2664};
2665
2694{
2695 public:
2696
2700 QgsProcessingParameterString( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
2701 bool multiLine = false,
2702 bool optional = false );
2703
2707 static QString typeName() { return QStringLiteral( "string" ); }
2708 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2709 QString type() const override { return typeName(); }
2710 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2711 QString asScriptCode() const override;
2712 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2713
2718 bool multiLine() const;
2719
2724 void setMultiLine( bool multiLine );
2725
2726 QVariantMap toVariantMap() const override;
2727 bool fromVariantMap( const QVariantMap &map ) override;
2728
2732 static QgsProcessingParameterString *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2733
2734 private:
2735
2736 bool mMultiLine = false;
2737
2738};
2739
2740
2754{
2755 public:
2756
2760 QgsProcessingParameterAuthConfig( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
2761 bool optional = false );
2762
2766 static QString typeName() { return QStringLiteral( "authcfg" ); }
2767 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2768 QString type() const override { return typeName(); }
2769 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2770 QString asScriptCode() const override;
2771
2775 static QgsProcessingParameterAuthConfig *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2776
2777};
2778
2786{
2787 public:
2788
2792 QgsProcessingParameterExpression( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
2793 const QString &parentLayerParameterName = QString(),
2794 bool optional = false );
2795
2799 static QString typeName() { return QStringLiteral( "expression" ); }
2800 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2801 QString type() const override { return typeName(); }
2802 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2803 QStringList dependsOnOtherParameters() const override;
2804 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2805
2810 QString parentLayerParameterName() const;
2811
2816 void setParentLayerParameterName( const QString &parentLayerParameterName );
2817
2818 QVariantMap toVariantMap() const override;
2819 bool fromVariantMap( const QVariantMap &map ) override;
2820
2824 static QgsProcessingParameterExpression *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2825
2826 private:
2827
2828 QString mParentLayerParameterName;
2829
2830};
2831
2832
2840{
2841 public:
2842
2846 QgsProcessingParameterLimitedDataTypes( const QList< int > &types = QList< int >() );
2847
2852 QList< int > dataTypes() const;
2853
2858 void setDataTypes( const QList< int > &types );
2859
2860 protected:
2861
2863 QList< int > mDataTypes;
2864};
2865
2874{
2875 public:
2876
2880 QgsProcessingParameterVectorLayer( const QString &name,
2881 const QString &description = QString(),
2882 const QList< int > &types = QList< int >(),
2883 const QVariant &defaultValue = QVariant(),
2884 bool optional = false );
2885
2889 static QString typeName() { return QStringLiteral( "vector" ); }
2890 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2891 QString type() const override { return typeName(); }
2892 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2893 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2894 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
2895 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
2896 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2897 QString createFileFilter() const override;
2898
2899 QVariantMap toVariantMap() const override;
2900 bool fromVariantMap( const QVariantMap &map ) override;
2901
2905 static QgsProcessingParameterVectorLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2906
2907};
2908
2916{
2917 public:
2918
2922 QgsProcessingParameterMeshLayer( const QString &name,
2923 const QString &description = QString(),
2924 const QVariant &defaultValue = QVariant(),
2925 bool optional = false );
2926
2930 static QString typeName() { return QStringLiteral( "mesh" ); }
2931 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2932 QString type() const override { return typeName(); }
2933 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2934 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2935 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
2936 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
2937 QString createFileFilter() const override;
2938
2942 static QgsProcessingParameterMeshLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2943};
2944
2952{
2953 public:
2954
2958 QgsProcessingParameterMapLayer( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
2959 bool optional = false,
2960 const QList< int > &types = QList< int >() );
2961
2965 static QString typeName() { return QStringLiteral( "layer" ); }
2966 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2967 QString type() const override { return typeName(); }
2968 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2969 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2970 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
2971 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
2972 QString asScriptCode() const override;
2973 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2974 QString createFileFilter() const override;
2975
2976 QVariantMap toVariantMap() const override;
2977 bool fromVariantMap( const QVariantMap &map ) override;
2978
2982 static QgsProcessingParameterMapLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2983
2984};
2985
2993{
2994 public:
2995
2998 {
2999 Any = -1,
3000 Numeric = 0,
3001 String = 1,
3002 DateTime = 2
3004
3008 QgsProcessingParameterField( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
3009 const QString &parentLayerParameterName = QString(),
3010 DataType type = Any,
3011 bool allowMultiple = false,
3012 bool optional = false,
3013 bool defaultToAllFields = false );
3014
3018 static QString typeName() { return QStringLiteral( "field" ); }
3019 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3020 QString type() const override { return typeName(); }
3021 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3022 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3023 QString asScriptCode() const override;
3024 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3025 QStringList dependsOnOtherParameters() const override;
3026
3031 QString parentLayerParameterName() const;
3032
3037 void setParentLayerParameterName( const QString &parentLayerParameterName );
3038
3043 DataType dataType() const;
3044
3049 void setDataType( DataType type );
3050
3055 bool allowMultiple() const;
3056
3061 void setAllowMultiple( bool allowMultiple );
3062
3072 bool defaultToAllFields() const;
3073
3083 void setDefaultToAllFields( bool enabled );
3084
3085 QVariantMap toVariantMap() const override;
3086 bool fromVariantMap( const QVariantMap &map ) override;
3087
3091 static QgsProcessingParameterField *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3092
3093 private:
3094
3095 QString mParentLayerParameterName;
3096 DataType mDataType = Any;
3097 bool mAllowMultiple = false;
3098 bool mDefaultToAllFields = false;
3099
3100};
3101
3102
3110{
3111 public:
3112
3116 QgsProcessingParameterFeatureSource( const QString &name, const QString &description = QString(),
3117 const QList< int > &types = QList< int >(),
3118 const QVariant &defaultValue = QVariant(), bool optional = false );
3119
3123 static QString typeName() { return QStringLiteral( "source" ); }
3124 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3125 QString type() const override { return typeName(); }
3126 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3127 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3128 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
3129 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
3130 QString asScriptCode() const override;
3131 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3132 QString createFileFilter() const override;
3133
3134 QVariantMap toVariantMap() const override;
3135 bool fromVariantMap( const QVariantMap &map ) override;
3136
3140 static QgsProcessingParameterFeatureSource *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3141
3142};
3143
3152{
3153 public:
3154
3161 QgsProcessingDestinationParameter( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
3162 bool optional = false, bool createByDefault = true );
3163
3164 bool isDestination() const override { return true; }
3165 QVariantMap toVariantMap() const override;
3166 bool fromVariantMap( const QVariantMap &map ) override;
3167 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3168 QString createFileFilter() const override;
3169
3175
3181 bool supportsNonFileBasedOutput() const { return mSupportsNonFileBasedOutputs; }
3182
3188 void setSupportsNonFileBasedOutput( bool supportsNonFileBasedOutput ) { mSupportsNonFileBasedOutputs = supportsNonFileBasedOutput; }
3189
3194 virtual QString defaultFileExtension() const = 0;
3195
3201 virtual QString generateTemporaryDestination() const;
3202
3217 virtual bool isSupportedOutputValue( const QVariant &value, QgsProcessingContext &context, QString &error SIP_OUT ) const;
3218
3224 bool createByDefault() const;
3225
3231 void setCreateByDefault( bool createByDefault );
3232
3233 protected:
3234
3243 QgsProcessingProvider *originalProvider() const { return mOriginalProvider; }
3244
3245 private:
3246
3254 QgsProcessingProvider *mOriginalProvider = nullptr;
3255
3256 bool mSupportsNonFileBasedOutputs = true;
3257 bool mCreateByDefault = true;
3258
3259 friend class QgsProcessingModelAlgorithm;
3260 friend class TestQgsProcessing;
3261 friend class TestQgsProcessingModelAlgorithm;
3262};
3263
3264
3274{
3275 public:
3276
3283 QgsProcessingParameterFeatureSink( const QString &name, const QString &description = QString(), QgsProcessing::SourceType type = QgsProcessing::TypeVectorAnyGeometry, const QVariant &defaultValue = QVariant(),
3284 bool optional = false, bool createByDefault = true, bool supportsAppend = false );
3285
3289 static QString typeName() { return QStringLiteral( "sink" ); }
3290 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3291 QString type() const override { return typeName(); }
3292 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3293 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3294 QString asScriptCode() const override;
3295 QgsProcessingOutputDefinition *toOutputDefinition() const override SIP_FACTORY;
3296 QString defaultFileExtension() const override;
3297 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3298 QString createFileFilter() const override;
3299
3305 virtual QStringList supportedOutputVectorLayerExtensions() const;
3306
3311 QgsProcessing::SourceType dataType() const;
3312
3317 bool hasGeometry() const;
3318
3323 void setDataType( QgsProcessing::SourceType type );
3324
3333 bool supportsAppend() const;
3334
3343 void setSupportsAppend( bool supportsAppend );
3344
3345 QVariantMap toVariantMap() const override;
3346 bool fromVariantMap( const QVariantMap &map ) override;
3347 QString generateTemporaryDestination() const override;
3348
3352 static QgsProcessingParameterFeatureSink *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3353
3354 private:
3355
3356 QgsProcessing::SourceType mDataType = QgsProcessing::TypeVectorAnyGeometry;
3357 bool mSupportsAppend = false;
3358};
3359
3360
3372{
3373 public:
3374
3381 QgsProcessingParameterVectorDestination( const QString &name, const QString &description = QString(), QgsProcessing::SourceType type = QgsProcessing::TypeVectorAnyGeometry, const QVariant &defaultValue = QVariant(),
3382 bool optional = false, bool createByDefault = true );
3383
3387 static QString typeName() { return QStringLiteral( "vectorDestination" ); }
3388 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3389 QString type() const override { return typeName(); }
3390 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3391 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3392 QString asScriptCode() const override;
3393 QgsProcessingOutputDefinition *toOutputDefinition() const override SIP_FACTORY;
3394 QString defaultFileExtension() const override;
3395 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3396 QString createFileFilter() const override;
3397
3403 virtual QStringList supportedOutputVectorLayerExtensions() const;
3404
3409 QgsProcessing::SourceType dataType() const;
3410
3415 bool hasGeometry() const;
3416
3421 void setDataType( QgsProcessing::SourceType type );
3422
3423 QVariantMap toVariantMap() const override;
3424 bool fromVariantMap( const QVariantMap &map ) override;
3425
3429 static QgsProcessingParameterVectorDestination *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3430
3431
3432 private:
3433
3434 QgsProcessing::SourceType mDataType = QgsProcessing::TypeVectorAnyGeometry;
3435};
3436
3445{
3446 public:
3447
3454 QgsProcessingParameterRasterDestination( const QString &name, const QString &description = QString(),
3455 const QVariant &defaultValue = QVariant(),
3456 bool optional = false,
3457 bool createByDefault = true );
3458
3462 static QString typeName() { return QStringLiteral( "rasterDestination" ); }
3463 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3464 QString type() const override { return typeName(); }
3465 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3466 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3467 QgsProcessingOutputDefinition *toOutputDefinition() const override SIP_FACTORY;
3468 QString defaultFileExtension() const override;
3469 QString createFileFilter() const override;
3470
3476 virtual QStringList supportedOutputRasterLayerExtensions() const;
3477
3481 static QgsProcessingParameterRasterDestination *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3482};
3483
3506{
3507 public:
3508
3515 QgsProcessingParameterFileDestination( const QString &name, const QString &description = QString(),
3516 const QString &fileFilter = QString(),
3517 const QVariant &defaultValue = QVariant(),
3518 bool optional = false,
3519 bool createByDefault = true );
3520
3524 static QString typeName() { return QStringLiteral( "fileDestination" ); }
3525 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3526 QString type() const override { return typeName(); }
3527 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3528 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3529 QgsProcessingOutputDefinition *toOutputDefinition() const override SIP_FACTORY;
3530 QString defaultFileExtension() const override;
3531 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3532 QString createFileFilter() const override;
3533
3538 QString fileFilter() const;
3539
3544 void setFileFilter( const QString &filter );
3545
3546 QVariantMap toVariantMap() const override;
3547 bool fromVariantMap( const QVariantMap &map ) override;
3548
3552 static QgsProcessingParameterFileDestination *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3553
3554
3555 private:
3556
3557 QString mFileFilter;
3558};
3559
3568{
3569 public:
3570
3574 QgsProcessingParameterFolderDestination( const QString &name, const QString &description = QString(),
3575 const QVariant &defaultValue = QVariant(),
3576 bool optional = false,
3577 bool createByDefault = true );
3578
3582 static QString typeName() { return QStringLiteral( "folderDestination" ); }
3583 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3584 QString type() const override { return typeName(); }
3585 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3586 QgsProcessingOutputDefinition *toOutputDefinition() const override SIP_FACTORY;
3587 QString defaultFileExtension() const override;
3588
3592 static QgsProcessingParameterFolderDestination *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3593
3594};
3595
3603{
3604 public:
3605
3609 QgsProcessingParameterBand( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
3610 const QString &parentLayerParameterName = QString(),
3611 bool optional = false,
3612 bool allowMultiple = false );
3613
3617 static QString typeName() { return QStringLiteral( "band" ); }
3618 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3619 QString type() const override { return typeName(); }
3620 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3621 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3622 QString asScriptCode() const override;
3623 QStringList dependsOnOtherParameters() const override;
3624 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3625
3630 QString parentLayerParameterName() const;
3631
3636 void setParentLayerParameterName( const QString &parentLayerParameterName );
3637
3638 QVariantMap toVariantMap() const override;
3639 bool fromVariantMap( const QVariantMap &map ) override;
3640
3644 static QgsProcessingParameterBand *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3645
3651 bool allowMultiple() const;
3652
3658 void setAllowMultiple( bool allowMultiple );
3659
3660 private:
3661
3662 QString mParentLayerParameterName;
3663 bool mAllowMultiple = false;
3664};
3665
3678{
3679 public:
3680
3684 QgsProcessingParameterLayout( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
3685 bool optional = false );
3686
3690 static QString typeName() { return QStringLiteral( "layout" ); }
3691 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3692 QString type() const override { return typeName(); }
3693 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3694 QString asScriptCode() const override;
3695 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3696
3700 static QgsProcessingParameterLayout *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3701
3702};
3703
3716{
3717 public:
3718
3722 QgsProcessingParameterLayoutItem( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
3723 const QString &parentLayoutParameterName = QString(),
3724 int itemType = -1,
3725 bool optional = false );
3726
3730 static QString typeName() { return QStringLiteral( "layoutitem" ); }
3731 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3732 QString type() const override { return typeName(); }
3733 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3734 QString asScriptCode() const override;
3735 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3736 QVariantMap toVariantMap() const override;
3737 bool fromVariantMap( const QVariantMap &map ) override;
3738 QStringList dependsOnOtherParameters() const override;
3739
3743 static QgsProcessingParameterLayoutItem *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3744
3749 QString parentLayoutParameterName() const;
3750
3755 void setParentLayoutParameterName( const QString &name );
3756
3764 int itemType() const;
3765
3773 void setItemType( int type );
3774
3775 private:
3776 QString mParentLayoutParameterName;
3777 int mItemType = -1;
3778};
3779
3790{
3791 public:
3792
3798 QgsProcessingParameterColor( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
3799 bool opacityEnabled = true,
3800 bool optional = false );
3801
3805 static QString typeName() { return QStringLiteral( "color" ); }
3806 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3807 QString type() const override { return typeName(); }
3808 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3809 QString asScriptCode() const override;
3810 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3811 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3812 QVariantMap toVariantMap() const override;
3813 bool fromVariantMap( const QVariantMap &map ) override;
3814
3821 bool opacityEnabled() const;
3822
3830 void setOpacityEnabled( bool enabled );
3831
3835 static QgsProcessingParameterColor *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3836
3837 private:
3838
3839 bool mAllowOpacity = true;
3840
3841};
3842
3843
3854{
3855 public:
3856
3860 QgsProcessingParameterCoordinateOperation( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
3861 const QString &sourceCrsParameterName = QString(), const QString &destinationCrsParameterName = QString(),
3862 const QVariant &staticSourceCrs = QVariant(), const QVariant &staticDestinationCrs = QVariant(),
3863 bool optional = false );
3864
3868 static QString typeName() { return QStringLiteral( "coordinateoperation" ); }
3869 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3870 QString type() const override { return typeName(); }
3871 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3872 QString asScriptCode() const override;
3873 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3874 QStringList dependsOnOtherParameters() const override;
3875
3876 QVariantMap toVariantMap() const override;
3877 bool fromVariantMap( const QVariantMap &map ) override;
3878
3882 static QgsProcessingParameterCoordinateOperation *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3883
3889 QString sourceCrsParameterName() const { return mSourceParameterName; }
3890
3896 void setSourceCrsParameterName( const QString &name ) { mSourceParameterName = name; }
3897
3903 QString destinationCrsParameterName() const { return mDestParameterName; }
3904
3910 void setDestinationCrsParameterName( const QString &name ) { mDestParameterName = name; }
3911
3917 QVariant sourceCrs() const { return mSourceCrs; }
3918
3924 void setSourceCrs( const QVariant &crs ) { mSourceCrs = crs; }
3925
3931 QVariant destinationCrs() const { return mDestCrs; }
3932
3938 void setDestinationCrs( const QVariant &crs ) { mDestCrs = crs; }
3939
3940 private:
3941
3942 QString mSourceParameterName;
3943 QString mDestParameterName;
3944 QVariant mSourceCrs;
3945 QVariant mDestCrs;
3946
3947};
3948
3949
3960{
3961 public:
3962
3966 QgsProcessingParameterMapTheme( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
3967 bool optional = false );
3968
3972 static QString typeName() { return QStringLiteral( "maptheme" ); }
3973 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3974 QString type() const override { return typeName(); }
3975 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3976 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3977 QString asScriptCode() const override;
3978 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3979 QVariantMap toVariantMap() const override;
3980 bool fromVariantMap( const QVariantMap &map ) override;
3981
3985 static QgsProcessingParameterMapTheme *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3986
3987 private:
3988
3989};
3990
3991
4003{
4004 public:
4005
4007 enum Type
4008 {
4012 };
4013
4017 explicit QgsProcessingParameterDateTime( const QString &name, const QString &description = QString(),
4018 Type type = DateTime,
4019 const QVariant &defaultValue = QVariant(),
4020 bool optional = false,
4021 const QDateTime &minValue = QDateTime(),
4022 const QDateTime &maxValue = QDateTime()
4023 );
4024
4028 static QString typeName() { return QStringLiteral( "datetime" ); }
4029 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4030 QString type() const override { return typeName(); }
4031 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4032 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4033 QString toolTip() const override;
4034 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
4035
4043 QDateTime minimum() const;
4044
4056 void setMinimum( const QDateTime &minimum );
4057
4065 QDateTime maximum() const;
4066
4078 void setMaximum( const QDateTime &maximum );
4079
4084 Type dataType() const;
4085
4090 void setDataType( Type type );
4091
4092 QVariantMap toVariantMap() const override;
4093 bool fromVariantMap( const QVariantMap &map ) override;
4094
4098 static QgsProcessingParameterDateTime *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4099
4100 private:
4101
4102 QDateTime mMin;
4103 QDateTime mMax;
4104 Type mDataType = DateTime;
4105};
4106
4107
4119{
4120 public:
4121
4128 QgsProcessingParameterProviderConnection( const QString &name, const QString &description, const QString &provider, const QVariant &defaultValue = QVariant(),
4129 bool optional = false );
4130
4134 static QString typeName() { return QStringLiteral( "providerconnection" ); }
4135 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4136 QString type() const override { return typeName(); }
4137 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4138 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4139 QString asScriptCode() const override;
4140 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
4141 QVariantMap toVariantMap() const override;
4142 bool fromVariantMap( const QVariantMap &map ) override;
4143
4148 QString providerId() const { return mProviderId; }
4149
4154 void setProviderId( const QString &provider ) { mProviderId = provider; }
4155
4159 static QgsProcessingParameterProviderConnection *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4160
4161 private:
4162
4163 QString mProviderId;
4164};
4165
4166
4178{
4179 public:
4180
4189 QgsProcessingParameterDatabaseSchema( const QString &name, const QString &description, const QString &connectionParameterName = QString(), const QVariant &defaultValue = QVariant(),
4190 bool optional = false );
4191
4195 static QString typeName() { return QStringLiteral( "databaseschema" ); }
4196 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4197 QString type() const override { return typeName(); }
4198 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4199 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4200 QString asScriptCode() const override;
4201 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
4202 QVariantMap toVariantMap() const override;
4203 bool fromVariantMap( const QVariantMap &map ) override;
4204 QStringList dependsOnOtherParameters() const override;
4205
4210 QString parentConnectionParameterName() const;
4211
4216 void setParentConnectionParameterName( const QString &name );
4217
4221 static QgsProcessingParameterDatabaseSchema *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4222
4223 private:
4224
4225 QString mParentConnectionParameterName;
4226};
4227
4228
4240{
4241 public:
4242
4252 QgsProcessingParameterDatabaseTable( const QString &name, const QString &description,
4253 const QString &connectionParameterName = QString(),
4254 const QString &schemaParameterName = QString(),
4255 const QVariant &defaultValue = QVariant(),
4256 bool optional = false,
4257 bool allowNewTableNames = false );
4258
4262 static QString typeName() { return QStringLiteral( "databasetable" ); }
4263 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4264 QString type() const override { return typeName(); }
4265 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4266 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4267 QString asScriptCode() const override;
4268 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
4269 QVariantMap toVariantMap() const override;
4270 bool fromVariantMap( const QVariantMap &map ) override;
4271 QStringList dependsOnOtherParameters() const override;
4272
4277 QString parentConnectionParameterName() const;
4278
4283 void setParentConnectionParameterName( const QString &name );
4284
4289 QString parentSchemaParameterName() const;
4290
4295 void setParentSchemaParameterName( const QString &name );
4296
4300 static QgsProcessingParameterDatabaseTable *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4301
4308 bool allowNewTableNames() const;
4309
4316 void setAllowNewTableNames( bool allowed );
4317
4318 private:
4319
4320 QString mParentConnectionParameterName;
4321 QString mParentSchemaParameterName;
4322 bool mAllowNewTableNames = false;
4323};
4324
4325
4333{
4334 public:
4335
4339 QgsProcessingParameterPointCloudLayer( const QString &name, const QString &description = QString(),
4340 const QVariant &defaultValue = QVariant(), bool optional = false );
4341
4345 static QString typeName() { return QStringLiteral( "pointcloud" ); }
4346 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4347 QString type() const override { return typeName(); }
4348 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4349 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4350 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
4351 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
4352 QString createFileFilter() const override;
4353
4357 static QgsProcessingParameterPointCloudLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4358};
4359
4360
4368{
4369 public:
4370
4374 QgsProcessingParameterAnnotationLayer( const QString &name, const QString &description = QString(),
4375 const QVariant &defaultValue = QVariant(), bool optional = false );
4376
4380 static QString typeName() { return QStringLiteral( "annotation" ); }
4381 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4382 QString type() const override { return typeName(); }
4383 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4384 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4385 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
4386 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
4387
4391 static QgsProcessingParameterAnnotationLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4392};
4393
4402{
4403 public:
4404
4411 QgsProcessingParameterPointCloudDestination( const QString &name, const QString &description = QString(),
4412 const QVariant &defaultValue = QVariant(),
4413 bool optional = false,
4414 bool createByDefault = true );
4415
4419 static QString typeName() { return QStringLiteral( "pointCloudDestination" ); }
4420 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4421 QString type() const override { return typeName(); }
4422 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4423 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4424 QgsProcessingOutputDefinition *toOutputDefinition() const override SIP_FACTORY;
4425 QString defaultFileExtension() const override;
4426 QString createFileFilter() const override;
4427
4432 virtual QStringList supportedOutputPointCloudLayerExtensions() const;
4433
4437 static QgsProcessingParameterPointCloudDestination *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4438};
4439
4440// clazy:excludeall=qstring-allocations
4441
4442#endif // QGSPROCESSINGPARAMETERS_H
4443
4444
Represents a map layer containing a set of georeferenced annotations, e.g.
This class represents a coordinate reference system (CRS).
This class wraps a request for features to a vector layer (or directly its vector data provider).
InvalidGeometryCheck
Handling of features with invalid geometries.
@ GeometryAbortOnInvalid
Close iterator on encountering any features with invalid geometry. This requires a slow geometry vali...
An interface for objects which accept features via addFeature(s) methods.
Container of fields for a vector layer.
Definition: qgsfields.h:45
Abstract interface for classes which generate a file filter string.
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:164
Base class for graphical items within a QgsLayout.
Base class for all map layer types.
Definition: qgsmaplayer.h:73
Represents a mesh layer supporting display of data on structured or unstructured meshes.
Definition: qgsmeshlayer.h:100
Represents a map layer supporting display of point clouds.
A class to represent a 2D point.
Definition: qgspointxy.h:59
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.
Definition: qgsexception.h:83
Encapsulates settings relating to a feature source input to a processing algorithm.
Flags flags
Flags which dictate source behavior.
bool operator!=(const QgsProcessingFeatureSourceDefinition &other) const
bool selectedFeaturesOnly
true if only selected features in the source should be used by algorithms.
QgsFeatureRequest::InvalidGeometryCheck geometryCheck
Geometry check method to apply to this source.
bool operator==(const QgsProcessingFeatureSourceDefinition &other) const
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...
Flag
Flags which control source behavior.
QgsProcessingFeatureSourceDefinition(const QgsProperty &source, bool selectedFeaturesOnly=false, long long featureLimit=-1, QgsProcessingFeatureSourceDefinition::Flags flags=QgsProcessingFeatureSourceDefinition::Flags(), QgsFeatureRequest::InvalidGeometryCheck geometryCheck=QgsFeatureRequest::GeometryAbortOnInvalid)
Constructor for QgsProcessingFeatureSourceDefinition, accepting a QgsProperty 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 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.
QVariant guiDefaultValueOverride() const
Returns the default value to use in the GUI 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.
void setMetadata(const QVariantMap &metadata)
Sets the parameter's freeform metadata.
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.
QVariant defaultValueForGui() const
Returns the default value to use for the parameter in a GUI.
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.
Flags flags() const
Returns any flags associated with the parameter.
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.
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....
void setFlags(Flags flags)
Sets the flags associated with the parameter.
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.
void setDefaultUnit(QgsUnitTypes::DistanceUnit unit)
Sets the default distance unit for the parameter.
static QString typeName()
Returns the type name for the parameter class.
A double numeric parameter for duration values.
void setDefaultUnit(QgsUnitTypes::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(Behavior behavior)
Sets the parameter behavior (e.g.
Behavior 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 QgsWkbTypes::GeometryType values.
bool allowMultipart() const
Returns the parameter allow multipart geometries.
QList< int > geometryTypes() const
Returns the parameter allowed geometries, as a list of QgsWkbTypes::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 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.
static QString typeName()
Returns the type name for the parameter class.
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.
Definition: qgsprocessing.h:40
PythonOutputType
Available Python output types.
Definition: qgsprocessing.h:63
@ PythonQgsProcessingAlgorithmSubclass
Full Python QgsProcessingAlgorithm subclass.
Definition: qgsprocessing.h:64
SourceType
Data source types enum.
Definition: qgsprocessing.h:46
@ TypeVectorAnyGeometry
Any vector layer with geometry.
Definition: qgsprocessing.h:48
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition: qgsproject.h:105
Definition for a property.
Definition: qgsproperty.h:46
A store for object properties.
Definition: qgsproperty.h:230
Represents a raster layer.
A rectangle specified with double values.
Definition: qgsrectangle.h:42
Defines the parameters used to remap features when creating a QgsRemappingProxyFeatureSink.
Helper functions for various unit types.
Definition: qgsunittypes.h:39
DistanceUnit
Units of distance.
Definition: qgsunittypes.h:68
@ DistanceUnknownUnit
Unknown distance unit.
Definition: qgsunittypes.h:78
TemporalUnit
Temporal units.
Definition: qgsunittypes.h:150
@ TemporalMilliseconds
Milliseconds.
Definition: qgsunittypes.h:151
Represents a vector layer which manages a vector based data sets.
Type
The WKB type describes the number of dimensions a geometry has.
Definition: qgswkbtypes.h:70
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:186
#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:198
#define SIP_END
Definition: qgis_sip.h:203
Q_DECLARE_METATYPE(QgsDatabaseQueryLogEntry)
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsField::ConfigurationFlags) CORE_EXPORT QDataStream &operator<<(QDataStream &out
Writes the field to stream out. QGIS version compatibility is not guaranteed.
QList< const QgsProcessingParameterDefinition * > QgsProcessingParameterDefinitions
List of processing parameters.
const QgsCoordinateReferenceSystem & crs
const QString & typeName