public final class PrecisionRectangle extends Rectangle
| Modifier and Type | Field and Description |
|---|---|
double |
preciseHeight
Deprecated.
Use
setPreciseHeight(double) and
preciseHeight() instead. This field will become
private in the future. |
double |
preciseWidth
Deprecated.
Use
setPreciseWidth(double) and
preciseWidth() instead. This field will become
private in the future. |
double |
preciseX
Deprecated.
Use
setPreciseX(double) and preciseX()
instead. This field will become private in the future. |
double |
preciseY
Deprecated.
Use
setPreciseX(double) and preciseY()
instead. This field will become private in the future. |
| Constructor and Description |
|---|
PrecisionRectangle()
Constructs a new PrecisionRectangle with all values 0.
|
PrecisionRectangle(double x,
double y,
double width,
double height)
Constructs a PrecisionRectangle with the provided values.
|
PrecisionRectangle(Point p,
Dimension d)
Constructs a new PrecisionRectangle from a given Point and a Dimension
|
PrecisionRectangle(Rectangle rect)
Constructs a new PrecisionRectangle from the given integer Rectangle.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(double x,
double y)
Returns whether the given coordinates are within the boundaries of this
Rectangle.
|
boolean |
contains(int x,
int y)
Returns whether the given coordinates are within the boundaries of this
Rectangle.
|
boolean |
contains(Point p)
Returns whether the given point is within the boundaries of this
Rectangle.
|
boolean |
contains(Rectangle rect)
Returns
true if the given rectangle is contained within the
boundaries of this Rectangle. |
boolean |
equals(java.lang.Object o)
Returns whether the input object is equal to this Rectangle or not.
|
Rectangle |
expand(double h,
double v)
Expands the horizontal and vertical sides of this Rectangle with the
values provided as input, and returns this for convenience.
|
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.
|
PrecisionRectangle |
getPreciseCopy()
Returns a precise copy of this.
|
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 |
intersect(Rectangle rect)
Sets the size of this Rectangle to the intersection region with the
Rectangle supplied as input, and returns this for convenience.
|
void |
performScale(double factor)
Scales this object by the scale factor.
|
void |
performTranslate(int dx,
int dy)
Translates this object horizontally by
dx and vertically by
dy. |
double |
preciseBottom()
Returns the bottom coordinte in double precision.
|
double |
preciseHeight()
Returns
double height |
double |
preciseRight()
Returns the right side in double precision.
|
double |
preciseWidth()
Returns
double width |
double |
preciseX()
Returns
double x coordinate |
double |
preciseY()
Returns
double y coordinate |
Rectangle |
resize(Dimension d)
Resizes this Rectangle by the Dimension provided as input and returns
this for convenience.
|
Rectangle |
resize(double w,
double h)
Resizes this Rectangle by the values supplied as input and returns this
for convenience.
|
Rectangle |
resize(int w,
int h)
Resizes this Rectangle by the values supplied as input and returns this
for convenience.
|
Rectangle |
setBounds(int x,
int y,
int width,
int height)
Sets the x, y, width, and height values of this Rectangle to the provided
values.
|
Rectangle |
setBounds(Point location,
Dimension size)
Sets the location and size of this rectangle to the provided ones.
|
Rectangle |
setBounds(Rectangle rect)
Sets the parameters of this Rectangle from the Rectangle passed in and
returns this for convenience.
|
void |
setHeight(double value)
Deprecated.
Use
setPreciseHeight(double) instead. |
Rectangle |
setHeight(int height)
Sets the height of this Rectangle to the specified one.
|
Rectangle |
setLocation(int x,
int y)
Sets the location of this Rectangle to the coordinates given as input and
returns this for convenience.
|
Rectangle |
setLocation(Point loc)
Sets the location of this Rectangle to the point given as input and
returns this for convenience.
|
PrecisionRectangle |
setPreciseBounds(double x,
double y,
double width,
double height)
Sets the preciseX, preciseY, preciseWidth, and preciseHeight values of
this PrecisionRectangle to the provided values and updates the integer
values of x, y, width, and height accordingly.
|
PrecisionRectangle |
setPreciseHeight(double value)
Sets the height of this PrecisionRectangle to the specified value.
|
PrecisionRectangle |
setPreciseLocation(double x,
double y)
Sets the preciseX and preciseY values of this PrecisionRectangle to the
provided values and updates the integer values of x and y accordingly.
|
PrecisionRectangle |
setPreciseLocation(PrecisionPoint loc)
Sets the precise location of this PrecisionRectangle
|
PrecisionRectangle |
setPreciseSize(double w,
double h)
Sets the preciseWidth and preciseHeight values of this PrecisionRectangle
to the provided values and updates the integer values of width and height
accordingly.
|
PrecisionRectangle |
setPreciseSize(PrecisionDimension size)
Set the size of this PrecisionRectangle to the given dimension's width
and height.
|
PrecisionRectangle |
setPreciseWidth(double value)
Sets the width of this PrecisionRectangle to the specified one.
|
PrecisionRectangle |
setPreciseX(double value)
Sets the x value.
|
PrecisionRectangle |
setPreciseY(double value)
Sets the y value.
|
Rectangle |
setSize(Dimension d)
Sets the width and height of this Rectangle to the width and height of
the given Dimension and returns this for convenience.
|
Rectangle |
setSize(int w,
int h)
Sets the width of this Rectangle to w and the height of this
Rectangle to h and returns this for convenience.
|
void |
setWidth(double value)
Deprecated.
Use
setPreciseWidth(double) instead. |
Rectangle |
setWidth(int width)
Sets the width of this Rectangle to the specified one.
|
void |
setX(double value)
Deprecated.
Use
setPreciseX(double) instead. |
Rectangle |
setX(int value)
Sets the x value of the Rectangle and returns this for convenience.
|
void |
setY(double value)
Deprecated.
Use
setPreciseX(double) instead. |
Rectangle |
setY(int value)
Sets the y value of the Rectangle and returns this for convenience.
|
Rectangle |
shrink(double h,
double v)
Shrinks the sides of this Rectangle by the horizontal and vertical values
provided as input, and returns this Rectangle for convenience.
|
Rectangle |
shrink(Insets insets)
Shrinks this rectangle by the amount specified in
insets. |
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.
|
boolean |
touches(Rectangle rect)
Returns
true if the input Rectangle touches this Rectangle. |
Rectangle |
translate(double dx,
double dy)
Moves this Rectangle horizontally by dx and vertically by dy, then
returns this Rectangle for convenience.
|
Rectangle |
translate(int dx,
int dy)
Moves this Rectangle horizontally by dx and vertically by dy, then
returns this Rectangle for convenience.
|
Rectangle |
translate(Point p)
Moves this Rectangle horizontally by the x value of the given Point and
vertically by the y value of the given Point, then returns this Rectangle
for convenience.
|
Rectangle |
transpose()
Switches the x and y values, as well as the width and height of this
Rectangle.
|
Rectangle |
union(double x,
double y)
Updates this Rectangle's bounds to the minimum size which can hold both
this Rectangle and the coordinate (x,y).
|
Rectangle |
union(double x,
double y,
double w,
double h)
Updates this Rectangle's dimensions to the minimum size which can hold
both this Rectangle and the rectangle (x, y, w, h).
|
Rectangle |
union(int x,
int y)
Updates this Rectangle's bounds to the minimum size which can hold both
this Rectangle and the coordinate (x,y).
|
Rectangle |
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 rectangle (x, y, w, h).
|
void |
union(Point p)
Updates this Rectangle's bounds to the minimum size which can hold both
this Rectangle and the given Point.
|
PrecisionRectangle |
union(PrecisionRectangle rect)
Deprecated.
Use
union(Rectangle) instead |
Rectangle |
union(Rectangle rect)
Updates this Rectangle's dimensions to the minimum size which can hold
both this Rectangle and the given Rectangle.
|
void |
updateInts()
Deprecated.
This method should not be accessed by clients any more (it
will be made private in future releases). The update of
integer and precision fields is performed automatically if
preciseX, preciseY, preciseWidth,
and preciseHeight field values are not manipulated
directly, but only via respective methods offered by this
class. |
bottom, crop, equals, getCropped, getExpanded, getExpanded, getExpanded, getIntersection, getLeft, getLocation, getPosition, getResized, getResized, getResized, getRight, getShrinked, getShrinked, getShrinked, getSize, getTranslated, getTranslated, getTranslated, getTransposed, getUnion, getUnion, hashCode, height, intersects, isEmpty, right, scale, scale, toString, union, width, x, ypublic double preciseHeight
setPreciseHeight(double) and
preciseHeight() instead. This field will become
private in the future.public double preciseWidth
setPreciseWidth(double) and
preciseWidth() instead. This field will become
private in the future.public double preciseX
setPreciseX(double) and preciseX()
instead. This field will become private in the future.public double preciseY
setPreciseX(double) and preciseY()
instead. This field will become private in the future.public PrecisionRectangle()
public PrecisionRectangle(double x,
double y,
double width,
double height)
x - X locationy - Y locationwidth - Width of the rectangleheight - Height of the rectanglepublic PrecisionRectangle(Point p, Dimension d)
p - The Point to specify x and y location of the
PrecisionRectangled - The Dimension to use for width and height of the
PrecisionRectanglepublic PrecisionRectangle(Rectangle rect)
rect - the base rectanglepublic boolean contains(double x,
double y)
Rectanglecontains in class Rectanglex - X valuey - Y valueRectangle.contains(double, double)public boolean contains(int x,
int y)
Rectanglecontains in class Rectanglex - X valuey - Y valueRectangle.contains(int, int)public boolean contains(Point p)
Rectanglecontains in class Rectanglep - Point being tested for containmentRectangle.contains(org.eclipse.draw2d.geometry.Point)public boolean contains(Rectangle rect)
Rectangletrue if the given rectangle is contained within the
boundaries of this Rectangle.contains in class Rectanglerect - the Rectangle to testRectangle.contains(org.eclipse.draw2d.geometry.Rectangle)public boolean equals(java.lang.Object o)
Rectangleequals in class Rectangleo - Object being tested for equalityRectangle.equals(Object)public Rectangle expand(double h, double v)
public Rectangle expand(Insets insets)
Rectangleexpand in class Rectangleinsets - contains the amounts to expand on each sidethis for convenienceRectangle.expand(org.eclipse.draw2d.geometry.Insets)public Rectangle expand(int h, int v)
Rectangleexpand in class Rectangleh - Horizontal incrementv - Vertical incrementthis for convenienceRectangle.expand(int, int)public Point getBottom()
RectanglegetBottom in class RectangleRectangle.getBottom()public Point getBottomLeft()
RectanglegetBottomLeft in class RectangleRectangle.getBottomLeft()public Point getBottomRight()
RectanglegetBottomRight in class RectangleRectangle.getBottomRight()public Point getCenter()
RectanglegetCenter in class RectangleRectangle.getCenter()public Rectangle getCopy()
RectanglegetCopy in class RectangleRectangle.getCopy()public PrecisionRectangle getPreciseCopy()
public Point getTop()
RectanglegetTop in class RectangleRectangle.getTop()public Point getTopLeft()
RectanglegetTopLeft in class RectangleRectangle.getTopLeft()public Point getTopRight()
RectanglegetTopRight in class RectangleRectangle.getTopRight()public Rectangle intersect(Rectangle rect)
Rectangleintersect in class Rectanglerect - Rectangle for the calculating intersection.this for convenienceRectangle.intersect(org.eclipse.draw2d.geometry.Rectangle)public void performScale(double factor)
TranslatableperformScale in interface TranslatableperformScale in class Rectanglefactor - The scale factorRectangle.performScale(double)public void performTranslate(int dx,
int dy)
Translatabledx and vertically by
dy.performTranslate in interface TranslatableperformTranslate in class Rectangledx - The amount to translate horizontallydy - The amount to translate verticallyRectangle.performTranslate(int, int)public double preciseBottom()
public double preciseHeight()
Rectangledouble heightpreciseHeight in class Rectangledouble heightRectangle.preciseHeight()public double preciseRight()
public double preciseWidth()
Rectangledouble widthpreciseWidth in class Rectangledouble widthRectangle.preciseWidth()public double preciseX()
Rectangledouble x coordinatepreciseX in class Rectangledouble x coordinateRectangle.preciseX()public double preciseY()
Rectangledouble y coordinatepreciseY in class Rectangledouble y coordinateRectangle.preciseY()public Rectangle resize(Dimension d)
Rectangleresize in class Rectangled - Resize data as a Dimensionthis for convenienceRectangle.resize(org.eclipse.draw2d.geometry.Dimension)public Rectangle resize(double w, double h)
Rectangleresize in class Rectanglew - Amount by which width is to be resizedh - Amount by which height is to be resizedthis for convenienceRectangle.resize(double, double)public Rectangle resize(int w, int h)
Rectangleresize in class Rectanglew - Amount by which width is to be resizedh - Amount by which height is to be resizedthis for convenienceRectangle.resize(int, int)public Rectangle setBounds(int x, int y, int width, int height)
RectanglesetBounds in class Rectanglex - The new xy - The new ywidth - The new widthheight - The new heightRectangle.setBounds(int, int, int, int)public Rectangle setBounds(Point location, Dimension size)
RectanglesetBounds in class Rectanglelocation - The new locationsize - The new sizeRectangle.setBounds(org.eclipse.draw2d.geometry.Point,
org.eclipse.draw2d.geometry.Dimension)public Rectangle setBounds(Rectangle rect)
RectanglesetBounds in class Rectanglerect - Rectangle providing the bounding valuesthis for convenienceRectangle.setBounds(org.eclipse.draw2d.geometry.Rectangle)public void setHeight(double value)
setPreciseHeight(double) instead.value - the new heightpublic Rectangle setHeight(int height)
RectanglesetHeight in class Rectangleheight - The new heightRectangle.setHeight(int)public Rectangle setLocation(int x, int y)
RectanglesetLocation in class Rectanglex - The new X coordinatey - The new Y coordinatethis for convenienceRectangle.setLocation(int, int)public Rectangle setLocation(Point loc)
RectanglesetLocation in class Rectangleloc - New position of this Rectanglethis for convenienceRectangle.setLocation(org.eclipse.draw2d.geometry.Point)public PrecisionRectangle setPreciseBounds(double x, double y, double width, double height)
x - The new xy - The new ywidth - The new widthheight - The new heightpublic PrecisionRectangle setPreciseHeight(double value)
value - The new height.public PrecisionRectangle setPreciseLocation(double x, double y)
x - The new x valuey - The new y valuepublic PrecisionRectangle setPreciseLocation(PrecisionPoint loc)
loc - The new locationpublic PrecisionRectangle setPreciseSize(double w, double h)
w - The new widthh - The new heightpublic PrecisionRectangle setPreciseSize(PrecisionDimension size)
size - The new sizepublic PrecisionRectangle setPreciseWidth(double value)
value - The new widthpublic PrecisionRectangle setPreciseX(double value)
value - The new x valuepublic PrecisionRectangle setPreciseY(double value)
value - the new y valuepublic Rectangle setSize(Dimension d)
RectanglesetSize in class Rectangled - The new Dimensionthis for convenienceRectangle.setSize(org.eclipse.draw2d.geometry.Dimension)public Rectangle setSize(int w, int h)
RectanglesetSize in class Rectanglew - The new widthh - The new heightthis for convenienceRectangle.setSize(int, int)public void setWidth(double value)
setPreciseWidth(double) instead.value - the new widthpublic Rectangle setWidth(int width)
RectanglesetWidth in class Rectanglewidth - The new widthRectangle.setWidth(int)public void setX(double value)
setPreciseX(double) instead.value - the new x valuepublic Rectangle setX(int value)
RectanglesetX in class Rectanglevalue - The new x valuethis for convenienceRectangle.setX(int)public void setY(double value)
setPreciseX(double) instead.value - the new y valuepublic Rectangle setY(int value)
RectanglesetY in class Rectanglevalue - The new y valuethis for convenienceRectangle.setY(int)public Rectangle shrink(double h, double v)
public Rectangle shrink(Insets insets)
Rectangleinsets.shrink in class Rectangleinsets - Insets to be removed from the Rectanglethis for convenienceRectangle.shrink(org.eclipse.draw2d.geometry.Insets)public Rectangle shrink(int h, int v)
Rectangleshrink in class Rectangleh - Horizontal reduction amountv - Vertical reduction amountthis for convenienceRectangle.shrink(int, int)public boolean touches(Rectangle rect)
Rectangletrue if the input Rectangle touches this Rectangle.touches in class Rectanglerect - Rectangle being checked for contacttrue if rect touches this RectangleRectangle.touches(org.eclipse.draw2d.geometry.Rectangle)public Rectangle translate(double dx, double dy)
Rectangletranslate in class Rectangledx - Shift along X axisdy - Shift along Y axisthis for convenienceRectangle.translate(double, double)public Rectangle translate(int dx, int dy)
Rectangletranslate in class Rectangledx - Shift along X axisdy - Shift along Y axisthis for convenienceRectangle.translate(int, int)public Rectangle translate(Point p)
Rectangletranslate in class Rectanglep - Point which provides translation informationthis for convenienceRectangle.translate(org.eclipse.draw2d.geometry.Point)public Rectangle transpose()
Rectangletranspose in class Rectanglethis for convenienceRectangle.transpose()public Rectangle union(double x, double y)
Rectangleunion in class Rectanglex - X coordinatey - Y coordinatethis for convenienceRectangle.union(double, double)public Rectangle union(double x, double y, double w, double h)
Rectangleunion in class Rectanglex - X coordinate of desired union.y - Y coordinate of desired union.w - Width of desired union.h - Height of desired union.this for convenienceRectangle.union(double, double, double,
double)public Rectangle union(int x, int y)
Rectangleunion in class Rectanglex - X coordinatey - Y coordinatethis for convenienceRectangle.union(int, int)public Rectangle union(int x, int y, int w, int h)
Rectangleunion in class Rectanglex - X coordinate of desired union.y - Y coordinate of desired union.w - Width of desired union.h - Height of desired union.this for convenienceRectangle.union(int, int, int, int)public void union(Point p)
Rectangleunion in class Rectanglep - Point to be unioned with this RectangleRectangle.union(org.eclipse.draw2d.geometry.Point)public PrecisionRectangle union(PrecisionRectangle rect)
union(Rectangle) insteadthis for convenience.rect - the rectangle being unionedthis for conveniencepublic Rectangle union(Rectangle rect)
Rectangleunion in class Rectanglerect - Rectangle to be unioned with this Rectanglethis for convenienceRectangle.union(org.eclipse.draw2d.geometry.Rectangle)public void updateInts()
preciseX, preciseY, preciseWidth,
and preciseHeight field values are not manipulated
directly, but only via respective methods offered by this
class.Copyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.