Class LayoutManager

java.lang.Object
org.opencastproject.composer.layout.LayoutManager

public final class LayoutManager extends Object
  • Method Details

    • twoShapeLayout

      public static TwoShapeLayout twoShapeLayout(Dimension canvas, Dimension upper, Dimension lower, TwoShapeLayouts.TwoShapeLayoutSpec spec)
      Compose two shapes on a canvas. It is guaranteed that shapes to not extend the underlying canvas.
      Parameters:
      canvas - the dimension of the target canvas
      upper - the dimension of the upper (z-axis) source shape
      lower - the dimension of the lower (z-axis) source shape
      spec - the layout specification
    • multiShapeLayout

      public static MultiShapeLayout multiShapeLayout(Dimension canvas, List<org.opencastproject.util.data.Tuple<Dimension,HorizontalCoverageLayoutSpec>> shapes)
      Compose a list of shapes on a canvas.
      Parameters:
      canvas - the dimension of the target canvas
      shapes - A list of shapes sorted in z-order with the first shape in the list being the lowermost one. The list consists of the dimension of the source shape tupled with a layout specification.
    • absoluteMultiShapeLayout

      public static MultiShapeLayout absoluteMultiShapeLayout(Dimension canvas, List<org.opencastproject.util.data.Tuple<Dimension,AbsolutePositionLayoutSpec>> shapes)
      Compose a list of shapes on a canvas.
      Parameters:
      canvas - the dimension of the target canvas
      shapes - A list of shapes sorted in z-order with the first shape in the list being the lowermost one. The list consists of the dimension of the source shape tupled with a layout specification.
    • limitMax

      public static int limitMax(double v, int max)
    • limitMin

      public static int limitMin(double v, int min)
    • fits

      public static boolean fits(Dimension into, Dimension shape)
      Test if shape fits into into.
    • area

      public static int area(Dimension a)
      Calculate the area of a dimension.
    • max

      public static Dimension max(Dimension a, Dimension b)
      Return the dimension with the bigger area.
    • aspectRatio

      public static double aspectRatio(Dimension a)
      Get the aspect ratio of a dimension.
    • overlap

      public static boolean overlap(Layout a, Layout b)
      Test if layouts a and b overlap.
    • left

      public static int left(Layout a)
      Get the X coordinate of the left bound of the layout.
    • right

      public static int right(Layout a)
      Get the X coordinate of the right bound of the layout.
    • top

      public static int top(Layout a)
      Get the Y coordinate of the top bound of the layout.
    • bottom

      public static int bottom(Layout a)
      Get the Y coordinate of the bottom bound of the layout.
    • offset

      public static Offset offset(Anchor a, Dimension dim)
      Calculate the offset of an anchor point for a given shape relative to its upper left corner.
    • scale

      public static Dimension scale(Dimension limit, Dimension shape, double scale)
      Scale shape by scale and ensure that any rounding errors are limited so that the resulting dimension does not exceed limit.
    • scaleToFit

      public static Dimension scaleToFit(Dimension canvas, Dimension d)
      Scale d to fit into canvas .
    • between

      public static boolean between(int a, int b, int x)
      a <= x <= b