예제 #1
0
        public void ComputeDepths(DirectedEdge de)
        {
            int edgeIndex = FindIndex(de);
//            Label label = de.Label;
            int startDepth      = de.GetDepth(Position.Left);
            int targetLastDepth = de.GetDepth(Position.Right);

            // compute the depths from this edge up to the end of the edge array
            int nextDepth = ComputeDepths(edgeIndex + 1, edgeList.Count, startDepth);

            // compute the depths for the initial part of the array
            int lastDepth = ComputeDepths(0, edgeIndex, nextDepth);

            if (lastDepth != targetLastDepth)
            {
                throw new GeometryException("depth mismatch at " + de.Coordinate);
            }
        }
예제 #2
0
        /// <summary>
        /// Compute the DirectedEdge depths for a subsequence of the edge array.
        /// </summary>
        /// <returns>
        /// The last depth assigned (from the R side of the last edge visited)
        /// </returns>
        private int ComputeDepths(int startIndex, int endIndex, int startDepth)
        {
            int currDepth = startDepth;

            for (int i = startIndex; i < endIndex; i++)
            {
                DirectedEdge nextDe = (DirectedEdge)edgeList[i];
//                Label label = nextDe.Label;
                nextDe.SetEdgeDepths(Position.Right, currDepth);
                currDepth = nextDe.GetDepth(Position.Left);
            }

            return(currDepth);
        }