Class: QgsProcessingDestinationParameter¶
Base class for all parameter definitions which represent file or layer destinations, e.g. parameters which are used for the destination for layers output by an algorithm.
Note
This is an abstract class, with methods which must be implemented by a subclass.
The following methods must be implemented: QgsProcessingParameterDefinition.clone()
, defaultFileExtension()
, toOutputDefinition()
, QgsProcessingParameterDefinition.type()
Class Hierarchy¶
Base classes¶
Base class for the definition of processing parameters. |
|
Abstract interface for classes which generate a file filter string. |
Subclasses¶
A feature sink output for processing algorithms. |
|
A generic file based destination parameter, for specifying the destination path for a file (non-map layer) created by the algorithm. |
|
A folder destination parameter, for specifying the destination path for a folder created by the algorithm or used for creating new files within the algorithm. |
|
A point cloud layer destination parameter, for specifying the destination path for a point cloud layer created by the algorithm. |
|
A raster layer destination parameter, for specifying the destination path for a raster layer created by the algorithm. |
|
A vector layer destination parameter, for specifying the destination path for a vector layer created by the algorithm. |
|
A vector tile layer destination parameter, for specifying the destination path for a vector tile layer created by the algorithm. |
Abstract Methods
Returns the default file extension for destination file paths associated with this parameter. |
|
Returns a new |
Methods
Returns |
|
Original (source) provider which this parameter has been derived from. |
|
Sets whether the destination should be created by default. |
|
Sets whether the destination parameter supports non filed-based outputs, such as memory layers or direct database outputs. |
|
Returns |
Virtual Methods
In PyQGIS, only methods marked as virtual
can be safely overridden in a Python subclass of QgsProcessingDestinationParameter. See the FAQ for more details.
Generates a temporary destination value for this parameter. |
|
Tests whether a value is a supported value for this parameter. |
- class qgis.core.QgsProcessingDestinationParameter[source]¶
Bases:
QgsProcessingParameterDefinition
,QgsFileFilterGenerator
- __init__(name: str | None, description: str | None = '', defaultValue: Any = None, optional: bool = False, createByDefault: bool = True)
Constructor for QgsProcessingDestinationParameter.
If
createByDefault
isFalse
and the parameter isoptional
, then the destination output will not be created by default.- Parameters:
name (Optional[str])
description (Optional[str] = '')
defaultValue (Any = None)
optional (bool = False)
createByDefault (bool = True)
- __init__(a0: QgsProcessingDestinationParameter)
- Parameters:
- createByDefault(self) bool [source]¶
Returns
True
if the destination should be created by default. For optional parameters, a return value ofFalse
indicates that the destination should not be created by default.See also
- Return type:
bool
- abstract defaultFileExtension(self) str [source]¶
Returns the default file extension for destination file paths associated with this parameter.
- Return type:
str
- virtual generateTemporaryDestination(self, context: QgsProcessingContext | None = None) str [source]¶
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.
- Parameters:
context (Optional[QgsProcessingContext] = None)
- Return type:
str
- virtual isSupportedOutputValue(self, value: Any, context: QgsProcessingContext)[source]¶
Tests whether a
value
is a supported value for this parameter.Will return
False
when avalue
with an unsupported file extension is specified. The default implementation callsQgsProcessingProvider.isSupportedOutputValue()
to test compatibility.- Parameters:
value (Any) – value to test
context (
QgsProcessingContext
) -> (bool) – Processing context
- Returns:
True
ifvalue
is supported.error: a descriptive error string
Added in version 3.14.
- originalProvider(self) QgsProcessingProvider | None [source]¶
Original (source) provider which this parameter has been derived from. In the case of destination parameters which are part of model algorithms, this will reflect the child algorithm’s provider which actually generates the parameter, as opposed to the provider which this parameter belongs to (i.e. the model provider)
Added in version 3.2.
- Return type:
Optional[QgsProcessingProvider]
- setCreateByDefault(self, createByDefault: bool)[source]¶
Sets whether the destination should be created by default. For optional parameters, a value of
False
indicates that the destination should not be created by default.See also
- Parameters:
createByDefault (bool)
- setSupportsNonFileBasedOutput(self, supportsNonFileBasedOutput: bool)[source]¶
Sets whether the destination parameter supports non filed-based outputs, such as memory layers or direct database outputs.
See also
- Parameters:
supportsNonFileBasedOutput (bool)
- supportsNonFileBasedOutput(self) bool [source]¶
Returns
True
if the destination parameter supports non filed-based outputs, such as memory layers or direct database outputs.See also
- Return type:
bool
- abstract toOutputDefinition(self) QgsProcessingOutputDefinition | None [source]¶
Returns a new
QgsProcessingOutputDefinition
corresponding to the definition of the destination parameter.- Return type:
Optional[QgsProcessingOutputDefinition]