java.awt.geom

Class Arc2D

Implemented Interfaces:
Cloneable, Shape
Known Direct Subclasses:
Arc2D.Double, Arc2D.Float

public abstract class Arc2D
extends RectangularShape

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

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.

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

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)
Determine whether or not the interior of the arc entirely contains the specified rectangle.
boolean
contains(Rectangle2D r)
Determine whether or not the interior of the arc entirely contains the specified rectangle.
boolean
containsAngle(double angle)
Determines whether or not the specified angle is within the angular extents of the arc.
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 bounding box of the arc.
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.
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 bounding box of this arc.
abstract void
setAngleExtent(double angExt)
Sets the angular extent of this arc to the specified double value.
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
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
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(Arc2D a)
Sets this arc to be the same as the specified arc.
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 outer bounds of this arc to the specified values.

Methods inherited from class 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 inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

CHORD

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.
Field Value:
1
Usages and Demos :

View More Examples of Arc2D.CHORD
   1:   g.setColor(Color.blue);
   2:   g.draw(new Arc2D.Double(340,40,140,140,40,160,Arc2D.CHORD) );
   3:   g.drawString("draw(new Arc2D.Double(340,40,",320,160);
   4:         ...
   5:   g.drawString("140,140,40,160,Arc2D.CHORD)",360,180);
   6: 
   7:   g.setColor(Color.magenta);
   8:   g.draw( new Arc2D.Double(30,200,140,140,40,160,Arc2D.PIE) );

View Full Code Here
   1:             s = new Arc2D.Float(110, 210, 80, 80, 0, 180,
   2:                 Arc2D.CHORD);
   3:             shapes.add(s);
   4: 
   5:             s = new Arc2D.Float(210, 210, 80, 80, 45, 90,

View Full Code Here
   1: 
   2:     private static String types[] = {"Arc2D.OPEN","Arc2D.CHORD","Arc2D.PIE"};
   3:     private static final int CLOSE = 0;
   4:     private static final int OPEN = 1;
   5:     private static final int FORWARD = 0;

View Full Code Here
   1:         } else if (str_type.toLowerCase().equals("chord")) {
   2:             type = Arc2D.CHORD;
   3:         }
   4:     }

View Full Code Here
   1:     final Arc2D arc = new Arc2D.Double();
   2:     arc.setArcType(Arc2D.CHORD);
   3:     arc.setFrame(rec.x, rec.y, rec.width, rec.height);
   4:     arc.setAngles(start.x, start.y, end.x, end.y);

View Full Code Here

OPEN

public static final int OPEN
The closure type for an open arc with no path segments connecting the two ends of the arc segment.
Field Value:
0
Usages and Demos :

View More Examples of Arc2D.OPEN
   1:   g.setColor(Color.red);
   2:   g.draw(new Arc2D.Double(30,40,140,140,40,160,Arc2D.OPEN));
   3:   g.drawString("draw(new Arc2D.Double(30,40,",0,160);
   4:         ...
   5:   g.drawString("140,140,40,160,Arc2D.OPEN)",30,180);
   6: 
   7:   g.setColor(Color.blue);
   8:   g.draw(new Arc2D.Double(340,40,140,140,40,160,Arc2D.CHORD) );

View Full Code Here
   1:     public void setUp() {
   2:         arc = new ZArc(new Arc2D.Double(1, 2, 3, 4, 5, 5, Arc2D.OPEN));
   3:     }
   4: 
   5:     public void testDuplicate() {

View Full Code Here
   1:         Arc2D.Double arc =
   2:             new Arc2D.Double(absRect.x, absRect.y, absRect.width, absRect.height, -angle, 1, Arc2D.OPEN);
   3: 
   4:         Point2D point = arc.getStartPoint();
   5:         return new Point((int) point.getX(), (int) point.getY());

View Full Code Here
   1:             );            
   2:             Arc2D.Double arc = new Arc2D.Double(arcBounds, angle1, angle, Arc2D.OPEN);
   3: 
   4:         ...
   5:             Arc2D.Double arc2 = new Arc2D.Double(
   6:                 innerArcBounds, angle1 + angle, -angle, Arc2D.OPEN
   7:             );
   8:             GeneralPath path = new GeneralPath();
   9:             path.moveTo((float) arc.getStartPoint().getX(), (float) arc.getStartPoint().getY());

