void UniteConnectedPreGraphs(ref List <PreGraph> preGraphs) { BasicGraph <IntPair> intersectionGraph = GetIntersectionGraphOfPreGraphs(preGraphs); if (intersectionGraph == null) { return; } var connectedComponents = ConnectedComponentCalculator <IntPair> .GetComponents(intersectionGraph); var newPreGraphList = new List <PreGraph>(); foreach (var component in connectedComponents) { PreGraph preGraph = null; foreach (var i in component) { if (preGraph == null) { preGraph = preGraphs[i]; newPreGraphList.Add(preGraph); } else { preGraph.AddGraph(preGraphs[i]); } } } preGraphs = newPreGraphList; foreach (var pg in preGraphs) { AddIntersectingNodes(pg); } }
private void AddIntersectingNodes(PreGraph pg) { var rect = pg.boundingBox; foreach (var curve in nodeTree.GetNodeItemsIntersectingRectangle(rect)) { pg.AddNodeBoundary(curve); } }
GeometryGraph CreateGeometryGraph(PreGraph preGraph) { var graph = new GeometryGraph(); var nodeDictionary = new Dictionary<ICurve, Node>(); foreach (var curve in preGraph.nodeBoundaries) { var node = new Node(curve); nodeDictionary[curve] = node; graph.Nodes.Add(node); } foreach (var eg in preGraph.edgeGeometries) AddEdgeGeometryToGraph(eg, graph, nodeDictionary); return graph; }
GeometryGraph CreateGeometryGraph(PreGraph preGraph) { var graph = new GeometryGraph(); var nodeDictionary = new Dictionary <ICurve, Node>(); foreach (var curve in preGraph.nodeBoundaries) { var node = new Node(curve); nodeDictionary[curve] = node; graph.Nodes.Add(node); } foreach (var eg in preGraph.edgeGeometries) { AddEdgeGeometryToGraph(eg, graph, nodeDictionary); } return(graph); }
internal void AddGraph(PreGraph a) { edgeGeometries.AddRange(a.edgeGeometries); nodeBoundaries += a.nodeBoundaries; boundingBox.Add(a.boundingBox); }
private void AddIntersectingNodes(PreGraph pg) { var rect = pg.boundingBox; foreach (var curve in nodeTree.GetNodeItemsIntersectingRectangle(rect)) pg.AddNodeBoundary(curve); }