The
IlvGrapher class also provides methods that let you access
intergraph links stored in a grapher in an efficient way:
IlvGraphicEnumeration getInterGraphLinks()
int getInterGraphLinksCount()
Since an intergraph link is stored in the same way as
other links in the grapher, it is also part of the list of all objects
contained in this grapher returned by the getObjects
method
of the class IlvManager
:
IlvGraphicEnumeration getObjects()
Nevertheless, calling the getInterGraphLinks
method
is much more efficient than traversing all objects of the grapher.
To distinguish an intergraph link from other objects
in the grapher, you can use the following method of the IlvGrapher
class:
boolean isInterGraphLink(IlvGraphic obj)
This method returns true
if
the specified graphic object is a link stored in the grapher instance
with the origin or the destination stored somewhere else. That is,
if the graphic object is an intergraph link.
The
IlvGrapher class also gives you access to intergraph links
that are leaving or entering a grapher. You can access such links
using the methods:
IlvGraphicEnumeration getExternalInterGraphLinks()
int getExternalInterGraphLinksCount()
The difference between the methods getInterGraphLinks and getExternalInterGraphLinks is:
The first method, getInterGraphLinks,
returns the intergraph links stored in a grapher with an origin or
destination in another grapher
The second method, getExternalInterGraphLinks,
returns the intergraph links stored in another grapher but with the
origin or destination in this grapher
If the grapher has no subgraphers, the external intergraph
links obtained by getExternalInterGraphLinks() are
all links that are leaving or entering the grapher.
If the grapher has subgraphers, the intergraph links
that leave the grapher have one of the following characteristics:
Calling getExternalInterGraphLinks() on
the grapher gives only the links with an end node in the grapher,
not the links with an end node in a subgrapher of the grapher.
When a grapher is moved, it is possible that the grapher
and all its nested subgraphers appear at a new location on the screen.
The grapher displacement causes the shape of the following links to
change:
All links that are directly connected
to the grapher. That is, have the grapher as origin or destination.
All links that are obtained by grapher.getTreeExternalInterGraphLinks().
The following figure illustrates interlinked nested graphers:
Grapher A contains two graphers, B and D. Grapher B contains
another grapher, C. The intergraph link from an object of C to an
object of D is then stored in A.
Neither the origin nor destination of the intergraph
link ends in grapher B, and thus this link is not returned by calling
getExternalInterGraphLinks
on
B. However, the link is returned by calling
getTreeExternalInterGraphLinks on B, since its origin node is nested inside B.