For experts: additional features of Link Layout

Using a node-side filter

Some applications require that links are not connected to specific sides of certain nodes. With the Link Layout algorithm, you can restrict to which node side a link can connect by using a node-side filter.
A node-side filter is any class that implements the interface ibm_ilog.graphlayout.INodeSideFilter. This interface defines the following method:
accept(graphModel, link, origin, node, side)
This method lets the input link connect its origin or destination to the input side of the input node.
As an example, assume that the application requires that for end nodes of type MyNode1, links can connect their origin only at the top and bottom sides.
For end nodes of type MyNode2, links can connect their destination only at the left and right sides. You can obtain this result with the following node-side filter:
dojo.declare('MyFilter', ibm_ilog.graphlayout.INodeSideFilter,
{
  accept: function(graphModel, link, origin, node, side) {
    if (node instanceof MyNode1 && origin)
        return (side == ibm_ilog.graphlayout.Direction.TOP || side == ibm_ilog.graphlayout.Direction.BOTTOM);
    if (node instanceof MyNode2 && !origin)
        return (side == ibm_ilog.graphlayout.Direction.LEFT || side == ibm_ilog.graphlayout.Direction.RIGHT);
    return true;
  }
});
Example of setting node-side filter (Link Layout algorithm)
To set this node-side filter:
Use the method nodeSideFilter:
layout.setNodeSideFilter(new MyFilter());
To remove the node-side filter:
layout.nodeSideFilter(null); 

Using a node box interface

Some applications require that the effective area of a node is not exactly its bounding box. For example, if the node has a shadow, the shadow is included in the bounding box. The shadow might not be considered as an obstacle for the links. In this case, the effective bounding box of a node is smaller.
Example of using a node box interface (Link Layout algorithm)
You can modify the effective bounding box of a node by implementing a class that implements the ibm_ilog.graphlayout.INodeBoxProvider.
This interface defines the following method:
getBox(graphModel, node)
By using this method, you can obtain the effective bounding box. For example, to set a node box interface that returns a smaller bounding box for all nodes of type MyNode, call:
dojo.declare('MyNodeBoxProvider', ibm_ilog.graphlayout.INodeBoxProvider,
 {
    getBox: function(graphModel, node)
   {
        var rect:Rectangle = graphModel.getBounds(node);
        if (node is MyNode) {
            // for example, the size of the bounding box is reduced:
            rect.x += 4;
            rect.y += 4;
            rect.width -= 8;
            rect.height -= 8;
        }
        return rect;
    }
});

Using a link connection box interface

By default, the connection points of the links are distributed on the border of the bounding box of the nodes. Sometimes, it can be necessary to place the connection points on a rectangle that is smaller or larger than the bounding box. For instance, it can happen when labels are displayed below or above nodes.
Using a link connection box interface to modify the position of connection points (Link Layout algorithm)
You can modify the position of the connection points of the links by implementing a class that implements the ibm_ilog.graphlayout.ILinkConnectionBoxProvider. It is a subinterface of INodeBoxProvider; see Using a node box interface. It defines again the method:
getBox(graphModel, node)
This method allows you to return the effective rectangle on which the connection points of the links are placed.
Additionally, the interface ibm_ilog.graphlayout.ILinkConnectionBoxProvider defines a second method:
getTangentialOffset(graphModel, node, nodeSide)
This method is used only in short link layout. For details, see Using a link connection box interface. In long link layout, implement the method by returning the value 0.