scenic.path
Class PathBuilder

java.lang.Object
  extended by scenic.path.PathBuilder

public class PathBuilder
extends java.lang.Object

This class offers a convenient interface for creating paths.


Constructor Summary
PathBuilder()
          Creates a new PathBuilder object.
 
Method Summary
 void addSegment(Segment s)
          Adds a segment to the current subpath.
 void arc(double x, double y, double xRadius, double yRadius, double rotation, double startAngle, double stopAngle)
          Draws an elliptic arc starting from the given position.
 void arcTo(double xRadius, double yRadius, double rotation, double startAngle, double stopAngle)
          Draws an elliptic arc starting from the current position.
 void close()
          Closes the current subpath.
 Path createPath()
          Creates a Path object that contains the created path.
 void curveTo(java.awt.geom.Point2D p1, java.awt.geom.Point2D p2)
          Draws a quadratic Bezier-curve using the given control points.
 void curveTo(java.awt.geom.Point2D p1, java.awt.geom.Point2D p2, java.awt.geom.Point2D p3)
          Draws a cubic Bezier-curve using the given control points.
 SubPath[] getSubPaths()
          Get the subpaths as an array.
 void lineTo(double x, double y)
          Draws a straight line to the given position.
 void moveTo(double x, double y)
          Begins a new subpath from the given position.
 void rectangle(double x, double y, double width, double height)
          Draws a rectangle.
 void roundedRectangle(double x, double y, double width, double height, double radius)
          Draws a rectangle with rounded edges.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PathBuilder

public PathBuilder()
Creates a new PathBuilder object.

Method Detail

moveTo

public void moveTo(double x,
                   double y)
Begins a new subpath from the given position.


lineTo

public void lineTo(double x,
                   double y)
Draws a straight line to the given position.


curveTo

public void curveTo(java.awt.geom.Point2D p1,
                    java.awt.geom.Point2D p2)
Draws a quadratic Bezier-curve using the given control points. The first control point is the current position.

Parameters:
p1 - the second control point.
p2 - the third control point.

curveTo

public void curveTo(java.awt.geom.Point2D p1,
                    java.awt.geom.Point2D p2,
                    java.awt.geom.Point2D p3)
Draws a cubic Bezier-curve using the given control points. The first control point is the current position.

Parameters:
p1 - the second control point.
p2 - the third control point.
p3 - the fourth control point.

arcTo

public void arcTo(double xRadius,
                  double yRadius,
                  double rotation,
                  double startAngle,
                  double stopAngle)
Draws an elliptic arc starting from the current position.

Parameters:
xRadius - the x radius of the ellipse.
yRadius - the y radius of the ellipse.
rotation - the rotation of the ellipse in degrees.
startAngle - the start angle of the arc in degrees.
stopAngle - the stop angle of the arc in degrees.

arc

public void arc(double x,
                double y,
                double xRadius,
                double yRadius,
                double rotation,
                double startAngle,
                double stopAngle)
Draws an elliptic arc starting from the given position.

Parameters:
x - the x-coordinate of the starting point of the arc.
y - the y-coordinate of the starting point of the arc.
xRadius - the x radius of the ellipse.
yRadius - the y radius of the ellipse.
rotation - the rotation of the ellipse in degrees.
startAngle - the start angle of the arc in degrees.
stopAngle - the stop angle of the arc in degrees.

rectangle

public void rectangle(double x,
                      double y,
                      double width,
                      double height)
Draws a rectangle.

Parameters:
x - the left side of the rectangle.
y - the top of the rectangle.
width - the width of the rectangle.
height - the height of the rectangle.

roundedRectangle

public void roundedRectangle(double x,
                             double y,
                             double width,
                             double height,
                             double radius)
Draws a rectangle with rounded edges.

Parameters:
x - the left side of the rectangle.
y - the top of the rectangle.
width - the width of the rectangle.
height - the height of the rectangle.
radius - the radius of the rounded edges.

addSegment

public void addSegment(Segment s)
Adds a segment to the current subpath.

Parameters:
s - the segment to be added.

close

public void close()
Closes the current subpath.


createPath

public Path createPath()
Creates a Path object that contains the created path.

Returns:
the Path object.

getSubPaths

public SubPath[] getSubPaths()
Get the subpaths as an array.

Returns:
the subpaths