@@ -206,6 +206,41 @@ class CORE_EXPORT QgsProcessingContext
206206 */
207207 SIP_SKIP std::function< void ( const QgsFeature & ) > invalidGeometryCallback () const { return mInvalidGeometryCallback ; }
208208
209+ /* *
210+ * Sets a callback function to use when encountering a transform error when iterating
211+ * features. This function will be
212+ * called using the feature which encountered the transform error as a parameter.
213+ * \since QGIS 3.0
214+ * \see transformErrorCallback()
215+ */
216+ #ifndef SIP_RUN
217+ void setTransformErrorCallback ( std::function< void ( const QgsFeature & ) > callback ) { mTransformErrorCallback = callback; }
218+ #else
219+ void setTransformErrorCallback ( SIP_PYCALLABLE / AllowNone / );
220+ % MethodCode
221+ Py_BEGIN_ALLOW_THREADS
222+
223+ sipCpp->setTransformErrorCallback ( [a0]( const QgsFeature &arg )
224+ {
225+ SIP_BLOCK_THREADS
226+ Py_XDECREF ( sipCallMethod ( NULL , a0, " D" , &arg, sipType_QgsFeature, NULL ) );
227+ SIP_UNBLOCK_THREADS
228+ } );
229+
230+ Py_END_ALLOW_THREADS
231+ % End
232+ #endif
233+
234+ /* *
235+ * Returns the callback function to use when encountering a transform error when iterating
236+ * features.
237+ * \since QGIS 3.0
238+ * \note not available in Python bindings
239+ * \see setTransformErrorCallback()
240+ * \see destinationCrs()
241+ */
242+ std::function< void ( const QgsFeature & ) > transformErrorCallback () const { return mTransformErrorCallback ; } SIP_SKIP
243+
209244 /* *
210245 * Returns the default encoding to use for newly created files.
211246 * \see setDefaultEncoding()
@@ -228,6 +263,7 @@ class CORE_EXPORT QgsProcessingContext
228263 QgsExpressionContext mExpressionContext ;
229264 QgsFeatureRequest::InvalidGeometryCheck mInvalidGeometryCheck = QgsFeatureRequest::GeometryNoCheck;
230265 std::function< void ( const QgsFeature & ) > mInvalidGeometryCallback ;
266+ std::function< void ( const QgsFeature & ) > mTransformErrorCallback ;
231267 QString mDefaultEncoding ;
232268 QMap< QString, LayerDetails > mLayersToLoadOnCompletion ;
233269
0 commit comments