From 568c2e31063e79f809119a8d274ecb44983e8a0f Mon Sep 17 00:00:00 2001 From: matthew16550 Date: Wed, 10 Mar 2021 05:20:39 +1100 Subject: [PATCH] Move diagram.getAnimation() & diagram.getWarningOrError() into ImageParameter class. --- .../activitydiagram3/ActivityDiagram3.java | 3 +-- .../plantuml/board/BoardDiagram.java | 3 +-- .../sourceforge/plantuml/bpm/BpmDiagram.java | 3 +-- .../plantuml/classdiagram/ClassDiagram.java | 2 +- .../plantuml/jsondiagram/JsonDiagram.java | 3 +-- .../plantuml/mindmap/MindMapDiagram.java | 2 +- .../plantuml/nwdiag/NwDiagram.java | 3 +-- .../plantuml/project/GanttDiagram.java | 3 +-- .../plantuml/salt/PSystemSalt.java | 3 +-- .../sdot/CucaDiagramFileMakerSmetana.java | 3 +-- .../SequenceDiagramFileMakerPuma2.java | 3 +-- .../teoz/SequenceDiagramFileMakerTeoz.java | 3 +-- .../plantuml/sprite/ListSpriteDiagram.java | 3 +-- .../plantuml/sprite/StdlibDiagram.java | 3 +-- .../svek/CucaDiagramFileMakerSvek.java | 2 +- .../plantuml/timingdiagram/TimingDiagram.java | 3 +-- .../plantuml/ugraphic/ImageParameter.java | 21 ++++++++++++------- .../sourceforge/plantuml/wbs/WBSDiagram.java | 3 +-- .../plantuml/wire/WireDiagram.java | 3 +-- 19 files changed, 31 insertions(+), 41 deletions(-) diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java b/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java index 7685dfb09..c82b2e4cf 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java @@ -226,8 +226,7 @@ public class ActivityDiagram3 extends UmlDiagram { final double dpiFactor = getDpiFactor(fileFormatOption, Dimension2DDouble.delta(dim, margins.getLeft() + margins.getRight(), 0)); - final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, getAnimation(), dpiFactor, - getWarningOrError()); + final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, dpiFactor); final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter); imageBuilder.setUDrawable(result); diff --git a/src/net/sourceforge/plantuml/board/BoardDiagram.java b/src/net/sourceforge/plantuml/board/BoardDiagram.java index 30a1fec8e..fce45e199 100644 --- a/src/net/sourceforge/plantuml/board/BoardDiagram.java +++ b/src/net/sourceforge/plantuml/board/BoardDiagram.java @@ -86,8 +86,7 @@ public class BoardDiagram extends UmlDiagram { final double dpiFactor = scale == null ? getScaleCoef(fileFormatOption) : scale.getScale(100, 100); final ISkinParam skinParam = getSkinParam(); - final ImageParameter imageParameter = new ImageParameter(this, - fileFormatOption, null, dpiFactor, ""); + final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, dpiFactor); final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter); diff --git a/src/net/sourceforge/plantuml/bpm/BpmDiagram.java b/src/net/sourceforge/plantuml/bpm/BpmDiagram.java index ae15796e5..fdb4807b7 100644 --- a/src/net/sourceforge/plantuml/bpm/BpmDiagram.java +++ b/src/net/sourceforge/plantuml/bpm/BpmDiagram.java @@ -82,8 +82,7 @@ public class BpmDiagram extends UmlDiagram { protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption) throws IOException { final double dpiFactor = 1; - final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, getAnimation(), dpiFactor, - getWarningOrError()); + final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, dpiFactor); final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter); imageBuilder.setUDrawable(getUDrawable()); diff --git a/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java b/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java index d1988133b..707567908 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); } - final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, null, 1.0, null); + final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, 1.0); final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter); imageBuilder.setUDrawable(fullLayout); return imageBuilder.writeImageTOBEMOVED(seed(), os); diff --git a/src/net/sourceforge/plantuml/jsondiagram/JsonDiagram.java b/src/net/sourceforge/plantuml/jsondiagram/JsonDiagram.java index caf7a9b83..2ea53b5c4 100644 --- a/src/net/sourceforge/plantuml/jsondiagram/JsonDiagram.java +++ b/src/net/sourceforge/plantuml/jsondiagram/JsonDiagram.java @@ -95,8 +95,7 @@ public class JsonDiagram extends TitledDiagram { final double dpiFactor = scale == null ? 1 : scale.getScale(100, 100); final ISkinParam skinParam = getSkinParam(); - final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, null, dpiFactor, - ""); + final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, dpiFactor); final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter); TextBlock result = getTextBlock(); result = new AnnotatedWorker(this, skinParam, fileFormatOption.getDefaultStringBounder(getSkinParam())) diff --git a/src/net/sourceforge/plantuml/mindmap/MindMapDiagram.java b/src/net/sourceforge/plantuml/mindmap/MindMapDiagram.java index 18fb3f94c..4f75d7b90 100644 --- a/src/net/sourceforge/plantuml/mindmap/MindMapDiagram.java +++ b/src/net/sourceforge/plantuml/mindmap/MindMapDiagram.java @@ -90,7 +90,7 @@ public class MindMapDiagram extends UmlDiagram { final Scale scale = getScale(); final double dpiFactor = scale == null ? getScaleCoef(fileFormatOption) : scale.getScale(100, 100); - final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, null, dpiFactor, ""); + final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, dpiFactor); final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter); TextBlock result = getTextBlock(); diff --git a/src/net/sourceforge/plantuml/nwdiag/NwDiagram.java b/src/net/sourceforge/plantuml/nwdiag/NwDiagram.java index 191fa45e4..ecc84f46a 100644 --- a/src/net/sourceforge/plantuml/nwdiag/NwDiagram.java +++ b/src/net/sourceforge/plantuml/nwdiag/NwDiagram.java @@ -221,8 +221,7 @@ public class NwDiagram extends UmlDiagram { final double dpiFactor = scale == null ? 1 : scale.getScale(100, 100); final ISkinParam skinParam = getSkinParam(); - final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, null, dpiFactor, - ""); + final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, dpiFactor); final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter); TextBlock result = getTextBlock(); result = new AnnotatedWorker(this, skinParam, fileFormatOption.getDefaultStringBounder(getSkinParam())) diff --git a/src/net/sourceforge/plantuml/project/GanttDiagram.java b/src/net/sourceforge/plantuml/project/GanttDiagram.java index cc7eda970..4647bc820 100644 --- a/src/net/sourceforge/plantuml/project/GanttDiagram.java +++ b/src/net/sourceforge/plantuml/project/GanttDiagram.java @@ -170,8 +170,7 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw, WithSprit throws IOException { final Scale scale = getScale(); final double dpiFactor = scale == null ? 1 : scale.getScale(100, 100); - final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, null, dpiFactor, - ""); + final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, dpiFactor); final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter); final StringBounder stringBounder = fileFormatOption.getDefaultStringBounder(getSkinParam()); diff --git a/src/net/sourceforge/plantuml/salt/PSystemSalt.java b/src/net/sourceforge/plantuml/salt/PSystemSalt.java index a5fe27994..ac98a595c 100644 --- a/src/net/sourceforge/plantuml/salt/PSystemSalt.java +++ b/src/net/sourceforge/plantuml/salt/PSystemSalt.java @@ -127,8 +127,7 @@ public class PSystemSalt extends TitledDiagram implements WithSprite { final Scale scale = getScale(); final double dpiFactor = scale == null ? getScaleCoef(fileFormatOption) : scale.getScale(100, 100); final ISkinParam skinParam = getSkinParam(); - final ImageParameter imageParameter = new ImageParameter(this, - fileFormatOption, null, dpiFactor, ""); + final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, dpiFactor); final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter); diff --git a/src/net/sourceforge/plantuml/sdot/CucaDiagramFileMakerSmetana.java b/src/net/sourceforge/plantuml/sdot/CucaDiagramFileMakerSmetana.java index 7d7367df8..fdd0b9eff 100644 --- a/src/net/sourceforge/plantuml/sdot/CucaDiagramFileMakerSmetana.java +++ b/src/net/sourceforge/plantuml/sdot/CucaDiagramFileMakerSmetana.java @@ -443,8 +443,7 @@ public class CucaDiagramFileMakerSmetana implements CucaDiagramFileMaker { // } final double scale = 1; - final ImageParameter imageParameter = new ImageParameter(diagram, fileFormatOption, diagram.getAnimation(), scale, - null); + final ImageParameter imageParameter = new ImageParameter(diagram, fileFormatOption, scale); final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter); diff --git a/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramFileMakerPuma2.java b/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramFileMakerPuma2.java index 287822a4d..f23a349d9 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramFileMakerPuma2.java +++ b/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramFileMakerPuma2.java @@ -195,8 +195,7 @@ public class SequenceDiagramFileMakerPuma2 implements FileMaker { // System.err.println("scale=" + scale); final double factor = oneOf(scale, dpiFactor); - final ImageParameter imageParameter = new ImageParameter(diagram, fileFormatOption, diagram.getAnimation(), factor, - null); + final ImageParameter imageParameter = new ImageParameter(diagram, fileFormatOption, factor); final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter); imageBuilder.setUDrawable(new UDrawable() { diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/SequenceDiagramFileMakerTeoz.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/SequenceDiagramFileMakerTeoz.java index 90632e2fa..1102010a4 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/SequenceDiagramFileMakerTeoz.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/SequenceDiagramFileMakerTeoz.java @@ -151,8 +151,7 @@ public class SequenceDiagramFileMakerTeoz implements FileMaker { final double scale = 1; final double factor = oneOf(scale, dpiFactor); - final ImageParameter imageParameter = new ImageParameter(diagram, fileFormatOption, diagram.getAnimation(), factor, - null); + final ImageParameter imageParameter = new ImageParameter(diagram, fileFormatOption, factor); final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter); diff --git a/src/net/sourceforge/plantuml/sprite/ListSpriteDiagram.java b/src/net/sourceforge/plantuml/sprite/ListSpriteDiagram.java index dada84086..f86e568d8 100644 --- a/src/net/sourceforge/plantuml/sprite/ListSpriteDiagram.java +++ b/src/net/sourceforge/plantuml/sprite/ListSpriteDiagram.java @@ -76,8 +76,7 @@ public class ListSpriteDiagram extends UmlDiagram { final TextBlock result = getTable(); final double dpiFactor = 1; - final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, getAnimation(), dpiFactor, - getWarningOrError()); + final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, dpiFactor); final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter); imageBuilder.setUDrawable(result); diff --git a/src/net/sourceforge/plantuml/sprite/StdlibDiagram.java b/src/net/sourceforge/plantuml/sprite/StdlibDiagram.java index 9cd26aafa..1f3a89c35 100644 --- a/src/net/sourceforge/plantuml/sprite/StdlibDiagram.java +++ b/src/net/sourceforge/plantuml/sprite/StdlibDiagram.java @@ -87,8 +87,7 @@ public class StdlibDiagram extends UmlDiagram { final TextBlock result = getTable(); final double dpiFactor = 1; - final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, getAnimation(), dpiFactor, - getWarningOrError()); + final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, dpiFactor); final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter); imageBuilder.setUDrawable(result); diff --git a/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek.java b/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek.java index 2592843bd..cac552730 100644 --- a/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek.java +++ b/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek.java @@ -124,7 +124,7 @@ public final class CucaDiagramFileMakerSvek implements CucaDiagramFileMaker { final HColor backcolor = result.getBackcolor(); final String metadata = fileFormatOption.isWithMetadata() ? diagram.getMetadata() : null; - final ImageParameter imageParameter = new ImageParameter(diagram, fileFormatOption, diagram.getAnimation(), scale, metadata, + final ImageParameter imageParameter = new ImageParameter(diagram, fileFormatOption, scale, metadata, warningOrError, backcolor); final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter); diff --git a/src/net/sourceforge/plantuml/timingdiagram/TimingDiagram.java b/src/net/sourceforge/plantuml/timingdiagram/TimingDiagram.java index f57d5a3fb..70f19b7c4 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/TimingDiagram.java +++ b/src/net/sourceforge/plantuml/timingdiagram/TimingDiagram.java @@ -100,8 +100,7 @@ public class TimingDiagram extends UmlDiagram implements Clocks { protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption) throws IOException { final double dpiFactor = 1; - final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, getAnimation(), dpiFactor, - getWarningOrError()); + final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, dpiFactor); final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter); TextBlock result = getTextBlock(); diff --git a/src/net/sourceforge/plantuml/ugraphic/ImageParameter.java b/src/net/sourceforge/plantuml/ugraphic/ImageParameter.java index 003e61b3f..32b21634e 100644 --- a/src/net/sourceforge/plantuml/ugraphic/ImageParameter.java +++ b/src/net/sourceforge/plantuml/ugraphic/ImageParameter.java @@ -42,6 +42,7 @@ import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.LineParam; import net.sourceforge.plantuml.SvgCharSizeHack; import net.sourceforge.plantuml.TitledDiagram; +import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UseStyle; import net.sourceforge.plantuml.anim.Animation; import net.sourceforge.plantuml.skin.rose.Rose; @@ -94,11 +95,15 @@ public class ImageParameter { this.fileFormatOption = null; } - public ImageParameter(TitledDiagram diagram, FileFormatOption fileFormatOption, Animation animation, - double dpiFactor, String warningOrError) { - this(diagram, fileFormatOption, animation, dpiFactor, - fileFormatOption.isWithMetadata() ? diagram.getMetadata() : null, warningOrError, - getBackgroundColor(diagram)); + public ImageParameter(TitledDiagram diagram, FileFormatOption fileFormatOption, double dpiFactor) { + this( + diagram, + fileFormatOption, + dpiFactor, + fileFormatOption.isWithMetadata() ? diagram.getMetadata() : null, + diagram.getWarningOrError(), + getBackgroundColor(diagram) + ); } private static HColor getBackgroundColor(TitledDiagram diagram) { @@ -118,13 +123,13 @@ public class ImageParameter { return diagram.getSkinParam().getBackgroundColor(false); } - public ImageParameter(TitledDiagram diagram, FileFormatOption fileFormatOption, Animation animation, - double dpiFactor, String metadata, String warningOrError, HColor backcolor) { + public ImageParameter(TitledDiagram diagram, FileFormatOption fileFormatOption, double dpiFactor, String metadata, + String warningOrError, HColor backcolor) { final ISkinParam skinParam = diagram.getSkinParam(); this.fileFormatOption = fileFormatOption; this.colorMapper = skinParam.getColorMapper(); this.useHandwritten = skinParam.handwritten(); - this.animation = animation; + this.animation = diagram instanceof UmlDiagram ? ((UmlDiagram) diagram).getAnimation() : null; // TODO move animation to TitledDiagram ? this.dpiFactor = dpiFactor; this.metadata = metadata; this.warningOrError = warningOrError; diff --git a/src/net/sourceforge/plantuml/wbs/WBSDiagram.java b/src/net/sourceforge/plantuml/wbs/WBSDiagram.java index 995733aa1..6bc73620e 100644 --- a/src/net/sourceforge/plantuml/wbs/WBSDiagram.java +++ b/src/net/sourceforge/plantuml/wbs/WBSDiagram.java @@ -83,8 +83,7 @@ public class WBSDiagram extends UmlDiagram { final double dpiFactor = scale == null ? getScaleCoef(fileFormatOption) : scale.getScale(100, 100); final ISkinParam skinParam = getSkinParam(); - final ImageParameter imageParameter = new ImageParameter(this, - fileFormatOption, null, dpiFactor, ""); + final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, dpiFactor); final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter); TextBlock result = getTextBlock(); diff --git a/src/net/sourceforge/plantuml/wire/WireDiagram.java b/src/net/sourceforge/plantuml/wire/WireDiagram.java index 8b76112cc..feb92331e 100644 --- a/src/net/sourceforge/plantuml/wire/WireDiagram.java +++ b/src/net/sourceforge/plantuml/wire/WireDiagram.java @@ -87,8 +87,7 @@ public class WireDiagram extends UmlDiagram { final double dpiFactor = scale == null ? getScaleCoef(fileFormatOption) : scale.getScale(100, 100); final ISkinParam skinParam = getSkinParam(); - final ImageParameter imageParameter = new ImageParameter(this, - fileFormatOption, null, dpiFactor, ""); + final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, dpiFactor); final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter); TextBlock result = getTextBlock();