OrientationLayout is a ILayoutStage that changes the orientation of the layout.
Remarks
Layout Style
There are four orientations that can be used for a layout. These orientations can exist with or without mirroring at the x-axis or y-axis.
Changing the layout orientation is useful for layout styles that show a main direction.
Concept
OrientationLayout performs three basic steps.
- Preparation: The sizes and locations of nodes and edge bends as well as labels and PortConstraints are transformed to the TOP_TO_BOTTOM orientation.
- Delegation: The core layout algorithm is invoked and calculates the layout for orientation TOP_TO_BOTTOM.
- Completion: The result of the core layout algorithm is rotated and mirrored to fit the desired layout orientation.
Features
OrientationLayout can either be used as a ILayoutStage wrapping a layout algorithm. Then it will change the orientation of the result of the core layout algorithm.
If no core layout algorithm is specified, OrientationLayout can work alone. It will just change the orientation of the layout without arranging nodes and edges.
Default Values of Properties
considerEdgeLabels | true | The orientation of labels is handled by this |
coreLayout | null | |
mirrorMode | BOTTOM_TO_TOP
| |
orientation | TOP_TO_BOTTOM
|
Type Details
- yfiles module
- layout-core
- yfiles-umd modules
- All layout modules, view-layout-bridge
- Legacy UMD name
- yfiles.layout.OrientationLayout
See Also
Constructors
Creates a new OrientationLayout instance using the given core layout algorithm.
Parameters
A map of options to pass to the method.
- coreLayout - ILayoutAlgorithm
- the core layout routine
- mirrorMode - MirrorModes
The mirror mask that defines which orientations this OrientationLayout shall mirror. This option sets the mirrorMode property on the created object.
- considerEdgeLabels - boolean
Whether or not the position of the edge labels should be changed during orientation change. This option sets the considerEdgeLabels property on the created object.
Creates a new OrientationLayout instance using the given orientation.
Parameters
A map of options to pass to the method.
- orientation - LayoutOrientation
- the orientation specifier
- mirrorMode - MirrorModes
The mirror mask that defines which orientations this OrientationLayout shall mirror. This option sets the mirrorMode property on the created object.
- considerEdgeLabels - boolean
Whether or not the position of the edge labels should be changed during orientation change. This option sets the considerEdgeLabels property on the created object.
- coreLayout - ILayoutAlgorithm
The core layout algorithm that is wrapped by this stage. This option sets the coreLayout property on the created object.
Throws
- Exception({ name: 'ArgumentError' })
- if the specified orientation is unknown
See Also
Properties
Gets or sets whether or not the position of the edge labels should be changed during orientation change.
Default Value
true
.The orientation of labels is handled by this
Gets or sets the core layout algorithm that is wrapped by this stage.
Gets whether or not the current orientation is horizontal.
Gets or sets the mirror mask that defines which orientations this OrientationLayout shall mirror.
Remarks
Setting a layout orientation can be seen as rotating the graph by 90
, 180
or 270
degrees. Afterwards the graph can be mirrored at the x-axis (for horizontal layout orientations) or y-axis (for vertical layout orientations).
Which directions are mirrored can be defined by the given mask. It can combine several mirrored directions with a logical or
-operation.
Default Value
BOTTOM_TO_TOP.Throws
- Exception({ name: 'ArgumentError' })
- if an unknown mask is specified
Gets or sets the main direction of the layout.
Default Value
TOP_TO_BOTTOM.Throws
- Exception({ name: 'ArgumentError' })
- if the specified orientation is unknown
Methods
Prepares the graph for orientation change before calling the core layout algorithm and finishes the orientation change afterwards.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
See Also
Implements
Invokes the layout process of the core layout algorithm.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
See Also
Defined in
Applies the desired orientation to the graph.
Remarks
It performs the inverse coordinate transformation that has been applied to the layout by method prepareOrientationChange.
This method is called by applyLayout after invoking the core layout algorithm. It may be overridden to extend the orientation change to custom layout features.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
See Also
Transforms the given point during completion.
Remarks
Parameters
A map of options to pass to the method.
- point - YPoint
- the calculated point
Returns
- ↪YPoint
- the transformed point
See Also
Creates a YDimension that is a geometric transformation of the given size.
Remarks
Parameters
A map of options to pass to the method.
- nodeSize - YDimension
- the original node size
Returns
- ↪YDimension
- the oriented node size
See Also
Returns whether or not this OrientationLayout instance will mirror the graph for a given layout orientation.
Remarks
Parameters
A map of options to pass to the method.
- orientation - LayoutOrientation
- the layout orientation for which to check the mirror state
Returns
- ↪boolean
true
if the layout algorithm will mirror the graph at the corresponding axis for the given layout orientation,false
otherwise
See Also
Prepares the layout for the desired orientation.
Remarks
It will rotate and mirror the coordinates and bounds of the graph layout such that the core layout algorithm can perform its calculations assuming the canonical TOP_TO_BOTTOM orientation.
This method is called by applyLayout before invoking the core layout algorithm. It might be overridden to extend the preparations to custom layout features.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
See Also
Transforms the given point during preparation.
Remarks
Parameters
A map of options to pass to the method.
- point - YPoint
- the original point
Returns
- ↪YPoint
- the transformed point
See Also
Transforms the given point during the preparation or completion step.
Remarks
Parameters
A map of options to pass to the method.
- point - YPoint
- the original/calculated point
- prepare - boolean
true
if this method is called during preparation,false
if it is called during completion
Returns
- ↪YPoint
- the transformed point