18 #ifndef QGSPROCESSINGPARAMETERS_H
19 #define QGSPROCESSINGPARAMETERS_H
21 #include "qgis_core.h"
65 FlagOverrideDefaultGeometryCheck = 1 << 0,
66 FlagCreateIndividualOutputPerInputFeature = 1 << 1,
68 Q_DECLARE_FLAGS( Flags, Flag )
86 , selectedFeaturesOnly( selectedFeaturesOnly )
87 , featureLimit( featureLimit )
89 , geometryCheck( geometryCheck )
108 , selectedFeaturesOnly( selectedFeaturesOnly )
109 , featureLimit( featureLimit )
111 , geometryCheck( geometryCheck )
130 long long featureLimit = -1;
137 Flags flags = Flags();
155 QVariant toVariant()
const;
163 bool loadVariant(
const QVariantMap &map );
167 return source == other.
source
170 && flags == other.
flags
176 return !( *
this == other );
180 operator QVariant()
const
182 return QVariant::fromValue( *
this );
210 , destinationProject( destinationProject )
220 , destinationProject( destinationProject )
283 QVariant toVariant()
const;
291 bool loadVariant(
const QVariantMap &map );
294 operator QVariant()
const
296 return QVariant::fromValue( *
this );
304 bool mUseRemapping =
false;
344 sipType = sipType_QgsProcessingParameterBoolean;
346 sipType = sipType_QgsProcessingParameterCrs;
348 sipType = sipType_QgsProcessingParameterMapLayer;
350 sipType = sipType_QgsProcessingParameterExtent;
352 sipType = sipType_QgsProcessingParameterPoint;
354 sipType = sipType_QgsProcessingParameterGeometry;
356 sipType = sipType_QgsProcessingParameterFile;
358 sipType = sipType_QgsProcessingParameterMatrix;
360 sipType = sipType_QgsProcessingParameterMultipleLayers;
362 sipType = sipType_QgsProcessingParameterNumber;
364 sipType = sipType_QgsProcessingParameterDistance;
366 sipType = sipType_QgsProcessingParameterScale;
368 sipType = sipType_QgsProcessingParameterRange;
370 sipType = sipType_QgsProcessingParameterRasterLayer;
372 sipType = sipType_QgsProcessingParameterMeshLayer;
374 sipType = sipType_QgsProcessingParameterEnum;
376 sipType = sipType_QgsProcessingParameterString;
378 sipType = sipType_QgsProcessingParameterExpression;
380 sipType = sipType_QgsProcessingParameterAuthConfig;
382 sipType = sipType_QgsProcessingParameterVectorLayer;
384 sipType = sipType_QgsProcessingParameterField;
386 sipType = sipType_QgsProcessingParameterFeatureSource;
388 sipType = sipType_QgsProcessingParameterFeatureSink;
390 sipType = sipType_QgsProcessingParameterVectorDestination;
392 sipType = sipType_QgsProcessingParameterRasterDestination;
394 sipType = sipType_QgsProcessingParameterFileDestination;
396 sipType = sipType_QgsProcessingParameterFolderDestination;
398 sipType = sipType_QgsProcessingParameterBand;
400 sipType = sipType_QgsProcessingParameterLayout;
402 sipType = sipType_QgsProcessingParameterLayoutItem;
404 sipType = sipType_QgsProcessingParameterColor;
406 sipType = sipType_QgsProcessingParameterCoordinateOperation;
408 sipType = sipType_QgsProcessingParameterMapTheme;
410 sipType = sipType_QgsProcessingParameterDateTime;
412 sipType = sipType_QgsProcessingParameterProviderConnection;
414 sipType = sipType_QgsProcessingParameterDatabaseSchema;
416 sipType = sipType_QgsProcessingParameterDatabaseTable;
418 sipType = sipType_QgsProcessingParameterFieldMapping;
420 sipType = sipType_QgsProcessingParameterTinInputLayers;
422 sipType = sipType_QgsProcessingParameterVectorTileWriterLayers;
424 sipType = sipType_QgsProcessingParameterDxfLayers;
426 sipType = sipType_QgsProcessingParameterMeshDatasetGroups;
428 sipType = sipType_QgsProcessingParameterMeshDatasetTime;
439 FlagAdvanced = 1 << 1,
441 FlagOptional = 1 << 3,
442 FlagIsModelOutput = 1 << 4,
444 Q_DECLARE_FLAGS( Flags, Flag )
450 bool optional =
false,
const QString &help = QString() );
462 virtual QString
type()
const = 0;
476 QString
name()
const {
return mName; }
483 void setName(
const QString &name ) { mName = name; }
497 void setDescription(
const QString &description ) { mDescription = description; }
508 QString
help()
const {
return mHelp; }
519 void setHelp(
const QString &help ) { mHelp = help; }
582 Flags
flags()
const {
return mFlags; }
597 virtual bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const;
603 virtual QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const;
609 virtual QString asScriptCode()
const;
627 virtual QVariantMap toVariantMap()
const;
634 virtual bool fromVariantMap(
const QVariantMap &map );
656 void setMetadata(
const QVariantMap &metadata ) { mMetadata = metadata; }
682 virtual QString toolTip()
const;
805 bool mIsDynamic =
false;
853 static bool isDynamic(
const QVariantMap ¶meters,
const QString &name );
1060 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;
1083 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;
1571 static QString descriptionFromName(
const QString &name );
1582 static bool parseScriptCodeParameterOptions(
const QString &code,
bool &isOptional, QString &name, QString &type, QString &definition );
1601 bool optional =
false );
1606 static QString
typeName() {
return QStringLiteral(
"boolean" ); }
1609 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
1610 QString asScriptCode()
const override;
1631 QgsProcessingParameterCrs(
const QString &name,
const QString &description = QString(),
const QVariant &defaultValue = QVariant(),
1632 bool optional =
false );
1637 static QString
typeName() {
return QStringLiteral(
"crs" ); }
1640 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
1641 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
1664 bool optional =
false );
1669 static QString
typeName() {
return QStringLiteral(
"extent" ); }
1672 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
1673 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
1696 QgsProcessingParameterPoint(
const QString &name,
const QString &description = QString(),
const QVariant &defaultValue = QVariant(),
1697 bool optional =
false );
1702 static QString
typeName() {
return QStringLiteral(
"point" ); }
1705 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
1706 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
1731 QgsProcessingParameterGeometry(
const QString &name,
const QString &description = QString(),
const QVariant &defaultValue = QVariant(),
bool optional =
false,
const QList< int > &geometryTypes = QList< int >() );
1736 static QString
typeName() {
return QStringLiteral(
"geometry" ); }
1739 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
1740 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
1741 QString asScriptCode()
const override;
1743 QVariantMap toVariantMap()
const override;
1744 bool fromVariantMap(
const QVariantMap &map )
override;
1765 QList<int> mGeomTypes;
1793 QgsProcessingParameterFile(
const QString &name,
const QString &description = QString(), Behavior behavior = File,
const QString &extension = QString(),
const QVariant &defaultValue = QVariant(),
1794 bool optional =
false,
const QString &fileFilter = QString() );
1799 static QString
typeName() {
return QStringLiteral(
"file" ); }
1802 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
1803 QString asScriptCode()
const override;
1805 QString createFileFilter()
const override;
1837 void setExtension(
const QString &extension );
1845 QString fileFilter()
const;
1856 void setFileFilter(
const QString &filter );
1858 QVariantMap toVariantMap()
const override;
1859 bool fromVariantMap(
const QVariantMap &map )
override;
1864 static QgsProcessingParameterFile *fromScriptCode(
const QString &name,
const QString &description,
bool isOptional,
const QString &definition, Behavior behavior = File )
SIP_FACTORY;
1868 Behavior mBehavior = File;
1870 QString mFileFilter;
1887 bool hasFixedNumberRows =
false,
const QStringList &headers = QStringList(),
1888 const QVariant &defaultValue = QVariant(),
1889 bool optional =
false );
1894 static QString
typeName() {
return QStringLiteral(
"matrix" ); }
1897 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
1898 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
1905 QStringList headers()
const;
1911 void setHeaders(
const QStringList &headers );
1919 int numberRows()
const;
1927 void setNumberRows(
int rows );
1934 bool hasFixedNumberRows()
const;
1941 void setHasFixedNumberRows(
bool hasFixedNumberRows );
1943 QVariantMap toVariantMap()
const override;
1944 bool fromVariantMap(
const QVariantMap &map )
override;
1953 QStringList mHeaders;
1954 int mNumberRows = 3;
1955 bool mFixedNumberRows =
false;
1973 const QVariant &defaultValue = QVariant(),
1974 bool optional =
false );
1979 static QString
typeName() {
return QStringLiteral(
"multilayer" ); }
1982 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
1983 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
1984 QString asScriptCode()
const override;
1986 QString createFileFilter()
const override;
2005 int minimumNumberInputs()
const;
2012 void setMinimumNumberInputs(
int minimum );
2014 QVariantMap toVariantMap()
const override;
2015 bool fromVariantMap(
const QVariantMap &map )
override;
2025 int mMinimumNumberInputs = 0;
2062 Type type = Integer,
2063 const QVariant &defaultValue = QVariant(),
2064 bool optional =
false,
2065 double minValue = std::numeric_limits<double>::lowest() + 1,
2066 double maxValue = std::numeric_limits<double>::max()
2072 static QString
typeName() {
return QStringLiteral(
"number" ); }
2075 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
2076 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
2077 QString toolTip()
const override;
2084 double minimum()
const;
2090 void setMinimum(
double minimum );
2096 double maximum()
const;
2102 void setMaximum(
double maximum );
2108 Type dataType()
const;
2114 void setDataType( Type type );
2116 QVariantMap toVariantMap()
const override;
2117 bool fromVariantMap(
const QVariantMap &map )
override;
2126 double mMin = std::numeric_limits<double>::lowest() + 1;
2127 double mMax = std::numeric_limits<double>::max();
2128 Type mDataType = Integer;
2158 const QVariant &defaultValue = QVariant(),
2159 const QString &parentParameterName = QString(),
2160 bool optional =
false,
2161 double minValue = std::numeric_limits<double>::lowest() + 1,
2162 double maxValue = std::numeric_limits<double>::max() );
2167 static QString
typeName() {
return QStringLiteral(
"distance" ); }
2171 QString type() const override;
2172 QStringList dependsOnOtherParameters() const override;
2173 QString asPythonString(
QgsProcessing::PythonOutputType outputType =
QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2179 QString parentParameterName() const;
2185 void setParentParameterName( const QString &parentParameterName );
2203 QVariantMap toVariantMap()
const override;
2204 bool fromVariantMap(
const QVariantMap &map )
override;
2208 QString mParentParameterName;
2231 const QVariant &defaultValue = QVariant(),
2232 bool optional =
false );
2237 static QString
typeName() {
return QStringLiteral(
"scale" ); }
2241 QString type() const override;
2242 QString asPythonString(
QgsProcessing::PythonOutputType outputType =
QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2266 const QVariant &defaultValue = QVariant(),
2267 bool optional =
false );
2272 static QString
typeName() {
return QStringLiteral(
"range" ); }
2275 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
2276 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
2291 QVariantMap toVariantMap()
const override;
2292 bool fromVariantMap(
const QVariantMap &map )
override;
2318 bool optional =
false );
2323 static QString
typeName() {
return QStringLiteral(
"raster" ); }
2326 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
2327 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
2328 QString createFileFilter()
const override;
2350 QgsProcessingParameterEnum(
const QString &name,
const QString &description = QString(),
const QStringList &options = QStringList(),
2351 bool allowMultiple =
false,
2352 const QVariant &defaultValue = QVariant(),
2353 bool optional =
false,
2354 bool usesStaticStrings =
false );
2359 static QString
typeName() {
return QStringLiteral(
"enum" ); }
2362 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
2363 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
2364 QString asScriptCode()
const override;
2371 QStringList options()
const;
2377 void setOptions(
const QStringList &options );
2383 bool allowMultiple()
const;
2389 void setAllowMultiple(
bool allowMultiple );
2397 bool usesStaticStrings()
const;
2405 void setUsesStaticStrings(
bool usesStaticStrings );
2407 QVariantMap toVariantMap()
const override;
2408 bool fromVariantMap(
const QVariantMap &map )
override;
2417 QStringList mOptions;
2418 bool mAllowMultiple =
false;
2419 bool mUsesStaticStrings =
false;
2436 bool multiLine =
false,
2437 bool optional =
false );
2442 static QString
typeName() {
return QStringLiteral(
"string" ); }
2445 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
2446 QString asScriptCode()
const override;
2453 bool multiLine()
const;
2459 void setMultiLine(
bool multiLine );
2461 QVariantMap toVariantMap()
const override;
2462 bool fromVariantMap(
const QVariantMap &map )
override;
2471 bool mMultiLine =
false;
2496 bool optional =
false );
2501 static QString
typeName() {
return QStringLiteral(
"authcfg" ); }
2504 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
2505 QString asScriptCode()
const override;
2528 const QString &parentLayerParameterName = QString(),
2529 bool optional =
false );
2534 static QString
typeName() {
return QStringLiteral(
"expression" ); }
2537 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
2538 QStringList dependsOnOtherParameters()
const override;
2545 QString parentLayerParameterName()
const;
2551 void setParentLayerParameterName(
const QString &parentLayerParameterName );
2553 QVariantMap toVariantMap()
const override;
2554 bool fromVariantMap(
const QVariantMap &map )
override;
2563 QString mParentLayerParameterName;
2587 QList< int > dataTypes()
const;
2593 void setDataTypes(
const QList< int > &types );
2616 const QString &description = QString(),
2617 const QList< int > &types = QList< int >(),
2618 const QVariant &defaultValue = QVariant(),
2619 bool optional =
false );
2624 static QString
typeName() {
return QStringLiteral(
"vector" ); }
2627 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
2628 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
2630 QString createFileFilter()
const override;
2632 QVariantMap toVariantMap()
const override;
2633 bool fromVariantMap(
const QVariantMap &map )
override;
2656 const QString &description = QString(),
2657 const QVariant &defaultValue = QVariant(),
2658 bool optional =
false );
2663 static QString
typeName() {
return QStringLiteral(
"mesh" ); }
2666 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
2667 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
2668 QString createFileFilter()
const override;
2690 bool optional =
false,
2691 const QList< int > &types = QList< int >() );
2696 static QString
typeName() {
return QStringLiteral(
"layer" ); }
2699 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
2700 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
2701 QString asScriptCode()
const override;
2703 QString createFileFilter()
const override;
2705 QVariantMap toVariantMap()
const override;
2706 bool fromVariantMap(
const QVariantMap &map )
override;
2737 QgsProcessingParameterField(
const QString &name,
const QString &description = QString(),
const QVariant &defaultValue = QVariant(),
2738 const QString &parentLayerParameterName = QString(),
2739 DataType type = Any,
2740 bool allowMultiple =
false,
2741 bool optional =
false,
2742 bool defaultToAllFields =
false );
2747 static QString
typeName() {
return QStringLiteral(
"field" ); }
2750 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
2751 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
2752 QString asScriptCode()
const override;
2754 QStringList dependsOnOtherParameters()
const override;
2760 QString parentLayerParameterName()
const;
2766 void setParentLayerParameterName(
const QString &parentLayerParameterName );
2772 DataType dataType()
const;
2778 void setDataType( DataType type );
2784 bool allowMultiple()
const;
2790 void setAllowMultiple(
bool allowMultiple );
2801 bool defaultToAllFields()
const;
2812 void setDefaultToAllFields(
bool enabled );
2814 QVariantMap toVariantMap()
const override;
2815 bool fromVariantMap(
const QVariantMap &map )
override;
2824 QString mParentLayerParameterName;
2825 DataType mDataType = Any;
2826 bool mAllowMultiple =
false;
2827 bool mDefaultToAllFields =
false;
2846 const QList< int > &types = QList< int >(),
2847 const QVariant &defaultValue = QVariant(),
bool optional =
false );
2852 static QString
typeName() {
return QStringLiteral(
"source" ); }
2855 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
2856 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
2857 QString asScriptCode()
const override;
2859 QString createFileFilter()
const override;
2861 QVariantMap toVariantMap()
const override;
2862 bool fromVariantMap(
const QVariantMap &map )
override;
2889 bool optional =
false,
bool createByDefault =
true );
2892 QVariantMap toVariantMap()
const override;
2893 bool fromVariantMap(
const QVariantMap &map )
override;
2895 QString createFileFilter()
const override;
2928 virtual QString generateTemporaryDestination()
const;
2951 bool createByDefault()
const;
2958 void setCreateByDefault(
bool createByDefault );
2983 bool mSupportsNonFileBasedOutputs =
true;
2984 bool mCreateByDefault =
true;
2986 friend class QgsProcessingModelAlgorithm;
2987 friend class TestQgsProcessing;
3010 bool optional =
false,
bool createByDefault =
true,
bool supportsAppend =
false );
3015 static QString
typeName() {
return QStringLiteral(
"sink" ); }
3018 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
3019 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
3020 QString asScriptCode()
const override;
3022 QString defaultFileExtension() const override;
3023 QString asPythonString(
QgsProcessing::PythonOutputType outputType =
QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3024 QString createFileFilter() const override;
3031 virtual QStringList supportedOutputVectorLayerExtensions() const;
3043 bool hasGeometry() const;
3059 bool supportsAppend() const;
3069 void setSupportsAppend(
bool supportsAppend );
3071 QVariantMap toVariantMap() const override;
3072 bool fromVariantMap( const QVariantMap &map ) override;
3073 QString generateTemporaryDestination() const override;
3083 bool mSupportsAppend = false;
3108 bool optional =
false,
bool createByDefault =
true );
3113 static QString
typeName() {
return QStringLiteral(
"vectorDestination" ); }
3116 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
3117 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
3118 QString asScriptCode()
const override;
3120 QString defaultFileExtension() const override;
3121 QString asPythonString(
QgsProcessing::PythonOutputType outputType =
QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3122 QString createFileFilter() const override;
3129 virtual QStringList supportedOutputVectorLayerExtensions() const;
3141 bool hasGeometry() const;
3149 QVariantMap toVariantMap() const override;
3150 bool fromVariantMap( const QVariantMap &map ) override;
3181 const QVariant &defaultValue = QVariant(),
3182 bool optional =
false,
3183 bool createByDefault =
true );
3188 static QString
typeName() {
return QStringLiteral(
"rasterDestination" ); }
3191 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
3192 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
3194 QString defaultFileExtension() const override;
3195 QString createFileFilter() const override;
3202 virtual QStringList supportedOutputRasterLayerExtensions() const;
3242 const QString &fileFilter = QString(),
3243 const QVariant &defaultValue = QVariant(),
3244 bool optional =
false,
3245 bool createByDefault =
true );
3250 static QString
typeName() {
return QStringLiteral(
"fileDestination" ); }
3253 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
3254 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
3256 QString defaultFileExtension() const override;
3257 QString asPythonString(
QgsProcessing::PythonOutputType outputType =
QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3258 QString createFileFilter() const override;
3264 QString fileFilter() const;
3270 void setFileFilter( const QString &filter );
3272 QVariantMap toVariantMap() const override;
3273 bool fromVariantMap( const QVariantMap &map ) override;
3283 QString mFileFilter;
3301 const QVariant &defaultValue = QVariant(),
3302 bool optional =
false,
3303 bool createByDefault =
true );
3308 static QString
typeName() {
return QStringLiteral(
"folderDestination" ); }
3311 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
3313 QString defaultFileExtension() const override;
3335 QgsProcessingParameterBand(
const QString &name,
const QString &description = QString(),
const QVariant &defaultValue = QVariant(),
3336 const QString &parentLayerParameterName = QString(),
3337 bool optional =
false,
3338 bool allowMultiple =
false );
3343 static QString
typeName() {
return QStringLiteral(
"band" ); }
3346 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
3347 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
3348 QString asScriptCode()
const override;
3349 QStringList dependsOnOtherParameters()
const override;
3356 QString parentLayerParameterName()
const;
3362 void setParentLayerParameterName(
const QString &parentLayerParameterName );
3364 QVariantMap toVariantMap()
const override;
3365 bool fromVariantMap(
const QVariantMap &map )
override;
3377 bool allowMultiple()
const;
3384 void setAllowMultiple(
bool allowMultiple );
3388 QString mParentLayerParameterName;
3389 bool mAllowMultiple =
false;
3411 bool optional =
false );
3416 static QString
typeName() {
return QStringLiteral(
"layout" ); }
3419 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
3420 QString asScriptCode()
const override;
3449 const QString &parentLayoutParameterName = QString(),
3451 bool optional =
false );
3456 static QString
typeName() {
return QStringLiteral(
"layoutitem" ); }
3459 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
3460 QString asScriptCode()
const override;
3462 QVariantMap toVariantMap()
const override;
3463 bool fromVariantMap(
const QVariantMap &map )
override;
3464 QStringList dependsOnOtherParameters()
const override;
3475 QString parentLayoutParameterName()
const;
3481 void setParentLayoutParameterName(
const QString &name );
3490 int itemType()
const;
3499 void setItemType(
int type );
3502 QString mParentLayoutParameterName;
3524 QgsProcessingParameterColor(
const QString &name,
const QString &description = QString(),
const QVariant &defaultValue = QVariant(),
3525 bool opacityEnabled =
true,
3526 bool optional =
false );
3531 static QString
typeName() {
return QStringLiteral(
"color" ); }
3534 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
3535 QString asScriptCode()
const override;
3537 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
3538 QVariantMap toVariantMap()
const override;
3539 bool fromVariantMap(
const QVariantMap &map )
override;
3547 bool opacityEnabled()
const;
3556 void setOpacityEnabled(
bool enabled );
3565 bool mAllowOpacity =
true;
3587 const QString &sourceCrsParameterName = QString(),
const QString &destinationCrsParameterName = QString(),
3588 const QVariant &staticSourceCrs = QVariant(),
const QVariant &staticDestinationCrs = QVariant(),
3589 bool optional =
false );
3594 static QString
typeName() {
return QStringLiteral(
"coordinateoperation" ); }
3597 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
3598 QString asScriptCode()
const override;
3600 QStringList dependsOnOtherParameters()
const override;
3602 QVariantMap toVariantMap()
const override;
3603 bool fromVariantMap(
const QVariantMap &map )
override;
3668 QString mSourceParameterName;
3669 QString mDestParameterName;
3670 QVariant mSourceCrs;
3693 bool optional =
false );
3698 static QString
typeName() {
return QStringLiteral(
"maptheme" ); }
3701 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
3702 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
3703 QString asScriptCode()
const override;
3705 QVariantMap toVariantMap()
const override;
3706 bool fromVariantMap(
const QVariantMap &map )
override;
3744 Type type = DateTime,
3745 const QVariant &defaultValue = QVariant(),
3746 bool optional =
false,
3747 const QDateTime &minValue = QDateTime(),
3748 const QDateTime &maxValue = QDateTime()
3754 static QString
typeName() {
return QStringLiteral(
"datetime" ); }
3757 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
3758 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
3759 QString toolTip()
const override;
3769 QDateTime minimum()
const;
3782 void setMinimum(
const QDateTime &minimum );
3791 QDateTime maximum()
const;
3804 void setMaximum(
const QDateTime &maximum );
3810 Type dataType()
const;
3816 void setDataType( Type type );
3818 QVariantMap toVariantMap()
const override;
3819 bool fromVariantMap(
const QVariantMap &map )
override;
3830 Type mDataType = DateTime;
3855 bool optional =
false );
3860 static QString
typeName() {
return QStringLiteral(
"providerconnection" ); }
3863 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
3864 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
3865 QString asScriptCode()
const override;
3867 QVariantMap toVariantMap()
const override;
3868 bool fromVariantMap(
const QVariantMap &map )
override;
3889 QString mProviderId;
3915 QgsProcessingParameterDatabaseSchema(
const QString &name,
const QString &description,
const QString &connectionParameterName = QString(),
const QVariant &defaultValue = QVariant(),
3916 bool optional =
false );
3921 static QString
typeName() {
return QStringLiteral(
"databaseschema" ); }
3924 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
3925 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
3926 QString asScriptCode()
const override;
3928 QVariantMap toVariantMap()
const override;
3929 bool fromVariantMap(
const QVariantMap &map )
override;
3930 QStringList dependsOnOtherParameters()
const override;
3936 QString parentConnectionParameterName()
const;
3942 void setParentConnectionParameterName(
const QString &name );
3951 QString mParentConnectionParameterName;
3979 const QString &connectionParameterName = QString(),
3980 const QString &schemaParameterName = QString(),
3981 const QVariant &defaultValue = QVariant(),
3982 bool optional =
false,
3983 bool allowNewTableNames =
false );
3988 static QString
typeName() {
return QStringLiteral(
"databasetable" ); }
3991 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
3992 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
3993 QString asScriptCode()
const override;
3995 QVariantMap toVariantMap()
const override;
3996 bool fromVariantMap(
const QVariantMap &map )
override;
3997 QStringList dependsOnOtherParameters()
const override;
4003 QString parentConnectionParameterName()
const;
4009 void setParentConnectionParameterName(
const QString &name );
4015 QString parentSchemaParameterName()
const;
4021 void setParentSchemaParameterName(
const QString &name );
4034 bool allowNewTableNames()
const;
4042 void setAllowNewTableNames(
bool allowed );
4046 QString mParentConnectionParameterName;
4047 QString mParentSchemaParameterName;
4048 bool mAllowNewTableNames =
false;
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.
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.
Represents a mesh layer supporting display of data on structured or unstructured meshes.
A class to represent a 2D point.
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 ...
virtual QgsProcessingOutputDefinition * toOutputDefinition() const =0
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
bool isDestination() const override
Returns true if this parameter represents a file or layer destination, e.g.
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
QgsProperty source
Source definition.
long long featureLimit
If set to a value > 0, places a limit on the maximum number of features which will be read from the s...
Flag
Flags which control source behavior.
QgsProcessingFeatureSourceDefinition(const QgsProperty &source, bool selectedFeaturesOnly=false, long long featureLimit=-1, QgsProcessingFeatureSourceDefinition::Flags flags=QgsProcessingFeatureSourceDefinition::Flags(), QgsFeatureRequest::InvalidGeometryCheck geometryCheck=QgsFeatureRequest::GeometryAbortOnInvalid)
Constructor for QgsProcessingFeatureSourceDefinition, accepting a QgsProperty source.
QgsFeatureSource subclass which proxies methods to an underlying QgsFeatureSource,...
Base class for providing feedback from a processing algorithm.
Base class for the definition of processing outputs.
Encapsulates settings relating to a feature sink or output raster layer for a processing algorithm.
QgsProcessingOutputLayerDefinition(const QgsProperty &sink, QgsProject *destinationProject=nullptr)
Constructor for QgsProcessingOutputLayerDefinition, accepting a QgsProperty sink/layer.
QgsProperty sink
Sink/layer definition.
bool useRemapping() const
Returns true if the output uses a remapping definition.
QgsProcessingOutputLayerDefinition(const QString &sink=QString(), QgsProject *destinationProject=nullptr)
Constructor for QgsProcessingOutputLayerDefinition, accepting a static sink/layer string.
QgsRemappingSinkDefinition remappingDefinition() const
Returns the output remapping definition, if useRemapping() is true.
QString destinationName
Name to use for sink if it's to be loaded into a destination project.
QVariantMap createOptions
Map of optional sink/layer creation options, which are passed to the underlying provider when creatin...
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.
@ DateTime
Datetime values.
static QString typeName()
Returns the type name for the parameter class.
Base class for the definition of processing parameters.
QString mHelp
Parameter help.
QVariant defaultValue() const
Returns the default value for the parameter.
void setDefaultValue(const QVariant &value)
Sets the default value for the parameter.
QVariant guiDefaultValueOverride() const
Returns the default value to use in the GUI for the parameter.
QStringList additionalExpressionContextVariables() const
Returns a list of additional expression context variables which are available for use when evaluating...
QStringList mAdditionalExpressionVariables
Additional expression context variables exposed for use by this parameter.
QString help() const
Returns the help for the parameter.
void setMetadata(const QVariantMap &metadata)
Sets the parameter's freeform metadata.
Flags mFlags
Parameter flags.
virtual QgsProcessingParameterDefinition * clone() const =0
Creates a clone of the parameter definition.
QString mName
Parameter name.
void setGuiDefaultValueOverride(const QVariant &value)
Sets the default value to use for the parameter in GUI widgets.
QVariantMap metadata() const
Returns the parameter's freeform metadata.
QString description() const
Returns the description for the parameter.
QString mDynamicLayerParameterName
Linked vector layer parameter name for dynamic properties.
QVariant defaultValueForGui() const
Returns the default value to use for the parameter in a GUI.
virtual bool isDestination() const
Returns true if this parameter represents a file or layer destination, e.g.
void setDescription(const QString &description)
Sets the description for the parameter.
void setDynamicLayerParameterName(const QString &name)
Sets the name for the parameter for a layer linked to a dynamic parameter, or an empty string if this...
QString dynamicLayerParameterName() const
Returns the name of the parameter for a layer linked to a dynamic parameter, or an empty string if th...
void setAdditionalExpressionContextVariables(const QStringList &variables)
Sets a list of additional expression context variables which are available for use when evaluating th...
QVariantMap mMetadata
Freeform metadata for parameter. Mostly used by widget wrappers to customize their appearance and beh...
void setName(const QString &name)
Sets the name of the parameter.
QString mDescription
Parameter description.
virtual 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.
QVariantMap & metadata()
Returns the parameter's freeform metadata.
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
QgsPropertyDefinition dynamicPropertyDefinition() const
Returns the property definition for dynamic properties.
A double numeric parameter for distance values.
void setDefaultUnit(QgsUnitTypes::DistanceUnit unit)
Sets the default distance unit for the parameter.
static QString typeName()
Returns the type name for the parameter class.
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.
DataType
Field data types.
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
Parameter behavior.
@ Folder
Parameter is a folder.
Behavior behavior() const
Returns the parameter behavior (e.g.
A folder destination parameter, for specifying the destination path for a folder created by the algor...
static QString typeName()
Returns the type name for the parameter class.
A geometry parameter for processing algorithms.
void setGeometryTypes(const QList< int > &geometryTypes)
Sets the allowed geometryTypes, as a list of QgsWkbTypes::GeometryType values.
QList< int > geometryTypes() const
Returns the parameter allowed geometries, as a list of QgsWkbTypes::GeometryType values.
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.
@ Double
Double/float values.
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.
A vector layer destination parameter, for specifying the destination path for a vector layer created ...
static QString typeName()
Returns the type name for the parameter class.
A vector layer (with or without geometry) parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
A collection of utilities for working with parameters when running a processing algorithm.
Abstract base class for processing providers.
LayerHint
Layer type hints.
@ UnknownType
Unknown layer type.
Contains enumerations and other constants for use in processing algorithms and parameters.
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 for a property.
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.
Helper functions for various unit types.
DistanceUnit
Units of distance.
@ DistanceUnknownUnit
Unknown distance unit.
Represents a vector layer which manages a vector based data sets.
Type
The WKB type describes the number of dimensions a geometry has.
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)
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsField::ConfigurationFlags) CORE_EXPORT QDataStream &operator<<(QDataStream &out
Writes the field to stream out. QGIS version compatibility is not guaranteed.
Q_DECLARE_METATYPE(QgsMeshTimeSettings)
QList< const QgsProcessingParameterDefinition * > QgsProcessingParameterDefinitions
List of processing parameters.
const QgsCoordinateReferenceSystem & crs