1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-05 21:17:52 +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,
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);

View File

@ -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);

View File

@ -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());

View File

@ -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);

View File

@ -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()))

View File

@ -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();

View File

@ -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()))

View File

@ -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());

View File

@ -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);

View File

@ -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);

View File

@ -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() {

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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();

View File

@ -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;

View File

@ -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();

View File

@ -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();