1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-12-22 10:59:01 +00:00

Move diagram.getAnimation() & diagram.getWarningOrError() into ImageParameter class.

This commit is contained in:
matthew16550 2021-03-10 05:20:39 +11:00
parent bedbe1036b
commit 568c2e3106
19 changed files with 31 additions and 41 deletions

View File

@ -226,8 +226,7 @@ public class ActivityDiagram3 extends UmlDiagram {
final double dpiFactor = getDpiFactor(fileFormatOption, final double dpiFactor = getDpiFactor(fileFormatOption,
Dimension2DDouble.delta(dim, margins.getLeft() + margins.getRight(), 0)); Dimension2DDouble.delta(dim, margins.getLeft() + margins.getRight(), 0));
final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, getAnimation(), dpiFactor, final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, dpiFactor);
getWarningOrError());
final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter); final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter);
imageBuilder.setUDrawable(result); imageBuilder.setUDrawable(result);

View File

@ -86,8 +86,7 @@ public class BoardDiagram extends UmlDiagram {
final double dpiFactor = scale == null ? getScaleCoef(fileFormatOption) : scale.getScale(100, 100); final double dpiFactor = scale == null ? getScaleCoef(fileFormatOption) : scale.getScale(100, 100);
final ISkinParam skinParam = getSkinParam(); final ISkinParam skinParam = getSkinParam();
final ImageParameter imageParameter = new ImageParameter(this, final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, dpiFactor);
fileFormatOption, null, dpiFactor, "");
final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter); final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter);

View File

@ -82,8 +82,7 @@ public class BpmDiagram extends UmlDiagram {
protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption) protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption)
throws IOException { throws IOException {
final double dpiFactor = 1; final double dpiFactor = 1;
final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, getAnimation(), dpiFactor, final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, dpiFactor);
getWarningOrError());
final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter); final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter);
imageBuilder.setUDrawable(getUDrawable()); imageBuilder.setUDrawable(getUDrawable());

View File

@ -198,7 +198,7 @@ public class ClassDiagram extends AbstractClassOrObjectDiagram {
final RowLayout rawLayout = getRawLayout(i); final RowLayout rawLayout = getRawLayout(i);
fullLayout.addRowLayout(rawLayout); 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); final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter);
imageBuilder.setUDrawable(fullLayout); imageBuilder.setUDrawable(fullLayout);
return imageBuilder.writeImageTOBEMOVED(seed(), os); return imageBuilder.writeImageTOBEMOVED(seed(), os);

View File

@ -95,8 +95,7 @@ public class JsonDiagram extends TitledDiagram {
final double dpiFactor = scale == null ? 1 : scale.getScale(100, 100); final double dpiFactor = scale == null ? 1 : scale.getScale(100, 100);
final ISkinParam skinParam = getSkinParam(); 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); final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter);
TextBlock result = getTextBlock(); TextBlock result = getTextBlock();
result = new AnnotatedWorker(this, skinParam, fileFormatOption.getDefaultStringBounder(getSkinParam())) result = new AnnotatedWorker(this, skinParam, fileFormatOption.getDefaultStringBounder(getSkinParam()))

View File

@ -90,7 +90,7 @@ public class MindMapDiagram extends UmlDiagram {
final Scale scale = getScale(); final Scale scale = getScale();
final double dpiFactor = scale == null ? getScaleCoef(fileFormatOption) : scale.getScale(100, 100); 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); final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter);
TextBlock result = getTextBlock(); TextBlock result = getTextBlock();

View File

@ -221,8 +221,7 @@ public class NwDiagram extends UmlDiagram {
final double dpiFactor = scale == null ? 1 : scale.getScale(100, 100); final double dpiFactor = scale == null ? 1 : scale.getScale(100, 100);
final ISkinParam skinParam = getSkinParam(); 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); final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter);
TextBlock result = getTextBlock(); TextBlock result = getTextBlock();
result = new AnnotatedWorker(this, skinParam, fileFormatOption.getDefaultStringBounder(getSkinParam())) result = new AnnotatedWorker(this, skinParam, fileFormatOption.getDefaultStringBounder(getSkinParam()))

View File

