示例#1
0
        /// <inheritdoc />
        protected override ILayoutAlgorithm CreateConfiguredLayout(GraphControl graphControl)
        {
            var router = new ChannelEdgeRouter();

            var orthogonalPatternEdgeRouter = new OrthogonalPatternEdgeRouter();

            orthogonalPatternEdgeRouter.AffectedEdgesDpKey = ChannelEdgeRouter.AffectedEdgesDpKey;
            orthogonalPatternEdgeRouter.MinimumDistance    = MinimumDistanceItem;
            orthogonalPatternEdgeRouter.GridRouting        = ActivateGridRoutingItem;
            orthogonalPatternEdgeRouter.GridSpacing        = GridSpacingItem;

            orthogonalPatternEdgeRouter.BendCost         = BendCostItem;
            orthogonalPatternEdgeRouter.EdgeCrossingCost = EdgeCrossingCostItem;
            orthogonalPatternEdgeRouter.NodeCrossingCost = NodeCrossingCostItem;

            // disable edge overlap costs when Edge distribution will run afterwards anyway
            orthogonalPatternEdgeRouter.EdgeOverlapCost = 0;

            router.PathFinderStrategy = orthogonalPatternEdgeRouter;

            var segmentDistributionStage = new OrthogonalSegmentDistributionStage();

            segmentDistributionStage.AffectedEdgesDpKey = ChannelEdgeRouter.AffectedEdgesDpKey;
            segmentDistributionStage.PreferredDistance  = MinimumDistanceItem;
            segmentDistributionStage.GridRouting        = ActivateGridRoutingItem;
            segmentDistributionStage.GridSpacing        = GridSpacingItem;

            router.EdgeDistributionStrategy = segmentDistributionStage;

            return(router);
        }
        ///<inheritdoc/>
        protected override void ConfigureLayout()
        {
            OptionGroup                 layoutGroup = (OptionGroup)Handler.GetGroupByName(TOP_LEVEL).GetGroupByName(LAYOUT_OPTIONS);
            OptionGroup                 costGroup   = (OptionGroup)Handler.GetGroupByName(TOP_LEVEL).GetGroupByName(COST);
            ILayoutAlgorithm            pathFinder;
            OrthogonalPatternEdgeRouter orthogonalPatternEdgeRouter = new OrthogonalPatternEdgeRouter();

            orthogonalPatternEdgeRouter.AffectedEdgesDpKey = ChannelEdgeRouter.AffectedEdgesDpKey;
            orthogonalPatternEdgeRouter.MinimumDistance    = (double)layoutGroup[MINIMUM_DISTANCE].Value;
            orthogonalPatternEdgeRouter.GridRouting        = (bool)layoutGroup[ACTIVATE_GRID_ROUTING].Value;
            orthogonalPatternEdgeRouter.GridSpacing        = (double)layoutGroup[GRID_SPACING].Value;

            orthogonalPatternEdgeRouter.BendCost         = (double)costGroup[BEND_COST].Value;
            orthogonalPatternEdgeRouter.EdgeCrossingCost = (double)costGroup[EDGE_CROSSING_COST].Value;
            orthogonalPatternEdgeRouter.NodeCrossingCost = (double)costGroup[NODE_CROSSING_COST].Value;

            //disable edge overlap costs when Edge distribution will run afterwards anyway
            orthogonalPatternEdgeRouter.EdgeOverlapCost = 0.0;
            pathFinder = orthogonalPatternEdgeRouter;

            router.PathFinderStrategy = pathFinder;

            OrthogonalSegmentDistributionStage segmentDistributionStage = new OrthogonalSegmentDistributionStage();

            segmentDistributionStage.AffectedEdgesDpKey = ChannelEdgeRouter.AffectedEdgesDpKey;
            segmentDistributionStage.PreferredDistance  = (double)layoutGroup[MINIMUM_DISTANCE].Value;
            segmentDistributionStage.GridRouting        = (bool)layoutGroup[ACTIVATE_GRID_ROUTING].Value;
            segmentDistributionStage.GridSpacing        = (double)layoutGroup[GRID_SPACING].Value;

            router.EdgeDistributionStrategy = segmentDistributionStage;

            LayoutAlgorithm = router;
        }