Class Orientation


  • public class Orientation
    extends java.lang.Object
    A 2 dimensional object with an orientation.
    Since:
    jcms-9.0.1
    Version:
    $Revision: 107554 $
    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.
      static java.lang.String REVISION  
    • Constructor Summary

      Constructors 
      Constructor Description
      Orientation​(java.awt.Dimension dimension)  
      Orientation​(java.io.File file)  
    • 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
    • Constructor Detail

      • Orientation

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

        public Orientation​(java.io.File file)
        Parameters:
        file - the oriented object File.
        Since:
        jcms-9.0.1
    • 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 class java.lang.Object