Skip to content

Commit

Permalink
[vector layer] Fix geometry validity check preventing saving of chang…
Browse files Browse the repository at this point in the history
…es after removing problematic feature(s)
  • Loading branch information
nirvn authored and nyalldawson committed Jan 28, 2025
1 parent d40836d commit 6062ff7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/app/qgsgeometryvalidationservice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,16 @@ void QgsGeometryValidationService::onGeometryChanged( QgsVectorLayer *layer, Qgs

void QgsGeometryValidationService::onFeatureDeleted( QgsVectorLayer *layer, QgsFeatureId fid )
{
mLayerChecks[layer].singleFeatureCheckErrors.remove( fid );

if ( !mLayerChecks[layer].topologyChecks.empty() )
{
invalidateTopologyChecks( layer );
}

mLayerChecks[layer].singleFeatureCheckErrors.remove( fid );
else
{
layer->setAllowCommit( mLayerChecks[layer].singleFeatureCheckErrors.empty() );
}

// There should be no geometry errors on a non-existent feature, right?
emit geometryCheckCompleted( layer, fid, QList<std::shared_ptr<QgsSingleGeometryCheckError>>() );
Expand Down Expand Up @@ -461,9 +465,13 @@ void QgsGeometryValidationService::triggerTopologyChecks( QgsVectorLayer *layer,
if ( !allErrors.empty() || !mLayerChecks[layer].singleFeatureCheckErrors.empty() )
{
if ( mLayerChecks[layer].commitPending )
{
showMessage( tr( "Geometry errors have been found. Please fix the errors before saving the layer." ) );
}
else
{
showMessage( tr( "Geometry errors have been found." ) );
}
}
if ( allErrors.empty() && mLayerChecks[layer].singleFeatureCheckErrors.empty() && mLayerChecks[layer].commitPending )
{
Expand Down

0 comments on commit 6062ff7

Please sign in to comment.