ilog.views.graphlayout.topologicalmesh
Class IlvTopologicalMeshLayout

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

public class IlvTopologicalMeshLayout
extends IlvGraphLayout

The main class for the Topological Mesh Layout (TML) algorithm.

The Topological Mesh Layout algorithm can be used to lay out cyclic graphs, both planar and nonplanar. Most of the time, if the graph is topologically symmetric, TML produces a symmetric drawing. The layout algorithm places the nodes of a cycle of the graph on a circle and the remaining nodes inside this circle. The size of the enclosing circle depends on the layout region settings (see IlvGraphLayout.setLayoutRegion(ilog.views.IlvManagerView)). For an optimal layout quality, the layout region needs to be large enough to have enough place for the nodes.

Sample drawings produced by the Topological Mesh 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, parameters, and so on.

Note that the initial position of the nodes (at the moment you start the layout) does not affect the resulting layout. However, nodes specified as fixed are not moved if you call the method setPreserveFixedNodes(boolean) with a true argument.

See Also:
Serialized Form

Field Summary
static int NO_RESHAPE_STYLE
          No links reshape option.
static int QUICK_BAD
          Fast node placement algorithm.
static int SLOW_GOOD
          Slow node placement algorithm.
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
IlvTopologicalMeshLayout()
          Creates a new instance of the Topological Mesh Layout algorithm.
IlvTopologicalMeshLayout(IlvTopologicalMeshLayout source)
          Creates a new layout instance by copying an existing one.
 
Method Summary
protected  void beforeLayoutOfSubgraph(IlvGraphModel connectedComponent)
          Performs preprocessing operations before the layout of each connected component.
 int checkAppropriateLink(Object link)
          Checks whether the input link is appropriate for this layout.
 void cleanNode(IlvGraphModel graphModel, Object node)
          Cleans a node.
 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 IlvTopologicalMeshLayoutGrapherProperty that stores the parameter settings of this layout class.
protected  IlvGraphLayoutNodeProperty createLayoutNodeProperty(String name, IlvGraphic node, boolean withDefaults)
          Returns a new instance of IlvTopologicalMeshLayoutNodeProperty that stores the parameter settings of this layout class for nodes.
 IlvGraphLayoutReport createLayoutReport()
          Creates the graph layout report instance.
 void detach()
          Overridden version of the method detach.
 long getAllowedNodesPlacementTime()
          Returns the currently allowed time for the node placement step.
 int getAllowedNumberOfNodesPlacementIterations()
          Returns the maximum number of allowed iterations.
 int getAllowedNumberOfOptimizationIterations()
          Returns the maximum number of allowed iterations.
 long getAllowedOptimizationTime()
          Returns the currently allowed time for the topological optimization step in milliseconds.
 int getExteriorCycleId()
          Returns the number of the cycle that will be used as a contour for the drawing of the graph.
 Enumeration getExteriorNodes()
          Returns an enumeration of the nodes that compose the outer cycle.
 int getLinkStyle()
          Returns the current option for the style of the shape of the links.
 IlvGraphicVector getMovingNodes()
          Returns the vector of nodes being moved by the graph layout algorithm.
 float getNodesMoveThreshold()
          Returns the threshold value for the node placement algorithm (second step of the layout algorithm).
 int getNodesPlacementAlgorithm()
          Returns the current choice of the node placement algorithm.
 int getNumberOfPossibleExteriorCycles()
          Returns the number of cycles that can be used as the contour (the outer cycle) for the drawing of the graph as determined by the topological optimization step of the layout algorithm.
 Object getStartingNode()
          Returns the current choice for the starting node.
protected  void init()
          Initializes instance variables.
 boolean isExteriorNode(Object node)
          Returns true if a node belongs to the outer cycle, and returns false otherwise.
