Class ExtendedGeneralPath

  • All Implemented Interfaces:
    Shape, Cloneable

    public class ExtendedGeneralPath
    extends Object
    implements Shape, Cloneable
    The ExtendedGeneralPath class represents a geometric path constructed from straight lines, quadratic and cubic (Bezier) curves and elliptical arc. This class delegates lines and curves to an enclosed GeneralPath. Elliptical arc is implemented using an Arc2D in double precision.

    Warning : An elliptical arc may be composed of several path segments. For further details, see the SVG Appendix F.6

    Version:
    $Id: ExtendedGeneralPath.java 594018 2007-11-12 04:17:41Z cam $
    Author:
    Thierry Kormann
    • Constructor Summary

      Constructors 
      Constructor Description
      ExtendedGeneralPath()
      Constructs a new ExtendedGeneralPath.
      ExtendedGeneralPath​(int rule)
      Constructs a new ExtendedGeneralPath with the specified winding rule to control operations that require the interior of the path to be defined.
      ExtendedGeneralPath​(int rule, int initialCapacity)
      Constructs a new ExtendedGeneralPath object with the specified winding rule and the specified initial capacity to store path coordinates.
      ExtendedGeneralPath​(Shape s)
      Constructs a new ExtendedGeneralPath object from an arbitrary Shape object.
    • Constructor Detail

      • ExtendedGeneralPath

        public ExtendedGeneralPath()
        Constructs a new ExtendedGeneralPath.
      • ExtendedGeneralPath

        public ExtendedGeneralPath​(int rule)
        Constructs a new ExtendedGeneralPath with the specified winding rule to control operations that require the interior of the path to be defined.
      • ExtendedGeneralPath

        public ExtendedGeneralPath​(int rule,
                                   int initialCapacity)
        Constructs a new ExtendedGeneralPath object with the specified winding rule and the specified initial capacity to store path coordinates.
      • ExtendedGeneralPath

        public ExtendedGeneralPath​(Shape s)
        Constructs a new ExtendedGeneralPath object from an arbitrary Shape object.
    • Method Detail

      • arcTo

        public void arcTo​(double rx,
                          double ry,
                          double angle,
                          boolean largeArcFlag,
                          boolean sweepFlag,
                          double x,
                          double y)
        Adds an elliptical arc, 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.
        Parameters:
        rx - the x radius of the ellipse
        ry - the y radius of the ellipse
        angle - the angle from the x-axis of the current coordinate system to the x-axis of the ellipse in degrees.
        largeArcFlag - the large arc flag. If true the arc spanning less than or equal to 180 degrees is chosen, otherwise the arc spanning greater 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
        x - the absolute x coordinate of the final point of the arc.
        y - the absolute y coordinate of the final point of the arc.
      • computeArc

        public static Arc2D computeArc​(double x0,
                                       double y0,
                                       double rx,
                                       double ry,
                                       double angle,
                                       boolean largeArcFlag,
                                       boolean sweepFlag,
                                       double x,
                                       double y)
        This constructs an unrotated Arc2D from the SVG specification of an Elliptical arc. To get the final arc you need to apply a rotation transform such as: AffineTransform.getRotateInstance (angle, arc.getX()+arc.getWidth()/2, arc.getY()+arc.getHeight()/2);
      • moveTo

        public void moveTo​(double x,
                           double y)
        Delegates to the enclosed GeneralPath.
      • lineTo

        public void lineTo​(double x,
                           double y)
        Delegates to the enclosed GeneralPath.
      • quadTo

        public void quadTo​(double x1,
                           double y1,
                           double x2,
                           double y2)
        Delegates to the enclosed GeneralPath.
      • curveTo

        public void curveTo​(double x1,
                            double y1,
                            double x2,
                            double y2,
                            double x3,
                            double y3)
        Delegates to the enclosed GeneralPath.
      • closePath

        public void closePath()
        Delegates to the enclosed GeneralPath.
      • checkMoveTo

        protected void checkMoveTo()
        Checks if previous command was a moveto command, skipping a close command (if present).
      • append

        public void append​(Shape s,
                           boolean connect)
        Delegates to the enclosed GeneralPath.
      • append

        public void append​(PathIterator pi,
                           boolean connect)
        Delegates to the enclosed GeneralPath.
      • append

        public void append​(ExtendedPathIterator epi,
                           boolean connect)
        Delegates to the enclosed GeneralPath.
      • getWindingRule

        public int getWindingRule()
        Delegates to the enclosed GeneralPath.
      • setWindingRule

        public void setWindingRule​(int rule)
        Delegates to the enclosed GeneralPath.
      • getCurrentPoint

        public Point2D getCurrentPoint()
        get the current position or null.
      • reset

        public void reset()
        Delegates to the enclosed GeneralPath.
      • transform

        public void transform​(AffineTransform at)
        Delegates to the enclosed GeneralPath.
      • createTransformedShape

        public Shape createTransformedShape​(AffineTransform at)
        Delegates to the enclosed GeneralPath.
      • getBounds

        public Rectangle getBounds()
        Delegates to the enclosed GeneralPath.
        Specified by:
        getBounds in interface Shape
      • contains

        public boolean contains​(double x,
                                double y)
        Delegates to the enclosed GeneralPath.
        Specified by:
        contains in interface Shape
      • contains

        public boolean contains​(Point2D p)
        Delegates to the enclosed GeneralPath.
        Specified by:
        contains in interface Shape
      • contains

        public boolean contains​(double x,
                                double y,
                                double w,
                                double h)
        Delegates to the enclosed GeneralPath.
        Specified by:
        contains in interface Shape
      • contains

        public boolean contains​(Rectangle2D r)
        Delegates to the enclosed GeneralPath.
        Specified by:
        contains in interface Shape
      • intersects

        public boolean intersects​(double x,
                                  double y,
                                  double w,
                                  double h)
        Delegates to the enclosed GeneralPath.
        Specified by:
        intersects in interface Shape
      • intersects

        public boolean intersects​(Rectangle2D r)
        Delegates to the enclosed GeneralPath.
        Specified by:
        intersects in interface Shape
      • getExtendedPathIterator

        public ExtendedPathIterator getExtendedPathIterator()
        Delegates to the enclosed GeneralPath.
      • clone

        public Object clone()
        Delegates to the enclosed GeneralPath.
        Overrides:
        clone in class Object