ArcFM Desktop Developer Guide
Fiber Manager

Resource Center Home

The following example shows how you can use the static, overloaded RunTrace method to run a fiber trace and return the connection trace structure.

Example Title
Copy Code
using System.Collections.Generic;
using ESRI.ArcGIS.Geodatabase;
using Miner.Framework.FiberManager;
using Miner.Geodatabase;
namespace Example.Framework.FiberManagerCustomCode
{
    public class ExampleTrace
    {
        private readonly RowConvertor _rc;
        public ExampleTrace(IWorkspace wkspc)
        {
            _rc = new RowConvertor(wkspc,ModelNameManager.Instance);
        }
        //the IRow of a fiber strand or port object
        public void RunTrace(IRow startRow, IRow nextRow) 
        {
            ConnectivityTrace trace;
            if(nextRow == null)
            {
                //Runs a non directional Y style trace shows error dialogs and does not throw errors
                trace = ConnectivityTrace.RunTrace(startRow, false, false, false);
            }
            else
            {
                //Runs a directional y style trace shows error dialogs and does not throw errors
                trace = ConnectivityTrace.RunTrace(startRow, nextRow, false, false);
            }
            //Get back the trace results
            var traceResults = trace.TraceResults;
            //exit if they came back empty
            if(traceResults == null)
            {
                return;
            }
            //Use the reults in whatever way we choose
            UseTrace(traceResults);
        }
        public void UseTrace(List<object> traceResults)
        {
            foreach(var o in traceResults)
            {
                //If for some reason an object in the trace was null skip it
                if(o == null)
                {
                    continue;
                }
                IRow row;
                if((row = o as IRow) != null)
                {
                    //If the object is a row in the trace then it is a lower level connectable object row
                    //use the row convertor to get its upper level feature
                    var feature = _rc.GetUpperLevelFeatureOfRow(row);
                    //TODO Whatever you wish to do with the row or its upper level feature
                }
                else
                {
                    //If the object is not a row then it is another branch of the trace so recurse 
                    //to use the objects in this branch
                    UseTrace((List<object>)o);
                }
            }
        }
    }
}

Class:
    ConnectivityTrace

 

 


Send Comment to ArcFMdocumentation@schneider-electric.com