Skip to content
Permalink
Browse files

Topology check integration in validation service

  • Loading branch information
m-kuhn committed Sep 27, 2018
1 parent 88ef921 commit ea878153b54a758ea9ebf872c02f3b7b06f2854d
Showing with 21 additions and 3 deletions.
  1. +17 −3 src/app/qgsgeometryvalidationservice.cpp
  2. +4 −0 src/app/qgsgeometryvalidationservice.h
@@ -52,6 +52,10 @@ void QgsGeometryValidationService::onLayersAdded( const QList<QgsMapLayer *> &la
{
onFeatureDeleted( vectorLayer, fid );
} );
connect( vectorLayer, &QgsVectorLayer::beforeCommitChanges, this, [this, vectorLayer]()
{
onBeforeCommitChanges( vectorLayer );
} );

enableLayerChecks( vectorLayer );
}
@@ -76,6 +80,14 @@ void QgsGeometryValidationService::onFeatureDeleted( QgsVectorLayer *layer, QgsF
cancelChecks( layer, fid );
}

void QgsGeometryValidationService::onBeforeCommitChanges( QgsVectorLayer *layer )
{
if ( !mTopologyChecksOk.value( layer ) )
{
triggerTopologyChecks( layer );
}
}

void QgsGeometryValidationService::enableLayerChecks( QgsVectorLayer *layer )
{
// TODO: finish all ongoing checks
@@ -145,7 +157,9 @@ void QgsGeometryValidationService::processFeature( QgsVectorLayer *layer, QgsFea
}

emit geometryCheckCompleted( layer, fid, allErrors );
// TODO: this is a bit hardcore
// const auto errors = mIsValidGeometryCheck->processGeometry( feature.geometry() );
// emit geometryCheckCompleted( layer, fid, errors );
}

void QgsGeometryValidationService::triggerTopologyChecks( QgsVectorLayer *layer )
{

}
@@ -71,6 +71,7 @@ class QgsGeometryValidationService : public QObject
void onFeatureAdded( QgsVectorLayer *layer, QgsFeatureId fid );
void onGeometryChanged( QgsVectorLayer *layer, QgsFeatureId fid, const QgsGeometry &geometry );
void onFeatureDeleted( QgsVectorLayer *layer, QgsFeatureId fid );
void onBeforeCommitChanges( QgsVectorLayer *layer );

private:
void enableLayerChecks( QgsVectorLayer *layer );
@@ -79,9 +80,12 @@ class QgsGeometryValidationService : public QObject

void processFeature( QgsVectorLayer *layer, QgsFeatureId fid );

void triggerTopologyChecks( QgsVectorLayer *layer );

QgsProject *mProject = nullptr;

QHash<QgsVectorLayer *, QList< QgsSingleGeometryCheck * > > mSingleFeatureChecks;
QHash<QgsVectorLayer *, bool > mTopologyChecksOk;
};

#endif // QGSGEOMETRYVALIDATIONSERVICE_H

0 comments on commit ea87815

Please sign in to comment.
You can’t perform that action at this time.