This document is archived and information here might be outdated. Recommended version. |
Provides access to the results of an analysis.
Name | Description | |
---|---|---|
ElementIDFieldName | The element ID field name. | |
FeatureClass | The feature class by element type. | |
FromEdgeIDFieldName | The from edge ID field name. | |
FromJunctionIDFieldName | The from junction ID field name. | |
FromPositionFieldName | The from position field name. | |
SearchConnected | Returns a connected set of elements in the result. | |
SourceIDFieldName | The source ID field name. | |
SourceOIDFieldName | The source OID field name. | |
ToEdgeIDFieldName | The to edge ID field name. | |
ToJunctionIDFieldName | The to junction ID field name. | |
ToPositionFieldName | The to position field name. |
Classes | Description |
---|---|
NATraversalResult | Contains the result of a network analysis. |
INATraversalResultQuery has been superseded by INATraversalResultQuery2.
This C# example shows how you can add a feature class returned by the FeatureClass property on INATraversalResultQuery to a map.
public void AddNATraversalResultToMap(ESRI.ArcGIS.NetworkAnalyst.INALayer naLayer, ESRI.ArcGIS.Carto.IMap map)
{
ESRI.ArcGIS.NetworkAnalyst.INATraversalResultQuery traversalResultQuery = naLayer.Context.Result as ESRI.ArcGIS.NetworkAnalyst.INATraversalResultQuery;
ESRI.ArcGIS.NetworkAnalyst.INATraversalResultEdit naTraversalResultEdit = traversalResultQuery as ESRI.ArcGIS.NetworkAnalyst.INATraversalResultEdit;
// Infer Geometry
naTraversalResultEdit.InferGeometry(string.Empty, null, new ESRI.ArcGIS.Display.CancelTrackerClass());
// Get the Edges and add as a layer
ESRI.ArcGIS.Carto.IFeatureLayer featureLayer = new ESRI.ArcGIS.Carto.FeatureLayerClass();
featureLayer.FeatureClass = traversalResultQuery.get_FeatureClass(ESRI.ArcGIS.Geodatabase.esriNetworkElementType.esriNETEdge);
featureLayer.Name = featureLayer.FeatureClass.AliasName;
map.AddLayer(featureLayer);
// Get the Junctions and add as a layer
featureLayer = new ESRI.ArcGIS.Carto.FeatureLayerClass();
featureLayer.FeatureClass = traversalResultQuery.get_FeatureClass(ESRI.ArcGIS.Geodatabase.esriNetworkElementType.esriNETJunction);
featureLayer.Name = featureLayer.FeatureClass.AliasName;
map.AddLayer(featureLayer);
}
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