The feature class by element type.
[Visual Basic .NET]
Public Function get_FeatureClass ( _
ByVal networkElementType As esriNetworkElementType _
) As IFeatureClass
[C#]
public IFeatureClass get_FeatureClass (
esriNetworkElementType networkElementType
);
[C++]
HRESULT get_FeatureClass(
esriNetworkElementType networkElementType,
IFeatureClass** FeatureClass
);
[C++]
Parameters
networkElementType [in]
networkElementType is a parameter of type esriNetworkElementType
FeatureClass [out, retval]
FeatureClass is a parameter of type IFeatureClass
Product Availability
Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server. Requires Network Analyst Extension.
Remarks
Use the FeatureClass property to return a feature class holding all of the NATraversalResultElements of a specific type (esriNETJunction, esriNETEdge, esriNETTurn).
This feature class can be accessed like any other feature class in ArcGIS.
[C#]
This C# example shows how you can add a feature class returned by the FeatureClass property on INATraversalResultQuery to a map.
public void AddNATraversalResultToMap(INALayer naLayer, IMap map)
{
INATraversalResultQuery traversalResultQuery=naLayer.Context.Result;
INATraversalResultEdit naTraversalResultEdit=traversalResultQuery as INATraversalResultEdit;
// Infer Geometry
naTraversalResultEdit.InferGeometry(string.Empty, null, new CancelTrackerClass());
// Get the Edges and add as a layer
IFeatureLayer featureLayer=new FeatureLayerClass();
featureLayer.FeatureClass=traversalResultQuery.get_FeatureClass(esriNetworkElementType.esriNETEdge);
featureLayer.Name=featureLayer.FeatureClass.AliasName;
map.AddLayer(featureLayer);
// Get the Junctions and add as a layer
featureLayer=new FeatureLayerClass();
featureLayer.FeatureClass=traversalResultQuery.get_FeatureClass(esriNetworkElementType.esriNETJunction);
featureLayer.Name=featureLayer.FeatureClass.AliasName;
map.AddLayer(featureLayer);
}
[Visual Basic .NET]
This VB.NET example shows how you can add a feature class returned by the FeatureClass property on INATraversalResultQuery to a map.
Public Sub AddNATraversalResultToMap(ByVal naLayer As INALayer, ByVal map As IMap)
Dim traversalResultQuery As INATraversalResultQuery=naLayer.Context.Result
Dim naTraversalResultEdit As INATraversalResultEdit=traversalResultQuery
' Infer Geometry
naTraversalResultEdit.InferGeometry(String.Empty, Nothing, New CancelTracker())
' Get the Edges and add as a layer
Dim featureLayer As IFeatureLayer=New FeatureLayer()
featureLayer.FeatureClass=traversalResultQuery.FeatureClass(esriNetworkElementType.esriNETEdge)
featureLayer.Name=featureLayer.FeatureClass.AliasName
map.AddLayer(featureLayer)
' Get the Junctions and add as a layer
featureLayer=New FeatureLayer()
featureLayer.FeatureClass=traversalResultQuery.FeatureClass(esriNetworkElementType.esriNETJunction)
featureLayer.Name=featureLayer.FeatureClass.AliasName
map.AddLayer(featureLayer)
End Sub
See Also
INATraversalResultQuery Interface
.NET Samples
Add a traversal result to the map (Code Files:
AddTraversalResultsToMap)