This is an implementation of a bounding box. This was originally written for the
AMF parser.
Method from org.apache.fontbox.util.BoundingBox Detail: |
public boolean contains(Point point) {
return contains( (float)point.getX(), (float)point.getY() );
}
Checks if a point is inside this rectangle. |
public boolean contains(float x,
float y) {
return x >= lowerLeftX && x < = upperRightX &&
y >= lowerLeftY && y < = upperRightY;
}
Checks if a point is inside this rectangle. |
public float getHeight() {
return getUpperRightY() - getLowerLeftY();
}
This will get the height of this rectangle as calculated by
upperRightY - lowerLeftY. |
public float getLowerLeftX() {
return lowerLeftX;
}
Getter for property lowerLeftX. |
public float getLowerLeftY() {
return lowerLeftY;
}
Getter for property lowerLeftY. |
public float getUpperRightX() {
return upperRightX;
}
Getter for property upperRightX. |
public float getUpperRightY() {
return upperRightY;
}
Getter for property upperRightY. |
public float getWidth() {
return getUpperRightX() - getLowerLeftX();
}
This will get the width of this rectangle as calculated by
upperRightX - lowerLeftX. |
public void setLowerLeftX(float lowerLeftXValue) {
this.lowerLeftX = lowerLeftXValue;
}
Setter for property lowerLeftX. |
public void setLowerLeftY(float lowerLeftYValue) {
this.lowerLeftY = lowerLeftYValue;
}
Setter for property lowerLeftY. |
public void setUpperRightX(float upperRightXValue) {
this.upperRightX = upperRightXValue;
}
Setter for property upperRightX. |
public void setUpperRightY(float upperRightYValue) {
this.upperRightY = upperRightYValue;
}
Setter for property upperRightY. |
public String toString() {
return "[" + getLowerLeftX() + "," + getLowerLeftY() + "," +
getUpperRightX() + "," + getUpperRightY() +"]";
}
This will return a string representation of this rectangle. |