This document is archived and information here might be outdated. Recommended version. |
Set generic solver parameters.
//<-- Snippet Start --> // DESCRIPTION: // Set generic solver parameters, including... ESRI.ArcGIS.NetworkAnalyst.INASolverSettings2 naSolverSettings=naSolver as ESRI.ArcGIS.NetworkAnalyst.INASolverSettings2; // ...impedance attribute naSolverSettings.ImpedanceAttributeName="Minutes"; // ...restriction attributes ESRI.ArcGIS.esriSystem.IStringArray restrictionAttributes=naSolverSettings.RestrictionAttributeNames; restrictionAttributes.Add("HeightRestriction"); naSolverSettings.RestrictionAttributeNames=restrictionAttributes; // ...attribute parameters naSolverSettings.set_AttributeParameterValue("HeightRestriction", "VehicleHeight", 10); // ...accumulated attributes ESRI.ArcGIS.esriSystem.IStringArray accumulateAttributes=naSolverSettings.AccumulateAttributeNames; accumulateAttributes.Add("Distance"); naSolverSettings.AccumulateAttributeNames=accumulateAttributes; // ...hierarchies naSolverSettings.UseHierarchy=true; naSolverSettings.HierarchyAttributeName="Hierarchy"; // ...UTurn policy naSolverSettings.RestrictUTurns=ESRI.ArcGIS.Geodatabase.esriNetworkForwardStarBacktrack.esriNFSBAllowBacktrack; // ...invalid location handling naSolverSettings.IgnoreInvalidLocations=true; //<-- Snippet End -->
'<-- Snippet Start --> ' DESCRIPTION: ' Set generic solver parameters, including... Dim naSolverSettings As ESRI.ArcGIS.NetworkAnalyst.INASolverSettings2=CType(naSolver, ESRI.ArcGIS.NetworkAnalyst.INASolverSettings2) ' ...impedance attribute naSolverSettings.ImpedanceAttributeName="Minutes" ' ...restriction attributes Dim restrictionAttributes As ESRI.ArcGIS.esriSystem.IStringArray=naSolverSettings.RestrictionAttributeNames restrictionAttributes.Add("HeightRestriction") naSolverSettings.RestrictionAttributeNames=restrictionAttributes ' ...attribute parameters naSolverSettings.AttributeParameterValue("HeightRestriction", "VehicleHeight")=10 ' ...accumulated attributes Dim accumulateAttributes As ESRI.ArcGIS.esriSystem.IStringArray=naSolverSettings.AccumulateAttributeNames accumulateAttributes.Add("Distance") naSolverSettings.AccumulateAttributeNames=accumulateAttributes ' ...hierarchies naSolverSettings.UseHierarchy=True naSolverSettings.HierarchyAttributeName="Hierarchy" ' ...UTurn policy naSolverSettings.RestrictUTurns=ESRI.ArcGIS.Geodatabase.esriNetworkForwardStarBacktrack.esriNFSBAllowBacktrack naSolverSettings.IgnoreInvalidLocations=True '<-- Snippet End -->