public class IlvLongLinkLayout extends IlvGraphLayout
The Long Link Layout algorithm reshapes the links of a graph without moving the nodes. It is specialized to route long orthogonal links on a grid without overlapping nodes. It uses a classical path search mechanism and an additional crossing reduction phase. It can be used to find an orthogonal route without overlaps in a labyrinth of node obstacles.
Optionally, direct links can be computed, which, however, may overlap
nodes. See the method #setGlobalLinkStyle(int)
.
This layout algorithm is recommended if any of the following conditions apply:
IlvShortLinkLayout
may be more
suitable.
Here are sample drawings produced by the Long Link Layout:
The long link mode can be used to find a route through a labyrinth:
Note the following points:
SDM {
LinkLayout : true;
}
LinkLayout {
graphLayout : @#layout;
// optional settings for the link layout renderer
}
Subobject#layout {
class : "ilog.views.graphlayout.link.longlink.IlvLongLinkLayout";
allowedTime : "3";
allowedTimePerLink : "3";
animate : "false";
combinedInterGraphLinksMode : "false";
coordinatesMode : "MANAGER_COORDINATES";
crossingReductionEnabled : "false";
exhaustiveSearching : "false";
fallbackRouteEnabled : "false";
globalDestinationPointMode : "FREE_MODE";
globalLinkStyle : "ORTHOGONAL_STYLE";
globalOriginPointMode : "FREE_MODE";
horizontalGridBase : "3.0";
horizontalGridOffset : "3.0";
horizontalMinOffset : "3.0";
incrementalConnectionPreserving : "false";
incrementalMode : "false";
interGraphLinksMode : "false";
linkObstacleEnabled : "false";
maxBacktrack : "2";
minBusyTime : "3";
minEndSegmentLength : "3.0";
minNodeCornerOffset : "3.0";
minStartSegmentLength : "3.0";
nodeObstacleEnabled : "false";
numberCrossingReductionIterations : "2";
straightRouteEnabled : "false";
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. |
long |
allowedTimePerLink
Sets the upper limit for the time allowed to find a route for a long link. |
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
Sets the routing of normal links in addition to intergraph links. |
int |
coordinatesMode
Sets the coordinates mode to be used during layout. |
boolean |
crossingReductionEnabled
Sets the crossing reduction. |
int |
DestinationPointMode
Sets the mode for the connection point of an individual link on the destination node. |
boolean |
exhaustiveSearching
Sets the exhaustive searching of routes for links. |
boolean |
fallbackRouteEnabled
Sets whether the fallback routing algorithm is enabled. |
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 minimum horizontal offset between the node border and a link segment that is (vertically) parallel to the node border. |
boolean |
incrementalConnectionPreserving
Sets whether the incremental layout mode preserves the side and relative order of the link connection points. |
boolean |
incrementalMode
Sets the incremental layout mode. |
boolean |
interGraphLinksMode
Sets the routing of intergraph links. |
boolean |
linkObstacleEnabled
Sets whether links should be line obstacles for the link routes. |
int |
LinkStyle
Sets the style for the shape of an individual link. |
int |
maxBacktrack
Sets the maximum number of backtrack steps to find a route for a long link. |
long |
minBusyTime
Sets the minimal time that the layout algorithm can be busy. |
double |
minEndSegmentLength
Sets the minimum length of the last segment of each link, that is, the segment incident to the "to" node. |
double |
minNodeCornerOffset
Sets the minimum offset between a node corner and a link starting at this node. |
double |
minStartSegmentLength
Sets the minimum length of the first segment of each link, that is, the segment incident to the "from" node. |
boolean |
nodeObstacleEnabled
Sets whether nodes should be obstacles for the link routes. |
int |
numberCrossingReductionIterations
Sets the maximum number of iterations performed during crossing reduction. |
int |
OriginPointMode
Sets the mode for the connection point on an individual link on the origin node. |
boolean |
straightRouteEnabled
Sets the straight routing. |
double |
verticalGridBase
Sets the vertical base coordinate of the grid. |
double |
verticalGridOffset
Sets the vertical offset between the grid lines. |
double |
verticalMinOffset
Sets the minimum 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.longlink.IlvLongLinkLayout";
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 long allowedTimePerLink
The default value is 2000
(2 seconds).
Note that the specified time is valid for each single link, that is, the maximum time to find routes for all links is approximately the specified time per link multiplied by the number of links. However, this happens only extremely seldom. The algorithm will most likely find a route for the majority of the links before the time elapses; therefore, the average time to find routes for all links is much smaller.
If the specified time elapsed for a link and the fallback routing is enabled, the link is quickly routed by the fallback mechanism instead.
allowedTimePerLink : "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 boolean crossingReductionEnabled
Crossing reduction is enabled by default.
crossingReductionEnabled : "false";
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(Object, boolean)
).#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
.
DestinationPointMode : "FREE_MODE";
Allowed values: | ||
FREE_MODE |
Free | |
FIXED_MODE |
Fixed |
globalDestinationPointMode
public boolean exhaustiveSearching
Exhaustive searching is disabled by default.
exhaustiveSearching : "false";
public boolean fallbackRouteEnabled
This routing algorithm is used for those links that cannot be routed on the grid without overlapping other obstacles (nodes or links). If it is disabled, then these fallback links remain unrouted.
The default is true
.
fallbackRouteEnabled : "false";
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(Object, boolean)
).#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
.
globalDestinationPointMode : "FREE_MODE";
Allowed values: | ||
FREE_MODE |
Free | |
FIXED_MODE |
Fixed | |
MIXED_MODE |
Mixed |
public int globalLinkStyle
#ORTHOGONAL_STYLE
- all links get 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
#setMinStartSegmentLength(double)
and #setMinEndSegmentLength(double)
and may be 0). In this link style,
links may overlap nodes.#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 style of shape.
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.
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(Object, boolean)
).#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
.
globalOriginPointMode : "FREE_MODE";
Allowed values: | ||
FREE_MODE |
Free | |
FIXED_MODE |
Fixed | |
MIXED_MODE |
Mixed |
public double horizontalGridBase
The default value is 0
.
horizontalGridBase : "3.0";
public double horizontalGridOffset
The default value is 5
.
horizontalGridOffset : "3.0";
public double horizontalMinOffset
The default value is 3
.
horizontalMinOffset : "3.0";
public boolean incrementalConnectionPreserving
false
.
incrementalConnectionPreserving : "false";
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:
#setIncrementalConnectionPreserving(boolean)
.
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 the combined intergraph link routing is enabled in
additional, 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 boolean linkObstacleEnabled
The default is true
. There are, however, situations
where it may be suitable to consider a set of obstacles different
from the links. In this case you can switch links as obstacles off
and use the methods #addLineObstacle(ilog.views.IlvRect)
and
#addLineObstacle(ilog.views.IlvPoint, ilog.views.IlvPoint)
to
specify the obstacles that are needed.
linkObstacleEnabled : "false";
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 gets 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
#setMinStartSegmentLength(double)
and #setMinEndSegmentLength(double)
and may be 0). In this link style,
links may overlap nodes.#NO_RESHAPE_STYLE
- the link is not reshaped.
The default value is #ORTHOGONAL_STYLE
.
When the graph attached to the layout is of type IlvGrapher
,
the effect of link reshaping depends on the type of links and the
connectors installed at the node. For all link styles, you are
recommended to use 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 methods IlvGraphLayoutUtil#EnsureAppropriateLinkTypes
and IlvGraphLayoutUtil#EnsureAppropriateLinkConnectors
before layout, or
the method IlvGraphLayoutUtil#EnsureAppropriateLinks
when the
exception is caught, to convert all links and connectors to an
appropriate type.
LinkStyle : "ORTHOGONAL_STYLE";
Allowed values: | ||
ORTHOGONAL_STYLE |
Orthogonal links | |
DIRECT_STYLE |
Direct links |
globalLinkStyle
public int maxBacktrack
Decreasing the value causes the algorithm to give up earlier without result. If the "from" point and "to" point are fixed, this speeds up the search. Otherwise, the time behavior is more complex, so it may speed up or slow down the search.
The default value is 30000
.
If the maximum number of backtrack steps is exceeded and the fallback routing is enabled, the link is quickly routed by the fallback mechanism instead.
maxBacktrack : "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 double minEndSegmentLength
The default value is 10
.
minEndSegmentLength : "3.0";
public double minNodeCornerOffset
0
enables the layout to start
a link exactly at a node corner.
The default value is 3
.
minNodeCornerOffset : "3.0";
public double minStartSegmentLength
The default value is 10
.
minStartSegmentLength : "3.0";
public boolean nodeObstacleEnabled
true
. There are, however, situations where it
may be suitable to consider a set of obstacles different from the
nodes. In this case you can switch nodes as obstacles off and use the
method #addRectObstacle(IlvRect)
to specify the obstacles
that are needed.
nodeObstacleEnabled : "false";
public int numberCrossingReductionIterations
The default value is 2
.
numberCrossingReductionIterations : "2";
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(Object, boolean)
).#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
.
OriginPointMode : "FREE_MODE";
Allowed values: | ||
FREE_MODE |
Free | |
FIXED_MODE |
Fixed |
globalOriginPointMode
public boolean straightRouteEnabled
Straight routing is enabled by default.
straightRouteEnabled : "false";
public double verticalGridBase
The default value is 0
.
verticalGridBase : "3.0";
public double verticalGridOffset
The default value is 5
.
verticalGridOffset : "3.0";
public double verticalMinOffset
The default value is 3
.
verticalMinOffset : "3.0";
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.