-
-
Notifications
You must be signed in to change notification settings - Fork 3k
/
qgsprocessingcontext.sip
274 lines (220 loc) · 8.31 KB
/
qgsprocessingcontext.sip
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
/************************************************************************
* 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
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:: setFlags()
:rtype: QgsProcessingContext.Flags
%End
void setFlags( const QgsProcessingContext::Flags &flags );
%Docstring
Sets ``flags`` for the context.
.. seealso:: flags()
%End
QgsProject *project() const;
%Docstring
Returns the project in which the algorithm is being executed.
.. seealso:: setProject()
:rtype: QgsProject
%End
void setProject( QgsProject *project );
%Docstring
Sets the ``project`` in which the algorithm will be executed.
.. seealso:: project()
%End
QgsExpressionContext &expressionContext();
%Docstring
Returns the expression context.
:rtype: QgsExpressionContext
%End
void setExpressionContext( const QgsExpressionContext &context );
%Docstring
Sets the expression ``context``.
%End
QgsMapLayerStore *temporaryLayerStore();
%Docstring
Returns a reference to the layer store used for storing temporary layers during
algorithm execution.
:rtype: QgsMapLayerStore
%End
struct LayerDetails
{
LayerDetails( const QString &name, QgsProject *project );
%Docstring
Constructor for LayerDetails.
%End
QString name;
%Docstring
Friendly name for layer, to use when loading layer into project.
%End
QgsProject *project;
%Docstring
Destination project
%End
};
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:: setLayersToLoadOnCompletion()
.. seealso:: addLayerToLoadOnCompletion()
:rtype: QMap< str, QgsProcessingContext.LayerDetails >
%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:: addLayerToLoadOnCompletion()
.. seealso:: layersToLoadOnCompletion()
%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:: setLayersToLoadOnCompletion()
.. seealso:: layersToLoadOnCompletion()
%End
QgsFeatureRequest::InvalidGeometryCheck invalidGeometryCheck() const;
%Docstring
Returns the behavior used for checking invalid geometries in input layers.
.. seealso:: setInvalidGeometryCheck()
:rtype: QgsFeatureRequest.InvalidGeometryCheck
%End
void setInvalidGeometryCheck( const 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:: 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.
.. versionadded:: 3.0
.. seealso:: invalidGeometryCallback()
%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.
.. versionadded:: 3.0
.. seealso:: transformErrorCallback()
%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:: setDefaultEncoding()
:rtype: str
%End
void setDefaultEncoding( const QString &encoding );
%Docstring
Sets the default ``encoding`` to use for newly created files.
.. seealso:: defaultEncoding()
%End
QgsProcessingFeedback *feedback();
%Docstring
Returns the associated feedback object.
.. seealso:: setFeedback()
:rtype: QgsProcessingFeedback
%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:: setFeedback()
%End
QThread *thread();
%Docstring
Returns the thread in which the context lives.
.. seealso:: pushToThread()
:rtype: QThread
%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:: 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 *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.
:rtype: QgsMapLayer
%End
private:
QgsProcessingContext( const QgsProcessingContext &other );
};
QFlags<QgsProcessingContext::Flag> operator|(QgsProcessingContext::Flag f1, QFlags<QgsProcessingContext::Flag> f2);
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/processing/qgsprocessingcontext.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/