final IDrawing drawing = synchro.getDrawing();
StringBuilder code;
String pkg = LaTeXGenerator.getPackages();
PSTShapeView<?> pstView;
final ViewsSynchroniserHandler handler = synchro.getHandler();
final IPoint origin = handler.getOriginDrawingPoint();
final IPoint tl = handler.getTopRightDrawingPoint();
final IPoint br = handler.getBottomLeftDrawingPoint();
final int ppc = handler.getPPCDrawing();
final Map<String, String> addedColours = new HashMap<>();
final StringBuilder shapeCode = new StringBuilder();
final boolean hasBeginFigure;
if(drawing.isEmpty())
return ;
if(withComments && comment!=null && !comment.isEmpty())
cache.append(comment);
cache.append(PACKAGE_PSTRICKS);
if(!pkg.isEmpty()) {
pkg = "% User Packages:" + LResources.EOL + "% " + pkg.replace(LResources.EOL, LResources.EOL + "% "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
cache.append(pkg).append(LResources.EOL);
}
if(withLatexParams && (positionVertToken!=VerticalPosition.NONE || !caption.isEmpty() || !label.isEmpty())) {
cache.append("\\begin{figure}"); //$NON-NLS-1$
if(positionVertToken==VerticalPosition.NONE)
cache.append(LResources.EOL);
else
cache.append('[').append(positionVertToken.getToken()).append(']').append(LResources.EOL);
hasBeginFigure = true;
}
else hasBeginFigure = false;
if(withLatexParams && positionHoriCentre)
cache.append("\\begin{center}").append(LResources.EOL);//$NON-NLS-1$
final Float scaleF = (float)LNumber.getCutNumber(getScale());
cache.append("\\psscalebox{").append(scaleF).append(' ').append(scaleF).append("} % Change this value to rescale the drawing.");//$NON-NLS-1$ //$NON-NLS-2$
cache.append(LResources.EOL).append('{').append(LResources.EOL);
cache.append("\\begin{pspicture}("); //$NON-NLS-1$
cache.append(0).append(',').append((float)LNumber.getCutNumber((origin.getY()-br.getY())/ppc)).append(')').append('(');
cache.append((float)LNumber.getCutNumber((tl.getX()-origin.getX())/ppc)).append(',').append((float)LNumber.getCutNumber((origin.getY()-tl.getY())/ppc));
cache.append(')').append(LResources.EOL);
for(final IShape shape : drawing.getShapes()) {
pstView = synchro.getView(shape);