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;
610 virtual QString valueAsPythonComment(
const QVariant &value,
QgsProcessingContext &context )
const;
616 virtual QString asScriptCode()
const;
634 virtual QVariantMap toVariantMap()
const;
641 virtual bool fromVariantMap(
const QVariantMap &map );
663 void setMetadata(
const QVariantMap &metadata ) { mMetadata = metadata; }
689 virtual QString toolTip()
const;
812 bool mIsDynamic =
false;
860 static bool isDynamic(
const QVariantMap ¶meters,
const QString &name );
1067 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;
1090 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;
1578 static QString descriptionFromName(
const QString &name );
1589 static bool parseScriptCodeParameterOptions(
const QString &code,
bool &isOptional, QString &name, QString &type, QString &definition );
1608 bool optional =
false );
1613 static QString
typeName() {
return QStringLiteral(
"boolean" ); }
1616 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
1617 QString asScriptCode()
const override;
1638 QgsProcessingParameterCrs(
const QString &name,
const QString &description = QString(),
const QVariant &defaultValue = QVariant(),
1639 bool optional =
false );
1644 static QString
typeName() {
return QStringLiteral(
"crs" ); }
1647 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
1648 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
1671 bool optional =
false );
1676 static QString
typeName() {
return QStringLiteral(
"extent" ); }
1679 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
1680 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
1703 QgsProcessingParameterPoint(
const QString &name,
const QString &description = QString(),
const QVariant &defaultValue = QVariant(),
1704 bool optional =
false );
1709 static QString
typeName() {
return QStringLiteral(
"point" ); }
1712 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
1713 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
1739 QgsProcessingParameterGeometry(
const QString &name,
const QString &description = QString(),
const QVariant &defaultValue = QVariant(),
bool optional =
false,
const QList< int > &geometryTypes = QList< int >(),
bool allowMultipart =
true );
1744 static QString
typeName() {
return QStringLiteral(
"geometry" ); }
1747 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
1748 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
1749 QString asScriptCode()
const override;
1751 QVariantMap toVariantMap()
const override;
1752 bool fromVariantMap(
const QVariantMap &map )
override;
1787 QList<int> mGeomTypes;
1788 bool mAllowMultipart;
1816 QgsProcessingParameterFile(
const QString &name,
const QString &description = QString(), Behavior behavior = File,
const QString &extension = QString(),
const QVariant &defaultValue = QVariant(),
1817 bool optional =
false,
const QString &fileFilter = QString() );
1822 static QString
typeName() {
return QStringLiteral(
"file" ); }
1825 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
1826 QString asScriptCode()
const override;
1828 QString createFileFilter()
const override;
1860 void setExtension(
const QString &extension );
1868 QString fileFilter()
const;
1879 void setFileFilter(
const QString &filter );
1881 QVariantMap toVariantMap()
const override;
1882 bool fromVariantMap(
const QVariantMap &map )
override;
1887 static QgsProcessingParameterFile *fromScriptCode(
const QString &name,
const QString &description,
bool isOptional,
const QString &definition, Behavior behavior = File )
SIP_FACTORY;
1891 Behavior mBehavior = File;
1893 QString mFileFilter;
1910 bool hasFixedNumberRows =
false,
const QStringList &headers = QStringList(),
1911 const QVariant &defaultValue = QVariant(),
1912 bool optional =
false );
1917 static QString
typeName() {
return QStringLiteral(
"matrix" ); }
1920 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
1921 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
1928 QStringList headers()
const;
1934 void setHeaders(
const QStringList &headers );
1942 int numberRows()
const;
1950 void setNumberRows(
int rows );
1957 bool hasFixedNumberRows()
const;
1964 void setHasFixedNumberRows(
bool hasFixedNumberRows );
1966 QVariantMap toVariantMap()
const override;
1967 bool fromVariantMap(
const QVariantMap &map )
override;
1976 QStringList mHeaders;
1977 int mNumberRows = 3;
1978 bool mFixedNumberRows =
false;
1996 const QVariant &defaultValue = QVariant(),
1997 bool optional =
false );
2002 static QString
typeName() {
return QStringLiteral(
"multilayer" ); }
2005 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
2006 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
2007 QString asScriptCode()
const override;
2009 QString createFileFilter()
const override;
2028 int minimumNumberInputs()
const;
2035 void setMinimumNumberInputs(
int minimum );
2037 QVariantMap toVariantMap()
const override;
2038 bool fromVariantMap(
const QVariantMap &map )
override;
2048 int mMinimumNumberInputs = 0;
2085 Type type = Integer,
2086 const QVariant &defaultValue = QVariant(),
2087 bool optional =
false,
2088 double minValue = std::numeric_limits<double>::lowest() + 1,
2089 double maxValue = std::numeric_limits<double>::max()
2095 static QString
typeName() {
return QStringLiteral(
"number" ); }
2098 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
2099 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
2100 QString toolTip()
const override;
2107 double minimum()
const;
2113 void setMinimum(
double minimum );
2119 double maximum()
const;
2125 void setMaximum(
double maximum );
2131 Type dataType()
const;
2137 void setDataType( Type type );
2139 QVariantMap toVariantMap()
const override;
2140 bool fromVariantMap(
const QVariantMap &map )
override;
2149 double mMin = std::numeric_limits<double>::lowest() + 1;
2150 double mMax = std::numeric_limits<double>::max();
2151 Type mDataType = Integer;
2181 const QVariant &defaultValue = QVariant(),
2182 const QString &parentParameterName = QString(),
2183 bool optional =
false,
2184 double minValue = std::numeric_limits<double>::lowest() + 1,
2185 double maxValue = std::numeric_limits<double>::max() );
2190 static QString
typeName() {
return QStringLiteral(
"distance" ); }
2194 QString type() const override;
2195 QStringList dependsOnOtherParameters() const override;
2196 QString asPythonString(
QgsProcessing::PythonOutputType outputType =
QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2202 QString parentParameterName() const;
2208 void setParentParameterName( const QString &parentParameterName );
2226 QVariantMap toVariantMap()
const override;
2227 bool fromVariantMap(
const QVariantMap &map )
override;
2231 QString mParentParameterName;
2254 const QVariant &defaultValue = QVariant(),
2255 bool optional =
false );
2260 static QString
typeName() {
return QStringLiteral(
"scale" ); }
2264 QString type() const override;
2265 QString asPythonString(
QgsProcessing::PythonOutputType outputType =
QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
2289 const QVariant &defaultValue = QVariant(),
2290 bool optional =
false );
2295 static QString
typeName() {
return QStringLiteral(
"range" ); }
2298 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
2299 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
2314 QVariantMap toVariantMap()
const override;
2315 bool fromVariantMap(
const QVariantMap &map )
override;
2341 bool optional =
false );
2346 static QString
typeName() {
return QStringLiteral(
"raster" ); }
2349 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
2350 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
2351 QString createFileFilter()
const override;
2373 QgsProcessingParameterEnum(
const QString &name,
const QString &description = QString(),
const QStringList &options = QStringList(),
2374 bool allowMultiple =
false,
2375 const QVariant &defaultValue = QVariant(),
2376 bool optional =
false,
2377 bool usesStaticStrings =
false );
2382 static QString
typeName() {
return QStringLiteral(
"enum" ); }
2385 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
2386 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
2387 QString valueAsPythonComment(
const QVariant &value,
QgsProcessingContext &context )
const override;
2388 QString asScriptCode()
const override;
2395 QStringList options()
const;
2401 void setOptions(
const QStringList &options );
2407 bool allowMultiple()
const;
2413 void setAllowMultiple(
bool allowMultiple );
2421 bool usesStaticStrings()
const;
2429 void setUsesStaticStrings(
bool usesStaticStrings );
2431 QVariantMap toVariantMap()
const override;
2432 bool fromVariantMap(
const QVariantMap &map )
override;
2441 QStringList mOptions;
2442 bool mAllowMultiple =
false;
2443 bool mUsesStaticStrings =
false;
2460 bool multiLine =
false,
2461 bool optional =
false );
2466 static QString
typeName() {
return QStringLiteral(
"string" ); }
2469 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
2470 QString asScriptCode()
const override;
2477 bool multiLine()
const;
2483 void setMultiLine(
bool multiLine );
2485 QVariantMap toVariantMap()
const override;
2486 bool fromVariantMap(
const QVariantMap &map )
override;
2495 bool mMultiLine =
false;
2520 bool optional =
false );
2525 static QString
typeName() {
return QStringLiteral(
"authcfg" ); }
2528 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
2529 QString asScriptCode()
const override;
2552 const QString &parentLayerParameterName = QString(),
2553 bool optional =
false );
2558 static QString
typeName() {
return QStringLiteral(
"expression" ); }
2561 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
2562 QStringList dependsOnOtherParameters()
const override;
2569 QString parentLayerParameterName()
const;
2575 void setParentLayerParameterName(
const QString &parentLayerParameterName );
2577 QVariantMap toVariantMap()
const override;
2578 bool fromVariantMap(
const QVariantMap &map )
override;
2587 QString mParentLayerParameterName;
2611 QList< int > dataTypes()
const;
2617 void setDataTypes(
const QList< int > &types );
2640 const QString &description = QString(),
2641 const QList< int > &types = QList< int >(),
2642 const QVariant &defaultValue = QVariant(),
2643 bool optional =
false );
2648 static QString
typeName() {
return QStringLiteral(
"vector" ); }
2651 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
2652 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
2654 QString createFileFilter()
const override;
2656 QVariantMap toVariantMap()
const override;
2657 bool fromVariantMap(
const QVariantMap &map )
override;
2680 const QString &description = QString(),
2681 const QVariant &defaultValue = QVariant(),
2682 bool optional =
false );
2687 static QString
typeName() {
return QStringLiteral(
"mesh" ); }
2690 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
2691 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
2692 QString createFileFilter()
const override;
2714 bool optional =
false,
2715 const QList< int > &types = QList< int >() );
2720 static QString
typeName() {
return QStringLiteral(
"layer" ); }
2723 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
2724 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
2725 QString asScriptCode()
const override;
2727 QString createFileFilter()
const override;
2729 QVariantMap toVariantMap()
const override;
2730 bool fromVariantMap(
const QVariantMap &map )
override;
2761 QgsProcessingParameterField(
const QString &name,
const QString &description = QString(),
const QVariant &defaultValue = QVariant(),
2762 const QString &parentLayerParameterName = QString(),
2763 DataType type = Any,
2764 bool allowMultiple =
false,
2765 bool optional =
false,
2766 bool defaultToAllFields =
false );
2771 static QString
typeName() {
return QStringLiteral(
"field" ); }
2774 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
2775 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
2776 QString asScriptCode()
const override;
2778 QStringList dependsOnOtherParameters()
const override;
2784 QString parentLayerParameterName()
const;
2790 void setParentLayerParameterName(
const QString &parentLayerParameterName );
2796 DataType dataType()
const;
2802 void setDataType( DataType type );
2808 bool allowMultiple()
const;
2814 void setAllowMultiple(
bool allowMultiple );
2825 bool defaultToAllFields()
const;
2836 void setDefaultToAllFields(
bool enabled );
2838 QVariantMap toVariantMap()
const override;
2839 bool fromVariantMap(
const QVariantMap &map )
override;
2848 QString mParentLayerParameterName;
2849 DataType mDataType = Any;
2850 bool mAllowMultiple =
false;
2851 bool mDefaultToAllFields =
false;
2870 const QList< int > &types = QList< int >(),
2871 const QVariant &defaultValue = QVariant(),
bool optional =
false );
2876 static QString
typeName() {
return QStringLiteral(
"source" ); }
2879 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
2880 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
2881 QString asScriptCode()
const override;
2883 QString createFileFilter()
const override;
2885 QVariantMap toVariantMap()
const override;
2886 bool fromVariantMap(
const QVariantMap &map )
override;
2913 bool optional =
false,
bool createByDefault =
true );
2916 QVariantMap toVariantMap()
const override;
2917 bool fromVariantMap(
const QVariantMap &map )
override;
2919 QString createFileFilter()
const override;
2952 virtual QString generateTemporaryDestination()
const;
2975 bool createByDefault()
const;
2982 void setCreateByDefault(
bool createByDefault );
3007 bool mSupportsNonFileBasedOutputs =
true;
3008 bool mCreateByDefault =
true;
3010 friend class QgsProcessingModelAlgorithm;
3011 friend class TestQgsProcessing;
3034 bool optional =
false,
bool createByDefault =
true,
bool supportsAppend =
false );
3039 static QString
typeName() {
return QStringLiteral(
"sink" ); }
3042 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
3043 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
3044 QString asScriptCode()
const override;
3046 QString defaultFileExtension() const override;
3047 QString asPythonString(
QgsProcessing::PythonOutputType outputType =
QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3048 QString createFileFilter() const override;
3055 virtual QStringList supportedOutputVectorLayerExtensions() const;
3067 bool hasGeometry() const;
3083 bool supportsAppend() const;
3093 void setSupportsAppend(
bool supportsAppend );
3095 QVariantMap toVariantMap() const override;
3096 bool fromVariantMap( const QVariantMap &map ) override;
3097 QString generateTemporaryDestination() const override;
3107 bool mSupportsAppend = false;
3132 bool optional =
false,
bool createByDefault =
true );
3137 static QString
typeName() {
return QStringLiteral(
"vectorDestination" ); }
3140 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
3141 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
3142 QString asScriptCode()
const override;
3144 QString defaultFileExtension() const override;
3145 QString asPythonString(
QgsProcessing::PythonOutputType outputType =
QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3146 QString createFileFilter() const override;
3153 virtual QStringList supportedOutputVectorLayerExtensions() const;
3165 bool hasGeometry() const;
3173 QVariantMap toVariantMap() const override;
3174 bool fromVariantMap( const QVariantMap &map ) override;
3205 const QVariant &defaultValue = QVariant(),
3206 bool optional =
false,
3207 bool createByDefault =
true );
3212 static QString
typeName() {
return QStringLiteral(
"rasterDestination" ); }
3215 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
3216 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
3218 QString defaultFileExtension() const override;
3219 QString createFileFilter() const override;
3226 virtual QStringList supportedOutputRasterLayerExtensions() const;
3266 const QString &fileFilter = QString(),
3267 const QVariant &defaultValue = QVariant(),
3268 bool optional =
false,
3269 bool createByDefault =
true );
3274 static QString
typeName() {
return QStringLiteral(
"fileDestination" ); }
3277 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
3278 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
3280 QString defaultFileExtension() const override;
3281 QString asPythonString(
QgsProcessing::PythonOutputType outputType =
QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const override;
3282 QString createFileFilter() const override;
3288 QString fileFilter() const;
3294 void setFileFilter( const QString &filter );
3296 QVariantMap toVariantMap() const override;
3297 bool fromVariantMap( const QVariantMap &map ) override;
3307 QString mFileFilter;
3325 const QVariant &defaultValue = QVariant(),
3326 bool optional =
false,
3327 bool createByDefault =
true );
3332 static QString
typeName() {
return QStringLiteral(
"folderDestination" ); }
3335 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
3337 QString defaultFileExtension() const override;
3359 QgsProcessingParameterBand(
const QString &name,
const QString &description = QString(),
const QVariant &defaultValue = QVariant(),
3360 const QString &parentLayerParameterName = QString(),
3361 bool optional =
false,
3362 bool allowMultiple =
false );
3367 static QString
typeName() {
return QStringLiteral(
"band" ); }
3370 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
3371 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
3372 QString asScriptCode()
const override;
3373 QStringList dependsOnOtherParameters()
const override;
3380 QString parentLayerParameterName()
const;
3386 void setParentLayerParameterName(
const QString &parentLayerParameterName );
3388 QVariantMap toVariantMap()
const override;
3389 bool fromVariantMap(
const QVariantMap &map )
override;
3401 bool allowMultiple()
const;
3408 void setAllowMultiple(
bool allowMultiple );
3412 QString mParentLayerParameterName;
3413 bool mAllowMultiple =
false;
3435 bool optional =
false );
3440 static QString
typeName() {
return QStringLiteral(
"layout" ); }
3443 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
3444 QString asScriptCode()
const override;
3473 const QString &parentLayoutParameterName = QString(),
3475 bool optional =
false );
3480 static QString
typeName() {
return QStringLiteral(
"layoutitem" ); }
3483 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
3484 QString asScriptCode()
const override;
3486 QVariantMap toVariantMap()
const override;
3487 bool fromVariantMap(
const QVariantMap &map )
override;
3488 QStringList dependsOnOtherParameters()
const override;
3499 QString parentLayoutParameterName()
const;
3505 void setParentLayoutParameterName(
const QString &name );
3514 int itemType()
const;
3523 void setItemType(
int type );
3526 QString mParentLayoutParameterName;
3548 QgsProcessingParameterColor(
const QString &name,
const QString &description = QString(),
const QVariant &defaultValue = QVariant(),
3549 bool opacityEnabled =
true,
3550 bool optional =
false );
3555 static QString
typeName() {
return QStringLiteral(
"color" ); }
3558 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
3559 QString asScriptCode()
const override;
3561 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
3562 QVariantMap toVariantMap()
const override;
3563 bool fromVariantMap(
const QVariantMap &map )
override;
3571 bool opacityEnabled()
const;
3580 void setOpacityEnabled(
bool enabled );
3589 bool mAllowOpacity =
true;
3611 const QString &sourceCrsParameterName = QString(),
const QString &destinationCrsParameterName = QString(),
3612 const QVariant &staticSourceCrs = QVariant(),
const QVariant &staticDestinationCrs = QVariant(),
3613 bool optional =
false );
3618 static QString
typeName() {
return QStringLiteral(
"coordinateoperation" ); }
3621 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
3622 QString asScriptCode()
const override;
3624 QStringList dependsOnOtherParameters()
const override;
3626 QVariantMap toVariantMap()
const override;
3627 bool fromVariantMap(
const QVariantMap &map )
override;
3692 QString mSourceParameterName;
3693 QString mDestParameterName;
3694 QVariant mSourceCrs;
3717 bool optional =
false );
3722 static QString
typeName() {
return QStringLiteral(
"maptheme" ); }
3725 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
3726 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
3727 QString asScriptCode()
const override;
3729 QVariantMap toVariantMap()
const override;
3730 bool fromVariantMap(
const QVariantMap &map )
override;
3768 Type type = DateTime,
3769 const QVariant &defaultValue = QVariant(),
3770 bool optional =
false,
3771 const QDateTime &minValue = QDateTime(),
3772 const QDateTime &maxValue = QDateTime()
3778 static QString
typeName() {
return QStringLiteral(
"datetime" ); }
3781 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
3782 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
3783 QString toolTip()
const override;
3793 QDateTime minimum()
const;
3806 void setMinimum(
const QDateTime &minimum );
3815 QDateTime maximum()
const;
3828 void setMaximum(
const QDateTime &maximum );
3834 Type dataType()
const;
3840 void setDataType( Type type );
3842 QVariantMap toVariantMap()
const override;
3843 bool fromVariantMap(
const QVariantMap &map )
override;
3854 Type mDataType = DateTime;
3879 bool optional =
false );
3884 static QString
typeName() {
return QStringLiteral(
"providerconnection" ); }
3887 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
3888 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
3889 QString asScriptCode()
const override;
3891 QVariantMap toVariantMap()
const override;
3892 bool fromVariantMap(
const QVariantMap &map )
override;
3913 QString mProviderId;
3939 QgsProcessingParameterDatabaseSchema(
const QString &name,
const QString &description,
const QString &connectionParameterName = QString(),
const QVariant &defaultValue = QVariant(),
3940 bool optional =
false );
3945 static QString
typeName() {
return QStringLiteral(
"databaseschema" ); }
3948 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
3949 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
3950 QString asScriptCode()
const override;
3952 QVariantMap toVariantMap()
const override;
3953 bool fromVariantMap(
const QVariantMap &map )
override;
3954 QStringList dependsOnOtherParameters()
const override;
3960 QString parentConnectionParameterName()
const;
3966 void setParentConnectionParameterName(
const QString &name );
3975 QString mParentConnectionParameterName;
4003 const QString &connectionParameterName = QString(),
4004 const QString &schemaParameterName = QString(),
4005 const QVariant &defaultValue = QVariant(),
4006 bool optional =
false,
4007 bool allowNewTableNames =
false );
4012 static QString
typeName() {
return QStringLiteral(
"databasetable" ); }
4015 bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const override;
4016 QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const override;
4017 QString asScriptCode()
const override;
4019 QVariantMap toVariantMap()
const override;
4020 bool fromVariantMap(
const QVariantMap &map )
override;
4021 QStringList dependsOnOtherParameters()
const override;
4027 QString parentConnectionParameterName()
const;
4033 void setParentConnectionParameterName(
const QString &name );
4039 QString parentSchemaParameterName()
const;
4045 void setParentSchemaParameterName(
const QString &name );
4058 bool allowNewTableNames()
const;
4066 void setAllowNewTableNames(
bool allowed );
4070 QString mParentConnectionParameterName;
4071 QString mParentSchemaParameterName;
4072 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.
bool allowMultipart() const
Returns the parameter allow multipart geometries.
QList< int > geometryTypes() const
Returns the parameter allowed geometries, as a list of QgsWkbTypes::GeometryType values.
void setAllowMultipart(bool allowMultipart)
Sets the allow multipart geometries.
static QString typeName()
Returns the type name for the parameter class.
A print layout item parameter, allowing users to select a particular item from a print layout.
static QString typeName()
Returns the type name for the parameter class.
A print layout parameter, allowing users to select a print layout.
static QString typeName()
Returns the type name for the parameter class.
Can be inherited by parameters which require limits to their acceptable data types.
QList< int > mDataTypes
List of acceptable data types for the parameter.
A map layer parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A map theme parameter for processing algorithms, allowing users to select an existing map theme from ...
static QString typeName()
Returns the type name for the parameter class.
A table (matrix) parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
A mesh layer parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
A parameter for processing algorithms which accepts multiple map layers.
static QString typeName()
Returns the type name for the parameter class.
A numeric parameter for processing algorithms.
@ 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