⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 arc2d.java

📁 this gcc-g++-3.3.1.tar.gz is a source file of gcc, you can learn more about gcc through this codes f
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
      this.start = start;      this.extent = extent;    }          /**     * Create a new arc with the given dimensions.     *     * @param r the bounding box     * @param start the start angle, in degrees     * @param extent the extent, in degrees     * @param type the arc type: {@link #OPEN}, {@link #CHORD}, or {@link #PIE}     * @throws IllegalArgumentException if type is invalid     * @throws NullPointerException if r is null     */    public Double(Rectangle2D r, double start, double extent, int type)    {      super(type);      x = r.getX();      y = r.getY();      width = r.getWidth();      height = r.getHeight();      this.start = start;      this.extent = extent;    }    /**     * Return the x coordinate of the bounding box.     *     * @return the value of x     */    public double getX()    {      return x;    }    /**     * Return the y coordinate of the bounding box.     *     * @return the value of y     */    public double getY()    {      return y;    }    /**     * Return the width of the bounding box.     *     * @return the value of width     */    public double getWidth()    {      return width;    }    /**     * Return the height of the bounding box.     *     * @return the value of height     */    public double getHeight()    {      return height;    }    /**     * Return the start angle of the arc, in degrees.     *     * @return the value of start     */    public double getAngleStart()    {      return start;    }    /**     * Return the extent of the arc, in degrees.     *     * @return the value of extent     */    public double getAngleExtent()    {      return extent;    }    /**     * Tests if the arc contains points.     *     * @return true if the arc has no interior     */    public boolean isEmpty()    {      return width <= 0 || height <= 0;    }    /**     * Sets the arc to the given dimensions.     *     * @param x the x coordinate     * @param y the y coordinate     * @param w the width     * @param h the height     * @param start the start angle, in degrees     * @param extent the extent, in degrees     * @param type the arc type: {@link #OPEN}, {@link #CHORD}, or {@link #PIE}     * @throws IllegalArgumentException if type is invalid     */    public void setArc(double x, double y, double w, double h,                       double start, double extent, int type)    {      this.x = x;      this.y = y;      width = w;      height = h;      this.start = start;      this.extent = extent;      setArcType(type);    }    /**     * Sets the start angle of the arc.     *     * @param start the new start angle     */    public void setAngleStart(double start)    {      this.start = start;    }    /**     * Sets the extent angle of the arc.     *     * @param start the new extent angle     */    public void setAngleExtent(double extent)    {      this.extent = extent;    }    /**     * Creates a tight bounding box given dimensions that more precise than     * the bounding box of the ellipse.     *     * @param x the x coordinate     * @param y the y coordinate     * @param w the width     * @param h the height     */    protected Rectangle2D makeBounds(double x, double y, double w, double h)    {      return new Rectangle2D.Double(x, y, w, h);    }  } // class Double  /**   * This class implements an arc in float precision.   *   * @author Eric Blake <ebb9@email.byu.edu   * @since 1.2   */  public static class Float extends Arc2D  {    /** The x coordinate of the box bounding the ellipse of this arc. */    public float x;    /** The y coordinate of the box bounding the ellipse of this arc. */    public float y;    /** The width of the box bounding the ellipse of this arc. */    public float width;    /** The height of the box bounding the ellipse of this arc. */    public float height;    /** The start angle of this arc, in degrees. */    public float start;    /** The extent angle of this arc, in degrees. */    public float extent;    /**     * Create a new, open arc at (0,0) with 0 extent.     */    public Float()    {      super(OPEN);    }    /**     * Create a new arc of the given type at (0,0) with 0 extent.     *     * @param type the arc type: {@link #OPEN}, {@link #CHORD}, or {@link #PIE}     * @throws IllegalArgumentException if type is invalid     */    public Float(int type)    {      super(type);    }    /**     * Create a new arc with the given dimensions.     *     * @param x the x coordinate     * @param y the y coordinate     * @param w the width     * @param h the height     * @param start the start angle, in degrees     * @param extent the extent, in degrees     * @param type the arc type: {@link #OPEN}, {@link #CHORD}, or {@link #PIE}     * @throws IllegalArgumentException if type is invalid     */    public Float(float x, float y, float w, float h,                  float start, float extent, int type)    {      super(type);      this.x = x;      this.y = y;      width = w;      height = h;      this.start = start;      this.extent = extent;    }          /**     * Create a new arc with the given dimensions.     *     * @param r the bounding box     * @param start the start angle, in degrees     * @param extent the extent, in degrees     * @param type the arc type: {@link #OPEN}, {@link #CHORD}, or {@link #PIE}     * @throws IllegalArgumentException if type is invalid     * @throws NullPointerException if r is null     */    public Float(Rectangle2D r, float start, float extent, int type)    {      super(type);      x = (float) r.getX();      y = (float) r.getY();      width = (float) r.getWidth();      height = (float) r.getHeight();      this.start = start;      this.extent = extent;    }    /**     * Return the x coordinate of the bounding box.     *     * @return the value of x     */    public double getX()    {      return x;    }    /**     * Return the y coordinate of the bounding box.     *     * @return the value of y     */    public double getY()    {      return y;    }    /**     * Return the width of the bounding box.     *     * @return the value of width     */    public double getWidth()    {      return width;    }    /**     * Return the height of the bounding box.     *     * @return the value of height     */    public double getHeight()    {      return height;    }    /**     * Return the start angle of the arc, in degrees.     *     * @return the value of start     */    public double getAngleStart()    {      return start;    }    /**     * Return the extent of the arc, in degrees.     *     * @return the value of extent     */    public double getAngleExtent()    {      return extent;    }    /**     * Tests if the arc contains points.     *     * @return true if the arc has no interior     */    public boolean isEmpty()    {      return width <= 0 || height <= 0;    }    /**     * Sets the arc to the given dimensions.     *     * @param x the x coordinate     * @param y the y coordinate     * @param w the width     * @param h the height     * @param start the start angle, in degrees     * @param extent the extent, in degrees     * @param type the arc type: {@link #OPEN}, {@link #CHORD}, or {@link #PIE}     * @throws IllegalArgumentException if type is invalid     */    public void setArc(double x, double y, double w, double h,                       double start, double extent, int type)    {      this.x = (float) x;      this.y = (float) y;      width = (float) w;      height = (float) h;      this.start = (float) start;      this.extent = (float) extent;      setArcType(type);    }    /**     * Sets the start angle of the arc.     *     * @param start the new start angle     */    public void setAngleStart(double start)    {      this.start = (float) start;    }    /**     * Sets the extent angle of the arc.     *     * @param start the new extent angle     */    public void setAngleExtent(double extent)    {      this.extent = (float) extent;    }    /**     * Creates a tight bounding box given dimensions that more precise than     * the bounding box of the ellipse.     *     * @param x the x coordinate     * @param y the y coordinate     * @param w the width     * @param h the height     */    protected Rectangle2D makeBounds(double x, double y, double w, double h)    {      return new Rectangle2D.Float((float) x, (float) y, (float) w, (float) h);    }  } // class Float} // class Arc2D

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -