IBM ILOG Dojo Diagrammer 1.1 API Documentation
Legend: Array Boolean Constructor Date DomNode Error Function Namespace Number Object RegExp Singleton String

ibm_ilog.graphlayout.ILinkConnectionBoxProvider (version 1.1-SNAPSHOT)

Object » ibm_ilog.graphlayout.INodeBoxProvider » ibm_ilog.graphlayout.ILinkConnectionBoxProvider
dojo.require("ibm_ilog.graphlayout.ILinkConnectionBoxProvider");

An interface used to customize the computation of the connection points of the links.

This interface is useful when a layout algorithm that supports this customization must place the connection points of the links at a certain distance inside or outside the bounding box of the nodes. This interface also allows a tangential "translation" of the connection points separately for each side of each node.

The following code is an example of the implementation of the method ILinkConnectionBoxProvider.getBox(). In this example, the connection points are at a distance of 10 outside the bounding box of the nodes. Therefore, the method computes the bounding box of the node and expands it with a value of 10 in all four directions:

function getBox(graphModel, node) {
var bbox = graphModel.boundingBox(node);
bbox.x -= 10;
bbox.y -= 10;
bbox.width += 20;
bbox.height += 20;
return bbox;
}
In the second code example, the connection points on the left and right side of the nodes are shifted to the top by a fixed amount of 10. (Of course, this amount could be variable dependent on specific conditions, for example, the height of a label below a node):
function getTangentialOffset(graphModel, node, nodeSide) {
switch (nodeSide) {
case ibm_ilog.graphlayout.Direction.LEFT:
case ibm_ilog.graphlayout.Direction.RIGHT:
return -10;
default:
return 0;
}
}

Method Summary

  • getBox(graphModel, node) Returns the rectangle on which the connection points of the links connected to 'node' can be placed.
  • getTangentialOffset(graphModel, node, nodeSide) Returns the tangential offset for the connection points of a link on the specified side of the specified node.

Methods

getBox
The rectangle on which the connection points of the links can be placed.

Returns the rectangle on which the connection points of the links connected to node can be placed. The rectangle must be in the actual coordinate system of the input node.

Note that when routing intergraph links, the coordinate system of the node is not necessarily the same as the coordinate system of the link.

ParameterTypeDescription
graphModelibm_ilog.graphlayout.AbstractGraphLayoutModelThe graph model to which the node belongs.
nodeObjectThe node.
getTangentialOffset
The tangential offset for the connection points of a link on the specified side of the specified node or '0' if no offset is required.

Returns the tangential offset for the connection points of a link on the specified side of the specified node. The offset must be in the current coordinate system of the input node.

By default, some layout algorithms place the links connected to one side of a node symmetrically with respect to the middle of the side. You can use this method to "shift" the links tangentially as follows:

  • On the "top" side of a node, the connection points are translated to the right if the offset is positive and to the left if the offset is negative.
  • On the "bottom" side of a node, the connection points are translated to the right if the offset is positive and to the left if the offset is negative.
  • On the "left" side of a node, the connection points are translated to the bottom if the offset is positive and to the top if the offset is negative.
  • On the "right" side of a node, the connection points are translated to the bottom if the offset is positive and to the top if the offset is negative.
This method must return 0 if no offset is necessary on the specified node and side.

Note that when routing intergraph links, the coordinate system of the node is not necessarily the same as the coordinate system of the link.

ParameterTypeDescription
graphModelibm_ilog.graphlayout.AbstractGraphLayoutModelThe graph model to which the node belongs.
nodeObjectThe node.
nodeSideintThe side of the node. The values are defined in ' ibm_ilog.graphlayout.Direction'. Valid values are 'Top', 'Bottom', 'Left', and 'Right'. .