public abstract class Arc2D extends RectangularShape
Arc2D是用于存储由边界矩形限定的2D弧的所有对象的抽象超,起始角度,角跨越(弧的长度),和闭合类型( OPEN , CHORD ,或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.
坐标的实际存储表示留给子类。
| Modifier and Type | Class and Description |
|---|---|
static class |
Arc2D.Double
此类定义了一个指定在
double精度的弧。
|
static class |
Arc2D.Float
此类定义了一个指定在
float精度的弧。
|
| Modifier and Type | Field and Description |
|---|---|
static int |
CHORD
通过从弧段开始绘制直线段到弧段的末端,关闭电弧的闭合类型。
|
static int |
OPEN
用于开弧的闭合类型,没有连接弧段两端的路段。
|
static int |
PIE
通过将直线段从弧段开始到完全椭圆的中心并从该点到弧段的末端将闭合类型关闭。
|
| Modifier | Constructor and Description |
|---|---|
protected |
Arc2D()
这是一个无法直接实例化的抽象类。
|
protected |
Arc2D(int type)
这是一个无法直接实例化的抽象类。
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(double x, double y)
确定指定点是否在弧的边界内。
|
boolean |
contains(double x, double y, double w, double h)
确定圆弧的内部是否完全包含指定的矩形。
|
boolean |
contains(Rectangle2D r)
确定圆弧的内部是否完全包含指定的矩形。
|
boolean |
containsAngle(double angle)
确定指定角度是否在弧的角度范围内。
|
boolean |
equals(Object obj)
确定指定的
Object是否等于此
Arc2D 。
|
abstract double |
getAngleExtent()
返回弧的角度范围。
|
abstract double |
getAngleStart()
返回弧的起始角度。
|
int |
getArcType()
|
Rectangle2D |
getBounds2D()
返回圆弧的高精度框架矩形。
|
Point2D |
getEndPoint()
返回圆弧的终点。
|
PathIterator |
getPathIterator(AffineTransform at)
返回定义圆弧边界的迭代对象。
|
Point2D |
getStartPoint()
返回圆弧的起始点。
|
int |
hashCode()
返回此
Arc2D的哈希码。
|
boolean |
intersects(double x, double y, double w, double h)
确定圆弧的内部是否与指定矩形的内部相交。
|
protected abstract Rectangle2D |
makeBounds(double x, double y, double w, double h)
构造一个
Rectangle2D精度的Rectangle2D,以将计算的参数保存为该弧的框架矩形。
|
abstract void |
setAngleExtent(double angExt)
将此弧的角度范围设置为指定的双精度值。
|
void |
setAngles(double x1, double y1, double x2, double y2)
使用两组坐标设置该弧的起始角度和角度范围。
|
void |
setAngles(Point2D p1, Point2D p2)
使用两点设置此弧的起始角度和角度范围。
|
abstract void |
setAngleStart(double angSt)
将此弧的起始角度设置为指定的双精度值。
|
void |
setAngleStart(Point2D p)
将该弧的起始角度设置为指定点相对于该弧的中心定义的角度。
|
void |
setArc(Arc2D a)
将此弧设置为与指定弧相同。
|
abstract void |
setArc(double x, double y, double w, double h, double angSt, double angExt, int closure)
将此弧的位置,大小,角度范围和闭合类型设置为指定的双精度值。
|
void |
setArc(Point2D loc, Dimension2D size, double angSt, double angExt, int closure)
将该弧的位置,大小,角度范围和闭合类型设置为指定的值。
|
void |
setArc(Rectangle2D rect, double angSt, double angExt, int closure)
将该弧的位置,大小,角度范围和闭合类型设置为指定的值。
|
void |
setArcByCenter(double x, double y, double radius, double angSt, double angExt, int closure)
将此弧的位置,边界,角度范围和闭合类型设置为指定的值。
|
void |
setArcByTangent(Point2D p1, Point2D p2, Point2D p3, double radius)
将该弧的位置,边界和角度范围设置为指定的值。
|
void |
setArcType(int type)
将此弧为指定值的闭合类型:
OPEN ,
CHORD ,或
PIE 。
|
void |
setFrame(double x, double y, double w, double h)
设置此的框架矩形的位置和大小
Shape到指定的矩形的值。
|
clone, contains, getBounds, getCenterX, getCenterY, getFrame, getHeight, getMaxX, getMaxY, getMinX, getMinY, getPathIterator, getWidth, getX, getY, intersects, isEmpty, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonalpublic static final int OPEN
public static final int CHORD
public static final int PIE
protected Arc2D()
此构造函数创建一个默认关闭类型为OPEN的对象。 它仅用于启用子类的序列化。
Arc2D.Float , Arc2D.Double
protected Arc2D(int type)
type -此弧的闭合类型:
OPEN ,
CHORD ,或
PIE 。
Arc2D.Float , Arc2D.Double
public abstract double getAngleStart()
setAngleStart(double)
public abstract double getAngleExtent()
setAngleExtent(double)
public int getArcType()
setArcType(int)
public Point2D getStartPoint()
Point2D起始点的x,y坐标的
Point2D对象。
public Point2D getEndPoint()
Point2D终点的x,y坐标的
Point2D对象。
public abstract void setArc(double x,
double y,
double w,
double h,
double angSt,
double angExt,
int closure)
public void setArc(Point2D loc, Dimension2D size, double angSt, double angExt, int closure)
public void setArc(Rectangle2D rect, double angSt, double angExt, int closure)
public void setArc(Arc2D a)
a - 用于设置弧的值的
Arc2D 。
public void setArcByCenter(double x,
double y,
double radius,
double angSt,
double angExt,
int closure)
public void setArcByTangent(Point2D p1, Point2D p2, Point2D p3, double radius)
p1 - 定义弧的第一个点。
弧的起始角度与由点(p1,p2)指定的线相切。
p2 - 定义弧的第二个点。
弧的起始角度与由点(p1,p2)指定的线相切。
弧的终止角与点(p2,p3)指定的线相切。
p3 - 定义弧的第三点。
弧的终止角与点(p2,p3)指定的线相切。
radius - 弧的半径。
public abstract void setAngleStart(double angSt)
angSt - 圆弧的起始角度,以度为单位。
getAngleStart()
public abstract void setAngleExtent(double angExt)
angExt - 弧度的角度范围。
getAngleExtent()
public void setAngleStart(Point2D p)
p - 定义起始角度的
Point2D 。
getAngleStart()
public void setAngles(double x1,
double y1,
double x2,
double y2)
x1 - 弧起点的X坐标。
y1 - 弧起点的Y坐标。
x2 - 弧的终点的X坐标。
y2 - 圆弧终点的Y坐标。
public void setAngles(Point2D p1, Point2D p2)
p1 - 定义弧线起点的
Point2D 。
p2 - 定义弧的终点的
Point2D 。
public void setArcType(int type)
OPEN ,
CHORD ,或
PIE 。
type -表示此弧的闭合类型的整数常量:
OPEN ,
CHORD ,或
PIE 。
IllegalArgumentException - 如果
type不是0,1或2. +
getArcType()
public void setFrame(double x,
double y,
double w,
double h)
Shape到指定的矩形的值。
请注意,这个RectangularShape的框架矩形RectangularShape 。
setFrame在类别
RectangularShape
x - 指定矩形左上角的X坐标
y - 指定矩形左上角的Y坐标
w - 指定矩形形状的宽度
h - 指定
h的高度
RectangularShape.getFrame()
public Rectangle2D getBounds2D()
Arc2D的部分,并且包含饼形楔块,如果此Arc2D具有PIE闭合类型。
此方法从不同getBounds ,所述getBounds方法只返回此的包围椭圆的边界Arc2D不考虑开始和结束这个角度Arc2D 。
Rectangle2D表示弧的窗体矩形。
Shape.getBounds()
protected abstract Rectangle2D makeBounds(double x, double y, double w, double h)
Rectangle2D精度的Rectangle2D,以将计算的参数保存为该弧的框架矩形。
x - 框架矩形左上角的X坐标。
y - 框架矩形左上角的Y坐标。
w - 框架矩形的宽度。
h - 框架矩形的高度。
Rectangle2D是这个弧的框架矩形。
public boolean containsAngle(double angle)
angle - 要测试的角度。
true如果电弧含有角度,
false如果电弧不包含角度。
public boolean contains(double x,
double y)
x - 测试点的X坐标。
y - 测试点的Y坐标。
true如果点中的界弧,
false如果点位于弧的边界之外。
public boolean intersects(double x,
double y,
double w,
double h)
x -
x的X坐标。
y -
y的Y坐标。
w -
w的宽度。
h -
h的高度。
true如果弧相交的矩形,
false如果弧不相交的矩形。
Area
public boolean contains(double x,
double y,
double w,
double h)
x -
x的X坐标。
y -
y的Y坐标。
w -
w的宽度。
h -
h的高度。
true如果弧包含矩形,
false如果弧不包含矩形。
Area , Shape.intersects(double, double, double, double)
public boolean contains(Rectangle2D r)
contains在界面
Shape
contains在类别
RectangularShape
r -
Rectangle2D要测试。
true如果弧包含矩形,
false如果弧不包含矩形。
Shape.contains(double, double, double, double)
public PathIterator getPathIterator(AffineTransform at)
Arc2D保证对电弧几何的修改不会影响已经在处理的几何的任何迭代。
at - 要在迭代中返回时应用于
at的可选
AffineTransform ,如果需要未转换的坐标,则为空。
PathIterator定义弧的边界。
public int hashCode()
Arc2D的哈希码。
hashCode在
Object
Arc2D 。
Object.equals(java.lang.Object) ,
System.identityHashCode(java.lang.Object)
public boolean equals(Object obj)
Object是否等于此Arc2D 。
指定Object等于该Arc2D如果是的一个实例Arc2D ,如果它的位置,大小,电弧程度和类型是相同的,因为这Arc2D 。
equals在
Object
obj - 一个
Object要与这个
Arc2D进行比较。
true如果obj是的一个实例Arc2D ,并具有相同的值;
false否则。
Object.hashCode() , HashMap
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.