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)ConstructRectangleobject from values and a common unit.Rectangle(Length x, Length y, Length width, Length height)ConstructRectangleobject from individual values
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(Rectangle other)Determines whether another rectangle is non-strictly inscribed into the present rectangle.booleanequals(java.lang.Object obj)static RectanglefromEdges(Length left, Length bottom, Length right, Length top)LengthgetBottom()Gets the bottom coordinate of the rectangle asLengthobject.LengthgetLeft()Gets the left coordinate of the rectangle asLengthobject.PointgetPosition()Get the position (origin) of the rectangle asPointobject.LengthgetRight()Gets the right coordinate of the rectangle asLengthobject.SizegetSize()Get the size of the rectangle asSizeobject.LengthgetTop()Gets the top coordinate of the rectangle asLengthobject.inthashCode()static Rectangleparse(java.lang.String value)Create aRectangleobject from a string representation.java.lang.StringtoString()Creates a string representation as x-y-width-height-tuple with associated suitable metric units, "m", "cm" or "mm".java.lang.StringtoString(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)
ConstructRectangleobject from individual values
-
Rectangle
public Rectangle(double x, double y, double width, double height, Length.Units unit)ConstructRectangleobject 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 aRectangleobject 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:
toStringin 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- asRectangleobject- Returns:
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-