Class ActivityDiagramLayouter
- java.lang.Object
-
- com.nomagic.magicdraw.uml.symbols.layout.AbstractDiagramLayouter
-
- com.nomagic.magicdraw.uml.symbols.layout.HierarchicDiagramLayouter
-
- com.nomagic.magicdraw.uml.symbols.layout.activity.ActivityDiagramLayouter
-
- All Implemented Interfaces:
DiagramLayouter
,java.lang.Cloneable
- Direct Known Subclasses:
BusinessProcessDiagramLayouter
@OpenApi public class ActivityDiagramLayouter extends HierarchicDiagramLayouter
Automatic layouter specialized for activity diagram layouting. It is used as a default layouter for activity diagrams and diagrams, based on activity diagram.
-
-
Field Summary
Fields Modifier and Type Field Description private static int
DEFAULT_FIRST_SEGMENT_LENGTH
-
Constructor Summary
Constructors Constructor Description ActivityDiagramLayouter()
ActivityDiagramLayouter(java.lang.String optionId)
Construct ActivityDiagramLayouter
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
afterLayout(AbstractDiagramLayouterOptionsGroup options, DiagramPresentationElement dpe, UMLGraph graph, com.nomagic.magicdraw.commands.MacroCommand mc)
private static int
calculateLayerSizeByChildren(UMLGraph graph, java.lang.String orientation, int percentageToTrim)
Finds a largest pin in graph after removing extreme values.protected boolean
containsSelectedFromTheSameParent(DiagramPresentationElement dpe)
Activity layouter should also consider when nodes in swimlanes are selected and layouted.private void
createSwimlanePartitions(DiagramPresentationElement dpe, ActivityLayouterOptionsGroup options, UMLGraph graph)
Creates information about swimlane and maps it to partition grid.private static boolean
isInDifferentSwimlanes(java.lang.Iterable<PresentationElement> selectedRoots)
private static boolean
isInSameCell(java.lang.Iterable<PresentationElement> selectedRoots)
protected boolean
layout(AbstractDiagramLayouterOptionsGroup opt, DiagramPresentationElement dpe, UMLGraph graph)
Layouts a diagramprivate static void
moveElementsByFakeEdges(UMLGraph graph, java.lang.String orientation)
Moves elements like pins according to the fake edges that are connected to them.private static void
moveShapesToBeginningOfCell(UMLGraph graph, ActivityLayouterOptionsGroup options)
private static void
moveToAppropriateFrameEdge(DiagramPresentationElement dpe, UMLGraph graph, java.lang.String orientation)
Moves shapes on diagram frame to appropriate frame.protected void
preProcessing(AbstractDiagramLayouterOptionsGroup options, DiagramPresentationElement dpe, com.nomagic.magicdraw.commands.MacroCommand mc)
private void
runActivityIHLLayoutSeries(UMLGraph graph, ActivityLayouterOptionsGroup options, y.layout.hierarchic.IncrementalHierarchicLayouter layouter)
-
Methods inherited from class com.nomagic.magicdraw.uml.symbols.layout.HierarchicDiagramLayouter
clone, createComponentLayouter, fixOnFrameElements, getPathRerouteCollectors, initDefaultHierarchicSettings, registerPathRerouteCollector, resizeOnEdgeElements, routeNonRoutedPaths, runIHLLayoutSeries, wrapToAccordingGroupLayouter
-
Methods inherited from class com.nomagic.magicdraw.uml.symbols.layout.AbstractDiagramLayouter
canLayout, clearOldRectangles, createCommands, createGraph, createGraph, createLayoutParameters, drawLayoutResults, getAnchoredPresentationElement, getDiagramLayouterAbortHandler, getLayoutParameter, getMessagesFromPath, getOptionsID, getSelected, isTypeSupported, layout, needPartitionData, placeLegendAndInfo, postprocessing, resizeFrameIfNecessary, setAnchoredPresentationElement, setLabelConsiderationMode, setLayoutParameter
-
-
-
-
Field Detail
-
DEFAULT_FIRST_SEGMENT_LENGTH
private static final int DEFAULT_FIRST_SEGMENT_LENGTH
- See Also:
- Constant Field Values
-
-
Method Detail
-
layout
@OpenApi protected boolean layout(AbstractDiagramLayouterOptionsGroup opt, DiagramPresentationElement dpe, UMLGraph graph)
Description copied from class:AbstractDiagramLayouter
Layouts a diagram- Overrides:
layout
in classHierarchicDiagramLayouter
- Parameters:
opt
- layouter optionsdpe
- diagram to layoutgraph
- a constructed graph from the diagram- Returns:
- true if it was layouted successfully , false otherwise.
-
runActivityIHLLayoutSeries
private void runActivityIHLLayoutSeries(UMLGraph graph, ActivityLayouterOptionsGroup options, y.layout.hierarchic.IncrementalHierarchicLayouter layouter)
-
createSwimlanePartitions
private void createSwimlanePartitions(DiagramPresentationElement dpe, ActivityLayouterOptionsGroup options, UMLGraph graph)
Creates information about swimlane and maps it to partition grid. Does that only if all diagram is layouted and it contains swimlanes, or if a swimlane is selected- Parameters:
dpe
- diagramoptions
- layout optionsgraph
- current graph
-
moveShapesToBeginningOfCell
private static void moveShapesToBeginningOfCell(UMLGraph graph, ActivityLayouterOptionsGroup options)
-
afterLayout
protected void afterLayout(AbstractDiagramLayouterOptionsGroup options, DiagramPresentationElement dpe, UMLGraph graph, com.nomagic.magicdraw.commands.MacroCommand mc)
-
moveElementsByFakeEdges
private static void moveElementsByFakeEdges(UMLGraph graph, java.lang.String orientation)
Moves elements like pins according to the fake edges that are connected to them. Input pin is put where fake target edge connects etc.- Parameters:
graph
- the graphorientation
- orientation
-
moveToAppropriateFrameEdge
private static void moveToAppropriateFrameEdge(DiagramPresentationElement dpe, UMLGraph graph, java.lang.String orientation)
Moves shapes on diagram frame to appropriate frame. If shape has outgoing relations and orientation is set to top to bottom, then it should be placed on top and etc.- Parameters:
dpe
- diagramgraph
- layouted graphorientation
- layout orientation
-
preProcessing
protected void preProcessing(AbstractDiagramLayouterOptionsGroup options, DiagramPresentationElement dpe, com.nomagic.magicdraw.commands.MacroCommand mc)
-
calculateLayerSizeByChildren
private static int calculateLayerSizeByChildren(UMLGraph graph, java.lang.String orientation, int percentageToTrim)
Finds a largest pin in graph after removing extreme values.- Parameters:
graph
- full graphorientation
- diagram orientationpercentageToTrim
- trims the defined percentage of longest pins- Returns:
- the size of the largest pin, 0 if not found.
-
containsSelectedFromTheSameParent
protected boolean containsSelectedFromTheSameParent(DiagramPresentationElement dpe)
Activity layouter should also consider when nodes in swimlanes are selected and layouted.- Parameters:
dpe
- diagram- Returns:
- true if selected in same cell(can also have elements that are owned by whole swimlane)
-
isInDifferentSwimlanes
private static boolean isInDifferentSwimlanes(java.lang.Iterable<PresentationElement> selectedRoots)
-
isInSameCell
private static boolean isInSameCell(java.lang.Iterable<PresentationElement> selectedRoots)
-
-