Package jpicedt.format.output.latex
Class LatexFormatter
- java.lang.Object
-
- jpicedt.format.output.latex.LatexFormatter
-
- All Implemented Interfaces:
LatexConstants,FormatterFactory,PicObjectConstants
- Direct Known Subclasses:
EepicFormatter
public class LatexFormatter extends java.lang.Object implements FormatterFactory, PicObjectConstants, LatexConstants
LaTeX formater- Since:
- jpicedt 1.0 (code refactoring 1.3.2)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classLatexFormatter.DrawingFormatter
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringfileWrapperEpilogprotected static java.lang.StringfileWrapperProlog-
Fields inherited from interface jpicedt.graphic.io.formatter.FormatterFactory
MAKE_STANDALONE_FILE
-
Fields inherited from interface jpicedt.format.output.latex.LatexConstants
CR_LF, DEFAULT_EM_LINE_LENGTH, DEFAULT_FILE_WRAPPER_EPILOG, DEFAULT_FILE_WRAPPER_PROLOG, DEFAULT_MAX_CIRCLE_DIAMETER, DEFAULT_MAX_DISK_DIAMETER, DEFAULT_MAX_EM_CIRCLE_SEGMENT_LENGTH, DEFAULT_MAX_EM_LINE_SLOPE, KEY_EM_LINE_LENGTH, KEY_FILE_WRAPPER_EPILOG, KEY_FILE_WRAPPER_PROLOG, KEY_MAX_CIRCLE_DIAMETER, KEY_MAX_DISK_DIAMETER, KEY_MAX_EM_CIRCLE_SEGMENT_LENGTH, KEY_MAX_EM_LINE_SLOPE, RESCALING_TEX_FUNCTION
-
Fields inherited from interface jpicedt.graphic.model.PicObjectConstants
ARROW_GLOBAL_SCALE_LENGTH, ARROW_GLOBAL_SCALE_WIDTH, ARROW_INSET_SCALE, ARROW_LENGTH_SCALE, ARROW_WIDTH_LINEWIDTH_SCALE, ARROW_WIDTH_MINIMUM_MM, BRACKET_LENGTH_SCALE, CROSSHATCH, CROSSHATCH_FILLED, DASH_OPAQUE, DASH_TRANSPARENT, DASH1, DASH2, DASH3, DASHED, DIMEN, DOT_SEP, DOT_SEP1, DOT_SEP2, DOT_SEP3, DOTTED, DOUBLE_COLOR, DOUBLE_LINE, DOUBLE_SEP, FILL_COLOR, FILL_STYLE, HATCH_ANGLE, HATCH_COLOR, HATCH_SEP, HATCH_WIDTH, HLINES, HLINES_FILLED, INNER, LEFT_ARROW, LINE_COLOR, LINE_STYLE, LINE_WIDTH, MIDDLE, NONE, OUTER, OVER_STRIKE, OVER_STRIKE_COLOR, OVER_STRIKE_WIDTH, POLYDOTS_ANGLE, POLYDOTS_CIRCLE, POLYDOTS_DISK, POLYDOTS_PENTAGON, POLYDOTS_PENTAGON_FILLED, POLYDOTS_PLUS, POLYDOTS_SCALE_H, POLYDOTS_SCALE_V, POLYDOTS_SIZE_LINEWIDTH_SCALE, POLYDOTS_SIZE_MINIMUM_MM, POLYDOTS_SQUARE, POLYDOTS_SQUARE_FILLED, POLYDOTS_STYLE, POLYDOTS_SUPERIMPOSE, POLYDOTS_TRIANGLE, POLYDOTS_TRIANGLE_FILLED, PS_POINT, PST_CUSTOM, RBRACKET_LENGTH_SCALE, RIGHT_ARROW, SHADOW, SHADOW_ANGLE, SHADOW_COLOR, SHADOW_SIZE, SOLID, TBAR_WIDTH_LINEWIDTH_SCALE, TBAR_WIDTH_MINIMUM_MM, TEXT_BOX_CIRCLE, TEXT_BOX_NO_FRAME, TEXT_BOX_OVAL, TEXT_BOX_RECTANGLE, TEXT_FRAME, TEXT_HALIGN_CENTER, TEXT_HALIGN_LEFT, TEXT_HALIGN_RIGHT, TEXT_HOR_ALIGN, TEXT_ROTATION, TEXT_VALIGN_BASELINE, TEXT_VALIGN_BOTTOM, TEXT_VALIGN_CENTER, TEXT_VALIGN_TOP, TEXT_VERT_ALIGN, VLINES, VLINES_FILLED
-
-
Constructor Summary
Constructors Constructor Description LatexFormatter()Constructor using default properties values
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappendThicknessString(java.lang.StringBuffer buf, Element obj)Create a string representation of the thickness command for the given PicObjet in the LaTeX format, and append it to the given StringBuffer.java.lang.StringBufferarrowToLatexString(PicPoint loc, PicPoint dir)Create a string representation of an arrow in the LaTeX format using \\vector's.static voidconfigure(java.util.Properties preferences)Configure static fields using the given Properties objectFormattercreateFormatter(Drawing d, java.lang.Object outputConstraint)FormattercreateFormatter(Element e)java.awt.PointgetXYNearestSlope(double slope, boolean isVector)java.lang.StringlineToLatexString(double x0, double y0, double x1, double y1, Arrow leftArrow, Arrow rightArrow, double dash)Computes a LaTeX string for a line segment, given its two end-points and decoration parameters.java.lang.StringlineToLatexString(PicPoint pt0, PicPoint pt1, Arrow leftArrow, Arrow rightArrow, double dash)Computes a LaTeX string for a line segment, given its two end-points and decoration parameters.
-
-
-
Method Detail
-
configure
public static void configure(java.util.Properties preferences)
Configure static fields using the given Properties object- Parameters:
properties- used to read shared parameters If null, default values are used.
-
createFormatter
public Formatter createFormatter(Element e)
- Specified by:
createFormatterin interfaceFormatterFactory- Returns:
- a Formatter able to format the given Element in the LaTeX picture env. format
-
createFormatter
public Formatter createFormatter(Drawing d, java.lang.Object outputConstraint)
- Specified by:
createFormatterin interfaceFormatterFactory- Parameters:
outputConstraint- constraint used by the factory to create a specific Formatter on-the-fly- Returns:
- a Formatter able to format the given Drawing in the LaTeX picture environment format ;
this may reliy on calls to
createFormatter(Element e)on the elements of the drawing, plus creating auxiliary
-
appendThicknessString
public void appendThicknessString(java.lang.StringBuffer buf, Element obj)Create a string representation of the thickness command for the given PicObjet in the LaTeX format, and append it to the given StringBuffer.
Such a command should preceed every object command. This string is CR-terminated.
- Since:
- jpicedt 1.3.2
-
lineToLatexString
public java.lang.String lineToLatexString(PicPoint pt0, PicPoint pt1, Arrow leftArrow, Arrow rightArrow, double dash)
Computes a LaTeX string for a line segment, given its two end-points and decoration parameters.- Parameters:
pt0- the start point of the line segmentpt1- the end point of the line segmentleftArrow- first arrow (we make no distinction b/w Arrow types, that is, we simply draw an arrow by using \\vector)rightArrow- second arrowdash- The dash step in mm ; must be .le. 0 if there's no dash- Returns:
- a LaTeX string (that is, not a "eepic" string !)
- Since:
- picedt 1.0
-
lineToLatexString
public java.lang.String lineToLatexString(double x0, double y0, double x1, double y1, Arrow leftArrow, Arrow rightArrow, double dash)Computes a LaTeX string for a line segment, given its two end-points and decoration parameters.- Parameters:
x0- The X coordinate (in mm) of the start point of the line segmenty0- The Y coordinate (in mm) of the start point of the line segmentx1- The X coordinate (in mm) of the end point of the line segmenty1- The Y coordinate (in mm) of the end point of the line segmentleftArrow- first arrow (we make no distinction b/w Arrow types, that is, we simply draw an arrow by using \\vector)rightArrow- second arrowdash- The dash step in mm ; must be .le. 0 if there's no dash- Returns:
- a LaTeX string (that is, not a "eepic" string !)
- Since:
- picedt 1.0
-
arrowToLatexString
public java.lang.StringBuffer arrowToLatexString(PicPoint loc, PicPoint dir)
Create a string representation of an arrow in the LaTeX format using \\vector's. The slope of the vector is as near as possible of the given slope.- Parameters:
loc- the location of the arrow, in mm (i.e. in the LaTeX coordinate system)dir- a vector that indicates the direction of the slope
-
getXYNearestSlope
public java.awt.Point getXYNearestSlope(double slope, boolean isVector)- Parameters:
slope- the slope to be matched by y/x (can be either positive or negative, or Double.POSITIVE_INFINITY)isVector- if true, x and y range from 1 to 4 ; from 1 to 6 otherwise- Returns:
- a pair (x,y) of positive integers ranging from 1 to 4 (for vectors) or 6 (for lines), so that y/x gives the better possible approximation of the given slope.
-
-