Save This Page
Home » openjdk-7 » java » awt » geom » [javadoc | source]
java.awt.geom
abstract public class: Arc2D [javadoc | source]
java.lang.Object
   java.awt.geom.RectangularShape
      java.awt.geom.Arc2D

All Implemented Interfaces:
    Shape, Cloneable

Direct Known Subclasses:
    Double, Float

Arc2D is the abstract superclass for all objects that store a 2D arc defined by a framing rectangle, start angle, angular extent (length of the arc), and a closure type (OPEN, CHORD, or PIE).

The arc is a partial section of a full ellipse which inscribes the framing rectangle of its parent RectangularShape . The angles are specified relative to the non-square framing rectangle such that 45 degrees always falls on the line from the center of the ellipse to the upper right corner of the framing rectangle. As a result, if the framing rectangle is noticeably longer along one axis than the other, the angles to the start and end of the arc segment will be skewed farther along the longer axis of the frame.

The actual storage representation of the coordinates is left to the subclass.

Nested Class Summary:
public static class  Arc2D.Float  This class defines an arc specified in {@code float} precision. 
public static class  Arc2D.Double  This class defines an arc specified in {@code double} precision. 
Field Summary
public static final  int OPEN    The closure type for an open arc with no path segments connecting the two ends of the arc segment.
    since: 1.2 -
 
public static final  int CHORD    The closure type for an arc closed by drawing a straight line segment from the start of the arc segment to the end of the arc segment.
    since: 1.2 -
 
public static final  int PIE    The closure type for an arc closed by drawing straight line segments from the start of the arc segment to the center of the full ellipse and from that point to the end of the arc segment.
    since: 1.2 -
 
Constructor:
 Arc2D() 
 protected Arc2D(int type) 
