Class RotationUtils


  • final class RotationUtils
    extends java.lang.Object
    • Constructor Detail

      • RotationUtils

        private RotationUtils()
    • Method Detail

      • countRotationMinMaxWidth

        public static MinMaxWidth countRotationMinMaxWidth​(MinMaxWidth minMaxWidth,
                                                           AbstractRenderer renderer)
        This method tries to calculate min-max-width of rotated element using heuristics of RotationMinMaxWidth.calculate(double, double, MinMaxWidth). This method may call IRenderer.layout(LayoutContext) once in best case (if the width is set on element, or if we are really lucky) and three times in worst case.
        Parameters:
        minMaxWidth - the minMaxWidth of NOT rotated renderer
        renderer - the actual renderer
        Returns:
        minMaxWidth of rotated renderer or original value in case rotated value can not be calculated, or renderer isn't rotated.
      • retrieveRotatedLayoutWidth

        public static java.lang.Float retrieveRotatedLayoutWidth​(float availableWidth,
                                                                 AbstractRenderer renderer)
        This method tries to calculate width of not rotated renderer, so after rotation it fits availableWidth. This method uses heuristics of RotationMinMaxWidth.calculate(double, double, MinMaxWidth, double). It doesn't take into account any of height properties of renderer or height of layoutArea. The minMaxWidth calculations and initial layout may take long time, but they won't be called if the renderer have width property.
        Parameters:
        availableWidth - the width of layoutArea
        renderer - the actual renderer
        Returns:
        the width that should be set as width of layout area to properly layout element, or fallback to AbstractRenderer.retrieveWidth(float) in case it can not be calculated, or renderer isn't rotated.
      • getLayoutRotatedWidth

        private static java.lang.Float getLayoutRotatedWidth​(AbstractRenderer renderer,
                                                             float availableWidth,
                                                             Rectangle previousBBox,
                                                             double angle)