QGIS/python/core/auto_generated/processing/qgsprocessingcontext.sip.in
Denis Rouzaud 65bb60e96c run sipify
2018-05-28 10:39:34 -08:00

446 lines
13 KiB
Plaintext

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/processing/qgsprocessingcontext.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsProcessingContext
{
%Docstring
Contains information about the context in which a processing algorithm is executed.
Contextual information includes settings such as the associated project, and
expression context.
.. versionadded:: 3.0
%End
%TypeHeaderCode
#include "qgsprocessingcontext.h"
%End
public:
enum Flag
{
// UseSelectionIfPresent,
};
typedef QFlags<QgsProcessingContext::Flag> Flags;
QgsProcessingContext();
%Docstring
Constructor for QgsProcessingContext.
%End
~QgsProcessingContext();
void copyThreadSafeSettings( const QgsProcessingContext &other );
%Docstring
Copies all settings which are safe for use across different threads from
``other`` to this context.
%End
QgsProcessingContext::Flags flags() const;
%Docstring
Returns any flags set in the context.
.. seealso:: :py:func:`setFlags`
%End
void setFlags( QgsProcessingContext::Flags flags );
%Docstring
Sets ``flags`` for the context.
.. seealso:: :py:func:`flags`
%End
QgsProject *project() const;
%Docstring
Returns the project in which the algorithm is being executed.
.. seealso:: :py:func:`setProject`
%End
void setProject( QgsProject *project );
%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
QgsExpressionContext &expressionContext();
%Docstring
Returns the expression context.
%End
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();
%Docstring
Returns a reference to the layer store used for storing temporary layers during
algorithm execution.
%End
class LayerDetails
{
%Docstring
Details for layers to load into projects.
.. versionadded:: 3.0
%End
%TypeHeaderCode
#include "qgsprocessingcontext.h"
%End
public:
LayerDetails( const QString &name, QgsProject *project, const QString &outputName = QString() );
%Docstring
Constructor for LayerDetails.
%End
LayerDetails();
%Docstring
Default constructor
%End
QString name;
QString outputName;
QgsProcessingLayerPostProcessorInterface *postProcessor() const;
%Docstring
Layer post-processor. May be None if no post-processing is required.
.. seealso:: :py:func:`setPostProcessor`
.. versionadded:: 3.2
%End
void setPostProcessor( QgsProcessingLayerPostProcessorInterface *processor /Transfer/ );
%Docstring
Sets the layer post-processor. May be None if no post-processing is required.
Ownership of ``processor`` is transferred.
.. seealso:: :py:func:`postProcessor`
.. versionadded:: 3.2
%End
QgsProject *project;
};
QMap< QString, QgsProcessingContext::LayerDetails > layersToLoadOnCompletion() const;
%Docstring
Returns a map of layers (by ID or datasource) to LayerDetails, to load into the canvas upon completion of the algorithm or model.
.. seealso:: :py:func:`setLayersToLoadOnCompletion`
.. seealso:: :py:func:`addLayerToLoadOnCompletion`
.. seealso:: :py:func:`willLoadLayerOnCompletion`
.. seealso:: :py:func:`layerToLoadOnCompletionDetails`
%End
bool willLoadLayerOnCompletion( const QString &layer ) const;
%Docstring
Returns true if the given ``layer`` (by ID or datasource) will be loaded into the current project
upon completion of the algorithm or model.
.. seealso:: :py:func:`layersToLoadOnCompletion`
.. seealso:: :py:func:`setLayersToLoadOnCompletion`
.. seealso:: :py:func:`addLayerToLoadOnCompletion`
.. seealso:: :py:func:`layerToLoadOnCompletionDetails`
.. versionadded:: 3.2
%End
void setLayersToLoadOnCompletion( const QMap< QString, QgsProcessingContext::LayerDetails > &layers );
%Docstring
Sets the map of ``layers`` (by ID or datasource) to LayerDetails, to load into the canvas upon completion of the algorithm or model.
.. seealso:: :py:func:`addLayerToLoadOnCompletion`
.. seealso:: :py:func:`layersToLoadOnCompletion`
.. seealso:: :py:func:`willLoadLayerOnCompletion`
.. seealso:: :py:func:`layerToLoadOnCompletionDetails`
%End
void addLayerToLoadOnCompletion( const QString &layer, const QgsProcessingContext::LayerDetails &details );
%Docstring
Adds a ``layer`` to load (by ID or datasource) into the canvas upon completion of the algorithm or model.
The ``details`` parameter dictates the LayerDetails.
.. seealso:: :py:func:`setLayersToLoadOnCompletion`
.. seealso:: :py:func:`layersToLoadOnCompletion`
.. seealso:: :py:func:`willLoadLayerOnCompletion`
.. seealso:: :py:func:`layerToLoadOnCompletionDetails`
%End
QgsProcessingContext::LayerDetails &layerToLoadOnCompletionDetails( const QString &layer );
%Docstring
Returns a reference to the details for a given ``layer`` which is loaded on completion of the
algorithm or model.
.. warning::
First check willLoadLayerOnCompletion(), or calling this method will incorrectly
add ``layer`` as a layer to load on completion.
.. seealso:: :py:func:`willLoadLayerOnCompletion`
.. seealso:: :py:func:`addLayerToLoadOnCompletion`
.. seealso:: :py:func:`setLayersToLoadOnCompletion`
.. seealso:: :py:func:`layersToLoadOnCompletion`
.. versionadded:: 3.2
%End
QgsFeatureRequest::InvalidGeometryCheck invalidGeometryCheck() const;
%Docstring
Returns the behavior used for checking invalid geometries in input layers.
.. seealso:: :py:func:`setInvalidGeometryCheck`
%End
void setInvalidGeometryCheck( QgsFeatureRequest::InvalidGeometryCheck check );
%Docstring
Sets the behavior used for checking invalid geometries in input layers.
Settings this to anything but QgsFeatureRequest.GeometryNoCheck will also
reset the invalidGeometryCallback() to a default implementation.
.. seealso:: :py:func:`invalidGeometryCheck`
%End
void setInvalidGeometryCallback( SIP_PYCALLABLE / AllowNone / );
%Docstring
Sets a callback function to use when encountering an invalid geometry and
invalidGeometryCheck() is set to GeometryAbortOnInvalid. This function will be
called using the feature with invalid geometry as a parameter.
.. seealso:: :py:func:`invalidGeometryCallback`
.. versionadded:: 3.0
%End
%MethodCode
Py_BEGIN_ALLOW_THREADS
sipCpp->setInvalidGeometryCallback( [a0]( const QgsFeature &arg )
{
SIP_BLOCK_THREADS
Py_XDECREF( sipCallMethod( NULL, a0, "D", &arg, sipType_QgsFeature, NULL ) );
SIP_UNBLOCK_THREADS
} );
Py_END_ALLOW_THREADS
%End
void setTransformErrorCallback( SIP_PYCALLABLE / AllowNone / );
%Docstring
Sets a callback function to use when encountering a transform error when iterating
features. This function will be
called using the feature which encountered the transform error as a parameter.
.. seealso:: :py:func:`transformErrorCallback`
.. versionadded:: 3.0
%End
%MethodCode
Py_BEGIN_ALLOW_THREADS
sipCpp->setTransformErrorCallback( [a0]( const QgsFeature &arg )
{
SIP_BLOCK_THREADS
Py_XDECREF( sipCallMethod( NULL, a0, "D", &arg, sipType_QgsFeature, NULL ) );
SIP_UNBLOCK_THREADS
} );
Py_END_ALLOW_THREADS
%End
QString defaultEncoding() const;
%Docstring
Returns the default encoding to use for newly created files.
.. seealso:: :py:func:`setDefaultEncoding`
%End
void setDefaultEncoding( const QString &encoding );
%Docstring
Sets the default ``encoding`` to use for newly created files.
.. seealso:: :py:func:`defaultEncoding`
%End
QgsProcessingFeedback *feedback();
%Docstring
Returns the associated feedback object.
.. seealso:: :py:func:`setFeedback`
%End
void setFeedback( QgsProcessingFeedback *feedback );
%Docstring
Sets an associated ``feedback`` object. This allows context related functions
to report feedback and errors to users and processing logs. While ideally this feedback
object should outlive the context, only a weak pointer to ``feedback`` is stored
and no errors will occur if feedback is deleted before the context.
Ownership of ``feedback`` is not transferred.
.. seealso:: :py:func:`setFeedback`
%End
QThread *thread();
%Docstring
Returns the thread in which the context lives.
.. seealso:: :py:func:`pushToThread`
%End
void pushToThread( QThread *thread );
%Docstring
Pushes the thread affinity for the context (including all layers contained in the temporaryLayerStore()) into
another ``thread``. This method is only safe to call when the current thread matches the existing thread
affinity for the context (see thread()).
.. seealso:: :py:func:`thread`
%End
void takeResultsFrom( QgsProcessingContext &context );
%Docstring
Takes the results from another ``context`` and merges them with the results currently
stored in this context. This includes settings like any layers loaded in the temporaryLayerStore()
and layersToLoadOnCompletion().
This is only safe to call when both this context and the other ``context`` share the same
thread() affinity, and that thread is the current thread.
%End
QgsMapLayer *getMapLayer( const QString &identifier );
%Docstring
Returns a map layer from the context with a matching ``identifier``.
This method considers layer IDs, names and sources when matching
the ``identifier`` (see :py:func:`QgsProcessingUtils.mapLayerFromString()`
for details).
Ownership is not transferred and remains with the context.
.. seealso:: :py:func:`takeResultLayer`
%End
QgsMapLayer *takeResultLayer( const QString &id ) /TransferBack/;
%Docstring
Takes the result map layer with matching ``id`` from the context and
transfers ownership of it back to the caller. This method can be used
to remove temporary layers which are not required for further processing
from a context.
.. seealso:: :py:func:`getMapLayer`
%End
private:
QgsProcessingContext( const QgsProcessingContext &other );
};
QFlags<QgsProcessingContext::Flag> operator|(QgsProcessingContext::Flag f1, QFlags<QgsProcessingContext::Flag> f2);
class QgsProcessingLayerPostProcessorInterface
{
%Docstring
An interface for layer post-processing handlers for execution following a processing algorithm operation.
Note that post-processing of a layer will ONLY occur if that layer is set to be loaded into a QGIS project
on algorithm completion. See :py:func:`QgsProcessingContext.layersToLoadOnCompletion()`
Algorithms that wish to set post-processing steps for generated layers should implement this interface
in a separate class (NOT the algorithm class itself!).
.. versionadded:: 3.2
%End
%TypeHeaderCode
#include "qgsprocessingcontext.h"
%End
public:
virtual ~QgsProcessingLayerPostProcessorInterface();
virtual void postProcessLayer( QgsMapLayer *layer, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) = 0;
%Docstring
Post-processes the specified ``layer``, following successful execution of a processing algorithm. This method
always runs in the main thread and can be used to setup renderers, editor widgets, metadata, etc for
the given layer.
Post-processing classes can utilize settings from the algorithm's ``context`` and report logging messages
or errors via the given ``feedback`` object.
In the case of an algorithm run as part of a larger model, the post-processing occurs following the completed
execution of the entire model.
Note that post-processing of a layer will ONLY occur if that layer is set to be loaded into a QGIS project
on algorithm completion. See :py:func:`QgsProcessingContext.layersToLoadOnCompletion()`
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/processing/qgsprocessingcontext.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/