public class IlvLinkLayoutRenderer extends IlvGraphLayoutRenderer
IlvLinkLayoutRenderer
is a subclass
of IlvGraphLayoutRenderer
that is specialized for
link layout.
It applies a layout algorithm that routes the links of the graph,
leaving the node positions unchanged.
The layout algorithm used can be either a normal link layout
with NodeSideFilter
enabled,
or a hierarchical layout configured to only route the links.
Normal link layouts are
IlvLinkLayout
,
IlvShortLinkLayout
, and
IlvLongLinkLayout
.
By default, an IlvLinkLayout
is used.
A hierarchical layout can only be used if a graph layout
renderer is installed that uses an instance of
IlvHierarchicalLayout
for graph layout. (The graph layout renderer can be either enabled or
disabled, see IlvGraphLayoutRenderer#setEnabled(boolean)
.)
In this case, this instance is reused but for the purpose of the link
layout renderer configured to only route the links. To use the hierarchical
layout, you must call setHierarchical(true)
.
The renderer defines two rendering properties on nodes and links
(in addition to any node and link properties defined by the layout algorithm
itself; see IlvGraphLayoutRenderer
for explanations):
NodeSideForOrigin
, which requests the layout algorithm
to attach the link to the specified side of the origin node.NodeSideForDestination
, which requests the layout algorithm
to attach the link to the specified side of the destination node.Top
, Bottom
,
Left
, Right
, Horizontal
,
Vertical
, or Any
(default). For example, a
specification for a link in the style sheet such as NodeSideForDestination:
Horizontal;
means the link should arrive at the left side or the
right side of the node. If the property is defined on a node, it holds
for any link that connects to this node. If the property is defined on
a link, it holds for any node to which the link is connected. If the
property is defined on both a link and the node to which the link is
connected, the property defined on the link is taken into account.
Note:
these properties are only effective for normal link layout algorithms.
If an IlvHierarchicalLayout
layout is used, you must use the
specific properties of this algorithm that control the way links are connected.
Examples of this are:
ilog.views.graphlayout.hierarchical.IlvHierarchicalLayout#setFromPortSide
ilog.views.graphlayout.hierarchical.IlvHierarchicalLayout#setToPortSide
Warning: Using the NodeSideFilter
constraints reduces
the degree of freedom of the layout to choose the link shapes. Using this
filter may create additional link bends and crossings.
CSS example:
LinkLayout {
addingLinkConnectors : "false";
alias : "<value>";
connectingLinksToShape : "false";
constraintsURL : "url(spec)";
enabled : "false";
ensureAppropriateLinks : "false";
ensureModelOrdering : "false";
graphLayout : "@#shortLinkLayout";
graphLayoutExceptionPassedOn : "false";
hierarchical : "false";
linkConnectorMode : "CENTER";
partialLayout : "false";
performingLayoutOnZoom : "false";
rotationAngle : "3.0";
rotationTransformer : "0.3, 0.5, 0.5, 0.3, 0.5, 0.5";
savingNodePositions : "false";
useOldLinkRoutesInHierarchical : "false";
usePerObjectParameters : "false";
}
Subobject#shortLinkLayout {
class : "ilog.views.graphlayout.link.shortlink.IlvShortLinkLayout";
}
Modifier and Type | Property and Description |
---|---|
boolean |
addingLinkConnectors
Deprecated.
Since JViews 6.0, use
IlvGraphLayoutRenderer.ensureAppropriateLinks . |
java.lang.String |
alias
Sets the alias of this renderer. |
boolean |
connectingLinksToShape
Specifies whether the graph layout algorithm should connect the links to the shape of the nodes or to the global bounding box of the nodes. |
java.net.URL |
constraintsURL
Sets the URL that specifies the layout constraints. |
boolean |
enabled
Enables or disables the graph layout algorithm. |
boolean |
ensureAppropriateLinks
Sets whether the renderer automatically makes sure that appropriate links and link connectors are used when needed. |
boolean |
ensureModelOrdering
Specifies that the graphic nodes and links should be ordered during graph layout in the same order as the corresponding SDM model objects. |
IlvGraphLayout |
graphLayout
Sets the graph layout algorithm that this renderer will apply to the grapher. |
boolean |
graphLayoutExceptionPassedOn
Sets whether the graph layout exception is passed on. |
boolean |
hierarchical
Configures this link layout renderer to use the same hierarchical layout algorithm as the one used to position the nodes of the graph. |
int |
linkConnectorMode
Sets the link connector mode. |
boolean |
partialLayout
Enables or disables the partial layout mode of the layout. |
boolean |
performingLayoutOnZoom
Specifies whether the layout algorithm should be applied every time the transformer of the reference view changes, or only when the data is initially rendered. |
double |
rotationAngle
Sets the rotation angle of the graph model. |
ilog.views.IlvTransformer |
rotationTransformer
Sets the rotation transformer of the graph model. |
boolean |
savingNodePositions
Specifies whether the positions of the nodes, as computed by the graph layout algorithm, will be saved to the data model, or if the data model will be left unchanged. |
boolean |
useOldLinkRoutesInHierarchical
Sets whether this link layout renderer, when using the hierarchical layout, keeps the old link routes before starting the hierarchical layout. |
boolean |
usePerObjectParameters
Enables or disables per-object layout parameters. |
public boolean addingLinkConnectors
IlvGraphLayoutRenderer.ensureAppropriateLinks
.addingLinkConnectors : "false";
public java.lang.String alias
SubGraph
or GraphLayout
.
alias : "<value>";
public boolean connectingLinksToShape
Some nodes (for example, the IlvGeneralNode
)
have a basic shape and a label that may be outside the shape. If this method is
called with a true
parameter, the links will be connected to
the shape, and the label will not be considered part of the node. If the
method is called with a false
parameter, the links will be
connected to the global bounding rectangle of the node, that is,
the union of the shape's bounding rectangle and the label's bounding rectangle.
The bounding rectangle of the shape is the rectangle returned by the
ilog.views.sdm.renderer.IlvSDMRenderer#getLinkConnectionRectangle
.
The global bounding rectangle of the node is the rectangle returned by the
IlvGraphic.boundingBox(ilog.views.IlvTransformer)
.
CSS example:
connectingLinksToShape : "false";
public java.net.URL constraintsURL
constraintsURL : "url(spec)";
public boolean enabled
enabled : "false";
public boolean ensureAppropriateLinks
ilog.views.graphic.IlvPolylineLinkImage
and subclasses of IlvFreeLinkConnector
are suitable for
all layout algorithms.
If layout cannot be performed because an inappropriate link or link connector is detected, then the following happens:
IlvInappropriateLinkException
is thrown.
ilog.views.graphic.IlvPolylineLinkImage
, and the inappropriate link connectors
are replaced by instances of IlvSDMFreeLinkConnector
.
Then layout is performed.
ensureAppropriateLinks : "false";
public boolean ensureModelOrdering
The option is enabled by default. Only when the option is disabled, it is
possible to specify a node or link comparator.
CSS example:
ensureModelOrdering : "false";
public IlvGraphLayout graphLayout
graphLayout : "@#shortLinkLayout";
Subobject#shortLinkLayout {
class : "ilog.views.graphlayout.link.shortlink.IlvShortLinkLayout";
}
Allowed values: | ||
Circular |
new ilog.views.graphlayout.circular.IlvCircularLayout() | |
Grid |
new ilog.views.graphlayout.grid.IlvGridLayout() | |
Hierarchical |
new ilog.views.graphlayout.hierarchical.IlvHierarchicalLayout() | |
Random |
new ilog.views.graphlayout.random.IlvRandomLayout() | |
SpringEmbedder |
new ilog.views.graphlayout.springembedder.IlvSpringEmbedderLayout() | |
TopologicalMesh |
new ilog.views.graphlayout.topologicalmesh.IlvTopologicalMeshLayout() | |
Tree |
new ilog.views.graphlayout.tree.IlvTreeLayout() | |
UniformLengthEdges |
new ilog.views.graphlayout.uniformlengthedges.IlvUniformLengthEdgesLayout() |
public boolean graphLayoutExceptionPassedOn
IlvGraphLayoutException
are passed to the outside as runtime exceptions. If disabled, the
exceptions are caught and handled internally.
This option is disabled by default.
It is useful only for debugging purpose to pass on the graph layout
exception.
Independently of whether the exception is passed on or not, the exception
is logged at the logger "ilog.views.sdm.renderer.graphlayout".
graphLayoutExceptionPassedOn : "false";
public boolean hierarchical
Beginning with JViews 5.5, the IlvHierarchicalLayout
algorithm is able to only route the links of the graph, leaving
the positions of the node unchanged. This method lets you use
this feature easily. For example, here are the rules to put
in the style sheet to use the same hierarchical layout algorithm
for positioning the nodes and routing the links:
SDM { GraphLayout : "Hierarchical"; LinkLayout : "true"; } GraphLayout { flowDirection : "Bottom"; globalLinkStyle : "ORTHOGONAL_STYLE"; } LinkLayout { hierarchical : "true"; }
Notes:
IlvLinkLayout
).
globalLinkStyle
in the example shown) must still be set in the GraphLayout
rule of the style
sheet, even though the hierarchical graph layout object is also used by the LinkLayout renderer.
hierarchical : "false";
IlvHierarchicalLayout
,
IlvGraphLayoutRenderer
public int linkConnectorMode
IlvStyleSheetRenderer#CENTER
-
Link connector mode: Use IlvSDMLinkConnector
for all nodes.
The links will be connected to the node center.
IlvStyleSheetRenderer#FREE
-
Link connector mode: Use IlvSDMFreeLinkConnector
for all nodes.
The links will be connected to the node border.
IlvStyleSheetRenderer#CLIP
-
Use IlvSDMClippingLinkConnector
for all nodes.
The links will point to the node but end on the outline of
the shape of the node. How the outline of a node is calculated
depends on the implementation of
IlvGraphic#getIntersectionWithOutline
.
IlvStyleSheetRenderer#setLinkConnectorMode
.
linkConnectorMode : "CENTER";
Allowed values: | ||
CENTER |
Link connector mode: Use IlvSDMLinkConnector for all nodes.
The links will be connected to the center of the rectangle
returned by #getLinkConnectionRectangle . |
|
FREE |
Link connector mode: Use IlvSDMFreeLinkConnector for all nodes.
The links will be connected to the border of the rectangle
returned by #getLinkConnectionRectangle . |
|
CLIP |
Link connector mode: Use IlvSDMClippingLinkConnector for all nodes.
The links will point to the the rectangle returned by
#getLinkConnectionRectangle but end on the outline of the shape
of the node. How the outline of a node is calculated depends on the
implementation of IlvGraphic#getIntersectionWithOutline . |
public boolean partialLayout
true
, and objects are selected,
all the nodes except the selected nodes are marked as fixed, so that the
layout is applied only on the selected nodes.
partialLayout : "false";
public boolean performingLayoutOnZoom
performingLayoutOnZoom : "false";
public double rotationAngle
IlvRotatedGraphModel
that rotates all coordinates by
the specific angle.
The bounding box of nodes remains upright despite of the rotation.
Specifying a rotation angle is only suitable for flat graphs.
It is not suitable for nested graphs with intergraph links, since those
are routed incorrectly when a rotation is specified.
When using a rotation angle, it is recommended to the the link
connector mode to IlvStyleSheetRenderer#CLIP
, otherwise the
links do not end at the nodes.
Rotation works well with most layout styles on flat graphs. It does not work well with Bus Layout and Long Link Layout since those layouts are not fully rotatable.
Setting the rotation angle modifies the rotation transformer.
CSS example:
rotationAngle : "3.0";
public ilog.views.IlvTransformer rotationTransformer
null
, the renderer uses
a IlvRotatedGraphModel
that transform all coordinates.
The bounding box of nodes remains upright despite of the rotation.
Specifying a rotation transformer is only suitable for flat graphs.
It is not suitable for nested graphs with intergraph links, since those
are routed incorrectly when a rotation transformer is specified.
When using a rotation transformer, it is recommended to the the link
connector mode to IlvStyleSheetRenderer#CLIP
, otherwise the
links do not end at the nodes.
Rotation works well with most layout styles on flat graphs. It does
not work well with Bus Layout and Long Link Layout since those layouts
are not fully rotatable.
CSS example:
rotationTransformer : "0.3, 0.5, 0.5, 0.3, 0.5, 0.5";
public boolean savingNodePositions
savingNodePositions : "false";
public boolean useOldLinkRoutesInHierarchical
IlvHierarchicalLayout#setLongLinkCrossingReductionDuringIncremental
is disabled, the hierarchical layout tries to respect the old link routes
for long links. In this case, it is useful to enable
the use of old link routes in hierarchical layout.
This mode has no effect when the hierarchical mode is disabled.
CSS example:
useOldLinkRoutesInHierarchical : "false";
hierarchical
public boolean usePerObjectParameters
This method can be used to disable or re-enable the mechanism that sets per-node or per-link parameters, as explained in the class description.
By default, per-object parameters are enabled. You can
disable them if you are sure that your style sheet does not
use any per-object layout parameters. Disabling per-object
parameters speeds up the SDM rendering process.
CSS example:
usePerObjectParameters : "false";
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.