OrientationStage is an 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
OrientationStage performs three basic steps.
- Preparation: The sizes and locations of nodes and edge bends as well as labels and LayoutPortCandidates are transformed to the TOP_TO_BOTTOM orientation.
- Delegation: The coreLayout is invoked and calculates the layout for orientation TOP_TO_BOTTOM.
- Completion: The result of the coreLayout is rotated and mirrored to fit the desired layout orientation.
Features
OrientationStage is used as an ILayoutStage wrapping an ILayoutAlgorithm. Then it will change the orientation of the result of the coreLayout.
Default Values of Properties
coreLayout | null | |
edgeLabelPlacement | CONSIDER
| The orientation of labels is handled by this |
mirroredOrientations | BOTTOM_TO_TOP
| |
orientation | TOP_TO_BOTTOM
|
Type Details
- yFiles module
- algorithms
Constructors
Creates a new OrientationStage instance using the given optional coreLayout and layout orientation.
Parameters
A map of options to pass to the method.
- coreLayout - ILayoutAlgorithm
- The core layout algorithm. The default value is
null
. - orientation - LayoutOrientation
- The layout orientation.
- mirroredOrientations - MirroredOrientations
- The mask that defines which orientations this OrientationStage shall mirror. This option sets the mirroredOrientations property on the created object.
- edgeLabelPlacement - OrientationStageEdgeLabelPlacement
- Whether the position of the edge labels should be changed during orientation change. This option sets the edgeLabelPlacement property on the created object.
- enabled - boolean
Properties
Gets or sets the core ILayoutAlgorithm that is wrapped by this stage.
Gets or sets whether the position of the edge labels should be changed during orientation change.
Default Value
Property Value
Gets or sets a value that determines whether this stage should do anything but execute the coreLayout.
Remarks
By default, when constructed, stages should be enabled. Users may disable a stage's functionality by setting this property to false
.
Stages that can guarantee that the graph will not change can choose to not even execute the coreLayout when disabled.
Implements
Gets or sets the mask that defines which orientations this OrientationStage shall mirror.
Remarks
Setting a layout orientation can be seen as rotating the graph by 90
, 180
, or 270
degrees. Afterward, 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.Property Value
Throws
- Exception({ name: 'ArgumentError' })
- if an unknown mask is specified
Gets or sets the main direction of the layout.
Methods
Implementation of the ILayoutAlgorithm interface and main entry point for the layout calculation.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- The graph to apply the layout to.
Implements
Prepares the graph for orientation change before calling the coreLayout and finishes the orientation change afterwards.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
Implements
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 applyLayoutImpl after invoking the coreLayout. 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
Prepares the layout for the desired orientation.
Remarks
It will rotate and mirror the coordinates and bounds of the graph layout such that the coreLayout can perform its calculations assuming the canonical TOP_TO_BOTTOM orientation.
This method is called by applyLayoutImpl before invoking the coreLayout. 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