Package com.itextpdf.layout.minmaxwidth
Class RotationMinMaxWidth
- java.lang.Object
-
- com.itextpdf.layout.minmaxwidth.MinMaxWidth
-
- com.itextpdf.layout.minmaxwidth.RotationMinMaxWidth
-
public class RotationMinMaxWidth extends MinMaxWidth
Class for min-max-width of rotated elements. Also contains heuristic methods for it calculation based on the assumption that area of element stays the same when we try to layout it with different available width (available width is between min-width and max-width).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
RotationMinMaxWidth.WidthFunction
Class that represents functions used, for calculation of width of element after rotation based on it's NOT rotated width and assumption, that area of element stays the same when we try to layout it with different available width.
-
Field Summary
Fields Modifier and Type Field Description private double
maxWidthHeight
private double
maxWidthOrigin
private double
minWidthHeight
private double
minWidthOrigin
-
Constructor Summary
Constructors Constructor Description RotationMinMaxWidth(double minWidth, double maxWidth, double minWidthOrigin, double maxWidthOrigin, double minWidthHeight, double maxWidthHeight)
Create new instance
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static RotationMinMaxWidth
calculate(double angle, double area, MinMaxWidth elementMinMaxWidth)
Heuristic method, based on the assumption that area of element stays the same, when we try to layout it with different available width (available width is between min-width and max-width).static RotationMinMaxWidth
calculate(double angle, double area, MinMaxWidth elementMinMaxWidth, double availableWidth)
Heuristic method, based on the assumption that area of element stays the same, when we try to layout it with different available width (available width is between min-width and max-width).private static RotationMinMaxWidth
calculate(RotationMinMaxWidth.WidthFunction func, double xMin, double xMax)
This method use derivative of function defined on interval: [xMin, xMax] to find its local minimum and maximum.static double
calculateRotatedWidth(Rectangle area, double angle)
Utility method for calculating rotated width of area in a similar way to other calculations in this class.private static double
correctSinCos(double value)
private static double
cos(double angle)
double
getMaxWidthHeight()
double
getMaxWidthOrigin()
double
getMinWidthHeight()
double
getMinWidthOrigin()
private static double
sin(double angle)
-
Methods inherited from class com.itextpdf.layout.minmaxwidth.MinMaxWidth
getAdditionalWidth, getChildrenMaxWidth, getChildrenMinWidth, getMaxWidth, getMinWidth, setAdditionalWidth, setChildrenMaxWidth, setChildrenMinWidth, toString
-
-
-
-
Constructor Detail
-
RotationMinMaxWidth
public RotationMinMaxWidth(double minWidth, double maxWidth, double minWidthOrigin, double maxWidthOrigin, double minWidthHeight, double maxWidthHeight)
Create new instance- Parameters:
minWidth
- min-width of rotated elementmaxWidth
- max-width of rotated elementminWidthOrigin
- the width of not rotated element, that will have min-width after rotationmaxWidthOrigin
- the width of not rotated element, that will have max-width after rotationminWidthHeight
- the height of rotated element, that have min-width as its rotated widthmaxWidthHeight
- the height of rotated element, that have min-width as its rotated width
-
-
Method Detail
-
getMinWidthOrigin
public double getMinWidthOrigin()
-
getMaxWidthOrigin
public double getMaxWidthOrigin()
-
getMinWidthHeight
public double getMinWidthHeight()
-
getMaxWidthHeight
public double getMaxWidthHeight()
-
calculate
public static RotationMinMaxWidth calculate(double angle, double area, MinMaxWidth elementMinMaxWidth)
Heuristic method, based on the assumption that area of element stays the same, when we try to layout it with different available width (available width is between min-width and max-width).- Parameters:
angle
- rotation angle in radiansarea
- the constant areaelementMinMaxWidth
- NOT rotated element min-max-width- Returns:
- possible min-max-width of element after rotation
-
calculate
public static RotationMinMaxWidth calculate(double angle, double area, MinMaxWidth elementMinMaxWidth, double availableWidth)
Heuristic method, based on the assumption that area of element stays the same, when we try to layout it with different available width (available width is between min-width and max-width).- Parameters:
angle
- rotation angle in radiansarea
- the constant areaelementMinMaxWidth
- NOT rotated element min-max-widthavailableWidth
- the maximum width of area the element will occupy after rotation.- Returns:
- possible min-max-width of element after rotation
-
calculateRotatedWidth
public static double calculateRotatedWidth(Rectangle area, double angle)
Utility method for calculating rotated width of area in a similar way to other calculations in this class.- Parameters:
area
- the initial areaangle
- the rotation angle in radians- Returns:
- width of rotated area
-
calculate
private static RotationMinMaxWidth calculate(RotationMinMaxWidth.WidthFunction func, double xMin, double xMax)
This method use derivative of function defined on interval: [xMin, xMax] to find its local minimum and maximum. It also calculate other handy values needed for the creation ofRotationMinMaxWidth
.- Parameters:
func
- theRotationMinMaxWidth.WidthFunction.getRotatedWidth(double)
of this instance is used as analysed functionxMin
- the smallest possible value of function argumentxMax
- the biggest possible value of function argument- Returns:
- the calculated
RotationMinMaxWidth
-
sin
private static double sin(double angle)
-
cos
private static double cos(double angle)
-
correctSinCos
private static double correctSinCos(double value)
-
-