Class HierarchicDiagramLayouter
- java.lang.Object
-
- com.nomagic.magicdraw.uml.symbols.layout.AbstractDiagramLayouter
-
- com.nomagic.magicdraw.uml.symbols.layout.HierarchicDiagramLayouter
-
- All Implemented Interfaces:
DiagramLayouter
,java.lang.Cloneable
- Direct Known Subclasses:
ActivityDiagramLayouter
,CompositeStructureDiagramLayouter
,GridDiagramLayouter
,StateDiagramLayouter
@OpenApi public class HierarchicDiagramLayouter extends AbstractDiagramLayouter
Hierarchic layouter.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Collection<com.nomagic.magicdraw.uml.symbols.layout.PathRerouteCollector>
pathRerouteCollectors
-
Constructor Summary
Constructors Constructor Description HierarchicDiagramLayouter()
Construct HierarchicDiagramLayouterHierarchicDiagramLayouter(java.lang.String optionId)
Construct HierarchicDiagramLayouter
-
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)
HierarchicDiagramLayouter
clone()
private static java.util.List<y.base.Edge>
collectNonDirectedEdges(UMLGraph graph)
private static void
collectOnEdgeElementsRecursively(java.util.Collection<ShapeElement> collectTo, ShapeElement collectFrom)
protected y.layout.ComponentLayouter
createComponentLayouter(UMLGraph graph, y.layout.grouping.RecursiveGroupLayouter coreLayouter, HierarchicLayouterOptionsGroup opt)
Creates a component layouter if possible.protected void
fixOnFrameElements(UMLGraph graph, DiagramPresentationElement dpe, HierarchicLayouterOptionsGroup o)
Fixes, moves, sorts overlapping shapes on diagram frame.java.util.Collection<com.nomagic.magicdraw.uml.symbols.layout.PathRerouteCollector>
getPathRerouteCollectors()
protected y.layout.hierarchic.IncrementalHierarchicLayouter
initDefaultHierarchicSettings(HierarchicLayouterOptionsGroup opt, UMLGraph graph)
Initializes hierarchic layouter settings: - Enables backlooping - Sets group compaction enabled - Aligns groups in center - Sets routing style to orthogonal - Adds group node insets - Enables label layout - Sets the node sequence within layer.private static void
initUndirectedEdges(UMLGraph graph)
Initializes non direct edges.private static boolean
isLayoutAsGrid(UMLGraph graph)
Checks if the graph should be layouted as gridprotected boolean
layout(AbstractDiagramLayouterOptionsGroup opt, DiagramPresentationElement dpe, UMLGraph graph)
Layouts a diagramprivate void
moveOutOfFrameHeader(DiagramPresentationElement diagram, HierarchicLayouterOptionsGroup o)
Moves elements of of the diagram frame header view, so that they would not overlapprivate void
moveOverlappingPorts(java.util.List<PresentationElement> elementsOnFrameEdge)
private static void
moveShapeBy(int moveBy, PresentationElement oneShape)
Moves shape by X coordinate, by provided moveByprotected void
preProcessing(AbstractDiagramLayouterOptionsGroup options, DiagramPresentationElement dpe, com.nomagic.magicdraw.commands.MacroCommand mc)
void
registerPathRerouteCollector(com.nomagic.magicdraw.uml.symbols.layout.PathRerouteCollector collector)
protected void
resizeOnEdgeElements(UMLGraph graph, AbstractDiagramLayouterOptionsGroup options)
Resizes elements on edge to the minimal size.protected void
routeNonRoutedPaths(UMLGraph graph, DiagramPresentationElement dpe, AbstractDiagramLayouterOptionsGroup options, com.nomagic.magicdraw.commands.MacroCommand mc, java.util.Collection<com.nomagic.magicdraw.uml.symbols.layout.PathRerouteCollector> rerouteCollectors)
protected void
runIHLLayoutSeries(y.layout.hierarchic.IncrementalHierarchicLayouter ihl, UMLGraph graph, HierarchicLayouterOptionsGroup options)
protected y.layout.Layouter
wrapToAccordingGroupLayouter(UMLGraph graph, y.layout.hierarchic.IncrementalHierarchicLayouter layouter, HierarchicLayouterOptionsGroup opt, boolean fromSketch)
-
Methods inherited from class com.nomagic.magicdraw.uml.symbols.layout.AbstractDiagramLayouter
canLayout, clearOldRectangles, containsSelectedFromTheSameParent, createCommands, createGraph, createGraph, createLayoutParameters, drawLayoutResults, getAnchoredPresentationElement, getDiagramLayouterAbortHandler, getLayoutParameter, getMessagesFromPath, getOptionsID, getSelected, isTypeSupported, layout, needPartitionData, placeLegendAndInfo, postprocessing, resizeFrameIfNecessary, setAnchoredPresentationElement, setLabelConsiderationMode, setLayoutParameter
-
-
-
-
Constructor Detail
-
HierarchicDiagramLayouter
@OpenApi public HierarchicDiagramLayouter()
Construct HierarchicDiagramLayouter
-
HierarchicDiagramLayouter
@OpenApi public HierarchicDiagramLayouter(java.lang.String optionId)
Construct HierarchicDiagramLayouter- Parameters:
optionId
- hierarchic diagram layouter options id
-
-
Method Detail
-
initDefaultHierarchicSettings
protected y.layout.hierarchic.IncrementalHierarchicLayouter initDefaultHierarchicSettings(HierarchicLayouterOptionsGroup opt, UMLGraph graph)
Initializes hierarchic layouter settings: - Enables backlooping - Sets group compaction enabled - Aligns groups in center - Sets routing style to orthogonal - Adds group node insets - Enables label layout - Sets the node sequence within layer.- Parameters:
opt
- optionsgraph
- current graph that should be layouted
-
runIHLLayoutSeries
protected void runIHLLayoutSeries(y.layout.hierarchic.IncrementalHierarchicLayouter ihl, UMLGraph graph, HierarchicLayouterOptionsGroup options)
-
wrapToAccordingGroupLayouter
protected y.layout.Layouter wrapToAccordingGroupLayouter(UMLGraph graph, y.layout.hierarchic.IncrementalHierarchicLayouter layouter, HierarchicLayouterOptionsGroup opt, boolean fromSketch)
-
createComponentLayouter
@CheckForNull protected y.layout.ComponentLayouter createComponentLayouter(UMLGraph graph, y.layout.grouping.RecursiveGroupLayouter coreLayouter, HierarchicLayouterOptionsGroup opt)
Creates a component layouter if possible. Sub-graphs that can be identified as separate components will be processed and placed to a more convenient location. It may not be possible to create component layouter if sequencing, swimlane partitions etc. are used- Parameters:
graph
- layouted graphcoreLayouter
- the core layouter for component layouteropt
- hierarchic options- Returns:
- a component layouter if possible.
-
initUndirectedEdges
private static void initUndirectedEdges(UMLGraph graph)
Initializes non direct edges. If a data key EDGE_DIRECTEDNESS_DPKEY is registered, all of the edges must contain some value. e.g. the non directed ones should contain 0.0 while all the others 1.0(directed).- Parameters:
graph
- graph edges to init
-
collectNonDirectedEdges
private static java.util.List<y.base.Edge> collectNonDirectedEdges(UMLGraph graph)
-
isLayoutAsGrid
private static boolean isLayoutAsGrid(UMLGraph graph)
Checks if the graph should be layouted as grid- Parameters:
graph
- graph to check- Returns:
- true if should layout the graph as grid, false otherwise
-
layout
@OpenApi protected boolean layout(AbstractDiagramLayouterOptionsGroup opt, DiagramPresentationElement dpe, UMLGraph graph)
Description copied from class:AbstractDiagramLayouter
Layouts a diagram- Specified by:
layout
in classAbstractDiagramLayouter
- Parameters:
opt
- layouter optionsdpe
- diagram to layoutgraph
- a constructed graph from the diagram- Returns:
- true if it was layouted successfully , false otherwise.
-
resizeOnEdgeElements
protected void resizeOnEdgeElements(UMLGraph graph, AbstractDiagramLayouterOptionsGroup options)
Resizes elements on edge to the minimal size.- Parameters:
graph
- layouted graphoptions
- options that may be regarded while adjusting
-
collectOnEdgeElementsRecursively
private static void collectOnEdgeElementsRecursively(java.util.Collection<ShapeElement> collectTo, ShapeElement collectFrom)
-
preProcessing
protected void preProcessing(AbstractDiagramLayouterOptionsGroup options, DiagramPresentationElement dpe, @CheckForNull com.nomagic.magicdraw.commands.MacroCommand mc)
-
afterLayout
protected void afterLayout(AbstractDiagramLayouterOptionsGroup options, DiagramPresentationElement dpe, UMLGraph graph, com.nomagic.magicdraw.commands.MacroCommand mc)
-
routeNonRoutedPaths
protected void routeNonRoutedPaths(UMLGraph graph, DiagramPresentationElement dpe, @CheckForNull AbstractDiagramLayouterOptionsGroup options, com.nomagic.magicdraw.commands.MacroCommand mc, java.util.Collection<com.nomagic.magicdraw.uml.symbols.layout.PathRerouteCollector> rerouteCollectors)
-
fixOnFrameElements
protected void fixOnFrameElements(UMLGraph graph, DiagramPresentationElement dpe, HierarchicLayouterOptionsGroup o)
Fixes, moves, sorts overlapping shapes on diagram frame.- Parameters:
graph
- the graph that is layouteddpe
- diagramo
- options group
-
moveOutOfFrameHeader
private void moveOutOfFrameHeader(DiagramPresentationElement diagram, HierarchicLayouterOptionsGroup o)
Moves elements of of the diagram frame header view, so that they would not overlap- Parameters:
diagram
- the diagram
-
moveOverlappingPorts
private void moveOverlappingPorts(java.util.List<PresentationElement> elementsOnFrameEdge)
-
moveShapeBy
private static void moveShapeBy(int moveBy, PresentationElement oneShape)
Moves shape by X coordinate, by provided moveBy- Parameters:
moveBy
- move element deltaoneShape
- the shape to move
-
registerPathRerouteCollector
public final void registerPathRerouteCollector(com.nomagic.magicdraw.uml.symbols.layout.PathRerouteCollector collector)
-
getPathRerouteCollectors
public java.util.Collection<com.nomagic.magicdraw.uml.symbols.layout.PathRerouteCollector> getPathRerouteCollectors()
-
clone
public HierarchicDiagramLayouter clone()
-
-