public class IltShortLinkLayout extends IlvGraphLayout
This class is an extended version of the Perforce JViews IlvShortLinkLayout
class.
It supports specifications for link connection ports on every node, and
of a set of allowed link connection ports for every link end.
This 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 methods setGlobalLinkStyle(int)
and
setLinkStyle(java.lang.Object, int)
.)
The links are placed freely in the plane by choosing the best shape from a fixed number of link shapes. Orthogonal links can a maximum of 3 bends. Direct links have 3 bends.
This layout algorithm is recommended when any of the following apply:
Here are sample drawings produced by the Short Link Layout algorithm:
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:
IlvGraphLayout.setPreserveFixedLinks(boolean)
is
enabled or links that have the link style NO_RESHAPE_STYLE
are not reshaped.
The incremental mode cannot be used for intergraph links.Modifier and Type | Field and Description |
---|---|
static int |
DIRECT_STYLE
Direct link style option.
|
static int |
FIRST_LAST_SEGMENT
Simple link bundles option.
|
static int |
IMPROVED_FIRST_LAST_SEGMENT
Improved link bundles option.
|
static int |
MIXED_STYLE
Mixed link shape option.
|
static int |
NO_BUNDLE
No link bundles option.
|
static int |
NO_RESHAPE_STYLE
No reshape link style option.
|
static int |
ORTHOGONAL_STYLE
Orthogonal link style option.
|
static int |
THREE_BENDS_ORTHOGONAL_STYLE
Three-bends self-link option.
|
static int |
TWO_BENDS_ORTHOGONAL_STYLE
Two-bends self-link option.
|
INVERSE_VIEW_COORDINATES, MANAGER_COORDINATES, VIEW_COORDINATES
Constructor and Description |
---|
IltShortLinkLayout()
Creates a new instance of the Short Link Layout algorithm.
|
IltShortLinkLayout(IltShortLinkLayout source)
Creates a new layout instance by copying an existing one.
|
Modifier and Type | Method and Description |
---|---|
int |
checkAppropriateLink(Object link)
Checks whether the input link is appropriate for this layout.
|
void |
checkAppropriateLinks()
Throws an exception if the links are not appropriate for the layout.
|
void |
cleanLink(IlvGraphModel graphModel,
Object link)
Cleans a link.
|
void |
cleanNode(IlvGraphModel graphModel,
Object node)
Cleans a node.
|
void |
contentsChanged(GraphModelEvent event)
Overridden version of the base class method to allow the layout to
be automatically restarted each time the layout instance is notified
that the structure or the geometry of the graph has changed.
|
IlvGraphLayout |
copy()
Copies the layout instance.
|
void |
copyParameters(IlvGraphLayout source)
Copies the parameters from a given layout instance.
|
protected IlvGraphLayoutGrapherProperty |
createLayoutGrapherProperty(String name,
boolean withDefaults)
Returns a new instance of
IltShortLinkLayoutGrapherProperty
that stores the parameter settings of this layout class. |
protected IlvGraphLayoutLinkProperty |
createLayoutLinkProperty(String name,
IlvGraphic link,
boolean withDefaults)
Returns a new instance of
IltShortLinkLayoutLinkProperty
that stores the parameter settings of this layout class for links. |
void |
detach()
Detaches the graph model from the layout instance.
|
int |
getAllowedNumberOfIterations()
Returns the maximum number of allowed optimization iterations.
|
double |
getBypassDistance()
Returns the minimum distance between the origin and
destination node for which a link shape going directly from
one node to another is allowed.
|
int |
getGlobalLinkStyle()
Returns the current choice for the style of the shape of the links.
|
int |
getGlobalSelfLinkStyle()
Returns the current choice for the style of the shape of the self-links.
|
int |
getLinkBundlesMode()
Returns the current choice for the link bundles mode.
|
double |
getLinkOffset()
Returns the offset between links connected on the same side of the
node.
|
int |
getLinkStyle(Object link)
Returns the style of the shape of an individual link.
|
float |
getLinkToLinkCrossingPenalty()
Returns the link-to-link crossing penalty factor.
|
float |
getLinkToNodeCrossingPenalty()
Returns the link-to-node crossing penalty factor.
|
double |
getMinFinalSegmentLength()
Returns the minimum length of the final segment of the links.
|
IlvNodeBoxInterface |
getNodeBoxInterface()
Returns the object that provides the rectangle defining
the position and size of each node.
|
IltNodeSideFilter |
getNodeSideFilter()
Returns the object that allows or prohibits the connection of
the links on a given side of the nodes, if one is specified
using the method
setNodeBoxInterface(ilog.views.graphlayout.IlvNodeBoxInterface) . |
protected void |
init()
Initializes instance variables.
|
void |
initProperties(String prefix,
int uniqId)
Initializes local properties of this layout class.
|
boolean |
isCombinedInterGraphLinksMode()
Returns
true if the routing of normal links in addition to
intergraph links is enabled. |
boolean |
isIncrementalMode()
Returns
true if the incremental mode is enabled. |
boolean |
isInterGraphLinksMode()
Returns
true if the routing of intergraph links is enabled. |
boolean |
isSameShapeForMultipleLinks()
Returns
true if the algorithm that ensures that multiple
links are reshaped in the same manner is enabled, and false
otherwise. |
protected void |
layout(boolean redraw)
Computes the layout using the Short Link Layout algorithm.
|
protected void |
performAutoLayout()
Performs the layout again following a structural or a geometric change of
the graph.
|
void |
setAllowedNumberOfIterations(int iterations)
Allows you to specify the maximum number of iterations of the layout
algorithm.
|
void |
setAutoLayout(boolean enable)
Enables the auto layout mode.
|
void |
setBypassDistance(double dist)
Allows you to specify the minimum distance between the origin and
destination node for which a link shape going directly from
one node to another is allowed.
|
void |
setCombinedInterGraphLinksMode(boolean enable)
Enables the routing of normal links in addition to intergraph links.
|
void |
setGlobalLinkStyle(int style)
Sets the global style of the shape of the links.
|
void |
setGlobalSelfLinkStyle(int style)
Sets the global style of the shape of the self-links.
|
void |
setIncrementalMode(boolean enable)
Enables the incremental layout mode.
|
void |
setInterGraphLinksMode(boolean enable)
Enables the routing of intergraph links.
|
void |
setLinkBundlesMode(int mode)
Allows you to specify the link bundles mode.
|
void |
setLinkConnectionBoxInterface(IlvLinkConnectionBoxInterface connectionBoxInterface)
Allows you to specify a link connection box interface for the connection
points of links.
|
void |
setLinkOffset(double offset)
Allows you to specify the offset between links connected on the same side
of the node.
|
void |
setLinkStyle(Object link,
int style)
Sets the style of the shape of an individual link.
|
void |
setLinkToLinkCrossingPenalty(float penalty)
Sets the link-to-link crossing penalty factor.
|
void |
setLinkToNodeCrossingPenalty(float penalty)
Sets the link-to-node crossing penalty factor.
|
void |
setMinFinalSegmentLength(double length)
Allows you to specify the minimum length of the final (first and last)
segment of the links.
|
void |
setNodeBoxInterface(IlvNodeBoxInterface nodeBoxInterface)
Allows you to specify an object that provides the rectangle
that defines the position and size of each node.
|
void |
setNodeSideFilter(IltNodeSideFilter filter)
Allows you to specify an object that allows or prohibits the connection of
the links on a given side of the nodes.
|
void |
setSameShapeForMultipleLinks(boolean option)
Allows you to specify whether the layout algorithm must ensure that
all multiple links have the same shape.
|
boolean |
stopImmediately()
Overridden version of the base class method.
|
boolean |
supportsAllowedTime()
Indicates that this layout class can stop the layout
computation in the proper manner when the user-defined allowed time
is exceeded.
|
boolean |
supportsAnimation()
Indicates that this layout class supports the animation mechanism;
that is, it performs a redraw of the grapher after each iteration if the
method
setAnimate(boolean) is called with a
true argument. |
boolean |
supportsLinkConnectionBox()
Indicates that this layout class can use a link connection box
interface to calculate the end points of a link.
|
boolean |
supportsPreserveFixedLinks()
Indicates that this layout class allows the user to specify
fixed links.
|
boolean |
supportsSaveParametersToNamedProperties()
Indicates that this layout class can transfer the layout
parameters to named properties.
|
boolean |
supportsStopImmediately()
Indicates that this layout class can interrupt the current run
of the layout immediately in a controlled way.
|
addGraphLayoutEventListener, addGraphLayoutParameterEventListener, afterLayoutOfSubgraph, attach, attach, beforeLayout, beforeLayoutOfSubgraph, callLayoutStepPerformedIfNeeded, cleanGraphModel, clipAllLinks, clipLink, connectAllLinksToCenter, connectLinkToCenter, createLayoutNodeProperty, createLayoutReport, getAllowedTime, getAutoLayoutHandler, getBalanceSplineCurveThreshold, getCalcLayoutRegion, getCoordinatesMode, getGrapher, getGraphModel, getInstanceId, getLayout, getLayoutOfConnectedComponents, getLayoutOfConnectedComponentsReport, getLayoutRegion, getLayoutReport, getLayouts, getLinkClipInterface, getLinkConnectionBoxInterface, getMaxSplineCurveSize, getMinBusyTime, getMinSplineCurveSize, getMovingNodes, getParentLayout, getProperty, getProperty, getRecursiveLayout, getRemainingAllowedTime, getSeedValueForRandomGenerator, getSpecLayoutRegion, getSplineLinkFilter, increasePercentageComplete, isAnimate, isAutoLayout, isFitToView, isFixed, isGeometryUpToDate, isInputCheckEnabled, isLayoutNeeded, isLayoutOfConnectedComponentsEnabled, isLayoutOfConnectedComponentsEnabledByDefault, isLayoutRunning, isLayoutRunning, isLayoutTimeElapsed, isLocalRecursiveLayoutNeeded, isMemorySavings, isParametersUpToDate, isPreserveFixedLinks, isPreserveFixedNodes, isSplineRoutingEnabled, isStoppedImmediately, isStructureUpToDate, isUseDefaultParameters, isUseSeedValueForRandomGenerator, layoutStepPerformed, onParameterChanged, onParameterChanged, performLayout, performLayout, performLayout, PerformLayout, performSublayout, removeGraphLayoutEventListener, removeGraphLayoutParameterEventListener, setAllowedTime, setAnimate, setAutoCheckAppropriateLinksEnabled, setAutoLayoutHandler, setBalanceSplineCurveThreshold, setCoordinatesMode, setFixed, setGeometryUpToDate, setGrapher, setGraphModel, setInputCheckEnabled, setLayoutOfConnectedComponents, setLayoutOfConnectedComponentsEnabled, setLayoutRegion, setLayoutRegion, setLayoutRegion, setLayoutReport, setLayoutRunning, setLinkClipInterface, setMaxSplineCurveSize, setMemorySavings, setMinBusyTime, setMinSplineCurveSize, setParametersUpToDate, setParentLayout, setPreserveFixedLinks, setPreserveFixedNodes, setProperty, setProperty, setSeedValueForRandomGenerator, setSplineLinkFilter, setSplineRoutingEnabled, setStructureUpToDate, setUseDefaultParameters, setUseSeedValueForRandomGenerator, supportsLayoutOfConnectedComponents, supportsLayoutRegion, supportsLinkClipping, supportsMemorySavings, supportsPercentageComplete, supportsPreserveFixedNodes, supportsRandomGenerator, supportsSplineRouting, unfixAllLinks, unfixAllNodes, useAnimateRedraw
public static final int ORTHOGONAL_STYLE
setGlobalLinkStyle(int)
, all links get an orthogonal shape
(alternating horizontal and vertical segments).
To specify the style of an individual link, use this option as the
argument of the method setLinkStyle(Object, int)
.public static final int DIRECT_STYLE
setGlobalLinkStyle(int)
, all links get a (semi)direct shape.
To specify the style of an individual link, use this option as the
argument of the method setLinkStyle(Object, int)
.public static final int MIXED_STYLE
setGlobalLinkStyle(int)
, each link can have a different shape.
The shape of an individual link can be set by the method
setLinkStyle(java.lang.Object, int)
.public static final int NO_RESHAPE_STYLE
MIXED_STYLE
.
To specify the style of an individual link, use this option as the
argument of the method setLinkStyle(Object, int)
.public static final int NO_BUNDLE
setLinkBundlesMode(int)
, no link bundles are computed.public static final int FIRST_LAST_SEGMENT
setLinkBundlesMode(int)
, only first and last segments of the
links are bundled.public static final int IMPROVED_FIRST_LAST_SEGMENT
setLinkBundlesMode(int)
, the first, second, next to last, and last
segments of the links are bundled.public static final int TWO_BENDS_ORTHOGONAL_STYLE
setGlobalSelfLinkStyle(int)
, a two-bend shape is given
to the self-links, that is, links with the same origin and destination
node.public static final int THREE_BENDS_ORTHOGONAL_STYLE
setGlobalSelfLinkStyle(int)
, a three-bend shape is given
to the self-links, that is, links with the same origin and destination
node.public IltShortLinkLayout()
attach(IlvGrapher)
.
attach(IlvGraphModel)
.
performLayout
.
public IltShortLinkLayout(IltShortLinkLayout source)
copy()
method.
Any subclass should provide a copy constructor.
The parameters of the source
layout are copied using
the method copyParameters(ilog.views.graphlayout.IlvGraphLayout)
.
source
- The layout instance that is copied.copy()
,
copyParameters(ilog.views.graphlayout.IlvGraphLayout)
protected void init()
You should not call this method directly. The method is called internally by the constructor without arguments and by the copy constructor. The method must be overridden by subclasses that need to initialize additional instance variables.
init
in class IlvGraphLayout
public IlvGraphLayout copy()
This method copies the layout instance by calling the copy constructor.
When performing a recursive layout on a nested graph,
this method is used by IlvLayoutProvider
to
"clone" the layout instance of a parent graph.
Note that the parameters which are specific to a node or a link are not copied. The other parameters, including the customization interfaces, are also copied.
copy
in class IlvGraphLayout
copyParameters(ilog.views.graphlayout.IlvGraphLayout)
public void copyParameters(IlvGraphLayout source)
Note that the parameters which are specific to a node or a link are not copied. The other parameters, including the customization interfaces, are also copied.
If a method of the type supportsXXX
is associated with a
parameter, the parameter is copied only if the corresponding method
returns true
.
copyParameters
in class IlvGraphLayout
source
- The layout instance from which the parameters are copied.copy()
public void initProperties(String prefix, int uniqId)
public void detach()
IlvGraphLayout.attach(ilog.views.IlvGrapher)
.
The detach
method performs cleaning operations on the
graph model.
In addition to the cleaning operations in the base class, the Short
Link Layout removes the link style specifications of individual links.
Note that you must call this method when you no longer need the layout instance. Otherwise, some objects may not be garbage collected.
detach
in class IlvGraphLayout
IlvGraphLayout.attach(ilog.views.IlvGrapher)
,
setLinkStyle(java.lang.Object, int)
public void cleanNode(IlvGraphModel graphModel, Object node)
Subclasses can override this method to remove additional information stored in the nodes.
cleanNode
in class IlvGraphLayout
graphModel
- The graph model to which node
belongs.node
- The node to be cleaned.detach()
public void cleanLink(IlvGraphModel graphModel, Object link)
Subclasses can override this method to remove additional information stored in the links.
cleanLink
in class IlvGraphLayout
graphModel
- The graph model to which link
belongs.link
- The link to be cleaned.detach()
protected void layout(boolean redraw) throws IlvGraphLayoutException
IlvGraphLayout.performLayout()
.layout
in class IlvGraphLayout
redraw
- If true
, the attached graph model will be
asked to redraw the graph after layout. When the layout algorithm
moves the nodes and reshapes the links, it is required to pass the
value of the redraw
argument to the methods IlvGraphModel.moveNode(java.lang.Object, double, double, boolean)
and IlvGraphModel.reshapeLink(java.lang.Object, ilog.views.IlvPoint, ilog.views.IlvPoint[], int, int, ilog.views.IlvPoint, boolean)
.IlvInappropriateLinkException
- if the grapher contains links that cannot
be reshaped to a polyline and whose connection points cannot be moved.
(For details, see IlvInappropriateLinkException
).IlvInappropriateLinkException
- if the grapher contains links that
cannot be reshaped to a polyline and whose connection points cannot be
moved. (For details, see IlvInappropriateLinkException
.)IlvGraphLayoutException
- If an unusual situation occurs.
WARNING: this method can throw one of the subclasses of IlvGraphLayoutException
. Specifically, it can throw an IlvInappropriateGraphException
. It can also throw an IlvInappropriateLinkException
when inappropriate types of links
and/or link connectors are used in an IlvGrapher
. For
details, refer to the documentation of these exception classes.IlvGraphLayout.performLayout()
public void setLinkConnectionBoxInterface(IlvLinkConnectionBoxInterface connectionBoxInterface)
By default, the layout algorithm places the connection points of
the links relative to the bounding box of the nodes
(see IlvGraphic.boundingBox(ilog.views.IlvTransformer)
and IlvGraphModel.boundingBox(java.lang.Object)
).
By setting a link connection box interface, the links can be connected
relative to a different box (see
getBox
).
By default, the links are connected symmetrically to the middle of the box,
and it is possible to "shift" the links tangentially by using the method
from the interface getTangentialOffset
IlvLinkConnectionBoxInterface
:
0
if no offset is necessary on
a certain node and/or side.
If you do not call this method, the layout algorithm places the
connection points on the node box that has been customized using the
method setNodeBoxInterface(ilog.views.graphlayout.IlvNodeBoxInterface)
. If this method has not been used,
the bounding box of the node in the graph model (see
IlvGraphModel.boundingBox(Object)
) is used.
You can call this method with a null
argument
to go back to the default behavior.
setLinkConnectionBoxInterface
in class IlvGraphLayout
setLinkConnectionRectangle
supportsLinkConnectionBox()
,
IlvGraphLayout.getLinkConnectionBoxInterface()
,
setNodeBoxInterface(ilog.views.graphlayout.IlvNodeBoxInterface)
public void setNodeBoxInterface(IlvNodeBoxInterface nodeBoxInterface)
If you do not call this method, the layout algorithm uses the
bounding box of the node (see IlvGraphModel.boundingBox(Object)
).
You can call this method with a null
argument
to go back to the default behavior.
getNodeBoxInterface()
public IlvNodeBoxInterface getNodeBoxInterface()
If no such an object has been specified using the method
setNodeBoxInterface(ilog.views.graphlayout.IlvNodeBoxInterface)
, the method returns null
.
setNodeBoxInterface(ilog.views.graphlayout.IlvNodeBoxInterface)
public void setNodeSideFilter(IltNodeSideFilter filter)
If you do not call this method, the layout algorithm is free to choose any side of the nodes.
When a filter is specified, the layout algorithm tries to choose for the links only shapes connected to node sides that are allowed by the filter.
Note that
the layout algorithm cannot always strictly respect the specifications
of the filter, especially for the DIRECT_STYLE
link style.
You can call this method with a null
argument
to go back to the default behavior.
getNodeSideFilter()
public IltNodeSideFilter getNodeSideFilter()
setNodeBoxInterface(ilog.views.graphlayout.IlvNodeBoxInterface)
.
Returns null
otherwise.public void checkAppropriateLinks() throws IlvInappropriateLinkException
checkAppropriateLinks
in class IlvGraphLayout
IlvInappropriateLinkException
IlvGraphLayout.performLayout(boolean, boolean, boolean)
,
IlvGraphLayout.performLayout(boolean, boolean)
,
IlvGraphLayout.checkAppropriateLink(java.lang.Object)
,
IlvGraphModel.setLinkCheckEnabled(boolean)
,
IlvGraphModel.setConnectionPointCheckEnabled(boolean)
,
IlvGraphLayoutUtil.EnsureAppropriateLinks(ilog.views.graphlayout.IlvGraphModel, ilog.views.graphlayout.IlvLayoutProvider)
,
IlvInappropriateLinkException
public int checkAppropriateLink(Object link)
checkAppropriateLinks()
.
checkAppropriateLink
in class IlvGraphLayout
link
- The link to be checked.checkAppropriateLinks()
public final void setGlobalLinkStyle(int style)
Sets the global style of the shape of the links. Valid values are the following:
DIRECT_STYLE
: the shape of the links is a polyline
composed of a straight-line segment between the end nodes with
two horizontal or vertical segments at its extremities (their length is
controlled by the setMinFinalSegmentLength
method and may
be 0).ORTHOGONAL_STYLE
: the shape of the links is a polyline
composed of alternating horizontal and vertical segments.ORTHOGONAL_STYLE
is the default value.
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
IlvRelativeLinkConnector
. Other link or connector types may cause
an IlvInappropriateLinkException
during layout. You can use the
method IlvGraphLayoutUtil.EnsureAppropriateLinkTypes(ilog.views.graphlayout.IlvGraphLayout, boolean)
and
method IlvGraphLayoutUtil.EnsureAppropriateLinkConnectors(ilog.views.graphlayout.IlvGraphLayout, boolean)
before
layout, or the method IlvGraphLayoutUtil.EnsureAppropriateLinks(ilog.views.graphlayout.IlvGraphModel, ilog.views.graphlayout.IlvLayoutProvider)
when the exception is caught, to convert all links and connectors
to an appropriate type.
getGlobalLinkStyle()
public final int getGlobalLinkStyle()
setGlobalLinkStyle(int)
public final void setLinkStyle(Object link, int style)
Sets the style of the shape of an individual link.
This link style is used only if the global link style is set to
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 orthogonal line segments.DIRECT_STYLE
-
the link gets a straight-line shape.NO_RESHAPE_STYLE
-
the link is not reshaped.This feature can be useful if the link can have intermediate points and
is not a straight-line link, for instance, a link of type
IlvPolylineLinkImage
.
The default value is ORTHOGONAL_STYLE
.
Note that when the graph attached to the layout is of type
IlvGrapher
, the effect of link reshaping depends
on the type of link. For the following link types, the reshaping has no
effect:
For all link styles, we recommend using links of type
IlvPolylineLinkImage
and link connectors of type
IlvRelativeLinkConnector
. Other link or connector types may cause
an IlvInappropriateLinkException
during layout. You can use the
method IlvGraphLayoutUtil.EnsureAppropriateLinks(ilog.views.graphlayout.IlvGraphModel, ilog.views.graphlayout.IlvLayoutProvider)
before layout
or when the exception is caught to convert all links and link connectors
to an appropriate type.
public int getLinkStyle(Object link)
public final void setGlobalSelfLinkStyle(int style)
Sets the global style of the shape of the self-links. Self-links are links that have the same origin and destination node.
Valid values are the following:
TWO_BENDS_ORTHOGONAL_STYLE
: the shape of the links is a
a polyline composed of three alternating horizontal and vertical segments,
connected to the same side of the node.THREE_BENDS_ORTHOGONAL_STYLE
: the shape of the links is a
a polyline composed of four alternating horizontal and vertical segments,
connected to two adjacent sides of the node.The default value is TWO_BENDS_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
IlvRelativeLinkConnector
. Other link or connector types may cause
an IlvInappropriateLinkException
during layout. You can use the
method IlvGraphLayoutUtil.EnsureAppropriateLinkTypes(ilog.views.graphlayout.IlvGraphLayout, boolean)
and
method IlvGraphLayoutUtil.EnsureAppropriateLinkConnectors(ilog.views.graphlayout.IlvGraphLayout, boolean)
before
layout, or the method IlvGraphLayoutUtil.EnsureAppropriateLinks(ilog.views.graphlayout.IlvGraphModel, ilog.views.graphlayout.IlvLayoutProvider)
when the exception, is caught to convert all links and connectors
to an appropriate type.
getGlobalSelfLinkStyle()
public final int getGlobalSelfLinkStyle()
setGlobalSelfLinkStyle(int)
public final void setLinkBundlesMode(int mode)
Allows you to specify the link bundles mode. The valid values of the
argument style
are the following:
NO_BUNDLE
: Several links connected to the same
side of a node share the same connection point, that is, the middle of the
node side. The final segments of the links overlap.
No bundles are created and the link offset parameter is ignored.FIRST_LAST_SEGMENT
: The connection points of several links
connected to the same side of a node are distributed according to the
link offset value. With the orthogonal link style, the algorithm
additionally ensures that the first and last segments of the links are
always orthogonal to the side of the node to which they are connected.IMPROVED_FIRST_LAST_SEGMENT
: The algorithm additionally tries
to avoid overlapping the second segment and the segment next to the last.
Note that with the direct link style, this option is equivalent to
FIRST_LAST_SEGMENT
.IMPROVED_FIRST_LAST_SEGMENT
is the default value.
getLinkBundlesMode()
public final int getLinkBundlesMode()
setLinkBundlesMode(int)
public void contentsChanged(GraphModelEvent event)
Overridden version of the base class method to allow the layout to be automatically restarted each time the layout instance is notified that the structure or the geometry of the graph has changed.
If the auto layout is enabled (that is, IlvGraphLayout.isAutoLayout()
returns
true
) the method calls performAutoLayout()
to redo the layout.
contentsChanged
in interface GraphModelListener
contentsChanged
in class IlvGraphLayout
event
- The event indicating the change that has occurred in the
graph model.IlvGraphLayout.isAutoLayout()
,
performAutoLayout()
protected void performAutoLayout()
Performs the layout again following a structural or a geometric change of the graph.
You should not call the method directly.
The method is called by contentsChanged(ilog.views.graphlayout.GraphModelEvent)
.
The default implementation simply calls the method
IlvGraphLayout.performLayout(boolean, boolean)
with
both force
and redraw
arguments of
true
.
The method can be overridden to catch the exception
IlvInappropriateLinkException
thrown by the method
IlvGraphLayout.performLayout(boolean, boolean)
and to execute the most appropriate action.
The utility method IlvGraphLayoutUtil.EnsureAppropriateLinks(ilog.views.graphlayout.IlvGraphModel, ilog.views.graphlayout.IlvLayoutProvider)
can be used to replace the inappropriate links, and then the layout
can be restarted.
performAutoLayout
in class IlvGraphLayout
contentsChanged(ilog.views.graphlayout.GraphModelEvent)
public final void setAutoLayout(boolean enable)
Enables the auto layout mode. If the argument
is true
, the layout is automatically performed
each time the layout instance is notified that the geometry
or the structure of the graph has changed.
The default value is false
.
To avoid unnecessary recomputation of the layout when performing a
sequence of several changes, you should call the method
IlvManager.setContentsAdjusting(boolean)
with a true
argument
before the changes and with a false
argument after the
changes. In this case, the layout is recomputed only at the end of the
sequence of changes. Note that this is not necessary when reading
an .ivl
file.
setAutoLayout
in class IlvGraphLayout
IlvGraphLayout.isAutoLayout()
,
contentsChanged(ilog.views.graphlayout.GraphModelEvent)
public final void setIncrementalMode(boolean enable)
Enables the incremental layout mode. If the argument is
true
, only those links that were affected
by changes since the last layout are rerouted.
The rerouted links keep their general shape but adjust the bends as necessary. The rerouted links do not change the side where they connect to the end nodes.
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.
public final boolean isIncrementalMode()
true
if the incremental mode is enabled.
It returns false
otherwise.
setIncrementalMode(boolean)
public final void setInterGraphLinksMode(boolean enable)
Enables the routing of intergraph links. If the argument is
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 addition, 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.public final boolean isInterGraphLinksMode()
true
if the routing of intergraph links is enabled.
It returns false
otherwise.setInterGraphLinksMode(boolean)
public final void setCombinedInterGraphLinksMode(boolean enable)
Enables the routing of normal links in addition to intergraph links.
If intergraph link routing is disabled, the option has no effect.
If intergraph link routing is enabled and the argument is
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
.
isCombinedInterGraphLinksMode()
,
setInterGraphLinksMode(boolean)
,
IlvGraphModel.isInterGraphLink(java.lang.Object)
public final boolean isCombinedInterGraphLinksMode()
true
if the routing of normal links in addition to
intergraph links is enabled.
Returns false
otherwise.setInterGraphLinksMode(boolean)
,
setCombinedInterGraphLinksMode(boolean)
public final void setSameShapeForMultipleLinks(boolean option)
Allows you to specify whether the layout algorithm must ensure that all multiple links have the same shape.
Multiple links are links that have the same origin and destination nodes.
If the argument is true
, additional work is done to
ensure that all multiple links will be reshaped in the same manner.
The default value is true
.
Note that in incremental mode (see setIncrementalMode(boolean)
it cannot
be guaranteed that newly inserted multiple links are reshaped in the
same manner as the existing ones.
isSameShapeForMultipleLinks()
public final boolean isSameShapeForMultipleLinks()
true
if the algorithm that ensures that multiple
links are reshaped in the same manner is enabled, and false
otherwise.setSameShapeForMultipleLinks(boolean)
public final void setLinkToNodeCrossingPenalty(float penalty)
The default value is 1
.
getLinkToNodeCrossingPenalty()
public final float getLinkToNodeCrossingPenalty()
Returns the link-to-node crossing penalty factor. When choosing the optimal shape for the links, the algorithm computes a penalty function expressed in the following manner:
Link_to_Link_Penalty * #Link_to_Link_Crossings + Link_to_Node_Penalty * #Link_to_Node_Crossings
The default value is 1
.
setLinkToNodeCrossingPenalty(float)
public final void setLinkToLinkCrossingPenalty(float penalty)
Sets the link-to-link crossing penalty factor.
The default value is 1
.
getLinkToLinkCrossingPenalty()
public final float getLinkToLinkCrossingPenalty()
Returns the link-to-link crossing penalty factor. When choosing the optimal shape for the links, the algorithm computes a penalty function expressed in the following manner:
Link_to_Link_Penalty * #Link_to_Link_Crossings + Link_to_Node_Penalty * #Link_to_Node_Crossings
The default value is 1
.
setLinkToLinkCrossingPenalty(float)
public final void setMinFinalSegmentLength(double length)
Allows you to specify the minimum length of the final (first and last) segment of the links.
The default value is 10
.
getMinFinalSegmentLength()
public final double getMinFinalSegmentLength()
setMinFinalSegmentLength(double)
public final void setBypassDistance(double dist)
Allows you to specify the minimum distance between the origin and destination node for which a link shape going directly from one node to another is allowed.
The default value is 10
.
getBypassDistance()
public final double getBypassDistance()
setBypassDistance(double)
public final void setLinkOffset(double offset)
Allows you to specify the offset between links connected on the same side of the node.
The default value is 2
.
getLinkOffset()
public final double getLinkOffset()
Returns the offset between links connected on the same side of the node.
The default value is 2
.
setLinkOffset(double)
public final int getAllowedNumberOfIterations()
setAllowedNumberOfIterations(int)
public final void setAllowedNumberOfIterations(int iterations)
getAllowedNumberOfIterations()
public boolean stopImmediately()
stopImmediately
in class IlvGraphLayout
true
if it was possible to indicate to this layout
to stop its execution, false
if this layout does not
support this feature or if it cannot be stopped.IlvGraphLayout.isAutoLayout()
,
performAutoLayout()
public final boolean supportsPreserveFixedLinks()
setPreserveFixedLinks(boolean)
is called with a
true
argument.supportsPreserveFixedLinks
in class IlvGraphLayout
true
.IlvGraphLayout.setPreserveFixedLinks(boolean)
,
IlvGraphLayout.isPreserveFixedLinks()
public final boolean supportsAllowedTime()
IlvGraphLayoutReport.STOPPED_AND_INVALID
in this case.supportsAllowedTime
in class IlvGraphLayout
true
.IlvGraphLayout.setAllowedTime(long)
,
IlvGraphLayout.getAllowedTime()
,
IlvGraphLayoutReport.getCode()
public final boolean supportsStopImmediately()
IlvGraphLayoutReport.STOPPED_AND_INVALID
in this case.supportsStopImmediately
in class IlvGraphLayout
true
.IlvGraphLayout.stopImmediately()
,
IlvGraphLayout.isStoppedImmediately()
,
IlvGraphLayoutReport.getCode()
public final boolean supportsAnimation()
setAnimate(boolean)
is called with a
true
argument.supportsAnimation
in class IlvGraphLayout
true
.IlvGraphLayout.setAnimate(boolean)
,
IlvGraphLayout.isAnimate()
public final boolean supportsLinkConnectionBox()
Indicates that this layout class can use a link connection box interface to calculate the end points of a link. The link connection box interface is an object that provides the rectangle to which the links are connected for each node, and the tangential shift offset at each side for the connection points.
The link connection box is used instead of the bounding box of each node
(see IlvGraphic.boundingBox(ilog.views.IlvTransformer)
and IlvGraphModel.boundingBox(java.lang.Object)
)
during the routing of links.
supportsLinkConnectionBox
in class IlvGraphLayout
true
.setLinkConnectionBoxInterface(ilog.views.graphlayout.IlvLinkConnectionBoxInterface)
public final boolean supportsSaveParametersToNamedProperties()
Indicates that this layout class can transfer the layout
parameters to named properties. This mechanism can be used if
layout parameters must be stored persistently in an .ivl
file.
supportsSaveParametersToNamedProperties
in class IlvGraphLayout
true
.IlvGrapherAdapter.saveParametersToNamedProperties(IlvGraphLayout, boolean)
,
IlvGrapherAdapter.loadParametersFromNamedProperties(IlvGraphLayout)
,
IlvGrapherAdapter.removeParametersFromNamedProperties()
protected IlvGraphLayoutGrapherProperty createLayoutGrapherProperty(String name, boolean withDefaults)
Returns a new instance of IltShortLinkLayoutGrapherProperty
that stores the parameter settings of this layout class.
The method is used by
IlvGrapherAdapter.saveParametersToNamedProperties(IlvGraphLayout, boolean)
to create a named property that contains parameter settings of this layout
instance.
createLayoutGrapherProperty
in class IlvGraphLayout
IlvGraphLayoutGrapherProperty
,
IlvGrapherAdapter.saveParametersToNamedProperties(IlvGraphLayout, boolean)
,
IlvGrapherAdapter.loadParametersFromNamedProperties(IlvGraphLayout)
,
IlvGrapherAdapter.removeParametersFromNamedProperties()
protected IlvGraphLayoutLinkProperty createLayoutLinkProperty(String name, IlvGraphic link, boolean withDefaults)
Returns a new instance of IltShortLinkLayoutLinkProperty
that stores the parameter settings of this layout class for links.
The method is used by
IlvGrapherAdapter.saveParametersToNamedProperties(IlvGraphLayout, boolean)
to create a named property for a link that contains parameter settings
of this layout instance for the input link.
createLayoutLinkProperty
in class IlvGraphLayout
IlvGraphLayoutLinkProperty
,
IlvGrapherAdapter.saveParametersToNamedProperties(IlvGraphLayout, boolean)
,
IlvGrapherAdapter.loadParametersFromNamedProperties(IlvGraphLayout)
,
IlvGrapherAdapter.removeParametersFromNamedProperties()
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.