View Full Code Here
   1: 
   2:     private transient Icon minIcon = getIcon(new Arc2D.Double(-4, -4, 8, 8, 0, 360, Arc2D.OPEN),
   3:                                              null, Color.black);
   4:         ...
   5:         this.minIcon = getIcon(
   6:             new Arc2D.Double(-4, -4, 8, 8, 0, 360, Arc2D.OPEN), null, Color.black
   7:         );
   8:         ...
   9:         this.maxIcon = getIcon(
  10:             new Arc2D.Double(-4, -4, 8, 8, 0, 360, Arc2D.OPEN), null, Color.black
  11:         );

View Full Code Here

PIE

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.
Field Value:
2
Usages and Demos :

View More Examples of Arc2D.PIE
   1:   {
   2:             new Arc2D.Double( 100, 100, 60, 60, 30, 120, Arc2D.PIE );
   3: 
   4:     ((Graphics2D) g).draw( arc );
   5:   }

View Full Code Here
   1:   {
   2:       new Arc2D.Double( 100, 100, 60, 60,    30,    120, Arc2D.PIE );
   3:   
   4:     ((Graphics2D)g).draw( arc );
   5:   }

View Full Code Here
   1:   g.setColor(Color.magenta);
   2:   g.draw( new Arc2D.Double(30,200,140,140,40,160,Arc2D.PIE) );
   3:   g.drawString("draw(new Arc2D.Double(30,200,",0,370);
   4:         ...
   5:   g.drawString("140,140,40,160,Arc2D.PIE))",30,390);
   6: 
   7:         ...
   8:   g.setColor( ranColor());
   9:   g.fill(new Arc2D.Double(340,200,140,140,40,160,Arc2D.PIE) );
  10:   g.setColor( ranColor());

View Full Code Here
   1:         
   2:         s1 = new Arc2D.Double(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, Arc2D.PIE);
   3:         assertFalse(ShapeUtilities.equal(s1, s2));
   4:         ...
   5:         s2 = new Arc2D.Double(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, Arc2D.PIE);
   6:         assertTrue(ShapeUtilities.equal(s1, s2));
   7:         assertFalse(s1.equals(s2));
   8:         

View Full Code Here
   1:     ang2 = (int) (360 * yData[ii]/sum +0.6);
   2:     g.fill(new Arc2D.Double(20,20,sizeP,sizeP,ang1,ang2,Arc2D.PIE) );
   3:     ang1 = ang1 + ang2;
   4: 
   5:     if (showText == true)

View Full Code Here

Constructor Details

Arc2D

protected Arc2D(int type)
This is an abstract class that cannot be instantiated directly. Type-specific implementation subclasses are available for instantiation and provide a number of formats for storing the information necessary to satisfy the various accessor methods below.
Parameters:
type - The closure type of this arc: OPEN, CHORD, or PIE.

Method Details

contains

public boolean contains(double x,
                        double y)
Determines whether or not the specified point is inside the boundary of the arc.
Specified by:
contains in interface Shape
Parameters:
Returns:
true if the point lies within the bound of the arc, false if the point lies outside of the arc's bounds.

contains

public boolean contains(double x,
                        double y,
                        double w,
                        double h)
Determine whether or not the interior of the arc entirely contains the specified rectangle.
Specified by:
contains in interface Shape
Parameters:
w - The width of the rectangle. (Specified in double precision.)
h - The height of the rectangle. (Specified in double precision.)
Returns:
true if the arc contains the rectangle, false if the arc doesn't contain the rectangle.

