org.apache.fontbox.util

Class BoundingBox

public class BoundingBox extends Object

This is an implementation of a bounding box. This was originally written for the AMF parser.

Version: $Revision: 1.1 $

Author: Ben Litchfield (ben@benlitchfield.com)

Method Summary
booleancontains(float x, float y)
Checks if a point is inside this rectangle.
booleancontains(Point point)
Checks if a point is inside this rectangle.
floatgetHeight()
This will get the height of this rectangle as calculated by upperRightY - lowerLeftY.
floatgetLowerLeftX()
Getter for property lowerLeftX.
floatgetLowerLeftY()
Getter for property lowerLeftY.
floatgetUpperRightX()
Getter for property upperRightX.
floatgetUpperRightY()
Getter for property upperRightY.
floatgetWidth()
This will get the width of this rectangle as calculated by upperRightX - lowerLeftX.
voidsetLowerLeftX(float lowerLeftXValue)
Setter for property lowerLeftX.
voidsetLowerLeftY(float lowerLeftYValue)
Setter for property lowerLeftY.
voidsetUpperRightX(float upperRightXValue)
Setter for property upperRightX.
voidsetUpperRightY(float upperRightYValue)
Setter for property upperRightY.
StringtoString()
This will return a string representation of this rectangle.

Method Detail

contains

public boolean contains(float x, float y)
Checks if a point is inside this rectangle.

Parameters: x The x coordinate. y The y coordinate.

Returns: true If the point is on the edge or inside the rectangle bounds.

contains

public boolean contains(Point point)
Checks if a point is inside this rectangle.

Parameters: point The point to check

Returns: true If the point is on the edge or inside the rectangle bounds.

getHeight

public float getHeight()
This will get the height of this rectangle as calculated by upperRightY - lowerLeftY.

Returns: The height of this rectangle.

getLowerLeftX

public float getLowerLeftX()
Getter for property lowerLeftX.

Returns: Value of property lowerLeftX.

getLowerLeftY

public float getLowerLeftY()
Getter for property lowerLeftY.

Returns: Value of property lowerLeftY.

getUpperRightX

public float getUpperRightX()
Getter for property upperRightX.

Returns: Value of property upperRightX.

getUpperRightY

public float getUpperRightY()
Getter for property upperRightY.

Returns: Value of property upperRightY.

getWidth

public float getWidth()
This will get the width of this rectangle as calculated by upperRightX - lowerLeftX.

Returns: The width of this rectangle.

setLowerLeftX

public void setLowerLeftX(float lowerLeftXValue)
Setter for property lowerLeftX.

Parameters: lowerLeftXValue New value of property lowerLeftX.

setLowerLeftY

public void setLowerLeftY(float lowerLeftYValue)
Setter for property lowerLeftY.

Parameters: lowerLeftYValue New value of property lowerLeftY.

setUpperRightX

public void setUpperRightX(float upperRightXValue)
Setter for property upperRightX.

Parameters: upperRightXValue New value of property upperRightX.

setUpperRightY

public void setUpperRightY(float upperRightYValue)
Setter for property upperRightY.

Parameters: upperRightYValue New value of property upperRightY.

toString

public String toString()
This will return a string representation of this rectangle.

Returns: This object as a string.