|
Draw2D v2.0 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--org.eclipse.draw2d.geometry.Rectangle
Provides support for a rectangle.
| Field Summary | |
int |
height
|
static Rectangle |
SINGLETON
|
int |
width
|
int |
x
|
int |
y
|
| Constructor Summary | |
Rectangle()
Constructs a Rectangle at the origin with zero width and height. |
|
Rectangle(int _x,
int _y,
int _width,
int _height)
Constructs a Rectangle with the location coordinates, width and height provided as input. |
|
Rectangle(Point pt,
Dimension d)
Constructs a Rectangle given its upper left hand corner and its dimensions. |
|
Rectangle(Point p1,
Point p2)
Constructs a Rectangle provided it upper left and lower right points. |
|
Rectangle(Rectangle copy)
Constructs a Rectangle with the location and size of the input Rectangle. |
|
Rectangle(Rectangle r)
Constructs a Rectangle with the same location and size of the SWT Rectangle provided as input. |
|
| Method Summary | |
int |
bottom()
Returns the y-coordinate of the bottom of this Rectangle |
boolean |
contains(int x,
int y)
Returns whether the given coordinates are within the boundaries of the rectangle, inclusive of the top and left boundary lines. |
boolean |
contains(Point pt)
Returns whether the given point is within the boundaries of the rectangle, inclusive of the top and left boundary. |
Rectangle |
crop(Insets insets)
Removes the space provided by the Insets from this Rectangle, and returns this for convenience. |
boolean |
equals(Object o)
Returns whether the input object is equal to this Rectangle or not. |
Rectangle |
expand(Insets insets)
Expands the horizontal and vertical sides of this Rectangle by the width and height of the given Insets, and returns this for convenience. |
Rectangle |
expand(int h,
int v)
Expands the horizontal and vertical sides of this Rectangle with the values provided as input, and returns this for convenience. |
Point |
getBottom()
Returns a new Point representing the middle point of the bottom side of this Rectangle. |
Point |
getBottomLeft()
Returns a new Point representing the bottom left point of this Rectangle. |
Point |
getBottomRight()
Returns a new Point representing the bottom right point of this Rectangle. |
Point |
getCenter()
Returns a new point representing the center of this Rectangle. |
Rectangle |
getCopy()
Returns a new Rectangle which has the exact same parameters as this Rectangle. |
Rectangle |
getCropped(Insets insets)
Returns a new Rectangle with the specified insets cropped. |
Rectangle |
getExpanded(Insets insets)
Creates and returns a new Rectangle with the bounds of this Rectangle, expanded by the given Insets. |
Rectangle |
getExpanded(int h,
int v)
Returns a new incremented Rectangle, where the sides are expanded by the horizonatal and vertical values provided. |
Rectangle |
getIntersection(Rectangle rect)
Returns a new Rectangle which has the intersection of this Rectangle and the rectangle provided as input. |
Point |
getLeft()
Returns a new Rectangle representing the middle point of the left hand side of this Rectangle. |
Point |
getLocation()
Returns the upper left hand corner of the rectangle. |
int |
getPosition(Point pt)
Returns an integer which represents the position of the given point with respect to this rectangle. |
Rectangle |
getResized(Dimension d)
Returns a new Rectangle which is equivalent to this Rectangle with its dimensions modified by the passed Dimension d. |
Rectangle |
getResized(int w,
int h)
Returns a new rectangle with its width and height augmented. |
Point |
getRight()
Returns a new Point which represents the middle point of the right hand side of this Rectangle. |
Dimension |
getSize()
Retuns the dimensions of this Rectangle. |
Point |
getTop()
Returns a new Point which represents the middle point of the top side of this Rectangle. |
Point |
getTopLeft()
Returns a new Point which represents the top left hand corner of this Rectangle. |
Point |
getTopRight()
Returns a new Point which represents the top right hand corner of this Rectangle. |
Rectangle |
getTranslated(int dx,
int dy)
Returns a new Rectangle which is shifted along each axis by the passed values. |
Rectangle |
getTranslated(Point pt)
Returns a new Rectangle which is shifted by the position of the input Point supplied. |
Rectangle |
getTransposed()
Returns a new rectangle whose width and height have been interchanged. |
Rectangle |
getUnion(Rectangle rect)
Returns the rectangular area which contains both this Rectangle and the Rectangle supplied as input. |
Rectangle |
intersect(Rectangle rect)
Sets the size of this Rectangle to the intersection region with the Rectangle supplied as input, and returns this for convenience. |
boolean |
intersects(Rectangle rect)
Returns if the input Rectangle intersects this Rectangle. |
boolean |
isEmpty()
Returns whether this Rectangle has any dimensions. |
void |
performScale(float factor)
Scales this object by the scale factor. |
void |
performTranslate(int dx,
int dy)
Translates this Rectangle by (dx,dy). |
Rectangle |
resize(Dimension sizeDelta)
Resizes this Rectangle by the dimensions provided as input, and returns this for convenience. |
Rectangle |
resize(int dw,
int dh)
Resizes this Rectangle by the dimension values supplied as input, and returns this for convenience. |
int |
right()
Returns the right end of the rectangle along the X axis. |
Rectangle |
scale(float scaleFactor)
Scales the location and size of this Rectangle by the given scale. |
Rectangle |
scale(float scaleX,
float scaleY)
Scales the location and size of this Rectangle by the given scales. |
Rectangle |
setBounds(Rectangle rect)
Sets the parameters of this Rectangle from the Rectangle passed in. |
Rectangle |
setLocation(int x1,
int y1)
Sets the location of this Rectangle to the coordinates given as input. |
Rectangle |
setLocation(Point p)
Sets the location of this Rectangle to the point given as input. |
Rectangle |
setSize(Dimension d)
Sets the dimensions of this Rectangle to the input Dimension values. |
Rectangle |
setSize(int w,
int h)
Sets the dimensions of this Rectangle to the values given as input. |
Rectangle |
shrink(int h,
int v)
Shrinks the sides of this Rectangle by the horizontal and vertical values provided as input, and returns this Rectangle for convenience. |
String |
toString()
Returns the description of this Rectangle. |
boolean |
touches(Rectangle rect)
Returns whether the input Rectangle touches this Rectangle. |
Rectangle |
translate(int dx,
int dy)
Returns this Rectangle after moving the center of the coordinate system by the values specified along each axis. |
Rectangle |
translate(Point p)
Returns this Rectangle after moving the center of the coordinate system Point p. |
void |
transpose()
Switches the location and the dimension of this Rectangle. |
void |
union(Dimension d)
Updates this Rectangle's dimensions to the minimum size which can hold both this Rectangle and the supplied Dimension. |
void |
union(int x1,
int y1)
Updates this Rectangle's Dimensions to the minimum size which can hold both this Rectangle and the supplied point, given its X and Y coordinates. |
void |
union(int _x,
int _y,
int _w,
int _h)
Updates this Rectangle's dimensions to the minimum size which can hold both this Rectangle and the passed parameters. |
void |
union(Point p)
Updates this Rectangle's dimensions to the minimum size which can hold both this Rectangle and the supplied Point. |
void |
union(Rectangle rect)
Updates this Rectangle's dimensions to the minimum size which can hold both this Rectangle and the passed Rectangle rect. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public int x
public int y
public int width
public int height
public static Rectangle SINGLETON
| Constructor Detail |
public Rectangle()
public Rectangle(Point pt,
Dimension d)
pt - Upper left corner pointd - Dimensions of the Rectangle.public Rectangle(Rectangle copy)
copy - Rectangle supplying the initial values.public Rectangle(Rectangle r)
r - SWT Rectangle
supplying the location and dimensions.Rectangle
public Rectangle(int _x,
int _y,
int _width,
int _height)
_x - X position of the upper left hand corner of the Rectangle._y - Y position of the upper left hand corner of the Rectangle._width - Width of the rectangle._height - Height of the rectangle.
public Rectangle(Point p1,
Point p2)
p1 - Upper left hand corner point.p2 - Lower right hand corner point.| Method Detail |
public void union(Dimension d)
d - Dimension against which union is performed.union(int,int),
union(Point),
union(Rectangle)
public void union(int x1,
int y1)
x1 - Position along X axis against
which union is performed.y1 - Position along Y axis against
which union is performed.union(Dimension),
union(Point),
union(Rectangle)public final void union(Point p)
p - Point against which union is to be performed.union(int,int),
union(Dimension),
union(Rectangle)public final void union(Rectangle rect)
rect - Rectangle against which union is performed.union(int,int),
union(Point),
union(Dimension)
public void union(int _x,
int _y,
int _w,
int _h)
_x - X coordiante of desired union._y - Y coordiante of desired union._w - Width of desired union._h - Height of desired union.union(int,int),
union(Point),
union(Dimension)public int bottom()
public boolean contains(Point pt)
pt - Point being tested for containment.contains(int,int)
public boolean contains(int x,
int y)
pt - Point being tested for containment.contains(Point)public Rectangle crop(Insets insets)
insets - Insets to be removed from the Rectanglepublic boolean equals(Object o)
equals in class Objecto - Object being tested for equality.
public Rectangle expand(int h,
int v)
h - Horizontal increment.v - Vertical increment.public Rectangle expand(Insets insets)
public Point getBottom()
public Point getBottomLeft()
public Point getBottomRight()
public Point getCenter()
public Rectangle getCopy()
public Rectangle getCropped(Insets insets)
insets - Insets being cropped from the Rectangle.
public Rectangle getExpanded(int h,
int v)
h - Horizontal increment.v - Vertical Inrement.public Rectangle getExpanded(Insets insets)
this Rectangle, expanded by the given Insets.
The location of its center is kept constant.expand(Insets)public Rectangle getIntersection(Rectangle rect)
rect - Rectangle provided to test for intersection.
public Rectangle getResized(int w,
int h)
public Rectangle getTranslated(Point pt)
pt - Point providing the amount of shift along each axis.
public Rectangle getTranslated(int dx,
int dy)
dx - Displacement along X axis.dy - Displacement along Y axis.public Rectangle getTransposed()
public Point getLeft()
public Point getLocation()
setLocation(Point)public int getPosition(Point pt)
PositionConstants
Returns PositionConstant.NONE if the given point is in this Rectangle.pt - The Point whose position has to be determinedPositionConstantspublic Rectangle getResized(Dimension d)
d - Dimensions by which the rectangle's size
should be modified.public Point getRight()
public Dimension getSize()
setSize(Dimension),
setSize(int,int)public Point getTop()
public Point getTopLeft()
public Point getTopRight()
public Rectangle getUnion(Rectangle rect)
rect - Rectangle for calculating union.public Rectangle intersect(Rectangle rect)
rect - Rectangle for the calculating intersection.intersects(Rectangle)public boolean intersects(Rectangle rect)
rect - Rectangle for the intersetion test.intersects(Rectangle)public boolean isEmpty()
public void performScale(float factor)
TranslatableperformScale in interface Translatable
public void performTranslate(int dx,
int dy)
this Rectangle by (dx,dy).performTranslate in interface Translatabletranslate(int, int)public Rectangle resize(Dimension sizeDelta)
sizeDelta - Resize data as a Dimension.resize(int,int)
public Rectangle resize(int dw,
int dh)
dw - Amount by which width is to be resized.dh - Amount by which height is to be resized.resize(Dimension)public int right()
public final Rectangle scale(float scaleFactor)
scaleFactor - The factor by which this rectangle
will be scaled
public Rectangle scale(float scaleX,
float scaleY)
scaleX - the factor by which the X
dimension has to be scaledscaleY - the factor by which the Y
dimension has to be scaledpublic Rectangle setBounds(Rectangle rect)
rect - Rectangle providing the bounding values.public Rectangle setLocation(Point p)
p - New position of this Rectangle.
public Rectangle setLocation(int x1,
int y1)
x1 - Position of rectangle along X axis.y1 - Position of rectangle along Y axis.getLocation()public Rectangle setSize(Dimension d)
d - New Dimensions.setSize(int,int),
getSize()
public Rectangle setSize(int w,
int h)
w - New width.h - New height.setSize(Dimension),
getSize()
public Rectangle shrink(int h,
int v)
h - Horizontal reduction amount.v - Vertical reduction amount.public String toString()
toString in class Objectpublic boolean touches(Rectangle rect)
rect - Rectangle being checked for contact.public Rectangle translate(Point p)
p - Point which provides translation information.translate(int,int)
public Rectangle translate(int dx,
int dy)
dx - Shift along X axis.dy - Shift along Y axis.translate(Point)public void transpose()
|
Draw2D v2.0 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||