net.sf.latexdraw.glib.views.pst
Class PSTCodeGenerator

java.lang.Object
  extended by net.sf.latexdraw.glib.views.latex.LaTeXGenerator
      extended by net.sf.latexdraw.glib.views.pst.PSTCodeGenerator
All Implemented Interfaces:
Modifiable

public class PSTCodeGenerator
extends LaTeXGenerator

Defines a PSTricks generator; it manages the PSTricks views and the latex additional code.
This file is part of LaTeXDraw.
Copyright (c) 2005-2012 Arnaud BLOUIN

LaTeXDraw is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
LaTeXDraw is distributed without any warranty; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

05/23/2010

Since:
3.0
Author:
Arnaud BLOUIN

Nested Class Summary
 
Nested classes/interfaces inherited from class net.sf.latexdraw.glib.views.latex.LaTeXGenerator
LaTeXGenerator.VerticalPosition
 
Field Summary
protected  java.lang.StringBuilder cache
          The code cache.
static java.lang.String PACKAGE_PSTRICKS
           
protected  PSTViewsSynchroniser synchro
          The PSTricks views.
protected  boolean withComments
          Defines if the comments must be generated.
protected  boolean withLatexParams
          Defines if the latex parameters (position, caption, etc.) must be generated.
 
Fields inherited from class net.sf.latexdraw.glib.views.latex.LaTeXGenerator
caption, comment, label, LGTH_START_LINE_COMMENT, modified, PACKAGES, positionHoriCentre, positionVertToken
 
Constructor Summary
PSTCodeGenerator(IDrawing drawing, ViewsSynchroniserHandler handler, boolean withLatexParams, boolean withComments)
          Creates and initialises the generator.
 
Method Summary
protected  void emptyCache()
          Empties the cache.
private  void generateColourCode(PSTShapeView<?> pstView, java.util.Map<java.lang.String,java.lang.String> addedColours)
          Adds the PST colour code to the cache.
 java.lang.StringBuilder getCache()
           
 PSTViewsSynchroniser getSynchro()
           
 boolean isWithComments()
           
 boolean isWithLatexParams()
           
 void setWithComments(boolean withComments)
          Defines if the code must contains comments.
 void setWithLatexParams(boolean withLatexParams)
          Defines if the latex parameters must be used by the generated code.
 void update()
          Updates the code cache.
 void updateFull()
          Updates the cache of every shapes and those of this generator.
 
Methods inherited from class net.sf.latexdraw.glib.views.latex.LaTeXGenerator
createLatexFile, createPDFFile, createPSFile, createPSFile, getCaption, getComment, getCommentsWithoutTag, getLabel, getLatexDocument, getPackages, getPackagesUnary, getPositionVertToken, isModified, isPositionHoriCentre, setCaption, setComment, setLabel, setModified, setPackages, setPositionHoriCentre, setPositionVertToken
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PACKAGE_PSTRICKS

public static final java.lang.String PACKAGE_PSTRICKS

synchro

protected PSTViewsSynchroniser synchro
The PSTricks views.


cache

protected java.lang.StringBuilder cache
The code cache.


withLatexParams

protected boolean withLatexParams
Defines if the latex parameters (position, caption, etc.) must be generated.


withComments

protected boolean withComments
Defines if the comments must be generated.

Constructor Detail

PSTCodeGenerator

public PSTCodeGenerator(IDrawing drawing,
                        ViewsSynchroniserHandler handler,
                        boolean withLatexParams,
                        boolean withComments)
Creates and initialises the generator.

Parameters:
drawing - The shapes used to generate PST code.
handler - The handler that provides information to the generator.
withLatexParams - Defines if the latex parameters (position, caption, etc.) must be generated.
withComments - Defines if the comments must be generated.
Throws:
java.lang.IllegalArgumentException - If the given drawing parameter is null.
Since:
3.0
Method Detail

getSynchro

public PSTViewsSynchroniser getSynchro()
Returns:
the synchroniser.
Since:
3.0

getCache

public java.lang.StringBuilder getCache()
Returns:
the cache.
Since:
3.0

update

public void update()
Description copied from class: LaTeXGenerator
Updates the code cache.

Specified by:
update in class LaTeXGenerator

generateColourCode

private void generateColourCode(PSTShapeView<?> pstView,
                                java.util.Map<java.lang.String,java.lang.String> addedColours)
Adds the PST colour code to the cache.

Parameters:
pstView - The shape which colour code will be generated.
addedColours - The PST colours already generated.
Since:
3.0

emptyCache

protected void emptyCache()
Empties the cache.

Since:
3.0

updateFull

public void updateFull()
Updates the cache of every shapes and those of this generator.

Since:
3.0

isWithLatexParams

public boolean isWithLatexParams()
Returns:
True: The latex parameters must be used by the generated code.
Since:
3.0

setWithLatexParams

public void setWithLatexParams(boolean withLatexParams)
Defines if the latex parameters must be used by the generated code.

Parameters:
withLatexParams - True: The latex parameters must be used by the generated code.
Since:
3.0

isWithComments

public boolean isWithComments()
Returns:
True: comments will be included.
Since:
3.0

setWithComments

public void setWithComments(boolean withComments)
Defines if the code must contains comments.

Parameters:
withComments - True: comments will be included.
Since:
3.0