|
Eclipse Draw2d 3.7 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.draw2d.geometry.Rectangle
org.eclipse.draw2d.geometry.PrecisionRectangle
public final class PrecisionRectangle
A Rectangle implementation using floating point values which are truncated into the inherited integer fields. The use of floating point prevents rounding errors from accumulating.
| Field Summary | |
|---|---|
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. |
| Fields inherited from class org.eclipse.draw2d.geometry.Rectangle |
|---|
height, SINGLETON, width, x, y |
| Constructor Summary | |
|---|---|
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. |
|
| Method Summary | |
|---|---|
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(Object o)
Returns whether the input object is equal to this Rectangle or not. |
Rectangle |
expand(double h,
double v)
Deprecated. Use expandPrecise(double, double) instead. |
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(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)
Deprecated. Use shrink(int, int) or
shrinkPrecise(double, double) instead. |
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(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(int x,
int y)
Updates this Rectangle's bounds to the minimum size which can hold both this Rectangle and the coordinate (x,y). |
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. |
| Methods inherited from class org.eclipse.draw2d.geometry.Rectangle |
|---|
bottom, crop, equals, getCropped, getExpanded, getExpanded, getIntersection, getLeft, getLocation, getPosition, getResized, getResized, getRight, getShrinked, getShrinked, getSize, getTranslated, getTranslated, getTransposed, getUnion, getUnion, hashCode, height, intersects, isEmpty, right, scale, scale, toString, union, union, width, x, y |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public 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.
| Constructor Detail |
|---|
public PrecisionRectangle()
public PrecisionRectangle(double x,
double y,
double width,
double height)
x - X locationy - Y locationwidth - Width of the rectangleheight - Height of the rectangle
public 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 rectangle| Method Detail |
|---|
public boolean contains(int x,
int y)
Rectangle
contains in class Rectanglex - X valuey - Y value
Rectangle.contains(int, int)public boolean contains(Point p)
Rectangle
contains in class Rectanglep - Point being tested for containment
Rectangle.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 test
Rectangle.contains(org.eclipse.draw2d.geometry.Rectangle)public boolean equals(Object o)
Rectangle
equals in class Rectangleo - Object being tested for equality
Rectangle.equals(Object)
public Rectangle expand(double h,
double v)
expandPrecise(double, double) instead.
h - Horizontal incrementv - Vertical increment
this for conveniencepublic Rectangle expand(Insets insets)
Rectangle
expand in class Rectangleinsets - contains the amounts to expand on each side
this for convenienceRectangle.expand(org.eclipse.draw2d.geometry.Insets)
public Rectangle expand(int h,
int v)
Rectangle
expand in class Rectangleh - Horizontal incrementv - Vertical increment
this for convenienceRectangle.expand(int, int)public Point getBottom()
Rectangle
getBottom in class RectangleRectangle.getBottom()public Point getBottomLeft()
Rectangle
getBottomLeft in class RectangleRectangle.getBottomLeft()public Point getBottomRight()
Rectangle
getBottomRight in class RectangleRectangle.getBottomRight()public Point getCenter()
Rectangle
getCenter in class RectangleRectangle.getCenter()public Rectangle getCopy()
Rectangle
getCopy in class RectangleRectangle.getCopy()public PrecisionRectangle getPreciseCopy()
public Point getTop()
Rectangle
getTop in class RectangleRectangle.getTop()public Point getTopLeft()
Rectangle
getTopLeft in class RectangleRectangle.getTopLeft()public Point getTopRight()
Rectangle
getTopRight in class RectangleRectangle.getTopRight()public Rectangle intersect(Rectangle rect)
Rectangle
intersect in class Rectanglerect - Rectangle for the calculating intersection.
this for convenienceRectangle.intersect(org.eclipse.draw2d.geometry.Rectangle)public void performScale(double factor)
Translatable
performScale 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 height
preciseHeight in class Rectangledouble heightRectangle.preciseHeight()public double preciseRight()
public double preciseWidth()
Rectangledouble width
preciseWidth in class Rectangledouble widthRectangle.preciseWidth()public double preciseX()
Rectangledouble x coordinate
preciseX in class Rectangledouble x coordinateRectangle.preciseX()public double preciseY()
Rectangledouble y coordinate
preciseY in class Rectangledouble y coordinateRectangle.preciseY()public Rectangle resize(Dimension d)
Rectangle
resize in class Rectangled - Resize data as a Dimension
this for convenienceRectangle.resize(org.eclipse.draw2d.geometry.Dimension)
public Rectangle resize(int w,
int h)
Rectangle
resize in class Rectanglew - Amount by which width is to be resizedh - Amount by which height is to be resized
this for convenienceRectangle.resize(int, int)
public Rectangle setBounds(int x,
int y,
int width,
int height)
Rectangle
setBounds in class Rectanglex - The new xy - The new ywidth - The new widthheight - The new height
Rectangle.setBounds(int, int, int, int)
public Rectangle setBounds(Point location,
Dimension size)
Rectangle
setBounds in class Rectanglelocation - The new locationsize - The new size
Rectangle.setBounds(org.eclipse.draw2d.geometry.Point,
org.eclipse.draw2d.geometry.Dimension)public Rectangle setBounds(Rectangle rect)
Rectangle
setBounds in class Rectanglerect - Rectangle providing the bounding values
this for convenienceRectangle.setBounds(org.eclipse.draw2d.geometry.Rectangle)public void setHeight(double value)
setPreciseHeight(double) instead.
value - the new heightpublic Rectangle setHeight(int height)
Rectangle
setHeight in class Rectangleheight - The new height
Rectangle.setHeight(int)
public Rectangle setLocation(int x,
int y)
Rectangle
setLocation in class Rectanglex - The new X coordinatey - The new Y coordinate
this for convenienceRectangle.setLocation(int, int)public Rectangle setLocation(Point loc)
Rectangle
setLocation in class Rectangleloc - New position of this Rectangle
this 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 height
public PrecisionRectangle setPreciseHeight(double value)
value - The new height.
public PrecisionRectangle setPreciseLocation(double x,
double y)
x - The new x valuey - The new y value
public PrecisionRectangle setPreciseLocation(PrecisionPoint loc)
loc - The new location
public PrecisionRectangle setPreciseSize(double w,
double h)
w - The new widthh - The new height
public PrecisionRectangle setPreciseSize(PrecisionDimension size)
size - The new size
public PrecisionRectangle setPreciseWidth(double value)
value - The new width
public PrecisionRectangle setPreciseX(double value)
value - The new x value
public PrecisionRectangle setPreciseY(double value)
value - the new y value
public Rectangle setSize(Dimension d)
Rectangle
setSize in class Rectangled - The new Dimension
this for convenienceRectangle.setSize(org.eclipse.draw2d.geometry.Dimension)
public Rectangle setSize(int w,
int h)
Rectangle
setSize in class Rectanglew - The new widthh - The new height
this for convenienceRectangle.setSize(int, int)public void setWidth(double value)
setPreciseWidth(double) instead.
value - the new widthpublic Rectangle setWidth(int width)
Rectangle
setWidth in class Rectanglewidth - The new width
Rectangle.setWidth(int)public void setX(double value)
setPreciseX(double) instead.
value - the new x valuepublic Rectangle setX(int value)
Rectangle
setX in class Rectanglevalue - The new x value
this for convenienceRectangle.setX(int)public void setY(double value)
setPreciseX(double) instead.
value - the new y valuepublic Rectangle setY(int value)
Rectangle
setY in class Rectanglevalue - The new y value
this for convenienceRectangle.setY(int)
public Rectangle shrink(double h,
double v)
shrink(int, int) or
shrinkPrecise(double, double) instead.
h - Horizontal reduction amountv - Vertical reduction amount
this for conveniencepublic Rectangle shrink(Insets insets)
Rectangleinsets.
shrink in class Rectangleinsets - Insets to be removed from the Rectangle
this for convenienceRectangle.shrink(org.eclipse.draw2d.geometry.Insets)
public Rectangle shrink(int h,
int v)
Rectangle
shrink in class Rectangleh - Horizontal reduction amountv - Vertical reduction amount
this 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 contact
true if rect touches this RectangleRectangle.touches(org.eclipse.draw2d.geometry.Rectangle)
public Rectangle translate(int dx,
int dy)
Rectangle
translate in class Rectangledx - Shift along X axisdy - Shift along Y axis
this for convenienceRectangle.translate(int, int)public Rectangle translate(Point p)
Rectangle
translate in class Rectanglep - Point which provides translation information
this for convenienceRectangle.translate(org.eclipse.draw2d.geometry.Point)public Rectangle transpose()
Rectangle
transpose in class Rectanglethis for convenienceRectangle.transpose()
public Rectangle union(int x,
int y)
Rectangle
union in class Rectanglex - X coordinatey - Y coordinate
this for convenienceRectangle.union(int, int)public void union(Point p)
Rectangle
union in class Rectanglep - Point to be unioned with this RectangleRectangle.union(org.eclipse.draw2d.geometry.Point)public PrecisionRectangle union(PrecisionRectangle rect)
union(Rectangle) instead
this for convenience.
rect - the rectangle being unioned
this for conveniencepublic Rectangle union(Rectangle rect)
Rectangle
union in class Rectanglerect - Rectangle to be unioned with this Rectangle
this 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.
|
Eclipse Draw2d 3.7 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||