org.eclipse.birt.chart.computation
Class Rectangle

java.lang.Object
  extended by org.eclipse.birt.chart.computation.Rectangle

public class Rectangle
extends java.lang.Object

The Rectangle class defines a rectangle specified in Rectangle coordinates.


Field Summary
 double height
          The height of this Rectangle.
static int OUT_BOTTOM
          The bitmask that indicates that a point lies below this Rectangle2D.
static int OUT_LEFT
          The bitmask that indicates that a point lies to the left of this Rectangle2D.
static int OUT_RIGHT
          The bitmask that indicates that a point lies to the right of this Rectangle2D.
static int OUT_TOP
          The bitmask that indicates that a point lies above this Rectangle2D.
 double width
          The width of this Rectangle.
 double x
          The x coordinate of this Rectangle.
 double y
          The y coordinate of this Rectangle.
 
Constructor Summary
Rectangle()
          Constructs a new Rectangle, initialized to location (0, 0) and size (0, 0).
Rectangle(BoundingBox bb)
           
Rectangle(double x, double y, double w, double h)
          Constructs and initializes a Rectangle from the specified Rectangle coordinates.
 
Method Summary
 boolean contains(Point lo)
           
 Rectangle createIntersection(Rectangle r)
          Returns a new Rectangle object representing the intersection of this Rectangle with the specified Rectangle.
 Rectangle createUnion(Rectangle r)
          Returns a new Rectangle object representing the union of this Rectangle with the specified Rectangle.
 Bounds getBounds()
           
 Rectangle getBounds2D()
          Returns the high precision bounding box of this Rectangle.
 double getHeight()
          Returns the height of this Rectangle in Rectangle precision.
 double getMaxX()
          Returns the largest X coordinate of the framing rectangle of the Rectangle in double precision.
 double getMaxY()
          Returns the largest Y coordinate of the framing rectangle of the Rectangle in double precision.
 double getMinX()
          Returns the smallest X coordinate of the framing rectangle of the Rectangle in double precision.
 double getMinY()
          Returns the smallest Y coordinate of the framing rectangle of the Rectangle in double precision.
 double getWidth()
          Returns the width of this Rectangle in Rectangle precision.
 double getX()
          Returns the X coordinate of this Rectangle in Rectangle precision.
 double getY()
          Returns the Y coordinate of this Rectangle in Rectangle precision.
 boolean isEmpty()
          Determines whether or not this Rectangle is empty.
 int outcode(double x, double y)
          Determines where the specified Rectangle coordinates lie with respect to this Rectangle.
 void setRect(double x, double y, double w, double h)
          Sets the location and size of this Rectangle to the specified Rectangle values.
 void setRect(Rectangle r)
          Sets this Rectangle to be the same as the specified Rectangle.
 java.lang.String toString()
          Returns the String representation of this Rectangle.
 void union(Rectangle rect)
           
static Rectangle union(Rectangle rect1, Rectangle rect2)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

OUT_LEFT

public static final int OUT_LEFT
The bitmask that indicates that a point lies to the left of this Rectangle2D.

See Also:
Constant Field Values

OUT_TOP

public static final int OUT_TOP
The bitmask that indicates that a point lies above this Rectangle2D.

See Also:
Constant Field Values

OUT_RIGHT

public static final int OUT_RIGHT
The bitmask that indicates that a point lies to the right of this Rectangle2D.

See Also:
Constant Field Values

OUT_BOTTOM

public static final int OUT_BOTTOM
The bitmask that indicates that a point lies below this Rectangle2D.

See Also:
Constant Field Values

x

public double x
The x coordinate of this Rectangle.


y

public double y
The y coordinate of this Rectangle.


width

public double width
The width of this Rectangle.


height

public double height
The height of this Rectangle.

Constructor Detail

Rectangle

public Rectangle()
Constructs a new Rectangle, initialized to location (0, 0) and size (0, 0).


Rectangle

public Rectangle(BoundingBox bb)

