|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttwaver.Size
twaver.Rect
public class Rect
矩形,继承于Size,增加了x,y两个位置参数
Field Summary | |
---|---|
float |
x
x坐标 |
float |
y
y坐标 |
Fields inherited from class twaver.Size |
---|
height, width |
Constructor Summary | |
---|---|
Rect()
构造函数 |
|
Rect(android.graphics.Rect gr)
构造函数,从 android.graphics.Rect 类型矩形中获取参数属性 |
|
Rect(android.graphics.RectF gr)
构造函数,从 android.graphics.RectF 类型矩形中获取参数属性 |
|
Rect(double x,
double y,
double width,
double height)
构造函数,指定矩形参数 |
|
Rect(float width,
float height)
构造函数,指定矩形宽高 |
|
Rect(Point location,
Size size)
构造函数 |
Method Summary | |
---|---|
void |
add(android.graphics.RectF r)
添加矩形,扩大矩形范围 |
Rect |
add(float newx,
float newy)
添加点,扩大矩形范围 |
void |
add(Point p)
添加点,扩大矩形范围 |
Rect |
clone()
拷贝一份新的数据,避免对原始数据的更改 |
boolean |
contains(double x2,
double y2)
是否包含坐标点 |
void |
deserialize(java.lang.String string)
反序列化属性,根据字符串生成对象的属性 |
boolean |
equals(java.lang.Object o)
|
boolean |
equals(Rect rect,
float precision)
是否相等 |
float |
getBottom()
|
Point |
getCenter()
|
float |
getCenterX()
|
float |
getCenterY()
|
float |
getLeft()
|
Point |
getLocation()
|
float |
getRight()
|
float |
getTop()
|
float |
getX()
|
float |
getY()
|
Rect |
grow(float h,
float v)
扩大矩形范围 |
Rect |
grow(float l,
float r,
float t,
float b)
扩大矩形范围,指定间距 |
Rect |
grow(Insets insets)
扩大矩形范围,指定间距 |
Rect |
intersection(Rect r)
相交区域 |
boolean |
intersects(double x2,
double y2)
是否包含坐标点 |
boolean |
intersects(double x2,
double y2,
double width2,
double height2)
矩形是否相交 |
boolean |
intersects(Point point)
是否包含坐标点 |
boolean |
intersects(Point point,
float tolerance)
是否包含坐标点 |
boolean |
intersects(Rect rect)
矩形是否相交 |
boolean |
isEmpty()
是否为空 |
Rect |
offset(float offsetX,
float offsetY)
偏移矩形 |
Rect |
offset(Point p)
偏移矩形 |
void |
reset()
重新设置矩形参数数值 |
java.lang.String |
serialize()
序列化该对象 |
void |
set(double x,
double y,
double width,
double height)
设置矩形参数 |
void |
set(Point location,
Size size)
设置矩形参数 |
void |
set(Rect rect)
从指定矩形中获取参数数值 |
android.graphics.Rect |
toGraphicRect()
转换为 android.graphics.Rect 类型 |
android.graphics.RectF |
toGraphicRectF()
转换为 android.graphics.RectF 类型 |
java.lang.String |
toString()
|
Rect |
translate(float tx,
float ty)
平移矩形位置 |
Rect |
union(Rect r)
合并矩形 |
Methods inherited from class twaver.Size |
---|
setHeight, setWidth |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public float x
public float y
Constructor Detail |
---|
public Rect(android.graphics.RectF gr)
android.graphics.RectF
类型矩形中获取参数属性
gr
- 矩形public Rect(android.graphics.Rect gr)
android.graphics.Rect
类型矩形中获取参数属性
gr
- 矩形public Rect()
public Rect(double x, double y, double width, double height)
x
- x坐标y
- y坐标width
- 宽度height
- 高度public Rect(float width, float height)
width
- 宽度height
- 高度public Rect(Point location, Size size)
location
- 矩形左上角位置size
- 矩形大小Method Detail |
---|
public void reset()
public void set(Rect rect)
rect
- 矩形public void set(double x, double y, double width, double height)
x
- x坐标y
- y坐标width
- 宽度height
- 高度public void set(Point location, Size size)
location
- 矩形左上角位置size
- 矩形大小public float getX()
public float getY()
public float getCenterX()
public float getCenterY()
public Point getCenter()
public float getLeft()
public float getTop()
public float getRight()
public float getBottom()
public Point getLocation()
public boolean contains(double x2, double y2)
x2
- x坐标y2
- y坐标
public boolean intersects(double x2, double y2)
intersects
in interface twaver.core.topo.IShape
x2
- x坐标y2
- y坐标
public boolean intersects(Point point)
point
- 坐标点
public boolean intersects(Point point, float tolerance)
point
- 坐标点tolerance
- 容差
public boolean intersects(Rect rect)
rect
- 矩形
public boolean intersects(double x2, double y2, double width2, double height2)
intersects
in interface twaver.core.topo.IShape
x2
- 矩形x坐标y2
- 矩形y坐标width2
- 矩形宽度height2
- 矩形高度
public Rect intersection(Rect r)
r
- 矩形
public void add(Point p)
p
- 点public Rect add(float newx, float newy)
newx
- x坐标newy
- y坐标
public void add(android.graphics.RectF r)
r
- 矩形public Rect grow(float h, float v)
h
- 水平扩大间距v
- 垂直扩大间距
public Rect grow(Insets insets)
insets
- 间距
public Rect grow(float l, float r, float t, float b)
l
- 左边间距r
- 右边间距t
- 顶部间距b
- 底部间距
public boolean isEmpty()
isEmpty
in class Size
public android.graphics.Rect toGraphicRect()
android.graphics.Rect
类型
android.graphics.Rect
类型矩形public android.graphics.RectF toGraphicRectF()
android.graphics.RectF
类型
android.graphics.RectF
类型public java.lang.String toString()
toString
in class Size
public Rect union(Rect r)
r
- 矩形
public Rect clone()
IStruct
clone
in interface IStruct
clone
in class Size
public boolean equals(Rect rect, float precision)
rect
- 矩形precision
- 精确度
public boolean equals(java.lang.Object o)
equals
in class Size
public Rect translate(float tx, float ty)
tx
- x平移量ty
- y平移量
public Rect offset(float offsetX, float offsetY)
offsetX
- x偏移量offsetY
- y偏移量
public Rect offset(Point p)
p
- 偏移量
public java.lang.String serialize()
ISerializable
serialize
in interface ISerializable
serialize
in class Size
public void deserialize(java.lang.String string)
ISerializable
deserialize
in interface ISerializable
deserialize
in class Size
string
- 字符串
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |