public class IlvLinkLayout extends IlvGraphLayout
The Link Layout algorithm reshapes the links of a graph without moving
the nodes. By default, the algorithm computes orthogonal links (that
is, links composed of alternating horizontal and vertical segments).
Optionally, direct links can be computed. See the method #setGlobalLinkStyle(int)
.
The layout algorithm has two modes: short link mode and long link mode. The short link mode places the links freely in the plane by choosing the best shape from a fixed number of link shapes. A link has a maximum of 4 bends. The long link mode searches for routes on a grid by avoiding obstacles. By doing this, any link shape can occur (that is, the number of link shapes is unlimited) but a long link route can have many bends.
The long link mode is slower and uses more memory on very large graphs than the short link mode. The short link mode should be used if any of the following conditions apply:
IlvShortLinkLayout
) directly. Applications that use the long link
mode exclusively can use the Long Link Layout algorithm (IlvLongLinkLayout
) directly.
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:
#setPreserveFixedLinks
is
enabled, or links that have the link style #NO_RESHAPE_STYLE
,
are not reshaped. The incremental mode cannot be used for intergraph
links.SDM {
LinkLayout : true;
}
LinkLayout {
graphLayout : @#layout;
// optional settings for the link layout renderer
}
Subobject#layout {
class : "ilog.views.graphlayout.link.IlvLinkLayout";
allowedTime : "3";
animate : "false";
combinedInterGraphLinksMode : "false";
coordinatesMode : "MANAGER_COORDINATES";
globalDestinationPointMode : "FREE_MODE";
globalLinkStyle : "ORTHOGONAL_STYLE";
globalOriginPointMode : "FREE_MODE";
horizontalGridBase : "3.0";
horizontalGridOffset : "3.0";
horizontalMinOffset : "3.0";
incrementalMode : "false";
interGraphLinksMode : "false";
layoutMode : "LONG_LINKS";
linkOffset : "3.0";
minBusyTime : "3";
minFinalSegmentLength : "3.0";
minNodeCornerOffset : "3.0";
verticalGridBase : "3.0";
verticalGridOffset : "3.0";
verticalMinOffset : "3.0";
}
link.tag {
DestinationPointMode : "FREE_MODE";
LinkStyle : "ORTHOGONAL_STYLE";
OriginPointMode : "FREE_MODE";
}
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.
Additional per-object properties are defined by the LinkLayoutRenderer
(which also inherits the properties defined by the GraphLayoutRenderer
):
IlvLinkLayoutRenderer.
Modifier and Type | Property and Description |
---|---|
long |
allowedTime
Sets the upper limit for the duration of the layout algorithm. |
boolean |
animate
If the argument is true , specifies that layout algorithms
that support the animation mechanism will require the graph model to
redraw the graph after each iteration or step. |
java.lang.String |
class
Default constructor. |
boolean |
combinedInterGraphLinksMode
Enables the routing of normal links in addition to intergraph links. |
int |
coordinatesMode
Sets the coordinates mode to be used during layout. |
int |
DestinationPointMode
Sets the mode for the connection point on an individual link on the destination node. |
int |
globalDestinationPointMode
Sets the global mode for the connection point of the links on the destination nodes. |
int |
globalLinkStyle
Sets the global style of the shapes of links. |
int |
globalOriginPointMode
Sets the global mode for the connection point of the links on the origin nodes. |
double |
horizontalGridBase
Sets the horizontal base coordinate of the grid. |
double |
horizontalGridOffset
Sets the horizontal offset between the grid lines. |
double |
horizontalMinOffset
Sets the minimal horizontal offset between the node border and a link segment that is (vertically) parallel to the node border. |
boolean |
incrementalMode
Enables the incremental layout mode. |
boolean |
interGraphLinksMode
Enables the routing of intergraph links. |
int |
layoutMode
Sets the layout mode. |
double |
linkOffset
Sets the offset between links connected on the same side of the node. |
int |
LinkStyle
Sets the shape style of an individual link. |
long |
minBusyTime
Sets the minimal time that the layout algorithm can be busy. |
double |
minFinalSegmentLength
Sets the minimum length of the first and last segments of each link. |
double |
minNodeCornerOffset
Sets the minimum offset between a node corner and a link starting at this node. |
int |
OriginPointMode
Sets the mode for the connection point on an individual link on the origin node. |
double |
verticalGridBase
Sets the vertical base coordinate of the grid. |
double |
verticalGridOffset
Sets the vertical offset between the grid lines. |
double |
verticalMinOffset
Sets the minimal vertical offset between the node border and a link segment that is (horizontally) parallel to the node border. |
public java.lang.String class
class : "ilog.views.graphlayout.link.IlvLinkLayout";
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 boolean animate
true
, specifies that layout algorithms
that support the animation mechanism will require the graph model to
redraw the graph after each iteration or step.
The default value is false
.
A RuntimeException
is thrown if the layout does not
support this option.
Note that to obtain a redraw of an IlvGrapher
after each
iteration or step, the method #performLayout(boolean, boolean,
boolean)
must be called with the value true
for the
redraw
argument.
animate : "false";
public boolean combinedInterGraphLinksMode
true
, both normal links and intergraph links are routed
in the same pass. Otherwise, only the intergraph links are routed.
The default value is true
.
combinedInterGraphLinksMode : "false";
interGraphLinksMode
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 int DestinationPointMode
#MIXED_MODE
. Otherwise, the connection points
on the destination nodes have, for all the links, the mode that is
specified as the global destination point mode.
Valid values are:
#FREE_MODE
- The layout is free to choose, for this
link, the appropriate position of the connection point on the
destination node, except for "pinned" connection points (see IlvGraphModel#hasPinnedConnectionPoint
).#FIXED_MODE
- The layout must keep, for this link, the
current position of the connection point on the destination node.
This can be useful, in particular, if the node has fixed pins where
the link is attached (as, for instance, with IlvPinLinkConnector
) and the pins should not be moved by the layout
algorithm.
The fixed mode works only if the link connector delivers consistently
the same connection point when called multiple times. If a link is
not connected to a link connector, or if the IlvClippingLinkConnector
is used, the real connection point is
calculated on the fly and may change when called multiple times with
changing link bends. In this case, the fixed mode cannot ensure a
correct routing of the links.
The default value is #FREE_MODE
.
Note that the Link Layout dispatches the call to its sublayouts, the Short Link Layout and the Long Link Layout. Specifying a mode on the Link Layout means that the same mode is specified for both Short and Long Link Layouts.
CSS example:
DestinationPointMode : "FREE_MODE";
Allowed values: | ||
FREE_MODE |
Free | |
FIXED_MODE |
Fixed |
globalDestinationPointMode
public int globalDestinationPointMode
#FREE_MODE
- For all links, the layout is free to choose
the appropriate position of the connection point on the destination
node, except for "pinned" connection points (see IlvGraphModel#hasPinnedConnectionPoint
).#FIXED_MODE
- For all links, the layout must keep the
current position of the connection point on the destination node.
This can be useful, in particular, if the node has fixed pins where
the link is attached (as, for instance, with IlvPinLinkConnector
) and the pins should not be moved by the layout
algorithm.
The fixed mode works only if the link connector delivers consistently
the same connection point when called multiple times. If a link is
not connected to a link connector, or if the IlvClippingLinkConnector
is used, the real connection point is
calculated on the fly and may change when called multiple times with
changing link bends. In this case, the fixed mode cannot ensure a
correct routing of the links.
#MIXED_MODE
- Each link can have a different mode for
the connection point on the destination node. The mode of each
individual link can be set by the method #setDestinationPointMode(Object, int)
.
Unless the global mode is #MIXED_MODE
, the connection points
on the destination node have the same mode for all the links.
The default value is #FREE_MODE
.
Note that the Link Layout dispatches the call to its sublayouts, the
Short Link Layout and the Long Link Layout. Specifying a mode on the
Link Layout means that the same mode is specified for both Short and
Long Link Layouts.
CSS example:
globalDestinationPointMode : "FREE_MODE";
Allowed values: | ||
FREE_MODE |
Free | |
FIXED_MODE |
Fixed | |
MIXED_MODE |
Mixed |
public int globalLinkStyle
#ORTHOGONAL_STYLE
- all links have an orthogonal shape,
that is, a shape consisting of a sequence of alternating horizontal
and vertical line segments.#DIRECT_STYLE
- all links get a nearly straight-line
shape. The shape of the links is a polyline composed of a
straight-line segment between the end nodes with two short horizontal
or vertical segments at its ends (their length is controlled by the
method setMinFinalSegmentLength
and may be
0
).#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 #ORTHOGONAL_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
and link connectors of type
IlvFreeLinkConnector
. Other link or
connector types may cause an IlvInappropriateLinkException
during layout. You can use the method IlvGraphLayoutUtil#EnsureAppropriateLinkTypes
and method IlvGraphLayoutUtil#EnsureAppropriateLinkConnectors
before layout, or
the method IlvGraphLayoutUtil#EnsureAppropriateLinks
when the
exception is caught, to convert all links and link connectors to an
appropriate type.
CSS example:
globalLinkStyle : "ORTHOGONAL_STYLE";
Allowed values: | ||
ORTHOGONAL_STYLE |
Orthogonal links | |
DIRECT_STYLE |
Direct links | |
MIXED_STYLE |
Mixed links |
public int globalOriginPointMode
#FREE_MODE
- For all links, the layout is free to choose
the appropriate position of the connection point on the origin node,
except for "pinned" connection points (see IlvGraphModel#hasPinnedConnectionPoint
).#FIXED_MODE
- For all links, the layout must keep the
current position of the connection point on the origin node. This can
be useful,in particular, if the node has fixed pins where the link is
attached (as, for instance, with IlvPinLinkConnector
) and the
pins should not be moved by the layout algorithm.
The fixed mode works only if the link connector delivers consistently
the same connection point when called multiple times. If a link is
not connected to a link connector, or if the IlvClippingLinkConnector
is used, the real connection point is
calculated on the fly and may change when called multiple times with
changing link bends. In this case, the fixed mode cannot ensure a
correct routing of the links.
#MIXED_MODE
- Each link can have a different mode for
the connection point on the origin node. The mode of each individual
link can be set by the method #setOriginPointMode(Object,
int)
.
Unless the global mode is #MIXED_MODE
, the connection points
on the origin node have the same mode for all the links.
The default value is #FREE_MODE
.
Note that the Link Layout dispatches the call to its sublayouts, the
Short Link Layout and the Long Link Layout. Specifying a mode on the
Link Layout means that the same mode is specified for both Short and
Long Link Layouts.
CSS example:
globalOriginPointMode : "FREE_MODE";
Allowed values: | ||
FREE_MODE |
Free | |
FIXED_MODE |
Fixed | |
MIXED_MODE |
Mixed |
public double horizontalGridBase
x
coordinate of the first vertical grid line. It affects
only the layout mode #LONG_LINKS
where the links are routed
on an orthogonal grid. In the layout mode #SHORT_LINKS
, links
are placed freely and the grid parameters are ignored.
The default value is 0
.
CSS example:
horizontalGridBase : "3.0";
public double horizontalGridOffset
#LONG_LINKS
where the links are routed on an
orthogonal grid. In the layout mode #SHORT_LINKS
, links are
placed freely and the grid parameters are ignored.
The default value is 5
.
horizontalGridOffset : "3.0";
public double horizontalMinOffset
#LONG_LINKS
where the links are routed
on an orthogonal grid. In the layout mode #SHORT_LINKS
, links
are placed freely and the grid parameters are ignored.
The default value is 3
.
CSS example:
horizontalMinOffset : "3.0";
public boolean incrementalMode
true
, only those links that were affected by changes
since the last layout are rerouted. A link is rerouted under the
following conditions:
In short link mode, links already laid out in the last layout keep their general shape (that is keep their number of bends and do not change the side where they connect to the end nodes), except if one or both of their end nodes have been moved or resized.
In long link mode, the rerouted links can change shape completely. The rerouted links can change the side where they are connected to the end nodes if this is necessary to obtain a better route.
The incremental mode works only if the intergraph links mode is disabled or if there are no intergraph links. The incremental mode is disabled by default.
incrementalMode : "false";
public boolean interGraphLinksMode
true
, the intergraph links are routed; otherwise, only
the normal links are routed. An intergraph link is a link stored in a
given graph that has an origin or destination not stored in this
graph. If additionally the combined intergraph link routing is
enabled, this means that normal links and intergraph links are routed
together; otherwise, only the intergraph links are routed.
The default value is true
.
If the intergraph link mode is enabled and the graph actually contains some intergraph links, there are some restrictions:
IlvGrapher
(or
IlvGrapherAdapter
), the top-level grapher must have a
manager view attached because of the coordinate transformations of
the subgraphers. If you create your own subclass of
IlvGraphModel
instead of IlvGrapherAdapter
to route intergraph links, you must ensure that all graph models of
all subgraphers use the same coordinate system through appropriate
coordinate transformations.interGraphLinksMode : "false";
public int layoutMode
#SHORT_LINKS
- Links are placed freely in the plane by
choosing the best shape from a fixed number of link shapes. A link
can have a maximum of 4 bends. #LONG_LINKS
- Orthogonal links are routed on a grid by
avoiding obstacles. Any orthogonal link shape can occur (that is, the
number of link shapes is not limited) but a long link route can have
many bends. Direct links are routed with the end segments on the
grid, but the middle segment may overlap obstacles.
The default value is #SHORT_LINKS
.
layoutMode : "LONG_LINKS";
Allowed values: |
LONG_LINKS |
SHORT_LINKS |
public double linkOffset
#SHORT_LINKS
where the links
are placed freely. In the layout mode #LONG_LINKS
, the link
offset parameter is ignored, because the offset between links is
implicitly determined by the grid width.
The default value is 2
.
linkOffset : "3.0";
public int LinkStyle
#MIXED_STYLE
.
Otherwise, all links have the style that is specified as the global
link style.
Valid values are:
#ORTHOGONAL_STYLE
- the link has an orthogonal shape,
that is, a shape consisting of a sequence of alternating horizontal
and vertical line segments.#DIRECT_STYLE
- the link gets a nearly straight-line
shape. The shape of the link is a polyline composed of a
straight-line segment between the end nodes with two short horizontal
or vertical segments at its ends (their length is controlled by the
method setMinFinalSegmentLength
and may be
0
).#NO_RESHAPE_STYLE
- the link is not reshaped.
The default value is #ORTHOGONAL_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
and link connectors of type
IlvFreeLinkConnector
. Other link or
connector types may cause an IlvInappropriateLinkException
during layout. You can use the method IlvGraphLayoutUtil#EnsureAppropriateLinkTypes
and method IlvGraphLayoutUtil#EnsureAppropriateLinkConnectors
before layout, or
the method IlvGraphLayoutUtil#EnsureAppropriateLinks
when the
exception is caught, to convert all links and connectors to an
appropriate type.
Note also that the Link Layout dispatches the call to its sublayouts, the Short Link Layout and the Long Link Layout. Specifying a link style on the Link Layout means that the same style is specified for both Short and Long Link Layouts.
CSS example:
LinkStyle : "ORTHOGONAL_STYLE";
Allowed values: | ||
ORTHOGONAL_STYLE |
Orthogonal links | |
DIRECT_STYLE |
Direct links |
globalLinkStyle
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 double minFinalSegmentLength
The default value is 10
.
CSS example:
minFinalSegmentLength : "3.0";
public double minNodeCornerOffset
0
enables the layout to start
a link exactly at a node corner. It affects only the layout mode
#LONG_LINKS
where the links are routed on an orthogonal grid
and always connect to the node border. In the layout mode #SHORT_LINKS
, links are placed freely in the plane, potentially
connecting outside the node border.
The default value is 3
.
CSS example:
minNodeCornerOffset : "3.0";
public int OriginPointMode
#MIXED_MODE
. Otherwise, the connection points on the
origin nodes have, for all the links, the mode that is specified as
the global origin point mode.
Valid values are:
#FREE_MODE
- The layout is free to choose, for this
link, the appropriate position of the connection point on the origin
node, except for "pinned" connection points (see IlvGraphModel#hasPinnedConnectionPoint
).#FIXED_MODE
- The layout must keep, for this link, the
current position of the connection point on the origin node. This can
be useful, in particular, if the node has fixed pins where the link
is attached (as, for instance, with IlvPinLinkConnector
) and
the pins should not be moved by the layout algorithm.
The fixed mode works only if the link connector delivers consistently
the same connection point when called multiple times. If a link is
not connected to a link connector, or if the IlvClippingLinkConnector
is used, the real connection point is
calculated on the fly and may change when called multiple times with
changing link bends. In this case, the fixed mode cannot ensure a
correct routing of the links.
The default value is #FREE_MODE
.
Note that the Link Layout dispatches the call to its sublayouts, the Short Link Layout and the Long Link Layout. Specifying a mode on the Link Layout means that the same mode is specified for both Short and Long Link Layouts.
CSS example:
OriginPointMode : "FREE_MODE";
Allowed values: | ||
FREE_MODE |
Free | |
FIXED_MODE |
Fixed |
globalOriginPointMode
public double verticalGridBase
y
coordinate of the first horizontal grid line. It
affects only the layout mode #LONG_LINKS
where the links are
routed on an orthogonal grid. In the layout mode #SHORT_LINKS
, links are placed freely and the grid parameters are
ignored.
The default value is 0
.
CSS example:
verticalGridBase : "3.0";
public double verticalGridOffset
#LONG_LINKS
where the links are routed on an
orthogonal grid. In the layout mode #SHORT_LINKS
, links are
placed freely and the grid parameters are ignored.
The default value is 5
.
CSS example:
verticalGridOffset : "3.0";
public double verticalMinOffset
#LONG_LINKS
where the links are
routed on an orthogonal grid. In the layout mode #SHORT_LINKS
, links are placed freely and the grid parameters are
ignored.
The default value is 3
.
CSS example:
verticalMinOffset : "3.0";
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.