public class IlvCircularLayout extends IlvBasicLinkStyleLayout
The Circular Layout algorithm displays graphs representing interconnected ring and/or star network topologies. The algorithm takes into account the size of the nodes and tries to avoid overlapping nodes.
Here are sample drawings produced by the Circular Layout algorithm:
For the layout algorithm to work, you must provide information about the topology of the network, that is about how the network should be divided into interconnected clusters.
The layout algorithm provides three clustering modes (see setClusteringMode(int)
):
For each node of the graph, you must specify the cluster (that is,
either the ring or the star) to which it belongs. Note that a node can
belong to more than one cluster. To do this, you can use the methods
setClusterId(Object, IlvClusterId)
and addClusterId(Object, IlvClusterId)
. The class IlvClusterId
is the abstract base class that is used as the identifier for the
clusters. You can use one of its subclasses provided in JViews (IlvClusterName
and IlvClusterNumber
) or write your own
subclass.
In addition, for each cluster (ring or star), you can specify the
order of the nodes along the cluster (with the exception of the
central node for star clusters). To do this, you must use the methods
setClusterId(Object, IlvClusterId, int)
and addClusterId(Object, IlvClusterId, int)
, where the last argument is
an integer index value associated with the node and the cluster. If
the index values are provided, the layout algorithm places the nodes
on the cluster in the order specified by the indexes.
Note that in this mode 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
IlvGraphLayout.setPreserveFixedNodes(boolean)
with a true
argument.
This mode works similar to the clustering by cluster identifiers, however you do not need to specify cluster information for all nodes. The topology of the graph is analyzed to determine the clusters. A link crossing reduction heuristic is used to determine the order of the nodes within the clusters. Additionally, you can specify cluster ids or cluster indexe for some nodes, in the same way as in the mode clustering by cluster identifiers.
In this mode, the algorithm handles a nested graph including intergraph links. It arranges the nodes of each subgraph on a circle, so that the number of link crossings is small. It respects the intergraph links and rotates the cluster so that the number of link crossings is small.
It assumes that all nodes are nearly square, all nodes are in subgraphs, but the subgraph nesting is only 1. Nodes that are inside subgraphs of subgraphs are not anymore handles.
Note that in this mode each subgraph keeps its initial position. The subgraphs can be placed either by a different layout algorithm, or interactively.
The following figure illustrates the dimensional parameters of the layout algorithm (clustering by cluster identifiers).
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.
Modifier and Type | Field and Description |
---|---|
static int |
AUTOMATIC
Automatic clustering.
|
static int |
BY_CLUSTER_IDS
Clustering by cluster IDs mode.
|
static int |
BY_SUBGRAPHS
Clustering by subgraphs mode.
|
static int |
NO_INDEX
This value is returned by the method
getIndex when a node
has no index value with respect to a given cluster. |
static int |
NO_RESHAPE_STYLE
No links reshape option.
|
static int |
STRAIGHT_LINE_STYLE
Straight-line links shape option.
|
ALL_CORNERS, BOTTOM_LEFT, BOTTOM_RIGHT, CENTERED, CLOCK_WISE, CONNECTED_ONE_BEND_BUNDLE, CONNECTED_RECTANGULAR, CONNECTED_SQUARE, COUNTER_CLOCK_WISE, FREE_ONE_BEND_BUNDLE, FREE_RECTANGULAR, FREE_SQUARE, HORIZONTAL_TO_VERTICAL, INNER, NARROW_CONNECTED_RECTANGULAR, NARROW_CONNECTED_SQUARE, NARROW_FREE_RECTANGULAR, NARROW_FREE_SQUARE, NARROW_STRAIGHT_LINE_BUNDLE, NO_BENDS, NO_BUNDLE, OUTER, STRAIGHT_LINE_BUNDLE, TOP_LEFT, TOP_RIGHT, VERTICAL_TO_HORIZONTAL
INVERSE_VIEW_COORDINATES, MANAGER_COORDINATES, VIEW_COORDINATES
Constructor and Description |
---|
IlvCircularLayout()
Creates a new instance of the Circular Layout algorithm.
|
IlvCircularLayout(IlvCircularLayout source)
Creates a new layout instance by copying an existing one.
|
Modifier and Type | Method and Description |
---|---|
void |
addClusterId(Object node,
IlvClusterId id)
Allows you to add a cluster identifier
id to the list of
cluster identifiers to which node belongs. |
void |
addClusterId(Object node,
IlvClusterId id,
int index)
Allows you to add a cluster identifier
id to the list of
cluster identifiers to which node belongs. |
protected boolean |
clusterize()
Clusters the graph.
|
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
IlvCircularLayoutGrapherProperty
that stores the parameter settings of this layout class. |
protected IlvGraphLayoutNodeProperty |
createLayoutNodeProperty(String name,
IlvGraphic node,
boolean withDefaults)
Returns a new instance of
IlvCircularLayoutNodeProperty that
stores the parameter settings of this layout class for nodes. |
protected void |
customizeLayoutOfClusterGraph(IlvGraphLayout layout)
Customize the layout of the cluster graph before it is applied.
|
void |
detach()
Detaches the graph model from the layout instance.
|
IlvPoint |
getClusterCenter(int clusterIndex)
Returns the center of the cluster of index
clusterIndex . |
Vector |
getClusterIds()
Returns the identifiers of all clusters (rings and/or stars) that are
detected in the graph.
|
Enumeration |
getClusterIds(Object node)
Returns an enumeration of the cluster identifiers for the clusters to
which
node belongs. |
int |
getClusterIdsCount(Object node)
Returns the number of cluster identifiers to which
node
belongs. |
int |
getClusteringMode()
Returns the current clustering mode.
|
Vector |
getClusterNodes(int clusterIndex)
Returns the nodes that are contained in the cluster of index
clusterIndex . |
double |
getClusterRadius(int clusterIndex)
Returns the radius of the cluster of index
clusterIndex . |
double |
getDisconnectedGraphOffset()
Returns the offset between disconnected groups of clusters (rings
and/or stars).
|
int |
getHighDegreeStarClusterSize()
Returns the minimum size to create star clusters from nodes with high
degree.
|
int |
getIndex(Object node,
IlvClusterId clusterId)
Returns the index of
node with respect to its order on
the cluster that is identified by clusterId . |
double |
getInterClusterLinkCrossingPenalty()
Returns the penalty for crossings of links between nodes of different
cluster.
|
double |
getIntraClusterLinkCrossingPenalty()
Returns the penalty for crossings of links between nodes of the same
cluster.
|
IlvGraphLayout |
getLayoutOfClusterGraph()
Returns the layout instance that lays out the graph of clusters.
|
double |
getLevelOffset()
Returns the level offset value.
|
int |
getMaximumClusterSize()
Returns the maximum number of nodes to form a cluster.
|
int |
getMaximumNumberOfIterationsToReachMaxClusterSize()
Returns the number of iterations to achieve the maximum cluster size.
|
int |
getMaxNumberOfPermutations()
Returns the maximum number of permutations tested for a cluster of
more than 7 nodes.
|
int |
getMinimumClusterSize()
Returns the minimum number of nodes to form a cluster.
|
double |
getMixedClusterLinkCrossingPenalty()
Returns the penalty for crossings of intra cluster links with inter
cluster links.
|
double |
getOffset()
Returns the offset value.
|
IlvClusterId[] |
getRootClusterIds()
Returns the cluster identifiers (instances of
IlvClusterId ) of the root clusters, as specified using
the method setRootClusterId . |
protected void |
init()
Initializes instance variables.
|
protected void |
internalLayout(boolean redraw)
Computes the layout using the Circular Layout algorithm.
|
boolean |
isAreaMinimizationEnabled()
Returns whether total area minimization is enabled.
|
boolean |
isClusterByBiconnectivity()
Returns whether the clustering by biconnectivity is enabled.
|
boolean |
isInterClusterCrossingReduction()
Returns whether the crossing reduction takes inter cluster links into
account.
|
boolean |
isStarCenter(Object node)
Returns
true if node is the central node of
a star cluster, and false otherwise. |
void |
removeAllClusterIds(Object node)
Removes
node from all clusters to which it belongs. |
void |
removeAllRootClusterIds()
Allows you to reset all the root cluster settings.
|
void |
removeClusterId(Object node,
IlvClusterId id)
Removes
node from the cluster id . |
void |
removeRootClusterId(IlvClusterId clusterId)
Allows you to specify that a cluster is no longer the root of the
connected component of the graph of clusters to which it belongs.
|
void |
setAreaMinimizationEnabled(boolean option)
Sets whether the total area minimization option is enabled.
|
void |
setClusterByBiconnectivity(boolean enable)
Sets whether the clustering by biconnectivity is enabled.
|
void |
setClusterId(Object node,
IlvClusterId id)
Allows you to specify that
node belongs to a unique
cluster of a given identifier id . |
void |
setClusterId(Object node,
IlvClusterId id,
int index)
Allows you to specify that
node belongs to a unique
cluster of a given identifier id and is associated with
the integer value index . |
void |
setClusteringMode(int mode)
Sets the clustering mode.
|
void |
setDisconnectedGraphOffset(double offsetValue)
Sets the offset between disconnected groups of clusters (rings and/or
stars).
|
void |
setHighDegreeStarClusterSize(int size)
Sets the minimum size to create star clusters from nodes with high
degree.
|
void |
setInterClusterCrossingReduction(boolean enable)
Sets whether the crossing reduction takes inter cluster links into
account.
|
void |
setInterClusterLinkCrossingPenalty(double penalty)
Sets the penalty for crossings of links between nodes of different
clusters.
|
void |
setIntraClusterLinkCrossingPenalty(double penalty)
Sets the penalty for crossings of links between nodes of the same
cluster.
|
void |
setLayoutOfClusterGraph(IlvGraphLayout layout)
Returns the layout instance that lays out the graph of clusters.
|
void |
setLevelOffset(double offsetValue)
Sets the offset between two concentric levels.
|
void |
setMaximumClusterSize(int size)
Sets the maximum number of nodes to form a cluster.
|
void |
setMaximumNumberOfIterationsToReachMaxClusterSize(int numIterations)
Sets the number of iterations to achieve the maximum cluster size.
|
void |
setMaxNumberOfPermutations(int n)
Sets the maximum number of permutations tested for a cluster of more
than 7 nodes.
|
void |
setMinimumClusterSize(int size)
Sets the minimum number of nodes to form a cluster.
|
void |
setMixedClusterLinkCrossingPenalty(double penalty)
Sets the penalty for crossings of intra cluster links with inter
cluster links.
|
void |
setOffset(double offsetValue)
Sets the offset value.
|
void |
setRootClusterId(IlvClusterId clusterId)
Allows you to specify a root cluster for the connected component of
the graph of clusters to which it belongs.
|
void |
setRootClusterIds(IlvClusterId[] clusterIds)
Allows you to specify the root cluster for each connected component of
the graph of clusters.
|
void |
setStarCenter(Object node,
boolean starCenter)
Allows you to specify whether
node is the central node of
a star cluster. |
void |
setStructureUpToDate(boolean uptodate)
Sets whether the structure of the graph is up to date.
|
boolean |
supportsAllowedTime()
Indicates that this layout class can not stop the layout computation
when the user-defined allowed time is exceeded.
|
boolean |
supportsLayoutRegion()
Indicates that this layout class takes into account a user-defined
region (a rectangle) or a user-defined manager view to compute the
dimensions of the drawing.
|
boolean |
supportsPercentageComplete()
Indicates that this layout class can not estimate the percentage of
completion during the layout run.
|
boolean |
supportsStopImmediately()
Indicates that this layout class can interrupt the current run of the
layout immediately in a controlled way.
|
checkAppropriateLink, checkAppropriateLinks, getLayoutCodeOnInterrupt, getLinkStyle, getMovingNodes, getMultiLinkMaxSpread, getMultiLinkMode, getMultiLinkOffset, getMultiLinksCount, getMultiSelfLinkDistribution, getMultiSelfLinkMaxSpread, getMultiSelfLinkOffset, getPercentagesOfCompletion, getSelfLinkAbsoluteAttachPosition, getSelfLinkAllowedCorners, getSelfLinkMode, getSelfLinkOrientation, getSelfLinkRelativeAttachPosition, getSelfLinksCount, getSelfLinkSpacing, increasePercentageComplete, isConnectLinksToNodeCenters, isInterrupted, isSelfLinkConnectToNodeCenter, layout, setConnectLinksToNodeCenters, setLinkStyle, setMultiLinkMaxSpread, setMultiLinkMode, setMultiLinkOffset, setMultiSelfLinkDistribution, setMultiSelfLinkMaxSpread, setMultiSelfLinkOffset, setSelfLinkAbsoluteAttachPosition, setSelfLinkAllowedCorners, setSelfLinkConnectToNodeCenter, setSelfLinkMode, setSelfLinkOrientation, setSelfLinkRelativeAttachPosition, setSelfLinkSpacing, supportsLayoutOfConnectedComponents, supportsLinkClipping, supportsLinkConnectionBox, supportsPreserveFixedLinks, supportsPreserveFixedNodes, supportsSaveParametersToNamedProperties
addGraphLayoutEventListener, addGraphLayoutParameterEventListener, afterLayoutOfSubgraph, attach, attach, beforeLayout, beforeLayoutOfSubgraph, callLayoutStepPerformedIfNeeded, cleanGraphModel, cleanLink, cleanNode, clipAllLinks, clipLink, connectAllLinksToCenter, connectLinkToCenter, contentsChanged, createLayoutLinkProperty, createLayoutReport, 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, isAnimate, isAutoLayout, isFitToView, isFixed, isGeometryUpToDate, isInputCheckEnabled, isLayoutNeeded, isLayoutOfConnectedComponentsEnabled, isLayoutOfConnectedComponentsEnabledByDefault, isLayoutRunning, isLayoutRunning, isLayoutTimeElapsed, isLocalRecursiveLayoutNeeded, isMemorySavings, isParametersUpToDate, isPreserveFixedLinks, isPreserveFixedNodes, isSplineRoutingEnabled, isStoppedImmediately, isStructureUpToDate, isUseDefaultParameters, isUseSeedValueForRandomGenerator, layoutStepPerformed, onParameterChanged, onParameterChanged, performAutoLayout, performLayout, performLayout, performLayout, PerformLayout, performSublayout, removeGraphLayoutEventListener, removeGraphLayoutParameterEventListener, setAllowedTime, setAnimate, setAutoCheckAppropriateLinksEnabled, setAutoLayout, setAutoLayoutHandler, setBalanceSplineCurveThreshold, setCoordinatesMode, setFixed, setGeometryUpToDate, setGrapher, setGraphModel, setInputCheckEnabled, setLayoutOfConnectedComponents, setLayoutOfConnectedComponentsEnabled, setLayoutRegion, setLayoutRegion, setLayoutRegion, setLayoutReport, setLayoutRunning, setLinkClipInterface, setLinkConnectionBoxInterface, setMaxSplineCurveSize, setMemorySavings, setMinBusyTime, setMinSplineCurveSize, setParametersUpToDate, setParentLayout, setPreserveFixedLinks, setPreserveFixedNodes, setProperty, setProperty, setSeedValueForRandomGenerator, setSplineLinkFilter, setSplineRoutingEnabled, setUseDefaultParameters, setUseSeedValueForRandomGenerator, stopImmediately, supportsAnimation, supportsMemorySavings, supportsRandomGenerator, supportsSplineRouting, unfixAllLinks, unfixAllNodes, useAnimateRedraw
public static final int NO_INDEX
getIndex
when a node
has no index value with respect to a given cluster.public static final int BY_CLUSTER_IDS
setClusteringMode(int)
, the graph is divided into
clusters on the basis of the IlvClusterId
objects provided
for each node.addClusterId(Object, IlvClusterId, int)
,
setClusteringMode(int)
,
Constant Field Valuespublic static final int BY_SUBGRAPHS
When used as the argument of the method setClusteringMode(int)
, the graph is divided into clusters on the
basis of the structure of the nested graph. (For details, see setClusteringMode(int)
.)
setClusteringMode(int)
,
Constant Field Valuespublic static final int AUTOMATIC
When used as the argument of the method setClusteringMode(int)
, the graph is divided into clusters by
analysing the topology. (For details, see setClusteringMode(int)
.)
setClusteringMode(int)
,
Constant Field Valuespublic static final int STRAIGHT_LINE_STYLE
IlvBasicLinkStyleLayout.setLinkStyle(int)
, the links are given a straight-line shape.public static final int NO_RESHAPE_STYLE
IlvBasicLinkStyleLayout.setLinkStyle(int)
, the links are not reshaped.public IlvCircularLayout()
attach(IlvGrapher)
. attach(IlvGraphModel)
.
performLayout
.
public IlvCircularLayout(IlvCircularLayout source)
copy()
method. Any subclass
should provide a copy constructor.
The parameters of the source
layout are copied using the
method copyParameters(IlvGraphLayout)
.
source
- The layout instance that is copied.copy()
,
copyParameters(IlvGraphLayout)
public void copyParameters(IlvGraphLayout source)
Note that the parameters which are specific to a node or a link are not copied. The other parameters, including the 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 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
.
copyParameters
in class IlvBasicLinkStyleLayout
source
- The layout instance from which the parameters are copied.IlvBasicLinkStyleLayout.copy()
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 IlvBasicLinkStyleLayout
public IlvGraphLayout copy()
This method copies the layout instance by calling the copy constructor.
When performing a recursive layout of a nested graph, IlvLayoutProvider
uses this method to "clone" the layout instance of
a parent graph.
Note that the parameters specific to a node or link are not copied. The other parameters, including the layout region specification and he link clip and link connection box interfaces, are also copied.
If a method of the type supportsXXX
is associated with a
parameter, the parameter is copied only if the corresponding method
returns true
.
copy
in class IlvBasicLinkStyleLayout
public void detach()
IlvGraphLayout.attach(IlvGraphModel)
. The detach
method
performs cleaning operations on the graph model. In addition to the
cleaning operations in the base class, the Circular Layout algorithm
removes the cluster ID and the star center attribute from the nodes.
Note that you must call this method when you no longer need the layout instance. Otherwise, some objects may not be garbage collected.
detach
in class IlvGraphLayout
IlvGraphLayout.attach(IlvGraphModel)
,
setClusterId(Object, IlvClusterId, int)
protected void internalLayout(boolean redraw) throws IlvGraphLayoutException
IlvGraphLayout.performLayout(boolean, boolean,
boolean)
.
Note that if the attached graph model is an IlvGrapherAdapter
and clustering information was not provided (using the method setClusterId(Object, IlvClusterId, int)
or addClusterId(Object, IlvClusterId, int)
, clustering information
eventually stored in IlvClusterInfoProperty
) is automatically
read.
internalLayout
in class IlvBasicLinkStyleLayout
IlvGraphLayoutException
- when no cluster (ring or star) was
found, that is, if cluster information is not available. Also, the
subclass IlvInappropriateLinkException
can be thrown when
laying out an IlvGrapher
containing links that cannot be
reshaped to a straight line.IlvGraphLayout.performLayout(boolean, boolean, boolean)
,
IlvGraphLayout.getCalcLayoutRegion()
public void setRootClusterId(IlvClusterId clusterId)
If a root cluster is not specified for a connected component of the graph of clusters, an arbitrary cluster is used.
This parameter is only used if the clustering mode (see setClusteringMode(int)
) is BY_CLUSTER_IDS
.
clusterId
- The cluster identifier of the root cluster.getRootClusterIds()
,
removeRootClusterId(IlvClusterId)
,
removeAllRootClusterIds()
public void removeRootClusterId(IlvClusterId clusterId)
If a root cluster is not specified for a connected component of the graph of clusters, an arbitrary cluster is used.
This parameter is only used if the clustering mode (see setClusteringMode(int)
) is BY_CLUSTER_IDS
.
clusterId
- The cluster identifier.setRootClusterId(IlvClusterId)
,
getRootClusterIds()
,
removeAllRootClusterIds()
public void removeAllRootClusterIds()
This parameter is only used if the clustering mode (see setClusteringMode(int)
) is BY_CLUSTER_IDS
.
getRootClusterIds()
,
removeRootClusterId(IlvClusterId)
,
setRootClusterId(IlvClusterId)
public void setRootClusterIds(IlvClusterId[] clusterIds)
If a root cluster is not specified for a connected component of the graph of clusters, an arbitrary cluster is used.
This parameter is only used if the clustering mode (see setClusteringMode(int)
) is BY_CLUSTER_IDS
.
clusterIds
- The cluster identifiers of the root clusters.getRootClusterIds()
,
removeRootClusterId(IlvClusterId)
,
removeAllRootClusterIds()
public IlvClusterId[] getRootClusterIds()
IlvClusterId
) of the root clusters, as specified using
the method setRootClusterId
.
This parameter is only used if the clustering mode (see setClusteringMode(int)
) is BY_CLUSTER_IDS
.
This method returns null
if no root clusters have been
specified. In this case, arbitrary root clusters will be used for
each connected component of the graph of clusters.
setRootClusterId(IlvClusterId)
,
removeRootClusterId(IlvClusterId)
,
removeAllRootClusterIds()
public void setStructureUpToDate(boolean uptodate)
If the argument is false
, notifies the layout instance
that the structure of the graph was changed since the last time the
layout was successfully performed.
Usually you do not need to call this method. The method is
automatically called with a true
argument each time the
layout is successfully performed.
setStructureUpToDate
in class IlvGraphLayout
IlvGraphLayout.isStructureUpToDate()
,
IlvGraphLayout.isLayoutNeeded()
protected boolean clusterize()
setClusterId
and addClusterId
.false
if no clusters were detected,
true
otherwise.setClusterId(Object, IlvClusterId, int)
,
addClusterId(Object, IlvClusterId, int)
public final void setStarCenter(Object node, boolean starCenter)
node
is the central node of
a star cluster.
This parameter is only used if the clustering mode (see setClusteringMode(int)
) is BY_CLUSTER_IDS
or AUTOMATIC
.
node
- The node.starCenter
- true
if the node is the central node of a
star cluster.setStarCenter(IlvGraphic, boolean)
.isStarCenter(Object)
public boolean isStarCenter(Object node)
true
if node
is the central node of
a star cluster, and false
otherwise.
This parameter is only used if the clustering mode (see setClusteringMode(int)
) is BY_CLUSTER_IDS
or AUTOMATIC
.
node
- The node.true
if the node is the central node of a star
cluster.isStarCenter(IlvGraphic)
.setStarCenter(Object, boolean)
public final void setClusterId(Object node, IlvClusterId id)
node
belongs to a unique
cluster of a given identifier id
. IlvClusterId
for each
node.
This parameter is only used if the clustering mode (see setClusteringMode(int)
) is BY_CLUSTER_IDS
or AUTOMATIC
.
node
- The node.id
- The cluster ID.IllegalArgumentException
- if node
is not (or is
no longer) a node of the attached grapher.setClusterId(IlvGraphic, IlvClusterId)
.getClusterIds(Object)
public final void setClusterId(Object node, IlvClusterId id, int index)
node
belongs to a unique
cluster of a given identifier id
and is associated with
the integer value index
. (The index is used by the
layout algorithm to determine the ordering of the nodes on the
cluster.)
Note that index
must not be negative. The values of the
indexes for consecutive nodes in a cluster are not necessarily
consecutive. Only the order of the values is important.
This parameter is only used if the clustering mode (see setClusteringMode(int)
) is BY_CLUSTER_IDS
or AUTOMATIC
.
node
- The node.id
- The cluster ID.index
- The index.IllegalArgumentException
- if node
is not (or is
no longer) a node of the attached grapher.setClusterId(IlvGraphic, IlvClusterId, int)
.getClusterIds(Object)
public final void addClusterId(Object node, IlvClusterId id)
id
to the list of
cluster identifiers to which node
belongs.
This parameter is only used if the clustering mode (see setClusteringMode(int)
) is BY_CLUSTER_IDS
or AUTOMATIC
.
node
- The node.id
- The cluster ID.IllegalArgumentException
- if node
is not (or is
no longer) a node of the attached grapher.addClusterId(IlvGraphic, IlvClusterId)
.getClusterIds(Object)
public final void addClusterId(Object node, IlvClusterId id, int index)
id
to the list of
cluster identifiers to which node
belongs. It also adds
the associated integer value index
(to be used by the
layout algorithm to determine the order of the nodes on the cluster).
Note that index
must not be negative. The values of the
indexes for consecutive nodes in a cluster are not necessarily
consecutive. Only the order of the values is important.
This parameter is only used if the clustering mode (see setClusteringMode(int)
) is BY_CLUSTER_IDS
or AUTOMATIC
.
node
- The node.id
- The cluster ID.index
- The index.IllegalArgumentException
- if node
is not (or is
no longer) a node of the attached grapher.addClusterId(IlvGraphic, IlvClusterId, int)
.getClusterIds(Object)
public final void removeClusterId(Object node, IlvClusterId id)
node
from the cluster id
. IlvClusterId
as you used when you called
setClusterId
or addClusterId
. You can use
another instance if the instances are equal with respect to the
method IlvClusterId.equals
.
This parameter is only used if the clustering mode (see setClusteringMode(int)
) is BY_CLUSTER_IDS
or AUTOMATIC
.
node
- The node.id
- The cluster ID.removeClusterId(IlvGraphic, IlvClusterId)
.getClusterIds(Object)
public final void removeAllClusterIds(Object node)
node
from all clusters to which it belongs.
This parameter is only used if the clustering mode (see setClusteringMode(int)
) is BY_CLUSTER_IDS
or AUTOMATIC
.
node
- The node.removeAllClusterIds(IlvGraphic)
.getClusterIds(Object)
public Vector getClusterIds()
IlvClusterId
or subclasses. It returns null
if there are no cluster identifiers.
This method should be used only if the clustering mode (see setClusteringMode(int)
) is BY_CLUSTER_IDS
or AUTOMATIC
.
public double getClusterRadius(int clusterIndex)
clusterIndex
.
The index corresponds to the index of elements in the vector returned
by the method getClusterIds
. Therefore, valid values of
clusterIndex
range from zero to the number of clusters
minus one (that is, the size of the vector returned by the method
getClusterIds()
minus one).
Note that the returned value may not be correct if the nodes of the cluster have been moved since the layout was performed.
This method should be used only if the clustering mode (see setClusteringMode(int)
) is BY_CLUSTER_IDS
.
clusterIndex
- The cluster index.getClusterIds()
public IlvPoint getClusterCenter(int clusterIndex)
clusterIndex
.
The index corresponds to the index of elements in the vector returned
by the method getClusterIds
. Therefore, valid values of
clusterIndex
range from zero to the number of clusters
minus one (that is, the size of the vector returned by the method
getClusterIds()
minus one).
Note that the returned value will not be correct if the nodes of the cluster have been moved since the layout was performed.
This method should be used only if the clustering mode (see setClusteringMode(int)
) is BY_CLUSTER_IDS
.
clusterIndex
- The cluster index.getClusterIds()
public Vector getClusterNodes(int clusterIndex)
clusterIndex
. This index corresponds to the index of
elements in the vector returned by the method
getClusterIds
. Therefore, valid values of
clusterIndex
range from zero to the number of clusters
minus one (that is, the size of the vector returned by the method
getClusterIds()
minus one).
This method should be used only if the clustering mode (see setClusteringMode(int)
) is BY_CLUSTER_IDS
or AUTOMATIC
.
clusterIndex
- The cluster index.getClusterIds()
public Enumeration getClusterIds(Object node)
node
belongs. The elements of the enumeration are
instances of IlvClusterId
or subclasses.
This method should be used only if the clustering mode (see setClusteringMode(int)
) is BY_CLUSTER_IDS
or AUTOMATIC
.
node
- The node.getClusterIds(IlvGraphic)
.setClusterId(Object, IlvClusterId, int)
,
addClusterId(Object, IlvClusterId, int)
,
removeClusterId(Object, IlvClusterId)
public int getClusterIdsCount(Object node)
node
belongs.
This method should be used only if the clustering mode (see setClusteringMode(int)
) is BY_CLUSTER_IDS
or AUTOMATIC
.
node
- The node.getClusterIdsCount(IlvGraphic)
.getClusterIds(java.lang.Object)
public int getIndex(Object node, IlvClusterId clusterId)
node
with respect to its order on
the cluster that is identified by clusterId
. It returns
NO_INDEX
if node
has no index on the cluster.
This method should be used only if the clustering mode (see setClusteringMode(int)
) is BY_CLUSTER_IDS
or AUTOMATIC
.
node
- The node.clusterId
- The cluster ID.IllegalArgumentException
- if node
is not
contained in the cluster identified by clusterId
.getIndex(IlvGraphic, IlvClusterId)
.setClusterId(Object, IlvClusterId, int)
,
addClusterId(Object, IlvClusterId, int)
,
removeClusterId(Object, IlvClusterId)
public final void setClusteringMode(int mode)
BY_CLUSTER_IDS
- The information needed for dividing
the graph into clusters is provided using IlvClusterId
objects for all nodes.
For each node of the graph, you must specify the cluster (that is,
either the ring or the star) to which it belongs. Note that a node
can belong to more than one cluster. To do this, you can use the
methods setClusterId(Object, IlvClusterId)
and addClusterId(Object, IlvClusterId)
. The class IlvClusterId
is the abstract base class that is used as the identifier for the
clusters. You can use one of its subclasses provided in JViews
(IlvClusterName
and IlvClusterNumber
) or write your
own subclass.
In addition, for each cluster (ring or star), you can specify the
order of the nodes along the cluster (with the exception of the
central node for star clusters). To do this, you must use the methods
setClusterId(Object, IlvClusterId, int)
and addClusterId(Object, IlvClusterId, int)
, where the last argument is
an integer index value associated with the node and the cluster. If
the index values are provided, the layout algorithm places the nodes
on the cluster in the order specified by the indexes.
The position of the clusters is computed using a radial tree-like algorithm.
Note that in this mode 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 IlvGraphLayout.setPreserveFixedNodes(boolean)
with a
true
argument.
BY_SUBGRAPHS
- The information needed for dividing the
graph into clusters is provided by placing the nodes and links into
subgraphs.
In this mode, the algorithm handles a nested graph including intergraph links. It arranges the nodes of each subgraph on a circle, so that the number of link crossings is small. It respects the intergraph links and rotates the cluster so that the number of link crossings is small.
It assumes that all nodes are nearly square, all nodes are in subgraphs, but the subgraph nesting is only 1. Nodes that are inside subgraphs of subgraphs are not anymore handles.
Note that in this mode each subgraph keeps its initial position. The subgraphs can be placed either by a different layout algorithm, or interactively.
AUTOMATIC
- This is similar to the mode BY_CLUSTER_IDS
, but does not require any specification of clusters.
The graph is divided into clusters by anaylizing the topology of the
graph. Biconnected components form initial clusters. The remaining
nodes that do not belong to any (nontrivial) biconnected component
form star clusters if their degree is larger than the star cluster
threshold. Then, the initial clusters are merged if they are smaller
than the minimal size of a cluster, or split if they are larger than
the maximal size of a cluster.
You can specify clusters using IlvClusterId
objects for some
nodes, but it is not needed to specify it for all nodes. The class
IlvClusterId
is the abstract base class that is used as the
identifier for the clusters. You can use one of its subclasses
provided in JViews (IlvClusterName
and IlvClusterNumber
) or write your own subclass.
In addition, for specified cluster (ring or star), you can optionally
specify the order of the nodes along the cluster (with the exception
of the central node for star clusters). To do this, you must use the
methods setClusterId(Object, IlvClusterId, int)
and addClusterId(Object, IlvClusterId, int)
, where the last argument is
an integer index value associated with the node and the cluster. You
can specify indexe for all or some nodes of the cluster. Nodes with
specified index are placed in this relative order on the cluster.
Nodes without specified index are merged into this relative order by
using a heuristic to reduce the number of link crossings.
The position of the clusters is computed using an instance of IlvTreeLayout
.
The default value is BY_CLUSTER_IDS
.
getClusteringMode()
public final int getClusteringMode()
setClusteringMode(int)
public final void setMaxNumberOfPermutations(int n)
This parameter is only used if the clustering mode (see setClusteringMode(int)
) is BY_SUBGRAPHS
.
The algorithm generates permutations of node orderings along the cluster circle and chooses the one with the best crossing and rotation behavior according to some quality criteria. Since the number of permutations is exponential, it is feasible to test all permutations only if there are no more than 7 nodes. Otherwise, the algorithm randomly generates some permutations and chooses the best one. The more permutations are chosen, the better the layout result.
getMaxNumberOfPermutations()
public final int getMaxNumberOfPermutations()
This parameter is used only if the clustering mode (see setClusteringMode(int)
) is BY_SUBGRAPHS
.
setMaxNumberOfPermutations(int)
public final void setInterClusterCrossingReduction(boolean enable)
This parameter is used only if the clustering mode (see setClusteringMode(int)
) is AUTOMATIC
.
isInterClusterCrossingReduction()
public final boolean isInterClusterCrossingReduction()
This parameter is used only if the clustering mode (see setClusteringMode(int)
) is AUTOMATIC
.
setInterClusterCrossingReduction(boolean)
public final void setIntraClusterLinkCrossingPenalty(double penalty)
The default value is 1.
This parameter is used only if the clustering mode (see setClusteringMode(int)
) is AUTOMATIC
.
During the crossing reduction, intra cluster links compete with inter cluster links, since some node orderings of a cluster produce more crossings of links inside the cluster, while other node orderings produce more crossings of links connecting different clusters. The penalty allows to fine tune whether intra cluster links or inter cluster links are more important.
getIntraClusterLinkCrossingPenalty()
public final double getIntraClusterLinkCrossingPenalty()
setClusteringMode(int)
) is AUTOMATIC
.setIntraClusterLinkCrossingPenalty(double)
public final void setInterClusterLinkCrossingPenalty(double penalty)
The default value is 1.
This parameter is used only if the clustering mode (see setClusteringMode(int)
) is AUTOMATIC
.
During the crossing reduction, intra cluster links compete with inter cluster links, since some node orderings of a cluster produce more crossings of links inside the cluster, while other node orderings produce more crossings of links connecting different clusters. The penalty allows to fine tune whether intra cluster links or inter cluster links are more important.
getInterClusterLinkCrossingPenalty()
public final double getInterClusterLinkCrossingPenalty()
setClusteringMode(int)
) is AUTOMATIC
.setInterClusterLinkCrossingPenalty(double)
public final void setMixedClusterLinkCrossingPenalty(double penalty)
The default value is 1.
This parameter is used only if the clustering mode (see setClusteringMode(int)
) is AUTOMATIC
.
During the crossing reduction, intra cluster links compete with inter cluster links, since some node orderings of a cluster produce more crossings of links inside the cluster, while other node orderings produce more crossings of links connecting different clusters. The penalty allows to fine tune whether intra cluster links or inter cluster links are more important.
getMixedClusterLinkCrossingPenalty()
public final double getMixedClusterLinkCrossingPenalty()
setClusteringMode(int)
) is AUTOMATIC
.setMixedClusterLinkCrossingPenalty(double)
public final void setClusterByBiconnectivity(boolean enable)
setClusteringMode(int)
) is AUTOMATIC
.
If the graph is automatically clustered, sets of nodes that have many connections though links are transformed into clusters. The mathematical term is the biconnected component, a set of nodes that has so many connections so that removing one node or link still keeps the component connected. If clustering by biconnectivity is enabled, the biconnected components are the initial clusters. These might get furthermore split or merged if a minimal or maximal size per cluster is desired.
isClusterByBiconnectivity()
,
setMinimumClusterSize(int)
,
setMaximumClusterSize(int)
public final boolean isClusterByBiconnectivity()
setClusteringMode(int)
) is AUTOMATIC
.setClusterByBiconnectivity(boolean)
public final void setMinimumClusterSize(int size)
The default value is 4.
This parameter is used only if the clustering mode (see setClusteringMode(int)
) is AUTOMATIC
.
getMinimumClusterSize()
public final int getMinimumClusterSize()
setClusteringMode(int)
) is AUTOMATIC
.setMinimumClusterSize(int)
public final void setMaximumClusterSize(int size)
The default value is 50.
This parameter is used only if the clustering mode (see setClusteringMode(int)
) is AUTOMATIC
.
getMaximumClusterSize()
public final int getMaximumClusterSize()
setClusteringMode(int)
) is AUTOMATIC
.setMaximumClusterSize(int)
public final void setHighDegreeStarClusterSize(int size)
The default value is 5.
This parameter is used only if the clustering mode (see setClusteringMode(int)
) is AUTOMATIC
.
getHighDegreeStarClusterSize()
public final int getHighDegreeStarClusterSize()
setClusteringMode(int)
) is AUTOMATIC
.setHighDegreeStarClusterSize(int)
public final void setMaximumNumberOfIterationsToReachMaxClusterSize(int numIterations)
The default value is 10.
This parameter is used only if the clustering mode (see setClusteringMode(int)
) is AUTOMATIC
.
Splitting a cluster is an iterative process that tries to find good subclusters with only few links that run between different clusters. Initial subclusters are improved iteratively. If the cluster algorithm takes too much time, reducting the number of iterations speeds up the algorithm.
getMaximumNumberOfIterationsToReachMaxClusterSize()
public final int getMaximumNumberOfIterationsToReachMaxClusterSize()
setClusteringMode(int)
) is AUTOMATIC
.setMaximumNumberOfIterationsToReachMaxClusterSize(int)
public void setLayoutOfClusterGraph(IlvGraphLayout layout)
setClusteringMode(int)
) is AUTOMATIC
.
If a layout instance has been specified, this instance is used. If no
layout instance has been specified, an instance of IlvTreeLayout
is used. The tree layout is set to balloon layout
mode. Note that the node comparator of the tree layout should not be
set on this layout instance because it is modified at runtime (see
customizeLayoutOfClusterGraph(ilog.views.graphlayout.IlvGraphLayout)
). You can call this method
with a null
argument to return to the default tree
layout instance.
The layout instance cannot be used independently as long as it is set as a layout of the cluster graph.
layout
- The layout instance to set, or null
to use
the default layout instance.getLayoutOfClusterGraph()
public IlvGraphLayout getLayoutOfClusterGraph()
setClusteringMode(int)
) is AUTOMATIC
.
If a layout instance has been specified using the method setLayoutOfClusterGraph(IlvGraphLayout)
, this instance is returned.
If no layout instance has been specified using the method setLayoutOfClusterGraph(IlvGraphLayout)
, the method returns an
instance of IlvTreeLayout
. The tree layout is set to balloon
layout mode. Note that the node comparator of the tree layout should
not be set on this layout instance because it is modified at runtime
(see customizeLayoutOfClusterGraph(ilog.views.graphlayout.IlvGraphLayout)
).
setLayoutOfClusterGraph(IlvGraphLayout)
protected void customizeLayoutOfClusterGraph(IlvGraphLayout layout) throws IlvGraphLayoutException
getLayoutOfClusterGraph()
returns a tree layout instance, it
sets the node comparator to enforce an appropriate node ordering when
laying out the graph of clusters. It also sets the global link style
to IlvTreeLayout.NO_RESHAPE_STYLE
since the links of the
cluster graph are virtual links that don't need to be reshaped.layout
- The layout instance.IlvGraphLayoutException
public boolean supportsAllowedTime()
supportsAllowedTime
in class IlvBasicLinkStyleLayout
false
.IlvGraphLayout.setAllowedTime(long)
,
IlvGraphLayout.getAllowedTime()
,
IlvGraphLayoutReport.getCode()
public boolean supportsStopImmediately()
supportsStopImmediately
in class IlvBasicLinkStyleLayout
false
.IlvGraphLayout.stopImmediately()
,
IlvGraphLayout.isStoppedImmediately()
,
IlvGraphLayoutReport.getCode()
public final boolean supportsLayoutRegion()
However, it is not possible to allow the user to control the size of the layout by specifying a bounding box for the drawing. The layout algorithm determines the size so that it has enough space to avoid overlapping nodes and clusters.
The layout region setting (which is either your own or the default setting) is used only to determine the position of the center of the drawing. That means that only the center of the layout region is taken into consideration when performing the layout.
Note that this parameter is only used if the clustering mode (see
setClusteringMode(int)
) is BY_CLUSTER_IDS
or AUTOMATIC
.
supportsLayoutRegion
in class IlvGraphLayout
true
.IlvGraphLayout.setLayoutRegion(ilog.views.IlvManagerView)
,
IlvGraphLayout.setLayoutRegion(ilog.views.IlvManagerView, ilog.views.IlvRect)
,
IlvGraphLayout.setLayoutRegion(ilog.views.IlvRect)
,
IlvGraphLayout.getSpecLayoutRegion()
,
IlvGraphLayout.getCalcLayoutRegion()
public boolean supportsPercentageComplete()
supportsPercentageComplete
in class IlvBasicLinkStyleLayout
false
.IlvGraphLayoutReport.getPercentageComplete()
public void setAreaMinimizationEnabled(boolean option)
If this option is enabled, priority is given to the readability of the layout. The child clusters are positioned closer to their parent clusters.
If this option is disabled, the algorithm gives a higher priority to the minimization of the total area of the layout.
The default value is false
.
Enabling the total area minimization is recommended for large graphs where the total area of the layout may become very large.
Note that this parameter is only used if the clustering mode (see
setClusteringMode(int)
) is BY_CLUSTER_IDS
.
option
- true
to set area minimization priority, or
false
to set readability priority.isAreaMinimizationEnabled()
public boolean isAreaMinimizationEnabled()
Note that this parameter is only used if the clustering mode (see
setClusteringMode(int)
) is BY_CLUSTER_IDS
.
setAreaMinimizationEnabled(boolean)
public void setOffset(double offsetValue)
The default value is 10
.
offsetValue
- The offset between two nodes.getOffset()
public double getOffset()
setOffset(double)
public void setLevelOffset(double offsetValue)
The default value is zero.
Note that this parameter is only used if the clustering mode (see
setClusteringMode(int)
) is BY_CLUSTER_IDS
.
offsetValue
- The level offset value.getLevelOffset()
public double getLevelOffset()
Note that this parameter is only used if the clustering mode (see
setClusteringMode(int)
) is BY_CLUSTER_IDS
.
setLevelOffset(double)
public void setDisconnectedGraphOffset(double offsetValue)
The default value is 10
.
Note that this parameter is only used if the clustering mode (see
setClusteringMode(int)
) is BY_CLUSTER_IDS
.
offsetValue
- The disconnected graph offset value.getDisconnectedGraphOffset()
public double getDisconnectedGraphOffset()
Note that this parameter is only used if the clustering mode (see
setClusteringMode(int)
) is BY_CLUSTER_IDS
.
setDisconnectedGraphOffset(double)
protected IlvGraphLayoutGrapherProperty createLayoutGrapherProperty(String name, boolean withDefaults)
IlvCircularLayoutGrapherProperty
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 IlvBasicLinkStyleLayout
IlvGraphLayoutGrapherProperty
,
IlvGrapherAdapter.saveParametersToNamedProperties(IlvGraphLayout,
boolean)
,
IlvGrapherAdapter.loadParametersFromNamedProperties(IlvGraphLayout)
,
IlvGrapherAdapter.removeParametersFromNamedProperties()
protected IlvGraphLayoutNodeProperty createLayoutNodeProperty(String name, IlvGraphic node, boolean withDefaults)
IlvCircularLayoutNodeProperty
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.
createLayoutNodeProperty
in class IlvGraphLayout
IlvGraphLayoutNodeProperty
,
IlvGrapherAdapter.saveParametersToNamedProperties(IlvGraphLayout,
boolean)
,
IlvGrapherAdapter.loadParametersFromNamedProperties(IlvGraphLayout)
,
IlvGrapherAdapter.removeParametersFromNamedProperties()
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.