QgsProcessingParameterFeatureSink class
A feature sink output for processing algorithms.
Contents
A parameter which represents the destination feature sink for features created by an algorithm.
Base classes
- class QgsProcessingDestinationParameter
- Base class for all parameter definitions which represent file or layer destinations, e.g.
Public static functions
- static auto fromScriptCode(const QString& name, const QString& description, bool isOptional, const QString& definition) -> QgsProcessingParameterFeatureSink*
- Creates a new parameter using the definition from a script code.
- static auto typeName() -> QString
- Returns the type name for the parameter class.
Constructors, destructors, conversion operators
-
QgsProcessingParameterFeatureSink(const QString& name,
const QString& description = QString(),
QgsProcessing::
SourceType type = QgsProcessing:: TypeVectorAnyGeometry, const QVariant& defaultValue = QVariant(), bool optional = false, bool createByDefault = true) - Constructor for QgsProcessingParameterFeatureSink.
Public functions
- auto asScriptCode() const -> QString override
- Returns the parameter definition encoded in a string which can be used within a Python processing script.
- auto checkValueIsAcceptable(const QVariant& input, QgsProcessingContext* context = nullptr) const -> bool override
- Checks whether the specified input value is acceptable for the parameter.
- auto clone() const -> QgsProcessingParameterDefinition* override
- Creates a clone of the parameter definition.
-
auto dataType() const -> QgsProcessing::
SourceType - Returns the layer type for sinks associated with the parameter.
- auto defaultFileExtension() const -> QString override
- Returns the default file extension for destination file paths associated with this parameter.
- auto fromVariantMap(const QVariantMap& map) -> bool override
- Restores this parameter to a QVariantMap.
- auto generateTemporaryDestination() const -> QString override
- Generates a temporary destination value for this parameter.
- auto hasGeometry() const -> bool
- Returns true if sink is likely to include geometries.
-
void setDataType(QgsProcessing::
SourceType type) - Sets the layer type for the sinks associated with the parameter.
- auto supportedOutputVectorLayerExtensions() const -> QStringList virtual
- Returns a list of the vector format file extensions supported by this parameter.
- auto toOutputDefinition() const -> QgsProcessingOutputDefinition* override
- Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parameter.
- auto toVariantMap() const -> QVariantMap override
- Saves this parameter to a QVariantMap.
- auto type() const -> QString override
- Unique parameter type name.
- auto valueAsPythonString(const QVariant& value, QgsProcessingContext& context) const -> QString override
- Returns a string version of the parameter input value, which is suitable for use as an input parameter value when running an algorithm directly from a Python command.
Function documentation
QgsProcessingParameterFeatureSink:: QgsProcessingParameterFeatureSink(const QString& name,
const QString& description = QString(),
QgsProcessing:: SourceType type = QgsProcessing:: TypeVectorAnyGeometry,
const QVariant& defaultValue = QVariant(),
bool optional = false,
bool createByDefault = true)
Constructor for QgsProcessingParameterFeatureSink.
If createByDefault is false and the parameter is optional, then this destination output will not be created by default.
bool QgsProcessingParameterFeatureSink:: checkValueIsAcceptable(const QVariant& input,
QgsProcessingContext* context = nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
Returns true if the value can be accepted. The optional context parameter can be specified to allow a more stringent check to be performed, capable of checking for the presence of required layers and other factors within the context.
QgsProcessing:: SourceType QgsProcessingParameterFeatureSink:: dataType() const
Returns the layer type for sinks associated with the parameter.
bool QgsProcessingParameterFeatureSink:: fromVariantMap(const QVariantMap& map) override
Restores this parameter to a QVariantMap.
Subclasses should ensure that they call the base class method.
QString QgsProcessingParameterFeatureSink:: generateTemporaryDestination() const override
Generates a temporary destination value for this parameter.
The returned value will be a file path or QGIS data provider URI suitable for temporary storage of created layers and files.
bool QgsProcessingParameterFeatureSink:: hasGeometry() const
Returns true if sink is likely to include geometries.
In cases were presence of geometry cannot be reliably determined in advance, this method will default to returning true.
void QgsProcessingParameterFeatureSink:: setDataType(QgsProcessing:: SourceType type)
Sets the layer type for the sinks associated with the parameter.
QStringList QgsProcessingParameterFeatureSink:: supportedOutputVectorLayerExtensions() const virtual
Returns a list of the vector format file extensions supported by this parameter.
QVariantMap QgsProcessingParameterFeatureSink:: toVariantMap() const override
Saves this parameter to a QVariantMap.
Subclasses should ensure that they call the base class method and then extend the result with additional properties.
QString QgsProcessingParameterFeatureSink:: valueAsPythonString(const QVariant& value,
QgsProcessingContext& context) const override
Returns a string version of the parameter input value, which is suitable for use as an input parameter value when running an algorithm directly from a Python command.
The returned value must be correctly escaped - e.g. string values must be wrapped in ' 's.