public class IlvClippingUtil extends Object
IlvClippingLinkConnector
.Modifier and Type | Method and Description |
---|---|
static IlvPoint |
ArcEndPoint(IlvRect rect,
double startAngle,
double deltaAngle)
Returns the end point of an arc (a partial ellipse).
|
static IlvPoint |
ArcStartPoint(IlvRect rect,
double startAngle)
Returns the starting point of an arc (a partial ellipse).
|
static IlvPoint |
BestClipPointOnRay(IlvPoint startPoint,
IlvPoint controlPoint,
IlvPoint[] intersectionPoints,
int numIntersections)
Selects the "best" of n intersection points of a ray for clipping.
|
static void |
ConnectLinksToPoint(IlvGrapher grapher,
IlvGraphic node,
IlvPoint point,
IlvTransformer t,
boolean redraw)
Tries to connect all links of the input node to the input point.
|
static void |
ConnectToNodeCenters(IlvLinkImage link,
boolean fromSide,
boolean toSide,
IlvTransformer t,
boolean redraw)
Tries to connect the link to the node centers.
|
static void |
ConnectToPoint(IlvLinkImage link,
IlvPoint fromPoint,
IlvPoint toPoint,
IlvTransformer t,
boolean redraw)
Tries to connect the link to the given points.
|
static void |
ConnectToViewPoint(IlvLinkImage link,
IlvPoint fromPoint,
IlvPoint toPoint,
IlvTransformer t,
boolean redraw)
Tries to connect the link to the given points.
|
static IlvPoint |
getClippedPoint(IlvGraphic node,
IlvTransformer t,
IlvPoint attachPoint,
IlvPoint controlPoint)
Returns the clipped point, assuming that the attach point is inside the node
and the control point is outside the node.
|
static IlvPoint |
getClippedPoint(IlvRect bbox,
IlvPoint attachPoint,
IlvPoint controlPoint)
Returns the clipped point at the bounding box, assuming that the attach
point is inside the bounding box, and the control point is outside that
bounding box.
|
static IlvPoint |
getClippedPoint(PathIterator pi,
IlvTransformer t,
double lineWidth,
IlvPoint attachPoint,
IlvPoint controlPoint)
Returns the clipped point, assuming that the attach point is inside
the shape described by a shape iterator,
and the control point is outside that shape.
|
static int |
LineIntersectsArc(IlvPoint p1,
IlvPoint p2,
IlvRect rect,
double startAngle,
double deltaAngle,
IlvPoint[] res)
Calculates both intersections between a line and an arc (a partial
ellipse).
|
static int |
LineIntersectsCubicSpline(IlvPoint p1,
IlvPoint p2,
IlvPoint[] c,
int startIndex,
IlvPoint[] res)
Calculates all three intersections between a line and a cubic
Bezier spline.
|
static int |
LineIntersectsEllipse(IlvPoint p1,
IlvPoint p2,
IlvRect rect,
IlvPoint[] res)
Calculates both intersections between a line and an ellipse.
|
static int |
LineIntersectsPolyPoints(IlvPoint p1,
IlvPoint p2,
IlvPoint[] points,
boolean closed,
IlvPoint[] res)
Calculates the intersections between a line and a polyline or polygon.
|
static int |
LineIntersectsQuadSpline(IlvPoint p1,
IlvPoint p2,
IlvPoint[] c,
int startIndex,
IlvPoint[] res)
Calculates the two intersections between a line and a quadratic
Bezier spline.
|
static boolean |
LineIntersectsSegment(IlvPoint p1,
IlvPoint p2,
IlvPoint p3,
IlvPoint p4,
IlvPoint res)
Calculates the intersection between a line and a line segment.
|
public static void ConnectLinksToPoint(IlvGrapher grapher, IlvGraphic node, IlvPoint point, IlvTransformer t, boolean redraw)
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 is drawn.redraw
- true
if the links are redrawn.public static void ConnectToPoint(IlvLinkImage link, IlvPoint fromPoint, IlvPoint toPoint, IlvTransformer t, boolean redraw)
link
- The link to be connected.fromPoint
- The untransformed origin point.
If null
, the link is
not connected at the origin side.toPoint
- The untransformed destination point.
If null
, the link is
not connected at the destination side.t
- The transformer by which the link is drawn.redraw
- true
if the link is redrawn.public static void ConnectToViewPoint(IlvLinkImage link, IlvPoint fromPoint, IlvPoint toPoint, IlvTransformer t, boolean redraw)
link
- The link to be connected.fromPoint
- The origin point, in view coordinates.
If null
, the link is
not connected at the origin side.toPoint
- The destination point, in view coordinates.
If null
, the link is
not connected at the destination side.t
- The transformer by which the link is drawn.redraw
- true
if the link is redrawn.public static void ConnectToNodeCenters(IlvLinkImage link, boolean fromSide, boolean toSide, IlvTransformer t, boolean redraw)
link
- The link to be connected.fromSide
- Whether the from side gets connected.toSide
- Whether the to side gets connected.t
- The transformer by which the link is drawn.redraw
- true
if the link is redrawn.public static IlvPoint BestClipPointOnRay(IlvPoint startPoint, IlvPoint controlPoint, IlvPoint[] intersectionPoints, int numIntersections)
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)
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)
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)
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)
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)
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)
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)
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)
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 IlvPoint getClippedPoint(IlvGraphic node, IlvTransformer t, IlvPoint attachPoint, IlvPoint controlPoint)
attachPoint
and controlPoint
are
equal, the attachPoint
is returned.
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.node
- The node to clip against its border.t
- The transformer that is used to draw the node.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.public static IlvPoint getClippedPoint(IlvRect bbox, IlvPoint attachPoint, IlvPoint controlPoint)
bbox
- The bounding box in view coordinates.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.public static IlvPoint getClippedPoint(PathIterator pi, IlvTransformer t, double lineWidth, IlvPoint attachPoint, IlvPoint controlPoint)
pi
- The iterator of the shape path.t
- The transformer that is used to draw the node.lineWidth
- The line width in transformed coordinates.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.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.