contains

public boolean contains(Rectangle2D r)
Determine whether or not the interior of the arc entirely contains the specified rectangle.
Specified by:
contains in interface Shape
Overrides:
contains in interface RectangularShape
Parameters:
r - The Rectangle2D to test.
Returns:
true if the arc contains the rectangle, false if the arc doesn't contain the rectangle.

containsAngle

public boolean containsAngle(double angle)
Determines whether or not the specified angle is within the angular extents of the arc.
Parameters:
angle - The angle to test. (Specified in double precision.)
Returns:
true if the arc contains the angle, false if the arc doesn't contain the angle.

getAngleExtent

public abstract double getAngleExtent()
Returns the angular extent of the arc.
Returns:
A double value that represents the angular extent of the arc in degrees.
Usages and Demos :

View More Examples of getAngleExtent()
   1: 
   2:     protected transient Arc2D arc;
   3: 
   4:         ...
   5: 
   6:     public ZArc(Arc2D aArch) {
   7:         super();
   8:         ...
   9:         ZArc newArc = (ZArc) super.duplicateObject();
  10:         newArc.arc = (Arc2D) getArc().clone();
  11:         return newArc;
  12:         ...
  13:         dimensions.add(new Double(arc.getAngleStart()));
  14:         dimensions.add(new Double(arc.getAngleExtent()));

View Full Code Here
   1: import java.awt.Stroke;
   2: import java.awt.geom.Arc2D;
   3: import java.awt.geom.Ellipse2D;
   4:         ...
   5:             }
   6:             else if (c.equals(Arc2D.class)) {
   7:                 final double x = stream.readDouble();
   8:         ...
   9:                 final double h = stream.readDouble();
  10:                 result = new Arc2D.Double(x, y, w, h, as, ae, at);
  11:             }            
  12:         ...
  13:                 stream.writeDouble(arc.getAngleStart());
  14:                 stream.writeDouble(arc.getAngleExtent());

View Full Code Here
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.Arc2D;
   3: import java.awt.geom.PathIterator;
   4:         ...
   5:             boolean goLeft = (curr[4]!=0.);
   6:             Arc2D arc = ExtendedGeneralPath.computeArc
   7:                 (prevEndPoint.getX(), prevEndPoint.getY(),
   8:         ...
   9:                  large, goLeft, curr[5], curr[6]);
  10:             double theta = arc.getAngleStart()+arc.getAngleExtent();
  11:             theta = Math.toRadians(theta);
  12:         ...
  13:             boolean goLeft = (next[4]!=0.);
  14:             Arc2D arc = ExtendedGeneralPath.computeArc

View Full Code Here

getAngleStart

public abstract double getAngleStart()
Returns the starting angle of the arc.
Returns:
A double value that represents the starting angle of the arc in degrees.
See Also:
setAngleStart
Usages and Demos :

View More Examples of getAngleStart()
   1: 
   2:     protected transient Arc2D arc;
   3: 
   4:         ...
   5: 
   6:     public ZArc(Arc2D aArch) {
   7:         super();
   8:         ...
   9:         ZArc newArc = (ZArc) super.duplicateObject();
  10:         newArc.arc = (Arc2D) getArc().clone();
  11:         return newArc;
  12:         ...
  13:         dimensions.add(new Double(arc.getHeight()));
  14:         dimensions.add(new Double(arc.getAngleStart()));

View Full Code Here
   1: import java.awt.Stroke;
   2: import java.awt.geom.Arc2D;
   3: import java.awt.geom.Ellipse2D;
   4:         ...
   5:             }
   6:             else if (c.equals(Arc2D.class)) {
   7:                 final double x = stream.readDouble();
   8:         ...
   9:                 final double h = stream.readDouble();
  10:                 result = new Arc2D.Double(x, y, w, h, as, ae, at);
  11:             }            
  12:         ...
  13:                 stream.writeDouble(arc.getHeight());
  14:                 stream.writeDouble(arc.getAngleStart());

