public interface IlvLinkConnectionBoxInterface extends IlvNodeBoxInterface
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
getBox(ilog.views.graphlayout.IlvGraphModel, java.lang.Object)
. 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:
public IlvRect getBox(IlvGraphModel graphModel, Object node) { IlvRect 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):
public double getTangentialOffset(IlvGraphModel graphModel, Object node, int nodeSide) { switch (nodeSide) { case IlvDirection.Left: case IlvDirection.Right: return -10; default: return 0; } }
Modifier and Type | Method and Description |
---|---|
IlvRect |
getBox(IlvGraphModel graphModel,
Object node)
Returns the rectangle on which the connection points of the links
connected to
node can be placed. |
double |
getTangentialOffset(IlvGraphModel graphModel,
Object node,
int nodeSide)
Returns the tangential offset for the connection points of a link on
the specified side of the specified node.
|
IlvRect getBox(IlvGraphModel graphModel, Object node)
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. If the input graph model is a grapher adapter (instance of
IlvGrapherAdapter
), the returned rectangle value should
depend on the actual coordinate mode that can be queried from the
input model by IlvGrapherAdapter.getCoordinatesMode()
.
getBox
in interface IlvNodeBoxInterface
graphModel
- The graph model to which the node belongs.node
- The node.double getTangentialOffset(IlvGraphModel graphModel, Object node, int nodeSide)
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:
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. If the input graph model is a grapher adapter (instance of
IlvGrapherAdapter
), the offset value returned should be
in the current coordinate system. You can find the coordinate system
by sending a query to the input model (IlvGrapherAdapter.getCoordinatesMode()
).
graphModel
- The graph model to which the node belongs.node
- The node.nodeSide
- The side of the node. The values are defined in IlvDirection
. Valid values are Top
,
Bottom
, Left
, and Right
. .0
if no offset
is required.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.