Example #1
0
 private void createRouter()
 {
     if (router != null)
     {
         return;
     }
     router = new BusRouter();
 }
        /// <summary>
        /// Setup default values for various configuration parameters.
        /// </summary>
        public BusEdgeRouterConfig()
        {
            var router = new BusRouter();

            ScopeItem                  = EnumScope.All;
            BusesItem                  = EnumBuses.Label;
            GridEnabledItem            = router.GridRouting;
            GridSpacingItem            = router.GridSpacing;
            MinimumDistanceToNodesItem = router.MinimumDistanceToNode;
            MinimumDistanceToEdgesItem = router.MinimumDistanceToEdge;

            PreferredBackboneSegmentCountItem = 1;
            MinimumBackboneSegmentLengthItem  = router.MinimumBackboneSegmentLength;

            CrossingCostItem               = router.CrossingCost;
            CrossingReroutingItem          = router.Rerouting;
            MinimumBusConnectionsCountItem = 6;
        }
        /// <inheritdoc />
        protected override ILayoutAlgorithm CreateConfiguredLayout(GraphControl graphControl)
        {
            var router = new BusRouter();

            switch (ScopeItem)
            {
            case EnumScope.All:
                router.Scope = Scope.RouteAllEdges;
                break;

            case EnumScope.Partial:
            case EnumScope.Subset:
            case EnumScope.SubsetBus:
                router.Scope = Scope.RouteAffectedEdges;
                break;

            default:
                router.Scope = Scope.RouteAllEdges;
                break;
            }
            router.GridRouting                   = GridEnabledItem;
            router.GridSpacing                   = GridSpacingItem;
            router.MinimumDistanceToNode         = MinimumDistanceToNodesItem;
            router.MinimumDistanceToEdge         = MinimumDistanceToEdgesItem;
            router.PreferredBackboneSegmentCount = PreferredBackboneSegmentCountItem;
            router.MinimumBackboneSegmentLength  = MinimumBackboneSegmentLengthItem;
            router.MinimumBusConnectionsCount    = MinimumBusConnectionsCountItem;
            router.CrossingCost                  = CrossingCostItem;
            router.Rerouting = CrossingReroutingItem;

            if (ScopeItem == EnumScope.Partial)
            {
                return(new HideNonOrthogonalEdgesStage(router));
            }

            return(router);
        }