public interface IlvTerminationPointFilter
The filter can be used instead of IlvNodeSideFilter
to allow more precisely
which termination points can be used when routing a link. For each
link, the layout algorithm proposes certain termination points that
are on the grid at any of the four sides of the corresponding end
node. The termination point filter allows you to assign a penalty to
the termination points. The termination point with the lowest penalty
is most likely to be used. Termination points with penalty
java.lang.Integer.MAX_VALUE
are never chosen for the link
routing.
The penalty affects which termination point is used, but this also depends whether a route from the "start" termination point to the "end" termination point of the link is possible at all without overlapping obstacles.
IlvNodeSideFilter
,
IlvLongLinkLayout.setTerminationPointFilter(IlvTerminationPointFilter)
Modifier and Type | Method and Description |
---|---|
int |
getPenalty(IlvGraphModel graphModel,
Object link,
boolean origin,
Object node,
IlvPoint point,
int side,
int proposedPenalty)
Allows you to assign a penalty to the termination point of
link at a given start point which is on the given side
of the node node . |
int getPenalty(IlvGraphModel graphModel, Object link, boolean origin, Object node, IlvPoint point, int side, int proposedPenalty)
link
at a given start point which is on the given side
of the node node
.
Returns a number between 0 and
java.lang.Integer.MAX_VALUE
. As smaller the number, as
more likely the termination point will be chosen for the link
routing. Termination points with penalty
java.lang.Integer.MAX_VALUE
are never chosen for the
link routing.
The values for side
are defined in the class
ilog.views.IlvDirection
. Valid values are
Top
, Bottom
, Left
, and
Right
.
This method is called by IlvLongLinkLayout
if a termination
point filter is installed. You can implement this method in order to
define complex requirements concerning the connection of the links to
the different sides of nodes. For example, if you want all links to
be connected to any side except the top side of the nodes, you could
use:
return (side != IlvDirection.Top ? proposedPenalty : java.lang.Integer.MAX_VALUE);
graphModel
- The graph model to which the node belongs.link
- The link to be connected to the node.origin
- If origin
is true
, the method
determines whether the link origin can be connected. Otherwise, the
method determines whether the link destination can be connected.node
- The node.point
- The proposed termination point for the link.side
- The side of the node where the proposed termination point is
placed. The values are defined in the class
ilog.views.IlvDirection
. Valid values are
Top
, Bottom
, Left
, and
Right
.proposedPenalty
- The proposed penalty for the termination point.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.