ibm_ilog.graphlayout.random.RandomLayout
The main class for the Random Layout algorithm.
This is the simplest layout algorithm. The nodes are moved at
randomly-computed positions inside a user-defined region which can be
specified using the method
ibm_ilog.graphlayout.GraphLayout.layoutRegion
.
Sample drawing produced by the Random Layout algorithm:
See the corresponding chapter of the User Manual for details on the algorithm, the types of graphs for which this algorithm can be used, features and limitations, code samples, 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
ibm_ilog.graphlayout.GraphLayout.setPreserveFixedNodes()
with
a true
argument.
Method Summary
- constructor(source) Returns a new instance of ' BasicLinkStyleLayoutNodeProperty' that stores the parameter settings of this layout class for nodes.
- copy() returns ibm_ilog.graphlayout.GraphLayout Copies the layout instance.
- copyParameters(source) Copies the parameters from a given layout instance.
- getLayoutCodeOnInterrupt() returns int Returns the layout code when the allowed time elapsed before completion of the layout.
- getLinkStyle() returns int Returns the current option for the style of the shape of the links.
- getMultiLinkMaxSpread() returns Number Returns the maximum spread width between multiple links between the same pair of nodes.
- getMultiLinkMode() returns int Returns the current option for the mode how multiple links between the same pair of nodes are laid out.
- getMultiLinkOffset() returns Number Returns the offset between multiple links between the same pair of nodes.
- getMultiLinksCount() returns int Returns the number of multilinks.
- getMultiSelfLinkDistribution() returns int Returns the current option for the distribution of bundles of multiple self-links (that is, multiple links that start and end at the same node).
- getMultiSelfLinkMaxSpread() returns Number Returns the maximum spread width between multiple self-links (that is, multiple links that start and end at the same node).
- getMultiSelfLinkOffset() returns Number Returns the offset between multiple self-links (that is, multiple links that start and end at the same node).
- getPercentagesOfCompletion() returns Array Returns an array of 4 integer numbers, denoting the percentage of completion: <ol> <li> After collecting multilinks and self-links.
- getSelfLinkAbsoluteAttachPosition() returns Point Returns the absolute attach position at the node border for self-links (that is, links that start and end at the same node).
- getSelfLinkAllowedCorners() returns int Returns which corners are allowed to have self-links (that is, links that start and end at the same node).
- getSelfLinkMode() returns int Returns the current option for the mode how self-links (that is, links that start and end at the same node) are laid out.
- getSelfLinkOrientation() returns int Returns the current option for the orientation of self-links (that is, links that start and end at the same node).
- getSelfLinkRelativeAttachPosition() returns Point Returns the relative attach position at the node border for self-links (that is, links that start and end at the same node).
- getSelfLinkSpacing() returns Number Returns the minimal spacing between node border and the self-links (that is, links that start and end at the same node).
- getSelfLinksCount() returns int Returns the number of self-links.
- increasePercentageComplete(newPercentage) Increases the percentage of completion that is stored in the layout report to the input value.
- init() Initializes instance variables.
- internalLayout() Computes the layout using the Random Layout algorithm.
- isConnectLinksToNodeCenters() returns Boolean Returns 'true' if the algorithm connects the links to the centers of the nodes.
- isInterrupted() returns Boolean Returns 'true' if the layout is interrupted.
- isSelfLinkConnectToNodeCenter() returns Boolean Returns whether self-links (that is, links that start and end at the same node) connect towards the node center.
- layout() Computes the layout using the Basic Link Style Layout algorithm.
- setConnectLinksToNodeCenters(enable) Sets whether the algorithm connects the links to the centers of the nodes.
- setLinkStyle(style) Sets the style of the shape of the links.
- setMultiLinkMaxSpread(maxSpread) Sets the maximum spread width between multiple links between the same pair of nodes.
- setMultiLinkMode(mode) Sets the mode how multiple links between the same pair of nodes are laid out.
- setMultiLinkOffset(offset) Sets the offset between multiple links between the same pair of nodes.
- setMultiSelfLinkDistribution(distribution) Sets the distribution of bundles of multiple self-links (that is, multiple links that start and end at the same node).
- setMultiSelfLinkMaxSpread(maxSpread) Sets the maximum spread width between multiple self-links (that is, multiple links that start and end at the same node).
- setMultiSelfLinkOffset(offset) Sets the offset between multiple self-links (that is, multiple links that start and end at the same node).
- setSelfLinkAbsoluteAttachPosition(position) Sets the absolute attach position at the node border for self-links (that is, links that start and end at the same node).
- setSelfLinkAllowedCorners(corners) Sets which corners are allowed to have self-links (that is, links that start and end at the same node).
- setSelfLinkConnectToNodeCenter(enable) Sets whether self-links (that is, links that start and end at the same node) connect towards the node center.
- setSelfLinkMode(mode) Sets the mode how self-links (that is, links that start and end at the same node) are laid out.
- setSelfLinkOrientation(orientation) Sets the orientation of self-links (that is, links that start and end at the same node).
- setSelfLinkRelativeAttachPosition(position) Sets the relative attach position at the node border for self-links (that is, links that start and end at the same node).
- setSelfLinkSpacing(spacing) Sets the minimal spacing between node border and self-links (that is, links that start and end at the same node).
- supportsAllowedTime() returns Boolean Indicates that this layout class can stop the layout computation when the user-defined allowed time is exceeded.
- supportsLayoutOfConnectedComponents() returns Boolean 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 ' ibm_ilog.graphlayout.GraphLayout.getLayoutOfConnectedComponents()' to position the connected components.
- supportsLayoutRegion() returns Boolean Indicates that this layout class can control the size of the drawing of the graph to fit (exactly or approximately) a user-defined region (a rectangle) or a user-defined manager view.
- supportsLinkConnectionBox() returns Boolean Indicates that this layout class can use a link connection box interface to calculate the end points of a link.
- supportsPercentageComplete() returns Boolean Indicates that this layout class can estimate the percentage of completion during the layout run.
- supportsPreserveFixedLinks() returns Boolean Indicates that this layout class allows the user to specify fixed links.
- supportsPreserveFixedNodes() returns Boolean Indicates that this layout class allows the user to specify fixed nodes.
- supportsRandomGenerator() returns Boolean Indicates that this layout class uses randomly generated numbers that can be initialized with a user-defined seed value.
- supportsStopImmediately() returns Boolean Indicates that this layout class can interrupt the current run of the layout immediately in a controlled way.
Methods
Returns a new instance of
BasicLinkStyleLayoutNodeProperty
that stores the parameter
settings of this layout class for nodes.
The method is used by
ibm_ilog.graphlayout.AbstractGraphLayoutModel.saveParametersToNamedProperties()
to create a named property for a node that contains parameter
settings of this layout instance for the input node.
Parameter | Type | Description |
---|---|---|
source |
Copies the layout instance.
This method copies the layout instance by calling the copy constructor.
When performing a recursive layout on a nested graph, this method is
used by ibm_ilog.graphlayout.ILayoutProvider
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.
If a method of the type supportsXXX
is associated with
a parameter, the parameter is copied only if the corresponding
method returns true
.
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.
If a method of the type supportsXXX
is associated with
a parameter, the parameter is copied only if the corresponding
method returns true
.
Parameter | Type | Description |
---|---|---|
source |
Returns the number of multilinks.
Can be used by subclasses inside
BasicLinkStyleLayout.internalLayout()
to test how many
multilinks have to be treated.
Returns an array of 4 integer numbers, denoting the percentage of completion:
- After collecting multilinks and self-links.
- After calling
RandomLayout.internalLayout()
. - After treating all multilinks.
- After treating all self-links.
Returns the absolute attach position at the node border for self-links (that is, links that start and end at the same node). The absolute attach position is expressed as absolute coordinate units.
- ' BasicLinkStyleLayout.TOP_LEFT': top left corner.
- ' BasicLinkStyleLayout.TOP_RIGHT': top right corner.
- ' BasicLinkStyleLayout.BOTTOM_RIGHT': bottom right corner.
- ' BasicLinkStyleLayout.BOTTOM_LEFT': bottom left corner.
Returns which corners are allowed to have self-links (that is, links that start and end at the same node). The default value is all the corners, that is, a combination of all the possible values.
Returns the relative attach position at the node border for self-links (that is, links that start and end at the same node). The relative attach position is expressed as a fraction of the width and height of the node bounding box. Self-links occur at a corner of the node, and the relative position is specified with respect to this corner.
Returns the number of self-links.
Can be used by subclasses inside
BasicLinkStyleLayout.internalLayout()
to test how many
self-links have to be treated.
Increases the percentage of completion that is stored in the layout report to the input value. Layout algorithms that support the percentage complete feature should call this method during the running of the layout. This method does not set the percentage to a lower value than the previous value. It also does not set the value to more than 100%. It silently ignores wrong input values.
Parameter | Type | Description |
---|---|---|
newPercentage | int | New percentage of completion |
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.
Computes the layout using the Random Layout algorithm.
To start the layout, call the method
ibm_ilog.graphlayout.GraphLayout.performLayout()
.
Computes the layout using the Basic Link Style Layout algorithm.
To start the layout, call the method
ibm_ilog.graphlayout.GraphLayout.performLayout()
. Subclasses
should not override this method but should override
BasicLinkStyleLayout.internalLayout()
instead.
Sets whether the algorithm connects the links to the centers of the
nodes.
This option has only an effect if the link style is not
BasicLinkStyleLayout.NO_RESHAPE_STYLE
. If the argument is
true
, the links are connected to the center of the
nodes. If a link connection box is set, it uses the virtual center
of the connection box instead of the center of the bounding boxes of
the end nodes. 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)
.
The default value is true
.
Parameter | Type | Description |
---|---|---|
enable |
Sets the style of the shape of the links.
Valid values are
BasicLinkStyleLayout.STRAIGHT_LINE_STYLE
(the links are given
a straight-line shape) and
BasicLinkStyleLayout.NO_RESHAPE_STYLE
(no reshape is
performed on the links).
This feature can be useful if the graph contains links that have
intermediate points and are not straight-line links, for instance,
ilog.diagrammer.model.DiagrammerLink
links with
intermediate points.
The default value is
BasicLinkStyleLayout.STRAIGHT_LINE_STYLE
.
Parameter | Type | Description |
---|---|---|
style | int | The link style value. |
Sets the maximum spread width between multiple links between the same pair of nodes.
If the multilink mode is
BasicLinkStyleLayout.STRAIGHT_LINE_BUNDLE
or
BasicLinkStyleLayout.NARROW_STRAIGHT_LINE_BUNDLE
, the
multiple straight line links are shifted relative to each other to
avoid overlaps. If the multilink mode is
BasicLinkStyleLayout.CONNECTED_ONE_BEND_BUNDLE
or
BasicLinkStyleLayout.FREE_ONE_BEND_BUNDLE
, bends are added to
the multiple links to avoid that those links overlap. The straight
links, or the multilink bends, respectively, are shifted relative to
each other by the multilink offset unless the number of links times
the offset exceeds the max spread value. In that case, the offset is
limited by the max spread value. If the multilink mode is
BasicLinkStyleLayout.NARROW_STRAIGHT_LINE_BUNDLE
, the offset
is further limited by the node size. If the multilink mode is
BasicLinkStyleLayout.NO_BUNDLE
, the maximum spread width has
no effect.
This maximum spread width affects only links that are no self-links.
See BasicLinkStyleLayout.setMultiSelfLinkMaxSpread()
for the same parameter at self-links.
The default maximum spread value is 50
.
Parameter | Type | Description |
---|---|---|
maxSpread | Number | The maximum spread value. |
Sets the mode how multiple links between the same pair of nodes are laid out. Valid values are:
-
BasicLinkStyleLayout.NO_BUNDLE
- no bundling. Multiple links between the same pair of nodes are not spread out and will overlap. -
BasicLinkStyleLayout.STRAIGHT_LINE_BUNDLE
- straight line bundling. Multiple links between the same pair of nodes are routed as straight lines but shifted relative to each other to avoid overlaps. Different to the narrow mode, the shift offset is not limited by the node size. -
BasicLinkStyleLayout.NARROW_STRAIGHT_LINE_BUNDLE
- narrow straight line bundling (the default). Multiple links between the same pair of nodes are routed as straight lines but shifted relative to each other to avoid overlaps. The bundle may appear more narrow since the shift offset is limited by the size of the end nodes. -
BasicLinkStyleLayout.CONNECTED_ONE_BEND_BUNDLE
- one bend polyline bundling with connection. Multiple links between the same pair of nodes are routed with one bend to avoid overlaps. All links of the bundle are connected to the node and start at the same point and end at the same point. -
BasicLinkStyleLayout.FREE_ONE_BEND_BUNDLE
- one bend polyline bundling without enforced connection. Multiple links between the same pair of nodes are routed with one bend to avoid overlaps. The link connection point is not enforced, that is, the node and link are free to decide themselves where to place the connection point. There is no guarantee that all links of the bundle start or end at a common point.
BasicLinkStyleLayout.NO_RESHAPE_STYLE
.
Parameter | Type | Description |
---|---|---|
mode | int | The multilink mode value. |
Sets the offset between multiple links between the same pair of
nodes.
If the multilink mode is
BasicLinkStyleLayout.STRAIGHT_LINE_BUNDLE
or
BasicLinkStyleLayout.NARROW_STRAIGHT_LINE_BUNDLE
, it is the
offset between the the multiple straight line links. If the
multilink mode is
BasicLinkStyleLayout.CONNECTED_ONE_BEND_BUNDLE
or
BasicLinkStyleLayout.FREE_ONE_BEND_BUNDLE
, it is the offset
between the bends that are added to the multiple links to avoid that
those links overlap. If the multilink mode is
BasicLinkStyleLayout.NO_BUNDLE
, the offset has no effect.
The straight links, or the multilink bends, respectively, are
shifted relative to each other by the multilink offset unless the
number of links times the offset exceeds the max spread value. In
that case, the offset is limited by the max spread value. If the
multilink mode is
BasicLinkStyleLayout.NARROW_STRAIGHT_LINE_BUNDLE
, the offset
is further limited by the node size.
This offset affects only links that are no self-links. See
BasicLinkStyleLayout.setMultiSelfLinkOffset()
for the same
parameter at self-links.
The default value is 10
.
Parameter | Type | Description |
---|---|---|
offset | Number | The offset value. |
Sets the distribution of bundles of multiple self-links (that is, multiple links that start and end at the same node). Self-link bundles form essentially nested rectangles or circles. There is a reference point at the node border and this reference point is either in the middle of the bundle, or at the outermost circle or at the innermost cicle. Valid values are:
-
BasicLinkStyleLayout.CENTERED
- centered (default). The middle of a bundle of multiple self-links is attached at the reference points for self-links. The nested circles are equally spread out towards the inner nesting and towards the outer nesting. -
BasicLinkStyleLayout.OUTER
- towards outer nestings. The innermost self-link of a bundle of multiple self-links is attached at the reference points for self-links and the remaining self-links are distributed towards the outer of the nestings. -
BasicLinkStyleLayout.INNER
- towards inner nestings. The outermost self-link of a bundle of multiple self-links is attached at the reference points for self-links and the remaining self-links are distributed towards the inner of the nestings.
BasicLinkStyleLayout.NO_RESHAPE_STYLE
and the
self-link mode is not BasicLinkStyleLayout.NO_BENDS
.
Parameter | Type | Description |
---|---|---|
distribution | int | The distribution mode for multiple self-links. |
Sets the maximum spread width between multiple self-links (that is, multiple links that start and end at the same node).
If the self-link mode is not
BasicLinkStyleLayout.NO_BENDS
, bends are added to self-links.
If there are multiple self-links at the same node, the bends are
shifted relative to each other by the multiple self-link offset
unless the number of self-links times the offset exceeds the max
spread value. In that case, the offset is limited by the max spread
value. If the self-link mode is
BasicLinkStyleLayout.NARROW_CONNECTED_RECTANGULAR
,
BasicLinkStyleLayout.NARROW_CONNECTED_SQUARE
,
BasicLinkStyleLayout.NARROW_FREE_RECTANGULAR
, or
BasicLinkStyleLayout.NARROW_FREE_SQUARE
, the offset is
further limited by the node size. If the self-link mode is
BasicLinkStyleLayout.NO_BENDS
, the maximum spread width has
no effect.
This maximum spread width affects only self-links, no other
multilinks. See
BasicLinkStyleLayout.setMultiLinkMaxSpread()
for the same
parameter at other multilinks.
The default maximum spread value is 50
.
Parameter | Type | Description |
---|---|---|
maxSpread | Number | The maximum spread value. |
Sets the offset between multiple self-links (that is, multiple links that start and end at the same node).
If the self-link mode is not
BasicLinkStyleLayout.NO_BENDS
, bends are added to self-links.
If there are multiple self-links at the same node, the bends are
shifted relative to each other by the multiple self-link offset
unless the number of self-links times the offset exceeds the
multiple self-link max spread value. In that case, the offset is
limited by the max spread value. If the self-link mode is
BasicLinkStyleLayout.NARROW_CONNECTED_RECTANGULAR
,
BasicLinkStyleLayout.NARROW_CONNECTED_SQUARE
,
BasicLinkStyleLayout.NARROW_FREE_RECTANGULAR
, or
BasicLinkStyleLayout.NARROW_FREE_SQUARE
, the offset is
further limited by the node size. If the self-link mode is
BasicLinkStyleLayout.NO_BENDS
, the offset has no effect.
This offset affects only self-links, no other multilinks. See
BasicLinkStyleLayout.setMultiLinkOffset()
for the same
parameter at other multilinks.
The default value is 10
.
Parameter | Type | Description |
---|---|---|
offset | Number | The offset value. |
Sets the absolute attach position at the node border for self-links
(that is, links that start and end at the same node).
The x value of the position specifies a point at the top or bottom
border of the node, and the y value of the position specifies a
point at the left or right border of the node. The absolute attach
position is expressed as absolute coordinate units. Self-links occur
at a corner of the node, and the relative position is specified with
respect to this corner. For instance, if the self-link occurs at the
bottom right corner, the attach position (10, 20)
specifies that the self-link goes from 10 units away from the corner
at the bottom side (that is, x = node.x + node.width -
10
) to 20 units away from the corner at the right side (that
is, y = node.y + node.height - 20
).
If the self-link mode is
BasicLinkStyleLayout.CONNECTED_SQUARE
,
BasicLinkStyleLayout.NARROW_CONNECTED_SQUARE
,
BasicLinkStyleLayout.FREE_SQUARE
, or
BasicLinkStyleLayout.NARROW_FREE_SQUARE
, then the attach
position is only respected at one side and calculate on the other
side to form a square.
The real attach position is the sum of the relative attach position
The real attach position is the sum of the relative attach position and the absolute attach position.
The default value of the absolute attach position is (0,
0)
.
Parameter | Type | Description |
---|---|---|
position | Point | The absolute attach position for self-links. |
Sets which corners are allowed to have self-links (that is, links
that start and end at the same node).
The default value is BasicLinkStyleLayout.ALL_CORNERS
,
that is, a combination of all the possible values:
-
BasicLinkStyleLayout.TOP_LEFT
: top left corner. -
BasicLinkStyleLayout.TOP_RIGHT
: top right corner. -
BasicLinkStyleLayout.BOTTOM_RIGHT
: bottom right corner. -
BasicLinkStyleLayout.BOTTOM_LEFT
: bottom left corner.
Parameter | Type | Description |
---|---|---|
corners | int | A bitwise-Or combination of the following values: BasicLinkStyleLayout.TOP_LEFT: top left corner; BasicLinkStyleLayout.TOP_RIGHT: top right corner; BasicLinkStyleLayout.BOTTOM_RIGHT: bottom right corner; BasicLinkStyleLayout.BOTTOM_LEFT: bottom left corner; or the value BasicLinkStyleLayout.ALL_CORNERS. |
Sets whether self-links (that is, links that start and end at the
same node) connect towards the node center.
This is disabled by default. It has only an effect for the self-link
modes BasicLinkStyleLayout.CONNECTED_RECTANGULAR
,
BasicLinkStyleLayout.NARROW_CONNECTED_RECTANGULAR
,
BasicLinkStyleLayout.CONNECTED_SQUARE
, or
BasicLinkStyleLayout.NARROW_CONNECTED_SQUARE
. If disabled,
the self-link segments incident to the node border are orthogonal to
the node border. If enabled, the self-link segments are rotated to
point towards the node center.
Parameter | Type | Description |
---|---|---|
enable | Boolean | Whether the option is enabled. |
Sets the mode how self-links (that is, links that start and end at the same node) are laid out. Valid values are:
-
BasicLinkStyleLayout.NO_BENDS
- no reshape. Self-links are not reshaped with bends and may not be visible after layout. -
BasicLinkStyleLayout.CONNECTED_RECTANGULAR
- rectangular self-links with 3 bends and connection. Self-links are reshaped with 3 bends placed in orthogonal style so that the link segments approximately resemble three quarters of a rectangle (the fourth quarter being the node where the self-link is attached). The connection points are placed on the border of the node. -
BasicLinkStyleLayout.FREE_RECTANGULAR
- rectangular self-links with 3 bends without enforced connection. Self-links are reshaped with 3 bends placed at the same position likeBasicLinkStyleLayout.CONNECTED_RECTANGULAR
. However, the link connection points are not enforced, that is, the nodes and links are free to decide themselves where to place the connection point. Since the connection point is not enforced, the link segments in free rectangular mode may not be orthogonal. -
BasicLinkStyleLayout.CONNECTED_SQUARE
- square self-links with 3 bends and connection. Self-links are reshaped with 3 bends placed in orthogonal style so that the link segments approximately resemble three quarters of a square (the fourth quarter being the node where the self-link is attached). If the self-link is a spline link, the square shape might be more appropriate than a rectangular shape since the spline then may approximately resemble three quarters of a circle. The connection points are placed on the border of the node. -
BasicLinkStyleLayout.FREE_SQUARE
- square self-links with 3 bends without enforced connection. Self-links are reshaped with 3 bends placed at the same position likeBasicLinkStyleLayout.CONNECTED_SQUARE
. If the self-link is a spline link, the square shape might be more appropriate than a rectangular shape since the spline then may approximately resemble three quarters of a circle. However, the link connection points are not enforced, that is, the nodes and links are free to decide themselves where to place the connection point. Since the connection point is not enforced, the link segments in free rectangular mode may not be orthogonal. -
BasicLinkStyleLayout.NARROW_CONNECTED_RECTANGULAR
- narrow rectangular self-links with 3 bends and connection (default). Self-links are reshaped with 3 bends placed in orthogonal style so that the link segments approximately resemble three quarters of a rectangle (the fourth quarter being the node where the self-link is attached). The connection points are placed on the border of the node. For single self-links, this mode has the same effect likeBasicLinkStyleLayout.CONNECTED_RECTANGULAR
. If you have multiple self-links at the same node, the self-links are shifted by an offset to avoid overlaps. In this case, this mode differs fromBasicLinkStyleLayout.CONNECTED_RECTANGULAR
, as the self-link bundle may appear more narrow since the shift offset of the multiple self-links is limited by the size of the end node. -
BasicLinkStyleLayout.NARROW_FREE_RECTANGULAR
- narrow rectangular self-links with 3 bends without enforced connection. Self-links are reshaped with 3 bends placed at the same position likeBasicLinkStyleLayout.NARROW_CONNECTED_RECTANGULAR
. For single self-links, this mode has the same effect likeBasicLinkStyleLayout.FREE_RECTANGULAR
. If you have multiple self-links at the same node, the self-links are shifted by an offset to avoid overlaps. In this case, this mode differs fromBasicLinkStyleLayout.FREE_RECTANGULAR
, as the self-link bundle may appear more narrow since the shift offset of the multiple self-links is limited by the size of the end node. The link connection points are not enforced, that is, the nodes and links are free to decide themselves where to place the connection point. Since the connection point is not enforced, the link segments in free rectangular mode may not be orthogonal. -
BasicLinkStyleLayout.NARROW_CONNECTED_SQUARE
- narrow square self-links with 3 bends and connection. Self-links are reshaped with 3 bends placed in orthogonal style so that the link segments approximately resemble three quarters of a square (the fourth quarter being the node where the self-link is attached). If the self-link is a spline link, the square shape might be more appropriate than a rectangular shape since the spline then may approximately resemble three quarters of a circle. The connection points are placed on the border of the node. For single self-links, this mode has the same effect likeBasicLinkStyleLayout.CONNECTED_SQUARE
. If you have multiple self-links at the same node, the self-links are shifted by an offset to avoid overlaps. In this case, this mode differs fromBasicLinkStyleLayout.CONNECTED_SQUARE
, as the self-link bundle may appear more narrow since the shift offset of the multiple self-links is limited by the size of the end node. -
BasicLinkStyleLayout.NARROW_FREE_SQUARE
- narrow square self-links with 3 bends without enforced connection. Self-links are reshaped with 3 bends placed at the same position likeBasicLinkStyleLayout.NARROW_CONNECTED_SQUARE
. If the self-link is a spline link, the square shape might be more appropriate than a rectangular shape since the spline then may approximately resemble three quarters of a circle. For single self-links, this mode has the same effect likeBasicLinkStyleLayout.FREE_SQUARE
. If you have multiple self-links at the same node, the self-links are shifted by an offset to avoid overlaps. In this case, this mode differs fromBasicLinkStyleLayout.FREE_SQUARE
, as the self-link bundle may appear more narrow since the shift offset of the multiple self-links is limited by the size of the end node. The link connection points are not enforced, that is, the nodes and links are free to decide themselves where to place the connection point. Since the connection point is not enforced, the link segments in free square mode may not be orthogonal.
BasicLinkStyleLayout.NO_RESHAPE_STYLE
.
Parameter | Type | Description |
---|---|---|
mode | int | The mode for self-links. |
Sets the orientation of self-links (that is, links that start and end at the same node). Valid values are:
-
BasicLinkStyleLayout.CLOCK_WISE
- clockwise (default). -
BasicLinkStyleLayout.COUNTER_CLOCK_WISE
- counterclockwise. -
BasicLinkStyleLayout.HORIZONTAL_TO_VERTICAL
- horizontal to vertical. Self-links start at the left or right side of the node with a horizontal segment and end at the top or bottom side of the node with a vertical segment. -
BasicLinkStyleLayout.VERTICAL_TO_HORIZONTAL
- vertical to horizontal. Self-links start at the top or bottom side of the node with a vertical segment and end at the left or right side of the node with a horizontal segment.
BasicLinkStyleLayout.NO_RESHAPE_STYLE
and the self-link mode
is not BasicLinkStyleLayout.NO_BENDS
.
Parameter | Type | Description |
---|---|---|
orientation | int | The orientation mode for self-links. |
Sets the relative attach position at the node border for self-links
(that is, links that start and end at the same node).
The x value of the position specifies a point at the top or bottom
border of the node, and the y value of the position specifies a
point at the left or right border of the node. The relative attach
position is expressed as a fraction of the width and height of the
node bounding box. Self-links occur at a corner of the node, and the
relative position is specified with respect to this corner. For
instance, the attach position (0.5, 0.1)
specifies the
middle of the top or bottom side and a point that is one tenth of
the node height away from the corner of the self-link at the left or
right side. If the self-link occurs at the bottom right corner, it
goes from the middle of the bottom side, to a point at the right
side that is 10% away from that corner. The attach position
(0.0, 0.0)
specifies exactly the corresponding corner.
The attach position (1.0, 1.0)
specified the, in each
direction, opposite corners, that is, if the self-link occurs at the
bottom right corner, it goes from the bottom left corner to the top
right corner. Such extreme values are perhaps not useful; they are
mentioned only to illustrate the meaning of the relative position.
The coordinate range for useful values is approximately between 0.1
and 0.5 for the relative position.
If the self-link mode is
BasicLinkStyleLayout.CONNECTED_SQUARE
,
BasicLinkStyleLayout.NARROW_CONNECTED_SQUARE
,
BasicLinkStyleLayout.FREE_SQUARE
, or
BasicLinkStyleLayout.NARROW_FREE_SQUARE
, then the attach
position is only respected at one side and calculate on the other
side to form a square.
The real attach position is the sum of the relative attach position and the absolute attach position.
The default value of the relative attach position is (0.5,
0.5)
.
Parameter | Type | Description |
---|---|---|
position | Point | The relative attach position for self-links. |
Sets the minimal spacing between node border and self-links (that
is, links that start and end at the same node).
If the self-link mode is
BasicLinkStyleLayout.NO_BENDS
, the offset has no effect.
If the spacing is negative, the spacing is calculated automatically.
This is in particular useful for the self-link modes
BasicLinkStyleLayout.CONNECTED_SQUARE
and
BasicLinkStyleLayout.NARROW_CONNECTED_SQUARE
in combination
with spline links, to form approximate circle shapes for the
self-links.
The default value is 5
.
Parameter | Type | Description |
---|---|---|
spacing | Number | The spacing value. |
Indicates that this layout class can stop the layout computation
when the user-defined allowed time is exceeded.
The result code in the layout report is
ibm_ilog.graphlayout.GraphLayoutReport.STOPPED_AND_INVALID
in
this case. Subclasses may return a different result code if the
method BasicLinkStyleLayout.getLayoutCodeOnInterrupt()
is overridden.
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
ibm_ilog.graphlayout.GraphLayout.getLayoutOfConnectedComponents()
to position the connected components.
By default, this layout is an instance of
ibm_ilog.graphlayout.grid.GridLayout
which can be customized
as needed.
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 only used if the link style is
straight line. It is used when the option
"connect links to node centers" (see
BasicLinkStyleLayout.isConnectLinksToNodeCenters()
) is
enabled. It is used for multilink bundles unless the multilink mode
is BasicLinkStyleLayout.NO_BUNDLE
or
BasicLinkStyleLayout.FREE_ONE_BEND_BUNDLE
. It is used for
self-links if the self-link mode is
BasicLinkStyleLayout.CONNECTED_RECTANGULAR
,
BasicLinkStyleLayout.NARROW_CONNECTED_RECTANGULAR
,
BasicLinkStyleLayout.CONNECTED_SQUARE
, or
BasicLinkStyleLayout.NARROW_CONNECTED_SQUARE
. In all other
cases, the layout algorithms does not actively place the end points
of links, hence it is not used.
When the connection box interface is used, the layout algorithm
calculates the virtual center of the end nodes of each link by the
link connection box interface and routes the links relative to those
centers. The virtual center is defined as the center of the
connection box shifted by the average of the tangential "top" and
"bottom" offsets in the horizontal direction, and by the average of
the tangential "left" and "right" offsets in the vertical direction.
For instance, if the tangential offset is 20 at the top side and 10
at all other sides, the average shift offset is (20 + 10)/2 =
15
in the horizontal direction and (10 + 10)/2 =
10
in the vertical direction; hence, the virtual center is at
connectionBox.center() + (15, 10)
.
Indicates that this layout class allows the user to specify fixed
links.
Fixed links are not reshaped during the layout if the method
ibm_ilog.graphlayout.GraphLayout.setPreserveFixedLinks()
is
called with a true
argument.
Indicates that this layout class allows the user to specify fixed
nodes.
Fixed nodes are not positioned during the layout if the method
ibm_ilog.graphlayout.GraphLayout.setPreserveFixedLinks()
is
called with a true
argument. The base class
BasicLinkStyleLayout
does not move any nodes anyway, hence
specifying nodes as fixed is not necessary. All subclasses of this
class however move nodes, and specifying nodes as fixed for a
subclass can be useful.
Indicates that this layout class uses randomly generated numbers
that can be initialized with a user-defined seed value.
When you perform the layout several times on the same graph and use
the same user-defined seed value, you obtain the same drawing of the
graph. If you want different drawings each time you perform the
layout, you should modify the seed value and call the method
ibm_ilog.graphlayout.GraphLayout.setUseSeedValueForRandomGenerator()
with a true
argument.
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
ibm_ilog.graphlayout.GraphLayoutReport.STOPPED_AND_INVALID
in
this case. Subclasses may return a different result code if the
method BasicLinkStyleLayout.getLayoutCodeOnInterrupt()
is overridden.