示例#1
0
        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);
            }
        }
示例#2
0
        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;
        }
示例#4
0
        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);
        }
示例#5
0
 internal void AddGraph(PreGraph a)
 {
     edgeGeometries.AddRange(a.edgeGeometries);
     nodeBoundaries += a.nodeBoundaries;
     boundingBox.Add(a.boundingBox);
 }
 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);
 }