net.sf.latexdraw.glib.views.pst
Class PSTShapeView<S extends IShape>

java.lang.Object
  extended by net.sf.latexdraw.glib.views.AbstractView<S>
      extended by net.sf.latexdraw.glib.views.AbstractCodeView<S>
          extended by net.sf.latexdraw.glib.views.pst.PSTShapeView<S>
All Implemented Interfaces:
IAbstractView
Direct Known Subclasses:
PSTAxesView, PSTClassicalView, PSTGridView, PSTGroupView, PSTPictureView, PSTTextView

abstract class PSTShapeView<S extends IShape>
extends AbstractCodeView<S>

Defines a PSTricks view of the LShape model.

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.

04/15/2008

Since:
3.0
Author:
Arnaud BLOUIN

Field Summary
protected  java.util.Set<java.lang.String> coloursName
          The list of name of the colours added to the generated code.
 
Fields inherited from class net.sf.latexdraw.glib.views.AbstractCodeView
cache
 
Fields inherited from class net.sf.latexdraw.glib.views.AbstractView
shape
 
Constructor Summary
protected PSTShapeView(S model)
          Creates and initialises an abstract PSTricks view.
 
Method Summary
protected  void addColour(java.lang.String name)
          Saves a colour coming from the generated code.
private  java.lang.StringBuilder getArrowParametersCode(IArrow arrow)
           
protected  java.lang.StringBuilder getArrowsParametersCode()
           
protected  java.lang.StringBuilder getArrowsStyleCode()
           
protected  java.lang.StringBuilder getBorderPositionCode()
           
protected  java.lang.String getColourName(java.awt.Color colour)
           
protected  java.lang.StringBuilder getDoubleBorderCode(float ppc)
           
protected  java.lang.StringBuilder getFillingCode(float ppc)
           
private  java.lang.StringBuilder getFillingGrad()
           
private  java.lang.StringBuilder getFillingHatchings(float ppc)
           
private  java.lang.StringBuilder getFillingPlain()
           
protected  java.lang.StringBuilder getLineCode(float ppc)
           
protected  java.lang.StringBuilder getRotationHeaderCode(float ppc, IPoint position)
           
protected  java.lang.StringBuilder getShadowCode(float ppc)
           
protected  java.lang.StringBuilder getShowPointsCode()
           
 void update()
          Updates the view.
abstract  void updateCache(IPoint origin, float ppc)
          Updates the cache.
 
Methods inherited from class net.sf.latexdraw.glib.views.AbstractCodeView
emptyCache, getCache
 
Methods inherited from class net.sf.latexdraw.glib.views.AbstractView
getShape
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

coloursName

protected java.util.Set<java.lang.String> coloursName
The list of name of the colours added to the generated code. Useful when generating the code to define the colours in the latex document.

Constructor Detail

PSTShapeView

protected PSTShapeView(S model)
Creates and initialises an abstract PSTricks view.

Parameters:
model - The model to view.
Throws:
java.lang.IllegalArgumentException - If the given model is not valid.
Since:
3.0
Method Detail

addColour

protected void addColour(java.lang.String name)
Saves a colour coming from the generated code.

Parameters:
name - The name of the generated colour.
Since:
3.0

update

public void update()
Description copied from interface: IAbstractView
Updates the view.


updateCache

public abstract void updateCache(IPoint origin,
                                 float ppc)
Updates the cache.

Parameters:
origin - The origin point of the PST drawing.
ppc - The number of point per centimetre.
Since:
3.0

getArrowsParametersCode

protected java.lang.StringBuilder getArrowsParametersCode()
Returns:
The PST code corresponding to the arrow parameters of the shape. Or null if no arrow.
Since:
3.0

getArrowParametersCode

private java.lang.StringBuilder getArrowParametersCode(IArrow arrow)
Returns:
The PST code corresponding to the parameter of the style of the given arrow. The style of the given arrow must not be NONE.

getArrowsStyleCode

protected java.lang.StringBuilder getArrowsStyleCode()
Returns:
The PST code corresponding to the style of the arrows (e.g. {|->}).
Since:
3.0

getShowPointsCode

protected java.lang.StringBuilder getShowPointsCode()
Returns:
The PSTricks code of the show-points option or null.
Since:
3.0

getRotationHeaderCode

protected java.lang.StringBuilder getRotationHeaderCode(float ppc,
                                                        IPoint position)
Parameters:
ppc - The number of pixels per centimetre.
position - The reference point of the PSTricks drawing.
Returns:
The header of the PSTricks rotation code.
Since:
3.0

getColourName

protected java.lang.String getColourName(java.awt.Color colour)
Parameters:
colour - The colour which name is looking for. If the colour does not exist yet, it is created.
Returns:
The name of a predefined or a newly generated colour.
Since:
3.0

getDoubleBorderCode

protected java.lang.StringBuilder getDoubleBorderCode(float ppc)
Parameters:
ppc - The number of pixels per centimetre.
Returns:
The PSTricks code of the double border of the shape.
Since:
3.0

getBorderPositionCode

protected java.lang.StringBuilder getBorderPositionCode()
Returns:
The PSTricks code of the border position.
Since:
3.0

getLineCode

protected java.lang.StringBuilder getLineCode(float ppc)
Parameters:
ppc - The number of pixels per centimetre.
Returns:
The PSTricks code of the line style.
Since:
1.7

getFillingPlain

private java.lang.StringBuilder getFillingPlain()
Returns:
The PST code of the filling with parameter "plain".
Since:
3.0

getFillingGrad

private java.lang.StringBuilder getFillingGrad()
Returns:
The PST code of the filling with parameter "gradient".
Since:
3.0

getFillingHatchings

private java.lang.StringBuilder getFillingHatchings(float ppc)
Returns:
The PST code of the filling with parameter "hlines" or "vlines" etc.
Since:
3.0

getFillingCode

protected java.lang.StringBuilder getFillingCode(float ppc)
Parameters:
ppc - The number of pixels per centimetre.
Returns:
The PSTricks code for the filling of the shape. Null if there is no filling.
Since:
1.7

getShadowCode

protected java.lang.StringBuilder getShadowCode(float ppc)
Parameters:
ppc - The number of pixels per centimetre.
Returns:
The code of the shape shadow or null if there is no shadow.
Since:
3.0