|
Eclipse Draw2d 3.3 |
|||||||||
| 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
Double value for height |
double |
preciseWidth
Double value for width |
double |
preciseX
Double value for X |
double |
preciseY
Double value for Y |
| 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(Rectangle rect)
Constructs a new PrecisionRectangle from the given integer Rectangle. |
|
| Method Summary | |
|---|---|
boolean |
contains(Point p)
Returns whether the given point is within the boundaries of this Rectangle. |
Rectangle |
crop(Insets insets)
Crops this rectangle by the amount specified in insets. |
boolean |
equals(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. |
Point |
getCenter()
Returns the precise geometric centre of the rectangle |
Rectangle |
getCopy()
Returns a new Rectangle which has the exact same parameters as this Rectangle. |
PrecisionRectangle |
getPreciseCopy()
Returns a precise copy of this. |
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 sizeDelta)
Resizes this Rectangle by the Dimension provided as input and returns this for convenience. |
void |
setHeight(double value)
Sets the height. |
Rectangle |
setLocation(Point loc)
Sets the location of this Rectangle to the point given as input and returns this for convenience. |
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. |
void |
setWidth(double value)
Sets the width. |
void |
setX(double value)
Sets the x value. |
void |
setY(double value)
Sets the y value. |
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(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. |
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. |
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 other)
Deprecated. Use union(Rectangle) instead |
Rectangle |
union(Rectangle other)
Updates this Rectangle's dimensions to the minimum size which can hold both this Rectangle and the given Rectangle. |
void |
updateInts()
Updates the integer values based on the current precise values. |
| Methods inherited from class org.eclipse.draw2d.geometry.Rectangle |
|---|
bottom, contains, contains, expand, expand, getBottom, getBottomLeft, getBottomRight, getCropped, getExpanded, getExpanded, getIntersection, getLeft, getLocation, getPosition, getResized, getResized, getRight, getSize, getTop, getTopLeft, getTopRight, getTranslated, getTranslated, getTransposed, getUnion, hashCode, intersect, intersects, isEmpty, resize, right, scale, scale, setBounds, setLocation, setSize, toString, touches, translate, union, union, union |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public double preciseHeight
public double preciseWidth
public double preciseX
public double preciseY
| Constructor Detail |
|---|
public PrecisionRectangle()
public PrecisionRectangle(Rectangle rect)
rect - the base rectangle| Method Detail |
|---|
public Rectangle getCopy()
Rectangle
getCopy in class RectangleRectangle.getCopy()public PrecisionRectangle getPreciseCopy()
public Rectangle crop(Insets insets)
Rectangleinsets.
crop in class Rectangleinsets - Insets to be removed from the Rectangle
this for convenienceRectangle.crop(org.eclipse.draw2d.geometry.Insets)public boolean equals(Object o)
Rectangle
equals in class Rectangleo - Object being tested for equality
Rectangle.equals(Object)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 preciseRight()
public Rectangle resize(Dimension sizeDelta)
Rectangle
resize in class RectanglesizeDelta - Resize data as a Dimension
this for convenienceRectangle.resize(org.eclipse.draw2d.geometry.Dimension)public void setHeight(double value)
value - the new heightpublic void setWidth(double value)
value - the new widthpublic void setX(double value)
value - the new x valuepublic void setY(double value)
value - the new y valuepublic Rectangle translate(Point p)
Rectangle
translate in class Rectanglep - Point which provides translation information
this for convenienceRectangle.translate(org.eclipse.draw2d.geometry.Point)public PrecisionRectangle union(PrecisionRectangle other)
union(Rectangle) instead
this for convenience.
other - the rectangle being unioned
this for conveniencepublic Rectangle union(Rectangle other)
Rectangle
union in class Rectangleother - Rectangle to be unioned with this Rectangle
this for convenienceRectangle.union(org.eclipse.draw2d.geometry.Rectangle)public void updateInts()
public void union(Point p)
Rectangle
union in class Rectanglep - Point to be unioned with this RectangleRectangle.union(org.eclipse.draw2d.geometry.Point)public Rectangle transpose()
Rectangle
transpose in class Rectanglethis for convenienceRectangle.transpose()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 Point getCenter()
getCenter in class RectanglePrecisionPoint geometric center of the rectangle
public Rectangle shrink(double h,
double v)
h - Horizontal reduction amountv - Vertical reduction amount
this for convenience
public Rectangle expand(double h,
double v)
h - Horizontal incrementv - Vertical increment
this for convenience
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 contains(Point p)
Rectangle
contains in class Rectanglep - Point being tested for containment
Rectangle.contains(org.eclipse.draw2d.geometry.Point)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 double preciseWidth()
Rectangledouble width
preciseWidth in class Rectangledouble widthRectangle.preciseWidth()public double preciseHeight()
Rectangledouble height
preciseHeight in class Rectangledouble heightRectangle.preciseHeight()public Rectangle setSize(Dimension d)
Rectangle
setSize in class Rectangled - The new Dimension
this for convenienceRectangle.setSize(org.eclipse.draw2d.geometry.Dimension)
|
Eclipse Draw2d 3.3 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||