QGIS API Documentation 3.27.0-Master (f261cc1f8b)
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 "qgsfeaturesource.h"
27#include "qgsprocessingutils.h"
30#include <QMap>
31#include <limits>
32
35class QgsRasterLayer;
36class QgsMeshLayer;
37class QgsVectorLayer;
38class QgsFeatureSink;
43class QgsPrintLayout;
44class QgsLayoutItem;
47
58{
59 public:
60
65 enum Flag
66 {
67 FlagOverrideDefaultGeometryCheck = 1 << 0,
68 FlagCreateIndividualOutputPerInputFeature = 1 << 1,
69 };
70 Q_DECLARE_FLAGS( Flags, Flag )
71
72
85 QgsProcessingFeatureSourceDefinition( const QString &source = QString(), bool selectedFeaturesOnly = false, long long featureLimit = -1,
86 QgsProcessingFeatureSourceDefinition::Flags flags = QgsProcessingFeatureSourceDefinition::Flags(), QgsFeatureRequest::InvalidGeometryCheck geometryCheck = QgsFeatureRequest::GeometryAbortOnInvalid )
87 : source( QgsProperty::fromValue( source ) )
88 , selectedFeaturesOnly( selectedFeaturesOnly )
89 , featureLimit( featureLimit )
90 , flags( flags )
91 , geometryCheck( geometryCheck )
92 {}
93
107 QgsProcessingFeatureSourceDefinition( const QgsProperty &source, bool selectedFeaturesOnly = false, long long featureLimit = -1,
108 QgsProcessingFeatureSourceDefinition::Flags flags = QgsProcessingFeatureSourceDefinition::Flags(), QgsFeatureRequest::InvalidGeometryCheck geometryCheck = QgsFeatureRequest::GeometryAbortOnInvalid )
109 : source( source )
110 , selectedFeaturesOnly( selectedFeaturesOnly )
111 , featureLimit( featureLimit )
112 , flags( flags )
113 , geometryCheck( geometryCheck )
114 {}
115
120
125
132 long long featureLimit = -1;
133
139 Flags flags = Flags();
140
150
157 QVariant toVariant() const;
158
165 bool loadVariant( const QVariantMap &map );
166
167 // TODO c++20 - replace with = default
169 {
170 return source == other.source
171 && selectedFeaturesOnly == other.selectedFeaturesOnly
172 && featureLimit == other.featureLimit
173 && flags == other.flags
174 && geometryCheck == other.geometryCheck;
175 }
176
178 {
179 return !( *this == other );
180 }
181
183 operator QVariant() const
184 {
185 return QVariant::fromValue( *this );
186 }
187
188};
189
191Q_DECLARE_OPERATORS_FOR_FLAGS( QgsProcessingFeatureSourceDefinition::Flags )
192
193
203{
204 public:
205
211 QgsProcessingOutputLayerDefinition( const QString &sink = QString(), QgsProject *destinationProject = nullptr )
212 : sink( QgsProperty::fromValue( sink ) )
213 , destinationProject( destinationProject )
214 {}
215
221 QgsProcessingOutputLayerDefinition( const QgsProperty &sink, QgsProject *destinationProject = nullptr )
222 : sink( sink )
223 , destinationProject( destinationProject )
224 {}
225
230
236 QgsProject *destinationProject = nullptr;
237
242
249 QVariantMap createOptions;
250
257 bool useRemapping() const { return mUseRemapping; }
258
266 QgsRemappingSinkDefinition remappingDefinition() const { return mRemappingDefinition; }
267
278 void setRemappingDefinition( const QgsRemappingSinkDefinition &definition );
279
286 QVariant toVariant() const;
287
294 bool loadVariant( const QVariantMap &map );
295
297 operator QVariant() const
298 {
299 return QVariant::fromValue( *this );
300 }
301
302 // TODO c++20 - replace with = default
303 bool operator==( const QgsProcessingOutputLayerDefinition &other ) const;
304 bool operator!=( const QgsProcessingOutputLayerDefinition &other ) const;
305
306 private:
307
308 bool mUseRemapping = false;
309 QgsRemappingSinkDefinition mRemappingDefinition;
310
311};
312
314
315
316
317
318//
319// Parameter definitions
320//
321
322
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
442 sipType = nullptr;
443 SIP_END
444#endif
445
446 public:
447
449 enum Flag
450 {
451 FlagAdvanced = 1 << 1,
452 FlagHidden = 1 << 2,
453 FlagOptional = 1 << 3,
454 FlagIsModelOutput = 1 << 4,
455 };
456 Q_DECLARE_FLAGS( Flags, Flag )
457
458
461 QgsProcessingParameterDefinition( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
462 bool optional = false, const QString &help = QString() );
463
465
470
474 virtual QString type() const = 0;
475
481 virtual bool isDestination() const { return false; }
482
488 QString name() const { return mName; }
489
495 void setName( const QString &name ) { mName = name; }
496
502 QString description() const { return mDescription; }
503
509 void setDescription( const QString &description ) { mDescription = description; }
510
520 QString help() const { return mHelp; }
521
531 void setHelp( const QString &help ) { mHelp = help; }
532
539 QVariant defaultValue() const { return mDefault; }
540
547 void setDefaultValue( const QVariant &value ) { mDefault = value; }
548
561 QVariant guiDefaultValueOverride() const { return mGuiDefault; }
562
578 void setGuiDefaultValueOverride( const QVariant &value ) { mGuiDefault = value; }
579
588 QVariant defaultValueForGui() const { return mGuiDefault.isValid() ? mGuiDefault : mDefault; }
589
594 Flags flags() const { return mFlags; }
595
600 void setFlags( Flags flags ) { mFlags = flags; }
601
609 virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const;
610
618 virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
619
631 virtual QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const;
632
646 virtual QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const;
647
661 virtual QStringList valueAsStringList( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const;
662
668 virtual QString valueAsPythonComment( const QVariant &value, QgsProcessingContext &context ) const;
669
674 virtual QString asScriptCode() const;
675
685 virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const;
686
692 virtual QVariantMap toVariantMap() const;
693
699 virtual bool fromVariantMap( const QVariantMap &map );
700
707 SIP_SKIP QVariantMap metadata() const { return mMetadata; }
708
714 QVariantMap &metadata() { return mMetadata; }
715
721 void setMetadata( const QVariantMap &metadata ) { mMetadata = metadata; }
722
727 virtual QStringList dependsOnOtherParameters() const { return QStringList(); }
728
735
741 QgsProcessingProvider *provider() const;
742
747 virtual QString toolTip() const;
748
756 bool isDynamic() const { return mIsDynamic; }
757
765 void setIsDynamic( bool dynamic ) { mIsDynamic = dynamic; }
766
773 QgsPropertyDefinition dynamicPropertyDefinition() const { return mPropertyDefinition; }
774
781 void setDynamicPropertyDefinition( const QgsPropertyDefinition &definition ) { mPropertyDefinition = definition; }
782
794 QString dynamicLayerParameterName() const { return mDynamicLayerParameterName; }
795
807 void setDynamicLayerParameterName( const QString &name ) { mDynamicLayerParameterName = name; }
808
822 QStringList additionalExpressionContextVariables() const { return mAdditionalExpressionVariables; }
823
841 void setAdditionalExpressionContextVariables( const QStringList &variables ) { mAdditionalExpressionVariables = variables; }
842
843 protected:
844
846 QString mName;
847
850
852 QString mHelp;
853
855 QVariant mDefault;
856
858 QVariant mGuiDefault;
859
861 Flags mFlags;
862
864 QVariantMap mMetadata;
865
867 QgsProcessingAlgorithm *mAlgorithm = nullptr;
868
870 bool mIsDynamic = false;
871
874
877
880
881 // To allow access to mAlgorithm. We don't want a public setter for this!
883
884};
885
886Q_DECLARE_OPERATORS_FOR_FLAGS( QgsProcessingParameterDefinition::Flags )
887
888
890
909class CORE_EXPORT QgsProcessingParameters
910{
911
912 public:
913
918 static bool isDynamic( const QVariantMap &parameters, const QString &name );
919
923 static QString parameterAsString( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
924
929 static QString parameterAsString( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
930
934 static QString parameterAsExpression( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
935
940 static QString parameterAsExpression( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
941
945 static double parameterAsDouble( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
946
951 static double parameterAsDouble( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
952
956 static int parameterAsInt( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
957
962 static int parameterAsInt( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
963
968 static QList<int> parameterAsInts( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
969
974 static QList<int> parameterAsInts( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
975
984 static QDateTime parameterAsDateTime( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
985
994 static QDateTime parameterAsDateTime( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
995
1004 static QDate parameterAsDate( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1005
1014 static QDate parameterAsDate( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1015
1024 static QTime parameterAsTime( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1025
1034 static QTime parameterAsTime( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1035
1039 static int parameterAsEnum( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1040
1045 static int parameterAsEnum( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1046
1050 static QList<int> parameterAsEnums( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1051
1056 static QList<int> parameterAsEnums( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1057
1062 static QString parameterAsEnumString( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1063
1068 static QString parameterAsEnumString( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1069
1074 static QStringList parameterAsEnumStrings( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1075
1080 static QStringList parameterAsEnumStrings( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1081
1085 static bool parameterAsBool( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1086
1092 static bool parameterAsBoolean( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1093
1098 static bool parameterAsBool( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1099
1104 static bool parameterAsBoolean( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1105
1123 static QgsFeatureSink *parameterAsSink( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters,
1124 const QgsFields &fields, QgsWkbTypes::Type geometryType, const QgsCoordinateReferenceSystem &crs,
1125 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;
1126
1146 static QgsFeatureSink *parameterAsSink( const QgsProcessingParameterDefinition *definition, const QVariant &value,
1147 const QgsFields &fields, QgsWkbTypes::Type geometryType, const QgsCoordinateReferenceSystem &crs,
1148 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;
1149
1158 static QgsProcessingFeatureSource *parameterAsSource( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context ) SIP_FACTORY;
1159
1170 static QgsProcessingFeatureSource *parameterAsSource( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context ) SIP_FACTORY;
1171
1187 static QString parameterAsCompatibleSourceLayerPath( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters,
1188 QgsProcessingContext &context, const QStringList &compatibleFormats, const QString &preferredFormat = QString( "shp" ), QgsProcessingFeedback *feedback = nullptr );
1189
1219 static QString parameterAsCompatibleSourceLayerPathAndLayerName( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters,
1220 QgsProcessingContext &context, const QStringList &compatibleFormats, const QString &preferredFormat = QString( "shp" ), QgsProcessingFeedback *feedback = nullptr, QString *layerName SIP_OUT = nullptr );
1221
1230
1241
1249 static QgsRasterLayer *parameterAsRasterLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1250
1260 static QgsRasterLayer *parameterAsRasterLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1261
1265 static QString parameterAsOutputLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1266
1271 static QString parameterAsOutputLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1272
1276 static QString parameterAsFileOutput( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1277
1282 static QString parameterAsFileOutput( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1283
1291 static QgsVectorLayer *parameterAsVectorLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1292
1302 static QgsVectorLayer *parameterAsVectorLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1303
1313 static QgsMeshLayer *parameterAsMeshLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1314
1324 static QgsMeshLayer *parameterAsMeshLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1325
1329 static QgsCoordinateReferenceSystem parameterAsCrs( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1330
1335 static QgsCoordinateReferenceSystem parameterAsCrs( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1336
1346 static QgsRectangle parameterAsExtent( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context,
1348
1360 static QgsRectangle parameterAsExtent( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context,
1362
1374 static QgsGeometry parameterAsExtentGeometry( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context,
1376
1382 static QgsCoordinateReferenceSystem parameterAsExtentCrs( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1383
1389 static QgsCoordinateReferenceSystem parameterAsExtentCrs( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1390
1391
1399 static QgsPointXY parameterAsPoint( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context,
1401
1410 static QgsPointXY parameterAsPoint( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context,
1412
1418 static QgsCoordinateReferenceSystem parameterAsPointCrs( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1419
1426 static QgsCoordinateReferenceSystem parameterAsPointCrs( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1427
1433 static QgsGeometry parameterAsGeometry( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem() );
1434
1441
1448 static QgsCoordinateReferenceSystem parameterAsGeometryCrs( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1449
1456 static QgsCoordinateReferenceSystem parameterAsGeometryCrs( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1457
1461 static QString parameterAsFile( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1462
1467 static QString parameterAsFile( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1468
1473 static QVariantList parameterAsMatrix( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1474
1480 static QVariantList parameterAsMatrix( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1481
1485 static QList< QgsMapLayer *> parameterAsLayerList( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1486
1491 static QList< QgsMapLayer *> parameterAsLayerList( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1492
1498 static QStringList parameterAsFileList( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1499
1505 static QStringList parameterAsFileList( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1506
1510 static QList<double> parameterAsRange( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1511
1516 static QList<double> parameterAsRange( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1517
1521 static QStringList parameterAsFields( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1522
1527 static QStringList parameterAsFields( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1528
1537 static QgsPrintLayout *parameterAsLayout( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1538
1547 static QgsPrintLayout *parameterAsLayout( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1548
1557 static QgsLayoutItem *parameterAsLayoutItem( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context, QgsPrintLayout *layout );
1558
1567 static QgsLayoutItem *parameterAsLayoutItem( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context, QgsPrintLayout *layout );
1568
1574 static QColor parameterAsColor( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1575
1581 static QColor parameterAsColor( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1582
1588 static QString parameterAsConnectionName( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1589
1595 static QString parameterAsConnectionName( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1596
1602 static QString parameterAsSchema( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1603
1609 static QString parameterAsSchema( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1610
1616 static QString parameterAsDatabaseTableName( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1617
1623 static QString parameterAsDatabaseTableName( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1624
1634 static QgsPointCloudLayer *parameterAsPointCloudLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1635
1645 static QgsPointCloudLayer *parameterAsPointCloudLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1646
1660 static QgsAnnotationLayer *parameterAsAnnotationLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1661
1675 static QgsAnnotationLayer *parameterAsAnnotationLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1676
1682 static QgsProcessingParameterDefinition *parameterFromVariantMap( const QVariantMap &map ) SIP_FACTORY;
1683
1687 static QString descriptionFromName( const QString &name );
1688
1694 static QgsProcessingParameterDefinition *parameterFromScriptCode( const QString &code ) SIP_FACTORY;
1695
1696 private:
1697
1698 static bool parseScriptCodeParameterOptions( const QString &code, bool &isOptional, QString &name, QString &type, QString &definition );
1699};
1700
1701
1702
1710{
1711 public:
1712
1716 QgsProcessingParameterBoolean( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
1717 bool optional = false );
1718
1722 static QString typeName() { return QStringLiteral( "boolean" ); }
1723 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1724 QString type() const override { return typeName(); }
1725 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1726 QString asScriptCode() const override;
1727
1731 static QgsProcessingParameterBoolean *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1732};
1733
1741{
1742 public:
1743
1747 QgsProcessingParameterCrs( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
1748 bool optional = false );
1749
1753 static QString typeName() { return QStringLiteral( "crs" ); }
1754 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1755 QString type() const override { return typeName(); }
1756 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
1757 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1758
1762 static QgsProcessingParameterCrs *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1763
1764};
1765
1773{
1774 public:
1775
1779 QgsProcessingParameterExtent( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
1780 bool optional = false );
1781
1785 static QString typeName() { return QStringLiteral( "extent" ); }
1786 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1787 QString type() const override { return typeName(); }
1788 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
1789 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1790
1794 static QgsProcessingParameterExtent *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1795
1796};
1797
1798
1806{
1807 public:
1808
1812 QgsProcessingParameterPoint( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
1813 bool optional = false );
1814
1818 static QString typeName() { return QStringLiteral( "point" ); }
1819 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1820 QString type() const override { return typeName(); }
1821 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
1822 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1823
1827 static QgsProcessingParameterPoint *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1828
1829};
1830
1838{
1839 public:
1840
1848 QgsProcessingParameterGeometry( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(), bool optional = false, const QList< int > &geometryTypes = QList< int >(), bool allowMultipart = true );
1849
1853 static QString typeName() { return QStringLiteral( "geometry" ); }
1854 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1855 QString type() const override { return typeName(); }
1856 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
1857 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1858 QString asScriptCode() const override;
1859 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
1860 QVariantMap toVariantMap() const override;
1861 bool fromVariantMap( const QVariantMap &map ) override;
1862
1867 QList<int> geometryTypes() const { return mGeomTypes; }
1868
1873 void setGeometryTypes( const QList<int> &geometryTypes ) { mGeomTypes = geometryTypes; }
1874
1879 bool allowMultipart() const { return mAllowMultipart; }
1880
1885 void setAllowMultipart( bool allowMultipart ) { mAllowMultipart = allowMultipart; }
1886
1887
1888
1892 static QgsProcessingParameterGeometry *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1893
1894 private:
1895
1896 QList<int> mGeomTypes;
1897 bool mAllowMultipart;
1898
1899};
1900
1908{
1909 public:
1910
1913 {
1914 File = 0,
1916 };
1917
1925 QgsProcessingParameterFile( const QString &name, const QString &description = QString(), Behavior behavior = File, const QString &extension = QString(), const QVariant &defaultValue = QVariant(),
1926 bool optional = false, const QString &fileFilter = QString() );
1927
1931 static QString typeName() { return QStringLiteral( "file" ); }
1932 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1933 QString type() const override { return typeName(); }
1934 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
1935 QString asScriptCode() const override;
1936 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
1937 QString createFileFilter() const override;
1938
1943 Behavior behavior() const { return mBehavior; }
1944
1949 void setBehavior( Behavior behavior ) { mBehavior = behavior; }
1950
1958 QString extension() const { return mExtension; }
1959
1969 void setExtension( const QString &extension );
1970
1977 QString fileFilter() const;
1978
1988 void setFileFilter( const QString &filter );
1989
1990 QVariantMap toVariantMap() const override;
1991 bool fromVariantMap( const QVariantMap &map ) override;
1992
1996 static QgsProcessingParameterFile *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition, Behavior behavior = File ) SIP_FACTORY;
1997
1998 private:
1999
2000 Behavior mBehavior = File;
2001 QString mExtension;
2002 QString mFileFilter;
2003};
2004
2012{
2013 public:
2014
2018 QgsProcessingParameterMatrix( const QString &name, const QString &description = QString(), int numberRows = 3,
2019 bool hasFixedNumberRows = false, const QStringList &headers = QStringList(),
2020 const QVariant &defaultValue = QVariant(),
2021 bool optional = false );
2022
2026 static QString typeName() { return QStringLiteral( "matrix" ); }
2027 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2028 QString type() const override { return typeName(); }
2029 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2030 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2031 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2032
2037 QStringList headers() const;
2038
2043 void setHeaders( const QStringList &headers );
2044
2051 int numberRows() const;
2052
2059 void setNumberRows( int rows );
2060
2066 bool hasFixedNumberRows() const;
2067
2073 void setHasFixedNumberRows( bool hasFixedNumberRows );
2074
2075 QVariantMap toVariantMap() const override;
2076 bool fromVariantMap( const QVariantMap &map ) override;
2077
2081 static QgsProcessingParameterMatrix *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2082
2083 private:
2084
2085 QStringList mHeaders;
2086 int mNumberRows = 3;
2087 bool mFixedNumberRows = false;
2088
2089};
2090
2098{
2099 public:
2100
2104 QgsProcessingParameterMultipleLayers( const QString &name, const QString &description = QString(), QgsProcessing::SourceType layerType = QgsProcessing::TypeVectorAnyGeometry,
2105 const QVariant &defaultValue = QVariant(),
2106 bool optional = false );
2107
2111 static QString typeName() { return QStringLiteral( "multilayer" ); }
2112 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2113 QString type() const override { return typeName(); }
2114 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2115 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2116 QString asScriptCode() const override;
2117 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2118 QString createFileFilter() const override;
2119
2124 QgsProcessing::SourceType layerType() const;
2125
2130 void setLayerType( QgsProcessing::SourceType type );
2131
2137 int minimumNumberInputs() const;
2138
2144 void setMinimumNumberInputs( int minimum );
2145
2146 QVariantMap toVariantMap() const override;
2147 bool fromVariantMap( const QVariantMap &map ) override;
2148
2152 static QgsProcessingParameterMultipleLayers *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2153
2154 private:
2155
2157 int mMinimumNumberInputs = 0;
2158
2159};
2160
2180{
2181 public:
2182
2184 enum Type
2185 {
2188 };
2189
2193 explicit QgsProcessingParameterNumber( const QString &name, const QString &description = QString(),
2194 Type type = Integer,
2195 const QVariant &defaultValue = QVariant(),
2196 bool optional = false,
2197 double minValue = std::numeric_limits<double>::lowest() + 1,
2198 double maxValue = std::numeric_limits<double>::max()
2199 );
2200
2204 static QString typeName() { return QStringLiteral( "number" ); }
2205 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2206 QString type() const override { return typeName(); }
2207 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2208 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2209 QString toolTip() const override;
2210 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2211
2216 double minimum() const;
2217
2222 void setMinimum( double minimum );
2223
2228 double maximum() const;
2229
2234 void setMaximum( double maximum );
2235
2240 Type dataType() const;
2241
2246 void setDataType( Type type );
2247
2248 QVariantMap toVariantMap() const override;
2249 bool fromVariantMap( const QVariantMap &map ) override;
2250
2254 static QgsProcessingParameterNumber *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2255
2256 private:
2257
2258 double mMin = std::numeric_limits<double>::lowest() + 1;
2259 double mMax = std::numeric_limits<double>::max();
2260 Type mDataType = Integer;
2261};
2262
2283{
2284 public:
2285
2289 explicit QgsProcessingParameterDistance( const QString &name, const QString &description = QString(),
2290 const QVariant &defaultValue = QVariant(),
2291 const QString &parentParameterName = QString(),
2292 bool optional = false,
2293 double minValue = std::numeric_limits<double>::lowest() + 1,
2294 double maxValue = std::numeric_limits<double>::max() );
2295
2299 static QString typeName() { return QStringLiteral( "distance" ); }
2300
2301 QgsProcessingParameterDistance *clone() const override SIP_FACTORY;
2302
2303 QString type() const override;
2304 QStringList dependsOnOtherParameters() const override;
2305 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2306
2311 QString parentParameterName() const;
2312
2317 void setParentParameterName( const QString &parentParameterName );
2318
2325 QgsUnitTypes::DistanceUnit defaultUnit() const { return mDefaultUnit; }
2326
2333 void setDefaultUnit( QgsUnitTypes::DistanceUnit unit ) { mDefaultUnit = unit; }
2334
2335 QVariantMap toVariantMap() const override;
2336 bool fromVariantMap( const QVariantMap &map ) override;
2337
2338 private:
2339
2340 QString mParentParameterName;
2342
2343};
2344
2353{
2354 public:
2355
2359 explicit QgsProcessingParameterDuration( const QString &name, const QString &description = QString(),
2360 const QVariant &defaultValue = QVariant(),
2361 bool optional = false,
2362 double minValue = std::numeric_limits<double>::lowest() + 1,
2363 double maxValue = std::numeric_limits<double>::max() );
2364
2368 static QString typeName() { return QStringLiteral( "duration" ); }
2369
2370 QgsProcessingParameterDuration *clone() const override SIP_FACTORY;
2371
2372 QString type() const override;
2373 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2374
2380 QgsUnitTypes::TemporalUnit defaultUnit() const { return mDefaultUnit; }
2381
2387 void setDefaultUnit( QgsUnitTypes::TemporalUnit unit ) { mDefaultUnit = unit; }
2388
2389 QVariantMap toVariantMap() const override;
2390 bool fromVariantMap( const QVariantMap &map ) override;
2391
2392 private:
2393
2395
2396};
2397
2409{
2410 public:
2411
2415 explicit QgsProcessingParameterScale( const QString &name, const QString &description = QString(),
2416 const QVariant &defaultValue = QVariant(),
2417 bool optional = false );
2418
2422 static QString typeName() { return QStringLiteral( "scale" ); }
2423
2424 QgsProcessingParameterScale *clone() const override SIP_FACTORY;
2425
2426 QString type() const override;
2427 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2428
2432 static QgsProcessingParameterScale *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2433
2434};
2435
2443{
2444 public:
2445
2449 QgsProcessingParameterRange( const QString &name, const QString &description = QString(),
2451 const QVariant &defaultValue = QVariant(),
2452 bool optional = false );
2453
2457 static QString typeName() { return QStringLiteral( "range" ); }
2458 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2459 QString type() const override { return typeName(); }
2460 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2461 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2462 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2463
2468 QgsProcessingParameterNumber::Type dataType() const;
2469
2474 void setDataType( QgsProcessingParameterNumber::Type dataType );
2475
2476 QVariantMap toVariantMap() const override;
2477 bool fromVariantMap( const QVariantMap &map ) override;
2478
2482 static QgsProcessingParameterRange *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2483
2484 private:
2485
2487};
2488
2496{
2497 public:
2498
2502 QgsProcessingParameterRasterLayer( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
2503 bool optional = false );
2504
2508 static QString typeName() { return QStringLiteral( "raster" ); }
2509 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2510 QString type() const override { return typeName(); }
2511 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2512 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2513 QString createFileFilter() const override;
2514
2518 static QgsProcessingParameterRasterLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2519
2520};
2521
2541{
2542 public:
2543
2547 QgsProcessingParameterEnum( const QString &name, const QString &description = QString(), const QStringList &options = QStringList(),
2548 bool allowMultiple = false,
2549 const QVariant &defaultValue = QVariant(),
2550 bool optional = false,
2551 bool usesStaticStrings = false );
2552
2556 static QString typeName() { return QStringLiteral( "enum" ); }
2557 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2558 QString type() const override { return typeName(); }
2559 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2560 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2561 QString valueAsPythonComment( const QVariant &value, QgsProcessingContext &context ) const override;
2562 QString asScriptCode() const override;
2563 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2564
2569 QStringList options() const;
2570
2575 void setOptions( const QStringList &options );
2576
2581 bool allowMultiple() const;
2582
2587 void setAllowMultiple( bool allowMultiple );
2588
2595 bool usesStaticStrings() const;
2596
2603 void setUsesStaticStrings( bool usesStaticStrings );
2604
2605 QVariantMap toVariantMap() const override;
2606 bool fromVariantMap( const QVariantMap &map ) override;
2607
2611 static QgsProcessingParameterEnum *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2612
2613 private:
2614
2615 QStringList mOptions;
2616 bool mAllowMultiple = false;
2617 bool mUsesStaticStrings = false;
2618};
2619
2648{
2649 public:
2650
2654 QgsProcessingParameterString( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
2655 bool multiLine = false,
2656 bool optional = false );
2657
2661 static QString typeName() { return QStringLiteral( "string" ); }
2662 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2663 QString type() const override { return typeName(); }
2664 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2665 QString asScriptCode() const override;
2666 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2667
2672 bool multiLine() const;
2673
2678 void setMultiLine( bool multiLine );
2679
2680 QVariantMap toVariantMap() const override;
2681 bool fromVariantMap( const QVariantMap &map ) override;
2682
2686 static QgsProcessingParameterString *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2687
2688 private:
2689
2690 bool mMultiLine = false;
2691
2692};
2693
2694
2708{
2709 public:
2710
2714 QgsProcessingParameterAuthConfig( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
2715 bool optional = false );
2716
2720 static QString typeName() { return QStringLiteral( "authcfg" ); }
2721 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2722 QString type() const override { return typeName(); }
2723 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2724 QString asScriptCode() const override;
2725
2729 static QgsProcessingParameterAuthConfig *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2730
2731};
2732
2740{
2741 public:
2742
2746 QgsProcessingParameterExpression( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
2747 const QString &parentLayerParameterName = QString(),
2748 bool optional = false );
2749
2753 static QString typeName() { return QStringLiteral( "expression" ); }
2754 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2755 QString type() const override { return typeName(); }
2756 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2757 QStringList dependsOnOtherParameters() const override;
2758 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2759
2764 QString parentLayerParameterName() const;
2765
2770 void setParentLayerParameterName( const QString &parentLayerParameterName );
2771
2772 QVariantMap toVariantMap() const override;
2773 bool fromVariantMap( const QVariantMap &map ) override;
2774
2778 static QgsProcessingParameterExpression *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2779
2780 private:
2781
2782 QString mParentLayerParameterName;
2783
2784};
2785
2786
2794{
2795 public:
2796
2800 QgsProcessingParameterLimitedDataTypes( const QList< int > &types = QList< int >() );
2801
2806 QList< int > dataTypes() const;
2807
2812 void setDataTypes( const QList< int > &types );
2813
2814 protected:
2815
2817 QList< int > mDataTypes;
2818};
2819
2828{
2829 public:
2830
2834 QgsProcessingParameterVectorLayer( const QString &name,
2835 const QString &description = QString(),
2836 const QList< int > &types = QList< int >(),
2837 const QVariant &defaultValue = QVariant(),
2838 bool optional = false );
2839
2843 static QString typeName() { return QStringLiteral( "vector" ); }
2844 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2845 QString type() const override { return typeName(); }
2846 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2847 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2848 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2849 QString createFileFilter() const override;
2850
2851 QVariantMap toVariantMap() const override;
2852 bool fromVariantMap( const QVariantMap &map ) override;
2853
2857 static QgsProcessingParameterVectorLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2858
2859};
2860
2868{
2869 public:
2870
2874 QgsProcessingParameterMeshLayer( const QString &name,
2875 const QString &description = QString(),
2876 const QVariant &defaultValue = QVariant(),
2877 bool optional = false );
2878
2882 static QString typeName() { return QStringLiteral( "mesh" ); }
2883 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2884 QString type() const override { return typeName(); }
2885 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2886 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2887 QString createFileFilter() const override;
2888
2892 static QgsProcessingParameterMeshLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2893};
2894
2902{
2903 public:
2904
2908 QgsProcessingParameterMapLayer( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
2909 bool optional = false,
2910 const QList< int > &types = QList< int >() );
2911
2915 static QString typeName() { return QStringLiteral( "layer" ); }
2916 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2917 QString type() const override { return typeName(); }
2918 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2919 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2920 QString asScriptCode() const override;
2921 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2922 QString createFileFilter() const override;
2923
2924 QVariantMap toVariantMap() const override;
2925 bool fromVariantMap( const QVariantMap &map ) override;
2926
2930 static QgsProcessingParameterMapLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2931
2932};
2933
2941{
2942 public:
2943
2946 {
2947 Any = -1,
2948 Numeric = 0,
2949 String = 1,
2950 DateTime = 2
2952
2956 QgsProcessingParameterField( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
2957 const QString &parentLayerParameterName = QString(),
2958 DataType type = Any,
2959 bool allowMultiple = false,
2960 bool optional = false,
2961 bool defaultToAllFields = false );
2962
2966 static QString typeName() { return QStringLiteral( "field" ); }
2967 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2968 QString type() const override { return typeName(); }
2969 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2970 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2971 QString asScriptCode() const override;
2972 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2973 QStringList dependsOnOtherParameters() const override;
2974
2979 QString parentLayerParameterName() const;
2980
2985 void setParentLayerParameterName( const QString &parentLayerParameterName );
2986
2991 DataType dataType() const;
2992
2997 void setDataType( DataType type );
2998
3003 bool allowMultiple() const;
3004
3009 void setAllowMultiple( bool allowMultiple );
3010
3020 bool defaultToAllFields() const;
3021
3031 void setDefaultToAllFields( bool enabled );
3032
3033 QVariantMap toVariantMap() const override;
3034 bool fromVariantMap( const QVariantMap &map ) override;
3035
3039 static QgsProcessingParameterField *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3040
3041 private:
3042
3043 QString mParentLayerParameterName;
3044 DataType mDataType = Any;
3045 bool mAllowMultiple = false;
3046 bool mDefaultToAllFields = false;
3047
3048};
3049
3050
3058{
3059 public:
3060
3064 QgsProcessingParameterFeatureSource( const QString &name, const QString &description = QString(),
3065 const QList< int > &types = QList< int >(),
3066 const QVariant &defaultValue = QVariant(), bool optional = false );
3067
3071 static QString typeName() { return QStringLiteral( "source" ); }
3072 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3073 QString type() const override { return typeName(); }
3074 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3075 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3076 QString asScriptCode() const override;
3077 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3078 QString createFileFilter() const override;
3079
3080 QVariantMap toVariantMap() const override;
3081 bool fromVariantMap( const QVariantMap &map ) override;
3082
3086 static QgsProcessingParameterFeatureSource *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3087
3088};
3089
3098{
3099 public:
3100
3107 QgsProcessingDestinationParameter( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
3108 bool optional = false, bool createByDefault = true );
3109
3110 bool isDestination() const override { return true; }
3111 QVariantMap toVariantMap() const override;
3112 bool fromVariantMap( const QVariantMap &map ) override;
3113 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3114 QString createFileFilter() const override;
3115
3121
3127 bool supportsNonFileBasedOutput() const { return mSupportsNonFileBasedOutputs; }
3128
3134 void setSupportsNonFileBasedOutput( bool supportsNonFileBasedOutput ) { mSupportsNonFileBasedOutputs = supportsNonFileBasedOutput; }
3135
3140 virtual QString defaultFileExtension() const = 0;
3141
3147 virtual QString generateTemporaryDestination() const;
3148
3163 virtual bool isSupportedOutputValue( const QVariant &value, QgsProcessingContext &context, QString &error SIP_OUT ) const;
3164
3170 bool createByDefault() const;
3171
3177 void setCreateByDefault( bool createByDefault );
3178
3179 protected:
3180
3189 QgsProcessingProvider *originalProvider() const { return mOriginalProvider; }
3190
3191 private:
3192
3200 QgsProcessingProvider *mOriginalProvider = nullptr;
3201
3202 bool mSupportsNonFileBasedOutputs = true;
3203 bool mCreateByDefault = true;
3204
3205 friend class QgsProcessingModelAlgorithm;
3206 friend class TestQgsProcessing;
3207 friend class TestQgsProcessingModelAlgorithm;
3208};
3209
3210
3220{
3221 public:
3222
3229 QgsProcessingParameterFeatureSink( const QString &name, const QString &description = QString(), QgsProcessing::SourceType type = QgsProcessing::TypeVectorAnyGeometry, const QVariant &defaultValue = QVariant(),
3230 bool optional = false, bool createByDefault = true, bool supportsAppend = false );
3231
3235 static QString typeName() { return QStringLiteral( "sink" ); }
3236 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3237 QString type() const override { return typeName(); }
3238 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3239 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3240 QString asScriptCode() const override;
3241 QgsProcessingOutputDefinition *toOutputDefinition() const override SIP_FACTORY;
3242 QString defaultFileExtension() const override;
3243 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3244 QString createFileFilter() const override;
3245
3251 virtual QStringList supportedOutputVectorLayerExtensions() const;
3252
3257 QgsProcessing::SourceType dataType() const;
3258
3263 bool hasGeometry() const;
3264
3269 void setDataType( QgsProcessing::SourceType type );
3270
3279 bool supportsAppend() const;
3280
3289 void setSupportsAppend( bool supportsAppend );
3290
3291 QVariantMap toVariantMap() const override;
3292 bool fromVariantMap( const QVariantMap &map ) override;
3293 QString generateTemporaryDestination() const override;
3294
3298 static QgsProcessingParameterFeatureSink *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3299
3300 private:
3301
3302 QgsProcessing::SourceType mDataType = QgsProcessing::TypeVectorAnyGeometry;
3303 bool mSupportsAppend = false;
3304};
3305
3306
3318{
3319 public:
3320
3327 QgsProcessingParameterVectorDestination( const QString &name, const QString &description = QString(), QgsProcessing::SourceType type = QgsProcessing::TypeVectorAnyGeometry, const QVariant &defaultValue = QVariant(),
3328 bool optional = false, bool createByDefault = true );
3329
3333 static QString typeName() { return QStringLiteral( "vectorDestination" ); }
3334 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3335 QString type() const override { return typeName(); }
3336 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3337 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3338 QString asScriptCode() const override;
3339 QgsProcessingOutputDefinition *toOutputDefinition() const override SIP_FACTORY;
3340 QString defaultFileExtension() const override;
3341 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3342 QString createFileFilter() const override;
3343
3349 virtual QStringList supportedOutputVectorLayerExtensions() const;
3350
3355 QgsProcessing::SourceType dataType() const;
3356
3361 bool hasGeometry() const;
3362
3367 void setDataType( QgsProcessing::SourceType type );
3368
3369 QVariantMap toVariantMap() const override;
3370 bool fromVariantMap( const QVariantMap &map ) override;
3371
3375 static QgsProcessingParameterVectorDestination *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3376
3377
3378 private:
3379
3380 QgsProcessing::SourceType mDataType = QgsProcessing::TypeVectorAnyGeometry;
3381};
3382
3391{
3392 public:
3393
3400 QgsProcessingParameterRasterDestination( const QString &name, const QString &description = QString(),
3401 const QVariant &defaultValue = QVariant(),
3402 bool optional = false,
3403 bool createByDefault = true );
3404
3408 static QString typeName() { return QStringLiteral( "rasterDestination" ); }
3409 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3410 QString type() const override { return typeName(); }
3411 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3412 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3413 QgsProcessingOutputDefinition *toOutputDefinition() const override SIP_FACTORY;
3414 QString defaultFileExtension() const override;
3415 QString createFileFilter() const override;
3416
3422 virtual QStringList supportedOutputRasterLayerExtensions() const;
3423
3427 static QgsProcessingParameterRasterDestination *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3428};
3429
3452{
3453 public:
3454
3461 QgsProcessingParameterFileDestination( const QString &name, const QString &description = QString(),
3462 const QString &fileFilter = QString(),
3463 const QVariant &defaultValue = QVariant(),
3464 bool optional = false,
3465 bool createByDefault = true );
3466
3470 static QString typeName() { return QStringLiteral( "fileDestination" ); }
3471 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3472 QString type() const override { return typeName(); }
3473 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3474 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3475 QgsProcessingOutputDefinition *toOutputDefinition() const override SIP_FACTORY;
3476 QString defaultFileExtension() const override;
3477 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3478 QString createFileFilter() const override;
3479
3484 QString fileFilter() const;
3485
3490 void setFileFilter( const QString &filter );
3491
3492 QVariantMap toVariantMap() const override;
3493 bool fromVariantMap( const QVariantMap &map ) override;
3494
3498 static QgsProcessingParameterFileDestination *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3499
3500
3501 private:
3502
3503 QString mFileFilter;
3504};
3505
3514{
3515 public:
3516
3520 QgsProcessingParameterFolderDestination( const QString &name, const QString &description = QString(),
3521 const QVariant &defaultValue = QVariant(),
3522 bool optional = false,
3523 bool createByDefault = true );
3524
3528 static QString typeName() { return QStringLiteral( "folderDestination" ); }
3529 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3530 QString type() const override { return typeName(); }
3531 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3532 QgsProcessingOutputDefinition *toOutputDefinition() const override SIP_FACTORY;
3533 QString defaultFileExtension() const override;
3534
3538 static QgsProcessingParameterFolderDestination *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3539
3540};
3541
3549{
3550 public:
3551
3555 QgsProcessingParameterBand( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
3556 const QString &parentLayerParameterName = QString(),
3557 bool optional = false,
3558 bool allowMultiple = false );
3559
3563 static QString typeName() { return QStringLiteral( "band" ); }
3564 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3565 QString type() const override { return typeName(); }
3566 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3567 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3568 QString asScriptCode() const override;
3569 QStringList dependsOnOtherParameters() const override;
3570 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3571
3576 QString parentLayerParameterName() const;
3577
3582 void setParentLayerParameterName( const QString &parentLayerParameterName );
3583
3584 QVariantMap toVariantMap() const override;
3585 bool fromVariantMap( const QVariantMap &map ) override;
3586
3590 static QgsProcessingParameterBand *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3591
3597 bool allowMultiple() const;
3598
3604 void setAllowMultiple( bool allowMultiple );
3605
3606 private:
3607
3608 QString mParentLayerParameterName;
3609 bool mAllowMultiple = false;
3610};
3611
3624{
3625 public:
3626
3630 QgsProcessingParameterLayout( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
3631 bool optional = false );
3632
3636 static QString typeName() { return QStringLiteral( "layout" ); }
3637 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3638 QString type() const override { return typeName(); }
3639 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3640 QString asScriptCode() const override;
3641 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3642
3646 static QgsProcessingParameterLayout *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3647
3648};
3649
3662{
3663 public:
3664
3668 QgsProcessingParameterLayoutItem( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
3669 const QString &parentLayoutParameterName = QString(),
3670 int itemType = -1,
3671 bool optional = false );
3672
3676 static QString typeName() { return QStringLiteral( "layoutitem" ); }
3677 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3678 QString type() const override { return typeName(); }
3679 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3680 QString asScriptCode() const override;
3681 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3682 QVariantMap toVariantMap() const override;
3683 bool fromVariantMap( const QVariantMap &map ) override;
3684 QStringList dependsOnOtherParameters() const override;
3685
3689 static QgsProcessingParameterLayoutItem *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3690
3695 QString parentLayoutParameterName() const;
3696
3701 void setParentLayoutParameterName( const QString &name );
3702
3710 int itemType() const;
3711
3719 void setItemType( int type );
3720
3721 private:
3722 QString mParentLayoutParameterName;
3723 int mItemType = -1;
3724};
3725
3736{
3737 public:
3738
3744 QgsProcessingParameterColor( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
3745 bool opacityEnabled = true,
3746 bool optional = false );
3747
3751 static QString typeName() { return QStringLiteral( "color" ); }
3752 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3753 QString type() const override { return typeName(); }
3754 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3755 QString asScriptCode() const override;
3756 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3757 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3758 QVariantMap toVariantMap() const override;
3759 bool fromVariantMap( const QVariantMap &map ) override;
3760
3767 bool opacityEnabled() const;
3768
3776 void setOpacityEnabled( bool enabled );
3777
3781 static QgsProcessingParameterColor *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3782
3783 private:
3784
3785 bool mAllowOpacity = true;
3786
3787};
3788
3789
3800{
3801 public:
3802
3806 QgsProcessingParameterCoordinateOperation( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
3807 const QString &sourceCrsParameterName = QString(), const QString &destinationCrsParameterName = QString(),
3808 const QVariant &staticSourceCrs = QVariant(), const QVariant &staticDestinationCrs = QVariant(),
3809 bool optional = false );
3810
3814 static QString typeName() { return QStringLiteral( "coordinateoperation" ); }
3815 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3816 QString type() const override { return typeName(); }
3817 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3818 QString asScriptCode() const override;
3819 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3820 QStringList dependsOnOtherParameters() const override;
3821
3822 QVariantMap toVariantMap() const override;
3823 bool fromVariantMap( const QVariantMap &map ) override;
3824
3828 static QgsProcessingParameterCoordinateOperation *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3829
3835 QString sourceCrsParameterName() const { return mSourceParameterName; }
3836
3842 void setSourceCrsParameterName( const QString &name ) { mSourceParameterName = name; }
3843
3849 QString destinationCrsParameterName() const { return mDestParameterName; }
3850
3856 void setDestinationCrsParameterName( const QString &name ) { mDestParameterName = name; }
3857
3863 QVariant sourceCrs() const { return mSourceCrs; }
3864
3870 void setSourceCrs( const QVariant &crs ) { mSourceCrs = crs; }
3871
3877 QVariant destinationCrs() const { return mDestCrs; }
3878
3884 void setDestinationCrs( const QVariant &crs ) { mDestCrs = crs; }
3885
3886 private:
3887
3888 QString mSourceParameterName;
3889 QString mDestParameterName;
3890 QVariant mSourceCrs;
3891 QVariant mDestCrs;
3892
3893};
3894
3895
3906{
3907 public:
3908
3912 QgsProcessingParameterMapTheme( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
3913 bool optional = false );
3914
3918 static QString typeName() { return QStringLiteral( "maptheme" ); }
3919 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3920 QString type() const override { return typeName(); }
3921 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3922 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3923 QString asScriptCode() const override;
3924 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3925 QVariantMap toVariantMap() const override;
3926 bool fromVariantMap( const QVariantMap &map ) override;
3927
3931 static QgsProcessingParameterMapTheme *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3932
3933 private:
3934
3935};
3936
3937
3949{
3950 public:
3951
3953 enum Type
3954 {
3958 };
3959
3963 explicit QgsProcessingParameterDateTime( const QString &name, const QString &description = QString(),
3964 Type type = DateTime,
3965 const QVariant &defaultValue = QVariant(),
3966 bool optional = false,
3967 const QDateTime &minValue = QDateTime(),
3968 const QDateTime &maxValue = QDateTime()
3969 );
3970
3974 static QString typeName() { return QStringLiteral( "datetime" ); }
3975 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3976 QString type() const override { return typeName(); }
3977 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3978 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3979 QString toolTip() const override;
3980 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3981
3989 QDateTime minimum() const;
3990
4002 void setMinimum( const QDateTime &minimum );
4003
4011 QDateTime maximum() const;
4012
4024 void setMaximum( const QDateTime &maximum );
4025
4030 Type dataType() const;
4031
4036 void setDataType( Type type );
4037
4038 QVariantMap toVariantMap() const override;
4039 bool fromVariantMap( const QVariantMap &map ) override;
4040
4044 static QgsProcessingParameterDateTime *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4045
4046 private:
4047
4048 QDateTime mMin;
4049 QDateTime mMax;
4050 Type mDataType = DateTime;
4051};
4052
4053
4065{
4066 public:
4067
4074 QgsProcessingParameterProviderConnection( const QString &name, const QString &description, const QString &provider, const QVariant &defaultValue = QVariant(),
4075 bool optional = false );
4076
4080 static QString typeName() { return QStringLiteral( "providerconnection" ); }
4081 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4082 QString type() const override { return typeName(); }
4083 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4084 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4085 QString asScriptCode() const override;
4086 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
4087 QVariantMap toVariantMap() const override;
4088 bool fromVariantMap( const QVariantMap &map ) override;
4089
4094 QString providerId() const { return mProviderId; }
4095
4100 void setProviderId( const QString &provider ) { mProviderId = provider; }
4101
4105 static QgsProcessingParameterProviderConnection *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4106
4107 private:
4108
4109 QString mProviderId;
4110};
4111
4112
4124{
4125 public:
4126
4135 QgsProcessingParameterDatabaseSchema( const QString &name, const QString &description, const QString &connectionParameterName = QString(), const QVariant &defaultValue = QVariant(),
4136 bool optional = false );
4137
4141 static QString typeName() { return QStringLiteral( "databaseschema" ); }
4142 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4143 QString type() const override { return typeName(); }
4144 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4145 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4146 QString asScriptCode() const override;
4147 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
4148 QVariantMap toVariantMap() const override;
4149 bool fromVariantMap( const QVariantMap &map ) override;
4150 QStringList dependsOnOtherParameters() const override;
4151
4156 QString parentConnectionParameterName() const;
4157
4162 void setParentConnectionParameterName( const QString &name );
4163
4167 static QgsProcessingParameterDatabaseSchema *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4168
4169 private:
4170
4171 QString mParentConnectionParameterName;
4172};
4173
4174
4186{
4187 public:
4188
4198 QgsProcessingParameterDatabaseTable( const QString &name, const QString &description,
4199 const QString &connectionParameterName = QString(),
4200 const QString &schemaParameterName = QString(),
4201 const QVariant &defaultValue = QVariant(),
4202 bool optional = false,
4203 bool allowNewTableNames = false );
4204
4208 static QString typeName() { return QStringLiteral( "databasetable" ); }
4209 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4210 QString type() const override { return typeName(); }
4211 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4212 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4213 QString asScriptCode() const override;
4214 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
4215 QVariantMap toVariantMap() const override;
4216 bool fromVariantMap( const QVariantMap &map ) override;
4217 QStringList dependsOnOtherParameters() const override;
4218
4223 QString parentConnectionParameterName() const;
4224
4229 void setParentConnectionParameterName( const QString &name );
4230
4235 QString parentSchemaParameterName() const;
4236
4241 void setParentSchemaParameterName( const QString &name );
4242
4246 static QgsProcessingParameterDatabaseTable *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4247
4254 bool allowNewTableNames() const;
4255
4262 void setAllowNewTableNames( bool allowed );
4263
4264 private:
4265
4266 QString mParentConnectionParameterName;
4267 QString mParentSchemaParameterName;
4268 bool mAllowNewTableNames = false;
4269};
4270
4271
4279{
4280 public:
4281
4285 QgsProcessingParameterPointCloudLayer( const QString &name, const QString &description = QString(),
4286 const QVariant &defaultValue = QVariant(), bool optional = false );
4287
4291 static QString typeName() { return QStringLiteral( "pointcloud" ); }
4292 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4293 QString type() const override { return typeName(); }
4294 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4295 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4296 QString createFileFilter() const override;
4297
4301 static QgsProcessingParameterPointCloudLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4302};
4303
4304
4312{
4313 public:
4314
4318 QgsProcessingParameterAnnotationLayer( const QString &name, const QString &description = QString(),
4319 const QVariant &defaultValue = QVariant(), bool optional = false );
4320
4324 static QString typeName() { return QStringLiteral( "annotation" ); }
4325 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4326 QString type() const override { return typeName(); }
4327 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4328 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4329
4333 static QgsProcessingParameterAnnotationLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4334};
4335
4344{
4345 public:
4346
4353 QgsProcessingParameterPointCloudDestination( const QString &name, const QString &description = QString(),
4354 const QVariant &defaultValue = QVariant(),
4355 bool optional = false,
4356 bool createByDefault = true );
4357
4361 static QString typeName() { return QStringLiteral( "pointCloudDestination" ); }
4362 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4363 QString type() const override { return typeName(); }
4364 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4365 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4366 QgsProcessingOutputDefinition *toOutputDefinition() const override SIP_FACTORY;
4367 QString defaultFileExtension() const override;
4368 QString createFileFilter() const override;
4369
4374 virtual QStringList supportedOutputPointCloudLayerExtensions() const;
4375
4379 static QgsProcessingParameterPointCloudDestination *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4380};
4381
4382// clazy:excludeall=qstring-allocations
4383
4384#endif // QGSPROCESSINGPARAMETERS_H
4385
4386
Represents a map layer containing a set of georeferenced annotations, e.g.
This class represents a coordinate reference system (CRS).
This class wraps a request for features to a vector layer (or directly its vector data provider).
InvalidGeometryCheck
Handling of features with invalid geometries.
@ GeometryAbortOnInvalid
Close iterator on encountering any features with invalid geometry. This requires a slow geometry vali...
An interface for objects which accept features via addFeature(s) methods.
Container of fields for a vector layer.
Definition: qgsfields.h:45
Abstract interface for classes which generate a file filter string.
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:125
Base class for graphical items within a QgsLayout.
Base class for all map layer types.
Definition: qgsmaplayer.h:73
Represents a mesh layer supporting display of data on structured or unstructured meshes.
Definition: qgsmeshlayer.h:99
Represents a map layer supporting display of point clouds.
A class to represent a 2D point.
Definition: qgspointxy.h:59
Print layout, a QgsLayout subclass for static or atlas-based layouts.
Abstract base class for processing algorithms.
QString parameterAsCompatibleSourceLayerPath(const QVariantMap &parameters, const QString &name, QgsProcessingContext &context, const QStringList &compatibleFormats, const QString &preferredFormat=QString("shp"), QgsProcessingFeedback *feedback=nullptr) const
Evaluates the parameter with matching name to a source vector layer file path of compatible format.
QString parameterAsConnectionName(const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
Evaluates the parameter with matching name to a connection name string.
QString parameterAsCompatibleSourceLayerPathAndLayerName(const QVariantMap &parameters, const QString &name, QgsProcessingContext &context, const QStringList &compatibleFormats, const QString &preferredFormat=QString("shp"), QgsProcessingFeedback *feedback=nullptr, QString *layerName=nullptr) const
Evaluates the parameter with matching name to a source vector layer file path and layer name of compa...
QgsGeometry parameterAsExtentGeometry(const QVariantMap &parameters, const QString &name, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem()) const
Evaluates the parameter with matching name to a rectangular extent, and returns a geometry covering t...
QgsMapLayer * parameterAsLayer(const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
Evaluates the parameter with matching name to a map layer.
QgsRasterLayer * parameterAsRasterLayer(const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
Evaluates the parameter with matching name to a raster layer.
int parameterAsInt(const QVariantMap &parameters, const QString &name, const QgsProcessingContext &context) const
Evaluates the parameter with matching name to a static integer value.
int parameterAsEnum(const QVariantMap &parameters, const QString &name, const QgsProcessingContext &context) const
Evaluates the parameter with matching name to a enum value.
QStringList parameterAsFields(const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
Evaluates the parameter with matching name to a list of fields.
QgsProcessingFeatureSource * parameterAsSource(const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
Evaluates the parameter with matching name to a feature source.
QString parameterAsFile(const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
Evaluates the parameter with matching name to a file/folder name.
QgsVectorLayer * parameterAsVectorLayer(const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
Evaluates the parameter with matching name to a vector layer.
QStringList parameterAsFileList(const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
Evaluates the parameter with matching name to a list of files (for QgsProcessingParameterMultipleLaye...
QString parameterAsDatabaseTableName(const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
Evaluates the parameter with matching name to a database table name string.
QString parameterAsExpression(const QVariantMap &parameters, const QString &name, const QgsProcessingContext &context) const
Evaluates the parameter with matching name to an expression.
QgsAnnotationLayer * parameterAsAnnotationLayer(const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
Evaluates the parameter with matching name to an annotation layer.
QgsGeometry parameterAsGeometry(const QVariantMap &parameters, const QString &name, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem()) const
Evaluates the parameter with matching name to a geometry.
QgsFeatureSink * parameterAsSink(const QVariantMap &parameters, const QString &name, QgsProcessingContext &context, QString &destinationIdentifier, const QgsFields &fields, QgsWkbTypes::Type geometryType=QgsWkbTypes::NoGeometry, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem(), QgsFeatureSink::SinkFlags sinkFlags=QgsFeatureSink::SinkFlags(), const QVariantMap &createOptions=QVariantMap(), const QStringList &datasourceOptions=QStringList(), const QStringList &layerOptions=QStringList()) const SIP_THROW(QgsProcessingException)
Evaluates the parameter with matching name to a feature sink.
bool parameterAsBoolean(const QVariantMap &parameters, const QString &name, const QgsProcessingContext &context) const
Evaluates the parameter with matching name to a static boolean value.
QList< double > parameterAsRange(const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
Evaluates the parameter with matching name to a range of values.
QVariantList parameterAsMatrix(const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
Evaluates the parameter with matching name to a matrix/table of values.
double parameterAsDouble(const QVariantMap &parameters, const QString &name, const QgsProcessingContext &context) const
Evaluates the parameter with matching name to a static double value.
QgsCoordinateReferenceSystem parameterAsPointCrs(const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
Returns the coordinate reference system associated with an point parameter value.
QString parameterAsString(const QVariantMap &parameters, const QString &name, const QgsProcessingContext &context) const
Evaluates the parameter with matching name to a static string value.
QgsRectangle parameterAsExtent(const QVariantMap &parameters, const QString &name, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem()) const
Evaluates the parameter with matching name to a rectangular extent.
QgsPrintLayout * parameterAsLayout(const QVariantMap &parameters, const QString &name, QgsProcessingContext &context)
Evaluates the parameter with matching name to a print layout.
QgsCoordinateReferenceSystem parameterAsCrs(const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
Evaluates the parameter with matching name to a coordinate reference system.
QString parameterAsFileOutput(const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
Evaluates the parameter with matching name to a file based output destination.
QgsLayoutItem * parameterAsLayoutItem(const QVariantMap &parameters, const QString &name, QgsProcessingContext &context, QgsPrintLayout *layout)
Evaluates the parameter with matching name to a print layout item, taken from the specified layout.
QString parameterAsSchema(const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
Evaluates the parameter with matching name to a database schema name string.
QStringList parameterAsEnumStrings(const QVariantMap &parameters, const QString &name, const QgsProcessingContext &context) const
Evaluates the parameter with matching name to list of static enum strings.
QgsPointXY parameterAsPoint(const QVariantMap &parameters, const QString &name, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem()) const
Evaluates the parameter with matching name to a point.
QList< QgsMapLayer * > parameterAsLayerList(const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
Evaluates the parameter with matching name to a list of map layers.
QgsCoordinateReferenceSystem parameterAsExtentCrs(const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
Returns the coordinate reference system associated with an extent parameter value.
QgsMeshLayer * parameterAsMeshLayer(const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
Evaluates the parameter with matching name to a mesh layer.
QgsCoordinateReferenceSystem parameterAsGeometryCrs(const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
Returns the coordinate reference system associated with a geometry parameter value.
QString parameterAsEnumString(const QVariantMap &parameters, const QString &name, const QgsProcessingContext &context) const
Evaluates the parameter with matching name to a static enum string.
QList< int > parameterAsInts(const QVariantMap &parameters, const QString &name, const QgsProcessingContext &context) const
Evaluates the parameter with matching name to a list of integer values.
bool parameterAsBool(const QVariantMap &parameters, const QString &name, const QgsProcessingContext &context) const
Evaluates the parameter with matching name to a static boolean value.
virtual QString name() const =0
Returns the algorithm name, used for identifying the algorithm.
QgsPointCloudLayer * parameterAsPointCloudLayer(const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
Evaluates the parameter with matching name to a point cloud layer.
QList< int > parameterAsEnums(const QVariantMap &parameters, const QString &name, const QgsProcessingContext &context) const
Evaluates the parameter with matching name to list of enum values.
QDateTime parameterAsDateTime(const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
Evaluates the parameter with matching name to a DateTime, or returns an invalid date time if the para...
QString parameterAsOutputLayer(const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
Evaluates the parameter with matching name to a output layer destination.
QColor parameterAsColor(const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
Evaluates the parameter with matching name to a color, or returns an invalid color if the parameter w...
Contains information about the context in which a processing algorithm is executed.
Base class for all parameter definitions which represent file or layer destinations,...
virtual QString defaultFileExtension() const =0
Returns the default file extension for destination file paths associated with this parameter.
bool supportsNonFileBasedOutput() const
Returns true if the destination parameter supports non filed-based outputs, such as memory layers or ...
bool isDestination() const override
Returns true if this parameter represents a file or layer destination, e.g.
virtual QgsProcessingOutputDefinition * toOutputDefinition() const =0
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
QgsProcessingProvider * originalProvider() const
Original (source) provider which this parameter has been derived from.
void setSupportsNonFileBasedOutput(bool supportsNonFileBasedOutput)
Sets whether the destination parameter supports non filed-based outputs, such as memory layers or dir...
Custom exception class for processing related exceptions.
Definition: qgsexception.h:83
Encapsulates settings relating to a feature source input to a processing algorithm.
Flags flags
Flags which dictate source behavior.
bool operator!=(const QgsProcessingFeatureSourceDefinition &other) const
bool selectedFeaturesOnly
true if only selected features in the source should be used by algorithms.
QgsFeatureRequest::InvalidGeometryCheck geometryCheck
Geometry check method to apply to this source.
bool operator==(const QgsProcessingFeatureSourceDefinition &other) const
long long featureLimit
If set to a value > 0, places a limit on the maximum number of features which will be read from the s...
Flag
Flags which control source behavior.
QgsProcessingFeatureSourceDefinition(const QgsProperty &source, bool selectedFeaturesOnly=false, long long featureLimit=-1, QgsProcessingFeatureSourceDefinition::Flags flags=QgsProcessingFeatureSourceDefinition::Flags(), QgsFeatureRequest::InvalidGeometryCheck geometryCheck=QgsFeatureRequest::GeometryAbortOnInvalid)
Constructor for QgsProcessingFeatureSourceDefinition, accepting a QgsProperty source.
QgsFeatureSource subclass which proxies methods to an underlying QgsFeatureSource,...
Base class for providing feedback from a processing algorithm.
Base class for the definition of processing outputs.
Encapsulates settings relating to a feature sink or output raster layer for a processing algorithm.
QgsProcessingOutputLayerDefinition(const QgsProperty &sink, QgsProject *destinationProject=nullptr)
Constructor for QgsProcessingOutputLayerDefinition, accepting a QgsProperty sink/layer.
QgsProperty sink
Sink/layer definition.
bool useRemapping() const
Returns true if the output uses a remapping definition.
QgsProcessingOutputLayerDefinition(const QString &sink=QString(), QgsProject *destinationProject=nullptr)
Constructor for QgsProcessingOutputLayerDefinition, accepting a static sink/layer string.
QgsRemappingSinkDefinition remappingDefinition() const
Returns the output remapping definition, if useRemapping() is true.
QString destinationName
Name to use for sink if it's to be loaded into a destination project.
QVariantMap createOptions
Map of optional sink/layer creation options, which are passed to the underlying provider when creatin...
An annotation layer parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A string parameter for authentication configuration ID values.
static QString typeName()
Returns the type name for the parameter class.
A raster band parameter for Processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A boolean parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A color parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A coordinate operation parameter for processing algorithms, for selection between available coordinat...
static QString typeName()
Returns the type name for the parameter class.
QVariant sourceCrs() const
Returns the static source CRS, or an invalid value if this is not set.
QString destinationCrsParameterName() const
Returns the name of the destination CRS parameter, or an empty string if this is not set.
void setDestinationCrsParameterName(const QString &name)
Sets the name of the destination CRS parameter.
void setSourceCrs(const QVariant &crs)
Sets the static source crs.
QVariant destinationCrs() const
Returns the static destination CRS, or an invalid value if this is not set.
void setDestinationCrs(const QVariant &crs)
Sets the static destination crs.
void setSourceCrsParameterName(const QString &name)
Sets the name of the source CRS parameter.
QString sourceCrsParameterName() const
Returns the name of the source CRS parameter, or an empty string if this is not set.
A coordinate reference system parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A database schema parameter for processing algorithms, allowing users to select from existing schemas...
static QString typeName()
Returns the type name for the parameter class.
A database table name parameter for processing algorithms, allowing users to select from existing dat...
static QString typeName()
Returns the type name for the parameter class.
A datetime (or pure date or time) parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
Base class for the definition of processing parameters.
QVariant defaultValue() const
Returns the default value for the parameter.
void setDefaultValue(const QVariant &value)
Sets the default value for the parameter.
QVariant guiDefaultValueOverride() const
Returns the default value to use in the GUI for the parameter.
QStringList additionalExpressionContextVariables() const
Returns a list of additional expression context variables which are available for use when evaluating...
QStringList mAdditionalExpressionVariables
Additional expression context variables exposed for use by this parameter.
QString help() const
Returns the help for the parameter.
void setMetadata(const QVariantMap &metadata)
Sets the parameter's freeform metadata.
void setGuiDefaultValueOverride(const QVariant &value)
Sets the default value to use for the parameter in GUI widgets.
QVariantMap metadata() const
Returns the parameter's freeform metadata.
QString description() const
Returns the description for the parameter.
QString mDynamicLayerParameterName
Linked vector layer parameter name for dynamic properties.
QVariant defaultValueForGui() const
Returns the default value to use for the parameter in a GUI.
virtual bool isDestination() const
Returns true if this parameter represents a file or layer destination, e.g.
void setDescription(const QString &description)
Sets the description for the parameter.
void setDynamicLayerParameterName(const QString &name)
Sets the name for the parameter for a layer linked to a dynamic parameter, or an empty string if this...
QString dynamicLayerParameterName() const
Returns the name of the parameter for a layer linked to a dynamic parameter, or an empty string if th...
void setAdditionalExpressionContextVariables(const QStringList &variables)
Sets a list of additional expression context variables which are available for use when evaluating th...
QVariantMap mMetadata
Freeform metadata for parameter. Mostly used by widget wrappers to customize their appearance and beh...
void setName(const QString &name)
Sets the name of the parameter.
QString mDescription
Parameter description.
virtual QgsProcessingParameterDefinition * clone() const =0
Creates a clone of the parameter definition.
virtual QString type() const =0
Unique parameter type name.
void setDynamicPropertyDefinition(const QgsPropertyDefinition &definition)
Sets the property definition for dynamic properties.
Flags flags() const
Returns any flags associated with the parameter.
void setHelp(const QString &help)
Sets the help for the parameter.
QString name() const
Returns the name of the parameter.
QVariant mDefault
Default value for parameter.
virtual QStringList dependsOnOtherParameters() const
Returns a list of other parameter names on which this parameter is dependent (e.g.
void setIsDynamic(bool dynamic)
Sets whether the parameter is dynamic, and can support data-defined values (i.e.
QVariant mGuiDefault
Default value for parameter in GUI.
QgsPropertyDefinition mPropertyDefinition
Data defined property definition.
bool isDynamic() const
Returns true if the parameter supports is dynamic, and can support data-defined values (i....
void setFlags(Flags flags)
Sets the flags associated with the parameter.
virtual ~QgsProcessingParameterDefinition()=default
QVariantMap & metadata()
Returns the parameter's freeform metadata.
QgsPropertyDefinition dynamicPropertyDefinition() const
Returns the property definition for dynamic properties.
A double numeric parameter for distance values.
void setDefaultUnit(QgsUnitTypes::DistanceUnit unit)
Sets the default distance unit for the parameter.
static QString typeName()
Returns the type name for the parameter class.
A double numeric parameter for duration values.
void setDefaultUnit(QgsUnitTypes::TemporalUnit unit)
Sets the default duration unit for the parameter.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
An enum based parameter for processing algorithms, allowing for selection from predefined values.
static QString typeName()
Returns the type name for the parameter class.
An expression parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A rectangular map extent parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A feature sink output for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
An input feature source (such as vector layers) parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
A vector layer or feature source field parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A generic file based destination parameter, for specifying the destination path for a file (non-map l...
static QString typeName()
Returns the type name for the parameter class.
An input file or folder parameter for processing algorithms.
QString extension() const
Returns any specified file extension for the parameter.
static QString typeName()
Returns the type name for the parameter class.
void setBehavior(Behavior behavior)
Sets the parameter behavior (e.g.
Behavior behavior() const
Returns the parameter behavior (e.g.
A folder destination parameter, for specifying the destination path for a folder created by the algor...
static QString typeName()
Returns the type name for the parameter class.
A geometry parameter for processing algorithms.
void setGeometryTypes(const QList< int > &geometryTypes)
Sets the allowed geometryTypes, as a list of QgsWkbTypes::GeometryType values.
bool allowMultipart() const
Returns the parameter allow multipart geometries.
QList< int > geometryTypes() const
Returns the parameter allowed geometries, as a list of QgsWkbTypes::GeometryType values.
void setAllowMultipart(bool allowMultipart)
Sets the allow multipart geometries.
static QString typeName()
Returns the type name for the parameter class.
A print layout item parameter, allowing users to select a particular item from a print layout.
static QString typeName()
Returns the type name for the parameter class.
A print layout parameter, allowing users to select a print layout.
static QString typeName()
Returns the type name for the parameter class.
Can be inherited by parameters which require limits to their acceptable data types.
QList< int > mDataTypes
List of acceptable data types for the parameter.
A map layer parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A map theme parameter for processing algorithms, allowing users to select an existing map theme from ...
static QString typeName()
Returns the type name for the parameter class.
A table (matrix) parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
A mesh layer parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A parameter for processing algorithms which accepts multiple map layers.
static QString typeName()
Returns the type name for the parameter class.
A numeric parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A point cloud layer destination parameter, for specifying the destination path for a point cloud laye...
static QString typeName()
Returns the type name for the parameter class.
A point cloud layer parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A point parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A data provider connection parameter for processing algorithms, allowing users to select from availab...
static QString typeName()
Returns the type name for the parameter class.
void setProviderId(const QString &provider)
Sets the ID of the provider associated with the connections.
QString providerId() const
Returns the ID of the provider associated with the connections.
A numeric range parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A raster layer destination parameter, for specifying the destination path for a raster layer created ...
static QString typeName()
Returns the type name for the parameter class.
A raster layer parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A double numeric parameter for map scale values.
static QString typeName()
Returns the type name for the parameter class.
A string parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
A vector layer destination parameter, for specifying the destination path for a vector layer created ...
static QString typeName()
Returns the type name for the parameter class.
A vector layer (with or without geometry) parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
A collection of utilities for working with parameters when running a processing algorithm.
Abstract base class for processing providers.
LayerHint
Layer type hints.
@ UnknownType
Unknown layer type.
Contains enumerations and other constants for use in processing algorithms and parameters.
Definition: qgsprocessing.h:40
PythonOutputType
Available Python output types.
Definition: qgsprocessing.h:63
@ PythonQgsProcessingAlgorithmSubclass
Full Python QgsProcessingAlgorithm subclass.
Definition: qgsprocessing.h:64
SourceType
Data source types enum.
Definition: qgsprocessing.h:46
@ TypeVectorAnyGeometry
Any vector layer with geometry.
Definition: qgsprocessing.h:48
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition: qgsproject.h:104
Definition for a property.
Definition: qgsproperty.h:47
A store for object properties.
Definition: qgsproperty.h:231
Represents a raster layer.
A rectangle specified with double values.
Definition: qgsrectangle.h:42
Defines the parameters used to remap features when creating a QgsRemappingProxyFeatureSink.
Helper functions for various unit types.
Definition: qgsunittypes.h:39
DistanceUnit
Units of distance.
Definition: qgsunittypes.h:68
@ DistanceUnknownUnit
Unknown distance unit.
Definition: qgsunittypes.h:78
TemporalUnit
Temporal units.
Definition: qgsunittypes.h:150
@ TemporalMilliseconds
Milliseconds.
Definition: qgsunittypes.h:151
Represents a vector layer which manages a vector based data sets.
Type
The WKB type describes the number of dimensions a geometry has.
Definition: qgswkbtypes.h:70
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into allowing algorithms to be written in pure substantial changes are required in order to port existing x Processing algorithms for QGIS x The most significant changes are outlined not GeoAlgorithm For algorithms which operate on features one by consider subclassing the QgsProcessingFeatureBasedAlgorithm class This class allows much of the boilerplate code for looping over features from a vector layer to be bypassed and instead requires implementation of a processFeature method Ensure that your algorithm(or algorithm 's parent class) implements the new pure virtual createInstance(self) call
#define SIP_THROW(name)
Definition: qgis_sip.h:198
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition: qgis_sip.h:186
#define SIP_SKIP
Definition: qgis_sip.h:126
#define SIP_OUT
Definition: qgis_sip.h:58
#define SIP_FACTORY
Definition: qgis_sip.h:76
#define SIP_END
Definition: qgis_sip.h:203
Q_DECLARE_METATYPE(QgsDatabaseQueryLogEntry)
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsField::ConfigurationFlags) CORE_EXPORT QDataStream &operator<<(QDataStream &out
Writes the field to stream out. QGIS version compatibility is not guaranteed.
QList< const QgsProcessingParameterDefinition * > QgsProcessingParameterDefinitions
List of processing parameters.
const QgsCoordinateReferenceSystem & crs
const QString & typeName