ilog.views.graphlayout.uniformlengthedges
Class IlvUniformLengthEdgesLayout

java.lang.Object
  extended by ilog.views.graphlayout.IlvGraphLayout
      extended by ilog.views.graphlayout.uniformlengthedges.IlvUniformLengthEdgesLayout
All Implemented Interfaces:
GraphModelListener, Serializable, EventListener

public class IlvUniformLengthEdgesLayout
extends IlvGraphLayout

The main class for the Uniform Length Edges Layout algorithm.

The Uniform Length Edges Layout algorithm can be used to lay out any type of graph. It often provides a drawing with no, or only a few, edge crossings and with approximately equal-length edges for small- and medium-size graphs having a small number of cycles.

This layout algorithm iteratively searches for a configuration of the graph such that the lengths of the edges are close to a desired value.

Here are sample drawings produced with the Uniform Length Edges Layout algorithm:

Performance hints

Several parameters have an impact on speed. In some extent, the performance can be improved by modifying these parameters.

See the corresponding chapter of the ILOG JViews Graph Layout 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, parameters, and so on.

You can specify a preferred length for the links globally (setPreferredLinksLength(float) or for specific links (setPreferredLength(java.lang.Object, float)).

You can request that the real size of the nodes is taken into account (setRespectNodeSizes(boolean)). This is especially recommended when the nodes are not square (have a larger or smaller width than height), or have different sizes. In such a case, the layout quality can be often further improved by increasing the weight of the node repulsion force (see setAdditionalNodeRepulsionWeight(float); the default is zero).

While the layout algorithm optionally restricts the region where the nodes are placed (see setForceFitToLayoutRegion(boolean)), the layout quality is usually much better if this option is not used (this is the default behavior).

If this option is not set, the nodes are considered to be points located in the center of the bounding box of the nodes. Using the layout algorithm without setting this option is recommended when the width of the nodes is close to their height and there are no significant size differences among the nodes.

Note that the initial position of the nodes (at the moment you start the layout) is taken into account by the layout algorithm, so you may get different results depending on the initial position.

See Also:
Serialized Form

Field Summary
static int NO_RESHAPE_STYLE
          No links reshape option.
static int STRAIGHT_LINE_STYLE
          Straight-line links shape option.
 
Fields inherited from class ilog.views.graphlayout.IlvGraphLayout
INVERSE_VIEW_COORDINATES, MANAGER_COORDINATES, VIEW_COORDINATES
 
Constructor Summary
IlvUniformLengthEdgesLayout()
          Creates a new instance of the Uniform Length Edges Layout algorithm.
IlvUniformLengthEdgesLayout(IlvUniformLengthEdgesLayout 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.
 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 IlvUniformLengthEdgesLayoutGrapherProperty that stores the parameter settings of this layout class.
protected  IlvGraphLayoutLinkProperty createLayoutLinkProperty(String name, IlvGraphic link, boolean withDefaults)
          Returns a new instance of IlvUniformLengthEdgesLayoutLinkProperty that stores the parameter settings of this layout class for links.
 IlvGraphLayoutReport createLayoutReport()
          Creates the graph layout report instance.
 void detach()
          Detaches the graph model from the layout instance.
 float getAdditionalNodeRepulsionWeight()
          Returns the weight of the additional node repulsion force.
 int getAllowedNumberOfIterations()
          Returns the maximum number of allowed iterations.
 float getConvergenceThreshold()
          Returns the threshold value.
 float getLinkLengthWeight()
          Returns the link length weight.
 int getLinkStyle()
          Returns the current option for the style of the shape of the links.
 float getMaxAllowedMovePerIteration()
          Returns the maximum authorized move at each iteration of the layout algorithm.
 IlvGraphicVector getMovingNodes()
          Returns the vector of nodes being moved by the graph layout algorithm.
 float getNodeDistanceThreshold()
          Returns the node distance threshold.
 float getPreferredLength(Object link)
          Returns the preferred length of a link.
 float getPreferredLinksLength()
          Returns the global preferred length of the links.
protected  void init()
          Initializes instance variables.
 boolean isForceFitToLayoutRegion()
          Returns the current choice for the force-fit-to-layout-region parameter.
protected  boolean isLayoutOfConnectedComponentsEnabledByDefault()
          Overridden version of the method from the superclass that always returns true.
 boolean isRespectNodeSizes()
          Returns true if the algorithm tries to respect the size of the nodes.
protected  void layout(boolean redraw)
          Computes the layout using the Uniform Length Edges Layout algorithm.
 void setAdditionalNodeRepulsionWeight(float weight)
          Sets the weight of the additional node repulsion force.
 void setAllowedNumberOfIterations(int iterations)
          Sets the maximum number of iterations of the layout algorithm.
 void setConvergenceThreshold(float threshold)
          Sets the threshold value for the convergence detection mechanism.
 void setForceFitToLayoutRegion(boolean option)
          Sets whether the layout algorithm must force the graph drawing to fit the layout region.
 void setLinkLengthWeight(float weight)
          Sets the link length weight.
 void setLinkStyle(int style)
          Sets the style of the shape of the links.
 void setMaxAllowedMovePerIteration(float maxMove)
          Sets the maximum authorized node move at each iteration of the layout algorithm.
 void setNodeDistanceThreshold(float threshold)
          Sets the node distance threshold.
 void setPreferredLength(Object link, float length)
          Sets the preferred length of a link.
 void setPreferredLinksLength(float length)
          Sets the global preferred length of the links.
 void setRespectNodeSizes(boolean respect)
          Sets whether the algorithm must try to respect the size of the nodes.
 boolean supportsAllowedTime()
          Indicates that this layout class can stop the layout computation 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 IlvGraphLayout.setAnimate(boolean) is called with a true argument.
 boolean supportsLayoutOfConnectedComponents()
          Indicates that this layout class can cut the attached graph into connected components, apply itself to each connected component separately, and then use the layout instance returned by the method IlvGraphLayout.getLayoutOfConnectedComponents() to position the connected components.
 boolean supportsLayoutRegion()
          Indicates that this layout class can control the size of the graph drawing to fit (approximately) a user-defined region (a rectangle) or a user-defined manager view.
 boolean supportsLinkClipping()
          Indicates that this layout class can use a link clip interface to clip the end points of a link.
 boolean supportsLinkConnectionBox()
          Indicates that this layout class can use a link connection box interface to calculate the end points of a link.
 boolean supportsPreserveFixedNodes()
          Indicates that this layout class allows the user to specify fixed nodes.
 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, checkAppropriateLinks, cleanGraphModel, cleanLink, cleanNode, clipAllLinks, clipLink, contentsChanged, createLayoutNodeProperty, getAllowedTime, getAutoLayoutHandler, getBalanceSplineCurveThreshold, getCalcLayoutRegion, getCoordinatesMode, getGrapher, getGraphModel, getInstanceId, getLayout, getLayoutOfConnectedComponents, getLayoutOfConnectedComponentsReport, getLayoutRegion, getLayoutReport, getLayouts, getLinkClipInterface, getLinkConnectionBoxInterface, getMaxSplineCurveSize, getMinBusyTime, getMinSplineCurveSize, getParentLayout, getProperty, getProperty, getRecursiveLayout, getRemainingAllowedTime, getSeedValueForRandomGenerator, getSpecLayoutRegion, getSplineLinkFilter, increasePercentageComplete, isAnimate, isAutoLayout, isFitToView, isFixed, isGeometryUpToDate, isInputCheckEnabled, isLayoutNeeded, isLayoutOfConnectedComponentsEnabled, isLayoutRunning, isLayoutTimeElapsed, isMemorySavings, isParametersUpToDate, isPreserveFixedLinks, isPreserveFixedNodes, isSplineRoutingEnabled, isStoppedImmediately, isStructureUpToDate, isUseDefaultParameters, isUseSeedValueForRandomGenerator, layoutStepPerformed, onParameterChanged, onParameterChanged, performAutoLayout, performLayout, performLayout, performLayout, PerformLayout, performSublayout, removeGraphLayoutEventListener, removeGraphLayoutParameterEventListener, setAllowedTime, setAnimate, setAutoLayout, setAutoLayoutHandler, setBalanceSplineCurveThreshold, setCoordinatesMode, setFixed, setGeometryUpToDate, setGrapher, setGraphModel, setInputCheckEnabled, setLayoutOfConnectedComponents, setLayoutOfConnectedComponentsEnabled, setLayoutRegion, setLayoutRegion, setLayoutRegion, setLayoutReport, setLinkClipInterface, setLinkConnectionBoxInterface, setMaxSplineCurveSize, setMemorySavings, setMinBusyTime, setMinSplineCurveSize, setParametersUpToDate, setParentLayout, setPreserveFixedLinks, setPreserveFixedNodes, setProperty, setProperty, setSeedValueForRandomGenerator, setSplineLinkFilter, setSplineRoutingEnabled, setStructureUpToDate, setUseDefaultParameters, setUseSeedValueForRandomGenerator, stopImmediately, supportsMemorySavings, supportsPercentageComplete, supportsPreserveFixedLinks, 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

STRAIGHT_LINE_STYLE

public static final int STRAIGHT_LINE_STYLE
Straight-line links shape option. When used as an argument of setLinkStyle(int), the links are given a straight-line shape.

Since:
JViews 3.0
See Also:
Constant Field Values

NO_RESHAPE_STYLE

public static final int NO_RESHAPE_STYLE
No links reshape option. When used as an argument of setLinkStyle(int), the links are not reshaped.

Since:
JViews 3.5
See Also:
Constant Field Values
Constructor Detail

IlvUniformLengthEdgesLayout

public IlvUniformLengthEdgesLayout()
Creates a new instance of the Uniform Length Edges Layout algorithm.
To indicate the grapher you want to lay out, use the method IlvGraphLayout.attach(ilog.views.IlvGrapher).
To indicate the graph model you want to lay out, use the method IlvGraphLayout.attach(IlvGraphModel).
To perform the layout, use the method IlvGraphLayout.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)

IlvUniformLengthEdgesLayout

public IlvUniformLengthEdgesLayout(IlvUniformLengthEdgesLayout 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 of 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 layout region specification and the customization interfaces, are also copied. A copy of the layout instance used for laying out the connected components is set on the new instance.

If a method of the type supportsXXX is associated with a parameter, the parameter is copied only if the corresponding method returns true.

Specified by:
copy in class IlvGraphLayout
Returns:
A copy of the layout instance.
Since:
JViews 5.0

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 layout region specification and the customization interfaces, are also copied. A copy of the layout instance used for laying out the connected components is set on this layout instance.

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()

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(IlvGraphModel).

The method performs cleaning operations on the graph model.

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(IlvGraphModel)

createLayoutReport

public IlvGraphLayoutReport createLayoutReport()
Creates the graph layout report instance. The current implementation creates an instance of IlvUniformLengthEdgesLayoutReport.

Overrides:
createLayoutReport in class IlvGraphLayout
See Also:
createLayoutReport()

isLayoutOfConnectedComponentsEnabledByDefault

protected boolean isLayoutOfConnectedComponentsEnabledByDefault()
Overridden version of the method from the superclass that always returns true.

Overrides:
isLayoutOfConnectedComponentsEnabledByDefault in class IlvGraphLayout
Since:
JViews 3.5
See Also:
IlvGraphLayout.setLayoutOfConnectedComponentsEnabled(boolean)

supportsPreserveFixedNodes

public final boolean supportsPreserveFixedNodes()
Indicates that this layout class allows the user to specify fixed nodes. Fixed nodes are not moved during the layout if the parameter preserveFixedNodes is true.

Overrides:
supportsPreserveFixedNodes in class IlvGraphLayout
Returns:
Always true.
See Also:
IlvGraphLayout.setPreserveFixedNodes(boolean), IlvGraphLayout.isPreserveFixedNodes()

supportsLayoutRegion

public final boolean supportsLayoutRegion()
Indicates that this layout class can control the size of the graph drawing to fit (approximately) a user-defined region (a rectangle) or a user-defined manager view. By default, this feature is disabled. To enable it, use the method setForceFitToLayoutRegion(boolean).

Overrides:
supportsLayoutRegion in class IlvGraphLayout
Returns:
Always true.
See Also:
setForceFitToLayoutRegion(boolean), IlvGraphLayout.setLayoutRegion(ilog.views.IlvManagerView), IlvGraphLayout.setLayoutRegion(ilog.views.IlvManagerView, ilog.views.IlvRect), IlvGraphLayout.setLayoutRegion(ilog.views.IlvRect), IlvGraphLayout.getSpecLayoutRegion(), IlvGraphLayout.getCalcLayoutRegion()

supportsAllowedTime

public final boolean supportsAllowedTime()
Indicates that this layout class can stop the layout computation when the user-defined allowed time is exceeded. The result code in the layout report is IlvGraphLayoutReport.STOPPED_AND_INVALID in this case.

Overrides:
supportsAllowedTime in class IlvGraphLayout
Returns:
Always true.
See Also:
IlvGraphLayout.setAllowedTime(long), IlvGraphLayout.getAllowedTime(), IlvGraphLayoutReport.getCode()

supportsStopImmediately

public final boolean supportsStopImmediately()
Indicates that this layout class can interrupt the current run of the layout immediately in a controlled way. The result code in the layout report is IlvGraphLayoutReport.STOPPED_AND_INVALID in this case.

Overrides:
supportsStopImmediately in class IlvGraphLayout
Returns:
Always true.
Since:
JViews 3.5
See Also:
IlvGraphLayout.stopImmediately(), IlvGraphLayout.isStoppedImmediately(), IlvGraphLayoutReport.getCode()

supportsAnimation

public final 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 IlvGraphLayout.setAnimate(boolean) is called with a true argument.

Overrides:
supportsAnimation in class IlvGraphLayout
Returns:
Always true.
See Also:
IlvGraphLayout.setAnimate(boolean), IlvGraphLayout.isAnimate()

supportsLayoutOfConnectedComponents

public final boolean supportsLayoutOfConnectedComponents()
Indicates that this layout class can cut the attached graph into connected components, apply itself to each connected component separately, and then use the layout instance returned by the method IlvGraphLayout.getLayoutOfConnectedComponents() to position the connected components. By default, this layout is an instance of IlvGridLayout that can be customized as needed.

Overrides:
supportsLayoutOfConnectedComponents in class IlvGraphLayout
Returns:
Always true.
Since:
JViews 3.5
See Also:
IlvGraphLayout.getLayoutOfConnectedComponents(), IlvGraphLayout.isLayoutOfConnectedComponentsEnabled(), IlvGraphLayout.performLayout(boolean, boolean)

supportsLinkConnectionBox

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 connection box interface is used only if link clipping is enabled by setting a link clip interface, and if the link style is straight line. In this case, the layout algorithm calculates the virtual center of the end nodes of each link by the link connection box interface and obtains the final connection points by clipping with the link clip interface. The virtual center is defined as the center of the connection box shifted by the average of the tangential "top" and "bottom" offsets in the horizontal direction, and by the average of the tangential "left" and "right" offsets in the vertical direction. For instance, if the tangential offset is 20 at the top side and 10 at all other sides, the average shift offset is (20 + 10)/2 = 15 in the horizontal direction and (10 + 10)/2 = 10 in the vertical direction; hence, the virtual center is at connectionBox.center() + (15, 10).

If no link clipping is performed, the layout algorithms does not actively place the end points of links. It relies on the link connectors that are attached to the nodes to find appropriate connection points for the links.

Overrides:
supportsLinkConnectionBox in class IlvGraphLayout
Returns:
Always true.
Since:
JViews 5.0
See Also:
IlvGraphLayout.setLinkConnectionBoxInterface(ilog.views.graphlayout.IlvLinkConnectionBoxInterface), IlvGraphLayout.setLinkClipInterface(ilog.views.graphlayout.IlvLinkClipInterface), IlvLinkConnector, setLinkStyle(int), supportsLinkClipping()

supportsLinkClipping

public final boolean supportsLinkClipping()
Indicates that this layout class can use a link clip interface to clip the end points of a link. The link clip interface is an object that provides the connection for a link clipped at the border of the shape of the end node. This is useful if the nodes have a nonrectangular shape such as a triangle, rhombus, or circle.

Link clipping is performed only if the link style is straight line. If no link clip interface is given, the layout algorithm does not actively place the end points of links. It relies on the link connectors that are attached to the nodes to find appropriate connection points for the links.

Overrides:
supportsLinkClipping in class IlvGraphLayout
Returns:
Always true.
Since:
JViews 5.0
See Also:
IlvGraphLayout.setLinkClipInterface(ilog.views.graphlayout.IlvLinkClipInterface), IlvLinkConnector, setLinkStyle(int), supportsLinkConnectionBox()

supportsSaveParametersToNamedProperties

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.

Overrides:
supportsSaveParametersToNamedProperties in class IlvGraphLayout
Returns:
Always true.
Since:
JViews 3.5
See Also:
IlvGrapherAdapter.saveParametersToNamedProperties(IlvGraphLayout, boolean), IlvGrapherAdapter.loadParametersFromNamedProperties(IlvGraphLayout), IlvGrapherAdapter.removeParametersFromNamedProperties()

layout

protected void layout(boolean redraw)
               throws IlvGraphLayoutException
Computes the layout using the Uniform Length Edges Layout algorithm. To start the layout, call the method IlvGraphLayout.performLayout(). Note that this class overrides the createLayoutReport() and creates an instance of IlvUniformLengthEdgesLayoutReport.

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 straight line and the link style is STRAIGHT_LINE_STYLE. (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(), createLayoutReport(), IlvUniformLengthEdgesLayoutReport, IlvGraphLayout.getCalcLayoutRegion()

setConvergenceThreshold

public final void setConvergenceThreshold(float threshold)
Sets the threshold value for the convergence detection mechanism. The iterative algorithm is stopped if the greatest movement of a node at an iteration getMaxAllowedMovePerIteration() is smaller than threshold during several successive iterations.

The default value is 1. The units are in the same coordinate space as the coordinates and size of the nodes. Increasing this value may speed up the layout because the iterations may be stopped earlier. However, this may produce a nonoptimal layout. Decreasing this value in some cases improves the quality of the layout but needs more time because more iterations are performed. Note that if the specified value is too small, the iterations cannot be stopped until the allowed time or the allowed number of iterations is reached.

Since:
JViews 3.5
See Also:
getConvergenceThreshold()

getConvergenceThreshold

public final float getConvergenceThreshold()
Returns the threshold value.

Since:
JViews 3.5
See Also:
setConvergenceThreshold(float)

setMaxAllowedMovePerIteration

public final void setMaxAllowedMovePerIteration(float maxMove)
Sets the maximum authorized node move at each iteration of the layout algorithm. The default value is 5.

Increasing this parameter may speed up the layout, but the algorithm may fail to converge. Decreasing this parameter slows down the layout but in some cases improves the convergence. You should not specify a zero value, because in this case the layout cannot move the nodes at all.

Since:
JViews 5.0
See Also:
getMaxAllowedMovePerIteration(), setConvergenceThreshold(float)

getMaxAllowedMovePerIteration

public final float getMaxAllowedMovePerIteration()
Returns the maximum authorized move at each iteration of the layout algorithm.

Since:
JViews 5.0
See Also:
setMaxAllowedMovePerIteration(float), setConvergenceThreshold(float)

setForceFitToLayoutRegion

public void setForceFitToLayoutRegion(boolean option)
Sets whether the layout algorithm must force the graph drawing to fit the layout region. If the argument is false (which is the default), the layout algorithm is free to move nodes outside the layout region. Note that the layout may not be optimal if the size of the layout region is too small. It is recommended to avoid forcing the use of a layout region anytime this is possible.

See Also:
IlvGraphLayout.setLayoutRegion(ilog.views.IlvManagerView), IlvGraphLayout.setLayoutRegion(ilog.views.IlvManagerView, ilog.views.IlvRect), IlvGraphLayout.setLayoutRegion(ilog.views.IlvRect), isForceFitToLayoutRegion(), IlvGraphLayout.getCalcLayoutRegion()

isForceFitToLayoutRegion

public boolean isForceFitToLayoutRegion()
Returns the current choice for the force-fit-to-layout-region parameter.

See Also:
setForceFitToLayoutRegion(boolean), IlvGraphLayout.getCalcLayoutRegion()

setPreferredLinksLength

public void setPreferredLinksLength(float length)
Sets the global preferred length of the links. The layout algorithm tries to compute a layout where the links have the specified length. The preferred length can also be specified individually for each link (or for some links). If an individual length is not specified for a particular link, the global length specified using this method is used for this link.

The default value is 60.

See Also:
getPreferredLinksLength(), setPreferredLength(java.lang.Object, float), setNodeDistanceThreshold(float)

getPreferredLinksLength

public float getPreferredLinksLength()
Returns the global preferred length of the links.

See Also:
setPreferredLinksLength(float), setPreferredLength(java.lang.Object, float), setNodeDistanceThreshold(float)

setPreferredLength

public void setPreferredLength(Object link,
                               float length)
Sets the preferred length of a link. The layout algorithm tries to compute a layout where the link has the specified length. If a preferred length is set for a link, this overrides the global preferred length for this link.

After having specified a length for a link, you can call the method with a strictly negative value to indicate that the global preferred length must be used again for this link.

By default, no length is specified for the individual links.

Since:
JViews 5.0
See Also:
getPreferredLength(java.lang.Object), setPreferredLinksLength(float), setNodeDistanceThreshold(float)

getPreferredLength

public float getPreferredLength(Object link)
Returns the preferred length of a link. It returns -1 if the length is unspecified (in this case, the layout uses the global length; see getPreferredLinksLength()).

Since:
JViews 5.0
See Also:
setPreferredLength(java.lang.Object, float), setPreferredLinksLength(float), setNodeDistanceThreshold(float)

setNodeDistanceThreshold

public void setNodeDistanceThreshold(float threshold)
Sets the node distance threshold. The additional repulsion force (see setAdditionalNodeRepulsionWeight(float)) is applied only for nodes that are not connected by a link and are at a distance smaller than this threshold.

The default value is 30.

Note that the additional repulsion force is applied only if the corresponding weight (see setAdditionalNodeRepulsionWeight(float)) is larger than 0. The default weight is 0; therefore, the node distance threshold has no effect if the weight is not modified.

Since:
JViews 5.0
See Also:
getNodeDistanceThreshold(), setPreferredLinksLength(float), setPreferredLength(java.lang.Object, float)

getNodeDistanceThreshold

public float getNodeDistanceThreshold()
Returns the node distance threshold.

Since:
JViews 5.0
See Also:
setNodeDistanceThreshold(float), setPreferredLinksLength(float), setPreferredLength(java.lang.Object, float)

setRespectNodeSizes

public void setRespectNodeSizes(boolean respect)
Sets whether the algorithm must try to respect the size of the nodes. If the argument is true, the preferred length parameter is interpreted as a minimum distance between the bounding boxes of the end nodes. Otherwise, the preferred length parameter is considered as the center-to-center distance between the end nodes.

Since:
JViews 3.0
See Also:
isRespectNodeSizes()

isRespectNodeSizes

public boolean isRespectNodeSizes()
Returns true if the algorithm tries to respect the size of the nodes. Returns false otherwise.

Since:
JViews 3.0
See Also:
setRespectNodeSizes(boolean)

setLinkLengthWeight

public void setLinkLengthWeight(float weight)
Sets the link length weight. This weight is a multiplier that is applied when two nodes connected by a link are moved in order to obtain a link length close to the preferred value (see setPreferredLinksLength(float) and setPreferredLength(java.lang.Object, float)). The default value is 1. Increasing (or decreasing) this value increases (or decreases) the priority that is given to the link length criteria with respect to the minimum distance between nodes not connected by a link.

Since:
JViews 5.0
See Also:
getLinkLengthWeight(), setAdditionalNodeRepulsionWeight(float)

getLinkLengthWeight

public float getLinkLengthWeight()
Returns the link length weight.

Since:
JViews 5.0
See Also:
setLinkLengthWeight(float), setAdditionalNodeRepulsionWeight(float)

setAdditionalNodeRepulsionWeight

public void setAdditionalNodeRepulsionWeight(float weight)
Sets the weight of the additional node repulsion force. This weight is a multiplier which is applied to the repulsion force between two nodes that are not connected by a link. The additional repulsion force is applied only if the distance between the nodes is smaller than the node distance threshold (see setNodeDistanceThreshold(float)).

The default value is 0.2. Increasing the weight increases the priority that is given to maintaining the nodes at a distance larger than the node distance threshold. On the other side, increasing the weight decreases the ability of the algorithm to reach convergence quickly.

Since:
JViews 5.0
See Also:
getAdditionalNodeRepulsionWeight(), setNodeDistanceThreshold(float), setLinkLengthWeight(float)

getAdditionalNodeRepulsionWeight

public float getAdditionalNodeRepulsionWeight()
Returns the weight of the additional node repulsion force.

Since:
JViews 5.0
See Also:
setAdditionalNodeRepulsionWeight(float), setLinkLengthWeight(float)

getAllowedNumberOfIterations

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

See Also:
setAllowedNumberOfIterations(int)

setAllowedNumberOfIterations

public void setAllowedNumberOfIterations(int iterations)
Sets the maximum number of iterations of the layout algorithm. The default value is 1000.

See Also:
getAllowedNumberOfIterations()

setLinkStyle

public void setLinkStyle(int style)
Sets the style of the shape of the links. Valid values are STRAIGHT_LINE_STYLE (the links are given a straight-line shape) and NO_RESHAPE_STYLE (no reshape is performed on the links).

This feature can be useful if the graph contains links that have intermediate points and are not straight-line links, for instance, IlvPolylineLinkImage links with intermediate points.

The default value is STRAIGHT_LINE_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 either no link connector or any link connector except IlvFreeLinkConnector 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.

Since:
JViews 3.0
See Also:
getLinkStyle()

getLinkStyle

public int getLinkStyle()
Returns the current option for the style of the shape of the links.

Since:
JViews 3.0
See Also:
setLinkStyle(int)

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 IlvGraphLayout.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:
IlvGraphLayout.checkAppropriateLinks()

getMovingNodes

public IlvGraphicVector getMovingNodes()
Returns the vector of nodes being moved by the graph layout algorithm. You should not call this method. It is only used when the graph model is an IlvGrapherAdapter in order to optimize for speed.

Overrides:
getMovingNodes in class IlvGraphLayout
Since:
JViews 5.5

createLayoutGrapherProperty

protected IlvGraphLayoutGrapherProperty createLayoutGrapherProperty(String name,
                                                                    boolean withDefaults)
Returns a new instance of IlvUniformLengthEdgesLayoutGrapherProperty 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.

Overrides:
createLayoutGrapherProperty in class IlvGraphLayout
Since:
JViews 3.5
See Also:
IlvGraphLayoutGrapherProperty, IlvGrapherAdapter.saveParametersToNamedProperties(IlvGraphLayout, boolean), IlvGrapherAdapter.loadParametersFromNamedProperties(IlvGraphLayout), IlvGrapherAdapter.removeParametersFromNamedProperties()

createLayoutLinkProperty

protected IlvGraphLayoutLinkProperty createLayoutLinkProperty(String name,
                                                              IlvGraphic link,
                                                              boolean withDefaults)
Returns a new instance of IlvUniformLengthEdgesLayoutLinkProperty 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.

Overrides:
createLayoutLinkProperty in class IlvGraphLayout
Since:
JViews 5.0
See Also:
IlvGraphLayoutLinkProperty, IlvGrapherAdapter.saveParametersToNamedProperties(IlvGraphLayout, boolean), IlvGrapherAdapter.loadParametersFromNamedProperties(IlvGraphLayout), IlvGrapherAdapter.removeParametersFromNamedProperties()


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.   . All Rights Reserved.