QGIS API Documentation 3.36.0-Maidenhead (09951dc0acf)
Loading...
Searching...
No Matches
qgsprocessingparameters.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsprocessingparameters.h
3 -------------------------
4 begin : April 2017
5 copyright : (C) 2017 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSPROCESSINGPARAMETERS_H
19#define QGSPROCESSINGPARAMETERS_H
20
21#include "qgis_core.h"
22#include "qgis.h"
23#include "qgsprocessing.h"
24#include "qgsproperty.h"
26#include "qgsprocessingutils.h"
29#include <QMap>
30#include <limits>
31
34class QgsRasterLayer;
35class QgsMeshLayer;
36class QgsVectorLayer;
37class QgsFeatureSink;
42class QgsPrintLayout;
43class QgsLayoutItem;
46
56{
57 public:
58
75 QgsProcessingFeatureSourceDefinition( const QString &source = QString(), bool selectedFeaturesOnly = false, long long featureLimit = -1,
76 Qgis::ProcessingFeatureSourceDefinitionFlags flags = Qgis::ProcessingFeatureSourceDefinitionFlags(), Qgis::InvalidGeometryCheck geometryCheck = Qgis::InvalidGeometryCheck::AbortOnInvalid, const QString &filterExpression = QString() )
77 : source( QgsProperty::fromValue( source ) )
78 , selectedFeaturesOnly( selectedFeaturesOnly )
79 , featureLimit( featureLimit )
80 , filterExpression( filterExpression )
81 , flags( flags )
82 , geometryCheck( geometryCheck )
83 {}
84
101 QgsProcessingFeatureSourceDefinition( const QgsProperty &source, bool selectedFeaturesOnly = false, long long featureLimit = -1,
102 Qgis::ProcessingFeatureSourceDefinitionFlags flags = Qgis::ProcessingFeatureSourceDefinitionFlags(), Qgis::InvalidGeometryCheck geometryCheck = Qgis::InvalidGeometryCheck::AbortOnInvalid, const QString &filterExpression = QString() )
103 : source( source )
104 , selectedFeaturesOnly( selectedFeaturesOnly )
105 , featureLimit( featureLimit )
106 , filterExpression( filterExpression )
107 , flags( flags )
108 , geometryCheck( geometryCheck )
109 {}
110
115
120
127 long long featureLimit = -1;
128
135
141 Qgis::ProcessingFeatureSourceDefinitionFlags flags;
142
152
159 QVariant toVariant() const;
160
167 bool loadVariant( const QVariantMap &map );
168
169 // TODO c++20 - replace with = default
171 {
172 return source == other.source
173 && selectedFeaturesOnly == other.selectedFeaturesOnly
174 && featureLimit == other.featureLimit
175 && filterExpression == other.filterExpression
176 && flags == other.flags
177 && geometryCheck == other.geometryCheck;
178 }
179
181 {
182 return !( *this == other );
183 }
184
186 operator QVariant() const
187 {
188 return QVariant::fromValue( *this );
189 }
190
191};
192
194
195
204{
205 public:
206
212 QgsProcessingOutputLayerDefinition( const QString &sink = QString(), QgsProject *destinationProject = nullptr )
213 : sink( QgsProperty::fromValue( sink ) )
214 , destinationProject( destinationProject )
215 {}
216
222 QgsProcessingOutputLayerDefinition( const QgsProperty &sink, QgsProject *destinationProject = nullptr )
223 : sink( sink )
224 , destinationProject( destinationProject )
225 {}
226
231
237 QgsProject *destinationProject = nullptr;
238
243
250 QVariantMap createOptions;
251
258 bool useRemapping() const { return mUseRemapping; }
259
267 QgsRemappingSinkDefinition remappingDefinition() const { return mRemappingDefinition; }
268
279 void setRemappingDefinition( const QgsRemappingSinkDefinition &definition );
280
287 QVariant toVariant() const;
288
295 bool loadVariant( const QVariantMap &map );
296
298 operator QVariant() const
299 {
300 return QVariant::fromValue( *this );
301 }
302
303 // TODO c++20 - replace with = default
304 bool operator==( const QgsProcessingOutputLayerDefinition &other ) const;
305 bool operator!=( const QgsProcessingOutputLayerDefinition &other ) const;
306
307 private:
308
309 bool mUseRemapping = false;
311
312};
313
315
316
317
318
319//
320// Parameter definitions
321//
322
323
335{
336
337#ifdef SIP_RUN
338 % TypeHeaderCode
345 % End
347 if ( sipCpp->type() == QgsProcessingParameterBoolean::typeName() )
348 sipType = sipType_QgsProcessingParameterBoolean;
349 else if ( sipCpp->type() == QgsProcessingParameterCrs::typeName() )
350 sipType = sipType_QgsProcessingParameterCrs;
351 else if ( sipCpp->type() == QgsProcessingParameterMapLayer::typeName() )
352 sipType = sipType_QgsProcessingParameterMapLayer;
353 else if ( sipCpp->type() == QgsProcessingParameterExtent::typeName() )
354 sipType = sipType_QgsProcessingParameterExtent;
355 else if ( sipCpp->type() == QgsProcessingParameterPoint::typeName() )
356 sipType = sipType_QgsProcessingParameterPoint;
357 else if ( sipCpp->type() == QgsProcessingParameterGeometry::typeName() )
358 sipType = sipType_QgsProcessingParameterGeometry;
359 else if ( sipCpp->type() == QgsProcessingParameterFile::typeName() )
360 sipType = sipType_QgsProcessingParameterFile;
361 else if ( sipCpp->type() == QgsProcessingParameterMatrix::typeName() )
362 sipType = sipType_QgsProcessingParameterMatrix;
363 else if ( sipCpp->type() == QgsProcessingParameterMultipleLayers::typeName() )
364 sipType = sipType_QgsProcessingParameterMultipleLayers;
365 else if ( sipCpp->type() == QgsProcessingParameterNumber::typeName() )
366 sipType = sipType_QgsProcessingParameterNumber;
367 else if ( sipCpp->type() == QgsProcessingParameterDistance::typeName() )
368 sipType = sipType_QgsProcessingParameterDistance;
369 else if ( sipCpp->type() == QgsProcessingParameterDuration::typeName() )
370 sipType = sipType_QgsProcessingParameterDuration;
371 else if ( sipCpp->type() == QgsProcessingParameterScale::typeName() )
372 sipType = sipType_QgsProcessingParameterScale;
373 else if ( sipCpp->type() == QgsProcessingParameterRange::typeName() )
374 sipType = sipType_QgsProcessingParameterRange;
375 else if ( sipCpp->type() == QgsProcessingParameterRasterLayer::typeName() )
376 sipType = sipType_QgsProcessingParameterRasterLayer;
377 else if ( sipCpp->type() == QgsProcessingParameterMeshLayer::typeName() )
378 sipType = sipType_QgsProcessingParameterMeshLayer;
379 else if ( sipCpp->type() == QgsProcessingParameterEnum::typeName() )
380 sipType = sipType_QgsProcessingParameterEnum;
381 else if ( sipCpp->type() == QgsProcessingParameterString::typeName() )
382 sipType = sipType_QgsProcessingParameterString;
383 else if ( sipCpp->type() == QgsProcessingParameterExpression::typeName() )
384 sipType = sipType_QgsProcessingParameterExpression;
385 else if ( sipCpp->type() == QgsProcessingParameterAuthConfig::typeName() )
386 sipType = sipType_QgsProcessingParameterAuthConfig;
387 else if ( sipCpp->type() == QgsProcessingParameterVectorLayer::typeName() )
388 sipType = sipType_QgsProcessingParameterVectorLayer;
389 else if ( sipCpp->type() == QgsProcessingParameterField::typeName() )
390 sipType = sipType_QgsProcessingParameterField;
391 else if ( sipCpp->type() == QgsProcessingParameterFeatureSource::typeName() )
392 sipType = sipType_QgsProcessingParameterFeatureSource;
393 else if ( sipCpp->type() == QgsProcessingParameterFeatureSink::typeName() )
394 sipType = sipType_QgsProcessingParameterFeatureSink;
395 else if ( sipCpp->type() == QgsProcessingParameterVectorDestination::typeName() )
396 sipType = sipType_QgsProcessingParameterVectorDestination;
397 else if ( sipCpp->type() == QgsProcessingParameterRasterDestination::typeName() )
398 sipType = sipType_QgsProcessingParameterRasterDestination;
399 else if ( sipCpp->type() == QgsProcessingParameterPointCloudDestination::typeName() )
400 sipType = sipType_QgsProcessingParameterPointCloudDestination;
401 else if ( sipCpp->type() == QgsProcessingParameterFileDestination::typeName() )
402 sipType = sipType_QgsProcessingParameterFileDestination;
403 else if ( sipCpp->type() == QgsProcessingParameterFolderDestination::typeName() )
404 sipType = sipType_QgsProcessingParameterFolderDestination;
405 else if ( sipCpp->type() == QgsProcessingParameterBand::typeName() )
406 sipType = sipType_QgsProcessingParameterBand;
407 else if ( sipCpp->type() == QgsProcessingParameterLayout::typeName() )
408 sipType = sipType_QgsProcessingParameterLayout;
409 else if ( sipCpp->type() == QgsProcessingParameterLayoutItem::typeName() )
410 sipType = sipType_QgsProcessingParameterLayoutItem;
411 else if ( sipCpp->type() == QgsProcessingParameterColor::typeName() )
412 sipType = sipType_QgsProcessingParameterColor;
413 else if ( sipCpp->type() == QgsProcessingParameterCoordinateOperation::typeName() )
414 sipType = sipType_QgsProcessingParameterCoordinateOperation;
415 else if ( sipCpp->type() == QgsProcessingParameterMapTheme::typeName() )
416 sipType = sipType_QgsProcessingParameterMapTheme;
417 else if ( sipCpp->type() == QgsProcessingParameterDateTime::typeName() )
418 sipType = sipType_QgsProcessingParameterDateTime;
419 else if ( sipCpp->type() == QgsProcessingParameterProviderConnection::typeName() )
420 sipType = sipType_QgsProcessingParameterProviderConnection;
421 else if ( sipCpp->type() == QgsProcessingParameterDatabaseSchema::typeName() )
422 sipType = sipType_QgsProcessingParameterDatabaseSchema;
423 else if ( sipCpp->type() == QgsProcessingParameterDatabaseTable::typeName() )
424 sipType = sipType_QgsProcessingParameterDatabaseTable;
425 else if ( sipCpp->type() == QgsProcessingParameterFieldMapping::typeName() )
426 sipType = sipType_QgsProcessingParameterFieldMapping;
427 else if ( sipCpp->type() == QgsProcessingParameterTinInputLayers::typeName() )
428 sipType = sipType_QgsProcessingParameterTinInputLayers;
429 else if ( sipCpp->type() == QgsProcessingParameterVectorTileWriterLayers::typeName() )
430 sipType = sipType_QgsProcessingParameterVectorTileWriterLayers;
431 else if ( sipCpp->type() == QgsProcessingParameterDxfLayers::typeName() )
432 sipType = sipType_QgsProcessingParameterDxfLayers;
433 else if ( sipCpp->type() == QgsProcessingParameterMeshDatasetGroups::typeName() )
434 sipType = sipType_QgsProcessingParameterMeshDatasetGroups;
435 else if ( sipCpp->type() == QgsProcessingParameterMeshDatasetTime::typeName() )
436 sipType = sipType_QgsProcessingParameterMeshDatasetTime;
437 else if ( sipCpp->type() == QgsProcessingParameterPointCloudLayer::typeName() )
438 sipType = sipType_QgsProcessingParameterPointCloudLayer;
439 else if ( sipCpp->type() == QgsProcessingParameterAnnotationLayer::typeName() )
440 sipType = sipType_QgsProcessingParameterAnnotationLayer;
441 else if ( sipCpp->type() == QgsProcessingParameterPointCloudAttribute::typeName() )
442 sipType = sipType_QgsProcessingParameterPointCloudAttribute;
443 else if ( sipCpp->type() == QgsProcessingParameterVectorTileDestination::typeName() )
444 sipType = sipType_QgsProcessingParameterVectorTileDestination;
445 else
446 sipType = nullptr;
447 SIP_END
448#endif
449
450 public:
451
455 QgsProcessingParameterDefinition( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
456 bool optional = false, const QString &help = QString() );
457
459
464
468 virtual QString type() const = 0;
469
475 virtual bool isDestination() const { return false; }
476
482 QString name() const { return mName; }
483
489 void setName( const QString &name ) { mName = name; }
490
496 QString description() const { return mDescription; }
497
503 void setDescription( const QString &description ) { mDescription = description; }
504
514 QString help() const { return mHelp; }
515
525 void setHelp( const QString &help ) { mHelp = help; }
526
533 QVariant defaultValue() const { return mDefault; }
534
541 void setDefaultValue( const QVariant &value ) { mDefault = value; }
542
555 QVariant guiDefaultValueOverride() const;
556
572 void setGuiDefaultValueOverride( const QVariant &value ) { mGuiDefault = value; }
573
582 QVariant defaultValueForGui() const;
583
588 Qgis::ProcessingParameterFlags flags() const { return mFlags; }
589
594 void setFlags( Qgis::ProcessingParameterFlags flags ) { mFlags = flags; }
595
603 virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const;
604
612 virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
613
625 virtual QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const;
626
640 virtual QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const;
641
655 virtual QStringList valueAsStringList( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const;
656
662 virtual QString valueAsPythonComment( const QVariant &value, QgsProcessingContext &context ) const;
663
668 virtual QString asScriptCode() const;
669
680
686 virtual QVariantMap toVariantMap() const;
687
693 virtual bool fromVariantMap( const QVariantMap &map );
694
701 SIP_SKIP QVariantMap metadata() const { return mMetadata; }
702
708 QVariantMap &metadata() { return mMetadata; }
709
715 void setMetadata( const QVariantMap &metadata ) { mMetadata = metadata; }
716
721 virtual QStringList dependsOnOtherParameters() const { return QStringList(); }
722
729
735 QgsProcessingProvider *provider() const;
736
741 virtual QString toolTip() const;
742
750 bool isDynamic() const { return mIsDynamic; }
751
759 void setIsDynamic( bool dynamic ) { mIsDynamic = dynamic; }
760
767 QgsPropertyDefinition dynamicPropertyDefinition() const { return mPropertyDefinition; }
768
775 void setDynamicPropertyDefinition( const QgsPropertyDefinition &definition ) { mPropertyDefinition = definition; }
776
788 QString dynamicLayerParameterName() const { return mDynamicLayerParameterName; }
789
801 void setDynamicLayerParameterName( const QString &name ) { mDynamicLayerParameterName = name; }
802
816 QStringList additionalExpressionContextVariables() const { return mAdditionalExpressionVariables; }
817
835 void setAdditionalExpressionContextVariables( const QStringList &variables ) { mAdditionalExpressionVariables = variables; }
836
837#ifndef SIP_RUN
838
846 enum class ValueAsStringFlag : int
847 {
848 AllowMapLayerValues = 1 << 0,
849 };
850 Q_DECLARE_FLAGS( ValueAsStringFlags, ValueAsStringFlag )
851#endif
852
853 protected:
854
855#ifndef SIP_RUN
856
863 QString valueAsStringPrivate( const QVariant &value, QgsProcessingContext &context, bool &ok, ValueAsStringFlags flags ) const;
864
871 QVariant valueAsJsonObjectPrivate( const QVariant &value, QgsProcessingContext &context, ValueAsStringFlags flags ) const;
872#endif
873
880 QVariant defaultGuiValueFromSetting() const;
881
883 QString mName;
884
887
889 QString mHelp;
890
892 QVariant mDefault;
893
895 QVariant mGuiDefault;
896
898 Qgis::ProcessingParameterFlags mFlags;
899
901 QVariantMap mMetadata;
902
904 QgsProcessingAlgorithm *mAlgorithm = nullptr;
905
907 bool mIsDynamic = false;
908
911
914
917
918 // To allow access to mAlgorithm. We don't want a public setter for this!
920
921};
922
923#ifndef SIP_RUN
924Q_DECLARE_OPERATORS_FOR_FLAGS( QgsProcessingParameterDefinition::ValueAsStringFlags )
925#endif
926
928typedef QList< const QgsProcessingParameterDefinition * > QgsProcessingParameterDefinitions;
929
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, Qgis::WkbType 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, Qgis::WkbType 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, QgsProcessing::LayerOptionsFlags flags = QgsProcessing::LayerOptionsFlags() );
1268
1278 static QgsMapLayer *parameterAsLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context, QgsProcessingUtils::LayerHint layerHint = QgsProcessingUtils::LayerHint::UnknownType, QgsProcessing::LayerOptionsFlags flags = QgsProcessing::LayerOptionsFlags() );
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
1524 static QList< QgsMapLayer *> parameterAsLayerList( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessing::LayerOptionsFlags flags = QgsProcessing::LayerOptionsFlags() );
1525
1531 static QList< QgsMapLayer *> parameterAsLayerList( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context, QgsProcessing::LayerOptionsFlags flags = QgsProcessing::LayerOptionsFlags() );
1532
1538 static QStringList parameterAsFileList( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1539
1545 static QStringList parameterAsFileList( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1546
1550 static QList<double> parameterAsRange( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1551
1556 static QList<double> parameterAsRange( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1557
1563 Q_DECL_DEPRECATED static QStringList parameterAsFields( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context ) SIP_DEPRECATED;
1564
1571 Q_DECL_DEPRECATED static QStringList parameterAsFields( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context ) SIP_DEPRECATED;
1572
1578 static QStringList parameterAsStrings( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1579
1585 static QStringList parameterAsStrings( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1586
1595 static QgsPrintLayout *parameterAsLayout( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1596
1605 static QgsPrintLayout *parameterAsLayout( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1606
1615 static QgsLayoutItem *parameterAsLayoutItem( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context, QgsPrintLayout *layout );
1616
1625 static QgsLayoutItem *parameterAsLayoutItem( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context, QgsPrintLayout *layout );
1626
1632 static QColor parameterAsColor( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1633
1639 static QColor parameterAsColor( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1640
1646 static QString parameterAsConnectionName( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1647
1653 static QString parameterAsConnectionName( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1654
1660 static QString parameterAsSchema( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1661
1667 static QString parameterAsSchema( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1668
1674 static QString parameterAsDatabaseTableName( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1675
1681 static QString parameterAsDatabaseTableName( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1682
1693 static QgsPointCloudLayer *parameterAsPointCloudLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessing::LayerOptionsFlags flags = QgsProcessing::LayerOptionsFlags() );
1694
1705 static QgsPointCloudLayer *parameterAsPointCloudLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context, QgsProcessing::LayerOptionsFlags flags = QgsProcessing::LayerOptionsFlags() );
1706
1720 static QgsAnnotationLayer *parameterAsAnnotationLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1721
1735 static QgsAnnotationLayer *parameterAsAnnotationLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1736
1742 static QgsProcessingParameterDefinition *parameterFromVariantMap( const QVariantMap &map ) SIP_FACTORY;
1743
1747 static QString descriptionFromName( const QString &name );
1748
1754 static QgsProcessingParameterDefinition *parameterFromScriptCode( const QString &code ) SIP_FACTORY;
1755
1756 private:
1757
1758 static bool parseScriptCodeParameterOptions( const QString &code, bool &isOptional, QString &name, QString &type, QString &definition );
1759};
1760
1761
1762
1769{
1770 public:
1771
1775 QgsProcessingParameterBoolean( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
1776 bool optional = false );
1777
1781 static QString typeName() { return QStringLiteral( "boolean" ); }
1782 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1783 QString type() const override { return typeName(); }
1784 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1785 QString asScriptCode() const override;
1786
1790 static QgsProcessingParameterBoolean *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1791};
1792
1799{
1800 public:
1801
1805 QgsProcessingParameterCrs( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
1806 bool optional = false );
1807
1811 static QString typeName() { return QStringLiteral( "crs" ); }
1812 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1813 QString type() const override { return typeName(); }
1814 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
1815 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1816 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
1817 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
1818
1822 static QgsProcessingParameterCrs *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1823
1824};
1825
1832{
1833 public:
1834
1838 QgsProcessingParameterExtent( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
1839 bool optional = false );
1840
1844 static QString typeName() { return QStringLiteral( "extent" ); }
1845 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1846 QString type() const override { return typeName(); }
1847 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
1848 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1849 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
1850 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
1851
1855 static QgsProcessingParameterExtent *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1856
1857};
1858
1859
1866{
1867 public:
1868
1872 QgsProcessingParameterPoint( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
1873 bool optional = false );
1874
1878 static QString typeName() { return QStringLiteral( "point" ); }
1879 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1880 QString type() const override { return typeName(); }
1881 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
1882 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1883
1887 static QgsProcessingParameterPoint *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1888
1889};
1890
1898{
1899 public:
1900
1908 QgsProcessingParameterGeometry( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(), bool optional = false, const QList< int > &geometryTypes = QList< int >(), bool allowMultipart = true );
1909
1913 static QString typeName() { return QStringLiteral( "geometry" ); }
1914 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1915 QString type() const override { return typeName(); }
1916 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
1917 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1918 QString asScriptCode() const override;
1920 QVariantMap toVariantMap() const override;
1921 bool fromVariantMap( const QVariantMap &map ) override;
1922
1927 QList<int> geometryTypes() const { return mGeomTypes; }
1928
1933 void setGeometryTypes( const QList<int> &geometryTypes ) { mGeomTypes = geometryTypes; }
1934
1939 bool allowMultipart() const { return mAllowMultipart; }
1940
1945 void setAllowMultipart( bool allowMultipart ) { mAllowMultipart = allowMultipart; }
1946
1947
1948
1952 static QgsProcessingParameterGeometry *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1953
1954 private:
1955
1956 QList<int> mGeomTypes;
1957 bool mAllowMultipart;
1958
1959};
1960
1967{
1968 public:
1969
1977 QgsProcessingParameterFile( const QString &name, const QString &description = QString(), Qgis::ProcessingFileParameterBehavior behavior = Qgis::ProcessingFileParameterBehavior::File, const QString &extension = QString(), const QVariant &defaultValue = QVariant(),
1978 bool optional = false, const QString &fileFilter = QString() );
1979
1983 static QString typeName() { return QStringLiteral( "file" ); }
1984 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1985 QString type() const override { return typeName(); }
1986 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
1987 QString asScriptCode() const override;
1989 QString createFileFilter() const override;
1990
1996
2001 void setBehavior( Qgis::ProcessingFileParameterBehavior behavior ) { mBehavior = behavior; }
2002
2010 QString extension() const { return mExtension; }
2011
2021 void setExtension( const QString &extension );
2022
2029 QString fileFilter() const;
2030
2040 void setFileFilter( const QString &filter );
2041
2042 QVariantMap toVariantMap() const override;
2043 bool fromVariantMap( const QVariantMap &map ) override;
2044
2048 static QgsProcessingParameterFile *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition, Qgis::ProcessingFileParameterBehavior behavior = Qgis::ProcessingFileParameterBehavior::File ) SIP_FACTORY;
2049
2050 private:
2051
2053 QString mExtension;
2054 QString mFileFilter;
2055};
2056
2063{
2064 public:
2065
2069 QgsProcessingParameterMatrix( const QString &name, const QString &description = QString(), int numberRows = 3,
2070 bool hasFixedNumberRows = false, const QStringList &headers = QStringList(),
2071 const QVariant &defaultValue = QVariant(),
2072 bool optional = false );
2073
2077 static QString typeName() { return QStringLiteral( "matrix" ); }
2078 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2079 QString type() const override { return typeName(); }
2080 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2081 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2083
2088 QStringList headers() const;
2089
2094 void setHeaders( const QStringList &headers );
2095
2102 int numberRows() const;
2103
2110 void setNumberRows( int rows );
2111
2117 bool hasFixedNumberRows() const;
2118
2124 void setHasFixedNumberRows( bool hasFixedNumberRows );
2125
2126 QVariantMap toVariantMap() const override;
2127 bool fromVariantMap( const QVariantMap &map ) override;
2128
2132 static QgsProcessingParameterMatrix *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2133
2134 private:
2135
2136 QStringList mHeaders;
2137 int mNumberRows = 3;
2138 bool mFixedNumberRows = false;
2139
2140};
2141
2148{
2149 public:
2150
2154 QgsProcessingParameterMultipleLayers( const QString &name, const QString &description = QString(), Qgis::ProcessingSourceType layerType = Qgis::ProcessingSourceType::VectorAnyGeometry,
2155 const QVariant &defaultValue = QVariant(),
2156 bool optional = false );
2157
2161 static QString typeName() { return QStringLiteral( "multilayer" ); }
2162 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2163 QString type() const override { return typeName(); }
2164 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2165 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2166 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
2167 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
2168 QString asScriptCode() const override;
2170 QString createFileFilter() const override;
2171
2176 Qgis::ProcessingSourceType layerType() const;
2177
2182 void setLayerType( Qgis::ProcessingSourceType type );
2183
2189 int minimumNumberInputs() const;
2190
2196 void setMinimumNumberInputs( int minimum );
2197
2198 QVariantMap toVariantMap() const override;
2199 bool fromVariantMap( const QVariantMap &map ) override;
2200
2204 static QgsProcessingParameterMultipleLayers *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2205
2206 private:
2207
2209 int mMinimumNumberInputs = 0;
2210
2211};
2212
2231{
2232 public:
2233
2237 explicit QgsProcessingParameterNumber( const QString &name, const QString &description = QString(),
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;
2255
2260 double minimum() const;
2261
2266 void setMinimum( double minimum );
2267
2272 double maximum() const;
2273
2278 void setMaximum( double maximum );
2279
2284 Qgis::ProcessingNumberParameterType dataType() const;
2285
2290 void setDataType( Qgis::ProcessingNumberParameterType 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();
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::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const override;
2350
2355 QString parentParameterName() const;
2356
2361 void setParentParameterName( const QString &parentParameterName );
2362
2369 Qgis::DistanceUnit defaultUnit() const { return mDefaultUnit; }
2370
2377 void setDefaultUnit( Qgis::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::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const override;
2418
2424 Qgis::TemporalUnit defaultUnit() const { return mDefaultUnit; }
2425
2431 void setDefaultUnit( Qgis::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::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const override;
2472
2476 static QgsProcessingParameterScale *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2477
2478};
2479
2486{
2487 public:
2488
2492 QgsProcessingParameterRange( const QString &name, const QString &description = QString(),
2494 const QVariant &defaultValue = QVariant(),
2495 bool optional = false );
2496
2500 static QString typeName() { return QStringLiteral( "range" ); }
2501 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2502 QString type() const override { return typeName(); }
2503 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2504 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2506
2511 Qgis::ProcessingNumberParameterType dataType() const;
2512
2517 void setDataType( Qgis::ProcessingNumberParameterType dataType );
2518
2519 QVariantMap toVariantMap() const override;
2520 bool fromVariantMap( const QVariantMap &map ) override;
2521
2525 static QgsProcessingParameterRange *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2526
2527 private:
2528
2530};
2531
2538{
2539 public:
2540
2544 QgsProcessingParameterRasterLayer( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
2545 bool optional = false );
2546
2550 static QString typeName() { return QStringLiteral( "raster" ); }
2551 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2552 QString type() const override { return typeName(); }
2553 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2554 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2555 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
2556 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
2557 QString createFileFilter() const override;
2558
2562 static QgsProcessingParameterRasterLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2563
2564};
2565
2584{
2585 public:
2586
2590 QgsProcessingParameterEnum( const QString &name, const QString &description = QString(), const QStringList &options = QStringList(),
2591 bool allowMultiple = false,
2592 const QVariant &defaultValue = QVariant(),
2593 bool optional = false,
2594 bool usesStaticStrings = false );
2595
2599 static QString typeName() { return QStringLiteral( "enum" ); }
2600 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2601 QString type() const override { return typeName(); }
2602 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2603 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2604 QString valueAsPythonComment( const QVariant &value, QgsProcessingContext &context ) const override;
2605 QString asScriptCode() const override;
2607
2612 QStringList options() const;
2613
2618 void setOptions( const QStringList &options );
2619
2624 bool allowMultiple() const;
2625
2630 void setAllowMultiple( bool allowMultiple );
2631
2638 bool usesStaticStrings() const;
2639
2646 void setUsesStaticStrings( bool usesStaticStrings );
2647
2648 QVariantMap toVariantMap() const override;
2649 bool fromVariantMap( const QVariantMap &map ) override;
2650
2654 static QgsProcessingParameterEnum *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2655
2656 private:
2657
2658 QStringList mOptions;
2659 bool mAllowMultiple = false;
2660 bool mUsesStaticStrings = false;
2661};
2662
2690{
2691 public:
2692
2696 QgsProcessingParameterString( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
2697 bool multiLine = false,
2698 bool optional = false );
2699
2703 static QString typeName() { return QStringLiteral( "string" ); }
2704 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2705 QString type() const override { return typeName(); }
2706 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2707 QString asScriptCode() const override;
2709
2714 bool multiLine() const;
2715
2720 void setMultiLine( bool multiLine );
2721
2722 QVariantMap toVariantMap() const override;
2723 bool fromVariantMap( const QVariantMap &map ) override;
2724
2728 static QgsProcessingParameterString *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2729
2730 private:
2731
2732 bool mMultiLine = false;
2733
2734};
2735
2736
2750{
2751 public:
2752
2756 QgsProcessingParameterAuthConfig( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
2757 bool optional = false );
2758
2762 static QString typeName() { return QStringLiteral( "authcfg" ); }
2763 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2764 QString type() const override { return typeName(); }
2765 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2766 QString asScriptCode() const override;
2767
2771 static QgsProcessingParameterAuthConfig *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2772
2773};
2774
2781{
2782 public:
2783
2787 QgsProcessingParameterExpression( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
2788 const QString &parentLayerParameterName = QString(),
2789 bool optional = false, Qgis::ExpressionType type = Qgis::ExpressionType::Qgis );
2790
2794 static QString typeName() { return QStringLiteral( "expression" ); }
2795 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2796 QString type() const override { return typeName(); }
2797 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2798 QStringList dependsOnOtherParameters() const override;
2800
2805 QString parentLayerParameterName() const;
2806
2811 void setParentLayerParameterName( const QString &parentLayerParameterName );
2812
2819 Qgis::ExpressionType expressionType() const;
2820
2827 void setExpressionType( Qgis::ExpressionType type );
2828
2829 QVariantMap toVariantMap() const override;
2830 bool fromVariantMap( const QVariantMap &map ) override;
2831
2835 static QgsProcessingParameterExpression *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2836
2837 private:
2838
2839 QString mParentLayerParameterName;
2841};
2842
2843
2850{
2851 public:
2852
2856 QgsProcessingParameterLimitedDataTypes( const QList< int > &types = QList< int >() );
2857
2862 QList< int > dataTypes() const;
2863
2868 void setDataTypes( const QList< int > &types );
2869
2870 protected:
2871
2873 QList< int > mDataTypes;
2874};
2875
2883{
2884 public:
2885
2889 QgsProcessingParameterVectorLayer( const QString &name,
2890 const QString &description = QString(),
2891 const QList< int > &types = QList< int >(),
2892 const QVariant &defaultValue = QVariant(),
2893 bool optional = false );
2894
2898 static QString typeName() { return QStringLiteral( "vector" ); }
2899 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2900 QString type() const override { return typeName(); }
2901 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2902 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2903 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
2904 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
2906 QString createFileFilter() const override;
2907
2908 QVariantMap toVariantMap() const override;
2909 bool fromVariantMap( const QVariantMap &map ) override;
2910
2914 static QgsProcessingParameterVectorLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2915
2916};
2917
2925{
2926 public:
2927
2931 QgsProcessingParameterMeshLayer( const QString &name,
2932 const QString &description = QString(),
2933 const QVariant &defaultValue = QVariant(),
2934 bool optional = false );
2935
2939 static QString typeName() { return QStringLiteral( "mesh" ); }
2940 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2941 QString type() const override { return typeName(); }
2942 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2943 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2944 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
2945 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
2946 QString createFileFilter() const override;
2947
2951 static QgsProcessingParameterMeshLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2952};
2953
2960{
2961 public:
2962
2966 QgsProcessingParameterMapLayer( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
2967 bool optional = false,
2968 const QList< int > &types = QList< int >() );
2969
2973 static QString typeName() { return QStringLiteral( "layer" ); }
2974 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2975 QString type() const override { return typeName(); }
2976 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2977 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2978 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
2979 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
2980 QString asScriptCode() const override;
2982 QString createFileFilter() const override;
2983
2984 QVariantMap toVariantMap() const override;
2985 bool fromVariantMap( const QVariantMap &map ) override;
2986
2990 static QgsProcessingParameterMapLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2991
2992};
2993
3000{
3001 public:
3002
3006 QgsProcessingParameterField( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
3007 const QString &parentLayerParameterName = QString(),
3009 bool allowMultiple = false,
3010 bool optional = false,
3011 bool defaultToAllFields = false );
3012
3016 static QString typeName() { return QStringLiteral( "field" ); }
3017 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3018 QString type() const override { return typeName(); }
3019 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3020 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3021 QString asScriptCode() const override;
3023 QStringList dependsOnOtherParameters() const override;
3024
3029 QString parentLayerParameterName() const;
3030
3035 void setParentLayerParameterName( const QString &parentLayerParameterName );
3036
3042
3047 void setDataType( Qgis::ProcessingFieldParameterDataType type );
3048
3053 bool allowMultiple() const;
3054
3059 void setAllowMultiple( bool allowMultiple );
3060
3070 bool defaultToAllFields() const;
3071
3081 void setDefaultToAllFields( bool enabled );
3082
3083 QVariantMap toVariantMap() const override;
3084 bool fromVariantMap( const QVariantMap &map ) override;
3085
3089 static QgsProcessingParameterField *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3090
3091 private:
3092
3093 QString mParentLayerParameterName;
3095 bool mAllowMultiple = false;
3096 bool mDefaultToAllFields = false;
3097
3098};
3099
3100
3107{
3108 public:
3109
3113 QgsProcessingParameterFeatureSource( const QString &name, const QString &description = QString(),
3114 const QList< int > &types = QList< int >(),
3115 const QVariant &defaultValue = QVariant(), bool optional = false );
3116
3120 static QString typeName() { return QStringLiteral( "source" ); }
3121 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3122 QString type() const override { return typeName(); }
3123 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3124 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3125 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
3126 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
3127 QString asScriptCode() const override;
3129 QString createFileFilter() const override;
3130
3131 QVariantMap toVariantMap() const override;
3132 bool fromVariantMap( const QVariantMap &map ) override;
3133
3137 static QgsProcessingParameterFeatureSource *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3138
3139};
3140
3148{
3149 public:
3150
3157 QgsProcessingDestinationParameter( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
3158 bool optional = false, bool createByDefault = true );
3159
3160 bool isDestination() const override { return true; }
3161 QVariantMap toVariantMap() const override;
3162 bool fromVariantMap( const QVariantMap &map ) override;
3164 QString createFileFilter() const override;
3165
3171
3177 bool supportsNonFileBasedOutput() const { return mSupportsNonFileBasedOutputs; }
3178
3184 void setSupportsNonFileBasedOutput( bool supportsNonFileBasedOutput ) { mSupportsNonFileBasedOutputs = supportsNonFileBasedOutput; }
3185
3190 virtual QString defaultFileExtension() const = 0;
3191
3197 virtual QString generateTemporaryDestination( const QgsProcessingContext *context = nullptr ) const;
3198
3213 virtual bool isSupportedOutputValue( const QVariant &value, QgsProcessingContext &context, QString &error SIP_OUT ) const;
3214
3220 bool createByDefault() const;
3221
3227 void setCreateByDefault( bool createByDefault );
3228
3229 protected:
3230
3239 QgsProcessingProvider *originalProvider() const { return mOriginalProvider; }
3240
3241 private:
3242
3250 QgsProcessingProvider *mOriginalProvider = nullptr;
3251
3252 bool mSupportsNonFileBasedOutputs = true;
3253 bool mCreateByDefault = true;
3254
3255 friend class QgsProcessingModelAlgorithm;
3256 friend class TestQgsProcessing;
3257 friend class TestQgsProcessingModelAlgorithm;
3258};
3259
3260
3269{
3270 public:
3271
3278 QgsProcessingParameterFeatureSink( const QString &name, const QString &description = QString(), Qgis::ProcessingSourceType type = Qgis::ProcessingSourceType::VectorAnyGeometry, const QVariant &defaultValue = QVariant(),
3279 bool optional = false, bool createByDefault = true, bool supportsAppend = false );
3280
3284 static QString typeName() { return QStringLiteral( "sink" ); }
3285 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3286 QString type() const override { return typeName(); }
3287 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3288 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3289 QString asScriptCode() const override;
3290 QgsProcessingOutputDefinition *toOutputDefinition() const override SIP_FACTORY;
3291 QString defaultFileExtension() const override;
3292 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const override;
3293 QString createFileFilter() const override;
3294
3300 virtual QStringList supportedOutputVectorLayerExtensions() const;
3301
3306 Qgis::ProcessingSourceType dataType() const;
3307
3312 bool hasGeometry() const;
3313
3318 void setDataType( Qgis::ProcessingSourceType type );
3319
3328 bool supportsAppend() const;
3329
3338 void setSupportsAppend( bool supportsAppend );
3339
3340 QVariantMap toVariantMap() const override;
3341 bool fromVariantMap( const QVariantMap &map ) override;
3342 QString generateTemporaryDestination( const QgsProcessingContext *context = nullptr ) const override;
3343
3347 static QgsProcessingParameterFeatureSink *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3348
3349 private:
3350
3351 Qgis::ProcessingSourceType mDataType = Qgis::ProcessingSourceType::VectorAnyGeometry;
3352 bool mSupportsAppend = false;
3353};
3354
3355
3366{
3367 public:
3368
3375 QgsProcessingParameterVectorDestination( const QString &name, const QString &description = QString(), Qgis::ProcessingSourceType type = Qgis::ProcessingSourceType::VectorAnyGeometry, const QVariant &defaultValue = QVariant(),
3376 bool optional = false, bool createByDefault = true );
3377
3381 static QString typeName() { return QStringLiteral( "vectorDestination" ); }
3382 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3383 QString type() const override { return typeName(); }
3384 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3385 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3386 QString asScriptCode() const override;
3387 QgsProcessingOutputDefinition *toOutputDefinition() const override SIP_FACTORY;
3388 QString defaultFileExtension() const override;
3389 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const override;
3390 QString createFileFilter() const override;
3391
3397 virtual QStringList supportedOutputVectorLayerExtensions() const;
3398
3403 Qgis::ProcessingSourceType dataType() const;
3404
3409 bool hasGeometry() const;
3410
3415 void setDataType( Qgis::ProcessingSourceType type );
3416
3417 QVariantMap toVariantMap() const override;
3418 bool fromVariantMap( const QVariantMap &map ) override;
3419
3423 static QgsProcessingParameterVectorDestination *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3424
3425
3426 private:
3427
3428 Qgis::ProcessingSourceType mDataType = Qgis::ProcessingSourceType::VectorAnyGeometry;
3429};
3430
3438{
3439 public:
3440
3447 QgsProcessingParameterRasterDestination( const QString &name, const QString &description = QString(),
3448 const QVariant &defaultValue = QVariant(),
3449 bool optional = false,
3450 bool createByDefault = true );
3451
3455 static QString typeName() { return QStringLiteral( "rasterDestination" ); }
3456 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3457 QString type() const override { return typeName(); }
3458 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3459 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3460 QgsProcessingOutputDefinition *toOutputDefinition() const override SIP_FACTORY;
3461 QString defaultFileExtension() const override;
3462 QString createFileFilter() const override;
3463
3469 virtual QStringList supportedOutputRasterLayerExtensions() const;
3470
3474 static QgsProcessingParameterRasterDestination *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3475};
3476
3498{
3499 public:
3500
3507 QgsProcessingParameterFileDestination( const QString &name, const QString &description = QString(),
3508 const QString &fileFilter = QString(),
3509 const QVariant &defaultValue = QVariant(),
3510 bool optional = false,
3511 bool createByDefault = true );
3512
3516 static QString typeName() { return QStringLiteral( "fileDestination" ); }
3517 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3518 QString type() const override { return typeName(); }
3519 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3520 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3521 QgsProcessingOutputDefinition *toOutputDefinition() const override SIP_FACTORY;
3522 QString defaultFileExtension() const override;
3523 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const override;
3524 QString createFileFilter() const override;
3525
3530 QString fileFilter() const;
3531
3536 void setFileFilter( const QString &filter );
3537
3538 QVariantMap toVariantMap() const override;
3539 bool fromVariantMap( const QVariantMap &map ) override;
3540
3544 static QgsProcessingParameterFileDestination *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3545
3546
3547 private:
3548
3549 QString mFileFilter;
3550};
3551
3559{
3560 public:
3561
3565 QgsProcessingParameterFolderDestination( const QString &name, const QString &description = QString(),
3566 const QVariant &defaultValue = QVariant(),
3567 bool optional = false,
3568 bool createByDefault = true );
3569
3573 static QString typeName() { return QStringLiteral( "folderDestination" ); }
3574 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3575 QString type() const override { return typeName(); }
3576 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3577 QgsProcessingOutputDefinition *toOutputDefinition() const override SIP_FACTORY;
3578 QString defaultFileExtension() const override;
3579
3583 static QgsProcessingParameterFolderDestination *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3584
3585};
3586
3593{
3594 public:
3595
3599 QgsProcessingParameterBand( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
3600 const QString &parentLayerParameterName = QString(),
3601 bool optional = false,
3602 bool allowMultiple = false );
3603
3607 static QString typeName() { return QStringLiteral( "band" ); }
3608 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3609 QString type() const override { return typeName(); }
3610 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3611 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3612 QString asScriptCode() const override;
3613 QStringList dependsOnOtherParameters() const override;
3615
3620 QString parentLayerParameterName() const;
3621
3626 void setParentLayerParameterName( const QString &parentLayerParameterName );
3627
3628 QVariantMap toVariantMap() const override;
3629 bool fromVariantMap( const QVariantMap &map ) override;
3630
3634 static QgsProcessingParameterBand *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3635
3641 bool allowMultiple() const;
3642
3648 void setAllowMultiple( bool allowMultiple );
3649
3650 private:
3651
3652 QString mParentLayerParameterName;
3653 bool mAllowMultiple = false;
3654};
3655
3668{
3669 public:
3670
3674 QgsProcessingParameterLayout( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
3675 bool optional = false );
3676
3680 static QString typeName() { return QStringLiteral( "layout" ); }
3681 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3682 QString type() const override { return typeName(); }
3683 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3684 QString asScriptCode() const override;
3686
3690 static QgsProcessingParameterLayout *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3691
3692};
3693
3706{
3707 public:
3708
3712 QgsProcessingParameterLayoutItem( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
3713 const QString &parentLayoutParameterName = QString(),
3714 int itemType = -1,
3715 bool optional = false );
3716
3720 static QString typeName() { return QStringLiteral( "layoutitem" ); }
3721 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3722 QString type() const override { return typeName(); }
3723 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3724 QString asScriptCode() const override;
3726 QVariantMap toVariantMap() const override;
3727 bool fromVariantMap( const QVariantMap &map ) override;
3728 QStringList dependsOnOtherParameters() const override;
3729
3733 static QgsProcessingParameterLayoutItem *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3734
3739 QString parentLayoutParameterName() const;
3740
3745 void setParentLayoutParameterName( const QString &name );
3746
3754 int itemType() const;
3755
3763 void setItemType( int type );
3764
3765 private:
3766 QString mParentLayoutParameterName;
3767 int mItemType = -1;
3768};
3769
3780{
3781 public:
3782
3788 QgsProcessingParameterColor( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
3789 bool opacityEnabled = true,
3790 bool optional = false );
3791
3795 static QString typeName() { return QStringLiteral( "color" ); }
3796 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3797 QString type() const override { return typeName(); }
3798 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3799 QString asScriptCode() const override;
3801 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3802 QVariantMap toVariantMap() const override;
3803 bool fromVariantMap( const QVariantMap &map ) override;
3804
3811 bool opacityEnabled() const;
3812
3820 void setOpacityEnabled( bool enabled );
3821
3825 static QgsProcessingParameterColor *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3826
3827 private:
3828
3829 bool mAllowOpacity = true;
3830
3831};
3832
3833
3844{
3845 public:
3846
3850 QgsProcessingParameterCoordinateOperation( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
3851 const QString &sourceCrsParameterName = QString(), const QString &destinationCrsParameterName = QString(),
3852 const QVariant &staticSourceCrs = QVariant(), const QVariant &staticDestinationCrs = QVariant(),
3853 bool optional = false );
3854
3858 static QString typeName() { return QStringLiteral( "coordinateoperation" ); }
3859 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3860 QString type() const override { return typeName(); }
3861 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3862 QString asScriptCode() const override;
3864 QStringList dependsOnOtherParameters() const override;
3865
3866 QVariantMap toVariantMap() const override;
3867 bool fromVariantMap( const QVariantMap &map ) override;
3868
3872 static QgsProcessingParameterCoordinateOperation *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3873
3879 QString sourceCrsParameterName() const { return mSourceParameterName; }
3880
3886 void setSourceCrsParameterName( const QString &name ) { mSourceParameterName = name; }
3887
3893 QString destinationCrsParameterName() const { return mDestParameterName; }
3894
3900 void setDestinationCrsParameterName( const QString &name ) { mDestParameterName = name; }
3901
3907 QVariant sourceCrs() const { return mSourceCrs; }
3908
3914 void setSourceCrs( const QVariant &crs ) { mSourceCrs = crs; }
3915
3921 QVariant destinationCrs() const { return mDestCrs; }
3922
3928 void setDestinationCrs( const QVariant &crs ) { mDestCrs = crs; }
3929
3930 private:
3931
3932 QString mSourceParameterName;
3933 QString mDestParameterName;
3934 QVariant mSourceCrs;
3935 QVariant mDestCrs;
3936
3937};
3938
3939
3950{
3951 public:
3952
3956 QgsProcessingParameterMapTheme( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
3957 bool optional = false );
3958
3962 static QString typeName() { return QStringLiteral( "maptheme" ); }
3963 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3964 QString type() const override { return typeName(); }
3965 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3966 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3967 QString asScriptCode() const override;
3969 QVariantMap toVariantMap() const override;
3970 bool fromVariantMap( const QVariantMap &map ) override;
3971
3975 static QgsProcessingParameterMapTheme *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3976
3977 private:
3978
3979};
3980
3981
3993{
3994 public:
3995
3999 explicit QgsProcessingParameterDateTime( const QString &name, const QString &description = QString(),
4001 const QVariant &defaultValue = QVariant(),
4002 bool optional = false,
4003 const QDateTime &minValue = QDateTime(),
4004 const QDateTime &maxValue = QDateTime()
4005 );
4006
4010 static QString typeName() { return QStringLiteral( "datetime" ); }
4011 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4012 QString type() const override { return typeName(); }
4013 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4014 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4015 QString toolTip() const override;
4017
4025 QDateTime minimum() const;
4026
4038 void setMinimum( const QDateTime &minimum );
4039
4047 QDateTime maximum() const;
4048
4060 void setMaximum( const QDateTime &maximum );
4061
4067
4072 void setDataType( Qgis::ProcessingDateTimeParameterDataType type );
4073
4074 QVariantMap toVariantMap() const override;
4075 bool fromVariantMap( const QVariantMap &map ) override;
4076
4080 static QgsProcessingParameterDateTime *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4081
4082 private:
4083
4084 QDateTime mMin;
4085 QDateTime mMax;
4087};
4088
4089
4101{
4102 public:
4103
4110 QgsProcessingParameterProviderConnection( const QString &name, const QString &description, const QString &provider, const QVariant &defaultValue = QVariant(),
4111 bool optional = false );
4112
4116 static QString typeName() { return QStringLiteral( "providerconnection" ); }
4117 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4118 QString type() const override { return typeName(); }
4119 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4120 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4121 QString asScriptCode() const override;
4123 QVariantMap toVariantMap() const override;
4124 bool fromVariantMap( const QVariantMap &map ) override;
4125
4130 QString providerId() const { return mProviderId; }
4131
4136 void setProviderId( const QString &provider ) { mProviderId = provider; }
4137
4141 static QgsProcessingParameterProviderConnection *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4142
4143 private:
4144
4145 QString mProviderId;
4146};
4147
4148
4160{
4161 public:
4162
4171 QgsProcessingParameterDatabaseSchema( const QString &name, const QString &description, const QString &connectionParameterName = QString(), const QVariant &defaultValue = QVariant(),
4172 bool optional = false );
4173
4177 static QString typeName() { return QStringLiteral( "databaseschema" ); }
4178 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4179 QString type() const override { return typeName(); }
4180 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4181 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4182 QString asScriptCode() const override;
4184 QVariantMap toVariantMap() const override;
4185 bool fromVariantMap( const QVariantMap &map ) override;
4186 QStringList dependsOnOtherParameters() const override;
4187
4192 QString parentConnectionParameterName() const;
4193
4198 void setParentConnectionParameterName( const QString &name );
4199
4203 static QgsProcessingParameterDatabaseSchema *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4204
4205 private:
4206
4207 QString mParentConnectionParameterName;
4208};
4209
4210
4222{
4223 public:
4224
4234 QgsProcessingParameterDatabaseTable( const QString &name, const QString &description,
4235 const QString &connectionParameterName = QString(),
4236 const QString &schemaParameterName = QString(),
4237 const QVariant &defaultValue = QVariant(),
4238 bool optional = false,
4239 bool allowNewTableNames = false );
4240
4244 static QString typeName() { return QStringLiteral( "databasetable" ); }
4245 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4246 QString type() const override { return typeName(); }
4247 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4248 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4249 QString asScriptCode() const override;
4251 QVariantMap toVariantMap() const override;
4252 bool fromVariantMap( const QVariantMap &map ) override;
4253 QStringList dependsOnOtherParameters() const override;
4254
4259 QString parentConnectionParameterName() const;
4260
4265 void setParentConnectionParameterName( const QString &name );
4266
4271 QString parentSchemaParameterName() const;
4272
4277 void setParentSchemaParameterName( const QString &name );
4278
4282 static QgsProcessingParameterDatabaseTable *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4283
4290 bool allowNewTableNames() const;
4291
4298 void setAllowNewTableNames( bool allowed );
4299
4300 private:
4301
4302 QString mParentConnectionParameterName;
4303 QString mParentSchemaParameterName;
4304 bool mAllowNewTableNames = false;
4305};
4306
4307
4315{
4316 public:
4317
4321 QgsProcessingParameterPointCloudLayer( const QString &name, const QString &description = QString(),
4322 const QVariant &defaultValue = QVariant(), bool optional = false );
4323
4327 static QString typeName() { return QStringLiteral( "pointcloud" ); }
4328 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4329 QString type() const override { return typeName(); }
4330 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4331 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4332 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
4333 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
4334 QString createFileFilter() const override;
4335
4339 static QgsProcessingParameterPointCloudLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4340};
4341
4342
4350{
4351 public:
4352
4356 QgsProcessingParameterAnnotationLayer( const QString &name, const QString &description = QString(),
4357 const QVariant &defaultValue = QVariant(), bool optional = false );
4358
4362 static QString typeName() { return QStringLiteral( "annotation" ); }
4363 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4364 QString type() const override { return typeName(); }
4365 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4366 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4367 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
4368 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
4369
4373 static QgsProcessingParameterAnnotationLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4374};
4375
4384{
4385 public:
4386
4393 QgsProcessingParameterPointCloudDestination( const QString &name, const QString &description = QString(),
4394 const QVariant &defaultValue = QVariant(),
4395 bool optional = false,
4396 bool createByDefault = true );
4397
4401 static QString typeName() { return QStringLiteral( "pointCloudDestination" ); }
4402 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4403 QString type() const override { return typeName(); }
4404 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4405 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4406 QgsProcessingOutputDefinition *toOutputDefinition() const override SIP_FACTORY;
4407 QString defaultFileExtension() const override;
4408 QString createFileFilter() const override;
4409
4414 virtual QStringList supportedOutputPointCloudLayerExtensions() const;
4415
4419 static QgsProcessingParameterPointCloudDestination *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4420};
4421
4429{
4430 public:
4431
4435 QgsProcessingParameterPointCloudAttribute( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
4436 const QString &parentLayerParameterName = QString(),
4437 bool allowMultiple = false,
4438 bool optional = false,
4439 bool defaultToAllAttributes = false );
4440
4444 static QString typeName() { return QStringLiteral( "attribute" ); }
4445 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4446 QString type() const override { return typeName(); }
4447 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4448 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4449 QString asScriptCode() const override;
4451 QStringList dependsOnOtherParameters() const override;
4452
4457 QString parentLayerParameterName() const;
4458
4463 void setParentLayerParameterName( const QString &parentLayerParameterName );
4464
4469 bool allowMultiple() const;
4470
4475 void setAllowMultiple( bool allowMultiple );
4476
4485 bool defaultToAllAttributes() const;
4486
4495 void setDefaultToAllAttributes( bool enabled );
4496
4497 QVariantMap toVariantMap() const override;
4498 bool fromVariantMap( const QVariantMap &map ) override;
4499
4503 static QgsProcessingParameterPointCloudAttribute *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4504
4505 private:
4506
4507 QString mParentLayerParameterName;
4508 bool mAllowMultiple = false;
4509 bool mDefaultToAllAttributes = false;
4510};
4511
4520{
4521 public:
4522
4529 QgsProcessingParameterVectorTileDestination( const QString &name, const QString &description = QString(),
4530 const QVariant &defaultValue = QVariant(),
4531 bool optional = false,
4532 bool createByDefault = true );
4533
4537 static QString typeName() { return QStringLiteral( "vectorTileDestination" ); }
4538 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4539 QString type() const override { return typeName(); }
4540 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4541 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4542 QgsProcessingOutputDefinition *toOutputDefinition() const override SIP_FACTORY;
4543 QString defaultFileExtension() const override;
4544 QString createFileFilter() const override;
4545
4550 virtual QStringList supportedOutputVectorTileLayerExtensions() const;
4551
4555 static QgsProcessingParameterVectorTileDestination *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4556};
4557
4558// clazy:excludeall=qstring-allocations
4559
4560#endif // QGSPROCESSINGPARAMETERS_H
4561
4562
The Qgis class provides global constants for use throughout the application.
Definition qgis.h:54
ProcessingSourceType
Processing data source types.
Definition qgis.h:2836
@ VectorAnyGeometry
Any vector layer with geometry.
ProcessingFileParameterBehavior
Flags which dictate the behavior of QgsProcessingParameterFile.
Definition qgis.h:3055
@ File
Parameter is a single file.
ExpressionType
Expression types.
Definition qgis.h:4400
@ Qgis
Native QGIS expression.
DistanceUnit
Units of distance.
Definition qgis.h:4062
@ Unknown
Unknown distance unit.
ProcessingFieldParameterDataType
Processing field parameter data types.
Definition qgis.h:3083
TemporalUnit
Temporal units.
Definition qgis.h:4169
@ Milliseconds
Milliseconds.
InvalidGeometryCheck
Methods for handling of features with invalid geometries.
Definition qgis.h:1759
@ AbortOnInvalid
Close iterator on encountering any features with invalid geometry. This requires a slow geometry vali...
WkbType
The WKB type describes the number of dimensions a geometry has.
Definition qgis.h:182
ProcessingDateTimeParameterDataType
Processing date time parameter data types.
Definition qgis.h:3101
ProcessingNumberParameterType
Processing numeric parameter data types.
Definition qgis.h:3069
Represents a map layer containing a set of georeferenced annotations, e.g.
This class represents a coordinate reference system (CRS).
An interface for objects which accept features via addFeature(s) methods.
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.
Base class for graphical items within a QgsLayout.
Base class for all map layer types.
Definition qgsmaplayer.h:75
Represents a mesh layer supporting display of data on structured or unstructured meshes.
Represents a map layer supporting display of point clouds.
A class to represent a 2D point.
Definition qgspointxy.h:60
Print layout, a QgsLayout subclass for static or atlas-based layouts.
Abstract base class for processing algorithms.
Contains information about the context in which a processing algorithm is executed.
Base class for all parameter definitions which represent file or layer destinations,...
virtual QString defaultFileExtension() const =0
Returns the default file extension for destination file paths associated with this parameter.
bool supportsNonFileBasedOutput() const
Returns true if the destination parameter supports non filed-based outputs, such as memory layers or ...
bool isDestination() const override
Returns true if this parameter represents a file or layer destination, e.g.
virtual QgsProcessingOutputDefinition * toOutputDefinition() const =0
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
QgsProcessingProvider * originalProvider() const
Original (source) provider which this parameter has been derived from.
void setSupportsNonFileBasedOutput(bool supportsNonFileBasedOutput)
Sets whether the destination parameter supports non filed-based outputs, such as memory layers or dir...
Custom exception class for processing related exceptions.
Encapsulates settings relating to a feature source input to a processing algorithm.
bool operator!=(const QgsProcessingFeatureSourceDefinition &other) const
bool selectedFeaturesOnly
true if only selected features in the source should be used by algorithms.
bool operator==(const QgsProcessingFeatureSourceDefinition &other) const
Qgis::InvalidGeometryCheck geometryCheck
Geometry check method to apply to this source.
QgsProcessingFeatureSourceDefinition(const QgsProperty &source, bool selectedFeaturesOnly=false, long long featureLimit=-1, Qgis::ProcessingFeatureSourceDefinitionFlags flags=Qgis::ProcessingFeatureSourceDefinitionFlags(), Qgis::InvalidGeometryCheck geometryCheck=Qgis::InvalidGeometryCheck::AbortOnInvalid, const QString &filterExpression=QString())
Constructor for QgsProcessingFeatureSourceDefinition, accepting a QgsProperty source.
QgsProcessingFeatureSourceDefinition(const QString &source=QString(), bool selectedFeaturesOnly=false, long long featureLimit=-1, Qgis::ProcessingFeatureSourceDefinitionFlags flags=Qgis::ProcessingFeatureSourceDefinitionFlags(), Qgis::InvalidGeometryCheck geometryCheck=Qgis::InvalidGeometryCheck::AbortOnInvalid, const QString &filterExpression=QString())
Constructor for QgsProcessingFeatureSourceDefinition, accepting a static string source.
Qgis::ProcessingFeatureSourceDefinitionFlags flags
Flags which dictate source behavior.
long long featureLimit
If set to a value > 0, places a limit on the maximum number of features which will be read from the s...
QString filterExpression
Optional expression filter to use for filtering features which will be read from the source.
QgsFeatureSource subclass which proxies methods to an underlying QgsFeatureSource,...
Base class for providing feedback from a processing algorithm.
Base class for the definition of processing outputs.
Encapsulates settings relating to a feature sink or output raster layer for a processing algorithm.
QgsProcessingOutputLayerDefinition(const QgsProperty &sink, QgsProject *destinationProject=nullptr)
Constructor for QgsProcessingOutputLayerDefinition, accepting a QgsProperty sink/layer.
QgsProperty sink
Sink/layer definition.
bool useRemapping() const
Returns true if the output uses a remapping definition.
QgsProcessingOutputLayerDefinition(const QString &sink=QString(), QgsProject *destinationProject=nullptr)
Constructor for QgsProcessingOutputLayerDefinition, accepting a static sink/layer string.
QgsRemappingSinkDefinition remappingDefinition() const
Returns the output remapping definition, if useRemapping() is true.
QString destinationName
Name to use for sink if it's to be loaded into a destination project.
QVariantMap createOptions
Map of optional sink/layer creation options, which are passed to the underlying provider when creatin...
An annotation layer parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A string parameter for authentication configuration ID values.
static QString typeName()
Returns the type name for the parameter class.
A raster band parameter for Processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A boolean parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A color parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A coordinate operation parameter for processing algorithms, for selection between available coordinat...
static QString typeName()
Returns the type name for the parameter class.
QVariant sourceCrs() const
Returns the static source CRS, or an invalid value if this is not set.
QString destinationCrsParameterName() const
Returns the name of the destination CRS parameter, or an empty string if this is not set.
void setDestinationCrsParameterName(const QString &name)
Sets the name of the destination CRS parameter.
void setSourceCrs(const QVariant &crs)
Sets the static source crs.
QVariant destinationCrs() const
Returns the static destination CRS, or an invalid value if this is not set.
void setDestinationCrs(const QVariant &crs)
Sets the static destination crs.
void setSourceCrsParameterName(const QString &name)
Sets the name of the source CRS parameter.
QString sourceCrsParameterName() const
Returns the name of the source CRS parameter, or an empty string if this is not set.
A coordinate reference system parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A database schema parameter for processing algorithms, allowing users to select from existing schemas...
static QString typeName()
Returns the type name for the parameter class.
A database table name parameter for processing algorithms, allowing users to select from existing dat...
static QString typeName()
Returns the type name for the parameter class.
A datetime (or pure date or time) parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
Base class for the definition of processing parameters.
QVariant defaultValue() const
Returns the default value for the parameter.
void setDefaultValue(const QVariant &value)
Sets the default value for the parameter.
QStringList additionalExpressionContextVariables() const
Returns a list of additional expression context variables which are available for use when evaluating...
QStringList mAdditionalExpressionVariables
Additional expression context variables exposed for use by this parameter.
QString help() const
Returns the help for the parameter.
Qgis::ProcessingParameterFlags mFlags
Parameter flags.
void setMetadata(const QVariantMap &metadata)
Sets the parameter's freeform metadata.
void setFlags(Qgis::ProcessingParameterFlags flags)
Sets the flags associated with the parameter.
ValueAsStringFlag
Flags for passing to the valueAsStringPrivate() method.
void setGuiDefaultValueOverride(const QVariant &value)
Sets the default value to use for the parameter in GUI widgets.
QVariantMap metadata() const
Returns the parameter's freeform metadata.
QString description() const
Returns the description for the parameter.
QString mDynamicLayerParameterName
Linked vector layer parameter name for dynamic properties.
virtual bool isDestination() const
Returns true if this parameter represents a file or layer destination, e.g.
void setDescription(const QString &description)
Sets the description for the parameter.
void setDynamicLayerParameterName(const QString &name)
Sets the name for the parameter for a layer linked to a dynamic parameter, or an empty string if this...
QString dynamicLayerParameterName() const
Returns the name of the parameter for a layer linked to a dynamic parameter, or an empty string if th...
void setAdditionalExpressionContextVariables(const QStringList &variables)
Sets a list of additional expression context variables which are available for use when evaluating th...
QVariantMap mMetadata
Freeform metadata for parameter. Mostly used by widget wrappers to customize their appearance and beh...
void setName(const QString &name)
Sets the name of the parameter.
QString mDescription
Parameter description.
virtual QgsProcessingParameterDefinition * clone() const =0
Creates a clone of the parameter definition.
virtual QString type() const =0
Unique parameter type name.
void setDynamicPropertyDefinition(const QgsPropertyDefinition &definition)
Sets the property definition for dynamic properties.
void setHelp(const QString &help)
Sets the help for the parameter.
QString name() const
Returns the name of the parameter.
QVariant mDefault
Default value for parameter.
virtual QStringList dependsOnOtherParameters() const
Returns a list of other parameter names on which this parameter is dependent (e.g.
void setIsDynamic(bool dynamic)
Sets whether the parameter is dynamic, and can support data-defined values (i.e.
Qgis::ProcessingParameterFlags flags() const
Returns any flags associated with the parameter.
QVariant mGuiDefault
Default value for parameter in GUI.
QgsPropertyDefinition mPropertyDefinition
Data defined property definition.
bool isDynamic() const
Returns true if the parameter supports is dynamic, and can support data-defined values (i....
virtual ~QgsProcessingParameterDefinition()=default
QVariantMap & metadata()
Returns the parameter's freeform metadata.
QgsPropertyDefinition dynamicPropertyDefinition() const
Returns the property definition for dynamic properties.
A double numeric parameter for distance values.
static QString typeName()
Returns the type name for the parameter class.
void setDefaultUnit(Qgis::DistanceUnit unit)
Sets the default distance unit for the parameter.
A double numeric parameter for duration values.
void setDefaultUnit(Qgis::TemporalUnit unit)
Sets the default duration unit for the parameter.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
An enum based parameter for processing algorithms, allowing for selection from predefined values.
static QString typeName()
Returns the type name for the parameter class.
An expression parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A rectangular map extent parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A feature sink output for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
An input feature source (such as vector layers) parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
A vector layer or feature source field parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A generic file based destination parameter, for specifying the destination path for a file (non-map l...
static QString typeName()
Returns the type name for the parameter class.
An input file or folder parameter for processing algorithms.
QString extension() const
Returns any specified file extension for the parameter.
static QString typeName()
Returns the type name for the parameter class.
void setBehavior(Qgis::ProcessingFileParameterBehavior behavior)
Sets the parameter behavior (e.g.
Qgis::ProcessingFileParameterBehavior behavior() const
Returns the parameter behavior (e.g.
A folder destination parameter, for specifying the destination path for a folder created by the algor...
static QString typeName()
Returns the type name for the parameter class.
A geometry parameter for processing algorithms.
void setGeometryTypes(const QList< int > &geometryTypes)
Sets the allowed geometryTypes, as a list of Qgis::GeometryType values.
bool allowMultipart() const
Returns the parameter allow multipart geometries.
QList< int > geometryTypes() const
Returns the parameter allowed geometries, as a list of Qgis::GeometryType values.
void setAllowMultipart(bool allowMultipart)
Sets the allow multipart geometries.
static QString typeName()
Returns the type name for the parameter class.
A print layout item parameter, allowing users to select a particular item from a print layout.
static QString typeName()
Returns the type name for the parameter class.
A print layout parameter, allowing users to select a print layout.
static QString typeName()
Returns the type name for the parameter class.
Can be inherited by parameters which require limits to their acceptable data types.
QList< int > mDataTypes
List of acceptable data types for the parameter.
A map layer parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A map theme parameter for processing algorithms, allowing users to select an existing map theme from ...
static QString typeName()
Returns the type name for the parameter class.
A table (matrix) parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
A mesh layer parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A parameter for processing algorithms which accepts multiple map layers.
static QString typeName()
Returns the type name for the parameter class.
A numeric parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A point cloud layer attribute parameter for Processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A point cloud layer destination parameter, for specifying the destination path for a point cloud laye...
static QString typeName()
Returns the type name for the parameter class.
A point cloud layer parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A point parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A data provider connection parameter for processing algorithms, allowing users to select from availab...
static QString typeName()
Returns the type name for the parameter class.
void setProviderId(const QString &provider)
Sets the ID of the provider associated with the connections.
QString providerId() const
Returns the ID of the provider associated with the connections.
A numeric range parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A raster layer destination parameter, for specifying the destination path for a raster layer created ...
static QString typeName()
Returns the type name for the parameter class.
A raster layer parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A double numeric parameter for map scale values.
static QString typeName()
Returns the type name for the parameter class.
A string parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
A vector layer destination parameter, for specifying the destination path for a vector layer created ...
static QString typeName()
Returns the type name for the parameter class.
A vector layer (with or without geometry) parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A vector tile layer destination parameter, for specifying the destination path for a vector tile laye...
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
A 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.
PythonOutputType
Available Python output types.
@ PythonQgsProcessingAlgorithmSubclass
Full Python QgsProcessingAlgorithm subclass.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition qgsproject.h:107
Definition for a property.
Definition qgsproperty.h:45
A store for object properties.
Represents a raster layer.
A rectangle specified with double values.
Defines the parameters used to remap features when creating a QgsRemappingProxyFeatureSink.
Represents a vector layer which manages a vector based data sets.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into allowing algorithms to be written in pure substantial changes are required in order to port existing x Processing algorithms for QGIS x The most significant changes are outlined not GeoAlgorithm For algorithms which operate on features one by consider subclassing the QgsProcessingFeatureBasedAlgorithm class This class allows much of the boilerplate code for looping over features from a vector layer to be bypassed and instead requires implementation of a processFeature method Ensure that your algorithm(or algorithm 's parent class) implements the new pure virtual createInstance(self) call
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition qgis_sip.h:191
#define SIP_DEPRECATED
Definition qgis_sip.h:106
#define SIP_SKIP
Definition qgis_sip.h:126
#define SIP_OUT
Definition qgis_sip.h:58
#define SIP_FACTORY
Definition qgis_sip.h:76
#define SIP_THROW(name,...)
Definition qgis_sip.h:203
#define SIP_END
Definition qgis_sip.h:208
Q_DECLARE_METATYPE(QgsDatabaseQueryLogEntry)
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
QList< const QgsProcessingParameterDefinition * > QgsProcessingParameterDefinitions
List of processing parameters.
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsTextRendererUtils::CurvedTextFlags)
const QgsCoordinateReferenceSystem & crs
const QString & typeName