Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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

share|improve this question
    
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

1 Answer 1

up vote 3 down vote accepted

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 
share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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