|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectview.Surrounding
public class Surrounding
Class Surrounding describes surrounding boxes
for 2D geometries. This box is defined in terms of
X coordinate of the left/right edge
and Y coordinate of the top/bottom edge.
| Field Summary | |
|---|---|
protected int |
maxx
|
protected int |
maxy
|
protected int |
minx
|
protected int |
miny
|
| Constructor Summary | |
|---|---|
Surrounding()
Constructs a surrounding rectangle for a point at 0, 0 |
|
Surrounding(int aMinx,
int aMiny,
int aMaxx,
int aMaxy)
Constructs a surrounding box defined by the left, top, right, bottom edge |
|
Surrounding(java.awt.Point center,
int size)
Constructs a surrounding square whose the given 2D point is the center |
|
Surrounding(java.awt.Point center,
int width,
int height)
Constructs a surrounding rectangle whose the given 2D point is the center |
|
Surrounding(Surrounding another)
Copy constructor |
|
| Method Summary | |
|---|---|
int |
bottom()
getter |
boolean |
contains(java.awt.Point p)
Tests if the given 2D point is inside this box |
java.awt.Point |
getCenterPoint()
Calculates the center of this box by calling getCenterX() and getCenterY() |
int |
getCenterX()
Calculates the X coordinate of the center of this box |
int |
getCenterY()
Calculates the Y coordinate of the center of this box |
void |
grow(int gw,
int gh)
Grows this box by the given extents |
void |
growBottom(int d)
Grows this box towards the bottom edge by the given extent |
void |
growLeft(int d)
Grows this box towards the left edge by the given extent |
void |
growRight(int d)
Grows this box towards the right edge by the given extent |
void |
growTop(int d)
Grows this box towards the top edge by the given extent |
int |
height()
Calculates the height of this box |
boolean |
isWithin(Surrounding another)
Tests if the given box is completely within this box |
int |
left()
getter |
int |
right()
getter |
int |
top()
getter |
int |
width()
Calculates the width of this box |
void |
wrap(java.awt.Point p)
Grows this box if neccessary to wrap the given 2D point |
void |
wrap(Surrounding another,
int leftD,
int topD,
int rightD,
int bottomD)
Grows this box if neccessary to wrap the given box by the given extents |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected int minx
protected int maxx
protected int miny
protected int maxy
| Constructor Detail |
|---|
public Surrounding()
public Surrounding(java.awt.Point center,
int size)
center - center of the surrounding square to constructsize - size of the surrounding square to construct
public Surrounding(java.awt.Point center,
int width,
int height)
center - center of the surrounding square to constructwidth - width of the surrounding rectangle to constructheight - height of the surrounding rectangle to constructpublic Surrounding(Surrounding another)
another - another surrounding box
public Surrounding(int aMinx,
int aMiny,
int aMaxx,
int aMaxy)
aMinx - X coordinate of the left edgeaMiny - Y coordinate of the top edgeaMaxx - X coordinate of the right edgeaMaxy - Y coordinate of the bottom edge| Method Detail |
|---|
public boolean isWithin(Surrounding another)
another - a surrounding box to test
true if another is completely within this box, false otherwisepublic boolean contains(java.awt.Point p)
p - a 2D point
true if p is inside this box,
false otherwise
public void wrap(Surrounding another,
int leftD,
int topD,
int rightD,
int bottomD)
another - a box to be wrappedleftD - the distance to the left edgetopD - the distance to the top edgerightD - the distance to the right edgebottomD - the distance to the bottom edgepublic void wrap(java.awt.Point p)
p - a 2D point to be wrappedpublic int width()
public int height()
public int left()
public int top()
public int right()
public int bottom()
public int getCenterX()
getCenterY(),
getCenterPoint()public int getCenterY()
getCenterX(),
getCenterPoint()public java.awt.Point getCenterPoint()
getCenterX() and getCenterY()
getCenterX(),
getCenterY()
public void grow(int gw,
int gh)
gw - horizontal extentgh - vertical extentpublic void growLeft(int d)
d - horizontal extentpublic void growRight(int d)
d - horizontal extentpublic void growTop(int d)
d - vertical extentpublic void growBottom(int d)
d - vertical extent
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||