View Full Code Here
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.Arc2D;
   3: import java.awt.geom.PathIterator;
   4:         ...
   5:             boolean goLeft = (curr[4]!=0.);
   6:             Arc2D arc = ExtendedGeneralPath.computeArc
   7:                 (prevEndPoint.getX(), prevEndPoint.getY(),
   8:         ...
   9:                  large, goLeft, curr[5], curr[6]);
  10:             double theta = arc.getAngleStart()+arc.getAngleExtent();
  11:             theta = Math.toRadians(theta);
  12:         ...
  13:             boolean goLeft = (next[4]!=0.);
  14:             Arc2D arc = ExtendedGeneralPath.computeArc

View Full Code Here

getArcType

public int getArcType()
Returns the arc closure type of the arc: OPEN, CHORD, or PIE.
Returns:
One of the integer constant closure types defined in this class.
Usages and Demos :

View More Examples of getArcType()
   1: 
   2: import java.awt.geom.Arc2D;
   3: import java.awt.geom.Line2D;
   4:         ...
   5: 
   6:     public Element toSVG(Arc2D arc) {
   7:         if ((arc.getWidth() == 0) ||  (arc.getHeight() == 0)) {
   8:         ...
   9:         double  ext     = arc.getAngleExtent();
  10:         int     type    = arc.getArcType();
  11: 
  12:         ...
  13: 
  14:         if (type == Arc2D.CHORD) {

View Full Code Here
   1: 
   2:     protected transient Arc2D arc;
   3: 
   4:         ...
   5: 
   6:     public ZArc(Arc2D aArch) {
   7:         super();
   8:         ...
   9:         ZArc newArc = (ZArc) super.duplicateObject();
  10:         newArc.arc = (Arc2D) getArc().clone();
  11:         return newArc;
  12:         ...
  13:         dimensions.add(new Double(arc.getAngleExtent()));
  14:         dimensions.add(new Integer(arc.getArcType()));

View Full Code Here
   1: import java.awt.Stroke;
   2: import java.awt.geom.Arc2D;
   3: import java.awt.geom.Ellipse2D;
   4:         ...
   5:             }
   6:             else if (c.equals(Arc2D.class)) {
   7:                 final double x = stream.readDouble();
   8:         ...
   9:                 final double h = stream.readDouble();
  10:                 result = new Arc2D.Double(x, y, w, h, as, ae, at);
  11:             }            
  12:         ...
  13:                 stream.writeDouble(arc.getAngleExtent());
  14:                 stream.writeInt(arc.getArcType());

View Full Code Here

getBounds2D

public Rectangle2D getBounds2D()
Returns the high-precision bounding box of the arc. The bounding box 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.

Specified by:
getBounds2D in interface Shape
Returns:
the Rectangle2D that represents the arc's bounding box.

getEndPoint

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.
Returns:
A Point2D object representing the x,y coordinates of the ending point of the arc.
Usages and Demos :

View More Examples of getEndPoint()
   1: import java.awt.font.LineMetrics;
   2: import java.awt.geom.Arc2D;
   3: import java.awt.geom.Ellipse2D;
   4:         ...
   5:     {
   6:         Arc2D arc1 = new Arc2D.Double(plotArea, startAngle, 0, Arc2D.OPEN);
   7:         ...
   8:         Point2D point1 = arc1.getEndPoint();

View Full Code Here
   1: import java.awt.Stroke;
   2: import java.awt.geom.Arc2D;
   3: import java.awt.geom.Line2D;
   4:         ...
   5:                     state.getExplodedPieArea(), angle1, angle, ep);
   6:             Arc2D.Double arc = new Arc2D.Double(arcBounds, angle1, angle, 
   7:                     Arc2D.PIE);
   8:         ...
   9:                     Arc2D.OPEN);
  10:             Point2D point1 = arc1.getEndPoint();
  11:             Arc2D.Double arc2 = new Arc2D.Double(exploded, angle, extent / 2, 
  12:         ...
  13:                     Arc2D.OPEN);
  14:             Point2D point2 = arc2.getEndPoint();

View Full Code Here

getPathIterator

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.
Specified by:
getPathIterator in interface Shape
Parameters:
at - an optional AffineTransform to be applied to the coordinates as they are returned in the iteration, or null if the untransformed coordinates are desired.
Returns:
A PathIterator that defines the arc's boundary.
Usages and Demos :

View More Examples of getPathIterator(AffineTransform at)
   1:     {
   2:         Arc2D a = new Arc2D.Float(0, 0, 100, 100, 0, -300, Arc2D.OPEN);
   3:         float[] ff = new float[6];
   4:         ...
   5:         int i = 0;
   6:         for (PathIterator pi = a.getPathIterator(null); !pi.isDone(); )
   7:         {
   8:             int type = pi.currentSegment(ff);
   9:             int n = 0;

View Full Code Here

getStartPoint

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.
Returns:
A Point2D object representing the x,y coordinates of the starting point of the arc.
Usages and Demos :

View More Examples of getStartPoint()
   1: 
   2: import java.awt.geom.Arc2D;
   3: import java.awt.geom.Line2D;
   4:         ...
   5: 
   6:     public Element toSVG(Arc2D arc) {
   7:         if ((arc.getWidth() == 0) ||  (arc.getHeight() == 0)) {
   8:         ...
   9: 
  10:         Point2D startPt = arc.getStartPoint();
  11:         Point2D endPt   = arc.getEndPoint();
  12:         ...
  13: 
  14:         if (type == Arc2D.CHORD) {

View Full Code Here

intersects

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.
Specified by:
intersects in interface Shape
Parameters:
w - The width of the rectangle. (Specified in double precision.)
h - The height of the rectangle. (Specified in double precision.)
Returns:
true if the arc intersects the rectangle, false if the arc doesn't intersect the rectangle.

makeBounds

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 bounding box of this arc.
Parameters:
w - The width of the bounding box. (Specified in double precision.)
h - The height of the bounding box. (Specified in double precision.)
Returns:
a Rectangle2D that is the bounding box of this arc.

setAngleExtent

public abstract void setAngleExtent(double angExt)
Sets the angular extent of this arc to the specified double value.
Parameters:
angExt - The angular extent of the arc in degrees.
Usages and Demos :

View More Examples of setAngleExtent(double angExt)
   1: import java.awt.Graphics2D;
   2: import java.awt.geom.Arc2D;
   3: import java.awt.geom.Area;
   4:         ...
   5: 
   6:         Arc2D shape = new Arc2D.Double(Arc2D.PIE);
   7:         double radius = plotArea.getHeight();
   8:         ...
   9:         shape.setAngleStart(270 - radius);
  10:         shape.setAngleExtent(2 * radius);

View Full Code Here
   1:          case ARC :
   2:              Arc2D a=new Arc2D.Double();
   3:              a.setAngleStart(param1);
   4:         ...
   5:              a.setAngleExtent(param2);
   6:              a.setFrame(_ox+_x,_oy+_y-_h,_w,_h);
   7:              _shape=a;
   8:             break;

View Full Code Here
   1: import java.awt.geom.Ellipse2D;
   2: import java.awt.geom.Arc2D;
   3: import java.awt.geom.AffineTransform;
   4:         ...
   5: 
   6:     private static String types[] = {"Arc2D.OPEN","Arc2D.CHORD","Arc2D.PIE"};
   7:     private static final int CLOSE = 0;
   8:         ...
   9:         for (int i = 0; i < types.length; i++) {
  10:             Arc2D arc = new Arc2D.Float(i);
  11:             arc.setFrame((i+1)*w*.2, (i+1)*h*.2, w*.17, h*.17);
  12:         ...
  13:             arc.setAngleStart(45);
  14:             arc.setAngleExtent(270);

View Full Code Here

setAngleStart

public abstract void setAngleStart(double angSt)
Sets the starting angle of this arc to the specified double value.
Parameters:
angSt - The starting angle of the arc in degrees.
Usages and Demos :

View More Examples of setAngleStart(double angSt)
   1: import java.awt.Graphics2D;
   2: import java.awt.geom.Arc2D;
   3: import java.awt.geom.Area;
   4:         ...
   5: 
   6:         Arc2D shape = new Arc2D.Double(Arc2D.PIE);
   7:         double radius = plotArea.getHeight();
   8:         ...
   9:         radius = Math.toDegrees(Math.asin(halfX / radius));
  10:         shape.setAngleStart(270 - radius);
  11:         shape.setAngleExtent(2 * radius);

View Full Code Here
   1:          case ARC :
   2:              Arc2D a=new Arc2D.Double();
   3:         ...
   4:              a.setAngleStart(param1);
   5:              a.setAngleExtent(param2);
   6:              a.setFrame(_ox+_x,_oy+_y-_h,_w,_h);
   7:              _shape=a;

View Full Code Here
   1: import java.awt.geom.Ellipse2D;
   2: import java.awt.geom.Arc2D;
   3: import java.awt.geom.AffineTransform;
   4:         ...
   5: 
   6:     private static String types[] = {"Arc2D.OPEN","Arc2D.CHORD","Arc2D.PIE"};
   7:     private static final int CLOSE = 0;
   8:         ...
   9:         for (int i = 0; i < types.length; i++) {
  10:             Arc2D arc = new Arc2D.Float(i);
  11:             arc.setFrame((i+1)*w*.2, (i+1)*h*.2, w*.17, h*.17);
  12:         ...
  13:             arc.setAngleStart(45);

View Full Code Here

setAngleStart

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.
Parameters:
p - The Point2D that defines the starting angle.
Usages and Demos :

View More Examples of setAngleStart(Point2D p)
   1: import java.awt.Graphics2D;
   2: import java.awt.geom.Arc2D;
   3: import java.awt.geom.Area;
   4:         ...
   5: 
   6:         Arc2D shape = new Arc2D.Double(Arc2D.PIE);
   7:         double radius = plotArea.getHeight();
   8:         ...
   9:         radius = Math.toDegrees(Math.asin(halfX / radius));
  10:         shape.setAngleStart(270 - radius);
  11:         shape.setAngleExtent(2 * radius);

View Full Code Here
   1:          case ARC :
   2:              Arc2D a=new Arc2D.Double();
   3:         ...
   4:              a.setAngleStart(param1);
   5:              a.setAngleExtent(param2);
   6:              a.setFrame(_ox+_x,_oy+_y-_h,_w,_h);
   7:              _shape=a;

View Full Code Here
   1: import java.awt.geom.Ellipse2D;
   2: import java.awt.geom.Arc2D;
   3: import java.awt.geom.AffineTransform;
   4:         ...
   5: 
   6:     private static String types[] = {"Arc2D.OPEN","Arc2D.CHORD","Arc2D.PIE"};
   7:     private static final int CLOSE = 0;
   8:         ...
   9:         for (int i = 0; i < types.length; i++) {
  10:             Arc2D arc = new Arc2D.Float(i);
  11:             arc.setFrame((i+1)*w*.2, (i+1)*h*.2, w*.17, h*.17);
  12:         ...
  13:             arc.setAngleStart(45);

View Full Code Here

setAngles

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.
Parameters:
Usages and Demos :

View More Examples of setAngles(double x1,double y1,double x2,double y2)
   1: import java.awt.Rectangle;
   2: import java.awt.geom.Arc2D;
   3: 
   4:         ...
   5: 
   6:     final Arc2D arc = new Arc2D.Double();
   7:     arc.setArcType(Arc2D.PIE);
   8:         ...
   9:     arc.setFrame(rec.x, rec.y, rec.width, rec.height);
  10:     arc.setAngles(start.x, start.y, end.x, end.y);

View Full Code Here
   1: import java.awt.Rectangle;
   2: import java.awt.geom.Arc2D;
   3: 
   4:         ...
   5: 
   6:     final Arc2D arc = new Arc2D.Double();
   7:     arc.setArcType(Arc2D.CHORD);
   8:         ...
   9:     arc.setFrame(rec.x, rec.y, rec.width, rec.height);
  10:     arc.setAngles(start.x, start.y, end.x, end.y);

View Full Code Here
   1: import java.awt.Rectangle;
   2: import java.awt.geom.Arc2D;
   3: 
   4:         ...
   5: 
   6:     final Arc2D arc = new Arc2D.Double();
   7:     arc.setArcType(Arc2D.OPEN);
   8:         ...
   9:     arc.setFrame(rec.x, rec.y, rec.width, rec.height);
  10:     arc.setAngles(start.x, start.y, end.x, end.y);

View Full Code Here

setAngles

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.
Parameters:
p1 - The Point2D that defines the arc's starting point.
p2 - The Point2D that defines the arc's ending point.

setArc

public 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.
Parameters:
w - The overall width of the full ellipse of which this arc is a partial section.
h - The overall height of the full ellipse of which this arc is a partial section.
angSt - The starting angle of the arc in degrees.
angExt - The angular extent of the arc in degrees.
closure - The closure type for the arc: OPEN, CHORD, or PIE.

setArc

public void setArc(Arc2D a)
Sets this arc to be the same as the specified arc.
Parameters:
a - The Arc2D to use to set the arc's values.

setArc

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.
Parameters:
loc - The Point2D representing the coordinates of the upper left corner of the arc.
size - The Dimension2D representing the width and height of the full ellipse of which this arc is a partial section.
angSt - The starting angle of the arc in degrees. (Specified in double precision.)
angExt - The angular extent of the arc in degrees. (Specified in double precision.)
closure - The closure type for the arc: OPEN, CHORD, or PIE.

setArc

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.
Parameters:
rect - The bounding rectangle that defines the outer boundary of the full ellipse of which this arc is a partial section.
angSt - The starting angle of the arc in degrees. (Specified in double precision.)
angExt - The angular extent of the arc in degrees. (Specified in double precision.)
closure - The closure type for the arc: OPEN, CHORD, or PIE.

setArcByCenter

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 bounding box for the full ellipse.
Parameters:
radius - The radius of the arc. (Specified in double precision.)
angSt - The starting angle of the arc in degrees. (Specified in double precision.)
angExt - The angular extent of the arc in degrees. (Specified in double precision.)
closure - The closure type for the arc: OPEN, CHORD, or PIE.

setArcByTangent

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.
Parameters:
p1 - The first point that defines the arc. The starting angle of the arc is tangent to the line specified by points (p1, p2).
p2 - The second point that defines the arc. The starting angle of the arc is tangent to the line specified by points (p1, p2). The ending angle of the arc is tangent to the line specified by points (p2, p3).
p3 - The third point that defines the arc. The ending angle of the arc is tangent to the line specified by points (p2, p3).
radius - The radius of the arc. (Specified in double precision.)

setArcType

public void setArcType(int type)
Sets the closure type of this arc to the specified value: OPEN, CHORD, or PIE.
Parameters:
type - The integer constant that represents the closure type of this arc: OPEN, CHORD, or PIE.
Throws:
IllegalArgumentException - if type is not 0, 1, or 2.+
See Also:
getArcType()
Usages and Demos :

View More Examples of setArcType(int type)
   1: import java.awt.Rectangle;
   2: import java.awt.geom.Arc2D;
   3: 
   4:         ...
   5: 
   6:     final Arc2D arc = new Arc2D.Double();
   7:         ...
   8:     arc.setArcType(Arc2D.PIE);
   9:     arc.setFrame(rec.x, rec.y, rec.width, rec.height);

View Full Code Here
   1: import java.awt.Rectangle;
   2: import java.awt.geom.Arc2D;
   3: 
   4:         ...
   5: 
   6:     final Arc2D arc = new Arc2D.Double();
   7:         ...
   8:     arc.setArcType(Arc2D.CHORD);
   9:     arc.setFrame(rec.x, rec.y, rec.width, rec.height);

View Full Code Here
   1: import java.awt.Rectangle;
   2: import java.awt.geom.Arc2D;
   3: 
   4:         ...
   5: 
   6:     final Arc2D arc = new Arc2D.Double();
   7:         ...
   8:     arc.setArcType(Arc2D.OPEN);
   9:     arc.setFrame(rec.x, rec.y, rec.width, rec.height);

View Full Code Here
   1:         G.setStroke(Normal);
   2:         G.draw(new Arc2D.Double(x,y,w,h,a,b,Arc2D.OPEN));
   3:     }
   4:         ...
   5:         else
   6:             G.draw(new Arc2D.Double(x,y,w,h,a,b,Arc2D.OPEN));
   7:     }
   8:         ...
   9:         G.setStroke(SuperThick);
  10:         G.draw(new Arc2D.Double(x-r,y-r,2*r,2*r,a,b,Arc2D.OPEN));
  11:     }
  12:         ...
  13:         {    setColor(o);
  14:             arc.setArcType(Arc2D.OPEN);

View Full Code Here

setFrame

public void setFrame(double x,
                     double y,
                     double w,
                     double h)
Sets the location and size of the outer bounds of this arc to the specified values.
Overrides:
setFrame in interface RectangularShape
Parameters:
w - The width of the arc's bounding box. (Specified in double precision.)
h - The height of the arc's bounding box. (Specified in double precision.)
Usages and Demos :

View More Examples of setFrame(double x,double y,double w,double h)
   1:          case ARC :
   2:              Arc2D a=new Arc2D.Double();
   3:              a.setAngleStart(param1);
   4:         ...
   5:              a.setAngleExtent(param2);
   6:              a.setFrame(_ox+_x,_oy+_y-_h,_w,_h);
   7:              _shape=a;
   8:         ...
   9:         }
  10:         _shape.setFrame(_ox+_x,_oy+_y-_h,_w,_h);
  11:     }
  12:         ...
  13:         super.translate(dx,dy);
  14:         _shape.setFrame(_ox+_x,_oy+_y-_h,_w,_h);

View Full Code Here
   1: import java.awt.Rectangle;
   2: import java.awt.geom.Arc2D;
   3: 
   4:         ...
   5: 
   6:     final Arc2D arc = new Arc2D.Double();
   7:     arc.setArcType(Arc2D.PIE);
   8:         ...
   9:     arc.setFrame(rec.x, rec.y, rec.width, rec.height);
  10:     arc.setAngles(start.x, start.y, end.x, end.y);

View Full Code Here
   1: import java.awt.Rectangle;
   2: import java.awt.geom.Arc2D;
   3: 
   4:         ...
   5: 
   6:     final Arc2D arc = new Arc2D.Double();
   7:     arc.setArcType(Arc2D.CHORD);
   8:         ...
   9:     arc.setFrame(rec.x, rec.y, rec.width, rec.height);
  10:     arc.setAngles(start.x, start.y, end.x, end.y);

View Full Code Here
   1: import java.awt.Rectangle;
   2: import java.awt.geom.Arc2D;
   3: 
   4:         ...
   5: 
   6:     final Arc2D arc = new Arc2D.Double();
   7:     arc.setArcType(Arc2D.OPEN);
   8:         ...
   9:     arc.setFrame(rec.x, rec.y, rec.width, rec.height);
  10:     arc.setAngles(start.x, start.y, end.x, end.y);

View Full Code Here