Advanced Features > Link Shape Policies > Orthogonal Link Shape Policy > Setting the Link Shape Policy

The orthogonal link shape policy can be set to links of class IlvPolicyAwareLinkImage. The policy can be shared among links. The following code shows how to set the orthogonal link shape policy to a couple of links:

IlvOrthogonalLinkShapePolicy policy =
    new IlvOrthogonalLinkShapePolicy();

IlvPolicyAwareLinkImage link1 =
    new IlvPolicyAwareLinkImage(node1, node2, true, null);
link1.setLinkShapePolicy(policy);
IlvPolicyAwareLinkImage link2 = 
    new IlvPolicyAwareLinkImage(node1, node2, true, null);
link2.setLinkShapePolicy(policy);
...
// insert the links into the grapher only AFTER installing the policy
grapher.addLink(link1, redraw);
grapher.addLink(link2, redraw);
...

After the link shape policy is set and added to the grapher, the link remains orthogonal during all the operations that try to reshape the link. To disable the link shape policy, call:

link.setLinkShapePolicy(null);

This does not change the shape of the link immediately, but it enables subsequent operations on the link to reshape it in a non orthogonal way again.