Class LayoutManager
java.lang.Object
org.opencastproject.composer.layout.LayoutManager
-
Method Summary
Modifier and TypeMethodDescriptionstatic MultiShapeLayoutabsoluteMultiShapeLayout(Dimension canvas, List<Tuple<Dimension, AbsolutePositionLayoutSpec>> shapes) Compose a list of shapes on a canvas.static intCalculate the area of a dimension.static doubleGet the aspect ratio of a dimension.static booleanbetween(int a, int b, int x) a <= x <= bstatic intGet the Y coordinate of the bottom bound of the layout.static booleanTest ifshapefits intointo.static intGet the X coordinate of the left bound of the layout.static intlimitMax(double v, int max) static intlimitMin(double v, int min) static DimensionReturn the dimension with the bigger area.static MultiShapeLayoutmultiShapeLayout(Dimension canvas, List<Tuple<Dimension, HorizontalCoverageLayoutSpec>> shapes) Compose a list of shapes on a canvas.static OffsetCalculate the offset of an anchor point for a given shape relative to its upper left corner.static booleanTest if layoutsaandboverlap.static intGet the X coordinate of the right bound of the layout.static DimensionScaleshapebyscaleand ensure that any rounding errors are limited so that the resulting dimension does not exceedlimit.static DimensionscaleToFit(Dimension canvas, Dimension d) Scaledto fit intocanvas.static intGet the Y coordinate of the top bound of the layout.static TwoShapeLayouttwoShapeLayout(Dimension canvas, Dimension upper, Dimension lower, TwoShapeLayouts.TwoShapeLayoutSpec spec) Compose two shapes on a canvas.
-
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 canvasupper- the dimension of the upper (z-axis) source shapelower- the dimension of the lower (z-axis) source shapespec- the layout specification
-
multiShapeLayout
public static MultiShapeLayout multiShapeLayout(Dimension canvas, List<Tuple<Dimension, HorizontalCoverageLayoutSpec>> shapes) Compose a list of shapes on a canvas.- Parameters:
canvas- the dimension of the target canvasshapes- 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<Tuple<Dimension, AbsolutePositionLayoutSpec>> shapes) Compose a list of shapes on a canvas.- Parameters:
canvas- the dimension of the target canvasshapes- 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
Test ifshapefits intointo. -
area
Calculate the area of a dimension. -
max
Return the dimension with the bigger area. -
aspectRatio
Get the aspect ratio of a dimension. -
overlap
Test if layoutsaandboverlap. -
left
Get the X coordinate of the left bound of the layout. -
right
Get the X coordinate of the right bound of the layout. -
top
Get the Y coordinate of the top bound of the layout. -
bottom
Get the Y coordinate of the bottom bound of the layout. -
offset
Calculate the offset of an anchor point for a given shape relative to its upper left corner. -
scale
Scaleshapebyscaleand ensure that any rounding errors are limited so that the resulting dimension does not exceedlimit. -
scaleToFit
Scaledto fit intocanvas. -
between
public static boolean between(int a, int b, int x) a <= x <= b
-