Class CompositeStructureDiagramLayouter
- java.lang.Object
-
- com.nomagic.magicdraw.uml.symbols.layout.AbstractDiagramLayouter
-
- com.nomagic.magicdraw.uml.symbols.layout.HierarchicDiagramLayouter
-
- com.nomagic.magicdraw.uml.symbols.layout.composite.CompositeStructureDiagramLayouter
-
- All Implemented Interfaces:
DiagramLayouter
,java.lang.Cloneable
- Direct Known Subclasses:
ClassDiagramLayouter
@OpenApi public class CompositeStructureDiagramLayouter extends HierarchicDiagramLayouter
Specialized layouter for composite diagram. It is used as a default layouter for composite structure diagrams and diagrams based on it.
-
-
Field Summary
Fields Modifier and Type Field Description protected com.nomagic.magicdraw.uml.symbols.layout.AbstractCustomCandidates
can
-
Constructor Summary
Constructors Constructor Description CompositeStructureDiagramLayouter()
CompositeStructureDiagramLayouter(java.lang.String optionId)
Construct Composite layouter
-
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 java.util.List<com.nomagic.magicdraw.uml.symbols.layout.composite.CompositeStructureDiagramLayouter.PortPlacementData>
collectPlacementData(UMLGraph graph, java.lang.Iterable<ShapeElement> shapeElementList)
Collects the placement data by constraint maps from candidates and adds them to a placementprotected UMLGraph
createGraph(DiagramPresentationElement dpe, AbstractDiagramLayouterOptionsGroup optionsGroup)
Constructs a graph for layoutprivate static java.lang.Byte
getConstraintSide(com.nomagic.magicdraw.uml.symbols.layout.composite.CompositeStructureDiagramLayouter.PortPlacementData first)
private com.nomagic.magicdraw.uml.symbols.layout.composite.CompositeStructureDiagramLayouter.PortPlacementData
getDataByShapeOnEdge(UMLGraph graph, java.util.Collection<com.nomagic.magicdraw.uml.symbols.layout.composite.CompositeStructureDiagramLayouter.PortPlacementData> allData, ShapeElement shapeOnEdge)
private int
getPossiblePathOverlapCount(UMLGraph graph, java.util.Collection<com.nomagic.magicdraw.uml.symbols.layout.composite.CompositeStructureDiagramLayouter.PortPlacementData> placementData, com.nomagic.magicdraw.uml.symbols.layout.composite.CompositeStructureDiagramLayouter.PortPlacementData first, com.nomagic.magicdraw.uml.symbols.layout.composite.CompositeStructureDiagramLayouter.PortPlacementData second)
protected boolean
layout(AbstractDiagramLayouterOptionsGroup opt, DiagramPresentationElement dpe, UMLGraph graph)
Layouts a diagramprivate void
moveElementsByFakeEdges(UMLGraph graph, com.nomagic.magicdraw.commands.MacroCommand mc)
Moves ports by fake edges.private static void
moveElementsOnEdgeToClosest(DiagramPresentationElement dpe, UMLGraph graph, HierarchicLayouterOptionsGroup o)
Moves shapes on edges to the closest frame edge and sets it as its on edge property.private static void
moveToBottom(java.awt.Rectangle diagramFrameBounds, ShapeElement shape, java.awt.Rectangle bounds)
private static void
moveToLeft(ShapeElement shape, java.awt.Rectangle bounds)
private static void
moveToRight(java.awt.Rectangle diagramFrameBounds, ShapeElement shape, java.awt.Rectangle bounds)
private static void
moveToTop(ShapeElement shape, java.awt.Rectangle bounds)
protected void
preProcessing(AbstractDiagramLayouterOptionsGroup options, DiagramPresentationElement dpe, com.nomagic.magicdraw.commands.MacroCommand mc)
private static void
setPortLocation(java.util.Collection<com.nomagic.magicdraw.uml.symbols.layout.composite.CompositeStructureDiagramLayouter.PortPlacementData> placementData, com.nomagic.magicdraw.commands.MacroCommand mc)
private static void
sortLayoutableByNesting(UMLGraph graph, y.base.NodeMap nodeMap, java.util.List<ShapeElement> shapeElementList)
Finsd all layoutable shape elements and sorts them by nesting levelprivate void
swapsPortLocationsByCrossings(UMLGraph graph, java.util.List<com.nomagic.magicdraw.uml.symbols.layout.composite.CompositeStructureDiagramLayouter.PortPlacementData> placementData)
Swaps ports location by possible crossings.-
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, containsSelectedFromTheSameParent, createCommands, createGraph, createLayoutParameters, drawLayoutResults, getAnchoredPresentationElement, getDiagramLayouterAbortHandler, getLayoutParameter, getMessagesFromPath, getOptionsID, getSelected, isTypeSupported, layout, needPartitionData, placeLegendAndInfo, postprocessing, resizeFrameIfNecessary, setAnchoredPresentationElement, setLabelConsiderationMode, setLayoutParameter
-
-
-
-
Constructor Detail
-
CompositeStructureDiagramLayouter
@OpenApi public CompositeStructureDiagramLayouter()
-
CompositeStructureDiagramLayouter
@OpenApi public CompositeStructureDiagramLayouter(java.lang.String optionId)
Construct Composite layouter- Parameters:
optionId
- activity diagram layouter options id
-
-
Method Detail
-
createGraph
@OpenApi protected UMLGraph createGraph(DiagramPresentationElement dpe, AbstractDiagramLayouterOptionsGroup optionsGroup)
Constructs a graph for layout- Overrides:
createGraph
in classAbstractDiagramLayouter
- Parameters:
dpe
- shapes and edges are taken from this diagramoptionsGroup
- layouter options- Returns:
- a created UMLGraph
-
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.
-
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)
-
moveElementsOnEdgeToClosest
private static void moveElementsOnEdgeToClosest(DiagramPresentationElement dpe, UMLGraph graph, HierarchicLayouterOptionsGroup o)
Moves shapes on edges to the closest frame edge and sets it as its on edge property.- Parameters:
dpe
- diagramgraph
- the grapho
- layout options
-
moveToRight
private static void moveToRight(java.awt.Rectangle diagramFrameBounds, ShapeElement shape, java.awt.Rectangle bounds)
-
moveToLeft
private static void moveToLeft(ShapeElement shape, java.awt.Rectangle bounds)
-
moveToBottom
private static void moveToBottom(java.awt.Rectangle diagramFrameBounds, ShapeElement shape, java.awt.Rectangle bounds)
-
moveToTop
private static void moveToTop(ShapeElement shape, java.awt.Rectangle bounds)
-
moveElementsByFakeEdges
private void moveElementsByFakeEdges(UMLGraph graph, com.nomagic.magicdraw.commands.MacroCommand mc)
Moves ports by fake edges. It considers if ports have outgoing connector deeper to the child part and can apply a according constraint.- Parameters:
graph
- the graph
-
sortLayoutableByNesting
private static void sortLayoutableByNesting(UMLGraph graph, y.base.NodeMap nodeMap, java.util.List<ShapeElement> shapeElementList)
Finsd all layoutable shape elements and sorts them by nesting level- Parameters:
graph
- graphnodeMap
- node mapshapeElementList
- layoutable shapes
-
collectPlacementData
private java.util.List<com.nomagic.magicdraw.uml.symbols.layout.composite.CompositeStructureDiagramLayouter.PortPlacementData> collectPlacementData(UMLGraph graph, java.lang.Iterable<ShapeElement> shapeElementList)
Collects the placement data by constraint maps from candidates and adds them to a placement- Parameters:
graph
- graphshapeElementList
- layoutable elements
-
swapsPortLocationsByCrossings
private void swapsPortLocationsByCrossings(UMLGraph graph, java.util.List<com.nomagic.magicdraw.uml.symbols.layout.composite.CompositeStructureDiagramLayouter.PortPlacementData> placementData)
Swaps ports location by possible crossings. Does this for each edge separately.- Parameters:
graph
- graphplacementData
- the placement data
-
setPortLocation
private static void setPortLocation(java.util.Collection<com.nomagic.magicdraw.uml.symbols.layout.composite.CompositeStructureDiagramLayouter.PortPlacementData> placementData, com.nomagic.magicdraw.commands.MacroCommand mc)
-
getPossiblePathOverlapCount
private int getPossiblePathOverlapCount(UMLGraph graph, java.util.Collection<com.nomagic.magicdraw.uml.symbols.layout.composite.CompositeStructureDiagramLayouter.PortPlacementData> placementData, com.nomagic.magicdraw.uml.symbols.layout.composite.CompositeStructureDiagramLayouter.PortPlacementData first, com.nomagic.magicdraw.uml.symbols.layout.composite.CompositeStructureDiagramLayouter.PortPlacementData second)
-
getConstraintSide
@CheckForNull private static java.lang.Byte getConstraintSide(com.nomagic.magicdraw.uml.symbols.layout.composite.CompositeStructureDiagramLayouter.PortPlacementData first)
-
getDataByShapeOnEdge
@CheckForNull private com.nomagic.magicdraw.uml.symbols.layout.composite.CompositeStructureDiagramLayouter.PortPlacementData getDataByShapeOnEdge(UMLGraph graph, java.util.Collection<com.nomagic.magicdraw.uml.symbols.layout.composite.CompositeStructureDiagramLayouter.PortPlacementData> allData, @CheckForNull ShapeElement shapeOnEdge)
-
-