Class Rectangle
java.lang.Object
org.eclipse.birt.chart.computation.Rectangle
The
Rectangle
class defines a rectangle specified in Rectangle
coordinates.-
Field Summary
FieldsModifier and TypeFieldDescriptiondouble
The height of thisRectangle
.static final int
The bitmask that indicates that a point lies below thisRectangle2D
.static final int
The bitmask that indicates that a point lies to the left of thisRectangle2D
.static final int
The bitmask that indicates that a point lies to the right of thisRectangle2D
.static final int
The bitmask that indicates that a point lies above thisRectangle2D
.double
The width of thisRectangle
.double
The x coordinate of thisRectangle
.double
The y coordinate of thisRectangle
. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newRectangle
, initialized to location (0, 0) and size (0, 0).Rectangle
(double x, double y, double w, double h) Constructs and initializes aRectangle
from the specified Rectangle coordinates.Rectangle
(BoundingBox bb) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns a newRectangle
object representing the intersection of thisRectangle
with the specifiedRectangle
.Returns a newRectangle
object representing the union of thisRectangle
with the specifiedRectangle
.Returns the high precision bounding box of thisRectangle
.double
Returns the height of thisRectangle
in Rectangle precision.double
getMaxX()
Returns the largest X coordinate of the framing rectangle of theRectangle
indouble
precision.double
getMaxY()
Returns the largest Y coordinate of the framing rectangle of theRectangle
indouble
precision.double
getMinX()
Returns the smallest X coordinate of the framing rectangle of theRectangle
indouble
precision.double
getMinY()
Returns the smallest Y coordinate of the framing rectangle of theRectangle
indouble
precision.double
getWidth()
Returns the width of thisRectangle
in Rectangle precision.double
getX()
Returns the X coordinate of thisRectangle
in Rectangle precision.double
getY()
Returns the Y coordinate of thisRectangle
in Rectangle precision.boolean
isEmpty()
Determines whether or not thisRectangle
is empty.int
outcode
(double x, double y) Determines where the specified Rectangle coordinates lie with respect to thisRectangle
.void
setRect
(double x, double y, double w, double h) Sets the location and size of thisRectangle
to the specified Rectangle values.void
Sets thisRectangle
to be the same as the specifiedRectangle
.toString()
Returns theString
representation of thisRectangle
.void
static Rectangle
-
Field Details
-
OUT_LEFT
public static final int OUT_LEFTThe bitmask that indicates that a point lies to the left of thisRectangle2D
.- See Also:
-
OUT_TOP
public static final int OUT_TOPThe bitmask that indicates that a point lies above thisRectangle2D
.- See Also:
-
OUT_RIGHT
public static final int OUT_RIGHTThe bitmask that indicates that a point lies to the right of thisRectangle2D
.- See Also:
-
OUT_BOTTOM
public static final int OUT_BOTTOMThe bitmask that indicates that a point lies below thisRectangle2D
.- See Also:
-
x
public double xThe x coordinate of thisRectangle
. -
y
public double yThe y coordinate of thisRectangle
. -
width
public double widthThe width of thisRectangle
. -
height
public double heightThe height of thisRectangle
.
-
-
Constructor Details
-
Rectangle
public Rectangle()Constructs a newRectangle
, initialized to location (0, 0) and size (0, 0). -
Rectangle
-
Rectangle
public Rectangle(double x, double y, double w, double h) Constructs and initializes aRectangle
from the specified Rectangle coordinates.- Parameters:
x
- , y the coordinates of the upper left corner of the newly constructedRectangle
w
- the width of the newly constructedRectangle
h
- the height of the newly constructedRectangle
-
-
Method Details
-
getBounds
-
getX
public double getX()Returns the X coordinate of thisRectangle
in Rectangle precision.- Returns:
- the X coordinate of this
Rectangle
.
-
getY
public double getY()Returns the Y coordinate of thisRectangle
in Rectangle precision.- Returns:
- the Y coordinate of this
Rectangle
.
-
getWidth
public double getWidth()Returns the width of thisRectangle
in Rectangle precision.- Returns:
- the width of this
Rectangle
.
-
getHeight
public double getHeight()Returns the height of thisRectangle
in Rectangle precision.- Returns:
- the height of this
Rectangle
.
-
isEmpty
public boolean isEmpty()Determines whether or not thisRectangle
is empty.- Returns:
true
if thisRectangle
is empty;false
otherwise.
-
setRect
public void setRect(double x, double y, double w, double h) Sets the location and size of thisRectangle
to the specified Rectangle values.- Parameters:
x
- , y the coordinates to which to set the upper left corner of thisRectangle
w
- the value to use to set the width of thisdouble
h
- the value to use to set the height of thisdouble
-
setRect
Sets thisRectangle
to be the same as the specifiedRectangle
.- Parameters:
r
- the specifiedRectangle
-
outcode
public int outcode(double x, double y) Determines where the specified Rectangle coordinates lie with respect to thisRectangle
. This method computes a binary OR of the appropriate mask values indicating, for each side of thisRectangle
, whether or not the specified coordinates are on the same side of the edge as the rest of thisRectangle
.- Parameters:
x
- , y the specified coordinates- Returns:
- the logical OR of all appropriate out codes.
- See Also:
-
getBounds2D
Returns the high precision bounding box of thisRectangle
.- Returns:
- the bounding box of this
Rectangle
.
-
createIntersection
Returns a newRectangle
object representing the intersection of thisRectangle
with the specifiedRectangle
.- Parameters:
r
- theRectangle
to be intersected with thisRectangle
- Returns:
- the largest
Rectangle
contained in both the specifiedRectangle
and in thisRectangle
.
-
createUnion
Returns a newRectangle
object representing the union of thisRectangle
with the specifiedRectangle
.- Parameters:
r
- theRectangle
to be combined with thisRectangle
- Returns:
- the smallest
Rectangle
containing both the specifiedRectangle
and thisRectangle
.
-
union
-
union
-
toString
Returns theString
representation of thisRectangle
. -
getMinX
public double getMinX()Returns the smallest X coordinate of the framing rectangle of theRectangle
indouble
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 theRectangle
indouble
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 theRectangle
indouble
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 theRectangle
indouble
precision.- Returns:
- the largest y coordinate of the framing rectangle of the
Rectangle
.
-
contains
-