public class IlvTreeLayout extends IlvGraphLayout
The Tree Layout algorithm places the nodes of a tree starting from the root of the tree to the leaves. If the graph has parts that are disconnected, it arranges each connected component as an individual tree. The Tree Layout algorithm is primarily designed for a forest of pure trees. In a tree, each node except the root has a parent node. All the nodes that have the same parent are called children with respect to the parent and siblings with respect to each other. The Tree Layout algorithm can also be used for non-trees (for example, cyclic graphs). In this case, the layout algorithm ignores those links that violate the tree structure and takes only the spanning tree of the graph into account.
The algorithm has several layout modes:
Several alignment options are provided. In particular, the free layout mode allows the tip-over alignment, which means that subtrees are arranged serially rather than in parallel. If the subtrees starting at one node are normally arranged horizontally, the tip-over alignment arranges them vertically. The tree layout provides layout modes that automatically adapt the tip-over alignment to best fit the layout to a given aspect ratio.
The following sample drawings are produced by the Tree Layout algorithm. The left drawing uses the level layout mode. The flow direction of the links is towards the bottom, and the nodes are south-justified (that is, they are aligned to the bottom) within each level. The right drawing is the same tree in free layout mode (which always uses north level alignment):
Here is another sample drawing in free layout mode with the tip-over alignment at some leaf nodes:
The following are two sample drawings in the two radial layout modes. The normal radial mode in the left drawing places the nodes of the same level on a circle around the root node. The alternating radial mode in the right drawing places the nodes of the same level alternating on two circles around the root node. This results in better usage of the space.
In nonradial layout modes, the Tree Layout algorithm supports different styles of links in the same drawing. The following sample drawing shows orthogonal and straight-line links. It also shows nodes that are aligned to the center (see the red nodes), to the east (green), and to the west (blue) of their children. The drawing was created by the free layout mode with the link flow direction to the right, and so north is to the left.
The Tree Layout algorithm supports node neighboring in all modes. The following sample drawing shows a tree layout with the flow direction towards the top. Some nodes are not placed as children but rather as neighbors at the same level as the corresponding parent node. The red links, which are perpendicular to the flow direction, are between nodes that were specified as neighbored.
See the corresponding chapter of the User's Manual for details on the algorithm, the types of graphs for which this algorithm can be used, the features and limitations, code samples, and so on.
Note the following points:
SDM {
GraphLayout : true;
}
GraphLayout {
graphLayout : @#layout;
// optional settings for the graph layout renderer
}
Subobject#layout {
class : "ilog.views.graphlayout.tree.IlvTreeLayout";
allLevelsAlternating : "false";
allowedTime : "3";
aspectRatio : "3.0";
associateOffset : "3.0";
balloonAngleSpacing : "REGULAR";
balloonInnerChildrenAngle : "2";
balloonLeafChildrenAngle : "2";
balloonRadiusMode : "VARIABLE_RADIUS";
balloonRootChildrenAngle : "2";
balloonStartAngle : "2";
branchOffset : "3.0";
categorizingLinks : "false";
categorizingLinksWithoutLayout : "false";
connectorStyle : "CENTERED_PINS";
coordinatesMode : "MANAGER_COORDINATES";
firstCircleEvenlySpacing : "false";
flowDirection : "Left";
globalAlignment : "MIXED";
globalLinkStyle : "MIXED_STYLE";
incrementalMode : "false";
intergraphConnectivityMode : "false";
invisibleRootUsed : "false";
layoutMode : "FREE";
layoutOfConnectedComponentsEnabled : "false";
levelAlignment : "NORTH";
maxChildrenAngle : "2";
minBusyTime : "3";
nonTreeLinksStraight : "false";
numberOfAlternatingCircles : "2";
orthForkPercentage : "3.0";
overlapPercentage : "3.0";
parentChildAssociateOffset : "3.0";
parentChildOffset : "3.0";
position : "10,10";
recursiveLayoutFromAncestorAllowed : "false";
recursiveLeafLayoutMode : "false";
respectNodeSizes : "false";
rootPosition : "false";
siblingOffset : "3.0";
tipOverBranchOffset : "3.0";
}
link.tag {
LinkStyle : "ORTHOGONAL_STYLE";
}
node.tag {
Alignment : "CENTER";
ChildAlignment : "UNSPECIFED";
EastSubtreeBlockMargin : "3.0";
NorthSubtreeBlockMargin : "3.0";
RootPreference : "2";
SouthSubtreeBlockMargin : "3.0";
WestSubtreeBlockMargin : "3.0";
}
The following table lists the per-object rendering properties of the GraphLayout
renderer:
Property | Type | Default | Description |
---|---|---|---|
GraphLayout | IlvGraphLayout | null | Lets you define a different graph layout algorithm for each subgraph. If one is not specified, the same algorithm is applied recursively to all subgraphs. |
LayoutFixed | String | false | Deprecated, replaced by Fixed. |
Fixed | String | false | Lets you specify that the node or link must not be moved or reshaped by the layout algorithm. |
LayoutGroup | String | null | Lets you apply the algorithm to different groups of objects, one group after the other. |
LayoutIgnored | boolean | false | If true , the object is ignored by the layout. |
The per-node and per-link layout parameters are specified in the style sheet through the CSS rules for nodes and links, not through the CSS rule for graph layout. For instance:
link.tag {
LinkStyle : "ORTHOGONAL_STYLE";
}
Note that the names of the node and link layout parameters use an initial capital, unlike the regular properties. See also the documentation of the class IlvGraphLayoutRenderer.
Modifier and Type | Property and Description |
---|---|
int |
Alignment
Sets the alignment option of an individual node. |
boolean |
allLevelsAlternating
Sets whether at all levels, nodes are forced into alternating circular layers. |
long |
allowedTime
Sets the upper limit for the duration of the layout algorithm. |
double |
aspectRatio
Sets the aspect ratio for the layout. |
double |
associateOffset
Sets the minimum offset between associates and the orthogonal link segment starting at the parent. |
int |
balloonAngleSpacing
Sets the current angle spacing for balloon layout mode. |
int |
balloonInnerChildrenAngle
Sets the maximum angle for children of inner nodes in balloon mode. |
int |
balloonLeafChildrenAngle
Sets the maximum angle for children of nodes that have only leaves as children in balloon mode. |
int |
balloonRadiusMode
Sets the current radius mode for balloon layout mode. |
int |
balloonRootChildrenAngle
Sets the maximum angle for children of the root node in balloon mode. |
int |
balloonStartAngle
Sets the start angle of the layout in balloon mode. |
double |
branchOffset
Sets the minimum offset between neighbor nodes that belong to different branches in the tree. |
boolean |
categorizingLinks
Sets whether the layout algorithm stores the categorization of links into forward, backward, and non-tree links. |
boolean |
categorizingLinksWithoutLayout
Sets whether the layout algorithm does not really perform a full layout. |
int |
ChildAlignment
Sets the child alignment option of the node. |
java.lang.String |
class
Default constructor. |
int |
connectorStyle
Sets the style of the connectors. |
int |
coordinatesMode
Sets the coordinates mode to be used during layout. |
double |
EastSubtreeBlockMargin
Sets the margin on the east side of the subtree starting at the input node. |
boolean |
firstCircleEvenlySpacing
Sets whether the nodes on the first circle must be evenly spaced in radial mode. |
int |
flowDirection
Sets the direction of the flow. |
int |
globalAlignment
Sets the global alignment option. |
int |
globalLinkStyle
Sets the global style of the shapes of links. |
boolean |
incrementalMode
Sets the incremental mode. |
boolean |
intergraphConnectivityMode
Sets whether the intergraph link connectivity is considered for the partitioning of the layout into subtrees. |
boolean |
invisibleRootUsed
Sets whether an invisible root is used to combine components that are disconnected from each other. |
int |
layoutMode
Sets the layout mode. |
boolean |
layoutOfConnectedComponentsEnabled
Sets whether the generic connected component layout mechanism is enabled. |
int |
levelAlignment
Sets the alignment within the levels. |
int |
LinkStyle
Sets the style of the shape of an individual link. |
int |
maxChildrenAngle
Sets the maximum angle for children that are placed in radial mode. |
long |
minBusyTime
Sets the minimal time that the layout algorithm can be busy. |
boolean |
nonTreeLinksStraight
Sets whether all non-tree links that don't have the no-reshape link style and that are not fixed and are not incident to fixed nodes are reshaped to be straight. |
double |
NorthSubtreeBlockMargin
Sets the margin on the north side of the subtree starting at the input node. |
int |
numberOfAlternatingCircles
Sets the number of alternating circles. |
double |
orthForkPercentage
Sets the percentage of the parent-child offset that determines the location where the orthogonal link routing places the bends in order to fork the routing towards the children. |
double |
overlapPercentage
Sets the percentage for which a node is considered smaller in the flow direction. |
double |
parentChildAssociateOffset
Sets the minimum offset between the parent and the first associate. |
double |
parentChildOffset
Sets the minimum offset between a parent and its children. |
ilog.views.IlvPoint |
position
Sets the position of the layout. |
boolean |
recursiveLayoutFromAncestorAllowed
Sets whether the layout instance of the ancestor graph is in principle allowed to treat this subgraph in a recursive layout. |
boolean |
recursiveLeafLayoutMode
Sets whether the recursive layout of nested subgraphs in leaves of the tree is enabled. |
boolean |
respectNodeSizes
Sets whether the algorithm must try to respect the size of the nodes. |
boolean |
rootPosition
Sets the meaning of the specified position. |
int |
RootPreference
Specifies the preference of the node to become root node. |
double |
siblingOffset
Sets the minimum offset between siblings, that is, between nodes that have the same parent in the tree structure. |
double |
SouthSubtreeBlockMargin
Sets the margin on the south side of the subtree starting at the input node. |
double |
tipOverBranchOffset
Sets the minimum offset in the flow direction between neighbor nodes that belong to different branches in the tree. |
double |
WestSubtreeBlockMargin
Sets the margin on the west side of the subtree starting at the input node. |
public java.lang.String class
class : "ilog.views.graphlayout.tree.IlvTreeLayout";
public int Alignment
#MIXED
.
Otherwise, all nodes have the alignment that is specified as the
global alignment. This option has no effect in balloon layout mode.
Valid values are:
#CENTER
- the node is centered with respect to the
centers of its child nodes.#BORDER_CENTER
- the node is centered with respect to
the border of its child nodes.#EAST
- the node is aligned to the border of its
easternmost child node.#WEST
- the node is aligned to the border of its
westernmost child node.#TIP_OVER_EAST
- a parent is outside the border of the
child nodes, and the child nodes are placed sequentially instead of
in parallel on the east side of the parent. This alignment option is
not possible in the radial or level layout modes. #TIP_OVER_WEST
- a parent is outside the border of the
child nodes, and the child nodes are placed sequentially instead of
in parallel on the west side of the parent. This alignment option is
not possible in the radial or level layout modes. #TIP_OVER_EAST_WEST
- similar to #TIP_OVER_EAST
or #TIP_OVER_WEST
, but the child nodes are arranged on both
sides of the link segment that starts at the parent node. The first
child is placed on the east side. Further child nodes are placed on
the east or west side, so that the space used on both sides is
roughly the same, that is, the subtrees on the east side have roughly
the same sum of heights as the subtrees on the west side. This
alignment option is not possible in the radial or level layout modes.
#TIP_OVER_BOTH_SIDES
- similar to #TIP_OVER_EAST
or #TIP_OVER_WEST
, but the child nodes are arranged in pairs
on both sides of the link segment that starts at the parent node.
Unlike the behavior with #TIP_OVER_EAST_WEST
, the algorithm
does not try to optimize the space used on both sides but always puts
the odd-numbered child nodes to the west and the even-numbered child
nodes to the east, and the pairs of child nodes, one on the east side
and one on the west side, are aligned with one another. This
alignment option is not possible in the radial or level layout modes.
The default value is #CENTER
.
Alignment : "CENTER";
Allowed values: | ||
CENTER |
||
BORDER_CENTER |
||
EAST |
||
WEST |
||
TIP_OVER |
Tip over (east) | |
TIP_OVER_WEST |
Tip over (west) | |
TIP_OVER_EAST_WEST |
Tip over (east and west) | |
TIP_OVER_BOTH_SIDES |
globalAlignment
public boolean allLevelsAlternating
This option has only an effect in layout mode #ALTERNATING_RADIAL
. Alternating placement means that the nodes of
one level are placed alternating in several (normally 2) circular
layers. Nonalternating placement means that the nodes of one level
are placed in one circular layer. Normally, the layout analyses which
levels must use the alternating placement in order to optimize space.
If the alternating placement of a level does not improve the space
usage, the nonalternating placement is used for the level even in
alternating radial layout mode.
This option allows to change this behavior: if the option is enabled, all levels use the alternating placement even if the alternating placement uses more space than the nonalternating placement. The option is ignored if the number of alternating circles is set to 0, because in that more, the number of alternating circles is automatically determined from the space usage.
The option is disabled by default.
allLevelsAlternating : "false";
public long allowedTime
When an iterative layout algorithm is used, the iterations can be
stopped when this time is exceeded. Noniterative algorithms can also
use this parameter as an upper limit for the computation time. The
default value is normally 32000
(32 seconds). Subclasses
that support this feature can use a different default value depending
on their particular behavior. Layout algorithms that are stopped in
this way set the result code of the layout report either to IlvGraphLayoutReport#STOPPED_AND_VALID
or to IlvGraphLayoutReport#STOPPED_AND_INVALID
.
When the connected components of disconnected graphs are laid out
separately (see #supportsLayoutOfConnectedComponents()
), the
specified allowed time is considered as the total time for the layout
of all the connected components plus the time for the connected
components layout.
Note that the layout algorithm may not obey exactly the allowed time specification.
Note for implementers of layout algorithms: the method #performLayout(boolean, boolean, boolean)
does NOT automatically
stop the layout when the allowed time is exceeded. It is the sole
responsibility of the implementation of the method #layout(boolean)
to do this.
A RuntimeException
is thrown if the layout does not
support this mechanism.
allowedTime : "3";
public double aspectRatio
width /
height
of the desired layout region.
The effect of the aspect ratio depends on the layout mode:
#RADIAL
and #ALTERNATING_RADIAL
,
the nodes are placed in circular layers if the aspect ratio is
1
. Otherwise, they are placed in elliptical layers.#BALLOON
, the nodes are placed in
circular balloons if the aspect ratio is 1
. Otherwise,
they are placed in elliptical ballons.#TIP_OVER
, #TIP_ROOTS_OVER
,
#TIP_LEAVES_OVER
, and #TIP_ROOTS_AND_LEAVES_OVER
, the
nodes are placed as in in free mode, but local tip-over alignments
are automatically added to better fit the layout to the aspect
ratio.aspectRatio : "3.0";
public double associateOffset
If the flow direction is toward the top or bottom, the orthogonal link segment starting at the parent is vertical, and the associates are placed left or right of this link segment. Hence it is a horizontal offset. If the flow direction is toward the left or right, the orthogonal link segment starting at the parent is horizontal, and the associates are placed above or below this link segment. Hence it is a vertical offset.
If the Respect node sizes option is enabled, this is the minimum offset between node borders; otherwise, it is the minimum offset between node centers.
The default value is 30
.
associateOffset : "3.0";
public int balloonAngleSpacing
#BALLOON
. Valid
values are:
#REGULAR
- the available angle range at a node is evenly
split so that each subtrees balloon at the node can occupy the same
angle. #FAST_PROPORTIONAL
- the available angle range at a node
is proportonally split so that larger subtrees balloons at the node
can occupy larger angles. The algorithm uses a fast heuristic to
calculate the angle ranges. This heuristic is not very precise. #PROPORTIONAL
- the available angle range at a node is
proportonally split so that larger subtrees balloons at the node can
occupy larger angles. The algorithm uses a slower heuristic to
calculate the angle ranges. This heuristic is more precise than the
fast heuristic.
The default value is #PROPORTIONAL
.
balloonAngleSpacing : "REGULAR";
Allowed values: | ||
REGULAR |
||
FAST_PROPORTIONAL |
Proportional (fast) | |
PROPORTIONAL |
Proportional (slow) |
layoutMode
public int balloonInnerChildrenAngle
The default value is 360.
This is an expert option. It has no effect in layout modes other than balloon.
balloonInnerChildrenAngle : "2";
public int balloonLeafChildrenAngle
The default value is 360.
This is an expert option. It has no effect in layout modes other than balloon.
balloonLeafChildrenAngle : "2";
public int balloonRadiusMode
#BALLOON
. Valid values
are:
#VARIABLE_RADIUS
- the radius of different child
balloons at the same parent node can vary. #OPTIMIZED_VARIABLE_RADIUS
- the radius of different
child balloons at the same parent node can vary. An additional
optimization heuristic reduces the radius. This has the advantage of
smaller space requirements but looses symmetries in the diagram.
#UNIFORM_LEAVES_RADIUS
- the radiuses of all leaves that
are children of the same node are uniform. The radius of balloons
that contain more than one node can still vary. Use this mode if
symmetries of the layout are important. #OPTIMIZED_UNIFORM_LEAVES_RADIUS
- the radiuses of all
leaves that are children of the same node are uniform. The radius of
balloons that contain more than one node can still vary. An
additional optimization heuristic reduces the radius. This has the
advantage of smaller space requirements but looses symmetries in the
diagram. #UNIFORM_RADIUS
- the radiuses of all subtree balloons
that are children of the same node are uniform. This mode requires
the most area but also shows the most symmetries in the layout.
The default value is #OPTIMIZED_UNIFORM_LEAVES_RADIUS
.
balloonRadiusMode : "VARIABLE_RADIUS";
Allowed values: | ||
VARIABLE_RADIUS |
Variable | |
OPTIMIZED_VARIABLE_RADIUS |
Variable optimized | |
UNIFORM_LEAVES_RADIUS |
Uniform for leaves | |
OPTIMIZED_UNIFORM_LEAVES_RADIUS |
Uniform for leaves optimized | |
UNIFORM_RADIUS |
Uniform |
layoutMode
public int balloonRootChildrenAngle
The default value is 360.
This is an expert option. It has no effect in layout modes other than balloon.
balloonRootChildrenAngle : "2";
public int balloonStartAngle
The default value is 0.
The angle orientation is clockwise for flow direction left and top and counter clockwise for flow direction right and bottom. The start angle 0 is always towards the right.
This is an expert option. It has no effect in layout modes other than balloon.
balloonStartAngle : "2";
public double branchOffset
If the flow direction is towards the top or bottom and the layout mode is not radial or balloon, this is a horizontal offset. If the flow direction is towards the left or right and the layout mode is not radial or balloon, this is a vertical offset. If the layout mode is radial, this is an offset tangential to the circles or ellipses.
If the layout mode is balloon, this is the minimal offset between nodes in all directions. The balloon mode does not distinguish between siblings and branches, hence the branch offset is used for all nodes.
If the respect node sizes option is enabled, this is the minimum offset between node borders; otherwise, it is the minimum offset between node centers.
The default value is 40
.
branchOffset : "3.0";
flowDirection
public boolean categorizingLinks
true
, the
next run of the layout algorithm makes the link categorization
available through the methods #getCalcForwardTreeLinks()
,
#getCalcBackwardTreeLinks()
, and #getCalcNonTreeLinks()
. If false
, the link
categorization is not made available. This saves memory and is
faster. In this case, the methods #getCalcForwardTreeLinks()
,
#getCalcBackwardTreeLinks()
, and #getCalcNonTreeLinks()
will return empty enumerations.
Note that only normal links can be categorized. Intergraph links are
never categorized, even if #setIntergraphConnectivityMode(boolean)
is set to true
.
The default value is false
.
categorizingLinks : "false";
public boolean categorizingLinksWithoutLayout
Note that a run of the layout is necessary to make the categorization
available. Otherwise, the methods #getCalcForwardTreeLinks()
,
#getCalcBackwardTreeLinks()
, and #getCalcNonTreeLinks()
return empty enumerations if there was no run
of the layout.
The default value is false
.
categorizingLinksWithoutLayout : "false";
categorizingLinks
,
recursiveLeafLayoutMode
public int ChildAlignment
#setAlignment(Object, int)
and #setGlobalAlignment(int)
at the parent. Child alignments only take
effect in free and level mode but not in radial or balloon mode, and
only if the child node is not a root node of a tree.
Valid values are:
#UNSPECIFIED
- no exceptional alignment is specified for
this child node.#EAST_NEIGHBOR
- the child node is made a neighbor on
the east side of its parent node.#WEST_NEIGHBOR
- the child node is made a neighbor on
the west side of its parent node.#TIP_OVER_ASSOCIATE_BOTH_SIDES
- the child is laid out
like an associate node of its parent node. Associate nodes occur
alternating on the east and west sides of their parent node.#TIP_OVER_ASSOCIATE_EAST
- the child is laid out like an
associate node of its parent node. This associate nodes occurs on the
east side of its parent node.#TIP_OVER_ASSOCIATE_WEST
- the child is laid out like an
associate node of its parent node. This associate nodes occurs on the
west side of its parent node.
The default value is #UNSPECIFIED
.
ChildAlignment : "UNSPECIFED";
Allowed values: | ||
UNSPECIFED |
Unspecified | |
EAST_NEIGHBOR |
||
WEST_NEIGHBOR |
||
TIP_OVER_ASSOCIATE_BOTH_SIDES |
Tip over associate (east and west) | |
TIP_OVER_ASSOCIATE_EAST |
Tip over associate (east) | |
TIP_OVER_ASSOCIATE_WEST |
Tip over associate (west) |
globalAlignment
public int connectorStyle
Valid values are:
#CENTERED_PINS
- the link connector pins are placed in
the center of the border of the node bounding box to which the link
is attached.#CLIPPED_PINS
- each link pointing to the center of the
node is clipped at the bounding box of the node. This style affects
straight links; it behaves like centered connector pins for
orthogonal links.#EVENLY_SPACED_PINS
- the link connector pins are evenly
spaced along the border of the node bounding box.#AUTOMATIC_PINS
- the connector style is selected
depending on the link style.
The default value is #AUTOMATIC_PINS
.
The connector style is ignored in the radial layout modes because clipped pins are always used in this case . The placement of connector pins also depends on the link clip interface and the connection box interface, in the following way:
IlvGraphLayout#setLinkConnectionBoxInterface(IlvLinkConnectionBoxInterface)
,
the bounding box and offsets are delivered by that interface.
Otherwise, the node bounding box delivered by the graph model (see
IlvGraphModel#boundingBox(Object)
) is used. setLinkClipInterface
, the connector pins are corrected
by clipping with that interface.
Note that when the graph attached to the layout is of type IlvGrapher
, the effect of the connector style depends on the type of
the connectors installed at the node. We recommend using link
connectors of type IlvFreeLinkConnector
. Other connector types
may cause an IlvInappropriateLinkException
during layout. You
can use the method
before layout, or the method IlvGraphLayoutUtil.EnsureAppropriateLinkConnectors
when the
exception is caught, to install the appropriate connectors.
IlvGraphLayoutUtil.EnsureAppropriateLinks
connectorStyle : "CENTERED_PINS";
Allowed values: |
CENTERED_PINS |
CLIPPED_PINS |
EVENLY_SPACED_PINS |
AUTOMATIC_PINS |
public int coordinatesMode
Valid values are:
ilog.views.graphlayout.IlvGraphLayout#MANAGER_COORDINATES
- The
geometry of the graph is computed using the coordinate space of the
manager (that is, the attached IlvGrapher
) without applying
any transformation.
This mode should be used if you visualize the graph at zoom level 1, or you do not visualize it at all, or the graph contains only fully zoomable objects. In all these cases there is no need to take the transformer into account during the layout.
Note that in this mode the dimensional parameters of the layout algorithms are considered as being specified in manager coordinates.
ilog.views.graphlayout.IlvGraphLayout#VIEW_COORDINATES
-
The geometry of the graph is computed in the coordinate space of the
manager view. More exactly, all the coordinates are transformed using
the current reference transformer.
This mode should be used if you want the dimensional parameters of the layout algorithms to be considered as being specified in manager view coordinates.
ilog.views.graphlayout.IlvGraphLayout#INVERSE_VIEW_COORDINATES
- The
geometry of the graph is computed using the coordinate space of the
manager view and then applying the inverse transformation. This mode
is equivalent to the "manager coordinates" mode if the geometry of
the graphic objects strictly obeys the transformer. (A small
difference may exist because of the limited precision of the
computations.)
On the contrary, if some graphic objects are either nonzoomable (see
IlvGraphic#zoomable
) or semizoomable (for example, links with
a maximum line width), this mode gives different results than the
manager coordinates mode. These results are optimal if the graph is
visualized using the same transformer as the one taken into account
during the layout.
Note that in this mode the dimensional parameters of the layout algorithms are considered as being specified in manager coordinates.
The default value is IlvGraphLayout#INVERSE_VIEW_COORDINATES
.
This option is useful only if the attached graph model is an IlvGrapherAdapter
(or a subclass). Otherwise, it has no effect.
Note: the coordinates mode of the layout is used only while this
layout is running. If layout is not running, operations on the
grapher adapter use the coordinates mode that was set on the grapher
adapter directly (see IlvGrapherAdapter#setCoordinatesMode
).
coordinatesMode : "MANAGER_COORDINATES";
Allowed values: |
MANAGER_COORDINATES |
VIEW_COORDINATES |
INVERSE_VIEW_COORDINATES |
public double EastSubtreeBlockMargin
The default value is -1, which means no margin.
EastSubtreeBlockMargin : "3.0";
public boolean firstCircleEvenlySpacing
By default, all nodes are placed as close as possible according to the offset parameters. In radial mode, this may cause the first circle to be only partially filled (that is, all nodes are placed close together at one part of the circle and there is a larger gap in another part of the circle).
To avoid this effect, you can enable the evenly spacing of the first circle. In this case, the children of the root node are placed such that their centers are approximately evenly spaced on the first circle, filling the entire circle. This may, however, cause the final result to waste much more space on the other circles.
It is disabled by default.
This is an expert option. It has no effect in layout modes other than radial. If there is east-west neighboring of the nodes in the first circle, these neighbors will not be equally spaced.
firstCircleEvenlySpacing : "false";
public int flowDirection
IlvDirection#Right
- the root is on the left and the
links flow to the right.IlvDirection#Left
- the root is on the right and the
links flow to the left.IlvDirection#Bottom
- the root is at the top and the
links flow to the bottom.IlvDirection#Top
- the root is at the bottom and the
links flow to the top.
Note that except for the radial layout modes, the compass direction
#SOUTH
is identical to the flow direction.
In the radial layout modes, all links flow radially from the center of the root outward. If connected component processing is disabled, the flow direction affects only the arrangement of disconnected trees in the radial modes.
The default value is IlvDirection#Right
.
flowDirection : "Left";
Allowed values: |
Left |
Right |
Top |
Bottom |
public int globalAlignment
#CENTER
- a parent is centered above its child nodes,
taking the center of the child nodes into account.#BORDER_CENTER
- a parent is centered above its child
nodes, taking the border of the child nodes into account. This
differs from the alignment #CENTER
if the Respect node sizes
option is enabled.#EAST
- a parent is aligned to the border of its
easternmost child node.#WEST
- a parent is aligned to the border of its
westernmost child node.#TIP_OVER_EAST
- a parent is outside the border of the
child nodes, and the child nodes are placed sequentially instead of
in parallel. The child nodes are on the east side of the parent. This
alignment option is not possible in the radial or level layout
modes.#TIP_OVER_WEST
- a parent is outside the border of the
child nodes, and the child nodes are placed sequentially instead of
in parallel. The child nodes are on the west side of the parent. This
alignment option is not possible in the radial or level layout
modes.#TIP_OVER_EAST_WEST
- similar to #TIP_OVER_EAST
or #TIP_OVER_WEST
, but the child nodes are arranged on both
sides of the link segment that starts at the parent node. The first
child node is placed on the east side. Further child nodes are placed
on the east or west side, so that the space used on both sides is
roughly the same, that is, the subtrees on the east side have roughly
the same sum of heights as the subtrees on the west side. This
alignment option is not possible in the radial or level layout
modes.#TIP_OVER_BOTH_SIDES
- similar to #TIP_OVER_EAST
or #TIP_OVER_WEST
, but the child nodes are arranged in pairs
on both sides of the link segment that starts at the parent node.
Unlike #TIP_OVER_EAST_WEST
, this style does not try to
optimize the space used on both sides but always puts the
odd-numbered child nodes to the west and the even-numbered child
nodes to the east. The pairs of child nodes, one on the east side and
one on the west side, are aligned with one another. This alignment
option is not possible in the radial or level layout modes.#MIXED
- each node can have a different alignment
option. The alignment of each individual node can be set by the
method #setAlignment(Object, int)
so that different
alignments can occur in the same graph.
The default value is #CENTER
.
globalAlignment : "MIXED";
Allowed values: | ||
MIXED |
||
CENTER |
||
BORDER_CENTER |
||
EAST |
||
WEST |
||
TIP_OVER |
Tip over (east) | |
TIP_OVER_WEST |
Tip over (west) | |
TIP_OVER_EAST_WEST |
Tip over (east and west) | |
TIP_OVER_BOTH_SIDES |
public int globalLinkStyle
#ORTHOGONAL_STYLE
- all links have an orthogonal shape,
that is, a shape consisting of a sequence of orthogonal line
segments. This option is not available for the radial layout
modes.#STRAIGHT_LINE_STYLE
- all links have a straight-line
shape.#NO_RESHAPE_STYLE
- no reshape is performed on any
link.#MIXED_STYLE
- each link can have a different link
style. The style of each individual link can be set by the method
#setLinkStyle(Object, int)
so that different link shapes can
occur in the same graph.
Unless the global link style is #MIXED_STYLE
, all links have
the same shape style.
The default value is #STRAIGHT_LINE_STYLE
.
Note that when the graph attached to the layout is of type IlvGrapher
, the effect of the link reshaping depends on the type of
the links and the connectors installed at the node. For all link
styles, we recommend using links of type IlvPolylineLinkImage
. For the orthogonal link
style, we additionally recommend using link connectors of type IlvFreeLinkConnector
. Other link or
connector types may cause an IlvInappropriateLinkException
during layout. You can use the method
and
method IlvGraphLayoutUtil.EnsureAppropriateLinkTypes
before layout, or the method IlvGraphLayoutUtil.EnsureAppropriateLinkConnectors
when the
exception is caught, to convert all links to an appropriate type.
IlvGraphLayoutUtil.EnsureAppropriateLinks
globalLinkStyle : "MIXED_STYLE";
Allowed values: | ||
MIXED_STYLE |
Mixed links | |
ORTHOGONAL_STYLE |
Orthogonal links | |
STRAIGHT_LINE_STYLE |
Straight-line links | |
NO_RESHAPE_STYLE |
No link reshape |
public boolean incrementalMode
If the incremental mode is enabled, the algorithm tries to preserve the relative order of the children on incremental changes, unless a node comparator is specified. The logical order of children of nodes in the tree is calculated from their coordinates. In this case, the layout is stable when incremental changes are made. If nodes are added or removed after a layout, the next layout uses a heuristic to try to adjust the layout only minimally and to avoid major structural reorganization.
If the incremental mode is disabled, the algorithm calculates the
logical order of children of nodes in the tree by using the order in
which nodes are returned by IlvGraphModel#getNodes()
.
If a node comparator is specified, the algorithm calculate the logical order of children of nodes in the tree from the node comparator, independent from whether the incremental mode is enabled or disabled.
The incremental mode is enabled by default.
incrementalMode : "false";
public boolean intergraphConnectivityMode
Note that this option has no effect if the generic disconnected node
placement is enabled (see #setLayoutOfConnectedComponentsEnabled(boolean)
).
Even if this option is enabled, the Tree Layout algorithm does not route intergraph links. They should be routed by applying a Link Layout after the Tree Layout.
intergraphConnectivityMode : "false";
public boolean invisibleRootUsed
#setRoot(Object)
or #setRootPreference(Object, int)
are the
roots of each individual component. If an invisible root is used, all
roots of each individual component are added as children to an
invisible dummy node and the layout is performed on the resulting
connected graph. By doing this, the components are arranged in the
same global structure. In particular, this is useful for the radial
layout modes to fit all components into the same global circular
layer structure instead of generating an individual circular layer
structure for each component.
Note that the layout is no longer stable on incremental changes if an invisible root is used. The layout heuristic cannot preserve the relative order of the components in this case. This means that the order of the components may change in subsequent layouts, and hence the next layout may look very different from the previous layout.
The default value is false
.
invisibleRootUsed : "false";
public int layoutMode
#FREE
- all links flow roughly in the flow direction.
Nodes of different tree branches (that is, nodes with a different
parent node) are not justified to each other; therefore, the level
alignment parameter is ignored. Tip-over alignment is possible if
specified as alignment. All link styles are possible. The aspect
ratio is ignored.#LEVEL
- all links flow roughly in the flow direction.
Nodes are organized in levels and are justified to their borders or
centered according to the level alignment parameter. Tip-over
alignment is not possible, but all link styles are possible. The
aspect ratio is ignored.#TIP_OVER
- similar to the mode #FREE
. However,
in mode #TIP_OVER
, the algorithm tries to optimize the layout
to automatically fit best to the specified aspect ratio. Using a fast
heuristic, it chooses the local alignment #TIP_OVER_EAST
for
some nodes but keeps the alignment of all other nodes as specified.
This heuristic is a fast compromise between the modes #TIP_LEAVES_OVER
, #TIP_ROOTS_OVER
, and #TIP_ROOTS_AND_LEAVES_OVER
.#TIP_LEAVES_OVER
- similar to the mode #TIP_OVER
. The algorithm tries to optimize the layout to
automatically fit best to the specified aspect ratio. This slow
heuristic tries to tip over beginning with the leaves and then
chooses the best layout. It checks the alignment mode #TIP_OVER_EAST
, but not #TIP_OVER_BOTH_SIDES
or other
variants. It keeps the alignment of all nodes close to the root as
specified.#TIP_ROOTS_OVER
- similar to the mode #TIP_OVER
.
The algorithm tries to optimize the layout to automatically fit best
to the specified aspect ratio. This slow heuristic tries to tip over
beginning with the roots and then chooses the best layout. It checks
the alignment mode #TIP_OVER_EAST
, but not #TIP_OVER_BOTH_SIDES
or other variants. It keeps the alignment of
all nodes close to the leaves as specified.#TIP_ROOTS_AND_LEAVES_OVER
- similar to the mode #TIP_OVER
. The algorithm tries to optimize the layout to
automatically fit best to the specified aspect ratio. This slow
heuristic tries to tip over beginning with the roots and with the
leaves, and then chooses the best layout. It checks the alignment
mode #TIP_OVER_EAST
, but not #TIP_OVER_BOTH_SIDES
or
other variants. It keeps the alignment of all nodes in the middle
between roots and leaves as specified.#RADIAL
- the root node is in the center, the links flow
radially away from the center, and the nodes are placed in circular
layers around the root node according to the level alignment.
Tip-over alignment and orthogonal link styles are not possible.
Clipped connector pins are used as the connector style. If an aspect
ratio is specified, the layers are ellipses around the center.#ALTERNATING_RADIAL
- this is the same as mode #RADIAL
, with the exception that children of the same node are
placed alternating in different circular layers when this results in
a smaller radius and better usage of the space. Tip-over alignment
and orthogonal link styles are not possible. Clipped connector pins
are used as the connector style. If an aspect ratio is specified, the
layers are ellipses around the center.#BALLOON
- the root node is in the center and the
subtrees are arranged as balloon circles around the root. It is very
similar to the mode #RADIAL
, however each subtree froms its
own balloon recursively. If an aspect ratio is specified, the
balloons are ellipses instead of circles. Tip-over alignment and
orthogonal link styles are not possible. Clipped connector pins are
used as the connector style. The recursive leaf layout mode is not
supported in combination with the balloon mode.
The default value is #FREE
.
Note that the tip-over layout modes work best if the node sizes are respected during layout.
layoutMode : "FREE";
Allowed values: | ||
FREE |
||
LEVEL |
||
BALLOON |
||
RADIAL |
||
ALTERNATING_RADIAL |
||
TIP_OVER |
Auto Tip Over (fast) | |
TIP_ROOTS_OVER |
Auto Tip Over (Roots) | |
TIP_LEAVES_OVER |
Auto Tip Over (Leaves) | |
TIP_ROOTS_AND_LEAVES_OVER |
Auto Tip Over (Roots and Leaves) |
public boolean layoutOfConnectedComponentsEnabled
#supportsLayoutOfConnectedComponents()
), the method
#performLayout(boolean, boolean, boolean)
cuts the attached
graph model into connected components and lays out each connected
component separately. Then the connected components are placed using
the layout instance returned by the method #getLayoutOfConnectedComponents()
.
Notice that the connected component layout is not used if the graph is connected.
A RuntimeException
is thrown if the layout does not
support this mechanism.
The default value is the value returned by the method #isLayoutOfConnectedComponentsEnabledByDefault()
.
CSS example:
layoutOfConnectedComponentsEnabled : "false";
public int levelAlignment
#CENTER
#NORTH
#SOUTH
This feature sets the alignment of the nodes within each level. It
can be used in layout modes #LEVEL
, #RADIAL
, and
#ALTERNATING_RADIAL
. It has an effect only if the respect
node sizes option is enabled.
If the nodes are center-justified, all nodes of the same level are
placed with their centers along a line. Otherwise, all nodes of the
same level are placed with the specified border justified to a line.
For instance, if the link flow direction is to the right, the
alignment #NORTH
means that the nodes are justified to the
left and the alignment #SOUTH
means that the nodes are
justified to the right.
In the radial layout modes, the alignment #NORTH
means that
the nodes are aligned along a circle with the border that is closer
to the root, and the alignment #SOUTH
means that the nodes
are aligned along a circle with the border that is farther away from
the root.
The default value is #CENTER
.
levelAlignment : "NORTH";
Allowed values: | ||
NORTH |
North justified | |
SOUTH |
South justified | |
CENTER |
Center justified |
public int LinkStyle
#MIXED_STYLE
and
the link is part of the spanning tree. If the global link style is
not #MIXED_STYLE
, all links of the spanning tree have the
style that is specified as the global link style. Links that are not
part of the spanning tree have the link style #NO_RESHAPE_STYLE
.
Valid values are:
#ORTHOGONAL_STYLE
- the link has an orthogonal shape,
that is, a shape consisting of a sequence of orthogonal line
segments. This option is not available for the radial layout
modes.#STRAIGHT_LINE_STYLE
- the link has a straight-line
shape.#NO_RESHAPE_STYLE
- no reshape is performed on the
link.
The default value is #STRAIGHT_LINE_STYLE
.
When the graph attached to the layout is of type IlvGrapher
,
the effect of the link reshaping depends on the type of the links and
the connectors installed at the node. For all link styles, you are
recommended to use links of type IlvPolylineLinkImage
. For the orthogonal link
style, you are additionally recommended to use link connectors of
type IlvFreeLinkConnector
. Other
link or connector types may cause an IlvInappropriateLinkException
during layout. You can use the method
and
method IlvGraphLayoutUtil.EnsureAppropriateLinkTypes
before layout, or the method IlvGraphLayoutUtil.EnsureAppropriateLinkConnectors
when the
exception is caught, to convert all links to an appropriate type.
IlvGraphLayoutUtil.EnsureAppropriateLinks
LinkStyle : "ORTHOGONAL_STYLE";
Allowed values: | ||
ORTHOGONAL_STYLE |
Orthogonal links | |
STRAIGHT_LINE_STYLE |
Straight-line links | |
NO_RESHAPE_STYLE |
No link reshape |
globalLinkStyle
public int maxChildrenAngle
The default value is 0.
In radial mode, children of a single node may cover nearly completely one circular layer. This sometime appears to be unbalanced, in particular because the links from the node to its outermost children are likely to cross other nodes. To avoid this effect, a maximum angle can be specified so that the children are placed more in the same direction and are not spread too widely around the parent. This angular restriction is applied to all children except the children of the root node. As a side effect, specifying a small maximum children angle enlarges the radius of the circles.
It is recommended choosing a value between 30
and
180
degrees for good results. The algorithm uses a
heuristic that has precision deviations below 30
degrees
and above 180
degrees. If an aspect ratio is specified,
the layout algorithm uses ellipses instead of circles. In this case,
precision deviations may occur as well.
This is an expert option. It has no effect in layout modes other than radial.
maxChildrenAngle : "2";
public long minBusyTime
#layoutStepPerformed()
when the
method #callLayoutStepPerformedIfNeeded()
is used.
The objective is to avoid the overhead of #layoutStepPerformed()
becoming too high if the method is called too
often. Internal routines of layout algorithms usually call #callLayoutStepPerformedIfNeeded()
, which calls #layoutStepPerformed()
if the time since the last call was at least
the minimal busy time.
The default value is 50 (milliseconds).
minBusyTime : "3";
public boolean nonTreeLinksStraight
This option is disabled by default. When disabled, the tree layout only routes the links of the spanning tree, but no other link. When enabled, the tree layout iterates over the links obtained by #getCalcNonTreeLinks()
and makes them straight.
It obeys the link clip interface and the link connection box interface when making the non-tree links straight. The tree layout can only obey the link style and the connector style of the tree links but not of the non-tree links. In particular, it is not able to route non-tree links orthogonally. Only tree-links can be routed orthogonally. Usually it is recommended to apply an additional link layout to the non-tree links if there are any. However, if the non-tree links should just be straight, this option comes in handy since an additional link layout can be omitted in this case.
nonTreeLinksStraight : "false";
public double NorthSubtreeBlockMargin
The default value is -1, means no margin.
NorthSubtreeBlockMargin : "3.0";
public int numberOfAlternatingCircles
This option has only an effect in layout mode #ALTERNATING_RADIAL
. Alternating placement means that the nodes of
one level are placed alternating in several circular layers. By
default, it uses 2 circular layers for the alternating placement.
Nonalternating placement means that the nodes of one level are
placed in one circular layer.
This option allows to define how many alternating layers are
maximally used. You cannot have more layers than nodes in the level,
hence it is only the maximum number of layers. Furthermore, the
layout analyses which levels must use the alternating placement in
order to optimize space, unless the option #isAllLevelsAlternating
returns true.
If you set the number to a positive value and #isAllLevelsAlternating
returns true, each level has exactly that
many circular layers, unless the level has not sufficient nodes. If
you set the number to a positive value and #isAllLevelsAlternating
returns false, each level has either exactly
that many circular layers or one circular layer, depending on which
version uses the space better. If you set the number to 0, a
heuristic tries to determine for each level how many circular layers
are needed in order to optimize the space. In this case, different
levels can have different number of circular layers, and the value of
#isAllLevelsAlternating
is ignored.
Note that the layout may have link crossings if a huge number of alternating circles per level is used.
The default value is 2.
numberOfAlternatingCircles : "2";
public double orthForkPercentage
The default value is 45
%.
This is an expert option. In all normal cases, it is not necessary to change the option. It is recommended choosing an orthogonal fork percentage that is always larger than the overlap percentage to obtain a good layout.
orthForkPercentage : "3.0";
public double overlapPercentage
#FREE
, #TIP_OVER
, #TIP_ROOTS_OVER
, #TIP_LEAVES_OVER
, and #TIP_ROOTS_AND_LEAVES_OVER
, outgoing links of a node may, in rare
cases, cross the neighbor leaf nodes if the overlap percentage is
high. To avoid this, set the parameter to 0
%.
The default value is 30
%, which is a good compromise for
many graphs between wasting space and the risk of having links cross
nodes.
This is an expert option. In all normal cases, it is not necessary to change the option. It is recommended choosing an orthogonal fork percentage that is always larger than the overlap percentage to obtain a good layout.
This option has no effect if the respect node sizes option is disabled.
overlapPercentage : "3.0";
public double parentChildAssociateOffset
If the flow direction is toward the top or bottom, the orthogonal link segment starting at the parent is vertical, and the associates are placed left or right of this link segment. In this case, it is a vertical offset between parent and child. If the flow direction is toward the left or right, the orthogonal link segment starting at the parent is horizontal, and the associates are placed above or below this link segment. In this case, it is a horizontal offset between parent and child.
If the Respect node sizes option is enabled, this is the minimum offset between node borders; otherwise, it is the minimum offset between node centers.
The default value is 30
.
parentChildAssociateOffset : "3.0";
public double parentChildOffset
If the flow direction is towards the top or bottom and the layout mode is not radial or balloon, this is a vertical offset. If the flow direction is towards the left or right and the layout mode is not radial or balloon, this is a horizontal offset. If the layout mode is radial or balloon, this is an offset radial to the circle or ellipses. In balloon mode, it corresponds to the minimal radius of the balloon.
If the respect node sizes option is enabled, this is the minimum offset between node borders; otherwise, it is the minimum offset between node centers.
The default value is 40
.
parentChildOffset : "3.0";
public ilog.views.IlvPoint position
The meaning of the position depends on the flag #isRootPosition()
. If the flag is true
, it specifies
the position of the first root node. This is useful in incremental
mode. If the flag is false
, it specifies the position of
the top-left border of the layout.
If no position is specified, the layout algorithm keeps the position of the first root node unchanged.
position : "10,10";
rootPosition
public boolean recursiveLayoutFromAncestorAllowed
This option is enabled by default.
recursiveLayoutFromAncestorAllowed : "false";
public boolean recursiveLeafLayoutMode
The layout is suited if the nodes and links have no labels that need to be placed around the nodes and links. (Labels in the center of nodes don't cause a problem). The layout may produce suboptimal results if the nodes or links of subgraphs have very long labels that must be placed by a label layout. Since the label layout can only run after the tree layout, it will influence the bounding boxes of the subgraphs after they are already placed, which is the cause for the suboptimal result.
recursiveLeafLayoutMode : "false";
public boolean respectNodeSizes
true
, the spacing parameters are
interpreted as the minimum distance between the node borders. If the
argument is false
, the spacing parameters are
interpreted as the minimum distance between the node centers.
If respecting node sizes is disabled, the level alignment option has no effect.
This is an expert option. The default is true
. It makes
sense to switch this option off only if all nodes already have
approximately the same size and the spacing parameters are larger
than the largest node. If the option is switched off, large nodes may
otherwise overlap. In particular, it is recommended keeping the
option enabled if orthogonal links are used.
respectNodeSizes : "false";
public boolean rootPosition
#getPosition()
. If passed
true
the specified position means the position of the
root node. Otherwise, it means the position of the top-left border of
the layout. This can be used if connected component processing is
disabled, or if the graph is fully connected. It has no effect
otherwise.
rootPosition : "false";
position
public int RootPreference
If a negative value is passed as input, the preference of the node is unspecified. In this case, the algorithm calculates a preference so that for directed trees the canonical root nodes with degree 0 have the highest preference.
RootPreference : "2";
public double siblingOffset
If the flow direction is towards the top or bottom and the layout mode is not radial, this is a horizontal offset. If the flow direction is towards the left or right and the layout mode is not radial, this is a vertical offset. If the layout mode is radial, this is an offset tangential to the circles or ellipses.
This offset has no effect in balloon layout mode. Use the branch offset to control the spacing between all nodes in balloon layout mode.
If the respect node sizes option is enabled, this is the minimum offset between node borders; otherwise, it is the minimum offset between node centers.
The default value is 40
.
siblingOffset : "3.0";
public double SouthSubtreeBlockMargin
The default value is -1, which means no margin.
SouthSubtreeBlockMargin : "3.0";
public double tipOverBranchOffset
If the flow direction is towards the top or bottom, this is a vertical offset. If the flow direction is towards the left or right, this is a horizontal offset.
If the respect node sizes option is enabled, this is the minimum offset between node borders; otherwise, it is the minimum offset between node centers.
The default value is 40
.
tipOverBranchOffset : "3.0";
flowDirection
public double WestSubtreeBlockMargin
The default value is -1, means no margin.
WestSubtreeBlockMargin : "3.0";
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.