示例#1
0
        /// <summary>
        /// Creates stub edges for all the intersections in this
        /// Edge (if any) and inserts them into the graph.
        /// </summary>
        /// <param name="edge"></param>
        /// <param name="l"></param>
        public virtual void ComputeEdgeEnds(Edge edge, IList l)
        {
            EdgeIntersectionList eiList = edge.EdgeIntersectionList;

            // ensure that the list has entries for the first and last point of the edge
            eiList.AddEndpoints();

            IEnumerator      it     = eiList.GetEnumerator();
            EdgeIntersection eiCurr = null;

            // no intersections, so there is nothing to do
            if (!it.MoveNext())
            {
                return;
            }
            EdgeIntersection eiNext = (EdgeIntersection)it.Current;

            do
            {
                EdgeIntersection eiPrev = eiCurr;
                eiCurr = eiNext;
                eiNext = null;

                if (it.MoveNext())
                {
                    eiNext = (EdgeIntersection)it.Current;
                }

                if (eiCurr != null)
                {
                    CreateEdgeEndForPrev(edge, l, eiCurr, eiPrev);
                    CreateEdgeEndForNext(edge, l, eiCurr, eiNext);
                }
            }while (eiCurr != null);
        }
示例#2
0
        }         // public ArrayList ComputeEdgeEnds( ArrayList edges )

        /// <summary>
        /// Creates stub edges for all the intersections in this Edge (if any) and inserts them into the graph.
        /// </summary>
        /// <param name="edge"></param>
        /// <param name="list"></param>
        public void ComputeEdgeEnds(Edge edge, ArrayList list)
        {
            EdgeIntersectionList eiList = edge.EdgeIntersectionList;

            //Trace.WriteLine( eiList.ToString() );

            // ensure that the list has entries for the first and last point of the edge
            if (!edge.IsClosed)
            {
                eiList.AddEndpoints();
            }

            EdgeIntersection eiPrev = null;
            EdgeIntersection eiCurr = null;

            // no intersections, so there is nothing to do
            if (eiList.IsEmpty())
            {
                return;                                         // return if the list is empty
            }
            int index = 0;                                      // index of eiList array.
            EdgeIntersection eiNext = eiList[index];            // gets the first intersection

            do
            {
                index++;
                eiPrev = eiCurr;                                // previouse one or null for first loop
                eiCurr = eiNext;                                // current one or the first one
                eiNext = null;
                if (index < eiList.Count)
                {
                    eiNext = eiList[index];                                             // if there are more
                }
                if (eiCurr != null)
                {
                    CreateEdgeEndForPrev(edge, list, eiCurr, eiPrev);
                    CreateEdgeEndForNext(edge, list, eiCurr, eiNext);
                }
            } while (eiCurr != null);
        }         // public void ComputeEdgeEnds( Edge edge, ArrayList l )