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 TypeFieldDescriptiondoubleThe height of thisRectangle.static final intThe bitmask that indicates that a point lies below thisRectangle2D.static final intThe bitmask that indicates that a point lies to the left of thisRectangle2D.static final intThe bitmask that indicates that a point lies to the right of thisRectangle2D.static final intThe bitmask that indicates that a point lies above thisRectangle2D.doubleThe width of thisRectangle.doubleThe x coordinate of thisRectangle.doubleThe 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 aRectanglefrom the specified Rectangle coordinates.Rectangle(BoundingBox bb) -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns a newRectangleobject representing the intersection of thisRectanglewith the specifiedRectangle.Returns a newRectangleobject representing the union of thisRectanglewith the specifiedRectangle.Returns the high precision bounding box of thisRectangle.doubleReturns the height of thisRectanglein Rectangle precision.doublegetMaxX()Returns the largest X coordinate of the framing rectangle of theRectangleindoubleprecision.doublegetMaxY()Returns the largest Y coordinate of the framing rectangle of theRectangleindoubleprecision.doublegetMinX()Returns the smallest X coordinate of the framing rectangle of theRectangleindoubleprecision.doublegetMinY()Returns the smallest Y coordinate of the framing rectangle of theRectangleindoubleprecision.doublegetWidth()Returns the width of thisRectanglein Rectangle precision.doublegetX()Returns the X coordinate of thisRectanglein Rectangle precision.doublegetY()Returns the Y coordinate of thisRectanglein Rectangle precision.booleanisEmpty()Determines whether or not thisRectangleis empty.intoutcode(double x, double y) Determines where the specified Rectangle coordinates lie with respect to thisRectangle.voidsetRect(double x, double y, double w, double h) Sets the location and size of thisRectangleto the specified Rectangle values.voidSets thisRectangleto be the same as the specifiedRectangle.toString()Returns theStringrepresentation of thisRectangle.voidstatic 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 aRectanglefrom the specified Rectangle coordinates.- Parameters:
x- , y the coordinates of the upper left corner of the newly constructedRectanglew- the width of the newly constructedRectangleh- the height of the newly constructedRectangle
-
-
Method Details
-
getBounds
-
getX
public double getX()Returns the X coordinate of thisRectanglein Rectangle precision.- Returns:
- the X coordinate of this
Rectangle.
-
getY
public double getY()Returns the Y coordinate of thisRectanglein Rectangle precision.- Returns:
- the Y coordinate of this
Rectangle.
-
getWidth
public double getWidth()Returns the width of thisRectanglein Rectangle precision.- Returns:
- the width of this
Rectangle.
-
getHeight
public double getHeight()Returns the height of thisRectanglein Rectangle precision.- Returns:
- the height of this
Rectangle.
-
isEmpty
public boolean isEmpty()Determines whether or not thisRectangleis empty.- Returns:
trueif thisRectangleis empty;falseotherwise.
-
setRect
public void setRect(double x, double y, double w, double h) Sets the location and size of thisRectangleto the specified Rectangle values.- Parameters:
x- , y the coordinates to which to set the upper left corner of thisRectanglew- the value to use to set the width of thisdoubleh- the value to use to set the height of thisdouble
-
setRect
Sets thisRectangleto 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 newRectangleobject representing the intersection of thisRectanglewith the specifiedRectangle.- Parameters:
r- theRectangleto be intersected with thisRectangle- Returns:
- the largest
Rectanglecontained in both the specifiedRectangleand in thisRectangle.
-
createUnion
Returns a newRectangleobject representing the union of thisRectanglewith the specifiedRectangle.- Parameters:
r- theRectangleto be combined with thisRectangle- Returns:
- the smallest
Rectanglecontaining both the specifiedRectangleand thisRectangle.
-
union
-
union
-
toString
Returns theStringrepresentation of thisRectangle. -
getMinX
public double getMinX()Returns the smallest X coordinate of the framing rectangle of theRectangleindoubleprecision.- 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 theRectangleindoubleprecision.- 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 theRectangleindoubleprecision.- 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 theRectangleindoubleprecision.- Returns:
- the largest y coordinate of the framing rectangle of the
Rectangle.
-
contains
-