QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
Loading...
Searching...
No Matches
qgsprocessingparameters.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsprocessingparameters.h
3 -------------------------
4 begin : April 2017
5 copyright : (C) 2017 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSPROCESSINGPARAMETERS_H
19#define QGSPROCESSINGPARAMETERS_H
20
21#include "qgis_core.h"
22#include "qgis.h"
23#include "qgsprocessing.h"
24#include "qgsproperty.h"
26#include "qgsprocessingutils.h"
29#include <QMap>
30#include <limits>
31
34class QgsRasterLayer;
35class QgsMeshLayer;
36class QgsVectorLayer;
37class QgsFeatureSink;
42class QgsPrintLayout;
43class QgsLayoutItem;
46
57{
58 public:
59
64 enum Flag
65 {
66 FlagOverrideDefaultGeometryCheck = 1 << 0,
67 FlagCreateIndividualOutputPerInputFeature = 1 << 1,
68 };
69 Q_DECLARE_FLAGS( Flags, Flag )
70
71
87 QgsProcessingFeatureSourceDefinition( const QString &source = QString(), bool selectedFeaturesOnly = false, long long featureLimit = -1,
88 QgsProcessingFeatureSourceDefinition::Flags flags = QgsProcessingFeatureSourceDefinition::Flags(), QgsFeatureRequest::InvalidGeometryCheck geometryCheck = QgsFeatureRequest::GeometryAbortOnInvalid, const QString &filterExpression = QString() )
89 : source( QgsProperty::fromValue( source ) )
90 , selectedFeaturesOnly( selectedFeaturesOnly )
91 , featureLimit( featureLimit )
92 , filterExpression( filterExpression )
93 , flags( flags )
94 , geometryCheck( geometryCheck )
95 {}
96
113 QgsProcessingFeatureSourceDefinition( const QgsProperty &source, bool selectedFeaturesOnly = false, long long featureLimit = -1,
114 QgsProcessingFeatureSourceDefinition::Flags flags = QgsProcessingFeatureSourceDefinition::Flags(), QgsFeatureRequest::InvalidGeometryCheck geometryCheck = QgsFeatureRequest::GeometryAbortOnInvalid, const QString &filterExpression = QString() )
115 : source( source )
116 , selectedFeaturesOnly( selectedFeaturesOnly )
117 , featureLimit( featureLimit )
118 , filterExpression( filterExpression )
119 , flags( flags )
120 , geometryCheck( geometryCheck )
121 {}
122
127
132
139 long long featureLimit = -1;
140
147
153 Flags flags = Flags();
154
164
171 QVariant toVariant() const;
172
179 bool loadVariant( const QVariantMap &map );
180
181 // TODO c++20 - replace with = default
183 {
184 return source == other.source
185 && selectedFeaturesOnly == other.selectedFeaturesOnly
186 && featureLimit == other.featureLimit
187 && filterExpression == other.filterExpression
188 && flags == other.flags
189 && geometryCheck == other.geometryCheck;
190 }
191
193 {
194 return !( *this == other );
195 }
196
198 operator QVariant() const
199 {
200 return QVariant::fromValue( *this );
201 }
202
203};
204
206Q_DECLARE_OPERATORS_FOR_FLAGS( QgsProcessingFeatureSourceDefinition::Flags )
207
208
218{
219 public:
220
226 QgsProcessingOutputLayerDefinition( const QString &sink = QString(), QgsProject *destinationProject = nullptr )
227 : sink( QgsProperty::fromValue( sink ) )
228 , destinationProject( destinationProject )
229 {}
230
236 QgsProcessingOutputLayerDefinition( const QgsProperty &sink, QgsProject *destinationProject = nullptr )
237 : sink( sink )
238 , destinationProject( destinationProject )
239 {}
240
245
251 QgsProject *destinationProject = nullptr;
252
257
264 QVariantMap createOptions;
265
272 bool useRemapping() const { return mUseRemapping; }
273
281 QgsRemappingSinkDefinition remappingDefinition() const { return mRemappingDefinition; }
282
293 void setRemappingDefinition( const QgsRemappingSinkDefinition &definition );
294
301 QVariant toVariant() const;
302
309 bool loadVariant( const QVariantMap &map );
310
312 operator QVariant() const
313 {
314 return QVariant::fromValue( *this );
315 }
316
317 // TODO c++20 - replace with = default
318 bool operator==( const QgsProcessingOutputLayerDefinition &other ) const;
319 bool operator!=( const QgsProcessingOutputLayerDefinition &other ) const;
320
321 private:
322
323 bool mUseRemapping = false;
325
326};
327
329
330
331
332
333//
334// Parameter definitions
335//
336
337
350{
351
352#ifdef SIP_RUN
353 % TypeHeaderCode
360 % End
362 if ( sipCpp->type() == QgsProcessingParameterBoolean::typeName() )
363 sipType = sipType_QgsProcessingParameterBoolean;
364 else if ( sipCpp->type() == QgsProcessingParameterCrs::typeName() )
365 sipType = sipType_QgsProcessingParameterCrs;
366 else if ( sipCpp->type() == QgsProcessingParameterMapLayer::typeName() )
367 sipType = sipType_QgsProcessingParameterMapLayer;
368 else if ( sipCpp->type() == QgsProcessingParameterExtent::typeName() )
369 sipType = sipType_QgsProcessingParameterExtent;
370 else if ( sipCpp->type() == QgsProcessingParameterPoint::typeName() )
371 sipType = sipType_QgsProcessingParameterPoint;
372 else if ( sipCpp->type() == QgsProcessingParameterGeometry::typeName() )
373 sipType = sipType_QgsProcessingParameterGeometry;
374 else if ( sipCpp->type() == QgsProcessingParameterFile::typeName() )
375 sipType = sipType_QgsProcessingParameterFile;
376 else if ( sipCpp->type() == QgsProcessingParameterMatrix::typeName() )
377 sipType = sipType_QgsProcessingParameterMatrix;
378 else if ( sipCpp->type() == QgsProcessingParameterMultipleLayers::typeName() )
379 sipType = sipType_QgsProcessingParameterMultipleLayers;
380 else if ( sipCpp->type() == QgsProcessingParameterNumber::typeName() )
381 sipType = sipType_QgsProcessingParameterNumber;
382 else if ( sipCpp->type() == QgsProcessingParameterDistance::typeName() )
383 sipType = sipType_QgsProcessingParameterDistance;
384 else if ( sipCpp->type() == QgsProcessingParameterDuration::typeName() )
385 sipType = sipType_QgsProcessingParameterDuration;
386 else if ( sipCpp->type() == QgsProcessingParameterScale::typeName() )
387 sipType = sipType_QgsProcessingParameterScale;
388 else if ( sipCpp->type() == QgsProcessingParameterRange::typeName() )
389 sipType = sipType_QgsProcessingParameterRange;
390 else if ( sipCpp->type() == QgsProcessingParameterRasterLayer::typeName() )
391 sipType = sipType_QgsProcessingParameterRasterLayer;
392 else if ( sipCpp->type() == QgsProcessingParameterMeshLayer::typeName() )
393 sipType = sipType_QgsProcessingParameterMeshLayer;
394 else if ( sipCpp->type() == QgsProcessingParameterEnum::typeName() )
395 sipType = sipType_QgsProcessingParameterEnum;
396 else if ( sipCpp->type() == QgsProcessingParameterString::typeName() )
397 sipType = sipType_QgsProcessingParameterString;
398 else if ( sipCpp->type() == QgsProcessingParameterExpression::typeName() )
399 sipType = sipType_QgsProcessingParameterExpression;
400 else if ( sipCpp->type() == QgsProcessingParameterAuthConfig::typeName() )
401 sipType = sipType_QgsProcessingParameterAuthConfig;
402 else if ( sipCpp->type() == QgsProcessingParameterVectorLayer::typeName() )
403 sipType = sipType_QgsProcessingParameterVectorLayer;
404 else if ( sipCpp->type() == QgsProcessingParameterField::typeName() )
405 sipType = sipType_QgsProcessingParameterField;
406 else if ( sipCpp->type() == QgsProcessingParameterFeatureSource::typeName() )
407 sipType = sipType_QgsProcessingParameterFeatureSource;
408 else if ( sipCpp->type() == QgsProcessingParameterFeatureSink::typeName() )
409 sipType = sipType_QgsProcessingParameterFeatureSink;
410 else if ( sipCpp->type() == QgsProcessingParameterVectorDestination::typeName() )
411 sipType = sipType_QgsProcessingParameterVectorDestination;
412 else if ( sipCpp->type() == QgsProcessingParameterRasterDestination::typeName() )
413 sipType = sipType_QgsProcessingParameterRasterDestination;
414 else if ( sipCpp->type() == QgsProcessingParameterPointCloudDestination::typeName() )
415 sipType = sipType_QgsProcessingParameterPointCloudDestination;
416 else if ( sipCpp->type() == QgsProcessingParameterFileDestination::typeName() )
417 sipType = sipType_QgsProcessingParameterFileDestination;
418 else if ( sipCpp->type() == QgsProcessingParameterFolderDestination::typeName() )
419 sipType = sipType_QgsProcessingParameterFolderDestination;
420 else if ( sipCpp->type() == QgsProcessingParameterBand::typeName() )
421 sipType = sipType_QgsProcessingParameterBand;
422 else if ( sipCpp->type() == QgsProcessingParameterLayout::typeName() )
423 sipType = sipType_QgsProcessingParameterLayout;
424 else if ( sipCpp->type() == QgsProcessingParameterLayoutItem::typeName() )
425 sipType = sipType_QgsProcessingParameterLayoutItem;
426 else if ( sipCpp->type() == QgsProcessingParameterColor::typeName() )
427 sipType = sipType_QgsProcessingParameterColor;
428 else if ( sipCpp->type() == QgsProcessingParameterCoordinateOperation::typeName() )
429 sipType = sipType_QgsProcessingParameterCoordinateOperation;
430 else if ( sipCpp->type() == QgsProcessingParameterMapTheme::typeName() )
431 sipType = sipType_QgsProcessingParameterMapTheme;
432 else if ( sipCpp->type() == QgsProcessingParameterDateTime::typeName() )
433 sipType = sipType_QgsProcessingParameterDateTime;
434 else if ( sipCpp->type() == QgsProcessingParameterProviderConnection::typeName() )
435 sipType = sipType_QgsProcessingParameterProviderConnection;
436 else if ( sipCpp->type() == QgsProcessingParameterDatabaseSchema::typeName() )
437 sipType = sipType_QgsProcessingParameterDatabaseSchema;
438 else if ( sipCpp->type() == QgsProcessingParameterDatabaseTable::typeName() )
439 sipType = sipType_QgsProcessingParameterDatabaseTable;
440 else if ( sipCpp->type() == QgsProcessingParameterFieldMapping::typeName() )
441 sipType = sipType_QgsProcessingParameterFieldMapping;
442 else if ( sipCpp->type() == QgsProcessingParameterTinInputLayers::typeName() )
443 sipType = sipType_QgsProcessingParameterTinInputLayers;
444 else if ( sipCpp->type() == QgsProcessingParameterVectorTileWriterLayers::typeName() )
445 sipType = sipType_QgsProcessingParameterVectorTileWriterLayers;
446 else if ( sipCpp->type() == QgsProcessingParameterDxfLayers::typeName() )
447 sipType = sipType_QgsProcessingParameterDxfLayers;
448 else if ( sipCpp->type() == QgsProcessingParameterMeshDatasetGroups::typeName() )
449 sipType = sipType_QgsProcessingParameterMeshDatasetGroups;
450 else if ( sipCpp->type() == QgsProcessingParameterMeshDatasetTime::typeName() )
451 sipType = sipType_QgsProcessingParameterMeshDatasetTime;
452 else if ( sipCpp->type() == QgsProcessingParameterPointCloudLayer::typeName() )
453 sipType = sipType_QgsProcessingParameterPointCloudLayer;
454 else if ( sipCpp->type() == QgsProcessingParameterAnnotationLayer::typeName() )
455 sipType = sipType_QgsProcessingParameterAnnotationLayer;
456 else if ( sipCpp->type() == QgsProcessingParameterPointCloudAttribute::typeName() )
457 sipType = sipType_QgsProcessingParameterPointCloudAttribute;
458 else if ( sipCpp->type() == QgsProcessingParameterVectorTileDestination::typeName() )
459 sipType = sipType_QgsProcessingParameterVectorTileDestination;
460 else
461 sipType = nullptr;
462 SIP_END
463#endif
464
465 public:
466
468 enum Flag
469 {
470 FlagAdvanced = 1 << 1,
471 FlagHidden = 1 << 2,
472 FlagOptional = 1 << 3,
473 FlagIsModelOutput = 1 << 4,
474 };
475 Q_DECLARE_FLAGS( Flags, Flag )
476
477
480 QgsProcessingParameterDefinition( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
481 bool optional = false, const QString &help = QString() );
482
484
489
493 virtual QString type() const = 0;
494
500 virtual bool isDestination() const { return false; }
501
507 QString name() const { return mName; }
508
514 void setName( const QString &name ) { mName = name; }
515
521 QString description() const { return mDescription; }
522
528 void setDescription( const QString &description ) { mDescription = description; }
529
539 QString help() const { return mHelp; }
540
550 void setHelp( const QString &help ) { mHelp = help; }
551
558 QVariant defaultValue() const { return mDefault; }
559
566 void setDefaultValue( const QVariant &value ) { mDefault = value; }
567
580 QVariant guiDefaultValueOverride() const;
581
597 void setGuiDefaultValueOverride( const QVariant &value ) { mGuiDefault = value; }
598
607 QVariant defaultValueForGui() const;
608
613 Flags flags() const { return mFlags; }
614
619 void setFlags( Flags flags ) { mFlags = flags; }
620
628 virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const;
629
637 virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
638
650 virtual QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const;
651
665 virtual QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const;
666
680 virtual QStringList valueAsStringList( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const;
681
687 virtual QString valueAsPythonComment( const QVariant &value, QgsProcessingContext &context ) const;
688
693 virtual QString asScriptCode() const;
694
704 virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const;
705
711 virtual QVariantMap toVariantMap() const;
712
718 virtual bool fromVariantMap( const QVariantMap &map );
719
726 SIP_SKIP QVariantMap metadata() const { return mMetadata; }
727
733 QVariantMap &metadata() { return mMetadata; }
734
740 void setMetadata( const QVariantMap &metadata ) { mMetadata = metadata; }
741
746 virtual QStringList dependsOnOtherParameters() const { return QStringList(); }
747
754
760 QgsProcessingProvider *provider() const;
761
766 virtual QString toolTip() const;
767
775 bool isDynamic() const { return mIsDynamic; }
776
784 void setIsDynamic( bool dynamic ) { mIsDynamic = dynamic; }
785
792 QgsPropertyDefinition dynamicPropertyDefinition() const { return mPropertyDefinition; }
793
800 void setDynamicPropertyDefinition( const QgsPropertyDefinition &definition ) { mPropertyDefinition = definition; }
801
813 QString dynamicLayerParameterName() const { return mDynamicLayerParameterName; }
814
826 void setDynamicLayerParameterName( const QString &name ) { mDynamicLayerParameterName = name; }
827
841 QStringList additionalExpressionContextVariables() const { return mAdditionalExpressionVariables; }
842
860 void setAdditionalExpressionContextVariables( const QStringList &variables ) { mAdditionalExpressionVariables = variables; }
861
862#ifndef SIP_RUN
863
871 enum class ValueAsStringFlag : int
872 {
873 AllowMapLayerValues = 1 << 0,
874 };
875 Q_DECLARE_FLAGS( ValueAsStringFlags, ValueAsStringFlag )
876#endif
877
878 protected:
879
880#ifndef SIP_RUN
881
888 QString valueAsStringPrivate( const QVariant &value, QgsProcessingContext &context, bool &ok, ValueAsStringFlags flags ) const;
889
896 QVariant valueAsJsonObjectPrivate( const QVariant &value, QgsProcessingContext &context, ValueAsStringFlags flags ) const;
897#endif
898
905 QVariant defaultGuiValueFromSetting() const;
906
908 QString mName;
909
912
914 QString mHelp;
915
917 QVariant mDefault;
918
920 QVariant mGuiDefault;
921
923 Flags mFlags;
924
926 QVariantMap mMetadata;
927
929 QgsProcessingAlgorithm *mAlgorithm = nullptr;
930
932 bool mIsDynamic = false;
933
936
939
942
943 // To allow access to mAlgorithm. We don't want a public setter for this!
945
946};
947
948Q_DECLARE_OPERATORS_FOR_FLAGS( QgsProcessingParameterDefinition::Flags )
949
950#ifndef SIP_RUN
951Q_DECLARE_OPERATORS_FOR_FLAGS( QgsProcessingParameterDefinition::ValueAsStringFlags )
952#endif
953
955typedef QList< const QgsProcessingParameterDefinition * > QgsProcessingParameterDefinitions;
956
975class CORE_EXPORT QgsProcessingParameters
976{
977
978 public:
979
984 static bool isDynamic( const QVariantMap &parameters, const QString &name );
985
989 static QString parameterAsString( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
990
995 static QString parameterAsString( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
996
1000 static QString parameterAsExpression( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1001
1006 static QString parameterAsExpression( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1007
1011 static double parameterAsDouble( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1012
1017 static double parameterAsDouble( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1018
1022 static int parameterAsInt( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1023
1028 static int parameterAsInt( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1029
1034 static QList<int> parameterAsInts( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1035
1040 static QList<int> parameterAsInts( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1041
1050 static QDateTime parameterAsDateTime( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1051
1060 static QDateTime parameterAsDateTime( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1061
1070 static QDate parameterAsDate( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1071
1080 static QDate parameterAsDate( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1081
1090 static QTime parameterAsTime( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1091
1100 static QTime parameterAsTime( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1101
1105 static int parameterAsEnum( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1106
1111 static int parameterAsEnum( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1112
1116 static QList<int> parameterAsEnums( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1117
1122 static QList<int> parameterAsEnums( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1123
1128 static QString parameterAsEnumString( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1129
1134 static QString parameterAsEnumString( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1135
1140 static QStringList parameterAsEnumStrings( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1141
1146 static QStringList parameterAsEnumStrings( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1147
1151 static bool parameterAsBool( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1152
1158 static bool parameterAsBoolean( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1159
1164 static bool parameterAsBool( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1165
1170 static bool parameterAsBoolean( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1171
1189 static QgsFeatureSink *parameterAsSink( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters,
1190 const QgsFields &fields, Qgis::WkbType geometryType, const QgsCoordinateReferenceSystem &crs,
1191 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;
1192
1212 static QgsFeatureSink *parameterAsSink( const QgsProcessingParameterDefinition *definition, const QVariant &value,
1213 const QgsFields &fields, Qgis::WkbType geometryType, const QgsCoordinateReferenceSystem &crs,
1214 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;
1215
1224 static QgsProcessingFeatureSource *parameterAsSource( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context ) SIP_FACTORY;
1225
1236 static QgsProcessingFeatureSource *parameterAsSource( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context ) SIP_FACTORY;
1237
1253 static QString parameterAsCompatibleSourceLayerPath( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters,
1254 QgsProcessingContext &context, const QStringList &compatibleFormats, const QString &preferredFormat = QString( "shp" ), QgsProcessingFeedback *feedback = nullptr );
1255
1285 static QString parameterAsCompatibleSourceLayerPathAndLayerName( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters,
1286 QgsProcessingContext &context, const QStringList &compatibleFormats, const QString &preferredFormat = QString( "shp" ), QgsProcessingFeedback *feedback = nullptr, QString *layerName SIP_OUT = nullptr );
1287
1295 static QgsMapLayer *parameterAsLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingUtils::LayerHint layerHint = QgsProcessingUtils::LayerHint::UnknownType, QgsProcessing::LayerOptionsFlags flags = QgsProcessing::LayerOptionsFlags() );
1296
1306 static QgsMapLayer *parameterAsLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context, QgsProcessingUtils::LayerHint layerHint = QgsProcessingUtils::LayerHint::UnknownType, QgsProcessing::LayerOptionsFlags flags = QgsProcessing::LayerOptionsFlags() );
1307
1315 static QgsRasterLayer *parameterAsRasterLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1316
1326 static QgsRasterLayer *parameterAsRasterLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1327
1331 static QString parameterAsOutputLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1332
1337 static QString parameterAsOutputLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1338
1342 static QString parameterAsFileOutput( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1343
1348 static QString parameterAsFileOutput( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1349
1357 static QgsVectorLayer *parameterAsVectorLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1358
1368 static QgsVectorLayer *parameterAsVectorLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1369
1379 static QgsMeshLayer *parameterAsMeshLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1380
1390 static QgsMeshLayer *parameterAsMeshLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1391
1395 static QgsCoordinateReferenceSystem parameterAsCrs( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1396
1401 static QgsCoordinateReferenceSystem parameterAsCrs( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1402
1412 static QgsRectangle parameterAsExtent( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context,
1414
1426 static QgsRectangle parameterAsExtent( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context,
1428
1440 static QgsGeometry parameterAsExtentGeometry( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context,
1442
1448 static QgsCoordinateReferenceSystem parameterAsExtentCrs( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1449
1455 static QgsCoordinateReferenceSystem parameterAsExtentCrs( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1456
1457
1465 static QgsPointXY parameterAsPoint( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context,
1467
1476 static QgsPointXY parameterAsPoint( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context,
1478
1484 static QgsCoordinateReferenceSystem parameterAsPointCrs( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1485
1492 static QgsCoordinateReferenceSystem parameterAsPointCrs( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1493
1499 static QgsGeometry parameterAsGeometry( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem() );
1500
1506 static QgsGeometry parameterAsGeometry( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem() );
1507
1514 static QgsCoordinateReferenceSystem parameterAsGeometryCrs( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1515
1522 static QgsCoordinateReferenceSystem parameterAsGeometryCrs( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1523
1527 static QString parameterAsFile( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1528
1533 static QString parameterAsFile( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1534
1539 static QVariantList parameterAsMatrix( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1540
1546 static QVariantList parameterAsMatrix( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1547
1552 static QList< QgsMapLayer *> parameterAsLayerList( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessing::LayerOptionsFlags flags = QgsProcessing::LayerOptionsFlags() );
1553
1559 static QList< QgsMapLayer *> parameterAsLayerList( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context, QgsProcessing::LayerOptionsFlags flags = QgsProcessing::LayerOptionsFlags() );
1560
1566 static QStringList parameterAsFileList( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1567
1573 static QStringList parameterAsFileList( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1574
1578 static QList<double> parameterAsRange( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1579
1584 static QList<double> parameterAsRange( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1585
1591 Q_DECL_DEPRECATED static QStringList parameterAsFields( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context ) SIP_DEPRECATED;
1592
1599 Q_DECL_DEPRECATED static QStringList parameterAsFields( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context ) SIP_DEPRECATED;
1600
1606 static QStringList parameterAsStrings( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1607
1613 static QStringList parameterAsStrings( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1614
1623 static QgsPrintLayout *parameterAsLayout( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1624
1633 static QgsPrintLayout *parameterAsLayout( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1634
1643 static QgsLayoutItem *parameterAsLayoutItem( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context, QgsPrintLayout *layout );
1644
1653 static QgsLayoutItem *parameterAsLayoutItem( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context, QgsPrintLayout *layout );
1654
1660 static QColor parameterAsColor( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1661
1667 static QColor parameterAsColor( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1668
1674 static QString parameterAsConnectionName( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1675
1681 static QString parameterAsConnectionName( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1682
1688 static QString parameterAsSchema( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1689
1695 static QString parameterAsSchema( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1696
1702 static QString parameterAsDatabaseTableName( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
1703
1709 static QString parameterAsDatabaseTableName( const QgsProcessingParameterDefinition *definition, const QVariant &value, const QgsProcessingContext &context );
1710
1721 static QgsPointCloudLayer *parameterAsPointCloudLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessing::LayerOptionsFlags flags = QgsProcessing::LayerOptionsFlags() );
1722
1733 static QgsPointCloudLayer *parameterAsPointCloudLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context, QgsProcessing::LayerOptionsFlags flags = QgsProcessing::LayerOptionsFlags() );
1734
1748 static QgsAnnotationLayer *parameterAsAnnotationLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
1749
1763 static QgsAnnotationLayer *parameterAsAnnotationLayer( const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context );
1764
1770 static QgsProcessingParameterDefinition *parameterFromVariantMap( const QVariantMap &map ) SIP_FACTORY;
1771
1775 static QString descriptionFromName( const QString &name );
1776
1782 static QgsProcessingParameterDefinition *parameterFromScriptCode( const QString &code ) SIP_FACTORY;
1783
1784 private:
1785
1786 static bool parseScriptCodeParameterOptions( const QString &code, bool &isOptional, QString &name, QString &type, QString &definition );
1787};
1788
1789
1790
1798{
1799 public:
1800
1804 QgsProcessingParameterBoolean( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
1805 bool optional = false );
1806
1810 static QString typeName() { return QStringLiteral( "boolean" ); }
1811 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1812 QString type() const override { return typeName(); }
1813 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1814 QString asScriptCode() const override;
1815
1819 static QgsProcessingParameterBoolean *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1820};
1821
1829{
1830 public:
1831
1835 QgsProcessingParameterCrs( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
1836 bool optional = false );
1837
1841 static QString typeName() { return QStringLiteral( "crs" ); }
1842 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1843 QString type() const override { return typeName(); }
1844 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
1845 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1846 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
1847 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
1848
1852 static QgsProcessingParameterCrs *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1853
1854};
1855
1863{
1864 public:
1865
1869 QgsProcessingParameterExtent( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
1870 bool optional = false );
1871
1875 static QString typeName() { return QStringLiteral( "extent" ); }
1876 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1877 QString type() const override { return typeName(); }
1878 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
1879 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1880 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
1881 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
1882
1886 static QgsProcessingParameterExtent *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1887
1888};
1889
1890
1898{
1899 public:
1900
1904 QgsProcessingParameterPoint( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
1905 bool optional = false );
1906
1910 static QString typeName() { return QStringLiteral( "point" ); }
1911 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1912 QString type() const override { return typeName(); }
1913 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
1914 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1915
1919 static QgsProcessingParameterPoint *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1920
1921};
1922
1930{
1931 public:
1932
1940 QgsProcessingParameterGeometry( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(), bool optional = false, const QList< int > &geometryTypes = QList< int >(), bool allowMultipart = true );
1941
1945 static QString typeName() { return QStringLiteral( "geometry" ); }
1946 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1947 QString type() const override { return typeName(); }
1948 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
1949 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1950 QString asScriptCode() const override;
1951 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
1952 QVariantMap toVariantMap() const override;
1953 bool fromVariantMap( const QVariantMap &map ) override;
1954
1959 QList<int> geometryTypes() const { return mGeomTypes; }
1960
1965 void setGeometryTypes( const QList<int> &geometryTypes ) { mGeomTypes = geometryTypes; }
1966
1971 bool allowMultipart() const { return mAllowMultipart; }
1972
1977 void setAllowMultipart( bool allowMultipart ) { mAllowMultipart = allowMultipart; }
1978
1979
1980
1984 static QgsProcessingParameterGeometry *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1985
1986 private:
1987
1988 QList<int> mGeomTypes;
1989 bool mAllowMultipart;
1990
1991};
1992
2000{
2001 public:
2002
2005 {
2006 File = 0,
2008 };
2009
2017 QgsProcessingParameterFile( const QString &name, const QString &description = QString(), Behavior behavior = File, const QString &extension = QString(), const QVariant &defaultValue = QVariant(),
2018 bool optional = false, const QString &fileFilter = QString() );
2019
2023 static QString typeName() { return QStringLiteral( "file" ); }
2024 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2025 QString type() const override { return typeName(); }
2026 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2027 QString asScriptCode() const override;
2028 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2029 QString createFileFilter() const override;
2030
2035 Behavior behavior() const { return mBehavior; }
2036
2041 void setBehavior( Behavior behavior ) { mBehavior = behavior; }
2042
2050 QString extension() const { return mExtension; }
2051
2061 void setExtension( const QString &extension );
2062
2069 QString fileFilter() const;
2070
2080 void setFileFilter( const QString &filter );
2081
2082 QVariantMap toVariantMap() const override;
2083 bool fromVariantMap( const QVariantMap &map ) override;
2084
2088 static QgsProcessingParameterFile *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition, Behavior behavior = File ) SIP_FACTORY;
2089
2090 private:
2091
2092 Behavior mBehavior = File;
2093 QString mExtension;
2094 QString mFileFilter;
2095};
2096
2104{
2105 public:
2106
2110 QgsProcessingParameterMatrix( const QString &name, const QString &description = QString(), int numberRows = 3,
2111 bool hasFixedNumberRows = false, const QStringList &headers = QStringList(),
2112 const QVariant &defaultValue = QVariant(),
2113 bool optional = false );
2114
2118 static QString typeName() { return QStringLiteral( "matrix" ); }
2119 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2120 QString type() const override { return typeName(); }
2121 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2122 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2123 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2124
2129 QStringList headers() const;
2130
2135 void setHeaders( const QStringList &headers );
2136
2143 int numberRows() const;
2144
2151 void setNumberRows( int rows );
2152
2158 bool hasFixedNumberRows() const;
2159
2165 void setHasFixedNumberRows( bool hasFixedNumberRows );
2166
2167 QVariantMap toVariantMap() const override;
2168 bool fromVariantMap( const QVariantMap &map ) override;
2169
2173 static QgsProcessingParameterMatrix *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2174
2175 private:
2176
2177 QStringList mHeaders;
2178 int mNumberRows = 3;
2179 bool mFixedNumberRows = false;
2180
2181};
2182
2190{
2191 public:
2192
2196 QgsProcessingParameterMultipleLayers( const QString &name, const QString &description = QString(), QgsProcessing::SourceType layerType = QgsProcessing::TypeVectorAnyGeometry,
2197 const QVariant &defaultValue = QVariant(),
2198 bool optional = false );
2199
2203 static QString typeName() { return QStringLiteral( "multilayer" ); }
2204 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2205 QString type() const override { return typeName(); }
2206 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2207 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2208 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
2209 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
2210 QString asScriptCode() const override;
2211 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2212 QString createFileFilter() const override;
2213
2218 QgsProcessing::SourceType layerType() const;
2219
2224 void setLayerType( QgsProcessing::SourceType type );
2225
2231 int minimumNumberInputs() const;
2232
2238 void setMinimumNumberInputs( int minimum );
2239
2240 QVariantMap toVariantMap() const override;
2241 bool fromVariantMap( const QVariantMap &map ) override;
2242
2246 static QgsProcessingParameterMultipleLayers *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2247
2248 private:
2249
2251 int mMinimumNumberInputs = 0;
2252
2253};
2254
2274{
2275 public:
2276
2278 enum Type
2279 {
2282 };
2283
2287 explicit QgsProcessingParameterNumber( const QString &name, const QString &description = QString(),
2288 Type type = Integer,
2289 const QVariant &defaultValue = QVariant(),
2290 bool optional = false,
2291 double minValue = std::numeric_limits<double>::lowest() + 1,
2292 double maxValue = std::numeric_limits<double>::max()
2293 );
2294
2298 static QString typeName() { return QStringLiteral( "number" ); }
2299 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2300 QString type() const override { return typeName(); }
2301 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2302 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2303 QString toolTip() const override;
2304 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2305
2310 double minimum() const;
2311
2316 void setMinimum( double minimum );
2317
2322 double maximum() const;
2323
2328 void setMaximum( double maximum );
2329
2334 Type dataType() const;
2335
2340 void setDataType( Type type );
2341
2342 QVariantMap toVariantMap() const override;
2343 bool fromVariantMap( const QVariantMap &map ) override;
2344
2348 static QgsProcessingParameterNumber *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2349
2350 private:
2351
2352 double mMin = std::numeric_limits<double>::lowest() + 1;
2353 double mMax = std::numeric_limits<double>::max();
2354 Type mDataType = Integer;
2355};
2356
2377{
2378 public:
2379
2383 explicit QgsProcessingParameterDistance( const QString &name, const QString &description = QString(),
2384 const QVariant &defaultValue = QVariant(),
2385 const QString &parentParameterName = QString(),
2386 bool optional = false,
2387 double minValue = std::numeric_limits<double>::lowest() + 1,
2388 double maxValue = std::numeric_limits<double>::max() );
2389
2393 static QString typeName() { return QStringLiteral( "distance" ); }
2394
2395 QgsProcessingParameterDistance *clone() const override SIP_FACTORY;
2396
2397 QString type() const override;
2398 QStringList dependsOnOtherParameters() const override;
2399 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2400
2405 QString parentParameterName() const;
2406
2411 void setParentParameterName( const QString &parentParameterName );
2412
2419 Qgis::DistanceUnit defaultUnit() const { return mDefaultUnit; }
2420
2427 void setDefaultUnit( Qgis::DistanceUnit unit ) { mDefaultUnit = unit; }
2428
2429 QVariantMap toVariantMap() const override;
2430 bool fromVariantMap( const QVariantMap &map ) override;
2431
2432 private:
2433
2434 QString mParentParameterName;
2436
2437};
2438
2447{
2448 public:
2449
2453 explicit QgsProcessingParameterDuration( const QString &name, const QString &description = QString(),
2454 const QVariant &defaultValue = QVariant(),
2455 bool optional = false,
2456 double minValue = std::numeric_limits<double>::lowest() + 1,
2457 double maxValue = std::numeric_limits<double>::max() );
2458
2462 static QString typeName() { return QStringLiteral( "duration" ); }
2463
2464 QgsProcessingParameterDuration *clone() const override SIP_FACTORY;
2465
2466 QString type() const override;
2467 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2468
2474 Qgis::TemporalUnit defaultUnit() const { return mDefaultUnit; }
2475
2481 void setDefaultUnit( Qgis::TemporalUnit unit ) { mDefaultUnit = unit; }
2482
2483 QVariantMap toVariantMap() const override;
2484 bool fromVariantMap( const QVariantMap &map ) override;
2485
2486 private:
2487
2489
2490};
2491
2503{
2504 public:
2505
2509 explicit QgsProcessingParameterScale( const QString &name, const QString &description = QString(),
2510 const QVariant &defaultValue = QVariant(),
2511 bool optional = false );
2512
2516 static QString typeName() { return QStringLiteral( "scale" ); }
2517
2518 QgsProcessingParameterScale *clone() const override SIP_FACTORY;
2519
2520 QString type() const override;
2521 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2522
2526 static QgsProcessingParameterScale *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2527
2528};
2529
2537{
2538 public:
2539
2543 QgsProcessingParameterRange( const QString &name, const QString &description = QString(),
2545 const QVariant &defaultValue = QVariant(),
2546 bool optional = false );
2547
2551 static QString typeName() { return QStringLiteral( "range" ); }
2552 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2553 QString type() const override { return typeName(); }
2554 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2555 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2556 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2557
2562 QgsProcessingParameterNumber::Type dataType() const;
2563
2568 void setDataType( QgsProcessingParameterNumber::Type dataType );
2569
2570 QVariantMap toVariantMap() const override;
2571 bool fromVariantMap( const QVariantMap &map ) override;
2572
2576 static QgsProcessingParameterRange *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2577
2578 private:
2579
2581};
2582
2590{
2591 public:
2592
2596 QgsProcessingParameterRasterLayer( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
2597 bool optional = false );
2598
2602 static QString typeName() { return QStringLiteral( "raster" ); }
2603 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2604 QString type() const override { return typeName(); }
2605 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2606 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2607 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
2608 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
2609 QString createFileFilter() const override;
2610
2614 static QgsProcessingParameterRasterLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2615
2616};
2617
2637{
2638 public:
2639
2643 QgsProcessingParameterEnum( const QString &name, const QString &description = QString(), const QStringList &options = QStringList(),
2644 bool allowMultiple = false,
2645 const QVariant &defaultValue = QVariant(),
2646 bool optional = false,
2647 bool usesStaticStrings = false );
2648
2652 static QString typeName() { return QStringLiteral( "enum" ); }
2653 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2654 QString type() const override { return typeName(); }
2655 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2656 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2657 QString valueAsPythonComment( const QVariant &value, QgsProcessingContext &context ) const override;
2658 QString asScriptCode() const override;
2659 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2660
2665 QStringList options() const;
2666
2671 void setOptions( const QStringList &options );
2672
2677 bool allowMultiple() const;
2678
2683 void setAllowMultiple( bool allowMultiple );
2684
2691 bool usesStaticStrings() const;
2692
2699 void setUsesStaticStrings( bool usesStaticStrings );
2700
2701 QVariantMap toVariantMap() const override;
2702 bool fromVariantMap( const QVariantMap &map ) override;
2703
2707 static QgsProcessingParameterEnum *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2708
2709 private:
2710
2711 QStringList mOptions;
2712 bool mAllowMultiple = false;
2713 bool mUsesStaticStrings = false;
2714};
2715
2744{
2745 public:
2746
2750 QgsProcessingParameterString( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
2751 bool multiLine = false,
2752 bool optional = false );
2753
2757 static QString typeName() { return QStringLiteral( "string" ); }
2758 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2759 QString type() const override { return typeName(); }
2760 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2761 QString asScriptCode() const override;
2762 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2763
2768 bool multiLine() const;
2769
2774 void setMultiLine( bool multiLine );
2775
2776 QVariantMap toVariantMap() const override;
2777 bool fromVariantMap( const QVariantMap &map ) override;
2778
2782 static QgsProcessingParameterString *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2783
2784 private:
2785
2786 bool mMultiLine = false;
2787
2788};
2789
2790
2804{
2805 public:
2806
2810 QgsProcessingParameterAuthConfig( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
2811 bool optional = false );
2812
2816 static QString typeName() { return QStringLiteral( "authcfg" ); }
2817 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2818 QString type() const override { return typeName(); }
2819 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2820 QString asScriptCode() const override;
2821
2825 static QgsProcessingParameterAuthConfig *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2826
2827};
2828
2836{
2837 public:
2838
2842 QgsProcessingParameterExpression( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
2843 const QString &parentLayerParameterName = QString(),
2844 bool optional = false, Qgis::ExpressionType type = Qgis::ExpressionType::Qgis );
2845
2849 static QString typeName() { return QStringLiteral( "expression" ); }
2850 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2851 QString type() const override { return typeName(); }
2852 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2853 QStringList dependsOnOtherParameters() const override;
2854 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2855
2860 QString parentLayerParameterName() const;
2861
2866 void setParentLayerParameterName( const QString &parentLayerParameterName );
2867
2874 Qgis::ExpressionType expressionType() const;
2875
2882 void setExpressionType( Qgis::ExpressionType type );
2883
2884 QVariantMap toVariantMap() const override;
2885 bool fromVariantMap( const QVariantMap &map ) override;
2886
2890 static QgsProcessingParameterExpression *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2891
2892 private:
2893
2894 QString mParentLayerParameterName;
2896};
2897
2898
2906{
2907 public:
2908
2912 QgsProcessingParameterLimitedDataTypes( const QList< int > &types = QList< int >() );
2913
2918 QList< int > dataTypes() const;
2919
2924 void setDataTypes( const QList< int > &types );
2925
2926 protected:
2927
2929 QList< int > mDataTypes;
2930};
2931
2940{
2941 public:
2942
2946 QgsProcessingParameterVectorLayer( const QString &name,
2947 const QString &description = QString(),
2948 const QList< int > &types = QList< int >(),
2949 const QVariant &defaultValue = QVariant(),
2950 bool optional = false );
2951
2955 static QString typeName() { return QStringLiteral( "vector" ); }
2956 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2957 QString type() const override { return typeName(); }
2958 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2959 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2960 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
2961 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
2962 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2963 QString createFileFilter() const override;
2964
2965 QVariantMap toVariantMap() const override;
2966 bool fromVariantMap( const QVariantMap &map ) override;
2967
2971 static QgsProcessingParameterVectorLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2972
2973};
2974
2982{
2983 public:
2984
2988 QgsProcessingParameterMeshLayer( const QString &name,
2989 const QString &description = QString(),
2990 const QVariant &defaultValue = QVariant(),
2991 bool optional = false );
2992
2996 static QString typeName() { return QStringLiteral( "mesh" ); }
2997 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2998 QString type() const override { return typeName(); }
2999 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3000 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3001 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
3002 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
3003 QString createFileFilter() const override;
3004
3008 static QgsProcessingParameterMeshLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3009};
3010
3018{
3019 public:
3020
3024 QgsProcessingParameterMapLayer( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
3025 bool optional = false,
3026 const QList< int > &types = QList< int >() );
3027
3031 static QString typeName() { return QStringLiteral( "layer" ); }
3032 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3033 QString type() const override { return typeName(); }
3034 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3035 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3036 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
3037 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
3038 QString asScriptCode() const override;
3039 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3040 QString createFileFilter() const override;
3041
3042 QVariantMap toVariantMap() const override;
3043 bool fromVariantMap( const QVariantMap &map ) override;
3044
3048 static QgsProcessingParameterMapLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3049
3050};
3051
3059{
3060 public:
3061
3064 {
3065 Any = -1,
3066 Numeric = 0,
3067 String = 1,
3068 DateTime = 2,
3069 Binary = 3,
3070 Boolean = 4,
3071 };
3072
3076 QgsProcessingParameterField( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
3077 const QString &parentLayerParameterName = QString(),
3078 DataType type = Any,
3079 bool allowMultiple = false,
3080 bool optional = false,
3081 bool defaultToAllFields = false );
3082
3086 static QString typeName() { return QStringLiteral( "field" ); }
3087 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3088 QString type() const override { return typeName(); }
3089 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3090 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3091 QString asScriptCode() const override;
3092 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3093 QStringList dependsOnOtherParameters() const override;
3094
3099 QString parentLayerParameterName() const;
3100
3105 void setParentLayerParameterName( const QString &parentLayerParameterName );
3106
3111 DataType dataType() const;
3112
3117 void setDataType( DataType type );
3118
3123 bool allowMultiple() const;
3124
3129 void setAllowMultiple( bool allowMultiple );
3130
3140 bool defaultToAllFields() const;
3141
3151 void setDefaultToAllFields( bool enabled );
3152
3153 QVariantMap toVariantMap() const override;
3154 bool fromVariantMap( const QVariantMap &map ) override;
3155
3159 static QgsProcessingParameterField *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3160
3161 private:
3162
3163 QString mParentLayerParameterName;
3164 DataType mDataType = Any;
3165 bool mAllowMultiple = false;
3166 bool mDefaultToAllFields = false;
3167
3168};
3169
3170
3178{
3179 public:
3180
3184 QgsProcessingParameterFeatureSource( const QString &name, const QString &description = QString(),
3185 const QList< int > &types = QList< int >(),
3186 const QVariant &defaultValue = QVariant(), bool optional = false );
3187
3191 static QString typeName() { return QStringLiteral( "source" ); }
3192 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3193 QString type() const override { return typeName(); }
3194 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3195 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3196 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
3197 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
3198 QString asScriptCode() const override;
3199 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3200 QString createFileFilter() const override;
3201
3202 QVariantMap toVariantMap() const override;
3203 bool fromVariantMap( const QVariantMap &map ) override;
3204
3208 static QgsProcessingParameterFeatureSource *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3209
3210};
3211
3220{
3221 public:
3222
3229 QgsProcessingDestinationParameter( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
3230 bool optional = false, bool createByDefault = true );
3231
3232 bool isDestination() const override { return true; }
3233 QVariantMap toVariantMap() const override;
3234 bool fromVariantMap( const QVariantMap &map ) override;
3235 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3236 QString createFileFilter() const override;
3237
3243
3249 bool supportsNonFileBasedOutput() const { return mSupportsNonFileBasedOutputs; }
3250
3256 void setSupportsNonFileBasedOutput( bool supportsNonFileBasedOutput ) { mSupportsNonFileBasedOutputs = supportsNonFileBasedOutput; }
3257
3262 virtual QString defaultFileExtension() const = 0;
3263
3269 virtual QString generateTemporaryDestination( const QgsProcessingContext *context = nullptr ) const;
3270
3285 virtual bool isSupportedOutputValue( const QVariant &value, QgsProcessingContext &context, QString &error SIP_OUT ) const;
3286
3292 bool createByDefault() const;
3293
3299 void setCreateByDefault( bool createByDefault );
3300
3301 protected:
3302
3311 QgsProcessingProvider *originalProvider() const { return mOriginalProvider; }
3312
3313 private:
3314
3322 QgsProcessingProvider *mOriginalProvider = nullptr;
3323
3324 bool mSupportsNonFileBasedOutputs = true;
3325 bool mCreateByDefault = true;
3326
3327 friend class QgsProcessingModelAlgorithm;
3328 friend class TestQgsProcessing;
3329 friend class TestQgsProcessingModelAlgorithm;
3330};
3331
3332
3342{
3343 public:
3344
3351 QgsProcessingParameterFeatureSink( const QString &name, const QString &description = QString(), QgsProcessing::SourceType type = QgsProcessing::TypeVectorAnyGeometry, const QVariant &defaultValue = QVariant(),
3352 bool optional = false, bool createByDefault = true, bool supportsAppend = false );
3353
3357 static QString typeName() { return QStringLiteral( "sink" ); }
3358 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3359 QString type() const override { return typeName(); }
3360 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3361 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3362 QString asScriptCode() const override;
3363 QgsProcessingOutputDefinition *toOutputDefinition() const override SIP_FACTORY;
3364 QString defaultFileExtension() const override;
3365 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3366 QString createFileFilter() const override;
3367
3373 virtual QStringList supportedOutputVectorLayerExtensions() const;
3374
3379 QgsProcessing::SourceType dataType() const;
3380
3385 bool hasGeometry() const;
3386
3391 void setDataType( QgsProcessing::SourceType type );
3392
3401 bool supportsAppend() const;
3402
3411 void setSupportsAppend( bool supportsAppend );
3412
3413 QVariantMap toVariantMap() const override;
3414 bool fromVariantMap( const QVariantMap &map ) override;
3415 QString generateTemporaryDestination( const QgsProcessingContext *context = nullptr ) const override;
3416
3420 static QgsProcessingParameterFeatureSink *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3421
3422 private:
3423
3424 QgsProcessing::SourceType mDataType = QgsProcessing::TypeVectorAnyGeometry;
3425 bool mSupportsAppend = false;
3426};
3427
3428
3440{
3441 public:
3442
3449 QgsProcessingParameterVectorDestination( const QString &name, const QString &description = QString(), QgsProcessing::SourceType type = QgsProcessing::TypeVectorAnyGeometry, const QVariant &defaultValue = QVariant(),
3450 bool optional = false, bool createByDefault = true );
3451
3455 static QString typeName() { return QStringLiteral( "vectorDestination" ); }
3456 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3457 QString type() const override { return typeName(); }
3458 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3459 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3460 QString asScriptCode() const override;
3461 QgsProcessingOutputDefinition *toOutputDefinition() const override SIP_FACTORY;
3462 QString defaultFileExtension() const override;
3463 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3464 QString createFileFilter() const override;
3465
3471 virtual QStringList supportedOutputVectorLayerExtensions() const;
3472
3477 QgsProcessing::SourceType dataType() const;
3478
3483 bool hasGeometry() const;
3484
3489 void setDataType( QgsProcessing::SourceType type );
3490
3491 QVariantMap toVariantMap() const override;
3492 bool fromVariantMap( const QVariantMap &map ) override;
3493
3497 static QgsProcessingParameterVectorDestination *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3498
3499
3500 private:
3501
3502 QgsProcessing::SourceType mDataType = QgsProcessing::TypeVectorAnyGeometry;
3503};
3504
3513{
3514 public:
3515
3522 QgsProcessingParameterRasterDestination( const QString &name, const QString &description = QString(),
3523 const QVariant &defaultValue = QVariant(),
3524 bool optional = false,
3525 bool createByDefault = true );
3526
3530 static QString typeName() { return QStringLiteral( "rasterDestination" ); }
3531 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3532 QString type() const override { return typeName(); }
3533 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3534 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3535 QgsProcessingOutputDefinition *toOutputDefinition() const override SIP_FACTORY;
3536 QString defaultFileExtension() const override;
3537 QString createFileFilter() const override;
3538
3544 virtual QStringList supportedOutputRasterLayerExtensions() const;
3545
3549 static QgsProcessingParameterRasterDestination *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3550};
3551
3574{
3575 public:
3576
3583 QgsProcessingParameterFileDestination( const QString &name, const QString &description = QString(),
3584 const QString &fileFilter = QString(),
3585 const QVariant &defaultValue = QVariant(),
3586 bool optional = false,
3587 bool createByDefault = true );
3588
3592 static QString typeName() { return QStringLiteral( "fileDestination" ); }
3593 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3594 QString type() const override { return typeName(); }
3595 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3596 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3597 QgsProcessingOutputDefinition *toOutputDefinition() const override SIP_FACTORY;
3598 QString defaultFileExtension() const override;
3599 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3600 QString createFileFilter() const override;
3601
3606 QString fileFilter() const;
3607
3612 void setFileFilter( const QString &filter );
3613
3614 QVariantMap toVariantMap() const override;
3615 bool fromVariantMap( const QVariantMap &map ) override;
3616
3620 static QgsProcessingParameterFileDestination *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3621
3622
3623 private:
3624
3625 QString mFileFilter;
3626};
3627
3636{
3637 public:
3638
3642 QgsProcessingParameterFolderDestination( const QString &name, const QString &description = QString(),
3643 const QVariant &defaultValue = QVariant(),
3644 bool optional = false,
3645 bool createByDefault = true );
3646
3650 static QString typeName() { return QStringLiteral( "folderDestination" ); }
3651 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3652 QString type() const override { return typeName(); }
3653 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3654 QgsProcessingOutputDefinition *toOutputDefinition() const override SIP_FACTORY;
3655 QString defaultFileExtension() const override;
3656
3660 static QgsProcessingParameterFolderDestination *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3661
3662};
3663
3671{
3672 public:
3673
3677 QgsProcessingParameterBand( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
3678 const QString &parentLayerParameterName = QString(),
3679 bool optional = false,
3680 bool allowMultiple = false );
3681
3685 static QString typeName() { return QStringLiteral( "band" ); }
3686 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3687 QString type() const override { return typeName(); }
3688 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3689 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3690 QString asScriptCode() const override;
3691 QStringList dependsOnOtherParameters() const override;
3692 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3693
3698 QString parentLayerParameterName() const;
3699
3704 void setParentLayerParameterName( const QString &parentLayerParameterName );
3705
3706 QVariantMap toVariantMap() const override;
3707 bool fromVariantMap( const QVariantMap &map ) override;
3708
3712 static QgsProcessingParameterBand *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3713
3719 bool allowMultiple() const;
3720
3726 void setAllowMultiple( bool allowMultiple );
3727
3728 private:
3729
3730 QString mParentLayerParameterName;
3731 bool mAllowMultiple = false;
3732};
3733
3746{
3747 public:
3748
3752 QgsProcessingParameterLayout( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
3753 bool optional = false );
3754
3758 static QString typeName() { return QStringLiteral( "layout" ); }
3759 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3760 QString type() const override { return typeName(); }
3761 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3762 QString asScriptCode() const override;
3763 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3764
3768 static QgsProcessingParameterLayout *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3769
3770};
3771
3784{
3785 public:
3786
3790 QgsProcessingParameterLayoutItem( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
3791 const QString &parentLayoutParameterName = QString(),
3792 int itemType = -1,
3793 bool optional = false );
3794
3798 static QString typeName() { return QStringLiteral( "layoutitem" ); }
3799 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3800 QString type() const override { return typeName(); }
3801 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3802 QString asScriptCode() const override;
3803 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3804 QVariantMap toVariantMap() const override;
3805 bool fromVariantMap( const QVariantMap &map ) override;
3806 QStringList dependsOnOtherParameters() const override;
3807
3811 static QgsProcessingParameterLayoutItem *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3812
3817 QString parentLayoutParameterName() const;
3818
3823 void setParentLayoutParameterName( const QString &name );
3824
3832 int itemType() const;
3833
3841 void setItemType( int type );
3842
3843 private:
3844 QString mParentLayoutParameterName;
3845 int mItemType = -1;
3846};
3847
3858{
3859 public:
3860
3866 QgsProcessingParameterColor( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
3867 bool opacityEnabled = true,
3868 bool optional = false );
3869
3873 static QString typeName() { return QStringLiteral( "color" ); }
3874 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3875 QString type() const override { return typeName(); }
3876 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3877 QString asScriptCode() const override;
3878 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3879 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
3880 QVariantMap toVariantMap() const override;
3881 bool fromVariantMap( const QVariantMap &map ) override;
3882
3889 bool opacityEnabled() const;
3890
3898 void setOpacityEnabled( bool enabled );
3899
3903 static QgsProcessingParameterColor *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3904
3905 private:
3906
3907 bool mAllowOpacity = true;
3908
3909};
3910
3911
3922{
3923 public:
3924
3928 QgsProcessingParameterCoordinateOperation( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
3929 const QString &sourceCrsParameterName = QString(), const QString &destinationCrsParameterName = QString(),
3930 const QVariant &staticSourceCrs = QVariant(), const QVariant &staticDestinationCrs = QVariant(),
3931 bool optional = false );
3932
3936 static QString typeName() { return QStringLiteral( "coordinateoperation" ); }
3937 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
3938 QString type() const override { return typeName(); }
3939 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
3940 QString asScriptCode() const override;
3941 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3942 QStringList dependsOnOtherParameters() const override;
3943
3944 QVariantMap toVariantMap() const override;
3945 bool fromVariantMap( const QVariantMap &map ) override;
3946
3950 static QgsProcessingParameterCoordinateOperation *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
3951
3957 QString sourceCrsParameterName() const { return mSourceParameterName; }
3958
3964 void setSourceCrsParameterName( const QString &name ) { mSourceParameterName = name; }
3965
3971 QString destinationCrsParameterName() const { return mDestParameterName; }
3972
3978 void setDestinationCrsParameterName( const QString &name ) { mDestParameterName = name; }
3979
3985 QVariant sourceCrs() const { return mSourceCrs; }
3986
3992 void setSourceCrs( const QVariant &crs ) { mSourceCrs = crs; }
3993
3999 QVariant destinationCrs() const { return mDestCrs; }
4000
4006 void setDestinationCrs( const QVariant &crs ) { mDestCrs = crs; }
4007
4008 private:
4009
4010 QString mSourceParameterName;
4011 QString mDestParameterName;
4012 QVariant mSourceCrs;
4013 QVariant mDestCrs;
4014
4015};
4016
4017
4028{
4029 public:
4030
4034 QgsProcessingParameterMapTheme( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
4035 bool optional = false );
4036
4040 static QString typeName() { return QStringLiteral( "maptheme" ); }
4041 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4042 QString type() const override { return typeName(); }
4043 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4044 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4045 QString asScriptCode() const override;
4046 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
4047 QVariantMap toVariantMap() const override;
4048 bool fromVariantMap( const QVariantMap &map ) override;
4049
4053 static QgsProcessingParameterMapTheme *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4054
4055 private:
4056
4057};
4058
4059
4071{
4072 public:
4073
4075 enum Type
4076 {
4080 };
4081
4085 explicit QgsProcessingParameterDateTime( const QString &name, const QString &description = QString(),
4086 Type type = DateTime,
4087 const QVariant &defaultValue = QVariant(),
4088 bool optional = false,
4089 const QDateTime &minValue = QDateTime(),
4090 const QDateTime &maxValue = QDateTime()
4091 );
4092
4096 static QString typeName() { return QStringLiteral( "datetime" ); }
4097 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4098 QString type() const override { return typeName(); }
4099 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4100 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4101 QString toolTip() const override;
4102 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
4103
4111 QDateTime minimum() const;
4112
4124 void setMinimum( const QDateTime &minimum );
4125
4133 QDateTime maximum() const;
4134
4146 void setMaximum( const QDateTime &maximum );
4147
4152 Type dataType() const;
4153
4158 void setDataType( Type type );
4159
4160 QVariantMap toVariantMap() const override;
4161 bool fromVariantMap( const QVariantMap &map ) override;
4162
4166 static QgsProcessingParameterDateTime *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4167
4168 private:
4169
4170 QDateTime mMin;
4171 QDateTime mMax;
4172 Type mDataType = DateTime;
4173};
4174
4175
4187{
4188 public:
4189
4196 QgsProcessingParameterProviderConnection( const QString &name, const QString &description, const QString &provider, const QVariant &defaultValue = QVariant(),
4197 bool optional = false );
4198
4202 static QString typeName() { return QStringLiteral( "providerconnection" ); }
4203 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4204 QString type() const override { return typeName(); }
4205 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4206 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4207 QString asScriptCode() const override;
4208 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
4209 QVariantMap toVariantMap() const override;
4210 bool fromVariantMap( const QVariantMap &map ) override;
4211
4216 QString providerId() const { return mProviderId; }
4217
4222 void setProviderId( const QString &provider ) { mProviderId = provider; }
4223
4227 static QgsProcessingParameterProviderConnection *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4228
4229 private:
4230
4231 QString mProviderId;
4232};
4233
4234
4246{
4247 public:
4248
4257 QgsProcessingParameterDatabaseSchema( const QString &name, const QString &description, const QString &connectionParameterName = QString(), const QVariant &defaultValue = QVariant(),
4258 bool optional = false );
4259
4263 static QString typeName() { return QStringLiteral( "databaseschema" ); }
4264 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4265 QString type() const override { return typeName(); }
4266 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4267 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4268 QString asScriptCode() const override;
4269 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
4270 QVariantMap toVariantMap() const override;
4271 bool fromVariantMap( const QVariantMap &map ) override;
4272 QStringList dependsOnOtherParameters() const override;
4273
4278 QString parentConnectionParameterName() const;
4279
4284 void setParentConnectionParameterName( const QString &name );
4285
4289 static QgsProcessingParameterDatabaseSchema *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4290
4291 private:
4292
4293 QString mParentConnectionParameterName;
4294};
4295
4296
4308{
4309 public:
4310
4320 QgsProcessingParameterDatabaseTable( const QString &name, const QString &description,
4321 const QString &connectionParameterName = QString(),
4322 const QString &schemaParameterName = QString(),
4323 const QVariant &defaultValue = QVariant(),
4324 bool optional = false,
4325 bool allowNewTableNames = false );
4326
4330 static QString typeName() { return QStringLiteral( "databasetable" ); }
4331 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4332 QString type() const override { return typeName(); }
4333 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4334 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4335 QString asScriptCode() const override;
4336 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
4337 QVariantMap toVariantMap() const override;
4338 bool fromVariantMap( const QVariantMap &map ) override;
4339 QStringList dependsOnOtherParameters() const override;
4340
4345 QString parentConnectionParameterName() const;
4346
4351 void setParentConnectionParameterName( const QString &name );
4352
4357 QString parentSchemaParameterName() const;
4358
4363 void setParentSchemaParameterName( const QString &name );
4364
4368 static QgsProcessingParameterDatabaseTable *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4369
4376 bool allowNewTableNames() const;
4377
4384 void setAllowNewTableNames( bool allowed );
4385
4386 private:
4387
4388 QString mParentConnectionParameterName;
4389 QString mParentSchemaParameterName;
4390 bool mAllowNewTableNames = false;
4391};
4392
4393
4401{
4402 public:
4403
4407 QgsProcessingParameterPointCloudLayer( const QString &name, const QString &description = QString(),
4408 const QVariant &defaultValue = QVariant(), bool optional = false );
4409
4413 static QString typeName() { return QStringLiteral( "pointcloud" ); }
4414 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4415 QString type() const override { return typeName(); }
4416 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4417 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4418 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
4419 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
4420 QString createFileFilter() const override;
4421
4425 static QgsProcessingParameterPointCloudLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4426};
4427
4428
4436{
4437 public:
4438
4442 QgsProcessingParameterAnnotationLayer( const QString &name, const QString &description = QString(),
4443 const QVariant &defaultValue = QVariant(), bool optional = false );
4444
4448 static QString typeName() { return QStringLiteral( "annotation" ); }
4449 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4450 QString type() const override { return typeName(); }
4451 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4452 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4453 QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
4454 QVariant valueAsJsonObject( const QVariant &value, QgsProcessingContext &context ) const override;
4455
4459 static QgsProcessingParameterAnnotationLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4460};
4461
4470{
4471 public:
4472
4479 QgsProcessingParameterPointCloudDestination( const QString &name, const QString &description = QString(),
4480 const QVariant &defaultValue = QVariant(),
4481 bool optional = false,
4482 bool createByDefault = true );
4483
4487 static QString typeName() { return QStringLiteral( "pointCloudDestination" ); }
4488 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4489 QString type() const override { return typeName(); }
4490 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4491 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4492 QgsProcessingOutputDefinition *toOutputDefinition() const override SIP_FACTORY;
4493 QString defaultFileExtension() const override;
4494 QString createFileFilter() const override;
4495
4500 virtual QStringList supportedOutputPointCloudLayerExtensions() const;
4501
4505 static QgsProcessingParameterPointCloudDestination *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4506};
4507
4515{
4516 public:
4517
4521 QgsProcessingParameterPointCloudAttribute( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
4522 const QString &parentLayerParameterName = QString(),
4523 bool allowMultiple = false,
4524 bool optional = false,
4525 bool defaultToAllAttributes = false );
4526
4530 static QString typeName() { return QStringLiteral( "attribute" ); }
4531 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4532 QString type() const override { return typeName(); }
4533 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4534 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4535 QString asScriptCode() const override;
4536 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
4537 QStringList dependsOnOtherParameters() const override;
4538
4543 QString parentLayerParameterName() const;
4544
4549 void setParentLayerParameterName( const QString &parentLayerParameterName );
4550
4555 bool allowMultiple() const;
4556
4561 void setAllowMultiple( bool allowMultiple );
4562
4571 bool defaultToAllAttributes() const;
4572
4581 void setDefaultToAllAttributes( bool enabled );
4582
4583 QVariantMap toVariantMap() const override;
4584 bool fromVariantMap( const QVariantMap &map ) override;
4585
4589 static QgsProcessingParameterPointCloudAttribute *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4590
4591 private:
4592
4593 QString mParentLayerParameterName;
4594 bool mAllowMultiple = false;
4595 bool mDefaultToAllAttributes = false;
4596};
4597
4606{
4607 public:
4608
4615 QgsProcessingParameterVectorTileDestination( const QString &name, const QString &description = QString(),
4616 const QVariant &defaultValue = QVariant(),
4617 bool optional = false,
4618 bool createByDefault = true );
4619
4623 static QString typeName() { return QStringLiteral( "vectorTileDestination" ); }
4624 QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
4625 QString type() const override { return typeName(); }
4626 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
4627 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
4628 QgsProcessingOutputDefinition *toOutputDefinition() const override SIP_FACTORY;
4629 QString defaultFileExtension() const override;
4630 QString createFileFilter() const override;
4631
4636 virtual QStringList supportedOutputVectorTileLayerExtensions() const;
4637
4641 static QgsProcessingParameterVectorTileDestination *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
4642};
4643
4644// clazy:excludeall=qstring-allocations
4645
4646#endif // QGSPROCESSINGPARAMETERS_H
4647
4648
The Qgis class provides global constants for use throughout the application.
Definition qgis.h:54
ExpressionType
Expression types.
Definition qgis.h:3834
@ Qgis
Native QGIS expression.
DistanceUnit
Units of distance.
Definition qgis.h:3496
@ Unknown
Unknown distance unit.
TemporalUnit
Temporal units.
Definition qgis.h:3603
@ Milliseconds
Milliseconds.
WkbType
The WKB type describes the number of dimensions a geometry has.
Definition qgis.h:182
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.
Base class for graphical items within a QgsLayout.
Base class for all map layer types.
Definition qgsmaplayer.h:74
Represents a mesh layer supporting display of data on structured or unstructured meshes.
Represents a map layer supporting display of point clouds.
A class to represent a 2D point.
Definition qgspointxy.h:59
Print layout, a QgsLayout subclass for static or atlas-based layouts.
Abstract base class for processing algorithms.
Contains information about the context in which a processing algorithm is executed.
Base class for all parameter definitions which represent file or layer destinations,...
virtual QString defaultFileExtension() const =0
Returns the default file extension for destination file paths associated with this parameter.
bool supportsNonFileBasedOutput() const
Returns true if the destination parameter supports non filed-based outputs, such as memory layers or ...
bool isDestination() const override
Returns true if this parameter represents a file or layer destination, e.g.
virtual QgsProcessingOutputDefinition * toOutputDefinition() const =0
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
QgsProcessingProvider * originalProvider() const
Original (source) provider which this parameter has been derived from.
void setSupportsNonFileBasedOutput(bool supportsNonFileBasedOutput)
Sets whether the destination parameter supports non filed-based outputs, such as memory layers or dir...
Custom exception class for processing related exceptions.
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
QgsProcessingFeatureSourceDefinition(const QgsProperty &source, bool selectedFeaturesOnly=false, long long featureLimit=-1, QgsProcessingFeatureSourceDefinition::Flags flags=QgsProcessingFeatureSourceDefinition::Flags(), QgsFeatureRequest::InvalidGeometryCheck geometryCheck=QgsFeatureRequest::GeometryAbortOnInvalid, const QString &filterExpression=QString())
Constructor for QgsProcessingFeatureSourceDefinition, accepting a QgsProperty source.
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.
QString filterExpression
Optional expression filter to use for filtering features which will be read from the source.
QgsFeatureSource subclass which proxies methods to an underlying QgsFeatureSource,...
Base class for providing feedback from a processing algorithm.
Base class for the definition of processing outputs.
Encapsulates settings relating to a feature sink or output raster layer for a processing algorithm.
QgsProcessingOutputLayerDefinition(const QgsProperty &sink, QgsProject *destinationProject=nullptr)
Constructor for QgsProcessingOutputLayerDefinition, accepting a QgsProperty sink/layer.
QgsProperty sink
Sink/layer definition.
bool useRemapping() const
Returns true if the output uses a remapping definition.
QgsProcessingOutputLayerDefinition(const QString &sink=QString(), QgsProject *destinationProject=nullptr)
Constructor for QgsProcessingOutputLayerDefinition, accepting a static sink/layer string.
QgsRemappingSinkDefinition remappingDefinition() const
Returns the output remapping definition, if useRemapping() is true.
QString destinationName
Name to use for sink if it's to be loaded into a destination project.
QVariantMap createOptions
Map of optional sink/layer creation options, which are passed to the underlying provider when creatin...
An annotation layer parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A string parameter for authentication configuration ID values.
static QString typeName()
Returns the type name for the parameter class.
A raster band parameter for Processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A boolean parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A color parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A coordinate operation parameter for processing algorithms, for selection between available coordinat...
static QString typeName()
Returns the type name for the parameter class.
QVariant sourceCrs() const
Returns the static source CRS, or an invalid value if this is not set.
QString destinationCrsParameterName() const
Returns the name of the destination CRS parameter, or an empty string if this is not set.
void setDestinationCrsParameterName(const QString &name)
Sets the name of the destination CRS parameter.
void setSourceCrs(const QVariant &crs)
Sets the static source crs.
QVariant destinationCrs() const
Returns the static destination CRS, or an invalid value if this is not set.
void setDestinationCrs(const QVariant &crs)
Sets the static destination crs.
void setSourceCrsParameterName(const QString &name)
Sets the name of the source CRS parameter.
QString sourceCrsParameterName() const
Returns the name of the source CRS parameter, or an empty string if this is not set.
A coordinate reference system parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A database schema parameter for processing algorithms, allowing users to select from existing schemas...
static QString typeName()
Returns the type name for the parameter class.
A database table name parameter for processing algorithms, allowing users to select from existing dat...
static QString typeName()
Returns the type name for the parameter class.
A datetime (or pure date or time) parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
Base class for the definition of processing parameters.
QVariant defaultValue() const
Returns the default value for the parameter.
void setDefaultValue(const QVariant &value)
Sets the default value for the parameter.
QStringList additionalExpressionContextVariables() const
Returns a list of additional expression context variables which are available for use when evaluating...
QStringList mAdditionalExpressionVariables
Additional expression context variables exposed for use by this parameter.
QString help() const
Returns the help for the parameter.
void setMetadata(const QVariantMap &metadata)
Sets the parameter's freeform metadata.
ValueAsStringFlag
Flags for passing to the valueAsStringPrivate() method.
void setGuiDefaultValueOverride(const QVariant &value)
Sets the default value to use for the parameter in GUI widgets.
QVariantMap metadata() const
Returns the parameter's freeform metadata.
QString description() const
Returns the description for the parameter.
QString mDynamicLayerParameterName
Linked vector layer parameter name for dynamic properties.
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.
static QString typeName()
Returns the type name for the parameter class.
void setDefaultUnit(Qgis::DistanceUnit unit)
Sets the default distance unit for the parameter.
A double numeric parameter for duration values.
void setDefaultUnit(Qgis::TemporalUnit unit)
Sets the default duration unit for the parameter.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
An enum based parameter for processing algorithms, allowing for selection from predefined values.
static QString typeName()
Returns the type name for the parameter class.
An expression parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A rectangular map extent parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A feature sink output for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
An input feature source (such as vector layers) parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
A vector layer or feature source field parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A generic file based destination parameter, for specifying the destination path for a file (non-map l...
static QString typeName()
Returns the type name for the parameter class.
An input file or folder parameter for processing algorithms.
QString extension() const
Returns any specified file extension for the parameter.
static QString typeName()
Returns the type name for the parameter class.
void setBehavior(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 Qgis::GeometryType values.
bool allowMultipart() const
Returns the parameter allow multipart geometries.
QList< int > geometryTypes() const
Returns the parameter allowed geometries, as a list of Qgis::GeometryType values.
void setAllowMultipart(bool allowMultipart)
Sets the allow multipart geometries.
static QString typeName()
Returns the type name for the parameter class.
A print layout item parameter, allowing users to select a particular item from a print layout.
static QString typeName()
Returns the type name for the parameter class.
A print layout parameter, allowing users to select a print layout.
static QString typeName()
Returns the type name for the parameter class.
Can be inherited by parameters which require limits to their acceptable data types.
QList< int > mDataTypes
List of acceptable data types for the parameter.
A map layer parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A map theme parameter for processing algorithms, allowing users to select an existing map theme from ...
static QString typeName()
Returns the type name for the parameter class.
A table (matrix) parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
A mesh layer parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A parameter for processing algorithms which accepts multiple map layers.
static QString typeName()
Returns the type name for the parameter class.
A numeric parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A point cloud layer attribute parameter for Processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A point cloud layer destination parameter, for specifying the destination path for a point cloud laye...
static QString typeName()
Returns the type name for the parameter class.
A point cloud layer parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A point parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A data provider connection parameter for processing algorithms, allowing users to select from availab...
static QString typeName()
Returns the type name for the parameter class.
void setProviderId(const QString &provider)
Sets the ID of the provider associated with the connections.
QString providerId() const
Returns the ID of the provider associated with the connections.
A numeric range parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A raster layer destination parameter, for specifying the destination path for a raster layer created ...
static QString typeName()
Returns the type name for the parameter class.
A raster layer parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A double numeric parameter for map scale values.
static QString typeName()
Returns the type name for the parameter class.
A string parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
A vector layer destination parameter, for specifying the destination path for a vector layer created ...
static QString typeName()
Returns the type name for the parameter class.
A vector layer (with or without geometry) parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A vector tile layer destination parameter, for specifying the destination path for a vector tile laye...
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
A collection of utilities for working with parameters when running a processing algorithm.
Abstract base class for processing providers.
LayerHint
Layer type hints.
@ UnknownType
Unknown layer type.
Contains enumerations and other constants for use in processing algorithms and parameters.
PythonOutputType
Available Python output types.
@ PythonQgsProcessingAlgorithmSubclass
Full Python QgsProcessingAlgorithm subclass.
SourceType
Data source types enum.
@ TypeVectorAnyGeometry
Any vector layer with geometry.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition qgsproject.h:107
Definition for a property.
Definition qgsproperty.h:46
A store for object properties.
Represents a raster layer.
A rectangle specified with double values.
Defines the parameters used to remap features when creating a QgsRemappingProxyFeatureSink.
Represents a vector layer which manages a vector based data sets.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into allowing algorithms to be written in pure substantial changes are required in order to port existing x Processing algorithms for QGIS x The most significant changes are outlined not GeoAlgorithm For algorithms which operate on features one by consider subclassing the QgsProcessingFeatureBasedAlgorithm class This class allows much of the boilerplate code for looping over features from a vector layer to be bypassed and instead requires implementation of a processFeature method Ensure that your algorithm(or algorithm 's parent class) implements the new pure virtual createInstance(self) call
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition qgis_sip.h:186
#define SIP_DEPRECATED
Definition qgis_sip.h:106
#define SIP_SKIP
Definition qgis_sip.h:126
#define SIP_OUT
Definition qgis_sip.h:58
#define SIP_FACTORY
Definition qgis_sip.h:76
#define SIP_THROW(name,...)
Definition qgis_sip.h:198
#define SIP_END
Definition qgis_sip.h:203
Q_DECLARE_METATYPE(QgsDatabaseQueryLogEntry)
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
QList< const QgsProcessingParameterDefinition * > QgsProcessingParameterDefinitions
List of processing parameters.
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsTextRendererUtils::CurvedTextFlags)
const QgsCoordinateReferenceSystem & crs
const QString & typeName