Package java.awt.geom

Examples of java.awt.geom.Arc2D


   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)      
  {
    // Arc2D does NOT override equals() 
    Arc2D arc1 = new Arc2D.Double();
    Arc2D arc2 = new Arc2D.Double();
    harness.check(!arc1.equals(arc2));
    harness.check(!arc1.equals(null));
  }
View Full Code Here


   *
   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)      
  {
    Arc2D arc1 = new Arc2D.Double();
    arc1.setArcByCenter(1.0, 2.0, 3.0, 4.0, 5.0, Arc2D.PIE);
    harness.check(arc1.getX(), -2.0);
    harness.check(arc1.getY(), -1.0);
    harness.check(arc1.getWidth(), 6.0);
    harness.check(arc1.getHeight(), 6.0);
    harness.check(arc1.getAngleStart(), 4.0);
    harness.check(arc1.getAngleExtent(), 5.0);
    harness.check(arc1.getArcType() == Arc2D.PIE);
 
    // check for illegal closure type
    boolean pass = false;
    try
    {
      arc1.setArcByCenter(1.0, 2.0, 3.0, 4.0, 5.0, 99);
    }
    catch (IllegalArgumentException e)
    {
      pass = true;
    }
View Full Code Here

   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)     
  {
    // constructor 1
    Arc2D arc = new Arc2D.Double();
    harness.check(arc.getArcType() == Arc2D.OPEN);
    harness.check(arc.getX(), 0.0);
    harness.check(arc.getY(), 0.0);
    harness.check(arc.getWidth(), 0.0);
    harness.check(arc.getHeight(), 0.0);
    harness.check(arc.getAngleStart(), 0.0);
    harness.check(arc.getAngleExtent(), 0.0);
   
    // constructor 2
    arc = new Arc2D.Double(Arc2D.PIE);
    harness.check(arc.getArcType() == Arc2D.PIE);
    harness.check(arc.getX(), 0.0);
    harness.check(arc.getY(), 0.0);
    harness.check(arc.getWidth(), 0.0);
    harness.check(arc.getHeight(), 0.0);
    harness.check(arc.getAngleStart(), 0.0);
    harness.check(arc.getAngleExtent(), 0.0);
   
    // constructor 3
    arc = new Arc2D.Double(1.0, 2.0, 3.0, 4.0, 45, 90.0, Arc2D.CHORD);
    harness.check(arc.getArcType() == Arc2D.CHORD);
    harness.check(arc.getX(), 1.0);
    harness.check(arc.getY(), 2.0);
    harness.check(arc.getWidth(), 3.0);
    harness.check(arc.getHeight(), 4.0);
    harness.check(arc.getAngleStart(), 45.0);
    harness.check(arc.getAngleExtent(), 90.0);
   
    boolean pass = false;
    try
    {
      arc = new Arc2D.Double(1.0, 2.0, 3.0, 4.0, 45, 90.0, 99);
    }
    catch (IllegalArgumentException e)
    {
      pass = true;
    }
    harness.check(pass);
   
    // constructor 4
    arc = new Arc2D.Double(new Rectangle2D.Double(10.0, 11.0, 12.0, 13.0),
            110.0, 35.0, Arc2D.OPEN);
    harness.check(arc.getArcType() == Arc2D.OPEN);
    harness.check(arc.getX(), 10.0);
    harness.check(arc.getY(), 11.0);
    harness.check(arc.getWidth(), 12.0);
    harness.check(arc.getHeight(), 13.0);
    harness.check(arc.getAngleStart(), 110.0);
    harness.check(arc.getAngleExtent(), 35.0);

    pass = false;
    try
    {
      arc = new Arc2D.Double(null, 110.0, 35.0, Arc2D.OPEN);       
View Full Code Here

    /**
     * @see Graphics#drawArc(int, int, int, int, int, int)
     */
    @Override
    public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) {
        Arc2D arc = new Arc2D.Double(x,y,width,height,startAngle, arcAngle, Arc2D.OPEN);
        draw(arc);

    }
View Full Code Here

    /**
     * @see Graphics#fillArc(int, int, int, int, int, int)
     */
    @Override
    public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle) {
        Arc2D arc = new Arc2D.Double(x,y,width,height,startAngle, arcAngle, Arc2D.PIE);
        fill(arc);
    }
View Full Code Here

     * @param angle  the angle.
     */
    protected void drawNeedle(Graphics2D g2, Rectangle2D plotArea,
                              Point2D rotate, double angle) {

        Arc2D shape = new Arc2D.Double(Arc2D.PIE);
        double radius = plotArea.getHeight();
        double halfX = plotArea.getWidth() / 2;
        double diameter = 2 * radius;

        shape.setFrame(plotArea.getMinX() + halfX - radius ,
                       plotArea.getMinY() - radius,
                       diameter, diameter);
        radius = Math.toDegrees(Math.asin(halfX / radius));
        shape.setAngleStart(270 - radius);
        shape.setAngleExtent(2 * radius);

        Area s = new Area(shape);

        if ((rotate != null) && (angle != 0)) {
            /// we have rotation houston, please spin me
View Full Code Here

        g2.setColor(Color.black);
        g2.draw(waferEdge);
        // calculate and draw the notch
        // horizontal orientation is considered notch right
        // vertical orientation is considered notch down
        Arc2D notch = null;
        Rectangle2D waferFrame = waferEdge.getFrame();
        double notchDiameter = waferFrame.getWidth() * 0.04;
        if (this.orientation == PlotOrientation.HORIZONTAL) {
            Rectangle2D notchFrame =
                new Rectangle2D.Double(
View Full Code Here

    /**
     * @see Graphics#drawArc(int, int, int, int, int, int)
     */
    @Override
    public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) {
        Arc2D arc = new Arc2D.Double(x,y,width,height,startAngle, arcAngle, Arc2D.OPEN);
        draw(arc);

    }
View Full Code Here

    /**
     * @see Graphics#fillArc(int, int, int, int, int, int)
     */
    @Override
    public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle) {
        Arc2D arc = new Arc2D.Double(x,y,width,height,startAngle, arcAngle, Arc2D.PIE);
        fill(arc);
    }
View Full Code Here

            ((v1.getHeight() - v0.getHeight()) * fraction);
        double start = v0.getAngleStart() +
            ((v1.getAngleStart() - v0.getAngleStart()) * fraction);
        double extent = v0.getAngleExtent() +
            ((v1.getAngleExtent() - v0.getAngleExtent()) * fraction);
        Arc2D value = (Arc2D)v0.clone();
        value.setArc(x, y, w, h, start, extent, v0.getArcType());
        return value;
    }
View Full Code Here

TOP

Related Classes of java.awt.geom.Arc2D

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.