@@ -63,34 +63,37 @@ void QgsGeometryValidationService::onFeatureAdded( QgsVectorLayer *layer, QgsFea
63
63
{
64
64
if ( !mLayerChecks [layer].topologyChecks .empty () )
65
65
{
66
- // TODO: Cancel topology checks
67
- layer->setAllowCommit ( false );
66
+ invalidateTopologyChecks ( layer );
68
67
}
69
68
processFeature ( layer, fid );
70
69
}
71
70
72
71
void QgsGeometryValidationService::onGeometryChanged ( QgsVectorLayer *layer, QgsFeatureId fid, const QgsGeometry &geometry )
73
72
{
73
+ Q_UNUSED ( geometry )
74
+ // It would be nice to use the geometry here for the tests.
75
+ // But:
76
+ // 1. other codepaths to the checks also have no geometry (feature added / feature deleted)
77
+ // 2. and looking it up from the edit buffer (in memory) is really fast.
78
+ // so in short: it's still a good idea, but not as important as on first thought.
79
+
74
80
if ( !mLayerChecks [layer].topologyChecks .empty () )
75
81
{
76
- // TODO: Cancel topology checks
77
- layer->setAllowCommit ( false );
82
+ invalidateTopologyChecks ( layer );
78
83
}
79
- Q_UNUSED ( geometry )
80
84
81
- cancelChecks ( layer, fid );
82
85
processFeature ( layer, fid );
83
86
}
84
87
85
88
void QgsGeometryValidationService::onFeatureDeleted ( QgsVectorLayer *layer, QgsFeatureId fid )
86
89
{
87
90
if ( !mLayerChecks [layer].topologyChecks .empty () )
88
91
{
89
- // TODO: Cancel topology checks
90
- layer->setAllowCommit ( false );
92
+ invalidateTopologyChecks ( layer );
91
93
}
92
94
93
- cancelChecks ( layer, fid );
95
+ // There should be no geometry errors on an inexistent feature, right?
96
+ emit geometryCheckCompleted ( layer, fid, QList<std::shared_ptr<QgsSingleGeometryCheckError>>() );
94
97
}
95
98
96
99
void QgsGeometryValidationService::onBeforeCommitChanges ( QgsVectorLayer *layer )
@@ -220,9 +223,10 @@ void QgsGeometryValidationService::cancelTopologyCheck( QgsVectorLayer *layer )
220
223
}
221
224
}
222
225
223
- void QgsGeometryValidationService::cancelChecks ( QgsVectorLayer *layer, QgsFeatureId fid )
226
+ void QgsGeometryValidationService::invalidateTopologyChecks ( QgsVectorLayer *layer )
224
227
{
225
-
228
+ cancelTopologyCheck ( layer );
229
+ layer->setAllowCommit ( false );
226
230
}
227
231
228
232
void QgsGeometryValidationService::processFeature ( QgsVectorLayer *layer, QgsFeatureId fid )
0 commit comments