Package com.pdftools.geometry.units
Class Rectangle
- java.lang.Object
-
- com.pdftools.geometry.units.Rectangle
-
public class Rectangle extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description Rectangle(double x, double y, double width, double height, Length.Units unit)
ConstructRectangle
object from values and a common unit.Rectangle(Length x, Length y, Length width, Length height)
ConstructRectangle
object from individual values
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(Rectangle other)
Determines whether another rectangle is non-strictly inscribed into the present rectangle.boolean
equals(java.lang.Object obj)
static Rectangle
fromEdges(Length left, Length bottom, Length right, Length top)
Length
getBottom()
Gets the bottom coordinate of the rectangle asLength
object.Length
getLeft()
Gets the left coordinate of the rectangle asLength
object.Point
getPosition()
Get the position (origin) of the rectangle asPoint
object.Length
getRight()
Gets the right coordinate of the rectangle asLength
object.Size
getSize()
Get the size of the rectangle asSize
object.Length
getTop()
Gets the top coordinate of the rectangle asLength
object.int
hashCode()
static Rectangle
parse(java.lang.String value)
Create aRectangle
object from a string representation.java.lang.String
toString()
Creates a string representation as x-y-width-height-tuple with associated suitable metric units, "m", "cm" or "mm".java.lang.String
toString(Length.Units unit)
Creates a string representation as x-y-width-height-tuple with the specified unit.
-
-
-
Constructor Detail
-
Rectangle
public Rectangle(Length x, Length y, Length width, Length height)
ConstructRectangle
object from individual values
-
Rectangle
public Rectangle(double x, double y, double width, double height, Length.Units unit)
ConstructRectangle
object from values and a common unit.- Parameters:
x
- as numerical valuey
- as numerical valuewidth
- as numerical valueheight
- as numerical valueunit
- the unit
-
-
Method Detail
-
parse
public static Rectangle parse(java.lang.String value)
Create aRectangle
object from a string representation.- Parameters:
value
- Allowed are value-unit pairs of the form "<x_value><x_unit> <y_value><y_unit> <right_value><right_unit> <height_value><height_unit>". Example: "12.3cm 23.4mm 34.5mm 45.6mm"- Returns:
-
toString
public java.lang.String toString()
Creates a string representation as x-y-width-height-tuple with associated suitable metric units, "m", "cm" or "mm".- Overrides:
toString
in classjava.lang.Object
-
toString
public java.lang.String toString(Length.Units unit)
Creates a string representation as x-y-width-height-tuple with the specified unit.
-
contains
public boolean contains(Rectangle other)
Determines whether another rectangle is non-strictly inscribed into the present rectangle.- Parameters:
other
- asRectangle
object- Returns:
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-