Class Rectangle

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

public class Rectangle extends Object
The Rectangle class defines a rectangle specified in Rectangle coordinates.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    double
    The height of this Rectangle.
    static final int
    The bitmask that indicates that a point lies below this Rectangle2D.
    static final int
    The bitmask that indicates that a point lies to the left of this Rectangle2D.
    static final int
    The bitmask that indicates that a point lies to the right of this Rectangle2D.
    static final int
    The bitmask that indicates that a point lies above this Rectangle2D.
    double
    The width of this Rectangle.
    double
    The x coordinate of this Rectangle.
    double
    The y coordinate of this Rectangle.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new Rectangle, initialized to location (0, 0) and size (0, 0).
    Rectangle(double x, double y, double w, double h)
    Constructs and initializes a Rectangle from the specified Rectangle coordinates.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    Returns a new Rectangle object representing the intersection of this Rectangle with the specified Rectangle.
    Returns a new Rectangle object representing the union of this Rectangle with the specified Rectangle.
     
    Returns the high precision bounding box of this Rectangle.
    double
    Returns the height of this Rectangle in Rectangle precision.
    double
    Returns the largest X coordinate of the framing rectangle of the Rectangle in double precision.
    double
    Returns the largest Y coordinate of the framing rectangle of the Rectangle in double precision.
    double
    Returns the smallest X coordinate of the framing rectangle of the Rectangle in double precision.
    double
    Returns the smallest Y coordinate of the framing rectangle of the Rectangle in double precision.
    double
    Returns the width of this Rectangle in Rectangle precision.
    double
    Returns the X coordinate of this Rectangle in Rectangle precision.
    double
    Returns the Y coordinate of this Rectangle in Rectangle precision.
    boolean
    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
    Sets this Rectangle to be the same as the specified Rectangle.
    Returns the String representation of this Rectangle.
    void
     
    static Rectangle
    union(Rectangle rect1, Rectangle rect2)
     

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • OUT_LEFT

      public static final int OUT_LEFT
      The bitmask that indicates that a point lies to the left of this Rectangle2D.
      See Also:
    • OUT_TOP

      public static final int OUT_TOP
      The bitmask that indicates that a point lies above this Rectangle2D.
      See Also:
    • OUT_RIGHT

      public static final int OUT_RIGHT
      The bitmask that indicates that a point lies to the right of this Rectangle2D.
      See Also:
    • OUT_BOTTOM

      public static final int OUT_BOTTOM
      The bitmask that indicates that a point lies below this Rectangle2D.
      See Also:
    • 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 Details

    • 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 Details

    • 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:
    • 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 String toString()
      Returns the String representation of this Rectangle.
      Overrides:
      toString in class 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)