ArcObjects Library Reference  (GeoDatabase)    

INetworkClass.NetworkAncillaryRole Property

The possible network ancillary roles of the contained Features.

[Visual Basic 6.0]
Property NetworkAncillaryRole As esriNetworkClassAncillaryRole
[Visual Basic .NET]
Public ReadOnly Property NetworkAncillaryRole As esriNetworkClassAncillaryRole
[C#]
public esriNetworkClassAncillaryRole NetworkAncillaryRole {get;}
[Java]
public esriNetworkClassAncillaryRole getNetworkAncillaryRole()
throws
    IOException,
    AutomationException
[C++]
HRESULT get_NetworkAncillaryRole(
  esriNetworkClassAncillaryRole* Role
);
[C++]

Parameters

Role [out, retval]

  Role is a parameter of type esriNetworkClassAncillaryRole

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Remarks

The NetworkAncillaryRole property will return the esriNetworkAncillaryRole enumeration which indicates if the junction class has a network ancillary role. Since junctions in a geometric network can act as a source, a sink or neither when calculating flow direction, this property will indicate whether or not the features in the class can be sources or sinks. If the class is a simple edge or complex edge network class, the ancillary role will always be returned as esriNCARNone since only junctions may have ancillary roles.

[C#]

The following example loops through the layers in a geometric network and prints out their ancillary role.

public void esriGeoDatabase__INetworkClass_NetworkAncillaryRole(IGeometricNetwork geometricNetwork)
{
    // The following example loops through the layers in the geometric network and prints out their ancillary role.
    IFeatureClassContainer featureclassContainer = (IFeatureClassContainer)geometricNetwork;
    INetworkClass networkClass;
    // for each feature class in the network
    for (int i = 0; i < featureclassContainer.ClassCount - 1; i++)
    {
        networkClass = (INetworkClass)featureclassContainer.get_Class(i);
        if (networkClass.NetworkAncillaryRole == esriNetworkClassAncillaryRole.esriNCARNone)
        {
            Console.WriteLine(networkClass.AliasName + " does not support an ancillary role.");
        }
        else
        {
            Console.WriteLine(networkClass.AliasName + " supports source and sink ancillary roles.");
        }
    }
}

[Visual Basic 6.0]

The following example loops through the layers in you map and prints out their ancillary role.

Dim pFeatcls As IFeatureClass
Dim pNetClass As INetworkClass
Dim pFeatLayer As IFeatureLayer
Dim pDoc As IMxDocument
Dim pMap As IMap
Dim lLayer As Long
' for each feature layer in the map
Set pDoc = ThisDocument
Set pMap = pDoc.Maps.Item(0)
For lLayer = 0 To (pMap.LayerCount - 1)
  Set pFeatLayer = pMap.Layer(lLayer)
  Set pFeatcls = pFeatLayer.FeatureClass
  ' check to see if it is a network class
  If TypeOf pFeatcls Is INetworkClass Then
    Set pNetClass = pFeatcls
    If pNetClass.NetworkAncillaryRole = esriNCARNone Then
      Debug.Print pFeatcls.AliasName & " does not support an ancillary role."
    Else
      Debug.Print pFeatcls.AliasName & " supports source and sink ancillary roles."
    End If
  Else
    Debug.Print pFeatcls.AliasName & " is not a network class."
  End If
Next lLayer

See Also

INetworkClass Interface | IGeometricNetwork Interface | INetwork Interface

 


Feedback Send feedback on this page