|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.CanonicMultiStageLayouter y.layout.orthogonal.OrthogonalLayouter
public class OrthogonalLayouter
This layout algorithm arranges graphs in an orthogonal fashion.
This layout algorithm arranges the nodes of a given graph such that each edge is drawn as an alternating sequence of horizontal and vertical segments.
It produces compact drawings with no overlapping nodes, few crossings and few bends and is well suited for small and medium-sized sparse graphs.
Orthogonal drawings are common in engineering applications since they are able to provide clear representations of complex networks that can also be optimal with respect to diverse objective functions such as bend minimization or area minimization. Application domains of orthogonal drawings include software engineering, database schema representation, system management, knowledge representation, VLSI circuits and floor planning applications.
Orthogonal layout with default settings
The orthogonal layout algorithm is based on the topology-shape-metrics approach and runs in three phases:
There exist several different layout styles that the orthogonal layout algorithm supports depending on whether or
not the edges should be routed completely orthogonal, or whether or not the original size of the nodes should be
maintained. Such layout styles are NORMAL_STYLE
, UNIFORM_STYLE
, BOX_STYLE
,
MIXED_STYLE
, FIXED_BOX_STYLE
, FIXED_MIXED_STYLE
and can be
applied using method setLayoutStyle(int)
.
OrthogonalLayouter
is able to consider edge label data when arranging a graph. This means that the layout
algorithm will determine the positions of the nodes and edges such that the edge labels do not overlap with the
rest of the layout. Integrated edge labeling can be activated using method
setIntegratedEdgeLabelingEnabled(boolean)
.
EdgeLayoutDescriptor
instances can be used for specifying individual information (e.g. distances) for each
edge in the graph. The descriptors are bound to the graph using DataProvider
s registered with key
EDGE_LAYOUT_DESCRIPTOR_DPKEY
.
If there is no descriptor assigned to some edges, a default descriptor will be used. To set default descriptors,
use setEdgeLayoutDescriptor(EdgeLayoutDescriptor)
.
OrthogonalLayouter
tries to optimize diverse objective functions such as bend minimization, number of edge
crossings, edge length minimization or face maximization. These settings can be enabled using the corresponding
methods setPerceivedBendsOptimizationEnabled(boolean)
, setUseCrossingPostprocessing(boolean)
,
setUseLengthReduction(boolean)
, and setUseFaceMaximization(boolean)
, respectively. The drawback when
these settings are enabled is that the running time of the algorithm may be drastically increased.
For input graphs without group nodes, this layout algorithm is able to detect some specific substructures.
If desired, it can handle and arrange
them explicitly, making the structure easy to recognize. Supported substructures are trees, chains and cycles.
See the corresponding style properties for details: setTreeStyle(byte)
, setChainStyle(byte)
and setCycleStyle(byte)
.
For the detection of substructures, it is optionally possible to consider
node types
, such that only nodes of the same user-defined type can form a substructure.
Field Summary | |
---|---|
static byte |
BOX_STYLE
A layout style that modifies the size of nodes to minimize the overall number of bends. |
static byte |
CHAIN_STYLE_NONE
A chain layout style that defines that chains should not be handled specifically. |
static byte |
CHAIN_STYLE_STRAIGHT
A chain layout style that defines that chains are arranged in a straight fashion. |
static byte |
CHAIN_STYLE_WRAPPED_WITH_BENDS_AT_TURNS
A chain layout style that defines that chains are line/column wrapped such that bends of the chain edges form the turns/corners of the chain arrangement. |
static byte |
CHAIN_STYLE_WRAPPED_WITH_NODES_AT_TURNS
A chain layout style that defines that chains are line/column-wrapped such that nodes form the turns/corners of the chain arrangement. |
static byte |
CYCLE_STYLE_CIRCULAR_WITH_BENDS_AT_CORNERS
A cycle layout style that defines that cycle structures are arranged in a circular fashion such that bends of cycle edges form the corners of the circular layout. |
static byte |
CYCLE_STYLE_CIRCULAR_WITH_NODES_AT_CORNERS
A cycle layout style that defines that cycle structures are arranged in a circular fashion such that nodes form the corners of the circular layout. |
static byte |
CYCLE_STYLE_NONE
A cycle layout style that defines that cycles should not be handled specifically. |
static java.lang.Object |
EDGE_BEND_COST_DPKEY
A DataProvider key for providing bend costs for each edge
The layout algorithm considers the specified costs during the bend minimization phase. |
static java.lang.Object |
EDGE_CROSSING_COST_DPKEY
A DataProvider key for providing crossing costs for each edge
The layout algorithm considers the specified costs during the crossing minimization phase. |
static java.lang.Object |
EDGE_DIRECTEDNESS_DPKEY
A DataProvider key for specifying the directedness of edges for the detection of substructures
The edge directedness is considered for the detection of substructures in the input graph
i.e., trees , chains and cycles . |
static java.lang.Object |
EDGE_LAYOUT_DESCRIPTOR_DPKEY
A DataProvider key for providing layout information for each edge
If no edge layout descriptor is mapped for an edge, a default edge layout descriptor will be obtained using method
createEdgeLayoutDescriptor() . |
static byte |
FIXED_BOX_STYLE
A layout style similar to BOX_STYLE that maintains the original node size. |
static byte |
FIXED_MIXED_STYLE
A layout style similar to MIXED_STYLE that maintains the original node size. |
static byte |
MIXED_STYLE
A layout style that produces non-orthogonal edges and resizes the nodes to a small uniform size. |
static int |
NODEMODEL_UNCHANGED
Deprecated. Use NORMAL_STYLE instead. |
static int |
NODEMODEL_UNIFORM
Deprecated. Use UNIFORM_STYLE instead. |
static byte |
NORMAL_STYLE
A layout style that produces orthogonal edges while maintaining the original node size. |
static byte |
NORMAL_TREE_STYLE
Deprecated. To configure a style for tree-like structures use the tree style property
instead. TREE_STYLE_ASPECT_RATIO_TREE produces tree layouts with a similar style. |
static byte |
ORIENTATION_AUTO_DETECTION
Orientation specifier that defines that the layout orientation of substructures is chosen automatically. |
static byte |
ORIENTATION_BOTTOM_TO_TOP
Orientation specifier that defines that the layout orientation of substructures is bottom to top. |
static byte |
ORIENTATION_LEFT_TO_RIGHT
Orientation specifier that defines that the layout orientation of substructures is left to right. |
static byte |
ORIENTATION_RIGHT_TO_LEFT
Orientation specifier that defines that the layout orientation of substructures is right to left. |
static byte |
ORIENTATION_TOP_TO_BOTTOM
Orientation specifier that defines that the layout orientation of substructures is top to bottom. |
static byte |
TREE_STYLE_ASPECT_RATIO_TREE
A tree layout style that yields tree layouts with an aspect ratio close to 1:1 that
are generated by ARNodePlacer . |
static byte |
TREE_STYLE_COMPACT
A tree layout style that aims to create maximally compact layouts for the subtrees by using the CompactNodePlacer for the tree layout algorithm. |
static byte |
TREE_STYLE_DEFAULT
A tree layout style that arranges subtrees in a layered tree fashion with grouped edge routes, generated by a DefaultNodePlacer with routing style
DefaultNodePlacer.ROUTING_FORK
and alignment setting DefaultNodePlacer.ALIGNMENT_CENTER . |
static byte |
TREE_STYLE_INTEGRATED
A tree layout style that arranges subtrees in a layered tree fashion with grouped edge routes and integrates the tree elements into the orthogonal layout framework. |
static byte |
TREE_STYLE_NONE
A tree layout style that defines that subtrees should not be handled specifically. |
static byte |
UNIFORM_STYLE
A layout style that produces orthogonal edges and nodes of uniform size. |
Fields inherited from interface y.layout.Layouter |
---|
EDGE_ID_DPKEY, NODE_ID_DPKEY, NODE_TYPE_DPKEY, SELECTED_EDGES, SELECTED_NODES |
Constructor Summary | |
---|---|
OrthogonalLayouter()
Creates a new OrthogonalLayouter instance with default settings. |
Method Summary | |
---|---|
boolean |
canLayoutCore(LayoutGraph graph)
Accepts general graphs without exceptions. |
protected EdgeLayoutDescriptor |
createEdgeLayoutDescriptor()
Returns a new EdgeLayoutDescriptor instance that will be used during the various phases of the layout
algorithm to determine the drawing details of the edges of the graph. |
void |
doLayout(LayoutGraph graph)
Calculates an orthogonal layout for the given graph. |
void |
doLayoutCore(LayoutGraph graph)
Calculates an orthogonal layout for the given graph. |
int |
getChainSize()
Returns the minimum size (number of nodes) a chain needs to have to be detected and handled as a chain substructure. |
byte |
getChainStyle()
Returns the chain layout style that defines how chain substructures are arranged. |
int |
getCycleSize()
Returns the minimum size (number of nodes) a cycle needs to have to be detected and explicitly handled as a cycle substructure. |
byte |
getCycleStyle()
Returns the cycle layout style that defines how cycle substructures are arranged. |
EdgeLayoutDescriptor |
getEdgeLayoutDescriptor()
Returns the EdgeLayoutDescriptor instance used for all those edges that do not have a specific layout
descriptor assigned. |
int |
getGrid()
Returns the equidistant spacing between the horizontal and vertical grid lines. |
int |
getLayoutStyle()
Returns the layout style for this layout algorithm. |
long |
getMaximumDuration()
Returns the preferred time limit in milliseconds. |
int |
getNodeModel()
Deprecated. Use setLayoutStyle(int) instead. |
byte |
getTreeOrientation()
Returns the desired orientation for subtree layouts. |
int |
getTreeSize()
Returns the minimum size (number of nodes) a subtree needs to have to be detected and explicitly handled as a tree substructure. |
byte |
getTreeStyle()
Returns the tree layout style that defines the basic arrangement style for subtrees. |
boolean |
getUseCrossingPostprocessing()
Returns whether or not the number of edge crossings should be reduced. |
boolean |
getUseFaceMaximization()
Returns whether or not one face of the embedding of the graph should be maximized. |
boolean |
getUseLengthReduction()
Returns whether or not the overall edge length should be optimized. |
boolean |
getUseRandomization()
Returns whether or not a randomization strategy should be performed. |
boolean |
getUseSketchDrawing()
Returns whether or not the existing drawing should be used as a sketch of the resulting orthogonal layout. |
boolean |
getUseSpacePostprocessing()
Deprecated. |
boolean |
isAlignDegreeOneNodesEnabled()
Returns whether or not degree-one nodes that have the same neighbor should be aligned. |
boolean |
isConsiderNodeLabelsEnabled()
Returns whether or not the layout algorithm considers node labels when calculating node positions to avoid overlaps. |
boolean |
isIntegratedEdgeLabelingEnabled()
Returns whether or not the layout algorithm preserves space and places edge labels. |
boolean |
isParallelRoutesPreferenceEnabled()
Returns whether or not parallel routes for parallel edges (multi-edges) are preferred over independent routes. |
boolean |
isPerceivedBendsOptimizationEnabled()
Returns whether or not the number of perceived bends should be minimized. |
boolean |
isUniformPortAssignmentEnabled()
Returns whether or not the layout algorithm should try to obtain a uniform port assignment of the edges incident to the same node side. |
void |
setAlignDegreeOneNodesEnabled(boolean alignDegreeOneNodesEnabled)
Specifies whether or not degree-one nodes that have the same neighbor should be aligned with each other. |
void |
setChainSize(int chainSize)
Specifies the minimum size (number of nodes) a chain needs to have to be detected and handled as a chain substructure. |
void |
setChainStyle(byte chainStyle)
Specifies the chain layout style that defines how chain substructures are arranged. |
void |
setComponentLayouterEnabled(boolean enabled)
Specifies whether or not the LayoutStage used for arranging the components of the graph is activated. |
void |
setConsiderNodeLabelsEnabled(boolean enabled)
Specifies whether or not the layout algorithm considers node labels when calculating node positions to avoid overlaps. |
void |
setCycleSize(int cycleSize)
Specifies the minimum size (number of nodes) a cycle needs to have to be detected and explicitly handled as a cycle substructure. |
void |
setCycleStyle(byte cycleStyle)
Specifies the cycle layout style that defines how cycle substructures are arranged. |
void |
setEdgeLayoutDescriptor(EdgeLayoutDescriptor edgeLayoutDescriptor)
Specifies the EdgeLayoutDescriptor instance used for all those edges that do not have a specific layout
descriptor assigned. |
void |
setGrid(int value)
Specifies the equidistant spacing between the horizontal and vertical grid lines. |
void |
setGroupNodeHidingEnabled(boolean groupNodeHidingEnabled)
Specifies whether or not the LayoutStage used for hiding group nodes is activated. |
void |
setIntegratedEdgeLabelingEnabled(boolean enabled)
Specifies whether or not the layout algorithm preserves space and places edge labels. |
void |
setLayoutStyle(int value)
Specifies a layout style for this layout algorithm. |
void |
setMaximumDuration(long maximumDuration)
Specifies the preferred time limit in milliseconds. |
void |
setNodeModel(int value)
Deprecated. Use setLayoutStyle(int) instead. |
void |
setOrientationLayouterEnabled(boolean enabled)
Specifies whether or not the LayoutStage that modifies the orientation of the layout is activated. |
void |
setParallelRoutesPreferenceEnabled(boolean parallelRoutesPreferenceEnabled)
Specifies whether or not parallel routes for parallel edges (multi-edges) are preferred over independent routes. |
void |
setPerceivedBendsOptimizationEnabled(boolean perceivedBendsOptimizationEnabled)
Specifies whether or not the number of perceived bends should be minimized. |
void |
setTreeOrientation(byte treeOrientation)
Specifies the desired orientation for subtree layouts. |
void |
setTreeSize(int treeSize)
Specifies the minimum size (number of nodes) a subtree needs to have to be detected and explicitly handled as a tree substructure. |
void |
setTreeStyle(byte treeStyle)
Specifies the tree layout style that defines the basic arrangement style for subtrees. |
void |
setUniformPortAssignmentEnabled(boolean uniformPortAssignmentEnabled)
Specifies whether or not the layout algorithm should try to obtain a uniform port assignment of the edges incident to the same node side. |
void |
setUseCrossingPostprocessing(boolean value)
Specifies whether or not the number of edge crossings should be reduced. |
void |
setUseFaceMaximization(boolean value)
Specifies whether or not one face of the embedding of the graph should be maximized. |
void |
setUseLengthReduction(boolean value)
Specifies whether or not the overall edge length should be optimized. |
void |
setUseRandomization(boolean value)
Specifies whether or not a randomization strategy should be performed. |
void |
setUseSketchDrawing(boolean value)
Specifies whether or not the existing drawing should be used as a sketch of the resulting orthogonal layout. |
void |
setUseSpacePostprocessing(boolean value)
Deprecated. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.Object EDGE_LAYOUT_DESCRIPTOR_DPKEY
DataProvider
key for providing layout information for each edge
If no edge layout descriptor is mapped for an edge, a default edge layout descriptor will be obtained using method
createEdgeLayoutDescriptor()
.
NORMAL_STYLE
and UNIFORM_STYLE
.setLayoutStyle(int)
public static final java.lang.Object EDGE_DIRECTEDNESS_DPKEY
DataProvider
key for specifying the directedness of edges for the detection of substructures
The edge directedness is considered for the detection of substructures in the input graph
i.e., trees
, chains
and cycles
.
A substructure is only identified as such if all edges are either undirected or consistently directed
with respect to the specified directedness.
1
indicates that the edge is considered to be
directed from source to target.
-1
indicates that the edge is considered to be
directed from target to source.
0
indicates that the edge is considered to be
undirected.
DataProvider
is registered with this key, all edges are treated as undirected.public static final java.lang.Object EDGE_CROSSING_COST_DPKEY
DataProvider
key for providing crossing costs for each edge
The layout algorithm considers the specified costs during the crossing minimization phase. Edges with lower
costs are more likely to have crossings. If no individual costs are defined, each crossing has a
cost of 1
.
public static final java.lang.Object EDGE_BEND_COST_DPKEY
DataProvider
key for providing bend costs for each edge
The layout algorithm considers the specified costs during the bend minimization phase.
Edges with lower costs are more likely to have bends. If no individual costs are defined, each bend has a
cost of 1
.
public static final byte NORMAL_STYLE
setLayoutStyle(int)
,
Constant Field ValuesLayout style NORMAL_STYLE |
public static final byte UNIFORM_STYLE
Before calculating the layout, all nodes will be assigned equal sizes.
setLayoutStyle(int)
,
Constant Field ValuesLayout style UNIFORM_STYLE |
public static final byte BOX_STYLE
The layout algorithm will enlarge nodes based on the number and position of their neighbors in order to minimize the number of required bends. The segments of all edges are either horizontal or vertical.
NodeHalo
s and node labels
are not considered
when choosing this style. To consider them use NORMAL_STYLE
.setLayoutStyle(int)
,
Constant Field ValuesLayout style BOX_STYLE |
public static final byte MIXED_STYLE
This layout style resembles BOX_STYLE
, but it resizes all nodes to equal size.
It introduces additional bends into some edges and routes the last edge segment of these edges non-orthogonally to their adjacent nodes.
NodeHalo
s and node labels
are not considered
when choosing this style. To consider them use NORMAL_STYLE
.setLayoutStyle(int)
,
Constant Field ValuesLayout style MIXED_STYLE |
public static final byte TREE_STYLE_NONE
Subtrees are not detected and will be arranged without specific emphasis of the tree structure.
setTreeStyle(byte)
,
Constant Field ValuesTree style TREE_STYLE_NONE |
public static final byte TREE_STYLE_DEFAULT
DefaultNodePlacer
with routing style
DefaultNodePlacer.ROUTING_FORK
and alignment setting DefaultNodePlacer.ALIGNMENT_CENTER
.
Child nodes sharing the same parent node are placed next to each other above/below the root (vertical orientation) or above each other left/right of the root (horizontal orientation).
In contrast to TREE_STYLE_INTEGRATED
this style produces more compact layout results. However, the
overall layout may be less homogeneous because the subtrees are separately arranged by a dedicated
tree layout algorithm which does e.g., not consider the specified grid
.
setTreeStyle(byte)
,
Constant Field ValuesTree style TREE_STYLE_DEFAULT |
public static final byte TREE_STYLE_INTEGRATED
Child nodes sharing the same parent node are placed next to each other above/below the root (vertical orientation) or above each other left/right of the root (horizontal orientation).
In contrast to TREE_STYLE_DEFAULT
, the subtree elements are handled by the orthogonal layout framework
internally. This makes the final layout more homogeneous, but potentially less compact. Furthermore, the
grid
will be correctly obeyed also for tree nodes.
setTreeStyle(byte)
,
Constant Field ValuesTree style TREE_STYLE_INTEGRATED |
public static final byte TREE_STYLE_COMPACT
CompactNodePlacer
for the tree layout algorithm.
The algorithm applied to the subtrees tries to combine different placement strategies such that the overall area required by subtrees is small. This means that the style of different tree structures can vary within the same layout.
setTreeStyle(byte)
,
Constant Field ValuesTree style TREE_STYLE_COMPACT |
public static final byte TREE_STYLE_ASPECT_RATIO_TREE
1:1
that
are generated by ARNodePlacer
.
To achieve the aspect ratio, tree child nodes are organized in as much rows/columns as needed. Edges are routed orthogonally along the rows/columns. The parent node of the children is placed in a corner besides the child nodes depending on the tree layout orientation, e.g., left above the child nodes for top-to-bottom orientation.
setTreeStyle(byte)
,
Constant Field ValuesTree style TREE_STYLE_ASPECT_RATIO_TREE |
public static final byte ORIENTATION_TOP_TO_BOTTOM
setTreeOrientation(byte)
,
Constant Field Valuespublic static final byte ORIENTATION_BOTTOM_TO_TOP
setTreeOrientation(byte)
,
Constant Field Valuespublic static final byte ORIENTATION_LEFT_TO_RIGHT
setTreeOrientation(byte)
,
Constant Field Valuespublic static final byte ORIENTATION_RIGHT_TO_LEFT
setTreeOrientation(byte)
,
Constant Field Valuespublic static final byte ORIENTATION_AUTO_DETECTION
The automatic orientation selection is made e.g., by searching a side at the root node were no edge connects yet and inserting the substructure at that side using the respective orientation (for example, right side means left-to-right layout). It is recommended to use this setting if layouts should be maximally compact, because specifying a fixed orientation reduces the degree of freedom of the algorithm.
setTreeOrientation(byte)
,
Constant Field Valuespublic static final byte CHAIN_STYLE_NONE
Chains in the input graph are not detected and will be arranged without specific emphasis of the chain structure.
setChainStyle(byte)
,
Constant Field ValuesChains are not handled explicitly ( CHAIN_STYLE_NONE ) |
public static final byte CHAIN_STYLE_STRAIGHT
setChainStyle(byte)
,
Constant Field ValuesChain layout style CHAIN_STYLE_STRAIGHT |
public static final byte CHAIN_STYLE_WRAPPED_WITH_NODES_AT_TURNS
setChainStyle(byte)
,
Constant Field ValuesChain layout style CHAIN_STYLE_WRAPPED_WITH_NODES_AT_TURNS |
public static final byte CHAIN_STYLE_WRAPPED_WITH_BENDS_AT_TURNS
setChainStyle(byte)
,
Constant Field ValuesChain layout style CHAIN_STYLE_WRAPPED_WITH_BENDS_AT_TURNS |
public static final byte CYCLE_STYLE_NONE
Cycles in the input graph are not detected and will be arranged without specific emphasis of the cycle structure.
setCycleStyle(byte)
,
Constant Field ValuesCycle not handled specifically ( CYCLE_STYLE_NONE ) |
public static final byte CYCLE_STYLE_CIRCULAR_WITH_NODES_AT_CORNERS
setCycleStyle(byte)
,
Constant Field ValuesCycle layout style CYCLE_STYLE_CIRCULAR_WITH_NODES_AT_CORNERS |
public static final byte CYCLE_STYLE_CIRCULAR_WITH_BENDS_AT_CORNERS
setCycleStyle(byte)
,
Constant Field ValuesCycle layout style CYCLE_STYLE_CIRCULAR_WITH_BENDS_AT_CORNERS |
public static final byte NORMAL_TREE_STYLE
tree style
property
instead. TREE_STYLE_ASPECT_RATIO_TREE
produces tree layouts with a similar style.NORMAL_STYLE
that is best-suited for tree-like structures and
graphs that contain one or more subtrees.
setLayoutStyle(int)
, the tree style
is automatically changed to TREE_STYLE_ASPECT_RATIO_TREE
, but the layout style value
is actually set to NORMAL_STYLE
.setTreeStyle(byte)
,
Constant Field Valuespublic static final byte FIXED_MIXED_STYLE
MIXED_STYLE
that maintains the original node size.
This style introduces additional bends into some edges and routes the last edge segment of these edges non-orthogonally to their adjacent nodes.
NodeHalo
s and node labels
are not considered
when choosing this style. To consider them use NORMAL_STYLE
.setLayoutStyle(int)
,
Constant Field ValuesLayout style FIXED_MIXED_STYLE |
public static final byte FIXED_BOX_STYLE
BOX_STYLE
that maintains the original node size.
Nodes will be placed at the same positions as with FIXED_MIXED_STYLE
, but edges will be routed strictly
orthogonally.
NodeHalo
s and node labels
are not considered
when choosing this style. To consider them use NORMAL_STYLE
.setLayoutStyle(int)
,
Constant Field ValuesLayout style FIXED_BOX_STYLE |
public static final int NODEMODEL_UNCHANGED
NORMAL_STYLE
instead.public static final int NODEMODEL_UNIFORM
UNIFORM_STYLE
instead.Constructor Detail |
---|
public OrthogonalLayouter()
OrthogonalLayouter
instance with default settings.
Method Detail |
---|
public long getMaximumDuration()
Depending on the specified value and the size of the input graph, the layout algorithm may automatically
disable properties setUseRandomization(boolean)
,
setUseLengthReduction(boolean)
, setPerceivedBendsOptimizationEnabled(boolean)
and setUseCrossingPostprocessing(boolean)
.
These properties improve the layout quality but also increase the runtime, especially for larger graphs.
If the time limit is set to Long.MAX_VALUE
, the layout algorithm runs unrestricted.
Values have to be greater or equal to 0
.
setMaximumDuration(long)
public void setMaximumDuration(long maximumDuration)
Depending on the specified value and the size of the input graph, the layout algorithm may automatically
disable properties setUseRandomization(boolean)
,
setUseLengthReduction(boolean)
, setPerceivedBendsOptimizationEnabled(boolean)
and setUseCrossingPostprocessing(boolean)
.
These properties improve the layout quality but also increase the runtime, especially for larger graphs.
If the time limit is set to Long.MAX_VALUE
, the layout algorithm runs unrestricted.
Values have to be greater or equal to 0
.
Long.MAX_VALUE
. The layout algorithm runs unrestricted.maximumDuration
- a non-negative value that specifies the preferred time limit
java.lang.IllegalArgumentException
- if the maximum duration is negativepublic void setNodeModel(int value)
setLayoutStyle(int)
instead.
public boolean isUniformPortAssignmentEnabled()
If this option is enabled, the algorithm may insert additional bends in order to obtain a more uniform port assignment.
setUseSketchDrawing(boolean)
is enabled, the algorithm doesn't insert additional bends
which may result in non-uniform ports even though this option is enabled.NORMAL_STYLE
and UNIFORM_STYLE
.true
if the port assignment is uniform, false
otherwisesetUniformPortAssignmentEnabled(boolean)
public void setUniformPortAssignmentEnabled(boolean uniformPortAssignmentEnabled)
If this option is enabled, the algorithm may insert additional bends in order to obtain a more uniform port assignment.
setUseSketchDrawing(boolean)
is enabled, the algorithm doesn't insert additional bends
which may result in non-uniform ports even though this option is enabled.NORMAL_STYLE
and UNIFORM_STYLE
.uniformPortAssignmentEnabled
- true
if the port assignment should be uniform,
false
otherwisetrue | false |
public byte getTreeStyle()
If there are user-defined node types
, a subtree contains only nodes
of the same type or only nodes without a type (i.e. null
as type). This way, node types
can be used to control which elements are allowed to form a substructure.
setTreeStyle(byte)
public void setTreeStyle(byte treeStyle)
If there are user-defined node types
, a subtree contains only nodes
of the same type or only nodes without a type (i.e. null
as type). This way, node types
can be used to control which elements are allowed to form a substructure.
TREE_STYLE_NONE
. Subtrees are not arranged in a special way.treeStyle
- one of the predefined tree styles
java.lang.IllegalArgumentException
- if an unknown tree style is givenpublic int getTreeSize()
TREE_STYLE_NONE
is specified.setTreeSize(int)
public void setTreeSize(int treeSize)
TREE_STYLE_NONE
is specified.treeSize
- the minimum number of nodes a tree needs to contain to be detected as a substructure
java.lang.IllegalArgumentException
- if the given minimum size is less than 3
public byte getTreeOrientation()
This orientation affects only trees that are specifically handled as a tree substructure when the
tree style
is not TREE_STYLE_NONE
. It is independent of the
main layout orientation
. For example, the main orientation could
be top-to-bottom while the subtree orientation is left-to-right at the same time.
TREE_STYLE_NONE
is set as tree style.ORIENTATION_AUTO_DETECTION
setTreeOrientation(byte)
public void setTreeOrientation(byte treeOrientation)
This orientation affects only trees that are specifically handled as a tree substructure when the
tree style
is not TREE_STYLE_NONE
. It is independent of the
main layout orientation
. For example, the main orientation could
be top-to-bottom while the subtree orientation is left-to-right at the same time.
TREE_STYLE_NONE
is set as tree style.ORIENTATION_AUTO_DETECTION
. The tree orientation is determined automatically.treeOrientation
- one of the four default layout orientations or ORIENTATION_AUTO_DETECTION
java.lang.IllegalArgumentException
- if the given layout orientation is unknownpublic byte getChainStyle()
A chain is a simple edge path where the degree of the nodes is less than or equal to 2
.
Property setChainSize(int)
defines the minimum length a chain needs
to have to be handled explicitly.
If there are user-defined node types
, a chain substructure contains only nodes
of the same type or only nodes without a type (i.e. null
as type). This way, node types
can be used to control which elements are allowed to form a substructure.
TREE_STYLE_NONE
must be selected),
then this chain will be arranged according to the tree layout style and not handled as a chain substructure.setChainStyle(byte)
public void setChainStyle(byte chainStyle)
A chain is a simple edge path where the degree of the nodes is less than or equal to 2
.
Property setChainSize(int)
defines the minimum length a chain needs
to have to be handled explicitly.
If there are user-defined node types
, a chain substructure contains only nodes
of the same type or only nodes without a type (i.e. null
as type). This way, node types
can be used to control which elements are allowed to form a substructure.
TREE_STYLE_NONE
must be selected),
then this chain will be arranged according to the tree layout style and not handled as a chain substructure.CHAIN_STYLE_NONE
. Chains are not handled explicitly.chainStyle
- one of the predefined chain styles
java.lang.IllegalArgumentException
- if an unknown chain style is givenpublic int getChainSize()
CHAIN_STYLE_NONE
is specified.setChainSize(int)
public void setChainSize(int chainSize)
CHAIN_STYLE_NONE
is specified.chainSize
- the minimum number of nodes a chain needs to contain to be detected as a substructure
java.lang.IllegalArgumentException
- if the given minimum size is less than 2
public byte getCycleStyle()
If there are user-defined node types
, a cycle contains only nodes
of the same type or only nodes without a type (i.e. null
as type). This way, node types
can be used to control which elements are allowed to form a substructure.
A cycle is a simple edge path where the first and last node are identical. The algorithm only considers cycles where at most one edge connects a cycle node with the rest of the graph (i.e. isolated cycles that are connected with one edge).
setCycleStyle(byte)
public void setCycleStyle(byte cycleStyle)
If there are user-defined node types
, a cycle contains only nodes
of the same type or only nodes without a type (i.e. null
as type). This way, node types
can be used to control which elements are allowed to form a substructure.
A cycle is a simple edge path where the first and last node are identical. The algorithm only considers cycles where at most one edge connects a cycle node with the rest of the graph (i.e. isolated cycles that are connected with one edge).
CYCLE_STYLE_NONE
. Cycles are not handled explicitly.cycleStyle
- one of the predefined cycle styles
java.lang.IllegalArgumentException
- if an unknown cycle style is givenpublic int getCycleSize()
CYCLE_STYLE_NONE
is specified.setCycleSize(int)
public void setCycleSize(int cycleSize)
CYCLE_STYLE_NONE
is specified.cycleSize
- the minimum number of nodes a cycle needs to contain to be detected as a substructure
java.lang.IllegalArgumentException
- if the given minimum size is less than 4
public boolean isParallelRoutesPreferenceEnabled()
When enabled, the algorithm routes multi-edges (edges that connect the same pair of nodes) in parallel, i.e.,
these edges connect to the same side of the nodes and have the same or a similar path.
Note that the path is not always exactly the same since the algorithm has to omit label-edge intersections
if integrated labeling
is enabled. If this setting is disabled, the
edges are simply independent and might as well connect to different node sides and get very different paths.
A parallel routing is suitable for a lot of diagrams (especially larger ones) as it helps to better recognize multi-edge structures. However, there are scenarios where the routes of such edges might as well be independent. For small examples the structure can also be clear if the edges connect to other node sides, especially when they are in consecutive order around the node.
CanonicMultiStageLayouter.isParallelEdgeLayouterEnabled()
is enabled, that is,
if parallel edges are not handled by this layout algorithm internally but by a specified stage.true
if parallel edges are routed in parallel,
false
otherwisesetParallelRoutesPreferenceEnabled(boolean)
public void setParallelRoutesPreferenceEnabled(boolean parallelRoutesPreferenceEnabled)
When enabled, the algorithm routes multi-edges (edges that connect the same pair of nodes) in parallel, i.e.,
these edges connect to the same side of the nodes and have the same or a similar path.
Note that the path is not always exactly the same since the algorithm has to omit label-edge intersections
if integrated labeling
is enabled. If this setting is disabled, the
edges are simply independent and might as well connect to different node sides and get very different paths.
A parallel routing is suitable for a lot of diagrams (especially larger ones) as it helps to better recognize multi-edge structures. However, there are scenarios where the routes of such edges might as well be independent. For small examples the structure can also be clear if the edges connect to other node sides, especially when they are in consecutive order around the node.
CanonicMultiStageLayouter.isParallelEdgeLayouterEnabled()
is enabled, that is,
if parallel edges are not handled by this layout algorithm internally but by a specified stage.parallelRoutesPreferenceEnabled
- true
if parallel edges should be routed in parallel,
false
otherwisetrue | false |
protected EdgeLayoutDescriptor createEdgeLayoutDescriptor()
EdgeLayoutDescriptor
instance that will be used during the various phases of the layout
algorithm to determine the drawing details of the edges of the graph.
This method may be overridden to create a new EdgeLayoutDescriptor
instance with different configuration
settings.
null
.EdgeLayoutDescriptor
instancepublic EdgeLayoutDescriptor getEdgeLayoutDescriptor()
EdgeLayoutDescriptor
instance used for all those edges that do not have a specific layout
descriptor assigned.
By default, this method will return an EdgeLayoutDescriptor
instance created with
createEdgeLayoutDescriptor()
.
EdgeLayoutDescriptor
instancesetEdgeLayoutDescriptor(EdgeLayoutDescriptor)
,
EDGE_LAYOUT_DESCRIPTOR_DPKEY
public void setEdgeLayoutDescriptor(EdgeLayoutDescriptor edgeLayoutDescriptor)
EdgeLayoutDescriptor
instance used for all those edges that do not have a specific layout
descriptor assigned.
EdgeLayoutDescriptor
edgeLayoutDescriptor
- the current EdgeLayoutDescriptor
instance
java.lang.IllegalArgumentException
- if the specified EdgeLayoutDescriptor
is null
EDGE_LAYOUT_DESCRIPTOR_DPKEY
public void setConsiderNodeLabelsEnabled(boolean enabled)
This method is a convenience method that assures that the
labeling algorithm
is of type
LabelLayoutTranslator
and LabelLayoutTranslator.setTranslateNodeLabelsEnabled(boolean)
is set to
true
.
NORMAL_STYLE
.enabled
- true
if the layout algorithm should take the node labels into account,
false
otherwisefalse | true |
public boolean isConsiderNodeLabelsEnabled()
This method is a convenience method that assures that the
labeling algorithm
is of type
LabelLayoutTranslator
and LabelLayoutTranslator.setTranslateNodeLabelsEnabled(boolean)
is set to
true
.
NORMAL_STYLE
.true
if the layout algorithm takes the node labels into account, false
otherwise
java.lang.IllegalStateException
- if no properly configured LabelLayoutTranslator
is registered even though
this property was enabled earlier (can happen when manually specifying
the labeling algorithm
).setConsiderNodeLabelsEnabled(boolean)
public void setIntegratedEdgeLabelingEnabled(boolean enabled)
To define the desired placement for each label add a PreferredPlacementDescriptor
on
EdgeLabelLayout
.
This method also assures that the labeling algorithm
is of type LabelLayoutTranslator
and LabelLayoutTranslator.setTranslateEdgeLabelsEnabled(boolean)
is set to true
.
labeling algorithm
will be
overwritten and when disabling it, any currently specified labeling algorithm will be disabled via property
CanonicMultiStageLayouter.setLabelLayouterEnabled(boolean)
. Therefore, it is recommended to only use this convenience property
instead of manually changing the mentioned other properties.enabled
- true
if integrated edge labeling should be enabled, false
otherwisefalse | true |
public boolean isIntegratedEdgeLabelingEnabled()
To define the desired placement for each label add a PreferredPlacementDescriptor
on
EdgeLabelLayout
.
This method also assures that the labeling algorithm
is of type LabelLayoutTranslator
and LabelLayoutTranslator.setTranslateEdgeLabelsEnabled(boolean)
is set to true
.
labeling algorithm
will be
overwritten and when disabling it, any currently specified labeling algorithm will be disabled via property
CanonicMultiStageLayouter.setLabelLayouterEnabled(boolean)
. Therefore, it is recommended to only use this convenience property
instead of manually changing the mentioned other properties.true
if integrated edge labeling is enabled, false
otherwise
java.lang.IllegalStateException
- if no properly configured LabelLayoutTranslator
is registered even though
integrated labeling was enabled earlier (can happen when manually specifying
the labeling algorithm
).setIntegratedEdgeLabelingEnabled(boolean)
public int getNodeModel()
setLayoutStyle(int)
instead.
public void setUseRandomization(boolean value)
The randomization will increase the overall layout quality with high probability. The drawback is that the running time of the layout algorithm may increase.
value
- true
if randomization should be performed, false
otherwisepublic boolean getUseRandomization()
The randomization will increase the overall layout quality with high probability. The drawback is that the running time of the layout algorithm may increase.
true
if randomization is performed, false
otherwisesetUseRandomization(boolean)
public boolean isAlignDegreeOneNodesEnabled()
true
if the degree-one nodes are aligned, false
otherwisesetAlignDegreeOneNodesEnabled(boolean)
public void setAlignDegreeOneNodesEnabled(boolean alignDegreeOneNodesEnabled)
public void setUseFaceMaximization(boolean value)
An embedding of a graph is uniquely specified by the cyclic order of edges incident to the same node in a graph drawing.
In any planar drawing of a planar graph, the edges divide the plane into different regions called faces. If one of these faces (the outer face) gets maximized, all other faces will be more compact.
public boolean getUseFaceMaximization()
An embedding of a graph is uniquely specified by the cyclic order of edges incident to the same node in a graph drawing.
In any planar drawing of a planar graph, the edges divide the plane into different regions called faces. If one of these faces (the outer face) gets maximized, all other faces will be more compact.
true
if a face of the embedding is maximized, false
otherwisesetUseRandomization(boolean)
public void setUseCrossingPostprocessing(boolean value)
The layout algorithm will try to significantly reduce the number of crossings in a post-processing step.
public boolean getUseCrossingPostprocessing()
The layout algorithm will try to significantly reduce the number of crossings in a post-processing step.
true
if the number of crossings is reduced, false
otherwisesetUseCrossingPostprocessing(boolean)
public boolean isPerceivedBendsOptimizationEnabled()
A perceived bend is not an actual bend but it is created when a helical arrangement of chains of nodes occurs.
true
if the number of perceived bends is minimized, false
otherwisesetPerceivedBendsOptimizationEnabled(boolean)
public void setPerceivedBendsOptimizationEnabled(boolean perceivedBendsOptimizationEnabled)
A perceived bend is not an actual bend but it is created when a helical arrangement of chains of nodes occurs.
public void setGrid(int value)
Each node will be placed on a grid point. Edges will be routed such that all segments but the first and last one lie on grid lines. (The first and last segments of an edge may or may not lie on grid lines.) Edges consisting of a single segment always lie on grid lines.
The grid spacing has to be greater than 0
.
layout style
is NORMAL_STYLE
.
For all other styles, it is used as a hint only.value
- the grid spacing
java.lang.IllegalArgumentException
- if the grid spacing is negativeGrid spacing 20 . | Grid spacing 40 . |
public int getGrid()
Each node will be placed on a grid point. Edges will be routed such that all segments but the first and last one lie on grid lines. (The first and last segments of an edge may or may not lie on grid lines.) Edges consisting of a single segment always lie on grid lines.
The grid spacing has to be greater than 0
.
layout style
is NORMAL_STYLE
.
For all other styles, it is used as a hint only.setGrid(int)
public void setLayoutStyle(int value)
NORMAL_STYLE
value
- one of the predefined layout styles
java.lang.IllegalArgumentException
- if an unknown layout style is givenpublic int getLayoutStyle()
setLayoutStyle(int)
public void setUseSpacePostprocessing(boolean value)
The layout algorithm will try to reduce significantly the occupied area.
value
- true
if the drawing area should be minimized, false
otherwisepublic boolean getUseSpacePostprocessing()
The layout algorithm will try to reduce significantly the occupied area.
true
if the drawing area is minimized, false
otherwisesetUseSpacePostprocessing(boolean)
public void setUseLengthReduction(boolean value)
The algorithm will try to significantly reduce the length of some edges.
public boolean getUseLengthReduction()
The algorithm will try to significantly reduce the length of some edges.
true
if the overall edge length minimization is reduced, false
otherwisesetUseLengthReduction(boolean)
public boolean getUseSketchDrawing()
The layout algorithm will try to orthogonalize the given sketch without making too many modifications with respect to the original drawing.
true
if the existing drawing is used as a sketch, false
otherwisesetUseSketchDrawing(boolean)
public void setUseSketchDrawing(boolean value)
The layout algorithm will try to orthogonalize the given sketch without making too many modifications in respect to the original drawing.
setUseCrossingPostprocessing(boolean)
, setUseFaceMaximization(boolean)
and setPerceivedBendsOptimizationEnabled(boolean)
are not applied even if enabled.value
- true
if the existing drawing should be used as a sketch, false
otherwiseInitial drawing | Orthogonal layout when initial drawing is used as sketch | Orthogonal layout when the initial drawing is not used as sketch |
public void setComponentLayouterEnabled(boolean enabled)
LayoutStage
used for arranging the components of the graph is activated.
setComponentLayouterEnabled
in class CanonicMultiStageLayouter
OrthogonalLayouter
can only handle single components. Disabling ComponentLayouter
will lead to errors during execution.enabled
- true
if the stage that arranges the graph components is activated,
false
otherwiseCanonicMultiStageLayouter.isComponentLayouterEnabled()
,
CanonicMultiStageLayouter.setComponentLayouter(LayoutStage)
,
ComponentLayouter
public void setGroupNodeHidingEnabled(boolean groupNodeHidingEnabled)
LayoutStage
used for hiding group nodes is activated.
setGroupNodeHidingEnabled
in class CanonicMultiStageLayouter
OrthogonalLayouter
cannot handle group nodes. Disabling GroupNodeHider
will lead to
errors during execution.groupNodeHidingEnabled
- true
if the stage used for hiding group nodes is activated,
false
otherwiseCanonicMultiStageLayouter.isGroupNodeHidingEnabled()
,
CanonicMultiStageLayouter.setGroupNodeHider(LayoutStage)
,
GroupNodeHider
public void setOrientationLayouterEnabled(boolean enabled)
LayoutStage
that modifies the orientation of the layout is activated.
setOrientationLayouterEnabled
in class CanonicMultiStageLayouter
LayoutOrientation.TOP_TO_BOTTOM
, the orientation of
the layout will not be modified.OrientationLayouter
has no significant effect.LayoutStage
is activated.enabled
- true
if the stage that modifies the orientation is activated,
false
otherwiseCanonicMultiStageLayouter.isOrientationLayouterEnabled()
,
CanonicMultiStageLayouter.setOrientationLayouter(LayoutStage)
,
CanonicMultiStageLayouter.setLayoutOrientation(byte)
,
OrientationLayouter
public boolean canLayoutCore(LayoutGraph graph)
canLayoutCore
in class CanonicMultiStageLayouter
graph
- the input graph
true
for all input graphspublic void doLayoutCore(LayoutGraph graph)
doLayoutCore
in class CanonicMultiStageLayouter
graph
- the input graphpublic void doLayout(LayoutGraph graph)
doLayout
in interface Layouter
doLayout
in class CanonicMultiStageLayouter
graph
- the input graphCanonicMultiStageLayouter.appendStage(LayoutStage)
,
CanonicMultiStageLayouter.prependStage(LayoutStage)
,
CanonicMultiStageLayouter.doLayoutCore(LayoutGraph)
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |