ilog.tgo.graphic.graphlayout
Class IltShortLinkLayout

java.lang.Object
  extended by ilog.views.graphlayout.IlvGraphLayout
      extended by ilog.tgo.graphic.graphlayout.IltShortLinkLayout
All Implemented Interfaces:
GraphModelListener, Serializable, EventListener

public class IltShortLinkLayout
extends IlvGraphLayout

This class is an extended version of the ILOG 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:

See Also:
Serialized Form

Field Summary
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.
 
Fields inherited from class ilog.views.graphlayout.IlvGraphLayout
INVERSE_VIEW_COORDINATES, MANAGER_COORDINATES, VIEW_COORDINATES
 
Constructor Summary
IltShortLinkLayout()
          Creates a new instance of the Short Link Layout algorithm.
IltShortLinkLayout(IltShortLinkLayout source)
          Creates a new layout instance by copying an existing one.
 
Method Summary
 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.
 float 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.
 float 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.
 float 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(float 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(float 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(float 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.
 
Methods inherited from class ilog.views.graphlayout.IlvGraphLayout
addGraphLayoutEventListener, addGraphLayoutParameterEventListener, afterLayoutOfSubgraph, attach, attach, beforeLayout, beforeLayoutOfSubgraph, callLayoutStepPerformedIfNeeded, cleanGraphModel, clipAllLinks, clipLink, 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, isLayoutTimeElapsed, isMemorySavings, isParametersUpToDate, isPreserveFixedLinks, isPreserveFixedNodes, isSplineRoutingEnabled, isStoppedImmediately, isStructureUpToDate, isUseDefaultParameters, isUseSeedValueForRandomGenerator, layoutStepPerformed, onParameterChanged, onParameterChanged, performLayout, performLayout, performLayout, PerformLayout, performSublayout, removeGraphLayoutEventListener, removeGraphLayoutParameterEventListener, setAllowedTime, setAnimate, setAutoLayoutHandler, setBalanceSplineCurveThreshold, setCoordinatesMode, setFixed, setGeometryUpToDate, setGrapher, setGraphModel, setInputCheckEnabled, setLayoutOfConnectedComponents, setLayoutOfConnectedComponentsEnabled, setLayoutRegion, setLayoutRegion, setLayoutRegion, setLayoutReport, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ORTHOGONAL_STYLE

public static final int ORTHOGONAL_STYLE
Orthogonal link style option. When used as the argument of the method 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).

See Also:
Constant Field Values

DIRECT_STYLE

public static final int DIRECT_STYLE
Direct link style option. When used as the argument of the method 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).

See Also:
Constant Field Values

MIXED_STYLE

public static final int MIXED_STYLE
Mixed link shape option. When used as the argument of the method 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).

See Also:
Constant Field Values

NO_RESHAPE_STYLE

public static final int NO_RESHAPE_STYLE
No reshape link style option. This can be used for individual links if the global link style is MIXED_STYLE. To specify the style of an individual link, use this option as the argument of the method setLinkStyle(Object, int).

See Also:
Constant Field Values

NO_BUNDLE

public static final int NO_BUNDLE
No link bundles option. When used as the argument of the method setLinkBundlesMode(int), no link bundles are computed.

See Also:
Constant Field Values

FIRST_LAST_SEGMENT

public static final int FIRST_LAST_SEGMENT
Simple link bundles option. When used as the argument of the method setLinkBundlesMode(int), only first and last segments of the links are bundled.

See Also:
Constant Field Values

IMPROVED_FIRST_LAST_SEGMENT

public static final int IMPROVED_FIRST_LAST_SEGMENT
Improved link bundles option. When used as the argument of the method setLinkBundlesMode(int), the first, second, next to last, and last segments of the links are bundled.

See Also:
Constant Field Values

TWO_BENDS_ORTHOGONAL_STYLE

public static final int TWO_BENDS_ORTHOGONAL_STYLE
Two-bends self-link option. When used as the argument of the method setGlobalSelfLinkStyle(int), a two-bend shape is given to the self-links, that is, links with the same origin and destination node.

See Also:
Constant Field Values

THREE_BENDS_ORTHOGONAL_STYLE

public static final int THREE_BENDS_ORTHOGONAL_STYLE
Three-bends self-link option. When used as the argument of the method setGlobalSelfLinkStyle(int), a three-bend shape is given to the self-links, that is, links with the same origin and destination node.

See Also:
Constant Field Values
Constructor Detail

IltShortLinkLayout

public IltShortLinkLayout()
Creates a new instance of the Short Link Layout algorithm.
To indicate the grapher you want to lay out, use the method attach(IlvGrapher).
To indicate the graph model you want to lay out, use the method attach(IlvGraphModel).
To perform the layout, use the method performLayout.
To modify the layout parameters, use the different methods provided in this class and its superclass.

See Also:
IlvGraphLayout.attach(ilog.views.IlvGrapher), IlvGraphLayout.attach(ilog.views.graphlayout.IlvGraphModel), IlvGraphLayout.performLayout(), IlvGrapherAdapter.addLayer(ilog.views.IlvManagerLayer), IlvGrapherAdapter.setFilter(ilog.views.graphlayout.IlvLayoutGraphicFilter)

IltShortLinkLayout

public IltShortLinkLayout(IltShortLinkLayout source)
Creates a new layout instance by copying an existing one. This constructor is used by the 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).

Parameters:
source - The layout instance that is copied.
Since:
JViews 5.0
See Also:
copy(), copyParameters(ilog.views.graphlayout.IlvGraphLayout)
Method Detail

init

protected void init()
Initializes instance variables.

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.

Overrides:
init in class IlvGraphLayout
Since:
JViews 5.0

copy

public IlvGraphLayout copy()
Copies the layout instance.

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.

Specified by:
copy in class IlvGraphLayout
Returns:
A copy of the layout instance.
Since:
JViews 5.0
See Also:
copyParameters(ilog.views.graphlayout.IlvGraphLayout)

copyParameters

public void copyParameters(IlvGraphLayout source)
Copies the parameters from a given layout instance.

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.

Overrides:
copyParameters in class IlvGraphLayout
Parameters:
source - The layout instance from which the parameters are copied.
Since:
JViews 5.0
See Also:
copy()

initProperties

public void initProperties(String prefix,
                           int uniqId)
Initializes local properties of this layout class. This is used internally in ILOG JViews only.

Since:
JViews 3.5

detach

public void detach()
Detaches the graph model from the layout instance. When you attach a new graph model to the layout instance, you do not need to detach the old graph model because this is done automatically when you call 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.

Overrides:
detach in class IlvGraphLayout
See Also:
IlvGraphLayout.attach(ilog.views.IlvGrapher), setLinkStyle(java.lang.Object, int)

cleanNode

public void cleanNode(IlvGraphModel graphModel,
                      Object node)
Cleans a node. This method removes any data that has been stored by the layout algorithm on a node.

Subclasses can override this method to remove additional information stored in the nodes.

Overrides:
cleanNode in class IlvGraphLayout
Parameters:
graphModel - The graph model to which node belongs.
node - The node to be cleaned.
Since:
JViews 5.0
See Also:
detach()

cleanLink

public void cleanLink(IlvGraphModel graphModel,
                      Object link)
Cleans a link. This method removes any data that has been stored by the layout algorithm on a link.

Subclasses can override this method to remove additional information stored in the links.

Overrides:
cleanLink in class IlvGraphLayout
Parameters:
graphModel - The graph model to which link belongs.
link - The link to be cleaned.
Since:
JViews 5.0
See Also:
detach()

layout

protected void layout(boolean redraw)
               throws IlvGraphLayoutException
Computes the layout using the Short Link Layout algorithm. To start the layout, call the method IlvGraphLayout.performLayout().

Specified by:
layout in class IlvGraphLayout
Parameters:
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, float, float, boolean) and IlvGraphModel.reshapeLink(java.lang.Object, ilog.views.IlvPoint, ilog.views.IlvPoint[], int, int, ilog.views.IlvPoint, boolean).
Throws:
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.
See Also:
IlvGraphLayout.performLayout()

setLinkConnectionBoxInterface

public void setLinkConnectionBoxInterface(IlvLinkConnectionBoxInterface connectionBoxInterface)
Allows you to specify a link connection box interface for the connection points of links. 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.

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 getTangentialOffset from the interface IlvLinkConnectionBoxInterface:

This method must return 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.

Overrides:
setLinkConnectionBoxInterface in class IlvGraphLayout
Since:
JViews 3.5 This method replaces the method setLinkConnectionRectangle
See Also:
supportsLinkConnectionBox(), IlvGraphLayout.getLinkConnectionBoxInterface(), setNodeBoxInterface(ilog.views.graphlayout.IlvNodeBoxInterface)

setNodeBoxInterface

public void setNodeBoxInterface(IlvNodeBoxInterface nodeBoxInterface)
Allows you to specify an object that provides the rectangle that defines the position and size of each node.

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.

Since:
JViews 3.5
See Also:
getNodeBoxInterface()

getNodeBoxInterface

public IlvNodeBoxInterface getNodeBoxInterface()
Returns the object that provides the rectangle defining the position and size of each node.

If no such an object has been specified using the method setNodeBoxInterface(ilog.views.graphlayout.IlvNodeBoxInterface), the method returns null.

Since:
JViews 3.5
See Also:
setNodeBoxInterface(ilog.views.graphlayout.IlvNodeBoxInterface)

setNodeSideFilter

public 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.

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.

See Also:
getNodeSideFilter()

getNodeSideFilter

public 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). Returns null otherwise.

See Also:
setNodeSideFilter(ilog.tgo.graphic.graphlayout.IltNodeSideFilter)

checkAppropriateLinks

public void checkAppropriateLinks()
                           throws IlvInappropriateLinkException
Throws an exception if the links are not appropriate for the layout.

Overrides:
checkAppropriateLinks in class IlvGraphLayout
Throws:
IlvInappropriateLinkException
Since:
JViews 5.0
See Also:
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

checkAppropriateLink

public int checkAppropriateLink(Object link)
Checks whether the input link is appropriate for this layout. You should not call this method directly. It is called by checkAppropriateLinks().

Overrides:
checkAppropriateLink in class IlvGraphLayout
Parameters:
link - The link to be checked.
Returns:
The exception type for the link.
Since:
JViews 5.0
See Also:
checkAppropriateLinks()

setGlobalLinkStyle

public final void setGlobalLinkStyle(int style)
Sets the global style of the shape of the links. Valid values are the following:

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.

Since:
JViews 3.5
See Also:
getGlobalLinkStyle()

getGlobalLinkStyle

public final int getGlobalLinkStyle()
Returns the current choice for the style of the shape of the links.

See Also:
setGlobalLinkStyle(int)

setLinkStyle

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:

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.

See Also:
setGlobalLinkStyle(int), getLinkStyle(java.lang.Object)

getLinkStyle

public int getLinkStyle(Object link)
Returns the style of the shape of an individual link.

See Also:
setGlobalLinkStyle(int), setLinkStyle(java.lang.Object, int)

setGlobalSelfLinkStyle

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:

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.

See Also:
getGlobalSelfLinkStyle()

getGlobalSelfLinkStyle

public final int getGlobalSelfLinkStyle()
Returns the current choice for the style of the shape of the self-links.

See Also:
setGlobalSelfLinkStyle(int)

setLinkBundlesMode

public final void setLinkBundlesMode(int mode)
Allows you to specify the link bundles mode. The valid values of the argument style are the following: IMPROVED_FIRST_LAST_SEGMENT is the default value.

See Also:
getLinkBundlesMode()

getLinkBundlesMode

public final int getLinkBundlesMode()
Returns the current choice for the link bundles mode.

See Also:
setLinkBundlesMode(int)

contentsChanged

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.

Specified by:
contentsChanged in interface GraphModelListener
Overrides:
contentsChanged in class IlvGraphLayout
See Also:
IlvGraphLayout.isAutoLayout(), performAutoLayout()

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.

