18 #ifndef QGSPROCESSINGPARAMETERS_H 19 #define QGSPROCESSINGPARAMETERS_H 21 #include "qgis_core.h" 58 , selectedFeaturesOnly( selectedFeaturesOnly )
66 , selectedFeaturesOnly( selectedFeaturesOnly )
86 return !( *
this == other );
90 operator QVariant()
const 92 return QVariant::fromValue( *
this );
119 , destinationProject( destinationProject )
129 , destinationProject( destinationProject )
163 QVariant toVariant()
const;
171 bool loadVariant(
const QVariantMap &map );
174 operator QVariant()
const 176 return QVariant::fromValue( *
this );
208 sipType = sipType_QgsProcessingParameterBoolean;
210 sipType = sipType_QgsProcessingParameterCrs;
212 sipType = sipType_QgsProcessingParameterMapLayer;
214 sipType = sipType_QgsProcessingParameterExtent;
216 sipType = sipType_QgsProcessingParameterPoint;
218 sipType = sipType_QgsProcessingParameterFile;
220 sipType = sipType_QgsProcessingParameterMatrix;
222 sipType = sipType_QgsProcessingParameterMultipleLayers;
224 sipType = sipType_QgsProcessingParameterNumber;
226 sipType = sipType_QgsProcessingParameterDistance;
228 sipType = sipType_QgsProcessingParameterRange;
230 sipType = sipType_QgsProcessingParameterRasterLayer;
232 sipType = sipType_QgsProcessingParameterEnum;
234 sipType = sipType_QgsProcessingParameterString;
236 sipType = sipType_QgsProcessingParameterExpression;
238 sipType = sipType_QgsProcessingParameterVectorLayer;
240 sipType = sipType_QgsProcessingParameterField;
242 sipType = sipType_QgsProcessingParameterFeatureSource;
244 sipType = sipType_QgsProcessingParameterFeatureSink;
246 sipType = sipType_QgsProcessingParameterVectorDestination;
248 sipType = sipType_QgsProcessingParameterRasterDestination;
250 sipType = sipType_QgsProcessingParameterFileDestination;
252 sipType = sipType_QgsProcessingParameterFolderDestination;
254 sipType = sipType_QgsProcessingParameterBand;
265 FlagAdvanced = 1 << 1,
267 FlagOptional = 1 << 3,
268 FlagIsModelOutput = 1 << 4,
270 Q_DECLARE_FLAGS( Flags,
Flag )
275 QgsProcessingParameterDefinition( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
276 bool optional = false );
278 virtual ~QgsProcessingParameterDefinition() = default;
283 virtual QgsProcessingParameterDefinition *clone() const = 0
SIP_FACTORY;
288 virtual QString type() const = 0;
295 virtual
bool isDestination()
const {
return false; }
302 QString
name()
const {
return mName; }
309 void setName(
const QString &name ) { mName = name; }
323 void setDescription(
const QString &description ) { mDescription = description; }
342 Flags
flags()
const {
return mFlags; }
357 virtual bool checkValueIsAcceptable(
const QVariant &input,
QgsProcessingContext *context =
nullptr )
const;
363 virtual QString valueAsPythonString(
const QVariant &value,
QgsProcessingContext &context )
const;
369 virtual QString asScriptCode()
const;
376 virtual QVariantMap toVariantMap()
const;
383 virtual bool fromVariantMap(
const QVariantMap &map );
405 void setMetadata(
const QVariantMap &metadata ) { mMetadata = metadata; }
431 virtual QString toolTip()
const;
514 bool mIsDynamic =
false;
527 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsProcessingParameterDefinition::Flags )
559 static bool isDynamic(
const QVariantMap ¶meters,
const QString &
name );
958 static QString descriptionFromName(
const QString &name );
969 static bool parseScriptCodeParameterOptions(
const QString &code,
bool &isOptional, QString &name, QString &type, QString &definition );
988 bool optional =
false );
993 static QString
typeName() {
return QStringLiteral(
"boolean" ); }
1018 QgsProcessingParameterCrs(
const QString &name,
const QString &description = QString(),
const QVariant &defaultValue = QVariant(),
1019 bool optional =
false );
1024 static QString
typeName() {
return QStringLiteral(
"crs" ); }
1051 bool optional =
false );
1056 static QString
typeName() {
return QStringLiteral(
"layer" ); }
1083 bool optional =
false );
1088 static QString
typeName() {
return QStringLiteral(
"extent" ); }
1115 QgsProcessingParameterPoint(
const QString &name,
const QString &description = QString(),
const QVariant &defaultValue = QVariant(),
1116 bool optional =
false );
1121 static QString
typeName() {
return QStringLiteral(
"point" ); }
1154 QgsProcessingParameterFile(
const QString &name,
const QString &description = QString(),
Behavior behavior = File,
const QString &extension = QString(),
const QVariant &defaultValue = QVariant(),
1155 bool optional =
false );
1160 static QString
typeName() {
return QStringLiteral(
"file" ); }
1218 bool hasFixedNumberRows =
false,
const QStringList &headers = QStringList(),
1219 const QVariant &defaultValue = QVariant(),
1220 bool optional =
false );
1225 static QString
typeName() {
return QStringLiteral(
"matrix" ); }
1235 QStringList headers()
const;
1241 void setHeaders(
const QStringList &headers );
1249 int numberRows()
const;
1257 void setNumberRows(
int rows );
1264 bool hasFixedNumberRows()
const;
1271 void setHasFixedNumberRows(
bool hasFixedNumberRows );
1283 QStringList mHeaders;
1284 int mNumberRows = 3;
1285 bool mFixedNumberRows =
false;
1303 const QVariant &defaultValue = QVariant(),
1304 bool optional =
false );
1309 static QString
typeName() {
return QStringLiteral(
"multilayer" ); }
1333 int minimumNumberInputs()
const;
1340 void setMinimumNumberInputs(
int minimum );
1353 int mMinimumNumberInputs = 0;
1390 Type type = Integer,
1391 const QVariant &defaultValue = QVariant(),
1392 bool optional =
false,
1393 double minValue = std::numeric_limits<double>::lowest() + 1,
1394 double maxValue = std::numeric_limits<double>::max()
1400 static QString
typeName() {
return QStringLiteral(
"number" ); }
1405 QString
toolTip()
const override;
1411 double minimum()
const;
1417 void setMinimum(
double minimum );
1423 double maximum()
const;
1429 void setMaximum(
double maximum );
1435 Type dataType()
const;
1441 void setDataType(
Type type );
1453 double mMin = std::numeric_limits<double>::lowest() + 1;
1454 double mMax = std::numeric_limits<double>::max();
1455 Type mDataType = Integer;
1485 const QVariant &defaultValue = QVariant(),
1486 const QString &parentParameterName = QString(),
1487 bool optional =
false,
1488 double minValue = std::numeric_limits<double>::lowest() + 1,
1489 double maxValue = std::numeric_limits<double>::max() );
1494 static QString
typeName() {
return QStringLiteral(
"distance" ); }
1498 QString
type()
const override;
1505 QString parentParameterName()
const;
1511 void setParentParameterName(
const QString &parentParameterName );
1534 QString mParentParameterName;
1554 const QVariant &defaultValue = QVariant(),
1555 bool optional =
false );
1560 static QString
typeName() {
return QStringLiteral(
"range" ); }
1605 bool optional =
false );
1610 static QString
typeName() {
return QStringLiteral(
"raster" ); }
1636 QgsProcessingParameterEnum(
const QString &name,
const QString &description = QString(),
const QStringList &options = QStringList(),
1637 bool allowMultiple =
false,
1638 const QVariant &defaultValue = QVariant(),
1639 bool optional =
false );
1644 static QString
typeName() {
return QStringLiteral(
"enum" ); }
1655 QStringList options()
const;
1661 void setOptions(
const QStringList &options );
1667 bool allowMultiple()
const;
1673 void setAllowMultiple(
bool allowMultiple );
1685 QStringList mOptions;
1686 bool mAllowMultiple =
false;
1704 bool multiLine =
false,
1705 bool optional =
false );
1710 static QString
typeName() {
return QStringLiteral(
"string" ); }
1720 bool multiLine()
const;
1726 void setMultiLine(
bool multiLine );
1738 bool mMultiLine =
false;
1756 const QString &parentLayerParameterName = QString(),
1757 bool optional =
false );
1762 static QString
typeName() {
return QStringLiteral(
"expression" ); }
1772 QString parentLayerParameterName()
const;
1778 void setParentLayerParameterName(
const QString &parentLayerParameterName );
1790 QString mParentLayerParameterName;
1814 QList< int > dataTypes()
const;
1820 void setDataTypes(
const QList< int > &types );
1843 const QString &description = QString(),
1844 const QList< int > &types = QList< int >(),
1845 const QVariant &defaultValue = QVariant(),
1846 bool optional =
false );
1851 static QString
typeName() {
return QStringLiteral(
"vector" ); }
1889 QgsProcessingParameterField(
const QString &name,
const QString &description = QString(),
const QVariant &defaultValue = QVariant(),
1890 const QString &parentLayerParameterName = QString(),
1892 bool allowMultiple =
false,
1893 bool optional =
false );
1898 static QString
typeName() {
return QStringLiteral(
"field" ); }
1910 QString parentLayerParameterName()
const;
1916 void setParentLayerParameterName(
const QString &parentLayerParameterName );
1934 bool allowMultiple()
const;
1940 void setAllowMultiple(
bool allowMultiple );
1952 QString mParentLayerParameterName;
1954 bool mAllowMultiple =
false;
1973 const QList< int > &types = QList< int >(),
1974 const QVariant &defaultValue = QVariant(),
bool optional =
false );
1979 static QString
typeName() {
return QStringLiteral(
"source" ); }
2014 bool optional =
false,
bool createByDefault =
true );
2044 virtual QString defaultFileExtension()
const = 0;
2051 virtual QString generateTemporaryDestination()
const;
2058 bool createByDefault()
const;
2065 void setCreateByDefault(
bool createByDefault );
2090 bool mSupportsNonFileBasedOutputs =
true;
2091 bool mCreateByDefault =
true;
2093 friend class QgsProcessingModelAlgorithm;
2094 friend class TestQgsProcessing;
2117 bool optional =
false,
bool createByDefault =
true );
2122 static QString
typeName() {
return QStringLiteral(
"sink" ); }
2136 virtual QStringList supportedOutputVectorLayerExtensions()
const;
2148 bool hasGeometry()
const;
2192 bool optional =
false,
bool createByDefault =
true );
2197 static QString
typeName() {
return QStringLiteral(
"vectorDestination" ); }
2211 virtual QStringList supportedOutputVectorLayerExtensions()
const;
2223 bool hasGeometry()
const;
2263 const QVariant &defaultValue = QVariant(),
2264 bool optional =
false,
2265 bool createByDefault =
true );
2270 static QString
typeName() {
return QStringLiteral(
"rasterDestination" ); }
2283 virtual QStringList supportedOutputRasterLayerExtensions()
const;
2309 const QString &fileFilter = QString(),
2310 const QVariant &defaultValue = QVariant(),
2311 bool optional =
false,
2312 bool createByDefault =
true );
2317 static QString
typeName() {
return QStringLiteral(
"fileDestination" ); }
2329 QString fileFilter()
const;
2335 void setFileFilter(
const QString &filter );
2348 QString mFileFilter;
2367 const QVariant &defaultValue = QVariant(),
2368 bool optional =
false );
2373 static QString
typeName() {
return QStringLiteral(
"folderDestination" ); }
2400 QgsProcessingParameterBand(
const QString &name,
const QString &description = QString(),
const QVariant &defaultValue = QVariant(),
2401 const QString &parentLayerParameterName = QString(),
2402 bool optional =
false,
2403 bool allowMultiple =
false );
2408 static QString
typeName() {
return QStringLiteral(
"band" ); }
2420 QString parentLayerParameterName()
const;
2426 void setParentLayerParameterName(
const QString &parentLayerParameterName );
2441 bool allowMultiple()
const;
2448 void setAllowMultiple(
bool allowMultiple );
2452 QString mParentLayerParameterName;
2453 bool mAllowMultiple =
false;
2458 #endif // QGSPROCESSINGPARAMETERS_H QString type() const override
Unique parameter type name.
QgsProperty sink
Sink/layer definition.
A boolean parameter for processing algorithms.
QList< const QgsProcessingParameterDefinition * > QgsProcessingParameterDefinitions
List of processing parameters.
static QString typeName()
Returns the type name for the parameter class.
QVariantList parameterAsMatrix(const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context) const
Evaluates the parameter with matching name to a matrix/table of values.
virtual QStringList dependsOnOtherParameters() const
Returns a list of other parameter names on which this parameter is dependent (e.g.
An input file or folder parameter for processing algorithms.
A parameter for processing algorithms which accepts multiple map layers.
QgsRectangle parameterAsExtent(const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem()) const
Evaluates the parameter with matching name to a rectangular extent.
A rectangle specified with double values.
Base class for all map layer types.
QgsCoordinateReferenceSystem parameterAsPointCrs(const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context)
Returns the coordinate reference system associated with an point parameter value. ...
QString type() const override
Unique parameter type name.
static QString typeName()
Returns the type name for the parameter class.
QVariantMap & metadata()
Returns the parameter's freeform metadata.
Base class for providing feedback from a processing algorithm.
QString parameterAsString(const QVariantMap ¶meters, const QString &name, const QgsProcessingContext &context) const
Evaluates the parameter with matching name to a static string value.
virtual bool fromVariantMap(const QVariantMap &map)
Restores this parameter to a QVariantMap.
Encapsulates settings relating to a feature sink or output raster layer for a processing algorithm...
QgsProcessingFeatureSourceDefinition(const QString &source=QString(), bool selectedFeaturesOnly=false)
Constructor for QgsProcessingFeatureSourceDefinition, accepting a static string source.
QString type() const override
Unique parameter type name.
QString type() const override
Unique parameter type name.
void setIsDynamic(bool dynamic)
Sets whether the parameter is dynamic, and can support data-defined values (i.e.
QString type() const override
Unique parameter type name.
A vector layer or feature source field parameter for processing algorithms.
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 mDynamicLayerParameterName
Linked vector layer parameter name for dynamic properties.
QString name() const
Returns the name of the parameter.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
This class provides qgis with the ability to render raster datasets onto the mapcanvas.
static QString typeName()
Returns the type name for the parameter class.
QString type() const override
Unique parameter type name.
QString type() const override
Unique parameter type name.
virtual QString name() const =0
Returns the algorithm name, used for identifying the algorithm.
A map layer parameter for processing algorithms.
QgsProcessingFeatureSource * parameterAsSource(const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context) const
Evaluates the parameter with matching name to a feature source.
A class to represent a 2D point.
An expression parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
QString type() const override
Unique parameter type name.
bool isDestination() const override
Returns true if this parameter represents a file or layer destination, e.g.
An interface for objects which accept features via addFeature(s) methods.
int parameterAsInt(const QVariantMap ¶meters, const QString &name, const QgsProcessingContext &context) const
Evaluates the parameter with matching name to a static integer value.
QString type() const override
Unique parameter type name.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
QVariantMap mMetadata
Freeform metadata for parameter. Mostly used by widget wrappers to customize their appearance and beh...
QgsFeatureSource subclass which proxies methods to an underlying QgsFeatureSource, modifying results according to the settings in a QgsProcessingContext.
Container of fields for a vector layer.
A geometry is the spatial representation of a feature.
Abstract base class for processing providers.
void setFlags(Flags flags)
Sets the flags associated with the parameter.
A raster band parameter for Processing algorithms.
QString type() const override
Unique parameter type name.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QList< int > parameterAsEnums(const QVariantMap ¶meters, const QString &name, const QgsProcessingContext &context) const
Evaluates the parameter with matching name to list of enum values.
static QString typeName()
Returns the type name for the parameter class.
QString type() const override
Unique parameter type name.
static QString typeName()
Returns the type name for the parameter class.
void setDefaultUnit(QgsUnitTypes::DistanceUnit unit)
Sets the default distance unit for the parameter.
const QgsCoordinateReferenceSystem & crs
QString type() const override
Unique parameter type name.
static QString typeName()
Returns the type name for the parameter class.
Base class for all parameter definitions which represent file or layer destinations, e.g.
Abstract base class for processing algorithms.
Q_DECLARE_METATYPE(QModelIndex)
A feature sink output for processing algorithms.
bool operator==(const QgsProcessingFeatureSourceDefinition &other)
bool selectedFeaturesOnly
True if only selected features in the source should be used by algorithms.
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.
Behavior behavior() const
Returns the parameter behavior (e.g.
A numeric range parameter for processing algorithms.
bool operator!=(const QgsProcessingFeatureSourceDefinition &other)
QList< QgsMapLayer * > parameterAsLayerList(const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context) const
Evaluates the parameter with matching name to a list of map layers.
int parameterAsEnum(const QVariantMap ¶meters, const QString &name, const QgsProcessingContext &context) const
Evaluates the parameter with matching name to a enum value.
QgsRasterLayer * parameterAsRasterLayer(const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context) const
Evaluates the parameter with matching name to a raster layer.
void setDynamicPropertyDefinition(const QgsPropertyDefinition &definition)
Sets the property definition for dynamic properties.
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.
Can be inherited by parameters which require limits to their acceptable data types.
A raster layer parameter for processing algorithms.
QList< int > parameterAsInts(const QVariantMap ¶meters, const QString &name, const QgsProcessingContext &context) const
Evaluates the parameter with matching name to a list of integer values.
Type
The WKB type describes the number of dimensions a geometry has.
void setDescription(const QString &description)
Sets the description for the parameter.
static QString typeName()
Returns the type name for the parameter class.
QgsPointXY parameterAsPoint(const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem()) const
Evaluates the parameter with matching name to a point.
virtual bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const
Checks whether the specified input value is acceptable for the parameter.
static QString typeName()
Returns the type name for the parameter class.
QgsProperty source
Source definition.
QgsCoordinateReferenceSystem parameterAsCrs(const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context) const
Evaluates the parameter with matching name to a coordinate reference system.
QgsCoordinateReferenceSystem parameterAsExtentCrs(const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context)
Returns the coordinate reference system associated with an extent parameter value.
QString type() const override
Unique parameter type name.
An enum based parameter for processing algorithms, allowing for selection from predefined values...
virtual QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
static QString typeName()
Returns the type name for the parameter class.
QList< double > parameterAsRange(const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context) const
Evaluates the parameter with matching name to a range of values.
QString parameterAsExpression(const QVariantMap ¶meters, const QString &name, const QgsProcessingContext &context) const
Evaluates the parameter with matching name to an expression.
QgsProcessingProvider * originalProvider() const
Original (source) provider which this parameter has been derived from.
bool isDynamic() const
Returns true if the parameter supports is dynamic, and can support data-defined values (i...
QgsVectorLayer * parameterAsVectorLayer(const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context) const
Evaluates the parameter with matching name to a vector layer.
QStringList parameterAsFields(const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context) const
Evaluates the parameter with matching name to a list of fields.
QgsProcessingOutputLayerDefinition(const QgsProperty &sink, QgsProject *destinationProject=nullptr)
Constructor for QgsProcessingOutputLayerDefinition, accepting a QgsProperty sink/layer.
A collection of utilities for working with parameters when running a processing algorithm.
Flags flags() const
Returns any flags associated with the parameter.
A double numeric parameter for distance values.
QgsMapLayer * parameterAsLayer(const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context) const
Evaluates the parameter with matching name to a map layer.
QString type() const override
Unique parameter type name.
Reads and writes project states.
void setDefaultValue(const QVariant &value)
Sets the default value for the parameter.
QString type() const override
Unique parameter type name.
A vector layer (with or without geometry) parameter for processing algorithms.
virtual QString defaultFileExtension() const =0
Returns the default file extension for destination file paths associated with this parameter...
QString parameterAsOutputLayer(const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context) const
Evaluates the parameter with matching name to a output layer destination.
QString description() const
Returns the description for the parameter.
A coordinate reference system parameter for processing algorithms.
QgsUnitTypes::DistanceUnit defaultUnit() const
Returns the default distance unit for the parameter.
A store for object properties.
A rectangular map extent parameter for processing algorithms.
QString type() const override
Unique parameter type name.
A numeric parameter for processing algorithms.
A generic file based destination parameter, for specifying the destination path for a file (non-map l...
void setExtension(const QString &extension)
Sets a file extension for the parameter.
QString parameterAsFileOutput(const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context) const
Evaluates the parameter with matching name to a file based output destination.
Definition for a property.
QgsGeometry parameterAsExtentGeometry(const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem())
Evaluates the parameter with matching name to a rectangular extent, and returns a geometry covering t...
QVariantMap metadata() const
Returns the parameter's freeform metadata.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QgsFeatureSink * parameterAsSink(const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context, QString &destinationIdentifier, const QgsFields &fields, QgsWkbTypes::Type geometryType=QgsWkbTypes::NoGeometry, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem(), QgsFeatureSink::SinkFlags sinkFlags=nullptr) const
Evaluates the parameter with matching name to a feature sink.
QList< int > mDataTypes
List of acceptable data types for the parameter.
Encapsulates settings relating to a feature source input to a processing algorithm.
virtual QString asScriptCode() const
Returns the parameter definition encoded in a string which can be used within a Python processing scr...
QString type() const override
Unique parameter type name.
DistanceUnit
Units of distance.
QString type() const override
Unique parameter type name.
Base class for the definition of processing outputs.
void setName(const QString &name)
Sets the name of the parameter.
A vector layer destination parameter, for specifying the destination path for a vector layer created ...
QString type() const override
Unique parameter type name.
virtual QVariantMap toVariantMap() const
Saves this parameter to a QVariantMap.
virtual QString generateTemporaryDestination() const
Generates a temporary destination value for this parameter.
A point parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
QgsPropertyDefinition dynamicPropertyDefinition() const
Returns the property definition for dynamic properties.
An input feature source (such as vector layers) parameter for processing algorithms.
void setMetadata(const QVariantMap &metadata)
Sets the parameter's freeform metadata.
A folder destination parameter, for specifying the destination path for a folder created by the algor...
QString destinationName
Name to use for sink if it's to be loaded into a destination project.
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
Flags mFlags
Parameter flags.
static QString typeName()
Returns the type name for the parameter class.
This class represents a coordinate reference system (CRS).
QgsProcessingOutputLayerDefinition(const QString &sink=QString(), QgsProject *destinationProject=nullptr)
Constructor for QgsProcessingOutputLayerDefinition, accepting a static sink/layer string...
Base class for the definition of processing parameters.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QVariant mDefault
Default value for parameter.
SourceType
Data source types enum.
QgsPropertyDefinition mPropertyDefinition
Data defined property definition.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
static QString typeName()
Returns the type name for the parameter class.
QString mName
Parameter name.
QgsProcessingFeatureSourceDefinition(const QgsProperty &source, bool selectedFeaturesOnly=false)
Constructor for QgsProcessingFeatureSourceDefinition, accepting a QgsProperty source.
virtual QString toolTip() const
Returns a formatted tooltip for use with the parameter, which gives helpful information like paramete...
static QString typeName()
Returns the type name for the parameter class.
Behavior
Parameter behavior.
void setSupportsNonFileBasedOutput(bool supportsNonFileBasedOutput)
Sets whether the destination parameter supports non filed-based outputs, such as memory layers or dir...
static QString typeName()
Returns the type name for the parameter class.
DataType
Field data types.
A table (matrix) parameter for processing algorithms.
QVariant defaultValue() const
Returns the default value for the parameter.
QString type() const override
Unique parameter type name.
QString mDescription
Parameter description.
QString extension() const
Returns any specified file extension for the parameter.
bool parameterAsBool(const QVariantMap ¶meters, const QString &name, const QgsProcessingContext &context) const
Evaluates the parameter with matching name to a static boolean value.
QString parameterAsCompatibleSourceLayerPath(const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context, const QStringList &compatibleFormats, const QString &preferredFormat=QString("shp"), QgsProcessingFeedback *feedback=nullptr)
Evaluates the parameter with matching name to a source vector layer file path of compatible format...
double parameterAsDouble(const QVariantMap ¶meters, const QString &name, const QgsProcessingContext &context) const
Evaluates the parameter with matching name to a static double value.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
void setBehavior(Behavior behavior)
Sets the parameter behavior (e.g.
Represents a vector layer which manages a vector based data sets.
Contains information about the context in which a processing algorithm is executed.
bool supportsNonFileBasedOutput() const
Returns true if the destination parameter supports non filed-based outputs, such as memory layers or ...
QString parameterAsFile(const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context) const
Evaluates the parameter with matching name to a file/folder name.
A string parameter for processing algorithms.
QString type() const override
Unique parameter type name.
QString dynamicLayerParameterName() const
Returns the name of the parameter for a layer linked to a dynamic parameter, or an empty string if th...
virtual QgsProcessingParameterDefinition * clone() const =0
Creates a clone of the parameter definition.
virtual QgsProcessingOutputDefinition * toOutputDefinition() const =0
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
Any vector layer with geometry.
QString type() const override
Unique parameter type name.
QVariantMap createOptions
Map of optional sink/layer creation options, which are passed to the underlying provider when creatin...
QString type() const override
Unique parameter type name.
static QString typeName()
Returns the type name for the parameter class.