internal MetroGraphData(EdgeGeometry[] regularEdges,
                                RectangleNode <Polyline> looseTree, RectangleNode <Polyline> tightTree,
                                BundlingSettings bundlingSettings, Cdt cdt,
                                Dictionary <EdgeGeometry, Set <Polyline> > edgeLooseEnterable, Dictionary <EdgeGeometry, Set <Polyline> > edgeTightEnterable, Func <Port, Polyline> loosePolylineOfPort)
        {
            //Debug.Assert(cdt != null);
            this.regularEdges = regularEdges;
            if (cdt != null)
            {
                Cdt = cdt;
            }
            else
            {
                Cdt = BundleRouter.CreateConstrainedDelaunayTriangulation(looseTree);
            }

            EdgeLooseEnterable  = edgeLooseEnterable;
            EdgeTightEnterable  = edgeTightEnterable;
            LoosePolylineOfPort = loosePolylineOfPort;

            looseIntersections = new Intersections(this, bundlingSettings, looseTree, station => station.EnterableLoosePolylines);
            tightIntersections = new Intersections(this, bundlingSettings, tightTree, station => station.EnterableTightPolylines);
            cdtIntersections   = new CdtIntersections(this, bundlingSettings);

            Initialize(false);
        }
        internal void Run() {
            foreach (GeometryGraph graph in GetGeometryGraphs()) {
                var br = new BundleRouter(graph, new SdShortestPath(transparentShapeSetter, null, null),
                    interactiveEdgeRouter.VisibilityGraph, bundlingSettings, interactiveEdgeRouter.LoosePadding, interactiveEdgeRouter.TightHierarchy,
                    interactiveEdgeRouter.LooseHierarchy, null, null, null);

                br.Run();
            }
        }
        void RouteBundles() {
            ScaleLooseShapesDown();

            CalculateEdgeEnterablePolylines();
            var looseHierarchy = GetLooseHierarchy();
            var cdt = BundleRouter.CreateConstrainedDelaunayTriangulation(looseHierarchy);
            // CdtSweeper.ShowFront(cdt.GetTriangles(), null, null,this.visGraph.Edges.Select(e=>new LineSegment(e.SourcePoint,e.TargetPoint)));

            var shortestPath = new SdShortestPath(MakeTransparentShapesOfEdgeGeometryAndGetTheShapes, cdt, FindCdtGates(cdt));
            var bundleRouter = new BundleRouter(geometryGraph, shortestPath, visGraph, BundlingSettings,
                                                         LoosePadding, GetTightHierarchy(),
                                                         looseHierarchy, enterableLoose, enterableTight,
                                                         port=>LoosePolyOfOriginalShape(portsToShapes[port]));

            bundleRouter.Run();
        }