Search this API

y.view
Class BezierPathCalculator

java.lang.Object
  extended by y.view.BezierPathCalculator
All Implemented Interfaces:
GenericEdgeRealizer.PathCalculator

public class BezierPathCalculator
extends java.lang.Object
implements GenericEdgeRealizer.PathCalculator

Calculates the visible path of an edge as a bezier curve. The behavior of this path calculator is similar to the path calculated for class BezierEdgeRealizer.

 

Constructor Summary
BezierPathCalculator()
          Initializes a new BezierPathCalculator instance.
BezierPathCalculator(boolean interpolate)
          Initializes a new BezierPathCalculator instance.
 
Method Summary
 byte calculatePath(EdgeRealizer context, BendList bends, java.awt.geom.GeneralPath path, java.awt.geom.Point2D sourceIntersectionPointOut, java.awt.geom.Point2D targetIntersectionPointOut)
          Calculates the visible path of an edge as a bezier curve.
 boolean isInterpolationEnabled()
          Determines whether or not additional control points are calculated from the coordinates of the edge's bends to ensure a smooth bezier path.
 void setInterpolationEnabled(boolean enabled)
          Specifies whether or not additional control points are calculated from the coordinates of the edge's bends that ensure a smooth bezier path.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BezierPathCalculator

public BezierPathCalculator()
Initializes a new BezierPathCalculator instance.


BezierPathCalculator

public BezierPathCalculator(boolean interpolate)
Initializes a new BezierPathCalculator instance.

Parameters:
interpolate - if true additional control points are calculated from the coordinates of the edge's bends to ensure a smooth bezier path; if false only the edge's bends are used as control points.
See Also:
setInterpolationEnabled(boolean)
Method Detail

isInterpolationEnabled

public boolean isInterpolationEnabled()
Determines whether or not additional control points are calculated from the coordinates of the edge's bends to ensure a smooth bezier path.

If interpolation is turned off, only the edge's bends are used as control points for the bezier path. I.e. the edge path is a piecewise composition of bezier curves such that bends 0,1,2,3 define the first bezier curve (with bend 0 being the start point, bend 3 being the end point, and bends 1 and 2 being parametric control points), bends 3,4,5,6 define the second bezier curve, etc. Consequently, the number of bends has to equal 3*n+1 for some n > -1 in this case.

 
Interpolation may only be turned off if the bends of the edge are specifically calculated as control points for bezier curves.
Default Value:
The default value is true.
Returns:
true if additional control points are calculated and false otherwise.
See Also:
setInterpolationEnabled(boolean)

setInterpolationEnabled

public void setInterpolationEnabled(boolean enabled)
Specifies whether or not additional control points are calculated from the coordinates of the edge's bends that ensure a smooth bezier path.

If interpolation is turned off, only the edge's bends are used as control points for the bezier path. I.e. the edge path is a piecewise composition of bezier curves such that bends 0,1,2,3 define the first bezier curve (with bend 0 being the start point, bend 3 being the end point, and bends 1 and 2 being parametric control points), bends 3,4,5,6 define the second bezier curve, etc. Consequently, the number of bends has to equal 3*n+1 for some n > -1 in this case.

 
Interpolation may only be turned off if the bends of the edge are specifically calculated as control points for bezier curves.
Default Value:
The default value is true.
Parameters:
enabled - if true additional control points are calculated; if false only the edge's bends are used as control points.
See Also:
isInterpolationEnabled()

calculatePath

public byte calculatePath(EdgeRealizer context,
                          BendList bends,
                          java.awt.geom.GeneralPath path,
                          java.awt.geom.Point2D sourceIntersectionPointOut,
                          java.awt.geom.Point2D targetIntersectionPointOut)
Calculates the visible path of an edge as a bezier curve. The given realizer's bends are the control points for the bezier curve.

Specified by:
calculatePath in interface GenericEdgeRealizer.PathCalculator
Parameters:
context - the context EdgeRealizer
bends - the current BendList
path - the current GeneralPath
sourceIntersectionPointOut - the point to place the source intersection point in
targetIntersectionPointOut - the point to place the target intersection point in
Returns:
one of EdgeRealizer.PATH_UNCLIPPED, EdgeRealizer.PATH_CLIPPED_AT_SOURCE, EdgeRealizer.PATH_CLIPPED_AT_TARGET, or EdgeRealizer.PATH_CLIPPED_AT_SOURCE_AND_TARGET.

© Copyright 2000-2021,
yWorks GmbH.
All rights reserved.