Method from java.awt.geom.Arc2D Summary:
contains,   contains,   contains,   containsAngle,   equals,   getAngleExtent,   getAngleStart,   getArcType,   getBounds2D,   getEndPoint,   getPathIterator,   getStartPoint,   hashCode,   intersects,   makeBounds,   normalizeDegrees,   setAngleExtent,   setAngleStart,   setAngleStart,   setAngles,   setAngles,   setArc,   setArc,   setArc,   setArc,   setArcByCenter,   setArcByTangent,   setArcType,   setFrame
Methods from java.awt.geom.RectangularShape:
clone,   contains,   contains,   getBounds,   getCenterX,   getCenterY,   getFrame,   getHeight,   getMaxX,   getMaxY,   getMinX,   getMinY,   getPathIterator,   getWidth,   getX,   getY,   intersects,   isEmpty,   setFrame,   setFrame,   setFrame,   setFrameFromCenter,   setFrameFromCenter,   setFrameFromDiagonal,   setFrameFromDiagonal
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from java.awt.geom.Arc2D Detail:
 public boolean contains(Rectangle2D r) 
    Determines whether or not the interior of the arc entirely contains the specified rectangle.
 public boolean contains(double x,
    double y) 
    Determines whether or not the specified point is inside the boundary of the arc.
 public boolean contains(double x,
    double y,
    double w,
    double h) 
    Determines whether or not the interior of the arc entirely contains the specified rectangle.
 public boolean containsAngle(double angle) 
    Determines whether or not the specified angle is within the angular extents of the arc.
 public boolean equals(Object obj) 
    Determines whether or not the specified Object is equal to this Arc2D. The specified Object is equal to this Arc2D if it is an instance of Arc2D and if its location, size, arc extents and type are the same as this Arc2D.
 abstract public double getAngleExtent()
    Returns the angular extent of the arc.
 abstract public double getAngleStart()
    Returns the starting angle of the arc.
 public int getArcType() 
 public Rectangle2D getBounds2D() 
    Returns the high-precision framing rectangle of the arc. The framing rectangle contains only the part of this Arc2D that is in between the starting and ending angles and contains the pie wedge, if this Arc2D has a PIE closure type.

    This method differs from the getBounds in that the getBounds method only returns the bounds of the enclosing ellipse of this Arc2D without considering the starting and ending angles of this Arc2D.

 public Point2D getEndPoint() 
    Returns the ending point of the arc. This point is the intersection of the ray from the center defined by the starting angle plus the angular extent of the arc and the elliptical boundary of the arc.
 public PathIterator getPathIterator(AffineTransform at) 
    Returns an iteration object that defines the boundary of the arc. This iterator is multithread safe. Arc2D guarantees that modifications to the geometry of the arc do not affect any iterations of that geometry that are already in process.
 public Point2D getStartPoint() 
    Returns the starting point of the arc. This point is the intersection of the ray from the center defined by the starting angle and the elliptical boundary of the arc.
 public int hashCode() 
    Returns the hashcode for this Arc2D.
 public boolean intersects(double x,
    double y,
    double w,
    double h) 
    Determines whether or not the interior of the arc intersects the interior of the specified rectangle.
 abstract protected Rectangle2D makeBounds(double x,
    double y,
    double w,
    double h)
    Constructs a Rectangle2D of the appropriate precision to hold the parameters calculated to be the framing rectangle of this arc.
 static double normalizeDegrees(double angle) 
 abstract public  void setAngleExtent(double angExt)
    Sets the angular extent of this arc to the specified double value.
 abstract public  void setAngleStart(double angSt)
    Sets the starting angle of this arc to the specified double value.
 public  void setAngleStart(Point2D p) 
    Sets the starting angle of this arc to the angle that the specified point defines relative to the center of this arc. The angular extent of the arc will remain the same.
 public  void setAngles(Point2D p1,
    Point2D p2) 
    Sets the starting angle and angular extent of this arc using two points. The first point is used to determine the angle of the starting point relative to the arc's center. The second point is used to determine the angle of the end point relative to the arc's center. The arc will always be non-empty and extend counterclockwise from the first point around to the second point.
 public  void setAngles(double x1,
    double y1,
    double x2,
    double y2) 
    Sets the starting angle and angular extent of this arc using two sets of coordinates. The first set of coordinates is used to determine the angle of the starting point relative to the arc's center. The second set of coordinates is used to determine the angle of the end point relative to the arc's center. The arc will always be non-empty and extend counterclockwise from the first point around to the second point.
 public  void setArc(Arc2D a) 
    Sets this arc to be the same as the specified arc.
 public  void setArc(Rectangle2D rect,
    double angSt,
    double angExt,
    int closure) 
    Sets the location, size, angular extents, and closure type of this arc to the specified values.
 public  void setArc(Point2D loc,
    Dimension2D size,
    double angSt,
    double angExt,
    int closure) 
    Sets the location, size, angular extents, and closure type of this arc to the specified values.
 abstract public  void setArc(double x,
    double y,
    double w,
    double h,
    double angSt,
    double angExt,
    int closure)
    Sets the location, size, angular extents, and closure type of this arc to the specified double values.
 public  void setArcByCenter(double x,
    double y,
    double radius,
    double angSt,
    double angExt,
    int closure) 
    Sets the position, bounds, angular extents, and closure type of this arc to the specified values. The arc is defined by a center point and a radius rather than a framing rectangle for the full ellipse.
 public  void setArcByTangent(Point2D p1,
    Point2D p2,
    Point2D p3,
    double radius) 
    Sets the position, bounds, and angular extents of this arc to the specified value. The starting angle of the arc is tangent to the line specified by points (p1, p2), the ending angle is tangent to the line specified by points (p2, p3), and the arc has the specified radius.
 public  void setArcType(int type) 
    Sets the closure type of this arc to the specified value: OPEN, CHORD, or PIE.
 public  void setFrame(double x,
    double y,
    double w,
    double h) 
    {@inheritDoc} Note that the arc partially inscribes the framing rectangle of this {@code RectangularShape}.