java.awt.geom
Class Arc2D.Float

java.lang.Object
  extended by java.awt.geom.RectangularShape
      extended by java.awt.geom.Arc2D
          extended by java.awt.geom.Arc2D.Float
All Implemented Interfaces:
Shape, Cloneable
Enclosing class:
Arc2D

public static class Arc2D.Float
extends Arc2D

This class implements an arc in float precision.

Since:
1.2

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.geom.Arc2D
Arc2D.Double, Arc2D.Float
 
Field Summary
 float extent
          The extent angle of this arc, in degrees.
 float height
          The height of the box bounding the ellipse of this arc.
 float start
          The start angle of this arc, in degrees.
 float width
          The width of the box bounding the ellipse of this arc.
 float x
          The x coordinate of the box bounding the ellipse of this arc.
 float y
          The y coordinate of the box bounding the ellipse of this arc.
 
Fields inherited from class java.awt.geom.Arc2D
CHORD, OPEN, PIE
 
Constructor Summary
Arc2D.Float()
          Create a new, open arc at (0,0) with 0 extent.
Arc2D.Float(float x, float y, float w, float h, float start, float extent, int type)
          Create a new arc with the given dimensions.
Arc2D.Float(int type)
          Create a new arc of the given type at (0,0) with 0 extent.
Arc2D.Float(Rectangle2D r, float start, float extent, int type)
          Create a new arc with the given dimensions.
 
Method Summary
 double getAngleExtent()
          Return the extent of the arc, in degrees.
 double getAngleStart()
          Return the start angle of the arc, in degrees.
 double getHeight()
          Return the height of the bounding box.
 double getWidth()
          Return the width of the bounding box.
 double getX()
          Return the x coordinate of the bounding box.
 double getY()
          Return the y coordinate of the bounding box.
 boolean isEmpty()
          Tests if the arc contains points.
protected  Rectangle2D makeBounds(double x, double y, double w, double h)
          Creates a tight bounding box given dimensions that more precise than the bounding box of the ellipse.
 void setAngleExtent(double extent)
          Sets the extent angle of the arc.
 void setAngleStart(double start)
          Sets the start angle of the arc.
 void setArc(double x, double y, double w, double h, double start, double extent, int type)
          Sets the arc to the given dimensions.
 
Methods inherited from class java.awt.geom.Arc2D
contains, contains, contains, containsAngle, getArcType, getBounds2D, getEndPoint, getPathIterator, getStartPoint, intersects, setAngles, setAngles, setAngleStart, setArc, setArc, setArc, setArcByCenter, setArcByTangent, setArcType, setFrame
 
Methods inherited from class java.awt.geom.RectangularShape
clone, contains, getBounds, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, getPathIterator, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

x

public float x
The x coordinate of the box bounding the ellipse of this arc.


y

public float y
The y coordinate of the box bounding the ellipse of this arc.


width

public float width
The width of the box bounding the ellipse of this arc.


height

public float height
The height of the box bounding the ellipse of this arc.


start

public float start
The start angle of this arc, in degrees.


extent

public float extent
The extent angle of this arc, in degrees.

Constructor Detail

Arc2D.Float

public Arc2D.Float()
Create a new, open arc at (0,0) with 0 extent.


Arc2D.Float

public Arc2D.Float(int type)
Create a new arc of the given type at (0,0) with 0 extent.

Parameters:
type - the arc type: Arc2D.OPEN, Arc2D.CHORD, or Arc2D.PIE
Throws:
IllegalArgumentException - if type is invalid

Arc2D.Float

public Arc2D.Float(float x,
                   float y,
                   float w,
                   float h,
                   float start,
                   float extent,
                   int type)
Create a new arc with the given dimensions.

Parameters:
x - the x coordinate
y - the y coordinate
w - the width
h - the height
start - the start angle, in degrees
extent - the extent, in degrees
type - the arc type: Arc2D.OPEN, Arc2D.CHORD, or Arc2D.PIE
Throws:
IllegalArgumentException - if type is invalid

Arc2D.Float

public Arc2D.Float(Rectangle2D r,
                   float start,
                   float extent,
                   int type)
Create a new arc with the given dimensions.

Parameters:
r - the bounding box
start - the start angle, in degrees
extent - the extent, in degrees
type - the arc type: Arc2D.OPEN, Arc2D.CHORD, or Arc2D.PIE
Throws:
IllegalArgumentException - if type is invalid
NullPointerException - if r is null
Method Detail

getX

public double getX()
Return the x coordinate of the bounding box.

Specified by:
getX in class RectangularShape
Returns:
the value of x

getY

public double getY()
Return the y coordinate of the bounding box.

Specified by:
getY in class RectangularShape
Returns:
the value of y

getWidth

public double getWidth()
Return the width of the bounding box.

Specified by:
getWidth in class RectangularShape
Returns:
the value of width

getHeight

public double getHeight()
Return the height of the bounding box.

Specified by:
getHeight in class RectangularShape
Returns:
the value of height

getAngleStart

public double getAngleStart()
Return the start angle of the arc, in degrees.

Specified by:
getAngleStart in class Arc2D
Returns:
the value of start
See Also:
Arc2D.setAngleStart(double)

getAngleExtent

public double getAngleExtent()
Return the extent of the arc, in degrees.

Specified by:
getAngleExtent in class Arc2D
Returns:
the value of extent
See Also:
Arc2D.setAngleExtent(double)

isEmpty

public boolean isEmpty()
Tests if the arc contains points.

Specified by:
isEmpty in class RectangularShape
Returns:
true if the arc has no interior

setArc

public void setArc(double x,
                   double y,
                   double w,
                   double h,
                   double start,
                   double extent,
                   int type)
Sets the arc to the given dimensions.

Specified by:
setArc in class Arc2D
Parameters:
x - the x coordinate
y - the y coordinate
w - the width
h - the height
start - the start angle, in degrees
extent - the extent, in degrees
type - the arc type: Arc2D.OPEN, Arc2D.CHORD, or Arc2D.PIE
Throws:
IllegalArgumentException - if type is invalid

setAngleStart

public void setAngleStart(double start)
Sets the start angle of the arc.

Specified by:
setAngleStart in class Arc2D
Parameters:
start - the new start angle
See Also:
Arc2D.getAngleStart()

setAngleExtent

public void setAngleExtent(double extent)
Sets the extent angle of the arc.

Specified by:
setAngleExtent in class Arc2D
Parameters:
extent - the new extent angle
See Also:
Arc2D.getAngleExtent()

makeBounds

protected Rectangle2D makeBounds(double x,
                                 double y,
                                 double w,
                                 double h)
Creates a tight bounding box given dimensions that more precise than the bounding box of the ellipse.

Specified by:
makeBounds in class Arc2D
Parameters:
x - the x coordinate
y - the y coordinate
w - the width
h - the height
Returns:
the rectangle for use in getBounds2D