public class IlvClippingLinkConnector extends IlvFreeLinkConnector
IlvFreeLinkConnector.connectLink(IlvLinkImage, IlvPoint, boolean, IlvTransformer)
;
that is, if the node moves, grows, or shrinks, the attachment point moves
proportionally.
However, unlike the free link connector, the link segment towards the attachment point is clipped at the border of the node if the node is one of the standard graphic objects. This is useful if the links have arrowheads that should be drawn exactly at the node border and the shape of the node is nonrectangular, for example a triangle, circle, or polygon.
How it works | Result |
It can clip at the border of the following objects:
IlvShapePath
interface.IlvPolygon
IlvEllipse
IlvArc
IlvRectangle
IlvSpline
with a small border line width and smoothness
larger than zero.
It does not work with IlvGraphicUtil.COMPATIBLE_SMOOTHNESS
.
If the line width is very large, rounding errors will become visible.
IlvGeneralPath
with a stroke width of 0.This link connector can be used with the graph layout algorithms that need to change the connection points of the links.
IlvShapePath
,
Serialized FormConstructor and Description |
---|
IlvClippingLinkConnector()
Creates an empty
IlvClippingLinkConnector . |
IlvClippingLinkConnector(IlvGraphic node)
Creates an
IlvClippingLinkConnector attached to the node
node . |
IlvClippingLinkConnector(IlvInputStream stream)
Reads the object from an
IlvInputStream . |
IlvClippingLinkConnector(IlvLinkImage link,
boolean origin)
Creates an
IlvClippingLinkConnector attached to the
origin or destination of the link link . |
Modifier and Type | Method and Description |
---|---|
protected IlvPoint |
calcConnectionPoint(IlvLinkImage link,
boolean origin,
IlvTransformer transformer)
Calculates the clipped connection point.
|
IlvPoint |
getClippedPoint(IlvGraphic node,
IlvTransformer t,
Object link,
IlvPoint attachPoint,
IlvPoint controlPoint,
boolean origin)
Returns the clipped connection point of a link that starts at the
proposed connection point inside the node and goes through the auxiliary
control point.
|
IlvPoint |
getUnclippedConnectionPoint(IlvLinkImage link,
boolean origin,
IlvTransformer transformer)
Returns the unclipped connection point of
link . |
protected boolean |
useCache()
Return
true because this link connector uses the cache. |
protected boolean |
zoomable()
Indicates that this link connector is nonzoomable.
|
allLinksRemoved, allowsConnectionPointMove, connectionPointMoveAllowed, connectLink, detach, detach, disconnectAllLinks, disconnectLink, getClosestConnectionPoint, getGhostBoundingBox, getNodeBoundingBox, isConnectionPointMoveAllowed, isPersistent, linkRemoved, read, setConnectionPointMoveAllowed, write, write
cleanCache, cleanCache, getCacheSize, getConnectionPoint, linkChanged, LinkChanged, LinkRemoved, setCacheSize, useCache
attach, attach, attach, drawGhost, Get, Get, GetAttached, GetAttached, getNode, supportsDrawGhost
public IlvClippingLinkConnector()
IlvClippingLinkConnector
. It can be
attached either to a node (using
IlvLinkConnector.attach(ilog.views.IlvGraphic,boolean)
) or to an extremity
of a link (using
IlvLinkConnector.attach(ilog.views.IlvLinkImage,boolean,boolean)
).public IlvClippingLinkConnector(IlvGraphic node)
IlvClippingLinkConnector
attached to the node
node
.public IlvClippingLinkConnector(IlvLinkImage link, boolean origin)
IlvClippingLinkConnector
attached to the
origin or destination of the link link
.
If the argument origin
is true
,
this creates a link connector for the origin of link
.
If the argument origin
is false
,
this creates a link connector for the destination of link
.public IlvClippingLinkConnector(IlvInputStream stream) throws IlvReadFileException
IlvInputStream
.
Note that any subclass (except one that overrides the method
IlvFreeLinkConnector.isPersistent()
to return false
) must provide a
constructor with an IlvInputStream
argument.
The first line of the constructor must be super(stream)
.
stream
- The input stream.IlvReadFileException
- if the format is not correct.IlvFreeLinkConnector.write(ilog.views.io.IlvOutputStream)
,
IlvFreeLinkConnector.isPersistent()
,
IlvLinkConnector.attach(IlvGraphic, boolean)
,
IlvFreeLinkConnector.detach(boolean)
protected boolean useCache()
true
because this link connector uses the cache.useCache
in class IlvFreeLinkConnector
protected boolean zoomable()
false
.
Even if the node assigned to the link connector is considered zoomable,
the shape of the node may depend on the zoom level (for instance,
the rounding of the corners of an IlvRectangle
).
Since the clipping link connector calculates the connection points
depending on the precise shape, the returned connection points may
depend on the zoom level.
zoomable
in class IlvFreeLinkConnector
protected IlvPoint calcConnectionPoint(IlvLinkImage link, boolean origin, IlvTransformer transformer)
calcConnectionPoint
in class IlvFreeLinkConnector
link
- The link.origin
- Whether the connection point at the origin side
or at the destination side is calculated.transformer
- The transformer that is used to draw the
node to which is connected the corresponding extremity of the link.public IlvPoint getUnclippedConnectionPoint(IlvLinkImage link, boolean origin, IlvTransformer transformer)
link
.
The real connection point of the link (provided by
getConnectionPoint
is the point that clips
the link segment that starts or ends at the unclipped connection point
with the border of the end node.
The returned point is transformed in the coordinate system used to
draw the link.link
- The link.origin
- If true
, the position of the link
connection point for the link origin is determined. Otherwise, the
position of the connection point for the link destination is found.transformer
- The transformer that is used to draw the node.public IlvPoint getClippedPoint(IlvGraphic node, IlvTransformer t, Object link, IlvPoint attachPoint, IlvPoint controlPoint, boolean origin)
attachPoint
and controlPoint
are
equal, the attachPoint
is returned.
node
- The source or target node of the link.t
- The transformer that is used to draw the node.link
- The link to be clipped.attachPoint
- The point to which the unclipped link is attached.controlPoint
- The auxiliary control point. For the purpose of
clipping, the link can be considered as a ray that starts at
the attach point and goes through the control point.origin
- true
if the node is the source of the link,
false
if it is the target of the link.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.