Package org.jzy3d.plot3d.text.renderers
Class TextRenderer
- java.lang.Object
-
- org.jzy3d.plot3d.text.AbstractTextRenderer
-
- org.jzy3d.plot3d.text.renderers.TextRenderer
-
- All Implemented Interfaces:
ITextRenderer
- Direct Known Subclasses:
AxisBox2d.RotatedTextBitmapRenderer
public class TextRenderer extends AbstractTextRenderer implements ITextRenderer
TheITextRenderer
computes text layout according toHorizontal
,Vertical
settings, text length, font size and text position. This is achieved with the help ofTextLayout
processor. It can be given a 2D offset in screen coordinates and a 3D offset in world coordinates that are applied after the initial layout is processed according to the settings, the text length, the font size and the text position. Rendering text relies onIPainter.drawText(Font, String, Coord3d, Color, float)
which was introduced as of Jzy3D 2.0 and offers much more flexibility than the initial simpleIPainter.glutBitmapString(int, String)
which only support two fonts.
-
-
Field Summary
Fields Modifier and Type Field Description protected TextLayout
layout
protected static org.apache.logging.log4j.Logger
LOGGER
-
Fields inherited from class org.jzy3d.plot3d.text.AbstractTextRenderer
NO_ROTATION, NO_SCENE_OFFSET, NO_SCREEN_OFFSET, spaceTransformer
-
-
Constructor Summary
Constructors Constructor Description TextRenderer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected BoundingBox3d
computeTextBounds(IPainter painter, Font font, Coord3d posScreenShifted, float strlen)
BoundingBox3d
drawText(IPainter painter, Font font, String text, Coord3d position, float rotation, Horizontal halign, Vertical valign, Color color, Coord2d screenOffset, Coord3d sceneOffset)
Draw a string at the specified position and return the 3d volume occupied by the string according to the current Camera configuration.protected void
glRasterPos(IPainter painter, Coord3d sceneOffset, Coord3d screenPositionAligned3d)
Left as a helper for subclasses.protected Coord3d
to3D(IPainter painter, Coord3d screen)
Convert a 2D screen position to 3D world coordinate-
Methods inherited from class org.jzy3d.plot3d.text.AbstractTextRenderer
drawText, drawText, drawText, drawText, drawText, drawText, getSpaceTransformer, setSpaceTransformer
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jzy3d.plot3d.text.ITextRenderer
drawText, drawText, drawText, drawText, drawText, drawText, getSpaceTransformer, setSpaceTransformer
-
-
-
-
Field Detail
-
LOGGER
protected static org.apache.logging.log4j.Logger LOGGER
-
layout
protected TextLayout layout
-
-
Method Detail
-
drawText
public BoundingBox3d drawText(IPainter painter, Font font, String text, Coord3d position, float rotation, Horizontal halign, Vertical valign, Color color, Coord2d screenOffset, Coord3d sceneOffset)
Draw a string at the specified position and return the 3d volume occupied by the string according to the current Camera configuration.- Specified by:
drawText
in interfaceITextRenderer
-
to3D
protected Coord3d to3D(IPainter painter, Coord3d screen)
Convert a 2D screen position to 3D world coordinate
-
computeTextBounds
protected BoundingBox3d computeTextBounds(IPainter painter, Font font, Coord3d posScreenShifted, float strlen)
-
-