///<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 EdgeRouter(); router.Scope = ScopeItem; router.MinimumNodeToEdgeDistance = MinimumNodeToEdgeDistanceItem; if (GridEnabledItem) { router.Grid = new Grid(0, 0, GridSpacingItem); } else { router.Grid = null; } router.ConsiderNodeLabels = ConsiderNodeLabelsItem; router.ConsiderEdgeLabels = ConsiderEdgeLabelsItem; router.Rerouting = EnableReroutingItem; // Note that CreateConfiguredLayoutData replaces the settings on the DefaultEdgeLayoutDescriptor // by providing a custom one for each edge. router.DefaultEdgeLayoutDescriptor.RoutingStyle = EdgeRoutingStyleItem; router.DefaultEdgeLayoutDescriptor.PreferredOctilinearSegmentLength = PreferredOctilinearSegmentLengthItem; router.DefaultEdgeLayoutDescriptor.MaximumOctilinearSegmentRatio = MaximumOctilinearSegmentRatioItem; router.DefaultEdgeLayoutDescriptor.SourceCurveConnectionStyle = SourceConnectionStyleItem; router.DefaultEdgeLayoutDescriptor.TargetCurveConnectionStyle = TargetConnectionStyleItem; router.MaximumDuration = MaximumDurationItem * 1000; var layout = new SequentialLayout(); layout.AppendLayout(router); if (EdgeLabelingItem == EnumEdgeLabeling.None) { router.IntegratedEdgeLabeling = false; } else if (EdgeLabelingItem == EnumEdgeLabeling.Integrated) { router.IntegratedEdgeLabeling = true; } else if (EdgeLabelingItem == EnumEdgeLabeling.Generic) { var genericLabeling = new GenericLabeling(); genericLabeling.PlaceEdgeLabels = true; genericLabeling.PlaceNodeLabels = false; genericLabeling.ReduceAmbiguity = ReduceAmbiguityItem; layout.AppendLayout(genericLabeling); } AddPreferredPlacementDescriptor(graphControl.Graph, LabelPlacementAlongEdgeItem, LabelPlacementSideOfEdgeItem, LabelPlacementOrientationItem, LabelPlacementDistanceItem); return(layout); }
/// <summary> /// Creates a layout algorithm suiting the <paramref name="resizeState"/>. /// </summary> /// <param name="resizeState">The current state of the gesture</param> /// <returns>A layout algorithm suiting the <paramref name="resizeState"/>.</returns> private ILayoutAlgorithm CreateLayout(ResizeState resizeState) { var sequentialLayout = new SequentialLayout(); if (resizeState == ResizeState.Shrinking) { // fill the free space of the shrunken node fillLayout = new FillAreaLayout { ComponentAssignmentStrategy = ComponentAssignmentStrategy.Single }; sequentialLayout.AppendLayout(fillLayout); if (this.state == GestureState.Finishing) { // only route edges for the final layout sequentialLayout.AppendLayout(new EdgeRouter { Scope = Scope.RouteEdgesAtAffectedNodes }); } } else { if (resizeState == ResizeState.Both) { // fill the free space of the resized node fillLayout = new FillAreaLayout { ComponentAssignmentStrategy = ComponentAssignmentStrategy.Single }; sequentialLayout.AppendLayout(fillLayout); } // clear the space of the moved/enlarged node sequentialLayout.AppendLayout(new ClearAreaLayout { ComponentAssignmentStrategy = ComponentAssignmentStrategy.Single, ClearAreaStrategy = ClearAreaStrategy.Local, ConsiderEdges = true }); } return(new GivenCoordinatesStage(sequentialLayout)); }
/// <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); }
static extern void SomeMethodTakingSequentialLayout(SequentialLayout _class);