Rectangle

public Rectangle(double x,
                 double y,
                 double w,
                 double h)
Constructs and initializes a Rectangle from the specified Rectangle coordinates.

Parameters:
x, y - the coordinates of the upper left corner of the newly constructed Rectangle
w - the width of the newly constructed Rectangle
h - the height of the newly constructed Rectangle
Method Detail

getBounds

public Bounds getBounds()

getX

public double getX()
Returns the X coordinate of this Rectangle in Rectangle precision.

Returns:
the X coordinate of this Rectangle.

getY

public double getY()
Returns the Y coordinate of this Rectangle in Rectangle precision.

Returns:
the Y coordinate of this Rectangle.

getWidth

public double getWidth()
Returns the width of this Rectangle in Rectangle precision.

Returns:
the width of this Rectangle.

getHeight

public double getHeight()
Returns the height of this Rectangle in Rectangle precision.

Returns:
the height of this Rectangle.

isEmpty

public boolean isEmpty()
Determines whether or not this Rectangle is empty.

Returns:
true if this Rectangle is empty; false otherwise.

setRect

public void setRect(double x,
                    double y,
                    double w,
                    double h)
Sets the location and size of this Rectangle to the specified Rectangle values.

Parameters:
x, y - the coordinates to which to set the upper left corner of this Rectangle
w - the value to use to set the width of this double
h - the value to use to set the height of this double

setRect

public void setRect(Rectangle r)
Sets this Rectangle to be the same as the specified Rectangle.

Parameters:
r - the specified Rectangle

outcode

public int outcode(double x,
                   double y)
Determines where the specified Rectangle coordinates lie with respect to this Rectangle. This method computes a binary OR of the appropriate mask values indicating, for each side of this Rectangle, whether or not the specified coordinates are on the same side of the edge as the rest of this Rectangle.

Parameters:
x, y - the specified coordinates
Returns:
the logical OR of all appropriate out codes.
See Also:
OUT_LEFT, OUT_TOP, OUT_RIGHT, OUT_BOTTOM

getBounds2D

public Rectangle getBounds2D()
Returns the high precision bounding box of this Rectangle.

Returns:
the bounding box of this Rectangle.

createIntersection

public Rectangle createIntersection(Rectangle r)
Returns a new Rectangle object representing the intersection of this Rectangle with the specified Rectangle.

Parameters:
r - the Rectangle to be intersected with this Rectangle
Returns:
the largest Rectangle contained in both the specified Rectangle and in this Rectangle.

createUnion

public Rectangle createUnion(Rectangle r)
Returns a new Rectangle object representing the union of this Rectangle with the specified Rectangle.

Parameters:
r - the Rectangle to be combined with this Rectangle
Returns:
the smallest Rectangle containing both the specified Rectangle and this Rectangle.

union

public static Rectangle union(Rectangle rect1,
                              Rectangle rect2)

union

public void union(Rectangle rect)

toString

public java.lang.String toString()
Returns the String representation of this Rectangle.

Overrides:
toString in class java.lang.Object
Returns:
a String representing this Rectangle.

getMinX

public double getMinX()
Returns the smallest X coordinate of the framing rectangle of the Rectangle in double precision.

Returns:
the smallest x coordinate of the framing rectangle of the Rectangle.

getMinY

public double getMinY()
Returns the smallest Y coordinate of the framing rectangle of the Rectangle in double precision.

Returns:
the smallest y coordinate of the framing rectangle of the Rectangle.

getMaxX

public double getMaxX()
Returns the largest X coordinate of the framing rectangle of the Rectangle in double precision.

Returns:
the largest x coordinate of the framing rectangle of the Rectangle.

getMaxY

public double getMaxY()
Returns the largest Y coordinate of the framing rectangle of the Rectangle in double precision.

Returns:
the largest y coordinate of the framing rectangle of the Rectangle.

contains

public boolean contains(Point lo)


Copyright © 2005-2008 Actuate Corp. All rights reserved.