Package org.jzy3d.plot3d.primitives.axis
Class AxisLabelProcessor
- java.lang.Object
-
- org.jzy3d.plot3d.primitives.axis.AxisLabelProcessor
-
public class AxisLabelProcessor extends Object
A helper class to process axis labels.- Author:
- martin
-
-
Field Summary
Fields Modifier and Type Field Description protected AxisBox
axis
protected AxisLayout
layout
-
Constructor Summary
Constructors Constructor Description AxisLabelProcessor(AxisBox axis)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
axisLabel(int dimension)
Return the axis label for the given direction.protected Coord2d
axisLabelOffset(IPainter painter, AxisRenderingInfo info, Coord3d labelPosition, int margin)
Offset for oblique labelsprotected Coord2d
axisLabelOffsetVertical(IPainter painter, AxisRenderingInfo info, Coord3d labelPosition, int margin)
Compute the offset to apply to a vertical Z label to avoid covering the tick labels.protected Coord3d
axisLabelPosition(int direction, float tickLength, Coord3d pos, Coord3d dir)
Compute the axis label position according to the tick position (on the axis segment) and a direction for the tick.protected Coord3d
axisLabelPosition_2D(int direction, Coord3d pos)
2D case : processed in 2D according to pixel margins, font size, and a pixel to world dimension ratio returned by the viewprotected Coord3d
axisLabelPosition_3D(int direction, float tickLength, Coord3d pos, Coord3d dir)
3D case : process a shift from the center of the axis to annotate based on the tick length (hence distance between tick text and axis) and a distance factor of the axis label w.r.t. the tick lengthprotected float
axisLabelRotation(IPainter painter, int direction, Coord3d[] axisSegment)
Compute axis label rotation according to settings and direction of the axis segment.protected void
drawAxisLabel(IPainter painter, int direction, Color color, BoundingBox3d ticksTxtBounds, Coord3d position, String label, float rotation, Coord2d offset)
protected TextAlign
getAxisLabelTextAlign(int direction)
-
-
-
Field Detail
-
axis
protected AxisBox axis
-
layout
protected AxisLayout layout
-
-
Constructor Detail
-
AxisLabelProcessor
public AxisLabelProcessor(AxisBox axis)
-
-
Method Detail
-
drawAxisLabel
protected void drawAxisLabel(IPainter painter, int direction, Color color, BoundingBox3d ticksTxtBounds, Coord3d position, String label, float rotation, Coord2d offset)
-
getAxisLabelTextAlign
protected TextAlign getAxisLabelTextAlign(int direction)
-
axisLabelOffsetVertical
protected Coord2d axisLabelOffsetVertical(IPainter painter, AxisRenderingInfo info, Coord3d labelPosition, int margin)
Compute the offset to apply to a vertical Z label to avoid covering the tick labels. Retrieve pixel scale in view to adapt margin- Parameters:
painter
-info
-labelPosition
-offset2D
-margin
-
-
axisLabelOffset
protected Coord2d axisLabelOffset(IPainter painter, AxisRenderingInfo info, Coord3d labelPosition, int margin)
Offset for oblique labels- Parameters:
painter
-info
-labelPosition
-margin
-- Returns:
-
axisLabelRotation
protected float axisLabelRotation(IPainter painter, int direction, Coord3d[] axisSegment)
Compute axis label rotation according to settings and direction of the axis segment.
-
axisLabel
protected String axisLabel(int dimension)
Return the axis label for the given direction.
-
axisLabelPosition
protected Coord3d axisLabelPosition(int direction, float tickLength, Coord3d pos, Coord3d dir)
Compute the axis label position according to the tick position (on the axis segment) and a direction for the tick. This is quite intricated withView.computeCamera3D_RenderingSphere(org.jzy3d.plot3d.rendering.view.Camera, org.jzy3d.plot3d.rendering.view.ViewportConfiguration, org.jzy3d.maths.BoundingBox3d)
andView.computeCamera2D_RenderingSquare(org.jzy3d.plot3d.rendering.view.Camera, org.jzy3d.plot3d.rendering.view.ViewportConfiguration, org.jzy3d.maths.BoundingBox3d)
which will perform the actual camera configuration to ensure enough white space around the scene to draw the axis and tick labels
-
axisLabelPosition_2D
protected Coord3d axisLabelPosition_2D(int direction, Coord3d pos)
2D case : processed in 2D according to pixel margins, font size, and a pixel to world dimension ratio returned by the view
-
axisLabelPosition_3D
protected Coord3d axisLabelPosition_3D(int direction, float tickLength, Coord3d pos, Coord3d dir)
3D case : process a shift from the center of the axis to annotate based on the tick length (hence distance between tick text and axis) and a distance factor of the axis label w.r.t. the tick length
-
-