|
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 rectangleMethod Detail |
---|
public Rectangle getCopy()
Rectangle
getCopy
in class Rectangle
Rectangle.getCopy()
public PrecisionRectangle getPreciseCopy()
public Rectangle crop(Insets insets)
Rectangle
insets
.
crop
in class Rectangle
insets
- 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 Rectangle
o
- Object being tested for equality
Rectangle.equals(Object)
public void performScale(double factor)
Translatable
performScale
in interface Translatable
performScale
in class Rectangle
factor
- The scale factorRectangle.performScale(double)
public void performTranslate(int dx, int dy)
Translatable
dx
and vertically by
dy
.
performTranslate
in interface Translatable
performTranslate
in class Rectangle
dx
- 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 Rectangle
sizeDelta
- 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 Rectangle
p
- 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 Rectangle
other
- 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 Rectangle
p
- Point to be unioned with this RectangleRectangle.union(org.eclipse.draw2d.geometry.Point)
public Rectangle transpose()
Rectangle
transpose
in class Rectangle
this
for convenienceRectangle.transpose()
public Rectangle setLocation(Point loc)
Rectangle
setLocation
in class Rectangle
loc
- New position of this Rectangle
this
for convenienceRectangle.setLocation(org.eclipse.draw2d.geometry.Point)
public Point getCenter()
getCenter
in class Rectangle
PrecisionPoint
geometric center of the rectanglepublic Rectangle shrink(double h, double v)
h
- Horizontal reduction amountv
- Vertical reduction amount
this
for conveniencepublic Rectangle expand(double h, double v)
h
- Horizontal incrementv
- Vertical increment
this
for conveniencepublic Rectangle shrink(int h, int v)
Rectangle
shrink
in class Rectangle
h
- Horizontal reduction amountv
- Vertical reduction amount
this
for convenienceRectangle.shrink(int, int)
public boolean contains(Point p)
Rectangle
contains
in class Rectangle
p
- Point being tested for containment
Rectangle.contains(org.eclipse.draw2d.geometry.Point)
public double preciseX()
Rectangle
double
x coordinate
preciseX
in class Rectangle
double
x coordinateRectangle.preciseX()
public double preciseY()
Rectangle
double
y coordinate
preciseY
in class Rectangle
double
y coordinateRectangle.preciseY()
public double preciseWidth()
Rectangle
double
width
preciseWidth
in class Rectangle
double
widthRectangle.preciseWidth()
public double preciseHeight()
Rectangle
double
height
preciseHeight
in class Rectangle
double
heightRectangle.preciseHeight()
public Rectangle setSize(Dimension d)
Rectangle
setSize
in class Rectangle
d
- 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 |