Skip to content

Commit

Permalink
Merge pull request #8403 from m-kuhn/backportAutoActivateGeometryVali…
Browse files Browse the repository at this point in the history
…dation

Backport auto activate geometry validation
  • Loading branch information
m-kuhn committed Nov 2, 2018
2 parents 383851c + 63d9421 commit 7b5926f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/app/qgsgeometryvalidationservice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ void QgsGeometryValidationService::onLayersAdded( const QList<QgsMapLayer *> &la
enableLayerChecks( vectorLayer );
} );

connect( vectorLayer->geometryOptions(), &QgsGeometryOptions::geometryChecksChanged, this, [this, vectorLayer]()
{
enableLayerChecks( vectorLayer );
} );

connect( vectorLayer, &QgsVectorLayer::destroyed, this, [vectorLayer, this]()
{
cleanupLayerChecks( vectorLayer );
Expand Down Expand Up @@ -175,9 +180,12 @@ void QgsGeometryValidationService::cleanupLayerChecks( QgsVectorLayer *layer )
VectorLayerCheckInformation &checkInformation = mLayerChecks[layer];

cancelTopologyCheck( layer );
clearTopologyChecks( layer );

qDeleteAll( checkInformation.singleFeatureChecks );
checkInformation.singleFeatureChecks.clear();
qDeleteAll( checkInformation.topologyChecks );
checkInformation.topologyChecks.clear();
checkInformation.context.reset();
}

Expand Down Expand Up @@ -315,6 +323,7 @@ void QgsGeometryValidationService::clearTopologyChecks( QgsVectorLayer *layer )
{
QList<std::shared_ptr<QgsGeometryCheckError>> &allErrors = mLayerChecks[layer].topologyCheckErrors;
allErrors.clear();
layer->setAllowCommit( mLayerChecks[layer].singleFeatureCheckErrors.empty() );

emit topologyChecksCleared( layer );
}
Expand Down Expand Up @@ -363,6 +372,7 @@ void QgsGeometryValidationService::triggerTopologyChecks( QgsVectorLayer *layer
{
cancelTopologyCheck( layer );
clearTopologyChecks( layer );
layer->setAllowCommit( false );

QgsFeatureIds affectedFeatureIds;
if ( layer->editBuffer() )
Expand Down

0 comments on commit 7b5926f

Please sign in to comment.