Class SvgDoublePathBuilder

java.lang.Object
org.jhotdraw8.geom.SvgDoublePathBuilder
All Implemented Interfaces:
PathBuilder<String>

public class SvgDoublePathBuilder extends Object implements PathBuilder<String>
SvgDoublePathBuilder.
Author:
Werner Randelshofer
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    void
    Closes the path by adding a straight line back to the last PathBuilder.moveTo(java.awt.geom.Point2D) point.
    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.
    double
    Getter.
    double
    Getter.
    double
    Getter.
    double
    Getter.
    void
    lineTo(double x, double y)
    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.
    boolean
     
    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.
    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.
    void
    smoothQuadTo(double x, double y)
    Adds a smooth quadratic curve going to the specified end point coordinate.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.jhotdraw8.geom.PathBuilder

    circle, counterClockwiseCircle, curveTo, getLastPoint, lineTo, moveTo, pathDone, quadTo, smoothCurveTo, smoothQuadTo
  • Constructor Details

    • SvgDoublePathBuilder

      public SvgDoublePathBuilder()
  • Method Details

    • arcTo

      public void arcTo(double radiusX, double radiusY, double xAxisRotation, double x, double y, boolean largeArcFlag, boolean sweepFlag)
      Description copied from interface: PathBuilder
      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.

      Specified by:
      arcTo in interface PathBuilder<String>
      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

      public void closePath()
      Description copied from interface: PathBuilder
      Closes the path by adding a straight line back to the last PathBuilder.moveTo(java.awt.geom.Point2D) point.

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

      Specified by:
      closePath in interface PathBuilder<String>
    • curveTo

      public void curveTo(double x1, double y1, double x2, double y2, double x, double y)
      Description copied from interface: PathBuilder
      Adds a cubic curve going to the specified end point coordinate using the specified control points.
      Specified by:
      curveTo in interface PathBuilder<String>
      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
    • getLastCX

      public double getLastCX()
      Description copied from interface: PathBuilder
      Getter.
      Specified by:
      getLastCX in interface PathBuilder<String>
      Returns:
      x coordinate of the last control point.
    • getLastCY

      public double getLastCY()
      Description copied from interface: PathBuilder
      Getter.
      Specified by:
      getLastCY in interface PathBuilder<String>
      Returns:
      y coordinate of the last control point.
    • getLastX

      public double getLastX()
      Description copied from interface: PathBuilder
      Getter.
      Specified by:
      getLastX in interface PathBuilder<String>
      Returns:
      x coordinate of the last end point.
    • getLastY

      public double getLastY()
      Description copied from interface: PathBuilder
      Getter.
      Specified by:
      getLastY in interface PathBuilder<String>
      Returns:
      y coordinate of the last control point.
    • lineTo

      public void lineTo(double x, double y)
      Description copied from interface: PathBuilder
      Adds a straight line to the path going to the specified end point.
      Specified by:
      lineTo in interface PathBuilder<String>
      Parameters:
      x - the x coordinate of the end point
      y - the y coordinate of the end point
    • moveTo

      public void moveTo(double x, double y)
      Description copied from interface: PathBuilder
      Adds a point to the path by moving to the specified point coordinates.
      Specified by:
      moveTo in interface PathBuilder<String>
      Parameters:
      x - the x coordinate of the end point
      y - the y coordinate of the end point
    • quadTo

      public void quadTo(double x1, double y1, double x, double y)
      Description copied from interface: PathBuilder
      Adds a quadratic curve going to the specified point coordinate using the specified control point.

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

      Specified by:
      quadTo in interface PathBuilder<String>
      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
    • smoothCurveTo

      public void smoothCurveTo(double x2, double y2, double x, double y)
      Description copied from interface: PathBuilder
      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.

      Specified by:
      smoothCurveTo in interface PathBuilder<String>
      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

      public void smoothQuadTo(double x, double y)
      Description copied from interface: PathBuilder
      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.

      Specified by:
      smoothQuadTo in interface PathBuilder<String>
      Parameters:
      x - the x coordinate of the end point
      y - the y coordinate of the end point
    • build

      public String build()
      Description copied from interface: PathBuilder
      Builds something.

      Some implementations may guarantee a non-null return value.

      Specified by:
      build in interface PathBuilder<String>
    • needsMoveTo

      public boolean needsMoveTo()
      Specified by:
      needsMoveTo in interface PathBuilder<String>