|
Eclipse Draw2d 3.8.0.201206011245 |
|||||||||
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(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. |
Methods inherited from class org.eclipse.draw2d.geometry.Rectangle |
---|
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, 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 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 rectangleMethod Detail |
---|
public boolean contains(double x, double y)
Rectangle
contains
in class Rectangle
x
- X valuey
- Y value
Rectangle.contains(double, double)
public boolean contains(int x, int y)
Rectangle
contains
in class Rectangle
x
- X valuey
- Y value
Rectangle.contains(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 boolean contains(Rectangle rect)
Rectangle
true
if the given rectangle is contained within the
boundaries of this Rectangle.
contains
in class Rectangle
rect
- the Rectangle to test
Rectangle.contains(org.eclipse.draw2d.geometry.Rectangle)
public boolean equals(java.lang.Object o)
Rectangle
equals
in class Rectangle
o
- Object being tested for equality
Rectangle.equals(Object)
public Rectangle expand(double h, double v)
expand
in class Rectangle
h
- Horizontal incrementv
- Vertical increment
this
for conveniencepublic Rectangle expand(Insets insets)
Rectangle
expand
in class Rectangle
insets
- 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 Rectangle
h
- Horizontal incrementv
- Vertical increment
this
for convenienceRectangle.expand(int, int)
public Point getBottom()
Rectangle
getBottom
in class Rectangle
Rectangle.getBottom()
public Point getBottomLeft()
Rectangle
getBottomLeft
in class Rectangle
Rectangle.getBottomLeft()
public Point getBottomRight()
Rectangle
getBottomRight
in class Rectangle
Rectangle.getBottomRight()
public Point getCenter()
Rectangle
getCenter
in class Rectangle
Rectangle.getCenter()
public Rectangle getCopy()
Rectangle
getCopy
in class Rectangle
Rectangle.getCopy()
public PrecisionRectangle getPreciseCopy()
public Point getTop()
Rectangle
getTop
in class Rectangle
Rectangle.getTop()
public Point getTopLeft()
Rectangle
getTopLeft
in class Rectangle
Rectangle.getTopLeft()
public Point getTopRight()
Rectangle
getTopRight
in class Rectangle
Rectangle.getTopRight()
public Rectangle intersect(Rectangle rect)
Rectangle
intersect
in class Rectangle
rect
- Rectangle for the calculating intersection.
this
for convenienceRectangle.intersect(org.eclipse.draw2d.geometry.Rectangle)
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 preciseHeight()
Rectangle
double
height
preciseHeight
in class Rectangle
double
heightRectangle.preciseHeight()
public double preciseRight()
public double preciseWidth()
Rectangle
double
width
preciseWidth
in class Rectangle
double
widthRectangle.preciseWidth()
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 Rectangle resize(Dimension d)
Rectangle
resize
in class Rectangle
d
- Resize data as a Dimension
this
for convenienceRectangle.resize(org.eclipse.draw2d.geometry.Dimension)
public Rectangle resize(double w, double h)
Rectangle
resize
in class Rectangle
w
- Amount by which width is to be resizedh
- Amount by which height is to be resized
this
for convenienceRectangle.resize(double, double)
public Rectangle resize(int w, int h)
Rectangle
resize
in class Rectangle
w
- 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 Rectangle
x
- 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 Rectangle
location
- 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 Rectangle
rect
- 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 Rectangle
height
- The new height
Rectangle.setHeight(int)
public Rectangle setLocation(int x, int y)
Rectangle
setLocation
in class Rectangle
x
- The new X coordinatey
- The new Y coordinate
this
for convenienceRectangle.setLocation(int, int)
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 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 Rectangle
d
- The new Dimension
this
for convenienceRectangle.setSize(org.eclipse.draw2d.geometry.Dimension)
public Rectangle setSize(int w, int h)
Rectangle
setSize
in class Rectangle
w
- 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 Rectangle
width
- 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 Rectangle
value
- 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 Rectangle
value
- The new y value
this
for convenienceRectangle.setY(int)
public Rectangle shrink(double h, double v)
shrink
in class Rectangle
h
- Horizontal reduction amountv
- Vertical reduction amount
this
for conveniencepublic Rectangle shrink(Insets insets)
Rectangle
insets
.
shrink
in class Rectangle
insets
- 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 Rectangle
h
- Horizontal reduction amountv
- Vertical reduction amount
this
for convenienceRectangle.shrink(int, int)
public boolean touches(Rectangle rect)
Rectangle
true
if the input Rectangle touches this Rectangle.
touches
in class Rectangle
rect
- Rectangle being checked for contact
true
if rect touches this RectangleRectangle.touches(org.eclipse.draw2d.geometry.Rectangle)
public Rectangle translate(double dx, double dy)
Rectangle
translate
in class Rectangle
dx
- Shift along X axisdy
- Shift along Y axis
this
for convenienceRectangle.translate(double, double)
public Rectangle translate(int dx, int dy)
Rectangle
translate
in class Rectangle
dx
- Shift along X axisdy
- Shift along Y axis
this
for convenienceRectangle.translate(int, int)
public 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 Rectangle transpose()
Rectangle
transpose
in class Rectangle
this
for convenienceRectangle.transpose()
public Rectangle union(double x, double y)
Rectangle
union
in class Rectangle
x
- X coordinatey
- Y coordinate
this
for convenienceRectangle.union(double, double)
public Rectangle union(double x, double y, double w, double h)
Rectangle
union
in class Rectangle
x
- 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)
Rectangle
union
in class Rectangle
x
- X coordinatey
- Y coordinate
this
for convenienceRectangle.union(int, int)
public Rectangle union(int x, int y, int w, int h)
Rectangle
union
in class Rectangle
x
- 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)
Rectangle
union
in class Rectangle
p
- 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 Rectangle
rect
- 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.8.0.201206011245 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |