/// <inheritdoc /> protected override ILayoutAlgorithm CreateConfiguredLayout(GraphControl graphControl) { var layout = new OrthogonalLayout(); if (GroupLayoutPolicyItem == EnumGroupPolicy.FixGroups) { var fgl = new FixGroupLayoutStage { InterEdgeRoutingStyle = InterEdgeRoutingStyle.Orthogonal }; layout.PrependStage(fgl); } else if (GroupLayoutPolicyItem == EnumGroupPolicy.IgnoreGroups) { layout.HideGroupsStageEnabled = true; } layout.LayoutStyle = StyleItem; layout.GridSpacing = GridSpacingItem; layout.EdgeLengthReduction = EdgeLengthReductionItem; layout.OptimizePerceivedBends = PerceivedBendsPostprocessingItem; layout.UniformPortAssignment = UniformPortAssignmentItem; layout.CrossingReduction = CrossingReductionItem; layout.Randomization = UseRandomizationItem; layout.FaceMaximization = UseFaceMaximizationItem; layout.FromSketchMode = UseExistingDrawingAsSketchItem; layout.EdgeLayoutDescriptor.MinimumFirstSegmentLength = MinimumFirstSegmentLengthItem; layout.EdgeLayoutDescriptor.MinimumLastSegmentLength = MinimumLastSegmentLengthItem; layout.EdgeLayoutDescriptor.MinimumSegmentLength = MinimumSegmentLengthItem; //set edge labeling options var normalStyle = layout.LayoutStyle == LayoutStyle.Normal; layout.IntegratedEdgeLabeling = EdgeLabelingItem == EnumEdgeLabeling.Integrated && normalStyle; layout.ConsiderNodeLabels = ConsiderNodeLabelsItem && normalStyle; if (EdgeLabelingItem == EnumEdgeLabeling.Generic || (EdgeLabelingItem == EnumEdgeLabeling.Integrated && normalStyle)) { layout.LabelingEnabled = true; if (EdgeLabelingItem == EnumEdgeLabeling.Generic) { ((GenericLabeling)layout.Labeling).ReduceAmbiguity = ReduceAmbiguityItem; } } else if (!ConsiderNodeLabelsItem || !normalStyle) { layout.LabelingEnabled = false; } layout.ChainStyle = ChainSubstructureStyleItem; layout.ChainSize = ChainSubstructureSizeItem; layout.CycleStyle = CycleSubstructureStyleItem; layout.CycleSize = CycleSubstructureSizeItem; layout.TreeStyle = TreeSubstructureStyleItem; layout.TreeSize = TreeSubstructureSizeItem; layout.TreeOrientation = TreeSubstructureOrientationItem; return(layout); }
///<inheritdoc/> protected override void PerformPreLayout() { String selGroupPolicy = (String)Handler.GetValue(GROUPING, GROUP_LAYOUT_POLICY); String edgeLabelingName = (String)Handler.GetValue(LABELING, EDGE_LABELING); MultiStageLayout multiStageLayout = LayoutAlgorithm as MultiStageLayout; IDataProvider upwardDP = null; if ((upwardDP = CurrentLayoutGraph.GetDataProvider(OrthogonalLayout.DirectedEdgeDpKey)) == null) { //determine upward edges if not already marked. if ((bool)Handler.GetValue(EDGES, DRAW_SELECTED_EDGES_UPWARDS)) { CurrentLayoutGraph.AddDataProvider(OrthogonalLayout.DirectedEdgeDpKey, upwardDP = new UpwardEdgeDP(this)); } } // if ((bool)Handler.GetValue(EDGES, UPWARD_EDGE_BUS_ROUTING) && upwardDP != null) { // sgDPOrig = CurrentLayoutGraph.GetDataProvider(PortConstraintKeys.SourceGroupIdDpKey); // tgDPOrig = CurrentLayoutGraph.GetDataProvider(PortConstraintKeys.TargetGroupIdDpKey); // sourceGroupMap = CurrentLayoutGraph.CreateEdgeMap(); // tgMap = CurrentLayoutGraph.CreateEdgeMap(); // CurrentLayoutGraph.AddDataProvider(PortConstraintKeys.SourceGroupIdDpKey, sourceGroupMap); // CurrentLayoutGraph.AddDataProvider(PortConstraintKeys.TargetGroupIdDpKey, tgMap); // AutoGroupEdges(CurrentLayoutGraph, sourceGroupMap, tgMap, upwardDP); // } if ((selGroupPolicy != IGNORE_GROUPS) && ContainsGroupNodes()) { multiStageLayout.HideGroupsStageEnabled = false; if (FIX_GROUPS == selGroupPolicy) { var fgl = new FixGroupLayoutStage(); fgl.InterEdgeRoutingStyle = InterEdgeRoutingStyle.Orthogonal; if (multiStageLayout != null) { multiStageLayout.PrependStage(fgl); preStage = fgl; } } } else { multiStageLayout.HideGroupsStageEnabled = true; } if (edgeLabelingName == GENERIC && multiStageLayout != null) { var la = new GenericLabeling(); la.MaximumDuration = 0; la.PlaceNodeLabels = false; la.PlaceEdgeLabels = true; la.AutoFlipping = true; la.ProfitModel = new SimpleProfitModel(); multiStageLayout.Labeling = la; } }