/// <summary> /// Completes the building of the input subgraphs by depth-labelling them, /// and adds them to the PolygonBuilder. /// </summary> /// <remarks> /// The subgraph list must be sorted in rightmost-coordinate order. /// </remarks> /// <param name="subgraphList"> the subgraphs to build</param> /// <param name="polyBuilder"> the PolygonBuilder which will build the final polygons</param> private static void BuildSubgraphs(IEnumerable <BufferSubgraph> subgraphList, PolygonBuilder polyBuilder) { var processedGraphs = new List <BufferSubgraph>(); foreach (var subgraph in subgraphList) { Coordinate p = subgraph.RightMostCoordinate; // int outsideDepth = 0; // if (polyBuilder.containsPoint(p)) // outsideDepth = 1; var locater = new SubgraphDepthLocater(processedGraphs); int outsideDepth = locater.GetDepth(p); // try { subgraph.ComputeDepth(outsideDepth); // } // catch (RuntimeException ex) { // // debugging only // //subgraph.saveDirEdges(); // throw ex; // } subgraph.FindResultEdges(); processedGraphs.Add(subgraph); polyBuilder.Add(new List <EdgeEnd>( Utilities.Caster.Upcast <DirectedEdge, EdgeEnd>(subgraph.DirectedEdges)), subgraph.Nodes); } }
private void checkContract( SubgraphDepthLocater.DepthSegment ds0, SubgraphDepthLocater.DepthSegment ds1) { // should never have ds1 < ds2 && ds2 < ds1 int cmp0 = ds0.CompareTo(ds1); int cmp1 = ds1.CompareTo(ds0); var isFail = cmp0 != 0 && cmp0 == cmp1; Assert.IsTrue(!isFail); }
/// <summary> /// Completes the building of the input subgraphs by depth-labelling them, /// and adds them to the PolygonBuilder. /// </summary> /// <remarks> /// The subgraph list must be sorted in rightmost-coordinate order. /// </remarks> /// <param name="subgraphList"> the subgraphs to build</param> /// <param name="polyBuilder"> the PolygonBuilder which will build the final polygons</param> private static void BuildSubgraphs(IEnumerable<BufferSubgraph> subgraphList, PolygonBuilder polyBuilder) { var processedGraphs = new List<BufferSubgraph>(); foreach (var subgraph in subgraphList) { Coordinate p = subgraph.RightMostCoordinate; // int outsideDepth = 0; // if (polyBuilder.containsPoint(p)) // outsideDepth = 1; var locater = new SubgraphDepthLocater(processedGraphs); int outsideDepth = locater.GetDepth(p); // try { subgraph.ComputeDepth(outsideDepth); // } // catch (RuntimeException ex) { // // debugging only // //subgraph.saveDirEdges(); // throw ex; // } subgraph.FindResultEdges(); processedGraphs.Add(subgraph); polyBuilder.Add(new List<EdgeEnd>( Utilities.Caster.Upcast<DirectedEdge, EdgeEnd>(subgraph.DirectedEdges)), subgraph.Nodes); } }