internal BundleRouter(GeometryGraph geometryGraph, SdShortestPath shortestPathRouter,
                              VisibilityGraph visibilityGraph, BundlingSettings bundlingSettings, double loosePadding, RectangleNode<Polyline> tightHierarchy,
                              RectangleNode<Polyline> looseHierarchy,
                              Dictionary<EdgeGeometry, Set<Polyline>> edgeLooseEnterable, Dictionary<EdgeGeometry, Set<Polyline>> edgeTightEnterable, Func<Port, Polyline> loosePolylineOfPort) {
            ValidateArg.IsNotNull(geometryGraph, "geometryGraph");
            ValidateArg.IsNotNull(bundlingSettings, "bundlingSettings");

            this.geometryGraph = geometryGraph;
            this.bundlingSettings = bundlingSettings;
            regularEdges = geometryGraph.Edges.Where(e => e.Source != e.Target).ToArray();
            VisibilityGraph = visibilityGraph;
            this.shortestPathRouter = shortestPathRouter;
            LoosePadding = loosePadding;
            LooseHierarchy = looseHierarchy;
            TightHierarchy = tightHierarchy;
            EdgeLooseEnterable = edgeLooseEnterable;
            EdgeTightEnterable = edgeTightEnterable;
            this.loosePolylineOfPort = loosePolylineOfPort;
        }
示例#2
0
        internal BundleRouter(GeometryGraph geometryGraph, SdShortestPath shortestPathRouter,
                              VisibilityGraph visibilityGraph, BundlingSettings bundlingSettings, double loosePadding, RectangleNode <Polyline> tightHierarchy,
                              RectangleNode <Polyline> looseHierarchy,
                              Dictionary <EdgeGeometry, Set <Polyline> > edgeLooseEnterable, Dictionary <EdgeGeometry, Set <Polyline> > edgeTightEnterable, Func <Port, Polyline> loosePolylineOfPort)
        {
            ValidateArg.IsNotNull(geometryGraph, "geometryGraph");
            ValidateArg.IsNotNull(bundlingSettings, "bundlingSettings");

            this.geometryGraph       = geometryGraph;
            this.bundlingSettings    = bundlingSettings;
            regularEdges             = geometryGraph.Edges.Where(e => e.Source != e.Target).ToArray();
            VisibilityGraph          = visibilityGraph;
            this.shortestPathRouter  = shortestPathRouter;
            LoosePadding             = loosePadding;
            LooseHierarchy           = looseHierarchy;
            TightHierarchy           = tightHierarchy;
            EdgeLooseEnterable       = edgeLooseEnterable;
            EdgeTightEnterable       = edgeTightEnterable;
            this.loosePolylineOfPort = loosePolylineOfPort;
        }
        double SavedCapacityPenaltyOnCdtEdge(CdtEdge cdtEdge, EdgeGeometry edgeGeometry)
        {
            if (cdtEdge.ResidualCapacity > 0)
            {
                return(0);
            }

            double savedDelta;
            double width = edgeGeometry.LineWidth;

            if (cdtEdge.ResidualCapacity == cdtEdge.Capacity - width)
            {
                savedDelta = width;
            }
            else
            {
                savedDelta = width + bundlingSettings.EdgeSeparation;
            }
            if (savedDelta > -cdtEdge.ResidualCapacity)
            {
                savedDelta = -cdtEdge.ResidualCapacity;
            }
            return(savedDelta * SdShortestPath.CapacityOverflowPenaltyMultiplier(bundlingSettings));
        }
        double AddedCapacityPenaltyForCdtEdge(CdtEdge cdtEdge, EdgeGeometry edgeGeometry)
        {
            double capacityOverflowMultiplier = SdShortestPath.CapacityOverflowPenaltyMultiplier(bundlingSettings);

            return(SdShortestPath.CostOfCrossingCdtEdge(capacityOverflowMultiplier, bundlingSettings, edgeGeometry, cdtEdge));
        }
        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();
        }