Interface PathBuilder<T>

Type Parameters:
T - the product type
All Known Implementing Classes:
AbstractPathBuilder, AbstractPathDataBuilder, AffineTransformPathBuilder, AreaMetricsBuilder, AwtPathBuilder, BezierPathBuilder, BoundingBoxBuilder, ContourPathBuilder, FXPathElementsBuilder, FXPathPointsBuilder, FXPolygonBuilder, FXTransformPathBuilder, MarkerPathBuilder, NineRegionsScalingBuilder, PathDataBuilder, PathIteratorPathBuilder, PathMetricsBuilder, PlinePathBuilder, StartAndEndPointPathBuilder, StartAndEndPointsPathBuilder, SvgDoublePathBuilder, SvgFloatPathBuilder

public interface PathBuilder<T>
Interface for a builder that builds a product from a sequence of path operations.
Author:
Werner Randelshofer
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    arcTo(double radiusX, double radiusY, double xAxisRotation, double x, double y, boolean largeArcFlag, boolean sweepFlag)
    Adds an elliptical arc to the path which goes to the specified end point using the specified parameters.
    Builds something.
    default void
    circle(double radius, double cx, double cy)
    Adds a circle to the path winding in clockwise direction.
    void
    Closes the path by adding a straight line back to the last moveTo(java.awt.geom.Point2D) point.
    default void
    counterClockwiseCircle(double radius, double cx, double cy)
    Adds a circle to the path winding in counter-clockwise direction.
    void
    curveTo(double x1, double y1, double x2, double y2, double x, double y)
    Adds a cubic curve going to the specified end point coordinate using the specified control points.
    default void
    Adds a cubic curve going to the specified point coordinate using the specified control points.
    double
    Getter.
    double
    Getter.
    Getter.
    double
    Getter.
    double
    Getter.
    void
    lineTo(double x, double y)
    Adds a straight line to the path going to the specified end point.
    default void
    Adds a straight line to the path going to the specified end point.
    void
    moveTo(double x, double y)
    Adds a point to the path by moving to the specified point coordinates.
    default void
    Adds a point to the path by moving to the specified end point.
    boolean
     
    default void
    Performs path processing after all the path segments have been added to the builder.
    void
    quadTo(double x1, double y1, double x, double y)
    Adds a quadratic curve going to the specified point coordinate using the specified control point.
    default void
    Adds a quadratic curve going to the specified point coordinate using the specified control point.
    default void
    smoothCurveTo(double x2, double y2, double x, double y)
    Adds a smooth cubic curve going to the specified end point coordinate using the specified control point.
    default void
    Adds a smooth cubic curve going to the specified end point coordinate using the specified control point.
    default void
    smoothQuadTo(double x, double y)
    Adds a smooth quadratic curve going to the specified end point coordinate.
    default void
    Adds a smooth quadratic curve going to the specified end point coordinate.
  • Method Details

    • arcTo

      default void arcTo(double radiusX, double radiusY, double xAxisRotation, double x, double y, boolean largeArcFlag, boolean sweepFlag)
      Adds an elliptical arc to the path which goes to the specified end point using the specified parameters.

      The elliptical arc is defined by two radii, an angle from the x-axis, a flag to choose the large arc or not, a flag to indicate if we increase or decrease the angles and the final point of the arc.

      As specified in SVG elliptical arc commands.

      The default implementation of this method has been derived from Apache Batik class org.apache.batik.ext.awt.geom.ExtendedGeneralPath#computArc. The default implementation decomposes the arc into cubic curve segments and invokes corresponding curveTo methods.

      Parameters:
      radiusX - the x radius of the ellipse
      radiusY - the y radius of the ellipse
      xAxisRotation - the angle from the x-axis of the current coordinate system to the x-axis of the ellipse in degrees.
      x - the x coordinate of the end point
      y - the y coordinate of the end point
      largeArcFlag - the large arc flag. If true the arc spanning more than or equal to 180 degrees is chosen, otherwise the arc spanning less than 180 degrees is chosen
      sweepFlag - the sweep flag. If true the line joining center to arc sweeps through decreasing angles otherwise it sweeps through increasing angles
    • closePath

      void closePath()
      Closes the path by adding a straight line back to the last moveTo(java.awt.geom.Point2D) point.

      If the path is already closed, then this method has no effect.

    • curveTo

      void curveTo(double x1, double y1, double x2, double y2, double x, double y)
      Adds a cubic curve going to the specified end point coordinate using the specified control points.
      Parameters:
      x1 - the x coordinate of control point 1
      y1 - the y coordinate of control point 1
      x2 - the x coordinate of control point 2
      y2 - the y coordinate of control point 2
      x - the x coordinate of the end point
      y - the y coordinate of the end point
    • curveTo

      default void curveTo(Point2D c1, Point2D c2, Point2D p)
      Adds a cubic curve going to the specified point coordinate using the specified control points.

      The default implementation of this method calls curveTo(double, double, double, double, double, double).

      Parameters:
      c1 - the control point 1
      c2 - the control point 2
      p - the end point
    • getLastCX

      double getLastCX()
      Getter.
      Returns:
      x coordinate of the last control point.
    • getLastCY

      double getLastCY()
      Getter.
      Returns:
      y coordinate of the last control point.
    • getLastPoint

      default Point2D.Double getLastPoint()
      Getter.
      Returns:
      the last end point.
    • getLastX

      double getLastX()
      Getter.
      Returns:
      x coordinate of the last end point.
    • getLastY

      double getLastY()
      Getter.
      Returns:
      y coordinate of the last control point.
    • lineTo

      default void lineTo(Point2D p)
      Adds a straight line to the path going to the specified end point.

      The default implementation of this method calls lineTo(double, double).

      Parameters:
      p - the end point
    • lineTo

      void lineTo(double x, double y)
      Adds a straight line to the path going to the specified end point.
      Parameters:
      x - the x coordinate of the end point
      y - the y coordinate of the end point
    • moveTo

      default void moveTo(Point2D p)
      Adds a point to the path by moving to the specified end point.

      The default implementation of this method calls moveTo(double, double).

      Parameters:
      p - the end point
    • moveTo

      void moveTo(double x, double y)
      Adds a point to the path by moving to the specified point coordinates.
      Parameters:
      x - the x coordinate of the end point
      y - the y coordinate of the end point
    • pathDone

      default void pathDone()
      Performs path processing after all the path segments have been added to the builder.
    • quadTo

      void quadTo(double x1, double y1, double x, double y)
      Adds a quadratic curve going to the specified point coordinate using the specified control point.

      The default implementation of this method calls quadTo(double, double, double, double).

      Parameters:
      x1 - the x coordinate of the control point
      y1 - the y coordinate of the control point
      x - the x coordinate of the end point
      y - the y coordinate of the end point
    • quadTo

      default void quadTo(Point2D c, Point2D p)
      Adds a quadratic curve going to the specified point coordinate using the specified control point.

      The default implementation of this method calls quadTo(double, double, double, double).

      Parameters:
      c - the control point
      p - the end point
    • smoothCurveTo

      default void smoothCurveTo(Point2D c2, Point2D p)
      Adds a smooth cubic curve going to the specified end point coordinate using the specified control point.

      The coordinates of control point 1 is the coordinate of the last control point mirrored along the last end point.

      The default implementation of this method calls smoothCurveTo(double, double, double, double).

      Parameters:
      c2 - the control point 2
      p - the end point
    • smoothCurveTo

      default void smoothCurveTo(double x2, double y2, double x, double y)
      Adds a smooth cubic curve going to the specified end point coordinate using the specified control point.

      The coordinates of control point 1 is the coordinate of the last control point mirrored along the last end point.

      Parameters:
      x2 - the x coordinate of control point 2
      y2 - the y coordinate of control point 2
      x - the x coordinate of the end point
      y - the y coordinate of the end point
    • smoothQuadTo

      default void smoothQuadTo(Point2D p)
      Adds a smooth quadratic curve going to the specified end point coordinate.

      The coordinates of the control point is the coordinate of the last control point mirrored along the last end point.

      The default implementation of this method calls smoothQuadTo(double, double).

      Parameters:
      p - the end point
    • smoothQuadTo

      default void smoothQuadTo(double x, double y)
      Adds a smooth quadratic curve going to the specified end point coordinate.

      The coordinates of the control point is the coordinate of the last control point mirrored along the last end point.

      Parameters:
      x - the x coordinate of the end point
      y - the y coordinate of the end point
    • needsMoveTo

      boolean needsMoveTo()
    • build

      T build()
      Builds something.

      Some implementations may guarantee a non-null return value.

    • circle

      default void circle(double radius, double cx, double cy)
      Adds a circle to the path winding in clockwise direction.
      Parameters:
      radius - the radius of the circle
      cx - the x-coordinate of the center of the circle
      cy - the y-coordinate of the center of the circle
    • counterClockwiseCircle

      default void counterClockwiseCircle(double radius, double cx, double cy)
      Adds a circle to the path winding in counter-clockwise direction.
      Parameters:
      radius - the radius of the circle
      cx - the x-coordinate of the center of the circle
      cy - the y-coordinate of the center of the circle