public class IltLinkLayout extends IlvGraphLayout
The Link Layout 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 method
setGlobalLinkStyle(int)
.
The layout algorithm has two modes: short link mode and long link mode. The short link mode places the links freely in the plane by choosing the best shape from a fixed number of link shapes. A link has a maximum of 3 bends. The long link mode searches for routes on a grid by avoiding obstacles. By doing this, any link shape can occur (that is, the number of link shapes is unlimited) but a long link route can have many bends.
The long link mode is slower and uses more memory on very large graphs than the short link mode. The short link mode should be used if any of the following conditions apply:
The short link mode works very well with thick links produced by Java 2D:
Here are sample drawings produced by the Link Layout algorithm in long link mode:
The long link mode can be used to find a route through a labyrinth:
The Link Layout algorithm is a wrapper that allows simplified
access to two sublayouts: the Short Link Layout algorithm and the
Long Link Layout algorithm. It calls these sublayouts internally
to perform the layout. This is useful for applications that need to use
both layout modes at the same time.
Applications that use the short link mode exclusively can use the
Short Link Layout algorithm (IltShortLinkLayout
) directly.
Applications that use the long link mode exclusively can use the
Long Link Layout algorithm (IlvLongLinkLayout
) directly.
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:
setPreserveFixedLinks(boolean)
is
enabled, or links that have the link style NO_RESHAPE_STYLE
,
are not reshaped.
The incremental mode cannot be used for intergraph links.Modifier and Type | Field and Description |
---|---|
static int |
DIRECT_STYLE
Direct link style option.
|
static int |
LONG_LINKS
Long links layout mode.
|
static int |
MIXED_STYLE
Mixed link style option.
|
static int |
NO_RESHAPE_STYLE
No reshape link style option.
|
static int |
ORTHOGONAL_STYLE
Orthogonal link style option.
|
static int |
SHORT_LINKS
Short links layout mode.
|
INVERSE_VIEW_COORDINATES, MANAGER_COORDINATES, VIEW_COORDINATES
Constructor and Description |
---|
IltLinkLayout()
Creates a new instance of the Link Layout algorithm.
|
IltLinkLayout(IltLinkLayout source)
Creates a new layout instance by copying an existing one.
|
Modifier and Type | Method and Description |
---|---|
void |
attach(IlvGraphModel graphModel)
Allows you to specify the graph model you want to lay out.
|
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 |
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
IltLinkLayoutGrapherProperty
that stores the parameter settings of this layout class. |
protected IlvGraphLayoutLinkProperty |
createLayoutLinkProperty(String name,
IlvGraphic link,
boolean withDefaults)
Returns a new instance of
IltLinkLayoutLinkProperty
that stores the parameter settings of this layout class for links. |
void |
detach()
Detaches the graph model from the layout instance.
|
int |
getGlobalLinkStyle()
Returns the global style of the shapes of links.
|
double |
getHorizontalGridBase()
Returns the horizontal base coordinate of the grid.
|
double |
getHorizontalGridOffset()
Returns the horizontal offset between the grid lines.
|
double |
getHorizontalMinOffset()
Returns the minimal horizontal offset between the node border and a link
segment that is (vertically) parallel to the node border.
|
int |
getLayoutMode()
Returns the current layout mode.
|
double |
getLinkOffset()
Returns the offset between links connected on the same side of the
node.
|
int |
getLinkStyle(Object link)
Returns the shape style of an individual link.
|
IlvLongLinkLayout |
getLongLinkLayout()
Returns the Long Link Layout instance that is used internally by
this Link Layout instance in layout mode
LONG_LINKS . |
double |
getMinFinalSegmentLength()
Returns the minimum length of the first and last segments of each link.
|
double |
getMinNodeCornerOffset()
Returns the minimum offset between a node corner and a link starting at
this node.
|
IlvNodeBoxInterface |
getNodeBoxInterface()
Returns the node box interface used during the layout,
or
null if none is specified. |
IltNodeSideFilter |
getNodeSideFilter()
Returns the node-side filter used during layout,
or
null if none is specified. |
IltShortLinkLayout |
getShortLinkLayout()
Returns the Short Link Layout instance that is used internally by
this Link Layout instance in layout mode
SHORT_LINKS . |
double |
getVerticalGridBase()
Returns the vertical base coordinate of the grid.
|
double |
getVerticalGridOffset()
Returns the vertical offset between the grid lines.
|
double |
getVerticalMinOffset()
Returns the minimal vertical offset between the node border and a link
segment that is (horizontally) parallel to the node border.
|
protected void |
init()
Initializes instance variables.
|
boolean |
isCombinedInterGraphLinksMode()
Returns
true if the routing of normal links in addition to
intergraph links is enabled. |
boolean |
isGeometryUpToDate()
Returns
false if at least one node, link, label or obstacle
was moved or reshaped since the last time the layout was successfully
performed on the same graph or if the layout has never been performed
successfully on the same graph. |
boolean |
isIncrementalMode()
Returns
true if the incremental mode is enabled. |
boolean |
isInterGraphLinksMode()
Returns
true if the routing of intergraph links is enabled. |
boolean |
isParametersUpToDate()
Returns
false if at least one parameter was modified since
the last time the layout was successfully performed on the same graph
or if the layout has never been performed successfully on the same graph. |
boolean |
isStructureUpToDate()
Returns
false if at least one modification occurred in the
structure of the graph since the last time the layout was successfully
performed on the same graph or if the layout has never been performed
successfully on the same graph. |
protected void |
layout(boolean redraw)
Computes the layout using the Link Layout algorithm.
|
void |
markForIncremental(Object link)
Marks the input link to be rerouted with the next call of
performLayout if incremental mode is enabled. |
protected void |
performAutoLayout()
Performs the layout again following a structural or a geometric change of
the graph.
|
void |
setAllowedTime(long time)
Sets an upper limit for the duration of the layout algorithm.
|
void |
setAnimate(boolean option)
Enables the animation mechanism.
|
void |
setAutoLayout(boolean enable)
Enables the auto layout mode.
|
void |
setCombinedInterGraphLinksMode(boolean enable)
Enables the routing of normal links in addition to intergraph links.
|
void |
setCoordinatesMode(int mode)
Sets the coordinates mode.
|
void |
setGeometryUpToDate(boolean uptodate)
This method is normally called with a
false argument
if the geometry of the graph changed. |
void |
setGlobalLinkStyle(int style)
Sets the global style of the shapes of links.
|
void |
setGraphModel(IlvGraphModel graphModel)
Sets the graph model to be laid out.
|
void |
setHorizontalGridBase(double coordinate)
Sets the horizontal base coordinate of the grid.
|
void |
setHorizontalGridOffset(double offset)
Sets the horizontal offset between the grid lines.
|
void |
setHorizontalMinOffset(double offset)
Sets the minimal horizontal offset between the node border and a link
segment that is (vertically) parallel to the node border.
|
void |
setIncrementalMode(boolean enable)
Enables the incremental layout mode.
|
void |
setInputCheckEnabled(boolean enable)
Enables the checks for the nodes and/or links
provided as arguments for the different methods of this
layout algorithm.
|
void |
setInterGraphLinksMode(boolean enable)
Enables the routing of intergraph links.
|
void |
setLayoutMode(int mode)
Sets the layout mode.
|
void |
setLinkConnectionBoxInterface(IlvLinkConnectionBoxInterface connectionBoxInterface)
Allows you to specify a link connection box interface for the connection
points of links.
|
void |
setLinkOffset(double offset)
Sets the offset between links connected on the same side of the node.
|
void |
setLinkStyle(Object link,
int style)
Sets the shape style of an individual link.
|
void |
setMinBusyTime(long time)
Sets the minimal time that the layout algorithm can be busy between
two calls of
layoutStepPerformed when the method
callLayoutStepPerformedIfNeeded is used. |
void |
setMinFinalSegmentLength(double length)
Sets the minimum length of the first and last segments of each link.
|
void |
setMinNodeCornerOffset(double offset)
Sets the minimum offset between a node corner and a link starting at
this node.
|
void |
setNodeBoxInterface(IlvNodeBoxInterface nodeBoxInterface)
Allows you to specify a node box interface for the obstacle area.
|
void |
setNodeSideFilter(IltNodeSideFilter filter)
Allows you to install a node-side filter, that is, an object that allows or
prohibits the connection of the links on a given side of the nodes.
|
void |
setParametersUpToDate(boolean uptodate)
This method is automatically called with a
false argument
each time the value of a parameter is changed. |
void |
setPreserveFixedLinks(boolean option)
If the argument is
true , specifies that the layout is not allowed to reshape
the links indicated as fixed by the user. |
void |
setStructureUpToDate(boolean uptodate)
This method is normally called with a
false argument
if the structure of the graph changed. |
void |
setUseDefaultParameters(boolean option)
If the argument is
true , specifies that the layout use the default
values of all the parameters; that is, the "get..." and "is..." methods
return the default values. |
void |
setVerticalGridBase(double coordinate)
Sets the vertical base coordinate of the grid.
|
void |
setVerticalGridOffset(double offset)
Sets the vertical offset between the grid lines.
|
void |
setVerticalMinOffset(double offset)
Sets the minimal vertical offset between the node border and a link
segment that is (horizontally) parallel to the node border.
|
boolean |
stopImmediately()
Stops the running layout algorithm as soon as possible.
|
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 can perform redraws to animate the layout process in some
way.
|
boolean |
supportsLinkConnectionBox()
Indicates that this layout class can use a link connection box
interface to calculate the end points of a link.
|
boolean |
supportsPreserveFixedLinks()
Indicates that this layout class allows the user to specify fixed links.
|
boolean |
supportsSaveParametersToNamedProperties()
Indicates that this layout class can transfer the layout
parameters to named properties.
|
boolean |
supportsStopImmediately()
Indicates that this layout class can interrupt the current run
of the layout immediately in a controlled way.
|
addGraphLayoutEventListener, addGraphLayoutParameterEventListener, afterLayoutOfSubgraph, attach, beforeLayout, beforeLayoutOfSubgraph, callLayoutStepPerformedIfNeeded, cleanGraphModel, cleanLink, cleanNode, clipAllLinks, clipLink, connectAllLinksToCenter, connectLinkToCenter, createLayoutNodeProperty, createLayoutReport, getAllowedTime, getAutoLayoutHandler, getBalanceSplineCurveThreshold, getCalcLayoutRegion, getCoordinatesMode, getGrapher, getGraphModel, getInstanceId, getLayout, getLayoutOfConnectedComponents, getLayoutOfConnectedComponentsReport, getLayoutRegion, getLayoutReport, getLayouts, getLinkClipInterface, getLinkConnectionBoxInterface, getMaxSplineCurveSize, getMinBusyTime, getMinSplineCurveSize, getMovingNodes, getParentLayout, getProperty, getProperty, getRecursiveLayout, getRemainingAllowedTime, getSeedValueForRandomGenerator, getSpecLayoutRegion, getSplineLinkFilter, increasePercentageComplete, isAnimate, isAutoLayout, isFitToView, isFixed, isInputCheckEnabled, isLayoutNeeded, isLayoutOfConnectedComponentsEnabled, isLayoutOfConnectedComponentsEnabledByDefault, isLayoutRunning, isLayoutRunning, isLayoutTimeElapsed, isLocalRecursiveLayoutNeeded, isMemorySavings, isPreserveFixedLinks, isPreserveFixedNodes, isSplineRoutingEnabled, isStoppedImmediately, isUseDefaultParameters, isUseSeedValueForRandomGenerator, layoutStepPerformed, onParameterChanged, onParameterChanged, performLayout, performLayout, performLayout, PerformLayout, performSublayout, removeGraphLayoutEventListener, removeGraphLayoutParameterEventListener, setAutoCheckAppropriateLinksEnabled, setAutoLayoutHandler, setBalanceSplineCurveThreshold, setFixed, setGrapher, setLayoutOfConnectedComponents, setLayoutOfConnectedComponentsEnabled, setLayoutRegion, setLayoutRegion, setLayoutRegion, setLayoutReport, setLayoutRunning, setLinkClipInterface, setMaxSplineCurveSize, setMemorySavings, setMinSplineCurveSize, setParentLayout, setPreserveFixedNodes, setProperty, setProperty, setSeedValueForRandomGenerator, setSplineLinkFilter, setSplineRoutingEnabled, setUseSeedValueForRandomGenerator, supportsLayoutOfConnectedComponents, supportsLayoutRegion, supportsLinkClipping, supportsMemorySavings, supportsPercentageComplete, supportsPreserveFixedNodes, supportsRandomGenerator, supportsSplineRouting, unfixAllLinks, unfixAllNodes, useAnimateRedraw
public static final int ORTHOGONAL_STYLE
setGlobalLinkStyle(int)
, all links have an orthogonal shape
(alternating horizontal and vertical segments).
To specify the style of an individual link, use this option as the
argument of the method setLinkStyle(Object, int)
.public static final int DIRECT_STYLE
setGlobalLinkStyle(int)
, all links have a (semi)direct shape.
To specify the style of an individual link, use this option as the
argument of the method setLinkStyle(Object, int)
.public static final int MIXED_STYLE
setGlobalLinkStyle(int)
, each link can have a different shape.
The shape of an individual link can be set by the method
setLinkStyle(java.lang.Object, int)
.public static final int NO_RESHAPE_STYLE
MIXED_STYLE
.
To specify the style of an individual link, use this option as the
argument of the method setLinkStyle(Object, int)
.public static final int SHORT_LINKS
setLayoutMode(int)
,
links are placed freely in the plane by choosing the best shape from a
fixed number of link shapes. A link can have a maximum of 3 bends.public static final int LONG_LINKS
When used as the argument of the method setLayoutMode(int)
,
links of link style ORTHOGONAL_STYLE
are routed on a grid
and avoid obstacles.
By so doing, any orthogonal link shape can occur (that is, the number of
link shapes is unlimited) and a long link route can have many bends.
Links of link style DIRECT_STYLE
are routed with the end
segments on the grid, but the middle segment may overlap obstacles.
public IltLinkLayout()
IlvGraphLayout.attach(ilog.views.IlvGrapher)
.
attach(ilog.views.graphlayout.IlvGraphModel)
.
IlvGraphLayout.performLayout()
.
public IltLinkLayout(IltLinkLayout source)
copy()
method.
Any subclass should provide a copy constructor.
The parameters of the source
layout are copied using
the method copyParameters(ilog.views.graphlayout.IlvGraphLayout)
.
source
- The layout instance that is copied.copy()
,
copyParameters(ilog.views.graphlayout.IlvGraphLayout)
protected void init()
You should not call this method directly. The method is called internally by the constructor without arguments and by the copy constructor. The method must be overridden by subclasses that need to initialize additional instance variables.
init
in class IlvGraphLayout
public IlvGraphLayout copy()
This method copies the layout instance by calling the copy constructor.
When performing a recursive layout on a nested graph,
IlvLayoutProvider
uses this method 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. Only the global parameters are copied. The customization
interfaces (node side filter, node box interface) are also copied.
copy
in class IlvGraphLayout
copyParameters(ilog.views.graphlayout.IlvGraphLayout)
,
setNodeBoxInterface(ilog.views.graphlayout.IlvNodeBoxInterface)
,
setNodeSideFilter(ilog.tgo.graphic.graphlayout.IltNodeSideFilter)
public void copyParameters(IlvGraphLayout source)
Note that the parameters which are specific to a node or a link are not copied. Only the global parameters are copied. The customization interfaces (node side filter, node box interface) are also copied.
copyParameters
in class IlvGraphLayout
source
- The layout instance from which the parameters are copied.copy()
,
setNodeBoxInterface(ilog.views.graphlayout.IlvNodeBoxInterface)
,
setNodeSideFilter(ilog.tgo.graphic.graphlayout.IltNodeSideFilter)
public void attach(IlvGraphModel graphModel)
attach
in class IlvGraphLayout
graphModel
- The graph model to lay out.detach()
,
getLongLinkLayout()
,
getShortLinkLayout()
public void detach()
attach(ilog.views.graphlayout.IlvGraphModel)
.
The detach
method performs cleaning operations on the
graph model.
In addition to the cleaning operations in the base class, the Link Layout
removes the link style specifications of individual links.
Note that you must call this method when you no longer need the layout instance. Otherwise, some objects may not be garbage collected.
detach
in class IlvGraphLayout
attach(ilog.views.graphlayout.IlvGraphModel)
,
setLinkStyle(java.lang.Object, int)
,
getLongLinkLayout()
,
getShortLinkLayout()
public void setGraphModel(IlvGraphModel graphModel)
IlvGraphLayout.attach(IlvGrapher)
or
attach(IlvGraphModel)
.setGraphModel
in class IlvGraphLayout
IlvGraphLayout.attach(IlvGrapher)
,
IlvGraphLayout.attach(IlvGraphModel)
protected void layout(boolean redraw) throws IlvGraphLayoutException
IlvGraphLayout.performLayout()
.layout
in class IlvGraphLayout
redraw
- If true
, the attached graph model will be
asked to redraw the graph after layout. When the layout algorithm
moves the nodes and reshapes the links, it is required to pass the
value of the redraw
argument to the methods IlvGraphModel.moveNode(java.lang.Object, double, double, boolean)
and IlvGraphModel.reshapeLink(java.lang.Object, ilog.views.IlvPoint, ilog.views.IlvPoint[], int, int, ilog.views.IlvPoint, boolean)
.IlvInappropriateLinkException
- if the grapher contains links
that cannot be reshaped to a polyline and whose connection points
cannot be moved.
(For details, see IlvInappropriateLinkException
).IlvGraphLayoutException
- If an unusual situation occurs.
WARNING: this method can throw one of the subclasses of IlvGraphLayoutException
. Specifically, it can throw an IlvInappropriateGraphException
. It can also throw an IlvInappropriateLinkException
when inappropriate types of links
and/or link connectors are used in an IlvGrapher
. For
details, refer to the documentation of these exception classes.IlvGraphLayout.performLayout()
public final void setLayoutMode(int mode)
SHORT_LINKS
-
Links are placed freely in the plane by choosing the best shape from
a fixed number of link shapes. A link can have a maximum of 3 bends.
LONG_LINKS
-
Orthogonal links are routed on a grid by avoiding obstacles.
Any orthogonal link shape can occur (that is, the number
of link shapes is not limited) but a long link route can have many
bends.
Direct links are routed with the end segments on the grid, but the
middle segment may overlap obstacles.
The default value is SHORT_LINKS
.
public final int getLayoutMode()
setLayoutMode(int)
public IltShortLinkLayout getShortLinkLayout()
SHORT_LINKS
.
This allows you to access the internal parameter settings of the
Short Link Layout.setLayoutMode(int)
,
getLongLinkLayout()
,
IltShortLinkLayout
public IlvLongLinkLayout getLongLinkLayout()
LONG_LINKS
.
This allows you to access the internal parameter settings of the
Long Link Layout.setLayoutMode(int)
,
getShortLinkLayout()
,
IlvLongLinkLayout
public void contentsChanged(GraphModelEvent event)
If auto layout is enabled (that is, IlvGraphLayout.isAutoLayout()
returns
true
) the method calls performAutoLayout()
to redo the layout.
contentsChanged
in interface GraphModelListener
contentsChanged
in class IlvGraphLayout
event
- The event indicating the change that has occurred in the
graph model.IlvGraphLayout.isAutoLayout()
,
performAutoLayout()
protected void performAutoLayout()
You should not call this 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 at
true
.
The method can be overridden to catch the exception
IlvInappropriateLinkException
thrown by the method
IlvGraphLayout.performLayout(boolean, boolean)
and to execute
the most appropriate action.
The utility method IlvGraphLayoutUtil.EnsureAppropriateLinks(ilog.views.graphlayout.IlvGraphModel, ilog.views.graphlayout.IlvLayoutProvider)
can be used to replace the inappropriate links, and then the layout can be
restarted.
performAutoLayout
in class IlvGraphLayout
setAutoLayout(boolean)
,
contentsChanged(ilog.views.graphlayout.GraphModelEvent)
public final void setAutoLayout(boolean enable)
true
, the layout is automatically performed again
each time the layout instance is notified that the geometry
or the structure of the graph has changed.
It is disabled by default.
setAutoLayout
in class IlvGraphLayout
IlvGraphLayout.isAutoLayout()
,
contentsChanged(ilog.views.graphlayout.GraphModelEvent)
,
performAutoLayout()
public final void setIncrementalMode(boolean enable)
true
,
only those links that were affected by changes since the last layout are
rerouted. A link is rerouted under the following conditions:
In short link mode, the rerouted links keep their general shape but adjust the bends as necessary. The rerouted links do not change the side where they are connected to the end nodes.
In long link mode, the rerouted links can change shape completely. The rerouted links can change the side where they are connected to the end nodes if this is necessary to obtain a better route.
The incremental mode works only if the intergraph links mode is disabled or if there are no intergraph links. The incremental mode is disabled by default.
public final boolean isIncrementalMode()
true
if the incremental mode is enabled.setIncrementalMode(boolean)
public final void markForIncremental(Object link)
performLayout
if incremental mode is enabled.
Normally, the incremental layout reroutes only those links that have
changed since the last layout. By setting a mark on the link, this link
will be rerouted even if it has not changed.public final void setInterGraphLinksMode(boolean enable)
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 additionally the combined intergraph link routing is enabled, 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 the intergraph link mode is enabled and the graph actually contains some intergraph links, there are some restrictions:
IlvGrapher
(or
IlvGrapherAdapter
), the top-level grapher must have a
manager view attached because of the coordinate transformations of
the subgraphers. If you create your own subclass of
IlvGraphModel
instead of IlvGrapherAdapter
to route intergraph links, you must ensure that all graph models of
all subgraphers use the same coordinate system through appropriate
coordinate transformations.public final boolean isInterGraphLinksMode()
true
if the routing of intergraph links is enabled.
Returns false
otherwise.setInterGraphLinksMode(boolean)
public final void setCombinedInterGraphLinksMode(boolean enable)
true
, both normal links and intergraph links are routed
in the same pass. Otherwise, only the intergraph links are routed.
The default value is true
.
isCombinedInterGraphLinksMode()
,
setInterGraphLinksMode(boolean)
,
IlvGraphModel.isInterGraphLink(java.lang.Object)
public final boolean isCombinedInterGraphLinksMode()
true
if the routing of normal links in addition to
intergraph links is enabled.
It returns false
otherwise.setInterGraphLinksMode(boolean)
,
setCombinedInterGraphLinksMode(boolean)
public final void setLinkOffset(double offset)
SHORT_LINKS
where the links
are placed freely. In the layout mode LONG_LINKS
, the link offset
parameter is ignored, because the offset between links is implicitly
determined by the grid width.
The default value is 2
.
public final double getLinkOffset()
SHORT_LINKS
.setLinkOffset(double)
public final void setHorizontalGridOffset(double offset)
LONG_LINKS
where the links
are routed on an orthogonal grid. In the layout mode SHORT_LINKS
,
links are placed freely and the grid parameters are ignored.
The default value is 5
.
public final double getHorizontalGridOffset()
LONG_LINKS
.setHorizontalGridOffset(double)
public final void setVerticalGridOffset(double offset)
LONG_LINKS
where the links
are routed on an orthogonal grid. In the layout mode SHORT_LINKS
,
links are placed freely and the grid parameters are ignored.
The default value is 5
.
public final double getVerticalGridOffset()
LONG_LINKS
.setVerticalGridOffset(double)
public final void setHorizontalGridBase(double coordinate)
x
coordinate of the first vertical grid line.
It affects only the layout mode LONG_LINKS
where the links
are routed on an orthogonal grid. In the layout mode SHORT_LINKS
,
links are placed freely and the grid parameters are ignored.
The default value is 0
.
public final double getHorizontalGridBase()
LONG_LINKS
.setHorizontalGridBase(double)
public final void setVerticalGridBase(double coordinate)
y
coordinate of the first horizontal grid line.
It affects only the layout mode LONG_LINKS
where the links
are routed on an orthogonal grid. In the layout mode SHORT_LINKS
,
links are placed freely and the grid parameters are ignored.
The default value is 0
.
public final double getVerticalGridBase()
LONG_LINKS
.setVerticalGridBase(double)
public final void setHorizontalMinOffset(double offset)
LONG_LINKS
where the links
are routed on an orthogonal grid. In the layout mode SHORT_LINKS
,
links are placed freely and the grid parameters are ignored.
The default value is 3
.
public final double getHorizontalMinOffset()
LONG_LINKS
.setHorizontalMinOffset(double)
public final void setVerticalMinOffset(double offset)
LONG_LINKS
where the links
are routed on an orthogonal grid. In the layout mode SHORT_LINKS
,
links are placed freely and the grid parameters are ignored.
The default value is 3
.
public final double getVerticalMinOffset()
LONG_LINKS
.setVerticalMinOffset(double)
public final void setMinNodeCornerOffset(double offset)
0
enables the layout to start a link exactly
at a node corner.
It affects only the layout mode LONG_LINKS
where the links
are routed on an orthogonal grid and always connect to the node border.
In the layout mode SHORT_LINKS
, links are placed freely in the
plane, potentially connecting outside the node border.
The default value is 3
.
getMinNodeCornerOffset()
,
setLayoutMode(int)
public final double getMinNodeCornerOffset()
LONG_LINKS
.setMinNodeCornerOffset(double)
public final void setMinFinalSegmentLength(double length)
The default value is 10
.
getMinFinalSegmentLength()
public final double getMinFinalSegmentLength()
setMinFinalSegmentLength(double)
public final void setGlobalLinkStyle(int style)
ORTHOGONAL_STYLE
-
all links have an orthogonal shape, that is, a shape consisting of a
sequence of alternating horizontal and vertical line segments.DIRECT_STYLE
-
all links get a nearly straight-line shape. The shape of the links is
a polyline composed of a straight-line segment between the end nodes with
two short horizontal or vertical segments at its ends (their length is
controlled by the method setMinFinalSegmentLength
and may be 0
).MIXED_STYLE
-
each link can have a different link style.
The style of each individual link can be set by the method
setLinkStyle(Object, int)
so that different link shapes can
occur in the same graph.
Unless the global link style is MIXED_STYLE
, all links
have the same shape style.
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 link connectors
to an appropriate type.
public final int getGlobalLinkStyle()
setGlobalLinkStyle(int)
public final void setLinkStyle(Object link, int style)
MIXED_STYLE
. Otherwise, all links have the style that
is specified as the global link style.
Valid values are:
ORTHOGONAL_STYLE
-
the link has an orthogonal shape, that is, a shape consisting of a
sequence of alternating horizontal and vertical line segments.DIRECT_STYLE
-
the link gets a nearly straight-line shape. The shape of the link is
a polyline composed of a straight-line segment between the end nodes with
two short horizontal or vertical segments at its ends (their length is
controlled by the method setMinFinalSegmentLength
and
may be 0
).NO_RESHAPE_STYLE
- the link is not reshaped.
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.
public int getLinkStyle(Object link)
public final void setNodeBoxInterface(IlvNodeBoxInterface nodeBoxInterface)
IlvGraphic.boundingBox(ilog.views.IlvTransformer)
and IlvGraphModel.boundingBox(java.lang.Object)
)
by default.
This node box specifies the obstacle area of the node, that is, the area
that links should avoid so they do not overlap the node. This
can be different from the node box used to find the connection points of
the links.
You can call this method with a null
argument
to restore the default behavior.
public final IlvNodeBoxInterface getNodeBoxInterface()
null
if none is specified.public void setLinkConnectionBoxInterface(IlvLinkConnectionBoxInterface connectionBoxInterface)
By default, the layout algorithm places the connection points of
the links relative to the bounding box of the nodes
(see IlvGraphic.boundingBox(ilog.views.IlvTransformer)
and IlvGraphModel.boundingBox(java.lang.Object)
).
By setting a link connection box interface, the links can be connected
relative to a different box (see
getBox
).
In short link mode, the links are connected by default 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
:
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 is used (see
IlvGraphModel.boundingBox(Object)
).
You can call this method with a null
argument
to restore the default behavior.
public final void setNodeSideFilter(IltNodeSideFilter filter)
When a filter is specified, the layout algorithm asks the filter at which side of its end node each link is allowed to attach. Note that a filter should always allow a link to connect to at least one side of a node; otherwise the link cannot be routed. If no node-side filter is installed, the layout algorithm is free to choose any side of the nodes.
Note that the layout algorithm cannot always respect the specifications
of the filter, especially for the DIRECT_STYLE
link style.
You can call this method with a null
argument
to restore the default behavior.
public final IltNodeSideFilter getNodeSideFilter()
null
if none is specified.public void setCoordinatesMode(int mode)
The default is IlvGraphLayout.INVERSE_VIEW_COORDINATES
.
public void setUseDefaultParameters(boolean option)
true
, specifies that the layout use the default
values of all the parameters; that is, the "get..." and "is..." methods
return the default values.
The default value of this parameter is false
.
setUseDefaultParameters
in class IlvGraphLayout
IlvGraphLayout.isUseDefaultParameters()
public void setMinBusyTime(long time)
layoutStepPerformed
when the method
callLayoutStepPerformedIfNeeded
is used.
The default value is 50
(milliseconds).
setMinBusyTime
in class IlvGraphLayout
IlvGraphLayout.layoutStepPerformed()
,
IlvGraphLayout.callLayoutStepPerformedIfNeeded()
,
IlvGraphLayout.getMinBusyTime()
public void setAllowedTime(long time)
The default value is 32000
(milliseconds).
setAllowedTime
in class IlvGraphLayout
time
- The allowed time in milliseconds.IlvGraphLayout.supportsAllowedTime()
,
IlvGraphLayout.getAllowedTime()
,
IlvGraphLayout.isLayoutTimeElapsed()
,
IlvGraphLayoutReport.getCode()
public void setInputCheckEnabled(boolean enable)
It is enabled by default.
setInputCheckEnabled
in class IlvGraphLayout
IlvGraphLayout.isInputCheckEnabled()
public void setPreserveFixedLinks(boolean option)
true
, specifies that the layout is not allowed to reshape
the links indicated as fixed by the user. If the argument is
false
, the layout is free to reshape all the links of the
grapher.
(This does not change the setting for the fixed links, which can still be
used at any time in the future.)
The default value is false
.
public void setAnimate(boolean option)
If the argument is true
, the layout tries to redraw the
graph during layout to show the progress of the layout.
Note that to obtain a redraw of an IlvGrapher
during animation,
the method IlvGraphLayout.performLayout(boolean, boolean)
must be called with the value true
for the
redraw
argument.
It is disabled by default.
setAnimate
in class IlvGraphLayout
IlvGraphLayout.isAnimate()
,
IlvGraphLayout.supportsAnimation()
public boolean stopImmediately()
This method can be used if multiple threads are used for layout and GUI control. The GUI control thread calls this method to notify the layout thread that the layout run must be stopped. The layout algorithm will perform some final cleanup operations before terminating. Therefore, the layout thread will continue until the cleanup operations are finished. The GUI thread, however, returns immediately from this method.
If the layout algorithm is stopped before completion, the result code of
the layout report is
IlvGraphLayoutReport.STOPPED_AND_INVALID
.
stopImmediately
in class IlvGraphLayout
true
if the algorithm can be stopped at this
point in time.IlvGraphLayoutReport.getCode()
public void checkAppropriateLinks() throws IlvInappropriateLinkException
checkAppropriateLinks
in class IlvGraphLayout
IlvInappropriateLinkException
IlvGraphLayout.performLayout(boolean, boolean, boolean)
,
IlvGraphLayout.performLayout(boolean, boolean)
,
IlvGraphLayout.checkAppropriateLink(java.lang.Object)
,
IlvGraphModel.setLinkCheckEnabled(boolean)
,
IlvGraphModel.setConnectionPointCheckEnabled(boolean)
,
IlvGraphLayoutUtil.EnsureAppropriateLinks(ilog.views.graphlayout.IlvGraphModel, ilog.views.graphlayout.IlvLayoutProvider)
,
IlvInappropriateLinkException
public int checkAppropriateLink(Object link)
checkAppropriateLinks()
.checkAppropriateLink
in class IlvGraphLayout
link
- The link to be checked.checkAppropriateLinks()
public void setParametersUpToDate(boolean uptodate)
false
argument
each time the value of a parameter is changed.
It is automatically called with a true
argument each
time the layout is successfully performed.setParametersUpToDate
in class IlvGraphLayout
isParametersUpToDate()
public boolean isParametersUpToDate()
false
if at least one parameter was modified since
the last time the layout was successfully performed on the same graph
or if the layout has never been performed successfully on the same graph.
Returns true
if no changes occurred.isParametersUpToDate
in class IlvGraphLayout
setParametersUpToDate(boolean)
public void setStructureUpToDate(boolean uptodate)
false
argument
if the structure of the graph changed.
It is automatically called with a true
argument each
time the layout is successfully performed.setStructureUpToDate
in class IlvGraphLayout
isStructureUpToDate()
public boolean isStructureUpToDate()
false
if at least one modification occurred in the
structure of the graph since the last time the layout was successfully
performed on the same graph or if the layout has never been performed
successfully on the same graph.
Returns true
if no changes occurred.isStructureUpToDate
in class IlvGraphLayout
setParametersUpToDate(boolean)
public void setGeometryUpToDate(boolean uptodate)
false
argument
if the geometry of the graph changed.
It is automatically called with a true
argument each
time the layout is successfully performed.setGeometryUpToDate
in class IlvGraphLayout
isGeometryUpToDate()
public boolean isGeometryUpToDate()
false
if at least one node, link, label or obstacle
was moved or reshaped since the last time the layout was successfully
performed on the same graph or if the layout has never been performed
successfully on the same graph.
Returns true
if no changes occurred.isGeometryUpToDate
in class IlvGraphLayout
setGeometryUpToDate(boolean)
public final boolean supportsPreserveFixedLinks()
setPreserveFixedLinks(boolean)
is called with
a true
argument.
The effect is very similar to the effect when the link is filtered during
the layout.supportsPreserveFixedLinks
in class IlvGraphLayout
true
.IlvGrapherAdapter.setFilter(ilog.views.graphlayout.IlvLayoutGraphicFilter)
,
IlvGraphLayout.setPreserveFixedLinks(boolean)
,
IlvGraphLayout.isPreserveFixedLinks()
,
setGlobalLinkStyle(int)
,
setLinkStyle(java.lang.Object, int)
public final boolean supportsAnimation()
supportsAnimation
in class IlvGraphLayout
true
.IlvGraphLayout.setAnimate(boolean)
,
IlvGraphLayout.isAnimate()
public final boolean supportsAllowedTime()
IlvGraphLayoutReport.STOPPED_AND_INVALID
in this case.supportsAllowedTime
in class IlvGraphLayout
true
.IlvGraphLayout.setAllowedTime(long)
,
IlvGraphLayout.getAllowedTime()
,
IlvGraphLayoutReport.getCode()
public final boolean supportsStopImmediately()
IlvGraphLayoutReport.STOPPED_AND_INVALID
in this case.supportsStopImmediately
in class IlvGraphLayout
true
.IlvGraphLayout.stopImmediately()
,
IlvGraphLayout.isStoppedImmediately()
,
IlvGraphLayoutReport.getCode()
public final boolean supportsLinkConnectionBox()
The link connection box is used instead of the bounding box of each node
(see IlvGraphic.boundingBox(ilog.views.IlvTransformer)
and IlvGraphModel.boundingBox(java.lang.Object)
)
during the routing of links.
In short link mode, the connection rectangle and the tangential offsets
are respected. In long link mode, only the connection rectangle is
respected, and the tangential offsets provided by the link connection box
interface are ignored.
supportsLinkConnectionBox
in class IlvGraphLayout
true
.setLinkConnectionBoxInterface(ilog.views.graphlayout.IlvLinkConnectionBoxInterface)
,
setLayoutMode(int)
public boolean supportsSaveParametersToNamedProperties()
.ivl
file.supportsSaveParametersToNamedProperties
in class IlvGraphLayout
true
.IlvGrapherAdapter.saveParametersToNamedProperties(IlvGraphLayout, boolean)
,
IlvGrapherAdapter.loadParametersFromNamedProperties(IlvGraphLayout)
,
IlvGrapherAdapter.removeParametersFromNamedProperties()
protected IlvGraphLayoutGrapherProperty createLayoutGrapherProperty(String name, boolean withDefaults)
IltLinkLayoutGrapherProperty
that stores the parameter settings of this layout class.
The method is used by
IlvGrapherAdapter.saveParametersToNamedProperties(IlvGraphLayout, boolean)
to create a named property that contains parameter settings of this layout
instance.
createLayoutGrapherProperty
in class IlvGraphLayout
IlvGraphLayoutGrapherProperty
,
IlvGrapherAdapter.saveParametersToNamedProperties(IlvGraphLayout, boolean)
,
IlvGrapherAdapter.loadParametersFromNamedProperties(IlvGraphLayout)
,
IlvGrapherAdapter.removeParametersFromNamedProperties()
protected IlvGraphLayoutLinkProperty createLayoutLinkProperty(String name, IlvGraphic link, boolean withDefaults)
IltLinkLayoutLinkProperty
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.
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.