mirror of
https://github.com/qgis/QGIS.git
synced 2025-11-27 00:07:16 -05: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
|
%Docstring
|
||||||
Sets the ``project`` in which the algorithm will be executed.
|
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()`
|
.. seealso:: :py:func:`project()`
|
||||||
%End
|
%End
|
||||||
|
|
||||||
@ -82,6 +85,23 @@ Returns the expression context.
|
|||||||
void setExpressionContext( const QgsExpressionContext &context );
|
void setExpressionContext( const QgsExpressionContext &context );
|
||||||
%Docstring
|
%Docstring
|
||||||
Sets the expression ``context``.
|
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
|
%End
|
||||||
|
|
||||||
QgsMapLayerStore *temporaryLayerStore();
|
QgsMapLayerStore *temporaryLayerStore();
|
||||||
|
|||||||
@ -102,9 +102,18 @@ class CORE_EXPORT QgsProcessingContext
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the \a project in which the algorithm will be executed.
|
* 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()
|
* \see project()
|
||||||
*/
|
*/
|
||||||
void setProject( QgsProject *project ) { mProject = project; }
|
void setProject( QgsProject *project )
|
||||||
|
{
|
||||||
|
mProject = project;
|
||||||
|
if ( mProject )
|
||||||
|
mTransformContext = mProject->transformContext();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the expression context.
|
* Returns the expression context.
|
||||||
@ -121,6 +130,22 @@ class CORE_EXPORT QgsProcessingContext
|
|||||||
*/
|
*/
|
||||||
void setExpressionContext( const QgsExpressionContext &context ) { mExpressionContext = context; }
|
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
|
* Returns a reference to the layer store used for storing temporary layers during
|
||||||
* algorithm execution.
|
* algorithm execution.
|
||||||
@ -375,6 +400,7 @@ class CORE_EXPORT QgsProcessingContext
|
|||||||
|
|
||||||
QgsProcessingContext::Flags mFlags = nullptr;
|
QgsProcessingContext::Flags mFlags = nullptr;
|
||||||
QPointer< QgsProject > mProject;
|
QPointer< QgsProject > mProject;
|
||||||
|
QgsCoordinateTransformContext mTransformContext;
|
||||||
//! Temporary project owned by the context, used for storing temporarily loaded map layers
|
//! Temporary project owned by the context, used for storing temporarily loaded map layers
|
||||||
QgsMapLayerStore tempLayerStore;
|
QgsMapLayerStore tempLayerStore;
|
||||||
QgsExpressionContext mExpressionContext;
|
QgsExpressionContext mExpressionContext;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user