mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-12 00:06:43 -04:00
Add invalid geometry handling method to processing context
This commit is contained in:
parent
06a20b935d
commit
f3cfb8b759
@ -72,14 +72,20 @@ class QgsProcessingContext
|
||||
Sets the expression ``context``.
|
||||
%End
|
||||
|
||||
QgsFeatureRequest::InvalidGeometryCheck invalidGeometryCheck() const;
|
||||
%Docstring
|
||||
Returns the behavior used for checking invalid geometries in input layers.
|
||||
\see setInvalidGeometryCheck()
|
||||
:rtype: QgsFeatureRequest.InvalidGeometryCheck
|
||||
%End
|
||||
|
||||
void setInvalidGeometryCheck( const QgsFeatureRequest::InvalidGeometryCheck &check );
|
||||
%Docstring
|
||||
Sets the behavior used for checking invalid geometries in input layers.
|
||||
\see invalidGeometryCheck()
|
||||
%End
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
QFlags<QgsProcessingContext::Flag> operator|(QgsProcessingContext::Flag f1, QFlags<QgsProcessingContext::Flag> f2);
|
||||
|
||||
|
||||
|
@ -108,4 +108,7 @@ def createContext():
|
||||
if use_selection:
|
||||
context.setFlags(QgsProcessingContext.UseSelection)
|
||||
|
||||
invalid_features_method = ProcessingConfig.getSetting(ProcessingConfig.FILTER_INVALID_GEOMETRIES)
|
||||
context.setInvalidGeometryCheck(invalid_features_method)
|
||||
|
||||
return context
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "qgis.h"
|
||||
#include "qgsproject.h"
|
||||
#include "qgsexpressioncontext.h"
|
||||
#include "qgsfeaturerequest.h"
|
||||
|
||||
/**
|
||||
* \class QgsProcessingContext
|
||||
@ -80,22 +81,26 @@ class CORE_EXPORT QgsProcessingContext
|
||||
*/
|
||||
void setExpressionContext( const QgsExpressionContext &context ) { mExpressionContext = context; }
|
||||
|
||||
/**
|
||||
* Returns the behavior used for checking invalid geometries in input layers.
|
||||
* \see setInvalidGeometryCheck()
|
||||
*/
|
||||
QgsFeatureRequest::InvalidGeometryCheck invalidGeometryCheck() const { return mInvalidGeometryCheck; }
|
||||
|
||||
/**
|
||||
* Sets the behavior used for checking invalid geometries in input layers.
|
||||
* \see invalidGeometryCheck()
|
||||
*/
|
||||
void setInvalidGeometryCheck( const QgsFeatureRequest::InvalidGeometryCheck &check ) { mInvalidGeometryCheck = check; }
|
||||
|
||||
private:
|
||||
|
||||
QgsProcessingContext::Flags mFlags = 0;
|
||||
|
||||
QPointer< QgsProject > mProject;
|
||||
|
||||
QgsExpressionContext mExpressionContext;
|
||||
QgsFeatureRequest::InvalidGeometryCheck mInvalidGeometryCheck = QgsFeatureRequest::GeometryNoCheck;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS( QgsProcessingContext::Flags )
|
||||
|
||||
#endif // QGSPROCESSINGPARAMETERS_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user