protected  void layout(boolean redraw)
          Computes the layout using the Topological Mesh Layout algorithm.
 void setAllowedNodesPlacementTime(long time)
          Sets the allowed maximum time (in milliseconds) for the topological optimization step of the layout.
 void setAllowedNumberOfNodesPlacementIterations(int iter)
          Sets the maximum number of iterations of the drawing algorithm.
 void setAllowedNumberOfOptimizationIterations(int iter)
          Sets the maximum number of iterations of the topological optimization algorithm.
 void setAllowedOptimizationTime(long time)
          Sets the allowed maximum time (in milliseconds) for the topological optimization step of the layout.
 void setAllowedTime(long time)
          Calls the method of the superclass and internally records that a parameter that can modify the result of the first step of TML (the topological optimization step) was modified.
 void setExteriorCycleId(int cycleId)
          Specifies the index of the cycle to be used as a contour for the drawing of the graph.
 void setFixed(Object node, boolean fixed)
          Allows you to specify whether node is a fixed node or not.
 void setLinkStyle(int style)
          Sets the style of the shape of the links.
 void setNodesMoveThreshold(float threshold)
          Sets the convergence criteria of the node placement algorithm (the second step of the layout algorithm).
 void setNodesPlacementAlgorithm(int option)
          Sets the choice of the node placement algorithm (the second step of the layout algorithm).
 void setPreserveFixedNodes(boolean option)
          If the argument is true, specifies that the layout is not allowed to move the nodes indicated as fixed by the user.
 void setStartingNode(Object node)
          Sets the node from which the topological optimization starts.
 void setUseDefaultParameters(boolean option)
          If the argument is true, specifies that the layout use the default values of all parameters.
 boolean supportsAllowedTime()
          Indicates that this layout class can stop the layout computation in a 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 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 supportsMemorySavings()
          Indicates that this layout class can perform the layout using two partially different implementations: one that gives priority to speed, the other that gives priority to memory usage.
 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, callLayoutStepPerformedIfNeeded, checkAppropriateLinks, cleanGraphModel, cleanLink, clipAllLinks, clipLink, contentsChanged, createLayoutLinkProperty, 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, isLayoutOfConnectedComponentsEnabledByDefault, isLayoutRunning, isLayoutTimeElapsed, isMemorySavings, isParametersUpToDate, isPreserveFixedLinks, isPreserveFixedNodes, isSplineRoutingEnabled, isStoppedImmediately, isStructureUpToDate, isUseDefaultParameters, isUseSeedValueForRandomGenerator, layoutStepPerformed, onParameterChanged, onParameterChanged, performAutoLayout, performLayout, performLayout, performLayout, PerformLayout, performSublayout, removeGraphLayoutEventListener, removeGraphLayoutParameterEventListener, setAnimate, setAutoLayout, setAutoLayoutHandler, setBalanceSplineCurveThreshold, setCoordinatesMode, setGeometryUpToDate, setGrapher, setGraphModel, setInputCheckEnabled, setLayoutOfConnectedComponents, setLayoutOfConnectedComponentsEnabled, setLayoutRegion, setLayoutRegion, setLayoutRegion, setLayoutReport, setLinkClipInterface, setLinkConnectionBoxInterface, setMaxSplineCurveSize, setMemorySavings, setMinBusyTime, setMinSplineCurveSize, setParametersUpToDate, setParentLayout, setPreserveFixedLinks, setProperty, setProperty, setSeedValueForRandomGenerator, setSplineLinkFilter, setSplineRoutingEnabled, setStructureUpToDate, setUseSeedValueForRandomGenerator, stopImmediately, 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 the argument of the method 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 the argument of the method setLinkStyle(int), the links are not reshaped.

Since:
JViews 3.0
See Also:
Constant Field Values

SLOW_GOOD

public static final int SLOW_GOOD
Slow node placement algorithm. When used as an argument of the method setNodesPlacementAlgorithm(int), it provides more uniformity of the node distribution inside the exterior cycle, but is slightly slower.

See Also:
Constant Field Values

QUICK_BAD

public static final int QUICK_BAD
Fast node placement algorithm. When used as an argument of the method setNodesPlacementAlgorithm(int), it provides less uniformity of the node distribution inside the exterior cycle, but is slightly quicker.

See Also:
Constant Field Values
Constructor Detail

IlvTopologicalMeshLayout

