SetDefaultEvaluator() public static method

public static SetDefaultEvaluator ( IEvaluatedNetworkAttribute netAttribute, object defaultValue, esriNetworkElementType eType ) : void
netAttribute IEvaluatedNetworkAttribute
defaultValue object
eType esriNetworkElementType
return void
        public static IEvaluatedNetworkAttribute AddScaleSubsetAttribute(IDENetworkDataset deNet, INetworkAttribute2 baseNetAttribute)
        {
            if (baseNetAttribute == null)
            {
                return(null);
            }

            if (baseNetAttribute.UsageType != esriNetworkAttributeUsageType.esriNAUTCost)
            {
                return(null);
            }

            IArray netAttributes = deNet.Attributes;
            IEvaluatedNetworkAttribute netAttribute = new EvaluatedNetworkAttributeClass() as IEvaluatedNetworkAttribute;

            string netAttributeName = BaseParameterName;

            netAttributeName += "_";
            netAttributeName += baseNetAttribute.Name;

            netAttribute.Name      = netAttributeName;
            netAttribute.UsageType = baseNetAttribute.UsageType;
            netAttribute.DataType  = baseNetAttribute.DataType;
            netAttribute.Units     = baseNetAttribute.Units;

            List <INetworkSource> allNetSources  = SubsetHelper.GetSourceList(deNet.Sources);
            List <INetworkSource> netSources     = SubsetHelper.GetSourceList(allNetSources, esriNetworkElementType.esriNETEdge);
            List <string>         netSourceNames = SubsetHelper.GetSourceNames(netSources);

            ResetScaleSubsetParameters((INetworkAttribute2)netAttribute, netSourceNames);

            bool supportTurns = deNet.SupportsTurns;

            //default evaluators
            SubsetHelper.SetDefaultEvaluator(netAttribute, 0, esriNetworkElementType.esriNETEdge);
            SubsetHelper.SetDefaultEvaluator(netAttribute, 0, esriNetworkElementType.esriNETJunction);
            if (supportTurns)
            {
                SubsetHelper.SetDefaultEvaluator(netAttribute, 0, esriNetworkElementType.esriNETTurn);
            }

            //sourced evaluators
            foreach (INetworkSource netSource in netSources)
            {
                SubsetHelper.SetEvaluators(netAttribute, netSource, typeof(ScaleSubsetEvaluator));
            }

            netAttributes.Add(netAttribute);
            deNet.Attributes = netAttributes;

            return(netAttribute);
        }
        public static IEvaluatedNetworkAttribute AddFilterSubsetAttribute(IDENetworkDataset deNet)
        {
            IArray netAttributes = deNet.Attributes;
            IEvaluatedNetworkAttribute netAttribute = new EvaluatedNetworkAttributeClass() as IEvaluatedNetworkAttribute;

            netAttribute.Name      = BaseParameterName;
            netAttribute.UsageType = esriNetworkAttributeUsageType.esriNAUTRestriction;
            netAttribute.DataType  = esriNetworkAttributeDataType.esriNADTBoolean;
            netAttribute.Units     = esriNetworkAttributeUnits.esriNAUUnknown;

            INetworkAttribute2 netAttribute2 = netAttribute as INetworkAttribute2;

            netAttribute2.UseByDefault = true;

            List <INetworkSource> allNetSources  = SubsetHelper.GetSourceList(deNet.Sources);
            List <INetworkSource> netSources     = SubsetHelper.GetSourceList(allNetSources, esriNetworkElementType.esriNETEdge);
            List <string>         netSourceNames = SubsetHelper.GetSourceNames(netSources);

            ResetFilterSubsetParameters((INetworkAttribute2)netAttribute, netSourceNames);

            bool supportTurns = deNet.SupportsTurns;

            //default evaluators
            SubsetHelper.SetDefaultEvaluator(netAttribute, false, esriNetworkElementType.esriNETEdge);
            SubsetHelper.SetDefaultEvaluator(netAttribute, false, esriNetworkElementType.esriNETJunction);
            if (supportTurns)
            {
                SubsetHelper.SetDefaultEvaluator(netAttribute, false, esriNetworkElementType.esriNETTurn);
            }

            //sourced evaluators
            foreach (INetworkSource netSource in netSources)
            {
                SubsetHelper.SetEvaluators(netAttribute, netSource, typeof(FilterSubsetEvaluator));
            }

            netAttributes.Add(netAttribute);
            deNet.Attributes = netAttributes;

            return(netAttribute);
        }