I need to be able to tell when a particular type of feature, that participates in a geometric network, is having its geometry automatically modified due to the geometric network.

What i mean is that I'm currently listening to the IObjectClassEvents::OnChange and use it to work out if the feature being changed is of the type I am interested in and if the change is to its geometry. I use IFeatureChanges and IRowChanges. This works fine. However I also want to check if the change is caused by a change to a connected node in the geometric network OR if the change is due to the user modifying the feature directly.

Anyone have any idea how to do this ?

I would be looking for a INetworkFeatureChanges or an INetwokClassEvents interface, but they don't exist..

Thanks, Ian

  • Anyone?? I did find a turnaround but it's not pretty. In the OnChange Event, I use the IRowChanges and IFeatureChanges to determine if something change. If neither the row values nor the geometry has changed, I assume it's a geometric network action. I'm still waiting for a prettier way to do this – Goldorak84 Jun 21 '11 at 13:53

After making a lot of testing, I found that the most accurate way to detect geometric network actions(such as connect, disconnect) in an IObjectClassEvents::OnChange event is to use the interfaces IRowChanges and IFeatureChanges to determine if something changed.

    Private Function NetworkConnectivityChanged(ByVal obj As ESRI.ArcGIS.Geodatabase.IObject) As Boolean
        Return Not ValuesChanged(obj) And Not ShapeChanged(obj)
    End Function

    Private Function ValuesChanged(ByVal obj As ESRI.ArcGIS.Geodatabase.IObject) As Boolean
        Dim rowChanges As IRowChanges
        rowChanges = DirectCast(obj, IRowChanges)
        For i As Integer = 0 To obj.Fields.FieldCount - 1
            If rowChanges.ValueChanged(i) Then 
                Return True
            End If
        Next i

        Return False
    End Function

    Private Function ShapeChanged(ByVal obj As ESRI.ArcGIS.Geodatabase.IObject) As Boolean
        Dim featureChanges As IFeatureChanges
        featureChanges = DirectCast(obj, IFeatureChanges)
        Return featureChanges.ShapeChanged
    End Function 
  • Interesting - so have you tested this by programmatically disconnecting something via INetworkFeature.Disconnect? – Kirk Kuykendall Jul 14 '11 at 17:19
  • 2
    Yes, I did, and the disconnect operation fired immmediatly the OnChange event. Same thing with the INetworkFeature.Connect event. – Goldorak84 Jul 19 '11 at 11:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.