ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Core.Data.UtilityNetwork.Trace Namespace / Function Class
Members Example

In This Topic
    Function Class
    In This Topic
    Functions allow the computation of values during a network trace.
    Object Model
    Function ClassCondition ClassNetworkAttribute ClassField Class
    Syntax
    Public MustInherit Class Function 
    public abstract class Function 
    Remarks
    Functions are evaluated at each applicable network element. The meaning of applicable varies depending on the Tracer. At the conclusion of the trace, function results can obtained using the FunctionOutputResult class.
    Example
    Create a Function
    {
      // This routine creates an Add function to sum the Load network attribute during a trace
      static void ApplyFunction(UtilityNetworkDefinition utilityNetworkDefinition, TraceConfiguration traceConfiguration)
      {
        // Get a NetworkAttribute object for the Load network attribute from the UtilityNetworkDefinition
        using NetworkAttribute loadNetworkAttribute = utilityNetworkDefinition.GetNetworkAttribute("Load");
        // Create a function to sum the Load
        Add sumLoadFunction = new Add(loadNetworkAttribute);
    
        // Add this function to our trace configuration
        traceConfiguration.Functions = new List<Function>() { sumLoadFunction };
      }
    }
    Create a FunctionBarrier
    {
      // This routine creates a FunctionBarrier that stops traversal when the total shape length exceeds 1000 feet
      static void CreateFunctionBarrier(UtilityNetworkDefinition utilityNetworkDefinition, TraceConfiguration traceConfiguration)
      {
        // Create a NetworkAttribute object for the Shape length network attribute from the UtilityNetworkDefinition
        using NetworkAttribute shapeLengthNetworkAttribute = utilityNetworkDefinition.GetNetworkAttribute("Shape length");
        // Create a function that adds up shape length
        Add lengthFunction = new Add(shapeLengthNetworkAttribute);
    
        // Create a function barrier that stops traversal after 1000 feet
        FunctionBarrier distanceBarrier = new FunctionBarrier(lengthFunction, Operator.GreaterThan, 1000.0);
    
        // Set this function barrier
        traceConfiguration.Traversability.FunctionBarriers = new List<FunctionBarrier>() { distanceBarrier };
      }
    }
    Inheritance Hierarchy
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also