Package com.jalios.util
Class Orientation
- java.lang.Object
-
- com.jalios.util.Orientation
-
public class Orientation extends java.lang.Object
A 2 dimensional object with an orientation.- Since:
- jcms-9.0.1
- Author:
- Sylvain Devaux
-
-
Field Summary
Fields Modifier and Type Field Description static double
LANDSCAPE_THRESHOLD
Default minimum ratio (width / height) for an object to be considered as Landscape oriented.static double
PORTRAIT_THRESHOLD
Default maximum ratio (width / height) for an object to be considered as Portrait oriented.
-
Constructor Summary
Constructors Constructor Description Orientation(java.awt.Dimension dimension)
Orientation(java.io.File file)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
getHeight()
protected double
getRatio()
double
getWidth()
boolean
isLandscape()
boolean
isPortrait()
boolean
isSquare()
java.lang.String
toString()
-
-
-
Field Detail
-
LANDSCAPE_THRESHOLD
public static final double LANDSCAPE_THRESHOLD
Default minimum ratio (width / height) for an object to be considered as Landscape oriented.- Since:
- jcms-9.0.1
- See Also:
- Constant Field Values
-
PORTRAIT_THRESHOLD
public static final double PORTRAIT_THRESHOLD
Default maximum ratio (width / height) for an object to be considered as Portrait oriented.- Since:
- jcms-9.0.1
- See Also:
- Constant Field Values
-
-
Method Detail
-
getRatio
protected double getRatio()
- Returns:
- the ratio
- Since:
- jcms-9.0.1
-
getWidth
public double getWidth()
- Returns:
- the width if set, or '-1'.
- Since:
- jcms-9.0.1
-
getHeight
public double getHeight()
- Returns:
- the height if set, or '-1'.
- Since:
- jcms-9.0.1
-
isLandscape
public boolean isLandscape()
- Returns:
- true if ratio is superior to
LANDSCAPE_THRESHOLD
. - Since:
- jcms-9.0.1
-
isPortrait
public boolean isPortrait()
- Returns:
- true if ratio is inferior to
PORTRAIT_THRESHOLD
. - Since:
- jcms-9.0.1
-
isSquare
public boolean isSquare()
- Returns:
- true if ratio is inferior to
PORTRAIT_THRESHOLD
. - Since:
- jcms-9.0.1
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-