@ -170,8 +170,7 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw, WithSprit
throws IOException { throws IOException {
final Scale scale = getScale(); final Scale scale = getScale();
final double dpiFactor = scale == null ? 1 : scale.getScale(100, 100); 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 ImageBuilder imageBuilder = ImageBuilder.build(imageParameter);
final StringBounder stringBounder = fileFormatOption.getDefaultStringBounder(getSkinParam()); final StringBounder stringBounder = fileFormatOption.getDefaultStringBounder(getSkinParam());

View File

@ -127,8 +127,7 @@ public class PSystemSalt extends TitledDiagram implements WithSprite {
final Scale scale = getScale(); final Scale scale = getScale();
final double dpiFactor = scale == null ? getScaleCoef(fileFormatOption) : scale.getScale(100, 100); final double dpiFactor = scale == null ? getScaleCoef(fileFormatOption) : scale.getScale(100, 100);
final ISkinParam skinParam = getSkinParam(); final ISkinParam skinParam = getSkinParam();
final ImageParameter imageParameter = new ImageParameter(this, final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, dpiFactor);
fileFormatOption, null, dpiFactor, "");
final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter); final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter);

View File

@ -443,8 +443,7 @@ public class CucaDiagramFileMakerSmetana implements CucaDiagramFileMaker {
// } // }
final double scale = 1; final double scale = 1;
final ImageParameter imageParameter = new ImageParameter(diagram, fileFormatOption, diagram.getAnimation(), scale, final ImageParameter imageParameter = new ImageParameter(diagram, fileFormatOption, scale);
null);
final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter); final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter);

View File

@ -195,8 +195,7 @@ public class SequenceDiagramFileMakerPuma2 implements FileMaker {
// System.err.println("scale=" + scale); // System.err.println("scale=" + scale);
final double factor = oneOf(scale, dpiFactor); final double factor = oneOf(scale, dpiFactor);
final ImageParameter imageParameter = new ImageParameter(diagram, fileFormatOption, diagram.getAnimation(), factor, final ImageParameter imageParameter = new ImageParameter(diagram, fileFormatOption, factor);
null);
final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter); final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter);
imageBuilder.setUDrawable(new UDrawable() { imageBuilder.setUDrawable(new UDrawable() {

View File

@ -151,8 +151,7 @@ public class SequenceDiagramFileMakerTeoz implements FileMaker {
final double scale = 1; final double scale = 1;
final double factor = oneOf(scale, dpiFactor); final double factor = oneOf(scale, dpiFactor);
final ImageParameter imageParameter = new ImageParameter(diagram, fileFormatOption, diagram.getAnimation(), factor, final ImageParameter imageParameter = new ImageParameter(diagram, fileFormatOption, factor);
null);
final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter); final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter);

View File

@ -76,8 +76,7 @@ public class ListSpriteDiagram extends UmlDiagram {
final TextBlock result = getTable(); final TextBlock result = getTable();
final double dpiFactor = 1; final double dpiFactor = 1;
final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, getAnimation(), dpiFactor, final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, dpiFactor);
getWarningOrError());
final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter); final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter);
imageBuilder.setUDrawable(result); imageBuilder.setUDrawable(result);

View File

@ -87,8 +87,7 @@ public class StdlibDiagram extends UmlDiagram {
final TextBlock result = getTable(); final TextBlock result = getTable();
final double dpiFactor = 1; final double dpiFactor = 1;
final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, getAnimation(), dpiFactor, final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, dpiFactor);
getWarningOrError());
final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter); final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter);
imageBuilder.setUDrawable(result); imageBuilder.setUDrawable(result);

View File

@ -124,7 +124,7 @@ public final class CucaDiagramFileMakerSvek implements CucaDiagramFileMaker {
final HColor backcolor = result.getBackcolor(); final HColor backcolor = result.getBackcolor();
final String metadata = fileFormatOption.isWithMetadata() ? diagram.getMetadata() : null; 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); warningOrError, backcolor);
final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter); final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter);

View File

