///<inheritdoc/> protected override void ConfigureLayout() { OptionGroup layoutGroup = (OptionGroup)Handler.GetGroupByName(LAYOUT_OPTIONS); router.MinimumDistance = (int)layoutGroup[MINIMAL_NODE_DISTANCE].Value; router.KeepExistingBends = (bool)layoutGroup[USE_BENDS].Value; router.RouteAllEdges = (bool)layoutGroup[ROUTE_ONLY_NECESSARY].Value; SequentialLayout sl = new SequentialLayout(); if ((bool)layoutGroup[ALLOW_MOVING_NODES].Value) { //if we are allowed to move nodes, we can improve the routing results by temporarily enlarging nodes and removing overlaps //(this strategy ensures that there is enough space for the edges) CompositeLayoutStage cls = new CompositeLayoutStage(); cls.AppendStage(router.CreateNodeEnlargementStage()); cls.AppendStage(new RemoveOverlapsStage(0)); sl.AppendLayout(cls); } if (router.KeepExistingBends) { //we want to keep the original bends BendConverter bendConverter = new BendConverter(); bendConverter.AffectedEdgesDpKey = OrganicEdgeRouter.AffectedEdgesDpKey; bendConverter.AdoptAffectedEdges = (bool)layoutGroup[SELECTION_ONLY].Value; bendConverter.CoreLayout = router; sl.AppendLayout(bendConverter); } else { sl.AppendLayout(router); } LayoutAlgorithm = new HideGroupsStage(sl); }
/// <inheritdoc /> protected override ILayoutAlgorithm CreateConfiguredLayout(GraphControl graphControl) { var router = new OrganicEdgeRouter(); router.MinimumDistance = MinimumNodeDistanceItem; router.KeepExistingBends = KeepExistingBendsItem; router.RouteAllEdges = !RouteOnlyNecessaryItem; var layout = new SequentialLayout(); if (AllowMovingNodesItem) { //if we are allowed to move nodes, we can improve the routing results by temporarily enlarging nodes and removing overlaps //(this strategy ensures that there is enough space for the edges) var cls = new CompositeLayoutStage(); cls.AppendStage(router.CreateNodeEnlargementStage()); cls.AppendStage(new RemoveOverlapsStage(0)); layout.AppendLayout(cls); } if (router.KeepExistingBends) { //we want to keep the original bends var bendConverter = new BendConverter { AffectedEdgesDpKey = OrganicEdgeRouter.AffectedEdgesDpKey, AdoptAffectedEdges = SelectionOnlyItem, CoreLayout = router }; layout.AppendLayout(bendConverter); } else { layout.AppendLayout(router); } return(layout); }