public final class IlvGraphLayoutUtil extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
IlvGraphLayoutUtil.FreeLinkConnectorFactory
A factory for creating a link connector of class
IlvFreeLinkConnector for a node. |
Modifier and Type | Method and Description |
---|---|
static IlvPoint |
ArcEndPoint(IlvRect rect,
double startAngle,
double deltaAngle)
Deprecated.
Beginning with JViews 6.0 you should use
IlvClippingUtil.ArcEndPoint(ilog.views.IlvRect, double, double) instead, which has the same
functionality. |
static IlvPoint |
ArcStartPoint(IlvRect rect,
double startAngle)
Deprecated.
Beginning with JViews 6.0 you should use
IlvClippingUtil.ArcStartPoint(ilog.views.IlvRect, double) instead, which has the same
functionality. |
static IlvPoint |
BestClipPointOnRay(IlvPoint startPoint,
IlvPoint controlPoint,
IlvPoint[] intersectionPoints,
int numIntersections)
Deprecated.
Beginning with JViews 6.0 you should use
IlvClippingUtil.BestClipPointOnRay(ilog.views.IlvPoint, ilog.views.IlvPoint, ilog.views.IlvPoint[], int) instead, which has the same
functionality. |
static int |
ComputeNumberOfLinkBends(IlvGraphModel graphModel)
Returns the number of bends in all links in the graph model.
|
static int |
ComputeNumberOfLinkCrossings(IlvGraphModel graphModel)
Returns the number of crossings of two links in the graph model.
|
static int |
ComputeNumberOfLinkOverlaps(IlvGraphModel graphModel)
Returns the number of overlaps of two links in the graph model.
|
static int |
ComputeNumberOfNodeLinkOverlaps(IlvGraphModel graphModel)
Returns the number of overlaps between a node and a link in the graph
model.
|
static int |
ComputeNumberOfNodeOverlaps(IlvGraphModel graphModel)
Returns the number of overlaps between nodes in the graph model.
|
static void |
ConnectLinksToPoint(IlvGrapher grapher,
IlvGraphic node,
IlvPoint point,
IlvTransformer t,
boolean redraw)
Deprecated.
Beginning with JViews 6.0 you should use
IlvClippingUtil.ConnectLinksToPoint(ilog.views.IlvGrapher, ilog.views.IlvGraphic, ilog.views.IlvPoint, ilog.views.IlvTransformer, boolean) instead, which has the same
functionality. |
static Enumeration |
CreateSortedEnumeration(Enumeration enumeration,
Comparator comparator)
Returns a new enumeration containing the same elements as the provided
enumeration , but ordered according to the provided
comparator . |
static void |
EnsureAppropriateLinkConnectors(IlvGrapherAdapter grapherAdapter,
IlvGraphLayout layout,
boolean moveableConnectionPoints,
boolean traverse)
Ensures that all the link connectors attached to the nodes of an
IlvGrapher are appropriate for a particular layout algorithm. |
static void |
EnsureAppropriateLinkConnectors(IlvGrapherAdapter grapherAdapter,
IlvGraphLayout layout,
boolean moveableConnectionPoints,
boolean traverse,
boolean redraw)
Ensures that all the link connectors attached to the nodes of an
IlvGrapher are appropriate for a particular layout algorithm. |
static void |
EnsureAppropriateLinkConnectors(IlvGraphLayout layout,
boolean moveableConnectionPoints)
Ensures that all the link connectors attached to the nodes of an
IlvGrapher are appropriate for a particular layout algorithm. |
static void |
EnsureAppropriateLinks(IlvGraphLayout layout,
boolean redraw)
Ensures that the link and link connector classes used in the graph
attached to the input layout are appropriate for the input layout
algorithm.
|
static void |
EnsureAppropriateLinks(IlvGraphLayout layout,
IlvInappropriateLinkException ex)
Deprecated.
Beginning with JViews 6.0, use the method
EnsureAppropriateLinks(IlvInappropriateLinkException, boolean)
instead. |
static void |
EnsureAppropriateLinks(IlvGraphModel graphModel,
IlvLayoutProvider layoutProvider)
Ensures that the link and link connector classes used in a nested
IlvGrapher hierarchy are appropriate for the layout
algorithms that are delivered by the input provider. |
static void |
EnsureAppropriateLinks(IlvGraphModel graphModel,
IlvLayoutProvider layoutProvider,
boolean redraw)
Ensures that the link and link connector classes used in a nested
IlvGrapher hierarchy are appropriate for the layout
algorithms that are delivered by the input provider. |
static void |
EnsureAppropriateLinks(IlvInappropriateLinkException ex)
Ensures that the link and link connector classes used in an
IlvGrapher are appropriate for a particular layout algorithm that
has raised an IlvInappropriateLinkException . |
static void |
EnsureAppropriateLinks(IlvInappropriateLinkException ex,
boolean redraw)
Ensures that the link and link connector classes used in an
IlvGrapher are appropriate for a particular layout algorithm that
has raised an IlvInappropriateLinkException . |
static void |
EnsureAppropriateLinkTypes(IlvGrapherAdapter grapherAdapter,
IlvGraphLayout layout,
boolean toStraightLine,
boolean traverse,
boolean interGraphLinks)
Ensures that all the links of the specified
IlvGrapherAdapter
are appropriate for a particular layout algorithm. |
static void |
EnsureAppropriateLinkTypes(IlvGrapherAdapter grapherAdapter,
IlvGraphLayout layout,
boolean toStraightLine,
boolean traverse,
boolean interGraphLinks,
boolean redraw)
Ensures that all the links of the specified
IlvGrapherAdapter
are appropriate for a particular layout algorithm. |
static void |
EnsureAppropriateLinkTypes(IlvGraphLayout layout,
boolean toStraightLine)
Ensures that all the links of the
IlvGrapherAdapter attached
to a layout instance are appropriate for a particular layout
algorithm. |
static IlvGraphModel |
GetConnectedComponents(IlvGraphModel graphModel)
Returns a graph model.
|
static IlvGraphLayoutUtil.FreeLinkConnectorFactory |
GetFreeLinkConnectorFactory()
Returns the factory that is used to create link connectors of class
IlvFreeLinkConnector during runs of any
EnsureAppropriate methods. |
static int |
GetNodeDegree(IlvGraphLayout layout,
IlvGraphic node)
Deprecated.
Beginning with JViews 3.0, use the method
IlvGraphModel.getNodeDegree(java.lang.Object) . |
static boolean |
IsConnected(IlvGraphModel graphModel)
Checks whether a graph model is connected or not.
|
static boolean |
IsTree(IlvGraphLayout layout,
Object startNode)
Returns
true if the connected component of the graph
attached to the layout instance that contains startNode
is a pure tree (with no cycles). |
static boolean |
IsTree(IlvGraphModel graphModel,
Object startNode)
Returns
true if the connected component of
graphModel that contains startNode is a
pure tree (with no cycles). |
static int |
LineIntersectsArc(IlvPoint p1,
IlvPoint p2,
IlvRect rect,
double startAngle,
double deltaAngle,
IlvPoint[] res)
Deprecated.
Beginning with JViews 6.0 you should use
IlvClippingUtil.LineIntersectsArc(ilog.views.IlvPoint, ilog.views.IlvPoint, ilog.views.IlvRect, double, double, ilog.views.IlvPoint[]) instead, which has the same
functionality. |
static int |
LineIntersectsCubicSpline(IlvPoint p1,
IlvPoint p2,
IlvPoint[] c,
int startIndex,
IlvPoint[] res)
Deprecated.
Beginning with JViews 6.0 you should use
IlvClippingUtil.LineIntersectsCubicSpline(ilog.views.IlvPoint, ilog.views.IlvPoint, ilog.views.IlvPoint[], int, ilog.views.IlvPoint[]) instead, which has the
same functionality. |
static int |
LineIntersectsEllipse(IlvPoint p1,
IlvPoint p2,
IlvRect rect,
IlvPoint[] res)
Deprecated.
Beginning with JViews 6.0 you should use
IlvClippingUtil.LineIntersectsEllipse(ilog.views.IlvPoint, ilog.views.IlvPoint, ilog.views.IlvRect, ilog.views.IlvPoint[]) instead, which has the same
functionality. |
static int |
LineIntersectsPolyPoints(IlvPoint p1,
IlvPoint p2,
IlvPoint[] points,
boolean closed,
IlvPoint[] res)
Deprecated.
Beginning with JViews 6.0 you should use
IlvClippingUtil.LineIntersectsPolyPoints(ilog.views.IlvPoint, ilog.views.IlvPoint, ilog.views.IlvPoint[], boolean, ilog.views.IlvPoint[]) instead, which has the
same functionality. |
static int |
LineIntersectsQuadSpline(IlvPoint p1,
IlvPoint p2,
IlvPoint[] c,
int startIndex,
IlvPoint[] res)
Deprecated.
Beginning with JViews 6.0 you should use
IlvClippingUtil.LineIntersectsQuadSpline(ilog.views.IlvPoint, ilog.views.IlvPoint, ilog.views.IlvPoint[], int, ilog.views.IlvPoint[]) instead, which has the
same functionality. |
static boolean |
LineIntersectsSegment(IlvPoint p1,
IlvPoint p2,
IlvPoint p3,
IlvPoint p4,
IlvPoint res)
Deprecated.
Beginning with JViews 6.0 you should use
IlvClippingUtil.LineIntersectsSegment(ilog.views.IlvPoint, ilog.views.IlvPoint, ilog.views.IlvPoint, ilog.views.IlvPoint, ilog.views.IlvPoint) instead, which has the same
functionality. |
static void |
SetFreeLinkConnectorFactory(IlvGraphLayoutUtil.FreeLinkConnectorFactory factory)
Allows you to specify a factory for creating link connectors of class
IlvFreeLinkConnector . |
static void |
Sort(Object[] objects,
Comparator comparator)
Sorts the provided
objects according to the provided
comparator . |
public static void EnsureAppropriateLinkTypes(IlvGraphLayout layout, boolean toStraightLine)
IlvGrapherAdapter
attached
to a layout instance are appropriate for a particular layout
algorithm.
The method simply calls EnsureAppropriateLinkTypes(IlvGrapherAdapter, IlvGraphLayout,
boolean, boolean, boolean, boolean)
passing the grapher adapter
attached to layout
, the layout
argument,
the toStraightLine
argument, false
for the
traverse
argument and for the
interGraphLinks
argument, and true
for the
redraw
argument. See the documentation of this method.
If the graph model attached to the layout instance is not an
IlvGrapherAdapter
, the method does nothing.
layout
- The layout instance to which an IlvGrapher
is
attached. It must not be null
.toStraightLine
- If true
, the method ensures that the
links can be reshaped to a straight line. Otherwise, it ensures
that the links can be reshaped to a polyline shape.public static void EnsureAppropriateLinkTypes(IlvGrapherAdapter grapherAdapter, IlvGraphLayout layout, boolean toStraightLine, boolean traverse, boolean interGraphLinks)
IlvGrapherAdapter
are appropriate for a particular layout algorithm.
The method calls EnsureAppropriateLinkTypes(IlvGrapherAdapter, IlvGraphLayout,
boolean, boolean, boolean, boolean)
passing true
for
the redraw
argument. See the documentation of this
method.
grapherAdapter
- The grapher adapter for which appropriate link
types are needed.layout
- The layout instance for which the appropriate link types
are needed. Can be null
if not available.toStraightLine
- If true
, the method ensures that the
links can be reshaped to a straight line. Otherwise, it ensures
that the links can be reshaped to a polyline shape.traverse
- If true
, the method is applied recursively
to the subgraphs.interGraphLinks
- If true
, the method checks and
replaces intergraph links. Otherwise, it checks and replaces normal
links.public static void EnsureAppropriateLinkTypes(IlvGrapherAdapter grapherAdapter, IlvGraphLayout layout, boolean toStraightLine, boolean traverse, boolean interGraphLinks, boolean redraw)
IlvGrapherAdapter
are appropriate for a particular layout algorithm.
Some layout algorithms need to reshape the intermediate points of the
links. When an IlvGrapher
is laid out, only some of the
JViews link classes allow changes to the intermediate points.
This utility method can be used either in advance (before performing
the layout) or when an IlvInappropriateLinkException
, thrown
by the method IlvGraphLayout.performLayout()
, is caught.
However, to achieve the best runtime performance, the appropriate
types of link should be used in the IlvGrapher
from the
beginning to avoid the overhead cost of the replacement.
Depending on the value of the argument toStraightLine
,
the method ensures that the links can be reshaped either to a
straight-line shape or to a polyline shape.
If the argument toStraightLine
is true
, the
method replaces all the links of the grapher that cannot be reshaped
to a straight-line shape with new links of type IlvPolylineLinkImage
without
any intermediate points. The links of the following link classes are
replaced:
IlvOneLinkImage
(and all
subclasses),IlvDoubleLinkImage
(and all
subclasses).
If the argument toStraightLine
is false
,
the method replaces all the links of the grapher that cannot be
reshaped to a polyline with new links of type IlvPolylineLinkImage
. The
links of the following link classes are replaced:
IlvLinkImage
(the base class only),IlvOneLinkImage
(and all
subclasses),IlvDoubleLinkImage
(and all
subclasses).When a link is replaced, the following attributes of the old link are copied to the new link:
Note that when a link is replaced, the object properties stored on
the link (see IlvGraphic.setProperty(java.lang.String, java.lang.Object)
and IlvGraphic.setNamedProperty(ilog.views.IlvNamedProperty)
) are not copied from the old link to the
new link.
This method calls IlvGraphModel.isReshapeableLink(java.lang.Object, boolean)
on the
grapher adapter (see IlvGraphLayout.getGraphModel()
) to check
whether a link can be reshaped.
Note that if a filter is specified for the adapter attached to the
layout instance (see IlvGrapherAdapter.setFilter(ilog.views.graphlayout.IlvLayoutGraphicFilter)
) or a
per-layer filter is used (see IlvGrapherAdapter.addLayer(ilog.views.IlvManagerLayer)
),
only links accepted by the filter are taken into consideration by
this method. Also, if the layout algorithm (layout
argument) is not null
and supports the fixed-link
mechanism (that is, IlvGraphLayout.supportsPreserveFixedLinks()
returns true
), the method replaces only the links that
are not fixed (that is, for which IlvGraphLayout.isFixed(java.lang.Object)
returns false
).
grapherAdapter
- The grapher adapter for which appropriate link
types are needed.layout
- The layout instance for which the appropriate link types
are needed. Can be null
if not available.toStraightLine
- If true
, the method ensures that the
links can be reshaped to a straight line. Otherwise, it ensures
that the links can be reshaped to a polyline shape.traverse
- If true
, the method is applied recursively
on the subgraphs.interGraphLinks
- If true
, the method checks and
replaces intergraph links. Otherwise, it checks and replaces normal
links.redraw
- If true
, a redraw is performed after the
replacement of links.EnsureAppropriateLinkConnectors(IlvGrapherAdapter, IlvGraphLayout, boolean, boolean, boolean)
,
EnsureAppropriateLinks(IlvInappropriateLinkException, boolean)
,
IlvInappropriateLinkException
public static void EnsureAppropriateLinkConnectors(IlvGraphLayout layout, boolean moveableConnectionPoints)
IlvGrapher
are appropriate for a particular layout algorithm.
The method simply calls EnsureAppropriateLinkConnectors(IlvGrapherAdapter, IlvGraphLayout,
boolean, boolean, boolean)
passing the graph model attached to
layout
, the layout
argument, the
toStraightLine
argument, false
for the
traverse
argument. and true
for the
redraw
argument. See the documentation of this method.
If the graph model attached to the layout instance is not an
IlvGrapherAdapter
, the method does nothing.
layout
- The layout instance to which an IlvGrapher
is
attached.moveableConnectionPoints
- If true
, the method
attaches/detaches link connectors as needed in order to provide
appropriate support for layout algorithms that need to change the
connection points of the links and for layout algorithms that
reshape only the intermediate points of the links.public static void EnsureAppropriateLinkConnectors(IlvGrapherAdapter grapherAdapter, IlvGraphLayout layout, boolean moveableConnectionPoints, boolean traverse)
IlvGrapher
are appropriate for a particular layout algorithm.
The method calls EnsureAppropriateLinkConnectors(IlvGrapherAdapter, IlvGraphLayout,
boolean, boolean, boolean)
passing true
for the
redraw
argument. See the documentation of this method.
grapherAdapter
- The grapher adapter for which the appropriate link
connectors need to be installed.layout
- The layout instance to which an IlvGrapher
is
attached. Can be null
if it is not available.moveableConnectionPoints
- If true
, the method
attaches or detaches link connectors as needed in order to provide
appropriate support for layout algorithms that need to change the
connection points of the links and for layout algorithms that
reshape only the intermediate points of the links.traverse
- If true
, the method is applied recursively
on the subgraphs.public static void EnsureAppropriateLinkConnectors(IlvGrapherAdapter grapherAdapter, IlvGraphLayout layout, boolean moveableConnectionPoints, boolean traverse, boolean redraw)
IlvGrapher
are appropriate for a particular layout algorithm.
Some layout algorithms need to move the connection points of the
links. Some other algorithms, or the same algorithm with different
settings, do not compute the connection points at all. However, the
connection points of the links on an IlvGrapher
can be moved
only if the appropriate link connector is used (IlvFreeLinkConnector
). By contrast, if the connection points are not
computed by the layout algorithm, IlvFreeLinkConnector
is
usually not appropriate.
This utility method can be used either in advance or when an IlvInappropriateLinkException
thrown by the method IlvGraphLayout.performLayout()
is caught.
The method is designed to be used when the layout algorithm lays out
an IlvGrapher
. If the argument graphModel
is not
an an IlvGrapherAdapter
, the method does nothing.
However, to achieve best runtime performance, the appropriate type of link connectors should be used from the beginning to avoid the overhead cost of the replacement.
Depending on the value of the argument
moveableConnectionPoints
, the method ensures that the
links have moveable connection points or not.
If the argument moveableConnectionPoints
is
true
, the method attaches a link connector of type
IlvFreeLinkConnector
on the nodes if one is not already
attached.
Otherwise, if the argument moveableConnectionPoints
is
false
, the method detaches any IlvFreeLinkConnector
(or subclass) from the nodes.
Note that if a filter is installed on graphModel
(see
IlvGrapherAdapter.setFilter(ilog.views.graphlayout.IlvLayoutGraphicFilter)
) or a per-layer filter is used
(see IlvGrapherAdapter.addLayer(ilog.views.IlvManagerLayer)
), only nodes accepted by the
filter are taken into consideration by this method.
grapherAdapter
- The grapher adapter for which the appropriate link
connectors need to be installed.layout
- The layout instance to which an IlvGrapher
is
attached. Can be null
if it is not available.moveableConnectionPoints
- If true
, the method
attaches/detaches link connectors as needed in order to provide
appropriate support for layout algorithms that need to change the
connection points of the links and for layout algorithms that
reshape only the intermediate points of the links.traverse
- If true
, the method is applied recursively
on the subgraphs.redraw
- If true
, a redraw is performed after the
replacement of link connectors.EnsureAppropriateLinkTypes(IlvGrapherAdapter, IlvGraphLayout, boolean, boolean, boolean, boolean)
,
EnsureAppropriateLinks(IlvInappropriateLinkException, boolean)
,
IlvInappropriateLinkException
public static void EnsureAppropriateLinks(IlvGraphModel graphModel, IlvLayoutProvider layoutProvider)
IlvGrapher
hierarchy are appropriate for the layout
algorithms that are delivered by the input provider.
The method calls EnsureAppropriateLinks(IlvGraphModel,
IlvLayoutProvider, boolean)
passing true
as third
argument (redraw argument). See the documentation of this method.
EnsureAppropriateLinks(IlvGraphModel, IlvLayoutProvider, boolean)
public static void EnsureAppropriateLinks(IlvGraphModel graphModel, IlvLayoutProvider layoutProvider, boolean redraw)
IlvGrapher
hierarchy are appropriate for the layout
algorithms that are delivered by the input provider.
Some layout algorithms need to reshape the intermediate points of the
links. When an IlvGrapher
is laid out, only some of the
JViews link classes allow changes to the intermediate points.
Some layout algorithms need to move the connection points of the
links. Some other algorithms, or the same algorithm with different
settings, do not compute the connection points at all. However, the
connection points of the links on an IlvGrapher
can be moved
only if the appropriate link connector is used (IlvFreeLinkConnector
). By contrast, if the connection points are not
computed by the layout algorithm, IlvFreeLinkConnector
is
usually not appropriate.
This utility traverses all layouts of the nested graph starting from
the input graph model and calls IlvGraphLayout.checkAppropriateLinks()
. If this raises an IlvInappropriateLinkException
for a subgraph, it catches the
exception and, depending on the type of the exception (see IlvInappropriateLinkException.getType()
), it calls EnsureAppropriateLinkTypes
and/or EnsureAppropriateLinkConnectors
. This replaces links or link
connectors as needed.
This utility method can be used either in advance or when an IlvInappropriateLinkException
thrown by the method IlvGraphLayout.performLayout()
is caught. However, to achieve best
runtime performance, the appropriate type of links and link
connectors should be used from the beginning to avoid the overhead
cost of the replacement.
Note that when a link is replaced, the object properties stored on
the link (see IlvGraphic.setProperty(java.lang.String, java.lang.Object)
and IlvGraphic.setNamedProperty(ilog.views.IlvNamedProperty)
) are not copied from the old link to the
new link.
Note that if a filter is installed on a graph model (see IlvGrapherAdapter.setFilter(ilog.views.graphlayout.IlvLayoutGraphicFilter)
) or a per-layer filter is used (see
IlvGrapherAdapter.addLayer(ilog.views.IlvManagerLayer)
), only nodes and links accepted by
the filter are taken into consideration by this method.
graphModel
- The top-level graph model where the recursive check is
started.layoutProvider
- The layout provider that delivers the layout
instances for the graph models of subgraphs.redraw
- If true
, redraw the graph when replacing
links.EnsureAppropriateLinkConnectors(IlvGrapherAdapter, IlvGraphLayout, boolean, boolean, boolean)
,
EnsureAppropriateLinkTypes(IlvGrapherAdapter, IlvGraphLayout, boolean, boolean, boolean, boolean)
,
IlvInappropriateLinkException
public static void EnsureAppropriateLinks(IlvGraphLayout layout, boolean redraw)
The method is equivalent to EnsureAppropriateLinks(IlvGraphModel, IlvLayoutProvider, boolean)
.
However, it works only on the input layout and does not traverse all
layouts of a nested graph. See the documentation of this method.
layout
- The layout to be checked.redraw
- If true
, redraw the graph when replacing
links.EnsureAppropriateLinks(IlvGraphModel, IlvLayoutProvider, boolean)
public static void EnsureAppropriateLinks(IlvInappropriateLinkException ex)
IlvGrapher
are appropriate for a particular layout algorithm that
has raised an IlvInappropriateLinkException
.
The method calls EnsureAppropriateLinks(IlvInappropriateLinkException, boolean)
passing true
as second argument (redraw argument). See
the documentation of this method.
EnsureAppropriateLinks(IlvInappropriateLinkException, boolean)
public static void EnsureAppropriateLinks(IlvInappropriateLinkException ex, boolean redraw)
IlvGrapher
are appropriate for a particular layout algorithm that
has raised an IlvInappropriateLinkException
.
When inappropriate links or link connectors are used, the method
IlvGraphLayout.performLayout()
throws an IlvInappropriateLinkException
. You can catch this exception and use
this utility method to obtain an automatic replacement of the
inappropriate links and link connectors.
Depending on the type of the exception (see IlvInappropriateLinkException.getType()
), the method calls EnsureAppropriateLinkTypes
and/or EnsureAppropriateLinkConnectors
. See the documentation of these
methods.
If the exception occurred during the layout of a nested graph with
the IlvRecursiveLayout
, the exception is a chain of exceptions (for each
subgraph one) connected through IlvGraphLayoutException.getNext()
. In this case, the method
handles the entire chain of exceptions, that is, it handles the
entire nested graph.
public static void EnsureAppropriateLinks(IlvGraphLayout layout, IlvInappropriateLinkException ex)
EnsureAppropriateLinks(IlvInappropriateLinkException, boolean)
instead.IlvGrapher
are appropriate for a particular layout algorithm.
EnsureAppropriateLinks(IlvInappropriateLinkException, boolean)
public static void SetFreeLinkConnectorFactory(IlvGraphLayoutUtil.FreeLinkConnectorFactory factory)
IlvFreeLinkConnector
. The methods
EnsureAppropriateLinkConnectors
and
EnsureAppropriateLinks
use this factory when creating
free link connectors for a node. If the factory is not set, instances
of IlvFreeLinkConnector
are created when needed to ensure
appropriate link connectors. The factory can be set to create
specific subclasses of IlvFreeLinkConnector
instead.
It is possible to install the factory once at the beginning of the
application. Switching the factory in a multithreading application
while some EnsureAppropriate
methods are running is not
recommended.
public static IlvGraphLayoutUtil.FreeLinkConnectorFactory GetFreeLinkConnectorFactory()
IlvFreeLinkConnector
during runs of any
EnsureAppropriate
methods.SetFreeLinkConnectorFactory(ilog.views.graphlayout.IlvGraphLayoutUtil.FreeLinkConnectorFactory)
,
EnsureAppropriateLinkConnectors(IlvGrapherAdapter, IlvGraphLayout, boolean, boolean, boolean)
,
EnsureAppropriateLinks(IlvGraphModel, IlvLayoutProvider, boolean)
,
EnsureAppropriateLinks(IlvInappropriateLinkException, boolean)
public static int GetNodeDegree(IlvGraphLayout layout, IlvGraphic node)
IlvGraphModel.getNodeDegree(java.lang.Object)
.IlvGrapher
; that is, the
number of links connected to the node.
Note that self-links are not taken into account (both extremities on the same node).
public static boolean IsTree(IlvGraphLayout layout, Object startNode)
true
if the connected component of the graph
attached to the layout instance that contains startNode
is a pure tree (with no cycles). Returns false
if this
component contains at least one cycle.
Self-links (that is, links with the same origin and destination node) are ignored during this test.
layout
- Layout instance.startNode
- Start node of the connected component of the graph.true
if the connected component of the graph
attached to the layout instance that contains
startNode
is a pure tree.IsTree(IlvGraphLayout, IlvGraphic)
IsTree(ilog.views.graphlayout.IlvGraphModel, java.lang.Object)
public static boolean IsTree(IlvGraphModel graphModel, Object startNode)
true
if the connected component of
graphModel
that contains startNode
is a
pure tree (with no cycles). Returns false
if this
component contains at least one cycle.
Self-links (that is, links with the same origin and destination node) are ignored during this test.
graphModel
- Graph layout model.startNode
- Start node of the connected component of the model.true
if the connected component of the graph model
containing the node is a pure tree.IsTree(ilog.views.graphlayout.IlvGraphLayout, java.lang.Object)
public static boolean IsConnected(IlvGraphModel graphModel)
true
if graphModel
is connected (that is, a
graph where there is a path connecting each pair of nodes); returns
false
otherwise.graphModel
- The graph model.true
if the graph model is connected.public static IlvGraphModel GetConnectedComponents(IlvGraphModel graphModel)
If the argument graphModel
represents a connected graph
(see IsConnected(ilog.views.graphlayout.IlvGraphModel)
), the graph model is returned unchanged.
Otherwise, it returns a new graph model in which only nodes are
stored (no links). Each node of the new graph model is itself a graph
model (instance of IlvGraphModel
) and contains the nodes and
the links of a connected component of the graph model passed as an
argument.
public static int ComputeNumberOfNodeOverlaps(IlvGraphModel graphModel)
graphModel
- The graph model.ComputeNumberOfNodeLinkOverlaps(IlvGraphModel)
,
ComputeNumberOfLinkOverlaps(IlvGraphModel)
,
ComputeNumberOfLinkCrossings(IlvGraphModel)
,
ComputeNumberOfLinkBends(IlvGraphModel)
public static int ComputeNumberOfNodeLinkOverlaps(IlvGraphModel graphModel)
graphModel
- The graph model.ComputeNumberOfNodeOverlaps(IlvGraphModel)
,
ComputeNumberOfLinkOverlaps(IlvGraphModel)
,
ComputeNumberOfLinkCrossings(IlvGraphModel)
,
ComputeNumberOfLinkBends(IlvGraphModel)
public static int ComputeNumberOfLinkBends(IlvGraphModel graphModel)
graphModel
- The graph model.ComputeNumberOfNodeOverlaps(IlvGraphModel)
,
ComputeNumberOfNodeLinkOverlaps(IlvGraphModel)
,
ComputeNumberOfLinkOverlaps(IlvGraphModel)
,
ComputeNumberOfLinkCrossings(IlvGraphModel)
public static int ComputeNumberOfLinkCrossings(IlvGraphModel graphModel)
graphModel
- The graph model.ComputeNumberOfNodeOverlaps(IlvGraphModel)
,
ComputeNumberOfNodeLinkOverlaps(IlvGraphModel)
,
ComputeNumberOfLinkOverlaps(IlvGraphModel)
,
ComputeNumberOfLinkBends(IlvGraphModel)
public static int ComputeNumberOfLinkOverlaps(IlvGraphModel graphModel)
graphModel
- The graph model.ComputeNumberOfNodeOverlaps(IlvGraphModel)
,
ComputeNumberOfNodeLinkOverlaps(IlvGraphModel)
,
ComputeNumberOfLinkCrossings(IlvGraphModel)
,
ComputeNumberOfLinkBends(IlvGraphModel)
public static void ConnectLinksToPoint(IlvGrapher grapher, IlvGraphic node, IlvPoint point, IlvTransformer t, boolean redraw)
IlvClippingUtil.ConnectLinksToPoint(ilog.views.IlvGrapher, ilog.views.IlvGraphic, ilog.views.IlvPoint, ilog.views.IlvTransformer, boolean)
instead, which has the same
functionality.grapher
- The grapher that contains the node.node
- The node whose links are connected.point
- The untransformed connection point (in manager
coordinates).t
- The transformer by which the node and the links are
drawn.redraw
- true
if the links are redrawn.public static IlvPoint BestClipPointOnRay(IlvPoint startPoint, IlvPoint controlPoint, IlvPoint[] intersectionPoints, int numIntersections)
IlvClippingUtil.BestClipPointOnRay(ilog.views.IlvPoint, ilog.views.IlvPoint, ilog.views.IlvPoint[], int)
instead, which has the same
functionality.startPoint
- The starting point of the ray.controlPoint
- Another point of the ray.intersectionPoints
- An array of intersection points. Typically,
these are the intersection points of a line through starting and
control points and the border shape of a node.numIntersections
- The number of valid intersections in the array.public static boolean LineIntersectsSegment(IlvPoint p1, IlvPoint p2, IlvPoint p3, IlvPoint p4, IlvPoint res)
IlvClippingUtil.LineIntersectsSegment(ilog.views.IlvPoint, ilog.views.IlvPoint, ilog.views.IlvPoint, ilog.views.IlvPoint, ilog.views.IlvPoint)
instead, which has the same
functionality.p1
- A point on the line.p2
- Another point on the line.p3
- The first end point of the line segment.p4
- The second end point of the line segment.res
- Container for the resulting intersection point.true
if the line intersects the segment at a unique
point.public static int LineIntersectsPolyPoints(IlvPoint p1, IlvPoint p2, IlvPoint[] points, boolean closed, IlvPoint[] res)
IlvClippingUtil.LineIntersectsPolyPoints(ilog.views.IlvPoint, ilog.views.IlvPoint, ilog.views.IlvPoint[], boolean, ilog.views.IlvPoint[])
instead, which has the
same functionality.p1
- One point of the line.p2
- Another point on the line.points
- The points of the polyline or polygon.closed
- true
if it is a polygon, false
if it is a polyline.res
- Container for the resulting intersection points. This
container must must be large enough to get all intersection points.public static int LineIntersectsEllipse(IlvPoint p1, IlvPoint p2, IlvRect rect, IlvPoint[] res)
IlvClippingUtil.LineIntersectsEllipse(ilog.views.IlvPoint, ilog.views.IlvPoint, ilog.views.IlvRect, ilog.views.IlvPoint[])
instead, which has the same
functionality.p1
- One point of the line.p2
- Another point on the line.rect
- The bounding box of the ellipse.res
- Container of two for the resulting intersection points.public static int LineIntersectsArc(IlvPoint p1, IlvPoint p2, IlvRect rect, double startAngle, double deltaAngle, IlvPoint[] res)
IlvClippingUtil.LineIntersectsArc(ilog.views.IlvPoint, ilog.views.IlvPoint, ilog.views.IlvRect, double, double, ilog.views.IlvPoint[])
instead, which has the same
functionality.p1
- One point of the line.p2
- Another point on the line.rect
- The bounding box of the complete ellipse.startAngle
- The angle of the starting point in degrees (0 .. 360).deltaAngle
- The angle range of the arc from the starting point to
the end point in degrees (0 .. 360).res
- Container of two for the resulting intersection points.public static int LineIntersectsQuadSpline(IlvPoint p1, IlvPoint p2, IlvPoint[] c, int startIndex, IlvPoint[] res)
IlvClippingUtil.LineIntersectsQuadSpline(ilog.views.IlvPoint, ilog.views.IlvPoint, ilog.views.IlvPoint[], int, ilog.views.IlvPoint[])
instead, which has the
same functionality.p1
- One point of the line.p2
- Another point on the line.c
- An array of control points of the spline.startIndex
- The index of the first valid control point in the
array c
. There must be three valid control points of
the spline in the array.res
- Container of two for the resulting intersection points.public static int LineIntersectsCubicSpline(IlvPoint p1, IlvPoint p2, IlvPoint[] c, int startIndex, IlvPoint[] res)
IlvClippingUtil.LineIntersectsCubicSpline(ilog.views.IlvPoint, ilog.views.IlvPoint, ilog.views.IlvPoint[], int, ilog.views.IlvPoint[])
instead, which has the
same functionality.p1
- One point of the line.p2
- Another point on the line.c
- An array of control points of the spline.startIndex
- The index of the first valid control point in the
array c
. There must be four valid control points of
the spline in the array.res
- Container of three for the resulting intersection points.public static IlvPoint ArcStartPoint(IlvRect rect, double startAngle)
IlvClippingUtil.ArcStartPoint(ilog.views.IlvRect, double)
instead, which has the same
functionality.rect
- The bounding box of the complete ellipse.startAngle
- The angle of the starting point in degrees (0 .. 360).public static IlvPoint ArcEndPoint(IlvRect rect, double startAngle, double deltaAngle)
IlvClippingUtil.ArcEndPoint(ilog.views.IlvRect, double, double)
instead, which has the same
functionality.rect
- The bounding box of the complete ellipse.startAngle
- The angle of the starting point in degrees (0 .. 360).deltaAngle
- The angle range of the arc from the starting point to
the end point in degrees (0 .. 360).public static Enumeration CreateSortedEnumeration(Enumeration enumeration, Comparator comparator)
enumeration
, but ordered according to the provided
comparator
.
If the argument comparator
is null
, or
enumeration
contains less than two elements, the method
returns the provided enumeration
unchanged.
This method transfers the elements of the enumeration into an array
of objects and then orders it thanks to the method Sort(Object[], Comparator)
. Finally, it builds a new enumeration
for the sorted array.
public static void Sort(Object[] objects, Comparator comparator)
objects
according to the provided
comparator
.
If the argument comparator
is null
or
objects
contains less than two elements, the method
keeps the provided objects
unchanged.
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.