http://www.jpicedt.org

jpicedt.format.output.latex
Class LatexFormatter

java.lang.Object
  extended by jpicedt.graphic.io.formatter.AbstractFormatterFactory
      extended by jpicedt.format.output.latex.LatexFormatter
All Implemented Interfaces:
FormatterFactory
Direct Known Subclasses:
EepicFormatter

public class LatexFormatter
extends AbstractFormatterFactory

LaTeX 'picture-env' formater

Since:
jpicedt 1.0 (code refactoring 1.3.2, 1.5)

Nested Class Summary
 class LatexFormatter.DrawingFormatter
           
 
Field Summary
protected static String fileWrapperEpilog
           
protected static String fileWrapperProlog
           
 
Fields inherited from class jpicedt.graphic.io.formatter.AbstractFormatterFactory
commentFormatter, factoryMap, lineSeparator
 
Fields inherited from interface jpicedt.graphic.io.formatter.FormatterFactory
MAKE_STANDALONE_FILE
 
Constructor Summary
LatexFormatter()
          Constructor using default properties values
 
Method Summary
 void appendThicknessString(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.
 StringBuffer arrowToLatexString(PicPoint loc, PicPoint dir)
          Create a string representation of an arrow in the LaTeX format using \\vector's.
static void configure(Properties preferences)
          Configure static fields using the given Properties object
 Formatter createFormatter(Drawing d, Object outputConstraints)
           
protected  String getFileWrapperEpilog()
          C'est juste pour avoir une implantation par défaut pour les types de contenu qui n'ont pas besoin de cette méthode d'interface.
protected  String getFileWrapperProlog()
          C'est juste pour avoir une implantation par défaut pour les types de contenu qui n'ont pas besoin de cette méthode d'interface.
 Point getXYNearestSlope(double slope, boolean isVector)
           
 String lineToLatexString(double x0, double y0, double x1, double y1, StyleConstants.ArrowStyle leftArrow, StyleConstants.ArrowStyle rightArrow, double dash)
          Computes a LaTeX string for a line segment, given its two end-points and decoration parameters.
 String lineToLatexString(PicPoint pt0, PicPoint pt1, StyleConstants.ArrowStyle leftArrow, StyleConstants.ArrowStyle rightArrow, double dash)
          Computes a LaTeX string for a line segment, given its two end-points and decoration parameters.
 
Methods inherited from class jpicedt.graphic.io.formatter.AbstractFormatterFactory
createFormatter, getCommentFormatter, getFormatterFactory, getLineSeparator, getMappedClass, map, revertedArrowsAttribute, setCommentFormatter, setLineSeparator, stringWriteMultiLine, textWriteMultiLine, toString, unmap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fileWrapperProlog

protected static String fileWrapperProlog

fileWrapperEpilog

protected static String fileWrapperEpilog
Constructor Detail

LatexFormatter

public LatexFormatter()
Constructor using default properties values

Method Detail

getFileWrapperProlog

protected String getFileWrapperProlog()
Description copied from class: AbstractFormatterFactory
C'est juste pour avoir une implantation par défaut pour les types de contenu qui n'ont pas besoin de cette méthode d'interface.

Overrides:
getFileWrapperProlog in class AbstractFormatterFactory
Returns:
le prologue de formatage d'un fichier autonome (stand-alone) correspondant au type de contenu offrant cette interface.

getFileWrapperEpilog

protected String getFileWrapperEpilog()
Description copied from class: AbstractFormatterFactory
C'est juste pour avoir une implantation par défaut pour les types de contenu qui n'ont pas besoin de cette méthode d'interface.

Overrides:
getFileWrapperEpilog in class AbstractFormatterFactory
Returns:
l'épilogue de formatage d'un fichier autonome (stand-alone) correspondant au type de contenu offrant cette interface.

configure

public static void configure(Properties preferences)
Configure static fields using the given Properties object

Parameters:
preferences - used to read shared parameters If null, default values are used.

createFormatter

public Formatter createFormatter(Drawing d,
                                 Object outputConstraints)
Parameters:
outputConstraints - 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(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 String lineToLatexString(PicPoint pt0,
                                PicPoint pt1,
                                StyleConstants.ArrowStyle leftArrow,
                                StyleConstants.ArrowStyle 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 segment
pt1 - the end point of the line segment
leftArrow - first arrow (we make no distinction b/w Arrow types, that is, we simply draw an arrow by using \\vector)
rightArrow - second arrow
dash - 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 String lineToLatexString(double x0,
                                double y0,
                                double x1,
                                double y1,
                                StyleConstants.ArrowStyle leftArrow,
                                StyleConstants.ArrowStyle 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 segment
y0 - The Y coordinate (in mm) of the start point of the line segment
x1 - The X coordinate (in mm) of the end point of the line segment
y1 - The Y coordinate (in mm) of the end point of the line segment
leftArrow - first arrow (we make no distinction b/w Arrow types, that is, we simply draw an arrow by using \\vector)
rightArrow - second arrow
dash - 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 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 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.

http://www.jpicedt.org

Submit a bug : syd@jpicedt.org