public IlvTopologicalMeshLayout()
Creates a new instance of the Topological Mesh Layout algorithm.
To indicate the grapher you want to lay out, use the method IlvGraphLayout.attach(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.

See Also:
IlvGraphLayout.attach(ilog.views.IlvGrapher), IlvGraphLayout.attach(ilog.views.graphlayout.IlvGraphModel), IlvGraphLayout.performLayout(), IlvGraphLayout.getCalcLayoutRegion()

IlvTopologicalMeshLayout

public IlvTopologicalMeshLayout(IlvTopologicalMeshLayout 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
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 link clip and link connection box 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
See Also:
copy(), 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 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()
Overridden version of the method detach.

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

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.

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

createLayoutReport

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

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

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 method setPreserveFixedNodes(boolean) is called with a true argument.
Note that the Topological Mesh Layout is always free to move the nodes belonging to the outer cycle.

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

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

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

supportsMemorySavings

public final boolean supportsMemorySavings()
Indicates that this layout class can perform the layout using two partially different implementations: one that gives priority to speed, the other that gives priority to memory usage. The choice depends on the parameter specified using IlvGraphLayout.setMemorySavings(boolean).
You should use the memory savings mode if memory is critical for your application or if you received an "out of memory" error on a large graph.
Note that no guarantee is given for the amount of memory savings and that the layout process may be slower.

Overrides:
supportsMemorySavings in class IlvGraphLayout
Returns:
Always true.
See Also:
IlvGraphLayout.setMemorySavings(boolean), IlvGraphLayout.isMemorySavings()

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.

Overrides:
supportsLayoutRegion in class IlvGraphLayout
Returns:
Always true.
See Also:
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 in a proper manner when the user-defined allowed time is exceeded. The result code in the layout report is IlvGraphLayoutReport.STOPPED_AND_VALID in this case.

Overrides:
supportsAllowedTime in class IlvGraphLayout
Returns:
Always true.
See Also:
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_VALID in this case.

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

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" offset in the horizontal direction, and by the average of the tangential "left" and "right" offset 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 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:
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 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:
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 Topological Mesh Layout algorithm. To start the layout, call the method IlvGraphLayout.performLayout(). Note that this class overrides the method createLayoutReport() and creates an instance of IlvTopologicalMeshLayoutReport.

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:
IlvInappropriateGraphException - If no cycle was found in the connected component of the graph containing the starting node with respect to the user-defined layers and/or filter, if applicable. (See setStartingNode(java.lang.Object), IlvGrapherAdapter.addLayer(ilog.views.IlvManagerLayer) and IlvGrapherAdapter.setFilter(ilog.views.graphlayout.IlvLayoutGraphicFilter)).
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(), IlvTopologicalMeshLayoutReport, IlvGraphLayout.getCalcLayoutRegion()

getExteriorNodes

public Enumeration getExteriorNodes()
Returns an enumeration of the nodes that compose the outer cycle.

The method returns an empty enumeration if the layout was never performed on the current graph or if at least one exterior node has been removed since the last time the layout was performed.

See Also:
isExteriorNode(java.lang.Object)

isExteriorNode

public boolean isExteriorNode(Object node)
Returns true if a node belongs to the outer cycle, and returns false otherwise.

Throws:
RuntimeException - If there is no attached graph, if the layout was never performed on the current graph, or if at least one exterior node has been removed since the last time the layout was performed.
Since:
JViews 3.0
See Also:
getExteriorNodes()

beforeLayoutOfSubgraph

protected void beforeLayoutOfSubgraph(IlvGraphModel connectedComponent)
Performs preprocessing operations before the layout of each connected component.

Overrides:
beforeLayoutOfSubgraph in class IlvGraphLayout
Since:
JViews 5.0
See Also:
IlvGraphLayout.performLayout(boolean, boolean, boolean), IlvGraphLayout.afterLayoutOfSubgraph(ilog.views.graphlayout.IlvGraphModel)

getNumberOfPossibleExteriorCycles

public int getNumberOfPossibleExteriorCycles()
Returns the number of cycles that can be used as the contour (the outer cycle) for the drawing of the graph as determined by the topological optimization step of the layout algorithm.

The method returns -1 if the layout was never performed on the current graph or if at least one exterior node has been removed since the last time the layout was performed.

Note that the method should not be used if the layout of connected components is enabled and after a layout of a disconnected graph.

Throws:
RuntimeException
See Also:
setExteriorCycleId(int), getExteriorCycleId()

setExteriorCycleId

public void setExteriorCycleId(int cycleId)
Specifies the index of the cycle to be used as a contour for the drawing of the graph.

This method allows you to obtain different drawings of the graph using the same topological optimization result.

You should use this method only after having performed the layout, that is, after having determined the near-optimal exterior cycles using the topological optimization.

The legal values range from zero to the number of possible exterior cycles minus one. The possible exterior cycles are automatically sorted from the longest to the shortest cycle according to the number of nodes in the cycle.

If the argument is not in this range, the value zero is used, which corresponds to the longest exterior cycle.

Note that the method should not be used if the layout of connected components is enabled and after a layout of a disconnected graph.

See Also:
getNumberOfPossibleExteriorCycles(), getExteriorCycleId()

getExteriorCycleId

public int getExteriorCycleId()
Returns the number of the cycle that will be used as a contour for the drawing of the graph.

The method returns -1 if the layout was never performed on the current graph or if at least one exterior node has been removed since the last time the layout was performed.

Note that the method should not be used if the layout of connected components is enabled and after a layout of a disconnected graph.

Throws:
RuntimeException - If the layout was never performed on the current graph or if at least one exterior node has been removed since the last time the layout was performed.
See Also:
getNumberOfPossibleExteriorCycles(), setExteriorCycleId(int)

setUseDefaultParameters

public void setUseDefaultParameters(boolean option)
If the argument is true, specifies that the layout use the default values of all parameters.

Overrides:
setUseDefaultParameters in class IlvGraphLayout
See Also:
IlvGraphLayout.isUseDefaultParameters()

setFixed

public void setFixed(Object node,
                     boolean fixed)
Allows you to specify whether node is a fixed node or not. Fixed nodes are not moved during the layout only if the method IlvGraphLayout.isPreserveFixedNodes() returns true.
By default, no node is fixed. Note that TML is always free to move the nodes belonging to the current exterior cycle (outer cycle).

An IllegalArgumentException is thrown if the node does not belong to the attached grapher.

Overrides:
setFixed in class IlvGraphLayout
Since:
JViews 3.0. This method replaces the method setFixed(IlvGraphic, boolean).
See Also:
IlvGraphLayout.isFixed(java.lang.Object), supportsPreserveFixedNodes(), setPreserveFixedNodes(boolean), IlvGraphLayout.isPreserveFixedNodes(), IlvGraphLayout.unfixAllNodes()

setPreserveFixedNodes

public void setPreserveFixedNodes(boolean option)
If the argument is true, specifies that the layout is not allowed to move the nodes indicated as fixed by the user. If the argument is false, the layout is free to move all the nodes of the grapher. (This will not change the setting for the fixed nodes, which can still be used at any time in the future.)

The default value is false.

A RuntimeException is thrown if the layout class does not support this option.

Overrides:
setPreserveFixedNodes in class IlvGraphLayout
See Also:
IlvGraphLayout.isPreserveFixedNodes(), setFixed(java.lang.Object, boolean), IlvGraphLayout.isFixed(java.lang.Object), supportsPreserveFixedNodes(), IlvGraphLayout.unfixAllNodes()

setNodesPlacementAlgorithm

public void setNodesPlacementAlgorithm(int option)
Sets the choice of the node placement algorithm (the second step of the layout algorithm). The valid values are:
- SLOW_GOOD The first node placement algorithm (the default), which provides more uniformity of the node distribution inside the exterior cycle, but is slightly slower.
- QUICK_BAD The second node placement algorithm, which provides less uniformity of the node distribution inside the exterior cycle, but is slightly quicker.

See Also:
getNodesPlacementAlgorithm()

getNodesPlacementAlgorithm

public int getNodesPlacementAlgorithm()
Returns the current choice of the node placement algorithm.

See Also:
setNodesPlacementAlgorithm(int)

setNodesMoveThreshold

public void setNodesMoveThreshold(float threshold)
Sets the convergence criteria of the node placement algorithm (the second step of the layout algorithm). This iterative algorithm is stopped when the greatest movement of a node at a given iteration is smaller than threshold.

The default value is 1.

The value of the argument is in the same coordinate space as the nodes and links of the graph. When laying out an IlvGrapher, the value is in manager coordinates (without transformation into view coordinates). If it is necessary to provide a given value in the coordinate space of a particular IlvManagerView, the value in manager coordinates can be computed using the following code:

 IlvTransformer t = view.getTransformer();
 double zoomFactor = transformer != null ? transformer.zoomFactor() : 1;
 float managerValue = (float)(viewValue / zoomFactor);
 

See Also:
getNodesMoveThreshold()

getNodesMoveThreshold

public float getNodesMoveThreshold()
Returns the threshold value for the node placement algorithm (second step of the layout algorithm).

See Also:
setNodesMoveThreshold(float)

setStartingNode

public void setStartingNode(Object node)
Sets the node from which the topological optimization starts. The layout is applied on the connected component of the attached grapher containing this starting node.

If you do not specify a starting node, an arbitrary starting node belonging to the attached grapher is used. If you specify a starting node but want to reset this setting and use an arbitrary starting node, set the starting node to null.

If you change the starting node, you may obtain different layouts of the same graph.

Note that the starting node must belong to the attached graph.

If there are more than one connected component, it is possible to select a root for each component. If no root is specified, an arbitrary starting node is automatically selected.

Since:
JViews 3.0. This method replaces the method setStartingNode(IlvGraphic).
See Also:
getStartingNode()

getStartingNode

public Object getStartingNode()
                       throws IlvGraphLayoutException
Returns the current choice for the starting node. If you did not specify a starting node or this node is no longer a valid node of the attached graph, an arbitrary starting node belonging to the attached grapher is returned.

Note that the method should not be used if the layout of connected components is enabled and after a layout of a disconnected graph.

Throws:
IlvInappropriateGraphException - If you did not specify a starting node and the algorithm could not choose a starting node because no nonzero degree node exists.
IlvGraphLayoutException - If no graph is attached or the starting node you specified is rejected by the filtering mechanism. (See IlvGrapherAdapter.setFilter(ilog.views.graphlayout.IlvLayoutGraphicFilter)).
Since:
JViews 3.0. This method replaces the method IlvGraphic getStartingNode().
See Also:
setStartingNode(java.lang.Object)

setAllowedNumberOfOptimizationIterations

public void setAllowedNumberOfOptimizationIterations(int iter)
Sets the maximum number of iterations of the topological optimization algorithm.

See Also:
getAllowedNumberOfOptimizationIterations()

getAllowedNumberOfOptimizationIterations

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

See Also:
setAllowedNumberOfOptimizationIterations(int)

setAllowedNumberOfNodesPlacementIterations

public void setAllowedNumberOfNodesPlacementIterations(int iter)
Sets the maximum number of iterations of the drawing algorithm.

See Also:
getAllowedNumberOfNodesPlacementIterations()

getAllowedNumberOfNodesPlacementIterations

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

See Also:
setAllowedNumberOfNodesPlacementIterations(int)

setAllowedOptimizationTime

public void setAllowedOptimizationTime(long time)
Sets the allowed maximum time (in milliseconds) for the topological optimization step of the layout.

See Also:
getAllowedOptimizationTime()

getAllowedOptimizationTime

public long getAllowedOptimizationTime()
Returns the currently allowed time for the topological optimization step in milliseconds.

See Also:
setAllowedOptimizationTime(long)

setAllowedNodesPlacementTime

public void setAllowedNodesPlacementTime(long time)
Sets the allowed maximum time (in milliseconds) for the topological optimization step of the layout.

See Also:
getAllowedNodesPlacementTime()

getAllowedNodesPlacementTime

public long getAllowedNodesPlacementTime()
Returns the currently allowed time for the node placement step.

See Also:
setAllowedNodesPlacementTime(long)

setAllowedTime

public final void setAllowedTime(long time)
Calls the method of the superclass and internally records that a parameter that can modify the result of the first step of TML (the topological optimization step) was modified.

Overrides:
setAllowedTime in class IlvGraphLayout
Parameters:
time - The allowed time in milliseconds.
See Also:
IlvGraphLayout.getAllowedTime()

setLinkStyle

public void setLinkStyle(int style)
Sets the style of the shape of the links. Valid values are

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. With the option STRAIGHT_LINE_STYLE, the layout removes the intermediate points of the links.

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

createLayoutNodeProperty

protected IlvGraphLayoutNodeProperty createLayoutNodeProperty(String name,
                                                              IlvGraphic node,
                                                              boolean withDefaults)
Returns a new instance of IlvTopologicalMeshLayoutNodeProperty that stores the parameter settings of this layout class for nodes.

The method is used by IlvGrapherAdapter.saveParametersToNamedProperties(IlvGraphLayout, boolean) to create a named property for a node that contains parameter settings of this layout instance for the input node.

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


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