diff --git a/src/net/sourceforge/plantuml/AbstractPSystem.java b/src/net/sourceforge/plantuml/AbstractPSystem.java index 3acf9f677..b94ee078d 100644 --- a/src/net/sourceforge/plantuml/AbstractPSystem.java +++ b/src/net/sourceforge/plantuml/AbstractPSystem.java @@ -143,7 +143,7 @@ public abstract class AbstractPSystem implements Diagram { throws IOException { final long now = System.currentTimeMillis(); try { - return exportDiagramNow(os, index, fileFormatOption, seed()); + return exportDiagramNow(os, index, fileFormatOption); } finally { if (OptionFlags.getInstance().isEnableStats()) { StatsUtilsIncrement.onceMoreGenerate(System.currentTimeMillis() - now, getClass(), @@ -160,8 +160,8 @@ public abstract class AbstractPSystem implements Diagram { return scale; } - protected abstract ImageData exportDiagramNow(OutputStream os, int index, FileFormatOption fileFormatOption, - long seed) throws IOException; + protected abstract ImageData exportDiagramNow(OutputStream os, int index, FileFormatOption fileFormatOption + ) throws IOException; public ClockwiseTopRightBottomLeft getDefaultMargins() { return ClockwiseTopRightBottomLeft.same(0); diff --git a/src/net/sourceforge/plantuml/NewpagedDiagram.java b/src/net/sourceforge/plantuml/NewpagedDiagram.java index 0dff3902d..207113786 100644 --- a/src/net/sourceforge/plantuml/NewpagedDiagram.java +++ b/src/net/sourceforge/plantuml/NewpagedDiagram.java @@ -102,7 +102,7 @@ public class NewpagedDiagram extends AbstractPSystem { } @Override - final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) + final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat) throws IOException { return diagrams.get(num).exportDiagram(os, 0, fileFormat); } diff --git a/src/net/sourceforge/plantuml/PlainDiagram.java b/src/net/sourceforge/plantuml/PlainDiagram.java index f6cd304a0..4c28ca5d9 100644 --- a/src/net/sourceforge/plantuml/PlainDiagram.java +++ b/src/net/sourceforge/plantuml/PlainDiagram.java @@ -47,14 +47,15 @@ import static net.sourceforge.plantuml.ugraphic.ImageBuilder.plainImageBuilder; public abstract class PlainDiagram extends AbstractPSystem { @Override - protected ImageData exportDiagramNow(OutputStream os, int index, FileFormatOption fileFormatOption, long seed) + protected ImageData exportDiagramNow(OutputStream os, int index, FileFormatOption fileFormatOption) throws IOException { final UDrawable drawable = getRootDrawable(fileFormatOption); - final ImageBuilder builder = plainImageBuilder(drawable, fileFormatOption, seed) + final ImageBuilder builder = plainImageBuilder(drawable, fileFormatOption) .margin(getDefaultMargins()) - .metadata(fileFormatOption.isWithMetadata() ? getMetadata() : null); + .metadata(fileFormatOption.isWithMetadata() ? getMetadata() : null) + .seed(seed()); return adjustImageBuilder(builder).write(os); } diff --git a/src/net/sourceforge/plantuml/SourceStringReader.java b/src/net/sourceforge/plantuml/SourceStringReader.java index 5af474fda..3bdec0246 100644 --- a/src/net/sourceforge/plantuml/SourceStringReader.java +++ b/src/net/sourceforge/plantuml/SourceStringReader.java @@ -146,7 +146,7 @@ public class SourceStringReader { public DiagramDescription outputImage(OutputStream os, int numImage, FileFormatOption fileFormatOption) throws IOException { if (blocks.size() == 0) { - noStartumlFound(os, fileFormatOption, 42); + noStartumlFound(os, fileFormatOption); return null; } for (BlockUml b : blocks) { @@ -222,11 +222,11 @@ public class SourceStringReader { } - public ImageData noStartumlFound(OutputStream os, FileFormatOption fileFormatOption, long seed) throws IOException { + public ImageData noStartumlFound(OutputStream os, FileFormatOption fileFormatOption) throws IOException { final TextBlockBackcolored error = GraphicStrings.createForError(Arrays.asList("No @startuml/@enduml found"), fileFormatOption.isUseRedForError()); - return plainImageBuilder(error, fileFormatOption, seed) + return plainImageBuilder(error, fileFormatOption) .write(os); } diff --git a/src/net/sourceforge/plantuml/UmlDiagram.java b/src/net/sourceforge/plantuml/UmlDiagram.java index 484fd6dbe..e65f3e1d0 100644 --- a/src/net/sourceforge/plantuml/UmlDiagram.java +++ b/src/net/sourceforge/plantuml/UmlDiagram.java @@ -132,7 +132,7 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot } @Override - final protected ImageData exportDiagramNow(OutputStream os, int index, FileFormatOption fileFormatOption, long seed) + final protected ImageData exportDiagramNow(OutputStream os, int index, FileFormatOption fileFormatOption) throws IOException { final HColor hover = getSkinParam().hoverPathColor(); @@ -155,20 +155,20 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot return imageData; } catch (NoStyleAvailableException e) { // e.printStackTrace(); - exportDiagramError(os, e, fileFormatOption, seed, null); + exportDiagramError(os, e, fileFormatOption, null); } catch (UnparsableGraphvizException e) { e.printStackTrace(); - exportDiagramError(os, e.getCause(), fileFormatOption, seed, e.getGraphvizVersion()); + exportDiagramError(os, e.getCause(), fileFormatOption, e.getGraphvizVersion()); } catch (Throwable e) { //e.printStackTrace(); - exportDiagramError(os, e, fileFormatOption, seed, null); + exportDiagramError(os, e, fileFormatOption, null); } return ImageDataSimple.error(); } - private void exportDiagramError(OutputStream os, Throwable exception, FileFormatOption fileFormat, long seed, + private void exportDiagramError(OutputStream os, Throwable exception, FileFormatOption fileFormat, String graphvizVersion) throws IOException { - exportDiagramError(os, exception, fileFormat, seed, getMetadata(), getFlashData(), + exportDiagramError(os, exception, fileFormat, seed(), getMetadata(), getFlashData(), getFailureText1(exception, graphvizVersion, getFlashData())); } @@ -208,8 +208,9 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot } }; - plainImageBuilder(drawable, fileFormat, seed) + plainImageBuilder(drawable, fileFormat) .metadata(metadata) + .seed(seed) .write(os); } diff --git a/src/net/sourceforge/plantuml/acearth/PSystemXearth.java b/src/net/sourceforge/plantuml/acearth/PSystemXearth.java index 305e60fa7..abc2a244c 100644 --- a/src/net/sourceforge/plantuml/acearth/PSystemXearth.java +++ b/src/net/sourceforge/plantuml/acearth/PSystemXearth.java @@ -78,7 +78,7 @@ public class PSystemXearth extends AbstractPSystem { } @Override - final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) + final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat) throws IOException { synchronized (PSystemXearth.class) { final ACearth earth = new ACearth(markers); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java b/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java index bb0a050c1..e363d5d01 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java @@ -205,7 +205,7 @@ public class ActivityDiagram3 extends UmlDiagram { result = CompressionXorYBuilder.build(CompressionMode.ON_Y, result, stringBounder); result = new TextBlockRecentred(result); - return styledImageBuilder(this, result, index, fileFormatOption, seed()) + return styledImageBuilder(this, result, index, fileFormatOption) .write(os); } diff --git a/src/net/sourceforge/plantuml/board/BoardDiagram.java b/src/net/sourceforge/plantuml/board/BoardDiagram.java index 8d42e6a04..95f7587c5 100644 --- a/src/net/sourceforge/plantuml/board/BoardDiagram.java +++ b/src/net/sourceforge/plantuml/board/BoardDiagram.java @@ -78,7 +78,7 @@ public class BoardDiagram extends UmlDiagram { protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption) throws IOException { - return styledImageBuilder(this, getTextBlock(), index, fileFormatOption, seed()) + return styledImageBuilder(this, getTextBlock(), index, fileFormatOption) .write(os); } diff --git a/src/net/sourceforge/plantuml/bpm/BpmDiagram.java b/src/net/sourceforge/plantuml/bpm/BpmDiagram.java index 6103bd2dd..adc22c35a 100644 --- a/src/net/sourceforge/plantuml/bpm/BpmDiagram.java +++ b/src/net/sourceforge/plantuml/bpm/BpmDiagram.java @@ -82,7 +82,7 @@ public class BpmDiagram extends UmlDiagram { protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption) throws IOException { - return styledImageBuilder(this, getUDrawable(), index, fileFormatOption, seed()) + return styledImageBuilder(this, getUDrawable(), index, fileFormatOption) .annotations(false) .write(os); } diff --git a/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java b/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java index 5ee57541c..8fb823cdb 100644 --- a/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java +++ b/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java @@ -198,7 +198,7 @@ public class ClassDiagram extends AbstractClassOrObjectDiagram { final RowLayout rawLayout = getRawLayout(i); fullLayout.addRowLayout(rawLayout); } - return styledImageBuilder(this, fullLayout, index, fileFormatOption, seed()) + return styledImageBuilder(this, fullLayout, index, fileFormatOption) .annotations(false) // Backwards compatibility - this only applies when "layout_new_line" is used .write(os); } diff --git a/src/net/sourceforge/plantuml/directdot/PSystemDot.java b/src/net/sourceforge/plantuml/directdot/PSystemDot.java index 292e23c8f..ea7e56d34 100644 --- a/src/net/sourceforge/plantuml/directdot/PSystemDot.java +++ b/src/net/sourceforge/plantuml/directdot/PSystemDot.java @@ -68,7 +68,7 @@ public class PSystemDot extends AbstractPSystem { } @Override - final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) + final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat) throws IOException { final Graphviz graphviz = GraphvizUtils.createForSystemDot(null, data, StringUtils.goLowerCase(fileFormat.getFileFormat().name())); diff --git a/src/net/sourceforge/plantuml/ditaa/PSystemDitaa.java b/src/net/sourceforge/plantuml/ditaa/PSystemDitaa.java index 937b1a122..05593f372 100644 --- a/src/net/sourceforge/plantuml/ditaa/PSystemDitaa.java +++ b/src/net/sourceforge/plantuml/ditaa/PSystemDitaa.java @@ -88,7 +88,7 @@ public class PSystemDitaa extends AbstractPSystem { } @Override - final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) + final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat) throws IOException { if (fileFormat.getFileFormat() == FileFormat.ATXT) { os.write(getSource().getPlainString().getBytes()); diff --git a/src/net/sourceforge/plantuml/eggs/PSystemPath.java b/src/net/sourceforge/plantuml/eggs/PSystemPath.java index 712c6783a..023b45582 100644 --- a/src/net/sourceforge/plantuml/eggs/PSystemPath.java +++ b/src/net/sourceforge/plantuml/eggs/PSystemPath.java @@ -53,7 +53,7 @@ public class PSystemPath extends AbstractPSystem { } @Override - final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) + final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat) throws IOException { return path.writeImage(os); } diff --git a/src/net/sourceforge/plantuml/error/PSystemError.java b/src/net/sourceforge/plantuml/error/PSystemError.java index 3b588cf76..58cee13c1 100644 --- a/src/net/sourceforge/plantuml/error/PSystemError.java +++ b/src/net/sourceforge/plantuml/error/PSystemError.java @@ -222,7 +222,7 @@ public abstract class PSystemError extends PlainDiagram { } @Override - final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) + final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat) throws IOException { if (fileFormat.getFileFormat() == FileFormat.ATXT || fileFormat.getFileFormat() == FileFormat.UTXT) { final UGraphicTxt ugt = new UGraphicTxt(); @@ -232,7 +232,7 @@ public abstract class PSystemError extends PlainDiagram { return new ImageDataSimple(1, 1); } - return super.exportDiagramNow(os, num, fileFormat, seed); + return super.exportDiagramNow(os, num, fileFormat); } @Override diff --git a/src/net/sourceforge/plantuml/gitlog/GitDiagram.java b/src/net/sourceforge/plantuml/gitlog/GitDiagram.java index e57614083..c72c4f843 100644 --- a/src/net/sourceforge/plantuml/gitlog/GitDiagram.java +++ b/src/net/sourceforge/plantuml/gitlog/GitDiagram.java @@ -73,7 +73,7 @@ public class GitDiagram extends UmlDiagram { protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption) throws IOException { - return styledImageBuilder(this, getTextBlock(), index, fileFormatOption, 0) + return styledImageBuilder(this, getTextBlock(), index, fileFormatOption) .write(os); } diff --git a/src/net/sourceforge/plantuml/help/Help.java b/src/net/sourceforge/plantuml/help/Help.java index 15b3f5cc1..580c55897 100644 --- a/src/net/sourceforge/plantuml/help/Help.java +++ b/src/net/sourceforge/plantuml/help/Help.java @@ -78,7 +78,7 @@ public class Help extends UmlDiagram { final Sheet sheet = Parser.build(fontConfiguration, HorizontalAlignment.LEFT, getSkinParam(), CreoleMode.FULL) .createSheet(display); final SheetBlock1 sheetBlock = new SheetBlock1(sheet, LineBreakStrategy.NONE, 0); - return styledImageBuilder(this, sheetBlock, 1, fileFormat, 0) + return styledImageBuilder(this, sheetBlock, 1, fileFormat) .annotations(false) .write(os); } diff --git a/src/net/sourceforge/plantuml/jcckit/PSystemJcckit.java b/src/net/sourceforge/plantuml/jcckit/PSystemJcckit.java index f84fbabdf..92de0be05 100644 --- a/src/net/sourceforge/plantuml/jcckit/PSystemJcckit.java +++ b/src/net/sourceforge/plantuml/jcckit/PSystemJcckit.java @@ -64,7 +64,7 @@ public class PSystemJcckit extends AbstractPSystem { } @Override - final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) + final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat) throws IOException { BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); diff --git a/src/net/sourceforge/plantuml/jsondiagram/JsonDiagram.java b/src/net/sourceforge/plantuml/jsondiagram/JsonDiagram.java index b6a066e63..b33481560 100644 --- a/src/net/sourceforge/plantuml/jsondiagram/JsonDiagram.java +++ b/src/net/sourceforge/plantuml/jsondiagram/JsonDiagram.java @@ -86,10 +86,10 @@ public class JsonDiagram extends TitledDiagram { } @Override - protected ImageData exportDiagramNow(OutputStream os, int index, FileFormatOption fileFormatOption, long seed) + protected ImageData exportDiagramNow(OutputStream os, int index, FileFormatOption fileFormatOption) throws IOException { - return styledImageBuilder(this, getTextBlock(), index, fileFormatOption, 0) + return styledImageBuilder(this, getTextBlock(), index, fileFormatOption) .write(os); } diff --git a/src/net/sourceforge/plantuml/logo/PSystemLogo.java b/src/net/sourceforge/plantuml/logo/PSystemLogo.java index 31bf99d3f..bd166f0b6 100644 --- a/src/net/sourceforge/plantuml/logo/PSystemLogo.java +++ b/src/net/sourceforge/plantuml/logo/PSystemLogo.java @@ -61,7 +61,7 @@ public class PSystemLogo extends AbstractPSystem { } @Override - final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) + final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat) throws IOException { final int width = 640; final int height = 480; diff --git a/src/net/sourceforge/plantuml/math/PSystemLatex.java b/src/net/sourceforge/plantuml/math/PSystemLatex.java index 1a063146f..ed9aa8f7a 100644 --- a/src/net/sourceforge/plantuml/math/PSystemLatex.java +++ b/src/net/sourceforge/plantuml/math/PSystemLatex.java @@ -63,7 +63,7 @@ public class PSystemLatex extends AbstractPSystem { } @Override - final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) + final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat) throws IOException { final ScientificEquationSafe asciiMath = ScientificEquationSafe.fromLatex(latex); return asciiMath.export(os, fileFormat, scale, color, backColor); diff --git a/src/net/sourceforge/plantuml/math/PSystemMath.java b/src/net/sourceforge/plantuml/math/PSystemMath.java index 00b20602c..6f4fcfbfb 100644 --- a/src/net/sourceforge/plantuml/math/PSystemMath.java +++ b/src/net/sourceforge/plantuml/math/PSystemMath.java @@ -63,7 +63,7 @@ public class PSystemMath extends AbstractPSystem { } @Override - final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) + final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat) throws IOException { final ScientificEquationSafe asciiMath = ScientificEquationSafe.fromAsciiMath(math); return asciiMath.export(os, fileFormat, scale, color, backColor); diff --git a/src/net/sourceforge/plantuml/math/ScientificEquationSafe.java b/src/net/sourceforge/plantuml/math/ScientificEquationSafe.java index 537a1da15..90f2603f4 100644 --- a/src/net/sourceforge/plantuml/math/ScientificEquationSafe.java +++ b/src/net/sourceforge/plantuml/math/ScientificEquationSafe.java @@ -101,7 +101,7 @@ public class ScientificEquationSafe { printTrace(e); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { - dimSvg = plainImageBuilder(getRollback(), new FileFormatOption(FileFormat.SVG), 42) + dimSvg = plainImageBuilder(getRollback(), new FileFormatOption(FileFormat.SVG)) .write(baos); } catch (IOException e1) { return null; diff --git a/src/net/sourceforge/plantuml/mindmap/MindMapDiagram.java b/src/net/sourceforge/plantuml/mindmap/MindMapDiagram.java index 34aee8cf0..dcfae9cc9 100644 --- a/src/net/sourceforge/plantuml/mindmap/MindMapDiagram.java +++ b/src/net/sourceforge/plantuml/mindmap/MindMapDiagram.java @@ -84,7 +84,7 @@ public class MindMapDiagram extends UmlDiagram { protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption) throws IOException { - return styledImageBuilder(this, getTextBlock(), index, fileFormatOption, seed()) + return styledImageBuilder(this, getTextBlock(), index, fileFormatOption) .write(os); } diff --git a/src/net/sourceforge/plantuml/nwdiag/NwDiagram.java b/src/net/sourceforge/plantuml/nwdiag/NwDiagram.java index d960c908c..3e1cd7c75 100644 --- a/src/net/sourceforge/plantuml/nwdiag/NwDiagram.java +++ b/src/net/sourceforge/plantuml/nwdiag/NwDiagram.java @@ -215,7 +215,7 @@ public class NwDiagram extends UmlDiagram { protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption) throws IOException { - return styledImageBuilder(this, getTextBlock(), index, fileFormatOption, 0) + return styledImageBuilder(this, getTextBlock(), index, fileFormatOption) .write(os); } diff --git a/src/net/sourceforge/plantuml/picoweb/PicoWebServer.java b/src/net/sourceforge/plantuml/picoweb/PicoWebServer.java index 7871930a1..0faec5899 100644 --- a/src/net/sourceforge/plantuml/picoweb/PicoWebServer.java +++ b/src/net/sourceforge/plantuml/picoweb/PicoWebServer.java @@ -189,7 +189,7 @@ public class PicoWebServer implements Runnable { system = PSystemErrorUtils.buildV2(null, new ErrorUml(SYNTAX_ERROR, "No @startuml/@enduml found", 0, new LineLocationImpl("", null)), null, Collections.emptyList()); - imageData = ssr.noStartumlFound(os, option.getFileFormatOption(), 42); + imageData = ssr.noStartumlFound(os, option.getFileFormatOption()); } else { system = ssr.getBlocks().get(0).getDiagram(); imageData = system.exportDiagram(os, 0, option.getFileFormatOption()); diff --git a/src/net/sourceforge/plantuml/project/GanttDiagram.java b/src/net/sourceforge/plantuml/project/GanttDiagram.java index be3a1d785..831df891e 100644 --- a/src/net/sourceforge/plantuml/project/GanttDiagram.java +++ b/src/net/sourceforge/plantuml/project/GanttDiagram.java @@ -163,10 +163,10 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw, WithSprit } @Override - protected ImageData exportDiagramNow(OutputStream os, int index, FileFormatOption fileFormatOption, long seed) + protected ImageData exportDiagramNow(OutputStream os, int index, FileFormatOption fileFormatOption) throws IOException { final StringBounder stringBounder = fileFormatOption.getDefaultStringBounder(getSkinParam()); - return styledImageBuilder(this, getTextBlock(stringBounder), index, fileFormatOption, seed()) + return styledImageBuilder(this, getTextBlock(stringBounder), index, fileFormatOption) .write(os); } diff --git a/src/net/sourceforge/plantuml/salt/PSystemSalt.java b/src/net/sourceforge/plantuml/salt/PSystemSalt.java index 126a1bd14..6031b3628 100644 --- a/src/net/sourceforge/plantuml/salt/PSystemSalt.java +++ b/src/net/sourceforge/plantuml/salt/PSystemSalt.java @@ -112,17 +112,17 @@ public class PSystemSalt extends TitledDiagram implements WithSprite { } @Override - final protected ImageData exportDiagramNow(OutputStream os, int index, FileFormatOption fileFormatOption, long seed) + final protected ImageData exportDiagramNow(OutputStream os, int index, FileFormatOption fileFormatOption) throws IOException { try { final Element salt = createElement(manageSprite()); final StringBounder stringBounder = fileFormatOption.getDefaultStringBounder(getSkinParam()); final Dimension2D size = salt.getPreferredDimension(stringBounder, 0, 0); - return styledImageBuilder(this, getTextBlock(salt, size), index, fileFormatOption, seed()) + return styledImageBuilder(this, getTextBlock(salt, size), index, fileFormatOption) .write(os); } catch (Exception e) { e.printStackTrace(); - UmlDiagram.exportDiagramError(os, e, fileFormatOption, seed, getMetadata(), "none", + UmlDiagram.exportDiagramError(os, e, fileFormatOption, seed(), getMetadata(), "none", new ArrayList()); return ImageDataSimple.error(); } diff --git a/src/net/sourceforge/plantuml/sdot/CucaDiagramFileMakerSmetana.java b/src/net/sourceforge/plantuml/sdot/CucaDiagramFileMakerSmetana.java index b7f1d7211..35eaedc55 100644 --- a/src/net/sourceforge/plantuml/sdot/CucaDiagramFileMakerSmetana.java +++ b/src/net/sourceforge/plantuml/sdot/CucaDiagramFileMakerSmetana.java @@ -450,7 +450,7 @@ public class CucaDiagramFileMakerSmetana implements CucaDiagramFileMaker { // imageBuilder.setUDrawable(new Drawing(new YMirror(dim.getHeight()))); final TextBlock drawable = new Drawing(new YMirror(minMax.getMaxY()), minMax); - return styledImageBuilder(diagram, drawable, 1, fileFormatOption, diagram.seed()) + return styledImageBuilder(diagram, drawable, 1, fileFormatOption) .write(os); } catch (Throwable e) { SmetanaDebug.printMe(); diff --git a/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramFileMakerPuma2.java b/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramFileMakerPuma2.java index 662811bb9..77170b662 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramFileMakerPuma2.java +++ b/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramFileMakerPuma2.java @@ -220,7 +220,7 @@ public class SequenceDiagramFileMakerPuma2 implements FileMaker { } }; - return styledImageBuilder(diagram, drawable, index, fileFormatOption, diagram.seed()) + return styledImageBuilder(diagram, drawable, index, fileFormatOption) .annotations(false) // they are managed above .write(os); } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/SequenceDiagramFileMakerTeoz.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/SequenceDiagramFileMakerTeoz.java index df4b3ae95..ef488e074 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/SequenceDiagramFileMakerTeoz.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/SequenceDiagramFileMakerTeoz.java @@ -139,7 +139,7 @@ public class SequenceDiagramFileMakerTeoz implements FileMaker { if (this.index != index) { throw new IllegalStateException(); } - return styledImageBuilder(diagram, new Foo(index), index, fileFormatOption, diagram.seed()) + return styledImageBuilder(diagram, new Foo(index), index, fileFormatOption) .annotations(false) // they are managed in drawInternal() .write(os); } diff --git a/src/net/sourceforge/plantuml/sprite/ListSpriteDiagram.java b/src/net/sourceforge/plantuml/sprite/ListSpriteDiagram.java index 2c50d86fc..48d8169dc 100644 --- a/src/net/sourceforge/plantuml/sprite/ListSpriteDiagram.java +++ b/src/net/sourceforge/plantuml/sprite/ListSpriteDiagram.java @@ -74,7 +74,7 @@ public class ListSpriteDiagram extends UmlDiagram { protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption) throws IOException { - return styledImageBuilder(this, getTable(), index, fileFormatOption, seed()) + return styledImageBuilder(this, getTable(), index, fileFormatOption) .annotations(false) .write(os); } diff --git a/src/net/sourceforge/plantuml/sprite/StdlibDiagram.java b/src/net/sourceforge/plantuml/sprite/StdlibDiagram.java index 316eeb93a..403a2306e 100644 --- a/src/net/sourceforge/plantuml/sprite/StdlibDiagram.java +++ b/src/net/sourceforge/plantuml/sprite/StdlibDiagram.java @@ -84,7 +84,7 @@ public class StdlibDiagram extends UmlDiagram { protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption) throws IOException { - return styledImageBuilder(this, getTable(), index, fileFormatOption, seed()) + return styledImageBuilder(this, getTable(), index, fileFormatOption) .annotations(false) .write(os); } diff --git a/src/net/sourceforge/plantuml/sudoku/PSystemSudoku.java b/src/net/sourceforge/plantuml/sudoku/PSystemSudoku.java index 449c1618f..f80b08a08 100644 --- a/src/net/sourceforge/plantuml/sudoku/PSystemSudoku.java +++ b/src/net/sourceforge/plantuml/sudoku/PSystemSudoku.java @@ -49,7 +49,7 @@ public class PSystemSudoku extends AbstractPSystem { final private ISudoku sudoku; @Override - final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) + final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat) throws IOException { final GraphicsSudoku sud = new GraphicsSudoku(sudoku); if (fileFormat.getFileFormat() == FileFormat.EPS) { diff --git a/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek.java b/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek.java index dc5b5c2ce..b3019b694 100644 --- a/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek.java +++ b/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek.java @@ -120,7 +120,7 @@ public final class CucaDiagramFileMakerSvek implements CucaDiagramFileMaker { // Sorry about this hack. There is a side effect in SvekResult::calculateDimension() result.calculateDimension(stringBounder); // Ensure text near the margins is not cut off - return styledImageBuilder(diagram, result, 1, fileFormatOption, diagram.seed()) + return styledImageBuilder(diagram, result, 1, fileFormatOption) .annotations(false) // backwards compatibility (AnnotatedWorker is used above) .status(result instanceof GraphvizCrash ? 503 : 0) .warningOrError(warningOrError) diff --git a/src/net/sourceforge/plantuml/timingdiagram/TimingDiagram.java b/src/net/sourceforge/plantuml/timingdiagram/TimingDiagram.java index e04aa5e40..96b391e14 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/TimingDiagram.java +++ b/src/net/sourceforge/plantuml/timingdiagram/TimingDiagram.java @@ -98,7 +98,7 @@ public class TimingDiagram extends UmlDiagram implements Clocks { protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption) throws IOException { - return styledImageBuilder(this, getTextBlock(), index, fileFormatOption, seed()) + return styledImageBuilder(this, getTextBlock(), index, fileFormatOption) .write(os); } diff --git a/src/net/sourceforge/plantuml/ugraphic/ImageBuilder.java b/src/net/sourceforge/plantuml/ugraphic/ImageBuilder.java index 3cc768b0a..28c9f1ca9 100644 --- a/src/net/sourceforge/plantuml/ugraphic/ImageBuilder.java +++ b/src/net/sourceforge/plantuml/ugraphic/ImageBuilder.java @@ -111,36 +111,36 @@ public class ImageBuilder { private final TitledDiagram titledDiagram; private UDrawable udrawable; private final FileFormatOption fileFormatOption; - private final long seed; + private long seed = 42; private int status = 0; private String metadata; private boolean randomPixel; private String warningOrError; - public static ImageBuilder plainImageBuilder(UDrawable drawable, FileFormatOption fileFormatOption, long seed) { - return new ImageBuilder(drawable, null, fileFormatOption, seed, new ImageParameter()); + public static ImageBuilder plainImageBuilder(UDrawable drawable, FileFormatOption fileFormatOption) { + return new ImageBuilder(drawable, null, fileFormatOption, new ImageParameter()); } public static ImageBuilder plainPngBuilder(UDrawable drawable) { - return plainImageBuilder(drawable, new FileFormatOption(FileFormat.PNG), 42); + return plainImageBuilder(drawable, new FileFormatOption(FileFormat.PNG)); } // TODO do something with "index" public static ImageBuilder styledImageBuilder(TitledDiagram diagram, UDrawable drawable, int index, - FileFormatOption fileFormatOption, long seed) { - return new ImageBuilder(drawable, diagram, fileFormatOption, seed, new ImageParameter(diagram)) + FileFormatOption fileFormatOption) { + return new ImageBuilder(drawable, diagram, fileFormatOption, new ImageParameter(diagram)) .annotations(true) .backcolor(getBackgroundColor(diagram)) .margin(calculateDiagramMargin(diagram)) .metadata(fileFormatOption.isWithMetadata() ? diagram.getMetadata() : null) + .seed(diagram.seed()) .warningOrError(diagram.getWarningOrError()); } - private ImageBuilder(UDrawable drawable, TitledDiagram titledDiagram, FileFormatOption fileFormatOption, long seed, ImageParameter param) { + private ImageBuilder(UDrawable drawable, TitledDiagram titledDiagram, FileFormatOption fileFormatOption, ImageParameter param) { this.udrawable = drawable; this.titledDiagram = titledDiagram; this.fileFormatOption = fileFormatOption; - this.seed = seed; this.param = param; if (drawable instanceof TextBlockBackcolored) { @@ -180,6 +180,11 @@ public class ImageBuilder { return this; } + public ImageBuilder seed(long seed) { + this.seed = seed; + return this; + } + public ImageBuilder status(int status) { this.status = status; return this; @@ -198,7 +203,7 @@ public class ImageBuilder { final AnnotatedWorker annotatedWorker = new AnnotatedWorker(titledDiagram, skinParam, stringBounder); udrawable = annotatedWorker.addAdd((TextBlock) udrawable); } - final ImageData imageData = writeImageTOBEMOVED(fileFormatOption, seed, os); + final ImageData imageData = writeImageTOBEMOVED(fileFormatOption, os); ((ImageDataAbstract) imageData).setStatus(status); return imageData; } @@ -210,11 +215,11 @@ public class ImageBuilder { } } - public ImageData writeImageTOBEMOVED(long seed, OutputStream os) throws IOException { - return writeImageTOBEMOVED(fileFormatOption, seed, os); + public ImageData writeImageTOBEMOVED(OutputStream os) throws IOException { + return writeImageTOBEMOVED(fileFormatOption, os); } - public ImageData writeImageTOBEMOVED(FileFormatOption fileFormatOption, long seed, OutputStream os) + public ImageData writeImageTOBEMOVED(FileFormatOption fileFormatOption, OutputStream os) throws IOException { final FileFormat fileFormat = fileFormatOption.getFileFormat(); if (fileFormat == FileFormat.MJPEG) { @@ -222,10 +227,10 @@ public class ImageBuilder { } else if (fileFormat == FileFormat.ANIMATED_GIF) { return writeImageAnimatedGif(os, fileFormatOption.getDefaultStringBounder(param.getSvgCharSizeHack())); } - return writeImageInternal(fileFormatOption, seed, os, param.getAnimation()); + return writeImageInternal(fileFormatOption, os, param.getAnimation()); } - private ImageData writeImageInternal(FileFormatOption fileFormatOption, long seed, OutputStream os, + private ImageData writeImageInternal(FileFormatOption fileFormatOption, OutputStream os, Animation animationArg) throws IOException { Dimension2D dim = getFinalDimension(fileFormatOption.getDefaultStringBounder(param.getSvgCharSizeHack())); double dx = 0; @@ -238,7 +243,7 @@ public class ImageBuilder { dy = -minmax.getMinY(); } - final UGraphic2 ug = createUGraphic(fileFormatOption, seed, dim, animationArg, dx, dy); + final UGraphic2 ug = createUGraphic(fileFormatOption, dim, animationArg, dx, dy); UGraphic ug2 = ug; final UStroke borderStroke = param.getBorderStroke(); @@ -361,7 +366,7 @@ public class ImageBuilder { private Image getAviImage(AffineTransformation affineTransform) throws IOException { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); - writeImageInternal(new FileFormatOption(FileFormat.PNG), 42, baos, Animation.singleton(affineTransform)); + writeImageInternal(new FileFormatOption(FileFormat.PNG), baos, Animation.singleton(affineTransform)); baos.close(); final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); @@ -370,7 +375,7 @@ public class ImageBuilder { return im; } - private UGraphic2 createUGraphic(FileFormatOption option, long seed, final Dimension2D dim, Animation animationArg, + private UGraphic2 createUGraphic(FileFormatOption option, final Dimension2D dim, Animation animationArg, double dx, double dy) { final ColorMapper colorMapper = param.getColorMapper(); final double scaleFactor = (param.getScale() == null ? 1 @@ -382,7 +387,7 @@ public class ImageBuilder { option.getWatermark()); case SVG: return createUGraphicSVG(colorMapper, scaleFactor, dim, backcolor, option.getSvgLinkTarget(), - option.getHoverColor(), seed, option.getPreserveAspectRatio(), param.getlengthAdjust()); + option.getHoverColor(), option.getPreserveAspectRatio(), param.getlengthAdjust()); case EPS: return new UGraphicEps(colorMapper, EpsStrategy.getDefault2()); case EPS_TEXT: @@ -408,7 +413,7 @@ public class ImageBuilder { } private UGraphic2 createUGraphicSVG(ColorMapper colorMapper, double scaleFactor, Dimension2D dim, - final HColor suggested, String svgLinkTarget, String hover, long seed, String preserveAspectRatio, + final HColor suggested, String svgLinkTarget, String hover, String preserveAspectRatio, LengthAdjust lengthAdjust) { HColor backColor = HColorUtils.WHITE; if (suggested instanceof HColorSimple) { diff --git a/src/net/sourceforge/plantuml/wbs/WBSDiagram.java b/src/net/sourceforge/plantuml/wbs/WBSDiagram.java index db2fb49c8..199938c73 100644 --- a/src/net/sourceforge/plantuml/wbs/WBSDiagram.java +++ b/src/net/sourceforge/plantuml/wbs/WBSDiagram.java @@ -77,7 +77,7 @@ public class WBSDiagram extends UmlDiagram { protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption) throws IOException { - return styledImageBuilder(this, getTextBlock(), index, fileFormatOption, seed()) + return styledImageBuilder(this, getTextBlock(), index, fileFormatOption) .write(os); } diff --git a/src/net/sourceforge/plantuml/wire/WireDiagram.java b/src/net/sourceforge/plantuml/wire/WireDiagram.java index e1602410e..cdc60e524 100644 --- a/src/net/sourceforge/plantuml/wire/WireDiagram.java +++ b/src/net/sourceforge/plantuml/wire/WireDiagram.java @@ -80,7 +80,7 @@ public class WireDiagram extends UmlDiagram { protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption) throws IOException { - return styledImageBuilder(this, getTextBlock(), index, fileFormatOption, seed()) + return styledImageBuilder(this, getTextBlock(), index, fileFormatOption) .write(os); }