@ -100,8 +100,7 @@ public class TimingDiagram extends UmlDiagram implements Clocks {
protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption) protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption)
throws IOException { throws IOException {
final double dpiFactor = 1; final double dpiFactor = 1;
final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, getAnimation(), dpiFactor, final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, dpiFactor);
getWarningOrError());
final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter); final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter);
TextBlock result = getTextBlock(); TextBlock result = getTextBlock();

View File

@ -42,6 +42,7 @@ import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.LineParam; import net.sourceforge.plantuml.LineParam;
import net.sourceforge.plantuml.SvgCharSizeHack; import net.sourceforge.plantuml.SvgCharSizeHack;
import net.sourceforge.plantuml.TitledDiagram; import net.sourceforge.plantuml.TitledDiagram;
import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.UseStyle; import net.sourceforge.plantuml.UseStyle;
import net.sourceforge.plantuml.anim.Animation; import net.sourceforge.plantuml.anim.Animation;
import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.skin.rose.Rose;
@ -94,11 +95,15 @@ public class ImageParameter {
this.fileFormatOption = null; this.fileFormatOption = null;
} }
public ImageParameter(TitledDiagram diagram, FileFormatOption fileFormatOption, Animation animation, public ImageParameter(TitledDiagram diagram, FileFormatOption fileFormatOption, double dpiFactor) {
double dpiFactor, String warningOrError) { this(
this(diagram, fileFormatOption, animation, dpiFactor, diagram,
fileFormatOption.isWithMetadata() ? diagram.getMetadata() : null, warningOrError, fileFormatOption,
getBackgroundColor(diagram)); dpiFactor,
fileFormatOption.isWithMetadata() ? diagram.getMetadata() : null,
diagram.getWarningOrError(),
getBackgroundColor(diagram)
);
} }
private static HColor getBackgroundColor(TitledDiagram diagram) { private static HColor getBackgroundColor(TitledDiagram diagram) {
@ -118,13 +123,13 @@ public class ImageParameter {
return diagram.getSkinParam().getBackgroundColor(false); return diagram.getSkinParam().getBackgroundColor(false);
} }
public ImageParameter(TitledDiagram diagram, FileFormatOption fileFormatOption, Animation animation, public ImageParameter(TitledDiagram diagram, FileFormatOption fileFormatOption, double dpiFactor, String metadata,
double dpiFactor, String metadata, String warningOrError, HColor backcolor) { String warningOrError, HColor backcolor) {
final ISkinParam skinParam = diagram.getSkinParam(); final ISkinParam skinParam = diagram.getSkinParam();
this.fileFormatOption = fileFormatOption; this.fileFormatOption = fileFormatOption;
this.colorMapper = skinParam.getColorMapper(); this.colorMapper = skinParam.getColorMapper();
this.useHandwritten = skinParam.handwritten(); 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.dpiFactor = dpiFactor;
this.metadata = metadata; this.metadata = metadata;
this.warningOrError = warningOrError; this.warningOrError = warningOrError;

View File

@ -83,8 +83,7 @@ public class WBSDiagram extends UmlDiagram {
final double dpiFactor = scale == null ? getScaleCoef(fileFormatOption) : scale.getScale(100, 100); final double dpiFactor = scale == null ? getScaleCoef(fileFormatOption) : scale.getScale(100, 100);
final ISkinParam skinParam = getSkinParam(); final ISkinParam skinParam = getSkinParam();
final ImageParameter imageParameter = new ImageParameter(this, final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, dpiFactor);
fileFormatOption, null, dpiFactor, "");
final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter); final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter);
TextBlock result = getTextBlock(); TextBlock result = getTextBlock();

View File

@ -87,8 +87,7 @@ public class WireDiagram extends UmlDiagram {
final double dpiFactor = scale == null ? getScaleCoef(fileFormatOption) : scale.getScale(100, 100); final double dpiFactor = scale == null ? getScaleCoef(fileFormatOption) : scale.getScale(100, 100);
final ISkinParam skinParam = getSkinParam(); final ISkinParam skinParam = getSkinParam();
final ImageParameter imageParameter = new ImageParameter(this, final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, dpiFactor);
fileFormatOption, null, dpiFactor, "");
final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter); final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter);
TextBlock result = getTextBlock(); TextBlock result = getTextBlock();