Interface INetworkSource

Namespace
ESRI.ArcGIS.Geodatabase
Assembly
ESRI.Server.Geodatabase.dll

Provides access to members that specify the properties of a source in a network dataset.

[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[Guid("10F8D75C-1D54-4F2A-8CE8-FB7D50A0DF1D")]
public interface INetworkSource

Remarks

The INetworkSource interface is used to access the properties of the network source, such as its name and source type.

To access the INetworkSource object for an existing network dataset source, use the Source, SourceByID, or SourceByName methods on the INetworkDataset interface.

The INetworkSource interface is also used to define a new network source.  To create a new network source, cocreate the appropriate NetworkSource object, specify its properties, and pass the object to the INetworkBuild::AddSource method on the network dataset.

Properties

ElementType

Network element type of this network source.

esriNetworkElementType ElementType { get; set; }

Property Value

esriNetworkElementType

GeometryType

The enumerated geometry type.

esriGeometryType GeometryType { get; }

Property Value

esriGeometryType

ID

Unique identifier of this network source.

int ID { get; }

Property Value

int

Remarks

Each source in a Network Dataset is identified by a unique value, the ID property.  The ID property can be used to get a reference to the corresponding network source through the INetworkDataset::SourceByID property.  This ID is different than the ID value returned by the IObjectClass::ObjectClassID property.

As with ObjectID values, SourceID values are never reused.  They are not guaranteed to be sequential, but are guaranteed to be in increasing order based on when the source was added to the network.  Unless the source is added or deleted from the DataElement, the SourceID values will remain constant after the INetworkDataset::UpdateSchema method is called.

Name

Name of the class associated with this network source.

string Name { get; set; }

Property Value

string

Remarks

As the network source and its associated feature class (or table) have the same name, it's possible to use this mapping to retrieve the source from any given layer.

[C#]

// The following code shows how to retrieve a network source based on the feature class name

int layerId = 0;

// Get the feature class associated with the specific layer

IMapServer ms = (MapServer)serverObjectHelper.ServerObject;

IMapServerDataAccess mapServerDataAccess = (IMapServerDataAccess)serverObjectHelper.ServerObject;

IMapServerInfo mapServerInfo = ms.GetServerInfo(ms.DefaultMapName);

IFeatureClass fc = (IFeatureClass)mapServerDataAccess.GetDataSource(ms.DefaultMapName, layerId);

IDataset ds = (IDataset)fc;

// Get the UN domain networks and loop through the network sources to find the one matching the feature class

IDatasetComponent dsComponent = (IDatasetComponent)unDataset;

IDEDataset dataElement = dsComponent.DataElement;

IDEBaseNetwork bnDataElement = (IDEBaseNetwork)dataElement;

IDEUtilityNetwork unDataElement = (IDEUtilityNetwork)bnDataElement;

IArray domainNetworks = unDataElement.DomainNetworks;

INetworkSource ns = null;

for (int i = 0; i < domainNetworks.Count; i++)

{

  IDomainNetwork dn = (IDomainNetwork)domainNetworks.Element[i];

  IArray networkSources = dn.Sources;

  for (int j = 0; j < networkSources.Count; j++)

  {

    INetworkSource currentNS = (INetworkSource) networkSources.Element[j];

    if(currentNS.Name == ds.Name)

    {

      ns = currentNS;

      break;

    }

  }

  if (ns != null)

    break;

}

NetworkSourceDirections

The directions settings for this network source.

INetworkSourceDirections NetworkSourceDirections { get; set; }

Property Value

INetworkSourceDirections

Remarks

The NetworkSourceDirections property specifies the information needed to generate driving directions when reporting routes traversing elements from this INetworkSource.

Properties

Property set of this network source.

IPropertySet Properties { get; set; }

Property Value

IPropertySet

SourceType

Type of network source.

esriNetworkSourceType SourceType { get; }

Property Value

esriNetworkSourceType

UsesGeometryInConnectivity

Indicates if the source object's geometry is used in determining network connectivity.

bool UsesGeometryInConnectivity { get; set; }

Property Value

bool

Remarks

The UsesGeometryInConnectivity property indicates whether the geometries of the features in an INetworkSource  are used in determining how its network elements are connected to each other.

For example, the geometries of the features in an EdgeFeatureSource and JunctionFeatureSource are used to determine how the generated edge and junction elements connect to each other.  The UsesGeometryInConnectivity property for these sources is True.

In contrast, the geometries of the features in a TurnFeatureSource are not used in deteriming how the turn elements are associated with the edges and junctions of the network -- the fields of the TurnFeatureSource feature class determine this.  The UsesGeometryInConnectivity property for the TurnFeatureSource is False.