public class IlvCrossingLinkShapePolicy extends IlvAbstractLinkShapePolicy
IlvCrossingLinkShapePolicy tells the links where the
crossings are.
This link shape policy works only with links of class
IlvCrossingAwareLinkImage.
The policy can be shared between links of the same kind.
The parameters of the policy can be set via
setHorizontalPreferred(boolean) and setNestingTraversal(boolean).
The parameter settings should be the same for all crossing link shape
policies of all links, otherwise the crossings may appear aesthetically
unpleasing.
If you work with nested graphs and intergraph links, and links of different subgraphers can cross each other, you should enable the nesting traversal. It updates the crossings between links even for links that belong to different graphers. However, if this option is enabled, the crossings are only correctly updated if in each grapher of the nesting hierarchy the following holds: all node that represent subgraphers are in different layers than the links. For instance, you should insert all nodes into layer 0 and all links into layer 1. If the condition is not satisfied, it gets ambiguous whether a link is drawn above or below a subgrapher node, and hence it is impossible to decide whether two links belonging to different subgraphers will visually cross each other.
Furthermore, the most crossing graphics that display crossings look
visually more appealing if all transformations on subgraphers preserve
the aspect ratio, and all gaps on links are nonzoomable
(see IlvCrossingAwareLinkImage.setGapZoomable(boolean)).
IlvCrossingAwareLinkImage| Constructor and Description |
|---|
IlvCrossingLinkShapePolicy()
Creates a crossing link shape policy.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
adjustmentEndHook(IlvManager manager)
Called by the manager when contents adjusting becomes false.
|
void |
afterAdd(IlvLinkImage link)
Allows the policy to react after a link with installed policy is added
to a grapher.
|
void |
afterAny(IlvLinkImage link)
Allows the policy to react after any of
onInstall,
onUninstall,
afterAdd,
beforeRemove,
afterSetIntermediateLinkPoints,
afterInsertPoint,
afterRemovePoint,
afterMovePoint,
afterApplyTransform,
afterFromNodeMoved,
and afterToNodeMoved. |
void |
afterApplyTransform(IlvLinkImage link,
IlvTransformer t)
Allows the policy to react after a transformation was applied.
|
void |
afterFromNodeMoved(IlvLinkImage link)
Allows the policy to react after the source node of the link was moved.
|
void |
afterInsertPoint(IlvLinkImage link,
int index,
IlvTransformer t)
Allows the policy to react after a point was inserted.
|
void |
afterMovePoint(IlvLinkImage link,
int index,
IlvTransformer t)
Allows the policy to react after a point was moved.
|
void |
afterRemovePoint(IlvLinkImage link,
int index,
IlvTransformer t)
Allows the policy to react after a point was removed.
|
void |
afterSetIntermediateLinkPoints(IlvLinkImage link)
Allows the policy to react after the intermediate points were set.
|
void |
afterToNodeMoved(IlvLinkImage link)
Allows the policy to react after the target node of the link was moved.
|
void |
beforeRemove(IlvLinkImage link)
Allows the policy to react before a link with installed policy is removed
from a grapher.
|
static void |
CollectLinksAndPolicies(IlvManager manager,
boolean traverse,
boolean onlyCrossingEnabled,
IlvGraphicVector links,
Vector policies)
Collect all crossing link shape policies, and all links that have these
policies, from the input manager.
|
boolean |
isHorizontalPreferred()
Returns
true if the crossings are registered at the
horizontal links. |
boolean |
isNestingTraversal()
Returns
true if the update of crossings will consider all
links of the entire nesting hierarchy of subgraphs. |
void |
onInstall(IlvLinkImage link)
Allows the policy to react immediately when it is installed at a link.
|
void |
onUninstall(IlvLinkImage link)
Allows the policy to react immediately when it is removed from a link.
|
static void |
SetCrossingEnabled(IlvManager manager,
boolean flag,
boolean traverse,
boolean redraw)
Enables or disables the display of crossings of all crossing aware links
of the input manager.
|
static void |
SetCrossingEnabled(IlvManager manager,
IlvGraphicVector links,
boolean flag,
boolean redraw)
Enables or disables the display of crossings of all crossing aware links
in the input links vector.
|
void |
setHorizontalPreferred(boolean flag)
Sets whether the crossings should be registered at the horizontal
links or at the vertical links.
|
static void |
SetHorizontalPreferred(IlvManager manager,
boolean flag,
boolean traverse,
boolean redraw)
Sets for all links of the input manager whether the crossings should be
registered at the horizontal links or at the vertical links.
|
void |
setNestingTraversal(boolean flag)
Sets whether the crossings should be calculated for the entire
nesting hierarchy of subgraphs, or whether the crossings should only
be calculated for a flat graph while ignoring links in parent or
subgraphs.
|
static void |
SetNestingTraversal(IlvManager manager,
boolean flag,
boolean traverse,
boolean redraw)
Sets whether the crossings should be calculated for the entire
nesting hierarchy of subgraphs, or whether the crossings should only
be calculated for a flat graph while ignoring links in parent or
subgraphs.
|
allowApplyTransform, allowInsertPoint, allowMovePoint, allowRemovePoint, allowSetIntermediateLinkPoints, getChildPolicy, getLinkPoints, getPointAt, setChildPolicypublic IlvCrossingLinkShapePolicy()
public void setHorizontalPreferred(boolean flag)
You should call this method only before any link uses this policy yet.
The crossings look only nice if all crossing link shape policies of
all links of a (potentially nested) managers have the same preference.
You can call this method if you know that this is the only instance of
a crossing link shape policy in the grapher. Otherwise, it is recommended
to use the method
SetHorizontalPreferred(IlvManager, boolean, boolean, boolean)
which sets the preference of all links in a manager in the same way.
public final boolean isHorizontalPreferred()
true if the crossings are registered at the
horizontal links.
setHorizontalPreferred(boolean)public static void SetHorizontalPreferred(IlvManager manager, boolean flag, boolean traverse, boolean redraw)
The crossings look only nice if all crossing link shape policies of all links of a (potentially nested) managers have the same preference. This method can be used to set the preference of all links in a manager in the same way.
manager - The manager.flag - true if horizontal is preferred,
false otherwise.traverse - Whether the submanagers should recursively be traversed
as well to set the preference.redraw - Whether a redraw of all links is required after setting
the preference.IlvCrossingAwareLinkImage.setCrossingGraphic(ilog.views.IlvGraphic),
setHorizontalPreferred(boolean),
isHorizontalPreferred()public void setNestingTraversal(boolean flag)
true is passed as argument, the update of crossings
will consider all links of the entire nesting hierarchy of subgraphs.
It will recursively traverse the entire nesting hierarchy to find
links that cross each other.
If false is passed as argument, the update of crossings
will only consider links that belong to the same subgraph.
It will only search in the local grapher for links that cross each other.
You should call this method only before any link uses this policy yet.
All crossing link shape policies of all links of a nested managers
must behave the same: either they all have the nesting traversal
enabled or they all have the nesting traversal disabled.
You can call this method if you know that this is the only instance of
a crossing link shape policy in the grapher. Otherwise, it is recommended
to use the method
SetNestingTraversal(IlvManager, boolean, boolean, boolean)
which sets the nesting traversal of all links in a manager in the same way.
public final boolean isNestingTraversal()
true if the update of crossings will consider all
links of the entire nesting hierarchy of subgraphs.
Returns false if the update of crossings will only consider
links that belong to the same subgraph.
setNestingTraversal(boolean)public static void SetNestingTraversal(IlvManager manager, boolean flag, boolean traverse, boolean redraw)
true is passed as argument, the update of crossings
will consider all links of the entire nesting hierarchy of subgraphs.
It will recursively traverse the entire nesting hierarchy to find
links that cross each other.
If false is passed as argument, the update of crossings
will only consider links that belong to the same subgraph.
It will only search in the local grapher for links that cross each other.
All crossing link shape policies of all links of a nested managers must behave the same: either they all have the nesting traversal enabled or they all have the nesting traversal disabled. This method can be used to set the nesting traversal of all links in a manager in the same way.
manager - The manager.flag - true if the nesting traversal is enabled,
false otherwise.traverse - Whether the submanagers should recursively be traversed
as well to set the nesting traversal.redraw - Whether a redraw of all links is required after setting
the nesting traversal.IlvCrossingAwareLinkImage.setCrossingGraphic(ilog.views.IlvGraphic),
setNestingTraversal(boolean),
isNestingTraversal()public static void SetCrossingEnabled(IlvManager manager, boolean flag, boolean traverse, boolean redraw)
manager - The manager.flag - true if the crossing display is enabled,
false otherwise.traverse - Whether the submanagers should recursively be traversed
as well to enable or disable the crossing display.redraw - Whether a redraw of all links is required after
enabling or disabling the crossing display.IlvCrossingAwareLinkImage.setCrossingEnabled(boolean)public static void SetCrossingEnabled(IlvManager manager, IlvGraphicVector links, boolean flag, boolean redraw)
manager - The manager.links - The links.flag - true if the crossing display is enabled,
false otherwise.redraw - Whether a redraw of all links is required after
enabling or disabling the crossing display.IlvCrossingAwareLinkImage.setCrossingEnabled(boolean)public static void CollectLinksAndPolicies(IlvManager manager, boolean traverse, boolean onlyCrossingEnabled, IlvGraphicVector links, Vector policies)
manager - The manager.traverse - Whether the submanagers should recursively be traversed
as well to enable or disable the crossing display.onlyCrossingEnabled - If true, only links are collected
that currently have crossings enabled.links - Container for the links.policies - Container for the link policies.IlvCrossingAwareLinkImage.setCrossingEnabled(boolean)public void afterAdd(IlvLinkImage link)
afterAdd in interface IlvLinkShapePolicyafterAdd in class IlvAbstractLinkShapePolicylink - The link.public void beforeRemove(IlvLinkImage link)
beforeRemove in interface IlvLinkShapePolicybeforeRemove in class IlvAbstractLinkShapePolicylink - The link.public void onInstall(IlvLinkImage link)
onInstall in interface IlvLinkShapePolicyonInstall in class IlvAbstractLinkShapePolicylink - The link.public void onUninstall(IlvLinkImage link)
onUninstall in interface IlvLinkShapePolicyonUninstall in class IlvAbstractLinkShapePolicylink - The link.public void afterSetIntermediateLinkPoints(IlvLinkImage link)
afterSetIntermediateLinkPoints in interface IlvLinkShapePolicyafterSetIntermediateLinkPoints in class IlvAbstractLinkShapePolicylink - The link.public void afterInsertPoint(IlvLinkImage link, int index, IlvTransformer t)
afterInsertPoint in interface IlvLinkShapePolicyafterInsertPoint in class IlvAbstractLinkShapePolicylink - The link.index - The index at which the new point was inserted.t - The transformer through which the link is drawn.public void afterRemovePoint(IlvLinkImage link, int index, IlvTransformer t)
afterRemovePoint in interface IlvLinkShapePolicyafterRemovePoint in class IlvAbstractLinkShapePolicylink - The link.index - The index at which a point was removed.t - The transformer through which the link is drawn.public void afterMovePoint(IlvLinkImage link, int index, IlvTransformer t)
afterMovePoint in interface IlvLinkShapePolicyafterMovePoint in class IlvAbstractLinkShapePolicylink - The link.index - The index of the point that was moved.t - The transformer through which the link is drawn.public void afterApplyTransform(IlvLinkImage link, IlvTransformer t)
afterApplyTransform in interface IlvLinkShapePolicyafterApplyTransform in class IlvAbstractLinkShapePolicylink - The link.t - The applied transformer.public void afterFromNodeMoved(IlvLinkImage link)
afterFromNodeMoved in interface IlvLinkShapePolicyafterFromNodeMoved in class IlvAbstractLinkShapePolicylink - The link.public void afterToNodeMoved(IlvLinkImage link)
afterToNodeMoved in interface IlvLinkShapePolicyafterToNodeMoved in class IlvAbstractLinkShapePolicylink - The link.public void afterAny(IlvLinkImage link)
onInstall,
onUninstall,
afterAdd,
beforeRemove,
afterSetIntermediateLinkPoints,
afterInsertPoint,
afterRemovePoint,
afterMovePoint,
afterApplyTransform,
afterFromNodeMoved,
and afterToNodeMoved.
afterAny in interface IlvLinkShapePolicyafterAny in class IlvAbstractLinkShapePolicylink - The link.public static void adjustmentEndHook(IlvManager manager)
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.