Class Orientation

java.lang.Object
com.jalios.util.Orientation

public class Orientation extends Object
A 2 dimensional object with an orientation.
Since:
jcms-9.0.1
Author:
Sylvain Devaux
  • Field Details

    • 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:
    • 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:
  • Constructor Details

    • Orientation

      public Orientation(Dimension dimension)
      Parameters:
      dimension - the source Dimension.
      Since:
      jcms-9.0.1
    • Orientation

      public Orientation(File file)
      Parameters:
      file - the oriented object File.
      Since:
      jcms-9.0.1
  • Method Details

    • 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 String toString()
      Overrides:
      toString in class Object