Package com.pdftools.geometry.units
Class Margin
- java.lang.Object
-
- com.pdftools.geometry.units.Margin
-
public class Margin extends java.lang.Object
The margin defines the space around elements.
The class is based on the respective distances left, bottom, right, and top of type
Length
.
-
-
Constructor Summary
Constructors Constructor Description Margin(double left, double bottom, double right, double top, Length.Units unit)
ConstructMargin
object from values and a common unit.Margin(double margin, Length.Units unit)
Construct aMargin
object of equal marginsMargin(Length margin)
Construct aMargin
object of equal marginsMargin(Length left, Length bottom, Length right, Length top)
ConstructMargin
object from individual values
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
Length
getBottom()
Gets the bottom margin asLength
object.Length
getLeft()
Gets the left margin asLength
object.Length
getRight()
Gets the right margin asLength
object.Length
getTop()
Gets the top margin asLength
object.int
hashCode()
static Margin
parse(java.lang.String value)
Create aMargin
object from a string representation.java.lang.String
toString()
Creates a string representation as left-bottom-right-top-tuple with associated suitable metric units, "m", "cm" or "mm".java.lang.String
toString(Length.Units unit)
Creates a string representation as left-bottom-right-top-tuple with the specified unit.
-
-
-
Constructor Detail
-
Margin
public Margin(Length left, Length bottom, Length right, Length top)
ConstructMargin
object from individual values
-
Margin
public Margin(double left, double bottom, double right, double top, Length.Units unit)
ConstructMargin
object from values and a common unit.- Parameters:
left
- as numerical valuebottom
- as numerical valueright
- as numerical valuetop
- as numerical valueunit
- the unit
-
Margin
public Margin(Length margin)
Construct aMargin
object of equal margins- Parameters:
margin
- asLength
type
-
Margin
public Margin(double margin, Length.Units unit)
Construct aMargin
object of equal margins- Parameters:
margin
- as numerical valueunit
- the unit
-
-
Method Detail
-
parse
public static Margin parse(java.lang.String value)
Create aMargin
object from a string representation.- Parameters:
value
- Allowed are value-unit pairs of the form "<left_value><left_unit> <bottom_value><bottom_unit> <right_value><right_unit> <top_value><top_unit>". Example: "12.3cm 23.4mm 34.5mm 45.6mm"- Returns:
-
toString
public java.lang.String toString()
Creates a string representation as left-bottom-right-top-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 left-bottom-right-top-tuple with the specified unit.
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-