ArcObjects Component Help  (Core)    

INetworkClass Interface

Provides access to members that return information about geometric networks, field weighting and ancillary roles.

When To Use

Use the INetworkClass interface to get a reference to the geometric network which the network class (feature class) belongs to. You can also check to see if the network class has an Ancillary Role in the network, and the wight to field mapping for the logical network.

The INetworkClass interface inherits from the IFeatureClass interface and the ITable interface.

Members

Description
Method AddField Adds a field to this object class.
Method AddIndex Adds an index to this object class.
Read-only property AliasName The alias name of the object class.
Read-only property AreaField The geometry area field.
Read-only property CLSID The GUID for the COM Class (CoClass) corresponding to instances of this object class.
Method CreateFeature Create a new feature, with a system assigned object ID and null property values.
Method CreateFeatureBuffer Create a feature buffer that can be used with an insert cursor.
Method DeleteField Deletes a field from this object class.
Method DeleteIndex Deletes an index from this object class.
Read-only property EXTCLSID The GUID for the COM Class (CoClass) corresponding to the class extension for this object class.
Read-only property Extension The extension for this object class.
Read-only property ExtensionProperties The extension properties for this object class.
Read-only property FeatureClassID The unique ID for the Feature Class.
Method FeatureCount The number of features selected by the specified query.
Read-only property FeatureDataset The feature dataset that contains the feature class.
Read-only property FeatureType The type of features in this feature class.
Read-only property Fields The fields collection for this object class.
Read-only property FieldToWeightMapping The specified field to Weight mapping for the logical network.
Method FindField The index of the field with the specified name.
Read-only property GeometricNetwork The geometric network in which this class participates.
Method GetFeature Get the feature with the specified object ID.
Method GetFeatures Get a cursor of Rows given a set of object ids.
Read-only property HasOID Indicates if the class has an object identity (OID) field.
Read-only property Indexes The indexes collection for this object class.
Method Insert Returns a cursor that can be used to insert new features.
Read-only property LengthField The geometry length field.
Read-only property NetworkAncillaryRole The possible network ancillary roles of the contained Features.
Read-only property ObjectClassID The unique ID for the object class.
Read-only property OIDFieldName The name of the field corresponding to the OID.
Read-only property RelationshipClasses The relationship classes in which this object class participates in for the specified role.
Method Search Returns an object cursor that can be used to fetch feature objects selected by the specified query.
Method Select Returns a selection That contains the object ids selected by the specified query.
Read-only property ShapeFieldName The name of the default sShape field.
Read-only property ShapeType The type of the default Shape for the features in this feature class.
Method Update Returns a cursor that can be used to update features selected by the specified query.

Inherited Interfaces

Interfaces Description
IFeatureClass Provides access to members that control the behavior and properties of a feature class.
IObjectClass Provides access to members that return information about an object class.
IClass Provides access to members that return information about and manage the class.

CoClasses that implement INetworkClass

CoClasses and Classes Description
FeatureClass FeatureClass Object.

Remarks

The FeatureType property of such feature classes will be one of esriFTSimpleJunction, esriDTSimpleEdge, esriFTComplexJunction, or esriFTComplexEdge.

The following two examples are code excerpts that show how to get a reference to an INetworkClass interface with Visual Basic for Applications and Visual Basic respectivly.

When using VBA, you can use the table of contents in ArcMap to get at the network featureclass.

Dim pFeatcls As IFeatureClass
Dim pNetClass As INetworkClass
Dim pFeatLayer As IFeatureLayer
Dim pDoc As IMxDocument
Dim pMap As IMap

Set pDoc = ThisDocument
Set pMap = pDoc.Maps.Item(0)
Set pFeatLayer = pMap.Layer(0)
Set pFeatcls = pFeatLayer.FeatureClass
Set pNetClass = pFeatcls

Or you can use IMap::Layers to return an enumeration of layers corresponding to the network feature classes.

Dim pMxDocument As IMxDocument
Dim pMap As IMap
Dim pEnumLayer As IEnumLayer
Dim pLayer As ILayer
Dim pFLayer As IFeatureLayer
Dim pFC as IFeatureClass
Dim pId As New UID
   
Set pMxDocument = Application.Document
Set pMap = pMxDocument.FocusMap
'The GUID for Network Classes
pId = "{E156D7E5-22AF-11D3-9F99-00C04F6BC78E}"
Set pEnumLayer = pMap.Layers(pId, False)
Set pFLayer = pLayer
Set pFC = pFLayer.FeatureClass

With Visual Basic, you are working outside of the application, so you need to use code to get the workspace object that contains the network feature class, then get the network feature class from there. This example has the location of the Access workspace hard-coded, but you could use the mini-browser to browse to the workspace, or the network feature class.

Dim pFact As IWorkspaceFactory
Set pFact = New AccessWorkspaceFactory
    
Dim pWorkspace As IWorkspace
Set pWorkspace = pFact.OpenFromFile("C:\data\electric.mdb", 0)
   
Dim pFeatws As IFeatureWorkspace
Set pFeatws = pWorkspace
   
Dim pFeatcls As IFeatureClass
Dim pNetClass As INetworkClass
Set pFeatcls = pFeatws.OpenFeatureClass("primaries")
Set pNetClass = pFeatcls

You can QI (Query Interface) to any of these other interfaces on the FeatureClass object.

IDataset
IGeoDataset
ITable
INetworkClass
ISubtypes
IValidation

See Also

IFeatureClass Interface | IGeometricNetwork Interface