I find a strange thing occasionally, I have a validate topology function developed by vb.net arcobjects. It work not properly. The case is:
- open arcmap
- start editing
- use my validate topology function, nothing happen, no error find (there really several errors)
- set the extent to global and use arcmap topology toolbar 'validate topology in current extent' tool to validate topology
- open error inspector and get errors list (4 errors)
- change the current extent and use arcmap topology toolbar 'validate topology in current extent' tool to validate topology
- open error inspector and get errors list (2 errors)
- remain the same extent as step 6, use validate topology function developed by vb.net arcobjects, all errors displayed in error inspector.
I want to know is it my code bug or operator issue?
' Step 1 - access a topology Dim topoUiD As UID = New UIDClass topoUiD.Value = "esriEditorExt.TopologyExtension" Dim m_application As IApplication = My.ArcMap.Application Dim topologyExt As ITopologyExtension = CType(m_application.FindExtensionByCLSID(topoUiD), ITopologyExtension) 'original code from esri Dim topology As ITopology topology = CType(topologyExt.CurrentTopology, ITopology) MsgBox("successfully access current topology") ' Step 2 - Finding topology errors Dim geoDS As IGeoDataset = CType(topology, IGeoDataset) Dim errorContainer As IErrorFeatureContainer = CType(topology, IErrorFeatureContainer) Dim eErrorFeat As IEnumTopologyErrorFeature eErrorFeat = errorContainer.ErrorFeaturesByRuleType(geoDS.SpatialReference, esriTopologyRuleType.esriTRTLineCoveredByLineClass, Nothing, True, False) Dim topoError As ITopologyErrorFeature ' check the eErrorFeat length to determine whether has error topoError = eErrorFeat.Next topologyExt.ClearActiveErrors(esriTEEventHint.esriTENone) topologyExt.DelayEvents(True) Do While Not (topoError Is Nothing) MsgBox("Topology error exists!") topologyExt.AddActiveError(topoError, esriTEEventHint.esriTENone) topoError = eErrorFeat.Next Loop topologyExt.DelayEvents(False)
Another thing is if I am not in editing session and use validate topology tool developed by vb.net arcobjects, the map will crash.