mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
Expose compatible vector layer parameter evaluation to QgsProcessingAlgorithm
This commit is contained in:
parent
9e184feaed
commit
d443bb3cbe
@ -514,7 +514,7 @@ class QgsProcessingAlgorithm
|
||||
|
||||
QgsProcessingFeatureSource *parameterAsSource( const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context ) const /Factory/;
|
||||
%Docstring
|
||||
Evaluates the parameter with matching ``definition`` to a feature source.
|
||||
Evaluates the parameter with matching ``name`` to a feature source.
|
||||
|
||||
Sources will either be taken from ``context``'s active project, or loaded from external
|
||||
sources and stored temporarily in the ``context``.
|
||||
@ -523,6 +523,22 @@ class QgsProcessingAlgorithm
|
||||
:rtype: QgsProcessingFeatureSource
|
||||
%End
|
||||
|
||||
QString parameterAsCompatibleSourceLayerPath( const QVariantMap ¶meters, const QString &name,
|
||||
QgsProcessingContext &context, const QStringList &compatibleFormats, const QString &preferredFormat = QString( "shp" ), QgsProcessingFeedback *feedback = 0 );
|
||||
%Docstring
|
||||
Evaluates the parameter with matching ``name`` to a source vector layer file path of compatible format.
|
||||
|
||||
If the parameter is evaluated to an existing layer, and that layer is not of the format listed in the
|
||||
``compatibleFormats`` argument, then the layer will first be exported to a compatible format
|
||||
in a temporary location. The function will then return the path to that temporary file.
|
||||
|
||||
``compatibleFormats`` should consist entirely of lowercase file extensions, e.g. 'shp'.
|
||||
|
||||
The ``preferredFormat`` argument is used to specify to desired file extension to use when a temporary
|
||||
layer export is required.
|
||||
:rtype: str
|
||||
%End
|
||||
|
||||
QgsMapLayer *parameterAsLayer( const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context ) const;
|
||||
%Docstring
|
||||
Evaluates the parameter with matching ``name`` to a map layer.
|
||||
|
@ -503,6 +503,11 @@ QgsProcessingFeatureSource *QgsProcessingAlgorithm::parameterAsSource( const QVa
|
||||
return QgsProcessingParameters::parameterAsSource( parameterDefinition( name ), parameters, context );
|
||||
}
|
||||
|
||||
QString QgsProcessingAlgorithm::parameterAsCompatibleSourceLayerPath( const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context, const QStringList &compatibleFormats, const QString &preferredFormat, QgsProcessingFeedback *feedback )
|
||||
{
|
||||
return QgsProcessingParameters::parameterAsCompatibleSourceLayerPath( parameterDefinition( name ), parameters, context, compatibleFormats, preferredFormat, feedback );
|
||||
}
|
||||
|
||||
QgsMapLayer *QgsProcessingAlgorithm::parameterAsLayer( const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context ) const
|
||||
{
|
||||
return QgsProcessingParameters::parameterAsLayer( parameterDefinition( name ), parameters, context );
|
||||
|
@ -30,6 +30,7 @@
|
||||
class QgsProcessingProvider;
|
||||
class QgsProcessingFeedback;
|
||||
class QgsFeatureSink;
|
||||
class QgsProcessingFeedback;
|
||||
|
||||
|
||||
/**
|
||||
@ -485,7 +486,7 @@ class CORE_EXPORT QgsProcessingAlgorithm
|
||||
const QgsFields &fields, QgsWkbTypes::Type geometryType = QgsWkbTypes::NoGeometry, const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem() ) const SIP_FACTORY;
|
||||
|
||||
/**
|
||||
* Evaluates the parameter with matching \a definition to a feature source.
|
||||
* Evaluates the parameter with matching \a name to a feature source.
|
||||
*
|
||||
* Sources will either be taken from \a context's active project, or loaded from external
|
||||
* sources and stored temporarily in the \a context.
|
||||
@ -494,6 +495,21 @@ class CORE_EXPORT QgsProcessingAlgorithm
|
||||
*/
|
||||
QgsProcessingFeatureSource *parameterAsSource( const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context ) const SIP_FACTORY;
|
||||
|
||||
/**
|
||||
* Evaluates the parameter with matching \a name to a source vector layer file path of compatible format.
|
||||
*
|
||||
* If the parameter is evaluated to an existing layer, and that layer is not of the format listed in the
|
||||
* \a compatibleFormats argument, then the layer will first be exported to a compatible format
|
||||
* in a temporary location. The function will then return the path to that temporary file.
|
||||
*
|
||||
* \a compatibleFormats should consist entirely of lowercase file extensions, e.g. 'shp'.
|
||||
*
|
||||
* The \a preferredFormat argument is used to specify to desired file extension to use when a temporary
|
||||
* layer export is required.
|
||||
*/
|
||||
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 \a name to a map layer.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user