/// <summary> /// /// </summary> /// <param name="de"></param> public virtual void ComputeDepths(DirectedEdge de) { int edgeIndex = FindIndex(de); int startDepth = de.GetDepth(Positions.Left); int targetLastDepth = de.GetDepth(Positions.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 TopologyException("depth mismatch at " + de.Coordinate); } }
/// <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]; nextDe.SetEdgeDepths(Positions.Right, currDepth); currDepth = nextDe.GetDepth(Positions.Left); } return(currDepth); }