is new.
java.lang.Objectjava.awt.geom.RectangularShape
java.awt.geom.Arc2D
public abstract class Arc2D
Arc2D is the abstract superclass for all objects that store a 2D arc defined by a
framing
bounding
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 bounding rectangle defines the outer boundary of the full ellipse of which this arc is a partial section. The angles are specified relative to the non-square extents of the bounding rectangle such that 45 degrees always falls on the line from the center of the ellipse to the upper right corner of the bounding rectangle. As a result, if the bounding 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 bounds.
The actual storage representation of the coordinates is left to the subclass.
Since:
1.2
| Nested Class Summary | |
|---|---|
| static class |
Arc2D.Double
This class defines an arc specified in double precision. |
| static class |
Arc2D.Float
This class defines an arc specified in float precision. |
| Field Summary | |
|---|---|
| static 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. |
| static int |
OPEN
The closure type for an open arc with no path segments connecting the two ends of the arc segment. |
| static 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. |
| Constructor Summary | |
|---|---|
| protected |
Arc2D
(int type) This is an abstract class that cannot be instantiated directly. |
| Method Summary | |
|---|---|
| boolean |
contains
(double x, double y) Determines whether or not the specified point is inside the boundary of the arc. |
| boolean |
contains
(double x, double y, double w, double h)
Determines
|
| boolean |
contains
(
Rectangle2D
Determines
|
| boolean |
containsAngle
(double angle) Determines whether or not the specified angle is within the angular extents of the arc. |
| boolean |
equals
(
Object
obj) Determines whether or not the specified Object is equal to this Arc2D. |
| abstract double |
getAngleExtent
() Returns the angular extent of the arc. |
| abstract double |
getAngleStart
() Returns the starting angle of the arc. |
| int |
getArcType
() Returns the arc closure type of the arc: OPEN , CHORD , or PIE . |
| Rectangle2D |
getBounds2D
() Returns the high-precision
framing rectangle
|
| Point2D |
getEndPoint
() Returns the ending point of the arc. |
| PathIterator |
getPathIterator
(
AffineTransform
at) Returns an iteration object that defines the boundary of the arc. |
| Point2D |
getStartPoint
() Returns the starting point of the arc. |
| int |
hashCode
() Returns the hashcode for this Arc2D. |
| 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. |
| protected abstract 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
|
| abstract void |
setAngleExtent
(double angExt) Sets the angular extent of this arc to the specified double value. |
| 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. |
| void |
setAngles
(
Point2D
p1,
Point2D
p2) Sets the starting angle and angular extent of this arc using two points. |
| abstract void |
setAngleStart
(double angSt) Sets the starting angle of this arc to the specified double value. |
| 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. |
| void |
setArc
(
Arc2D
a) Sets this arc to be the same as the specified arc. |
| abstract 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. |
| 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. |
| 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. |
| 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. |
| void |
setArcByTangent
(
Point2D
p1,
Point2D
p2,
Point2D
p3, double radius) Sets the position, bounds, and angular extents of this arc to the specified value. |
| void |
setArcType
(int type) Sets the closure type of this arc to the specified value: OPEN, CHORD, or PIE. |
| void |
setFrame
(double x, double y, double w, double h) Sets the location and size of the
framing rectangle
Shape
rectangular
values. |
| Methods inherited from class java.awt.geom. RectangularShape |
|---|
| clone , contains , getBounds , getCenterX , getCenterY , getFrame , getHeight , getMaxX , getMaxY , getMinX , getMinY , getPathIterator , getWidth , getX , getY , intersects , isEmpty , setFrame , setFrame , setFrameFromCenter , setFrameFromCenter , setFrameFromDiagonal , setFrameFromDiagonal |
| Methods inherited from class java.lang. Object |
|---|
| finalize , getClass , notify , notifyAll , toString , wait , wait , wait |
| Field Detail |
|---|
public static final int OPEN
Since:
1.2
public static final int CHORD
Since:
1.2
public static final int PIE
Since:
1.2
| Constructor Detail |
|---|
protected Arc2D(int type)
Since:
1.2
| Method Detail |
|---|
public abstract double getAngleStart()
Since:
1.2
public abstract double getAngleExtent()
Since:
1.2
public int getArcType()
Since:
1.2
public Point2D getStartPoint()
Since:
1.2
public Point2D getEndPoint()
Since:
1.2
public abstract void setArc(double x,
double y,
double w,
double h,
double angSt,
double angExt,
int closure)
x
X coordinate
upper-left
y - The Y coordinate of the upper-left corner of the arc.
w
width
h - The overall height of the full ellipse of which this arc is a partial section.
Since:
1.2
public void setArc(Point2D loc,
Dimension2D size,
double angSt,
double angExt,
int closure)
upper-left
Since:
1.2
public void setArc(Rectangle2D rect,
double angSt,
double angExt,
int closure)
framing
Since:
1.2
public void setArc(Arc2D a)
Since:
1.2
public void setArcByCenter(double x,
double y,
double radius,
double angSt,
double angExt,
int closure)
framing rectangle
x
X coordinate
y - The Y coordinate of the center of the arc.
Since:
1.2
public void setArcByTangent(Point2D p1,
Point2D p2,
Point2D p3,
double radius)
Since:
1.2
public abstract void setAngleStart(double angSt)
Since:
1.2
public abstract void setAngleExtent(double angExt)
Since:
1.2
public void setAngleStart(Point2D p)
Since:
1.2
public void setAngles(double x1,
double y1,
double x2,
double y2)
x1
X coordinate
y1 - The Y coordinate of the arc's starting point.
x2 - The X coordinate of the arc's ending point.
y2 - The Y coordinate of the arc's ending point.
Since:
1.2
public void setAngles(Point2D p1,
Point2D p2)
Since:
1.2
public void setArcType(int type)
Since:
1.2
public void setFrame(double x,
double y,
double w,
double h)
framing rectangle
Shape
rectangular
values.
Note that the arc
partially inscribes
the framing rectangle of this RectangularShape.
x - the X coordinate of the upper-left corner of the specified rectangular shape
y - the Y coordinate of the upper-left corner of the specified rectangular shape
w - the width of the specified rectangular shape
h - the height of the specified rectangular shape
Since:
1.2
public Rectangle2D getBounds2D()
framing rectangle
framing rectangle
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.
framing rectangle.
Since:
1.2
protected abstract Rectangle2D makeBounds(double x,
double y,
double w,
double h)
framing rectangle
x - The X coordinate of the upper-left corner of the framing rectangle.
y - The Y coordinate of the upper-left corner of the framing rectangle.
w - The width of the framing rectangle.
h - The height of the framing rectangle.
framing rectangle
Since:
1.2
public boolean containsAngle(double angle)
Since:
1.2
public boolean contains(double x,
double y)
x - The X coordinate of the point to test.
y - The Y coordinate of the point to test.
Since:
1.2
public boolean intersects(double x,
double y,
double w,
double h)
x
X coordinate
upper-left
y - The Y coordinate of the rectangle's upper-left corner.
Since:
1.2
public boolean contains(double x,
double y,
double w,
double h)
Determines
x
X coordinate
upper-left
y - The Y coordinate of the rectangle's upper-left corner.
Since:
1.2
public boolean contains(Rectangle2D r)
Determines
Since:
1.2
public PathIterator getPathIterator(AffineTransform at)
Since:
1.2
public int hashCode()
public boolean equals(Object obj)