Package org.apache.fontbox.util
Class BoundingBox
java.lang.Object
org.apache.fontbox.util.BoundingBox
This is an implementation of a bounding box. This was originally written for the
AMF parser.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate float
private float
private float
private float
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.BoundingBox
(float minX, float minY, float maxX, float maxY) Constructor.BoundingBox
(List<Number> numbers) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionboolean
contains
(float x, float y) Checks if a point is inside this rectangle.float
This will get the height of this rectangle as calculated by upperRightY - lowerLeftY.float
Getter for property lowerLeftX.float
Getter for property lowerLeftY.float
Getter for property upperRightX.float
Getter for property upperRightY.float
getWidth()
This will get the width of this rectangle as calculated by upperRightX - lowerLeftX.void
setLowerLeftX
(float lowerLeftXValue) Setter for property lowerLeftX.void
setLowerLeftY
(float lowerLeftYValue) Setter for property lowerLeftY.void
setUpperRightX
(float upperRightXValue) Setter for property upperRightX.void
setUpperRightY
(float upperRightYValue) Setter for property upperRightY.toString()
This will return a string representation of this rectangle.
-
Field Details
-
lowerLeftX
private float lowerLeftX -
lowerLeftY
private float lowerLeftY -
upperRightX
private float upperRightX -
upperRightY
private float upperRightY
-
-
Constructor Details
-
BoundingBox
public BoundingBox()Default constructor. -
BoundingBox
public BoundingBox(float minX, float minY, float maxX, float maxY) Constructor.- Parameters:
minX
- lower left x valueminY
- lower left y valuemaxX
- upper right x valuemaxY
- upper right y value
-
BoundingBox
Constructor.- Parameters:
numbers
- list of four numbers
-
-
Method Details
-
getLowerLeftX
public float getLowerLeftX()Getter for property lowerLeftX.- Returns:
- Value of property lowerLeftX.
-
setLowerLeftX
public void setLowerLeftX(float lowerLeftXValue) Setter for property lowerLeftX.- Parameters:
lowerLeftXValue
- New value of property lowerLeftX.
-
getLowerLeftY
public float getLowerLeftY()Getter for property lowerLeftY.- Returns:
- Value of property lowerLeftY.
-
setLowerLeftY
public void setLowerLeftY(float lowerLeftYValue) Setter for property lowerLeftY.- Parameters:
lowerLeftYValue
- New value of property lowerLeftY.
-
getUpperRightX
public float getUpperRightX()Getter for property upperRightX.- Returns:
- Value of property upperRightX.
-
setUpperRightX
public void setUpperRightX(float upperRightXValue) Setter for property upperRightX.- Parameters:
upperRightXValue
- New value of property upperRightX.
-
getUpperRightY
public float getUpperRightY()Getter for property upperRightY.- Returns:
- Value of property upperRightY.
-
setUpperRightY
public void setUpperRightY(float upperRightYValue) Setter for property upperRightY.- Parameters:
upperRightYValue
- New 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.
-
getHeight
public float getHeight()This will get the height of this rectangle as calculated by upperRightY - lowerLeftY.- Returns:
- The height of this rectangle.
-
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.
-
toString
This will return a string representation of this rectangle.
-