23 mInvalidGeometryCheck = check;
25 switch ( mInvalidGeometryCheck )
29 auto callback = [](
const QgsFeature & feature )
31 throw QgsProcessingException( QObject::tr(
"Feature (%1) has invalid geometry. Please fix the geometry or change the Processing setting to the \"Ignore invalid input features\" option." ).arg( feature.id() ) );
33 mInvalidGeometryCallback = callback;
39 auto callback = [ = ](
const QgsFeature & feature )
42 mFeedback->reportError( QObject::tr(
"Feature (%1) has invalid geometry and has been skipped. Please fix the geometry or change the Processing setting to the \"Ignore invalid input features\" option." ).arg( feature.id() ) );
44 mInvalidGeometryCallback = callback;
56 QMap< QString, LayerDetails >::const_iterator llIt = loadOnCompletion.constBegin();
57 for ( ; llIt != loadOnCompletion.constEnd(); ++llIt )
59 mLayersToLoadOnCompletion.insert( llIt.key(), llIt.value() );
static QgsMapLayer * mapLayerFromString(const QString &string, QgsProcessingContext &context, bool allowLoadingNewLayers=true)
Interprets a string as a map layer within the supplied context.
Base class for all map layer types.
void setLayersToLoadOnCompletion(const QMap< QString, QgsProcessingContext::LayerDetails > &layers)
Sets the map of layers (by ID or datasource) to LayerDetails, to load into the canvas upon completion...
QMap< QString, QgsProcessingContext::LayerDetails > layersToLoadOnCompletion() const
Returns a map of layers (by ID or datasource) to LayerDetails, to load into the canvas upon completio...
QgsMapLayer * takeResultLayer(const QString &id)
Takes the result map layer with matching id from the context and transfers ownership of it back to th...
Skip any features with invalid geometry. This requires a slow geometry validity check for every featu...
QgsMapLayer * takeMapLayer(QgsMapLayer *layer)
Takes a layer from the store.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
InvalidGeometryCheck
Handling of features with invalid geometries.
QgsMapLayerStore * temporaryLayerStore()
Returns a reference to the layer store used for storing temporary layers during algorithm execution...
void takeResultsFrom(QgsProcessingContext &context)
Takes the results from another context and merges them with the results currently stored in this cont...
Custom exception class for processing related exceptions.
QgsMapLayer * getMapLayer(const QString &identifier)
Returns a map layer from the context with a matching identifier.
void setInvalidGeometryCheck(QgsFeatureRequest::InvalidGeometryCheck check)
Sets the behavior used for checking invalid geometries in input layers.
void transferLayersFromStore(QgsMapLayerStore *other)
Transfers all the map layers contained within another map layer store and adds them to this store...
QgsMapLayer * mapLayer(const QString &id) const
Retrieve a pointer to a layer by layer id.
Contains information about the context in which a processing algorithm is executed.
Close iterator on encountering any features with invalid geometry. This requires a slow geometry vali...