Orthogonal link shape policy
The orthogonal link shape policy forces links to keep at right angles to one another. When a link bend is moved, the adjacent link bends automatically to follow the move so that the link always remains orthogonal.
Setting the Link Shape Policy
The orthogonal link shape policy can be set on links of class
IlvPolicyAwareLinkImage. The policy can be shared by several links. The following code shows how to set the orthogonal link shape policy on two 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 nonorthogonal way again.
Chaining of link shape policies
It is possible to apply multiple link shape policies to the same link, if these policies do not contradict each other. In particular, it is possible to add a crossing link shape policy onto an orthogonal link shape policy, as illustrated in the following code.
policy = new IlvOrthogonalLinkShapePolicy();
policy.setChildPolicy(new IlvCrossingLinkShapePolicy());
link.setLinkShapePolicy(policy);
In this case, the orthogonal policy first forces the link to an orthogonal shape, and then the crossing policy calculates the display of the link crossings.
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.