Overrides:
performAutoLayout in class IlvGraphLayout
Since:
JViews 3.5
See Also:
contentsChanged(ilog.views.graphlayout.GraphModelEvent)

setAutoLayout

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.

Overrides:
setAutoLayout in class IlvGraphLayout
See Also:
IlvGraphLayout.isAutoLayout(), contentsChanged(ilog.views.graphlayout.GraphModelEvent)

setIncrementalMode

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.

See Also:
isIncrementalMode(), contentsChanged(ilog.views.graphlayout.GraphModelEvent), setInterGraphLinksMode(boolean)

isIncrementalMode

public final boolean isIncrementalMode()
Returns true if the incremental mode is enabled. It returns false otherwise.

See Also:
setIncrementalMode(boolean)

setInterGraphLinksMode

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:

Since:
JViews 5.0
See Also:
isInterGraphLinksMode(), setCombinedInterGraphLinksMode(boolean), IlvGraphLayout.setAnimate(boolean), setIncrementalMode(boolean), IlvGraphModel.isInterGraphLink(java.lang.Object)

isInterGraphLinksMode

public final boolean isInterGraphLinksMode()
Returns true if the routing of intergraph links is enabled. It returns false otherwise.

Since:
JViews 5.0
See Also:
setInterGraphLinksMode(boolean)

setCombinedInterGraphLinksMode

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.

Since:
JViews 5.0
See Also:
isCombinedInterGraphLinksMode(), setInterGraphLinksMode(boolean), IlvGraphModel.isInterGraphLink(java.lang.Object)

isCombinedInterGraphLinksMode

public final boolean isCombinedInterGraphLinksMode()
Returns true if the routing of normal links in addition to intergraph links is enabled. Returns false otherwise.

Since:
JViews 5.0
See Also:
setInterGraphLinksMode(boolean), setCombinedInterGraphLinksMode(boolean)

setSameShapeForMultipleLinks

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.

See Also:
isSameShapeForMultipleLinks()

isSameShapeForMultipleLinks

public final boolean isSameShapeForMultipleLinks()
Returns true if the algorithm that ensures that multiple links are reshaped in the same manner is enabled, and false otherwise.

See Also:
setSameShapeForMultipleLinks(boolean)

setLinkToNodeCrossingPenalty

public final void setLinkToNodeCrossingPenalty(float penalty)
Sets the link-to-node crossing penalty factor.

The default value is 1.

See Also:
getLinkToNodeCrossingPenalty()

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.

See Also:
setLinkToNodeCrossingPenalty(float)

setLinkToLinkCrossingPenalty

public final void setLinkToLinkCrossingPenalty(float penalty)
Sets the link-to-link crossing penalty factor.

The default value is 1.

See Also:
getLinkToLinkCrossingPenalty()

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.

See Also:
setLinkToLinkCrossingPenalty(float)

setMinFinalSegmentLength

public final void setMinFinalSegmentLength(float length)
Allows you to specify the minimum length of the final (first and last) segment of the links.

The default value is 10.

See Also:
getMinFinalSegmentLength()

getMinFinalSegmentLength

public final float getMinFinalSegmentLength()
Returns the minimum length of the final segment of the links.

See Also:
setMinFinalSegmentLength(float)

setBypassDistance

public final void setBypassDistance(float 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.

Since:
JViews 3.5
See Also:
getBypassDistance()

getBypassDistance

public final float 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.

Since:
JViews 3.5
See Also:
setBypassDistance(float)

setLinkOffset

public final void setLinkOffset(float offset)
Allows you to specify the offset between links connected on the same side of the node.

The default value is 2.

See Also:
getLinkOffset()

getLinkOffset

public final float getLinkOffset()
Returns the offset between links connected on the same side of the node.

The default value is 2.

See Also:
setLinkOffset(float)

getAllowedNumberOfIterations

public final int getAllowedNumberOfIterations()
Returns the maximum number of allowed optimization iterations.

See Also:
setAllowedNumberOfIterations(int)

setAllowedNumberOfIterations

public final void setAllowedNumberOfIterations(int iterations)
Allows you to specify the maximum number of iterations of the layout algorithm.

See Also: