mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
Add transform context to processing context
This commit is contained in:
parent
90e5196996
commit
b24a1bf10d
@ -70,6 +70,9 @@ Returns the project in which the algorithm is being executed.
|
||||
%Docstring
|
||||
Sets the ``project`` in which the algorithm will be executed.
|
||||
|
||||
This also automatically sets the transformContext() to match
|
||||
the project's transform context.
|
||||
|
||||
.. seealso:: :py:func:`project()`
|
||||
%End
|
||||
|
||||
@ -82,6 +85,23 @@ Returns the expression context.
|
||||
void setExpressionContext( const QgsExpressionContext &context );
|
||||
%Docstring
|
||||
Sets the expression ``context``.
|
||||
%End
|
||||
|
||||
QgsCoordinateTransformContext transformContext() const;
|
||||
%Docstring
|
||||
Returns the coordinate transform context.
|
||||
|
||||
.. seealso:: :py:func:`setTransformContext()`
|
||||
%End
|
||||
|
||||
void setTransformContext( const QgsCoordinateTransformContext &context );
|
||||
%Docstring
|
||||
Sets the coordinate transform ``context``.
|
||||
|
||||
Note that setting a project for the context will automatically set the coordinate transform
|
||||
context.
|
||||
|
||||
.. seealso:: :py:func:`transformContext()`
|
||||
%End
|
||||
|
||||
QgsMapLayerStore *temporaryLayerStore();
|
||||
|
@ -102,9 +102,18 @@ class CORE_EXPORT QgsProcessingContext
|
||||
|
||||
/**
|
||||
* Sets the \a project in which the algorithm will be executed.
|
||||
*
|
||||
* This also automatically sets the transformContext() to match
|
||||
* the project's transform context.
|
||||
*
|
||||
* \see project()
|
||||
*/
|
||||
void setProject( QgsProject *project ) { mProject = project; }
|
||||
void setProject( QgsProject *project )
|
||||
{
|
||||
mProject = project;
|
||||
if ( mProject )
|
||||
mTransformContext = mProject->transformContext();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the expression context.
|
||||
@ -121,6 +130,22 @@ class CORE_EXPORT QgsProcessingContext
|
||||
*/
|
||||
void setExpressionContext( const QgsExpressionContext &context ) { mExpressionContext = context; }
|
||||
|
||||
/**
|
||||
* Returns the coordinate transform context.
|
||||
* \see setTransformContext()
|
||||
*/
|
||||
QgsCoordinateTransformContext transformContext() const { return mTransformContext; }
|
||||
|
||||
/**
|
||||
* Sets the coordinate transform \a context.
|
||||
*
|
||||
* Note that setting a project for the context will automatically set the coordinate transform
|
||||
* context.
|
||||
*
|
||||
* \see transformContext()
|
||||
*/
|
||||
void setTransformContext( const QgsCoordinateTransformContext &context ) { mTransformContext = context; }
|
||||
|
||||
/**
|
||||
* Returns a reference to the layer store used for storing temporary layers during
|
||||
* algorithm execution.
|
||||
@ -375,6 +400,7 @@ class CORE_EXPORT QgsProcessingContext
|
||||
|
||||
QgsProcessingContext::Flags mFlags = nullptr;
|
||||
QPointer< QgsProject > mProject;
|
||||
QgsCoordinateTransformContext mTransformContext;
|
||||
//! Temporary project owned by the context, used for storing temporarily loaded map layers
|
||||
QgsMapLayerStore tempLayerStore;
|
||||
QgsExpressionContext mExpressionContext;
|
||||
|
Loading…
x
Reference in New Issue
Block a user