示例#1
0
        /// <summary>
        /// Gets the closest component to a location
        /// </summary>
        /// <param name="loc"></param>
        /// <returns></returns>
        public SLComponentType ClosestComponent(Coordinates loc)
        {
            LinePath iLp  = this.InitialPath(loc);
            double   init = iLp.GetPoint(iLp.GetClosestPoint(loc)).DistanceTo(loc);

            LinePath fLp = this.FinalPath(loc);
            double   fin = fLp.GetPoint(fLp.GetClosestPoint(loc)).DistanceTo(loc);

            double inter = Interconnect.DistanceTo(loc);

            if (init < inter && init < fin)
            {
                return(SLComponentType.Initial);
            }
            else if (fin < inter && fin < init)
            {
                return(SLComponentType.Final);
            }
            else
            {
                return(SLComponentType.Interconnect);
            }
        }