Eclipse Draw2d 3.3

## org.eclipse.draw2d.geometry
Class PrecisionRectangle

    java.lang.Object
      org.eclipse.draw2d.geometry.Rectangle
          org.eclipse.draw2d.geometry.PrecisionRectangle

All Implemented Interfaces:
  Cloneable, Serializable, Translatable

public final class PrecisionRectangle
extends Rectangle

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.

See Also:
  Serialized Form

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
`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` `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` `preciseRight()` Returns the right side in double precision.
`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.
`void` `setWidth(double value)` Sets the width.
`void` `setX(double value)` Sets the x value.
`void` `setY(double value)` Sets the y value.
`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.
`PrecisionRectangle` `union(PrecisionRectangle other)` Unions the given PrecisionRectangle with this rectangle and returns `this` for convenience.
`void` `updateInts()` Updates the integer values based on the current precise values.

Methods inherited from class org.eclipse.draw2d.geometry.Rectangle

`bottom, contains, contains, contains, expand, expand, getBottom, getBottomLeft, getBottomRight, getCenter, 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, setLocation, setSize, setSize, shrink, toString, touches, translate, transpose, union, union, union, union, union`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### preciseHeight

    public double preciseHeight

  Double value for height

### preciseWidth

    public double preciseWidth

  Double value for width

### preciseX

    public double preciseX

  Double value for X

### preciseY

    public double preciseY

  Double value for Y

Constructor Detail

### PrecisionRectangle

    public PrecisionRectangle()

  Constructs a new PrecisionRectangle with all values 0.

### PrecisionRectangle

    public PrecisionRectangle(Rectangle rect)

  Constructs a new PrecisionRectangle from the given integer Rectangle.

Parameters:
  `rect` - the base rectangle

Method Detail

### getCopy

    public Rectangle getCopy()

  Description copied from class: `Rectangle`
  Returns a new Rectangle which has the exact same parameters as this Rectangle.

  Overrides:
    `getCopy` in class `Rectangle`
  Returns:
    Copy of this Rectangle
  See Also:
    `Rectangle.getCopy()`

### getPreciseCopy

    public PrecisionRectangle getPreciseCopy()

  Returns a precise copy of this.

  Returns:
    a precise copy

### crop

    public Rectangle crop(Insets insets)

  Description copied from class: `Rectangle`
  Crops this rectangle by the amount specified in `insets`.

  Overrides:
    `crop` in class `Rectangle`
  Parameters:
    `insets` - Insets to be removed from the Rectangle
  Returns:
    `this` for convenience
  See Also:
    `Rectangle.crop(org.eclipse.draw2d.geometry.Insets)`

### equals

    public boolean equals(Object o)

  Description copied from class: `Rectangle`
  Returns whether the input object is equal to this Rectangle or not. Rectangles are equivalent if their x, y, height, and width values are the same.

  Overrides:
    `equals` in class `Rectangle`
  Parameters:
    `o` - Object being tested for equality
  Returns:
    Returns the result of the equality test
  See Also:
    `Rectangle.equals(Object)`

### performScale

    public void performScale(double factor)

  Description copied from interface: `Translatable`
  Scales this object by the scale factor.

  Specified by:
    `performScale` in interface `Translatable`
  Overrides:
    `performScale` in class `Rectangle`
  See Also:
    `Rectangle.performScale(double)`

### performTranslate

    public void performTranslate(int dx,
                                 int dy)

  Description copied from interface: `Translatable`
  Translates this object horizontally by `dx` and vertically by `dy`.

  Specified by:
    `performTranslate` in interface `Translatable`
  Overrides:
    `performTranslate` in class `Rectangle`
  See Also:
    `Rectangle.performTranslate(int, int)`

### preciseBottom

    public double preciseBottom()

  Returns the bottom coordinte in double precision.

  Returns:
    the precise bottom

### preciseRight

    public double preciseRight()

  Returns the right side in double precision.

  Returns:
    the precise right

### resize

    public Rectangle resize(Dimension sizeDelta)

  Description copied from class: `Rectangle`
  Resizes this Rectangle by the Dimension provided as input and returns this for convenience. This Rectange's width will become this.width + sizeDelta.width. Likewise for height.

  Overrides:
    `resize` in class `Rectangle`
  Parameters:
    `sizeDelta` - Resize data as a Dimension
  Returns:
    `this` for convenience
  See Also:
    `Rectangle.resize(org.eclipse.draw2d.geometry.Dimension)`

### setHeight

    public void setHeight(double value)

  Sets the height.

  Parameters:
    `value` - the new height

### setWidth

    public void setWidth(double value)

  Sets the width.

  Parameters:
    `value` - the new width

### setX

    public void setX(double value)

  Sets the x value.

  Parameters:
    `value` - the new x value

### setY

    public void setY(double value)

  Sets the y value.

  Parameters:
    `value` - the new y value

### translate

    public Rectangle translate(Point p)

  Description copied from class: `Rectangle`
  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.

  Overrides:
    `translate` in class `Rectangle`
  Parameters:
    `p` - Point which provides translation information
  Returns:
    `this` for convenience
  See Also:
    `Rectangle.translate(org.eclipse.draw2d.geometry.Point)`

### union

    public PrecisionRectangle union(PrecisionRectangle other)

  Unions the given PrecisionRectangle with this rectangle and returns `this` for convenience.

  Parameters:
    `other` - the rectangle being unioned
  Returns:
    `this` for convenience
  Since:
    3.0

### updateInts

    public void updateInts()

  Updates the integer values based on the current precise values. The integer values ar the floor of the double values. This is called automatically when calling api which is overridden in this class.

  Since:
    3.0

Eclipse Draw2d 3.3

Copyright (c) IBM Corp. and others 2000, 2007. All Rights Reserved.