From a02ff86cbdc71b712be9dc5ac4215a5e5b330780 Mon Sep 17 00:00:00 2001 From: matthew16550 Date: Mon, 4 Oct 2021 22:00:11 +1100 Subject: [PATCH] Delete UScale and related code as it is now unused. --- .../ugraphic/AbstractCommonUGraphic.java | 11 +--- .../plantuml/ugraphic/AbstractUGraphic.java | 8 +-- .../plantuml/ugraphic/LimitFinder.java | 1 - .../plantuml/ugraphic/Scalable.java | 41 ------------ .../plantuml/ugraphic/UEllipse.java | 11 +--- .../sourceforge/plantuml/ugraphic/UFont.java | 8 --- .../sourceforge/plantuml/ugraphic/ULine.java | 11 +--- .../sourceforge/plantuml/ugraphic/UParam.java | 2 - .../plantuml/ugraphic/UParamNull.java | 6 -- .../plantuml/ugraphic/URectangle.java | 12 +--- .../sourceforge/plantuml/ugraphic/UScale.java | 63 ------------------- .../plantuml/ugraphic/g2d/DriverLineG2d.java | 2 +- .../ugraphic/g2d/DriverTextAsPathG2d.java | 2 +- .../plantuml/ugraphic/g2d/DriverTextG2d.java | 8 +-- 14 files changed, 10 insertions(+), 176 deletions(-) delete mode 100644 src/net/sourceforge/plantuml/ugraphic/Scalable.java delete mode 100644 src/net/sourceforge/plantuml/ugraphic/UScale.java diff --git a/src/net/sourceforge/plantuml/ugraphic/AbstractCommonUGraphic.java b/src/net/sourceforge/plantuml/ugraphic/AbstractCommonUGraphic.java index 0b10d8498..244c6441e 100644 --- a/src/net/sourceforge/plantuml/ugraphic/AbstractCommonUGraphic.java +++ b/src/net/sourceforge/plantuml/ugraphic/AbstractCommonUGraphic.java @@ -58,7 +58,6 @@ public abstract class AbstractCommonUGraphic implements UGraphic { private final ColorMapper colorMapper; private UClip clip; - private double scale = 1; private final HColor defaultBackground; @@ -75,7 +74,7 @@ public abstract class AbstractCommonUGraphic implements UGraphic { Objects.requireNonNull(change); final AbstractCommonUGraphic copy = copyUGraphic(); if (change instanceof UTranslate) { - copy.translate = ((UTranslate) change).scaled(scale).compose(copy.translate); + copy.translate = ((UTranslate) change).compose(copy.translate); } else if (change instanceof UClip) { copy.clip = (UClip) change; copy.clip = copy.clip.translate(getTranslateX(), getTranslateY()); @@ -91,9 +90,6 @@ public abstract class AbstractCommonUGraphic implements UGraphic { copy.color = null; } else if (change instanceof HColor) { copy.color = (HColor) change; - } else if (change instanceof UScale) { - final double factor = ((UScale) change).getScale(); - copy.scale = scale * factor; } return copy; } @@ -128,7 +124,6 @@ public abstract class AbstractCommonUGraphic implements UGraphic { this.hidden = other.hidden; this.color = other.color; this.backColor = other.backColor; - this.scale = other.scale; } protected abstract AbstractCommonUGraphic copyUGraphic(); @@ -155,10 +150,6 @@ public abstract class AbstractCommonUGraphic implements UGraphic { public UPattern getPattern() { return pattern; } - - public double getScale() { - return scale; - } }; } diff --git a/src/net/sourceforge/plantuml/ugraphic/AbstractUGraphic.java b/src/net/sourceforge/plantuml/ugraphic/AbstractUGraphic.java index 6a9b78485..c2704705c 100644 --- a/src/net/sourceforge/plantuml/ugraphic/AbstractUGraphic.java +++ b/src/net/sourceforge/plantuml/ugraphic/AbstractUGraphic.java @@ -93,13 +93,7 @@ public abstract class AbstractUGraphic extends AbstractCommonUGraphic { return; } beforeDraw(); - if (shape instanceof Scalable) { - final double scale = getParam().getScale(); - shape = ((Scalable) shape).getScaled(scale); - driver.draw(shape, getTranslateX(), getTranslateY(), getColorMapper(), getParam(), graphic); - } else { - driver.draw(shape, getTranslateX(), getTranslateY(), getColorMapper(), getParam(), graphic); - } + driver.draw(shape, getTranslateX(), getTranslateY(), getColorMapper(), getParam(), graphic); afterDraw(); } diff --git a/src/net/sourceforge/plantuml/ugraphic/LimitFinder.java b/src/net/sourceforge/plantuml/ugraphic/LimitFinder.java index f073c3650..fc29b3098 100644 --- a/src/net/sourceforge/plantuml/ugraphic/LimitFinder.java +++ b/src/net/sourceforge/plantuml/ugraphic/LimitFinder.java @@ -72,7 +72,6 @@ public class LimitFinder extends UGraphicNo { UClip.class, HColor.class, UHidden.class, - UScale.class, UStroke.class, UTranslate.class )) { diff --git a/src/net/sourceforge/plantuml/ugraphic/Scalable.java b/src/net/sourceforge/plantuml/ugraphic/Scalable.java deleted file mode 100644 index f4b4ea011..000000000 --- a/src/net/sourceforge/plantuml/ugraphic/Scalable.java +++ /dev/null @@ -1,41 +0,0 @@ -/* ======================================================================== - * PlantUML : a free UML diagram generator - * ======================================================================== - * - * (C) Copyright 2009-2020, Arnaud Roques - * - * Project Info: http://plantuml.com - * - * If you like this project or if you find it useful, you can support us at: - * - * http://plantuml.com/patreon (only 1$ per month!) - * http://plantuml.com/paypal - * - * This file is part of PlantUML. - * - * PlantUML is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PlantUML distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - * License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. - * - * - * Original Author: Arnaud Roques - * - * - */ -package net.sourceforge.plantuml.ugraphic; - -public interface Scalable { - - public UShape getScaled(double scale); -} diff --git a/src/net/sourceforge/plantuml/ugraphic/UEllipse.java b/src/net/sourceforge/plantuml/ugraphic/UEllipse.java index b8faca214..f18bb3bea 100644 --- a/src/net/sourceforge/plantuml/ugraphic/UEllipse.java +++ b/src/net/sourceforge/plantuml/ugraphic/UEllipse.java @@ -40,22 +40,13 @@ import java.awt.geom.Point2D; import net.sourceforge.plantuml.Dimension2DDouble; -public class UEllipse extends AbstractShadowable implements Scalable, UShapeSized { +public class UEllipse extends AbstractShadowable implements UShapeSized { private final double width; private final double height; private final double start; private final double extend; - public UShape getScaled(double scale) { - if (scale == 1) { - return this; - } - final AbstractShadowable result = new UEllipse(width * scale, height * scale, start, extend); - result.setDeltaShadow(this.getDeltaShadow()); - return result; - } - public UEllipse(double width, double height) { this(width, height, 0, 0); } diff --git a/src/net/sourceforge/plantuml/ugraphic/UFont.java b/src/net/sourceforge/plantuml/ugraphic/UFont.java index 0e78914e0..6a4d86797 100644 --- a/src/net/sourceforge/plantuml/ugraphic/UFont.java +++ b/src/net/sourceforge/plantuml/ugraphic/UFont.java @@ -116,14 +116,6 @@ public class UFont { return font; } - public UFont scaled(double scale) { - if (scale == 1) { - return this; - } - final float current = font.getSize2D(); - return withSize((float) (current * scale)); - } - public UFont withSize(float size) { return new UFont(font.deriveFont(size), family); } diff --git a/src/net/sourceforge/plantuml/ugraphic/ULine.java b/src/net/sourceforge/plantuml/ugraphic/ULine.java index a8affa1f6..0fe095ab7 100644 --- a/src/net/sourceforge/plantuml/ugraphic/ULine.java +++ b/src/net/sourceforge/plantuml/ugraphic/ULine.java @@ -37,20 +37,11 @@ package net.sourceforge.plantuml.ugraphic; import java.awt.geom.Point2D; -public class ULine extends AbstractShadowable implements Scalable, UShapeSized { +public class ULine extends AbstractShadowable implements UShapeSized { private final double dx; private final double dy; - public UShape getScaled(double scale) { - if (scale == 1) { - return this; - } - final AbstractShadowable result = new ULine(dx * scale, dy * scale); - result.setDeltaShadow(this.getDeltaShadow()); - return result; - } - public ULine(Point2D p1, Point2D p2) { this(p2.getX() - p1.getX(), p2.getY() - p1.getY()); } diff --git a/src/net/sourceforge/plantuml/ugraphic/UParam.java b/src/net/sourceforge/plantuml/ugraphic/UParam.java index 2a9f0cf92..10a7340d4 100644 --- a/src/net/sourceforge/plantuml/ugraphic/UParam.java +++ b/src/net/sourceforge/plantuml/ugraphic/UParam.java @@ -48,6 +48,4 @@ public interface UParam { public boolean isHidden(); public UPattern getPattern(); - - public double getScale(); } diff --git a/src/net/sourceforge/plantuml/ugraphic/UParamNull.java b/src/net/sourceforge/plantuml/ugraphic/UParamNull.java index b17d4dbbd..c55264e57 100644 --- a/src/net/sourceforge/plantuml/ugraphic/UParamNull.java +++ b/src/net/sourceforge/plantuml/ugraphic/UParamNull.java @@ -58,10 +58,4 @@ public class UParamNull implements UParam { public UPattern getPattern() { return UPattern.FULL; } - - public double getScale() { - return 1; - } - - } diff --git a/src/net/sourceforge/plantuml/ugraphic/URectangle.java b/src/net/sourceforge/plantuml/ugraphic/URectangle.java index b21462847..07e0bf8b2 100644 --- a/src/net/sourceforge/plantuml/ugraphic/URectangle.java +++ b/src/net/sourceforge/plantuml/ugraphic/URectangle.java @@ -39,7 +39,7 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.ugraphic.comp.CompressionMode; -public class URectangle extends AbstractShadowable implements Scalable, UShapeSized, UShapeIgnorableForCompression { +public class URectangle extends AbstractShadowable implements UShapeSized, UShapeIgnorableForCompression { private final double width; private final double height; @@ -102,16 +102,6 @@ public class URectangle extends AbstractShadowable implements Scalable, UShapeSi return new URectangle(width, height, rx, ry, comment, ignoreForCompressionOnX, true, codeLine); } - public UShape getScaled(double scale) { - if (scale == 1) { - return this; - } - final AbstractShadowable result = new URectangle(width * scale, height * scale, rx * scale, ry * scale, comment, - ignoreForCompressionOnX, ignoreForCompressionOnY, codeLine); - result.setDeltaShadow(this.getDeltaShadow()); - return result; - } - public URectangle(double width, double height) { this(width, height, 0, 0, null, false, false, null); } diff --git a/src/net/sourceforge/plantuml/ugraphic/UScale.java b/src/net/sourceforge/plantuml/ugraphic/UScale.java deleted file mode 100644 index 937994080..000000000 --- a/src/net/sourceforge/plantuml/ugraphic/UScale.java +++ /dev/null @@ -1,63 +0,0 @@ -/* ======================================================================== - * PlantUML : a free UML diagram generator - * ======================================================================== - * - * (C) Copyright 2009-2020, Arnaud Roques - * - * Project Info: http://plantuml.com - * - * If you like this project or if you find it useful, you can support us at: - * - * http://plantuml.com/patreon (only 1$ per month!) - * http://plantuml.com/paypal - * - * This file is part of PlantUML. - * - * PlantUML is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PlantUML distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - * License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. - * - * - * Original Author: Arnaud Roques - * - * - */ -package net.sourceforge.plantuml.ugraphic; - - -public class UScale implements UChange { - - private final double scale; - - @Override - public String toString() { - return "scale scale=" + scale; - } - - public UScale(double scale) { - this.scale = scale; - } - - public double getScale() { - return scale; - } - -// public Point2D getTranslated(Point2D p) { -// if (p == null) { -// return null; -// } -// return new Point2D.Double(p.getX() + dx, p.getY() + dy); -// } - -} diff --git a/src/net/sourceforge/plantuml/ugraphic/g2d/DriverLineG2d.java b/src/net/sourceforge/plantuml/ugraphic/g2d/DriverLineG2d.java index f844a9a03..30084854b 100644 --- a/src/net/sourceforge/plantuml/ugraphic/g2d/DriverLineG2d.java +++ b/src/net/sourceforge/plantuml/ugraphic/g2d/DriverLineG2d.java @@ -73,7 +73,7 @@ public class DriverLineG2d extends DriverShadowedG2d implements UDriver { final UText shape = (UText) ushape; final FontConfiguration fontConfiguration = shape.getFontConfiguration(); - final UFont font = fontConfiguration.getFont().scaled(param.getScale()); + final UFont font = fontConfiguration.getFont(); final Dimension2D dimBack = calculateDimension(font, shape.getText()); if (fontConfiguration.containsStyle(FontStyle.BACKCOLOR)) { final Color extended = mapper.toColor(fontConfiguration.getExtendedColor()); diff --git a/src/net/sourceforge/plantuml/ugraphic/g2d/DriverTextG2d.java b/src/net/sourceforge/plantuml/ugraphic/g2d/DriverTextG2d.java index a45c1ed47..e5e8259d8 100644 --- a/src/net/sourceforge/plantuml/ugraphic/g2d/DriverTextG2d.java +++ b/src/net/sourceforge/plantuml/ugraphic/g2d/DriverTextG2d.java @@ -83,20 +83,18 @@ public class DriverTextG2d implements UDriver { final List strings = StyledString.build(text); - final UFont font = fontConfiguration.getFont().scaled(param.getScale()); - for (StyledString styledString : strings) { final FontConfiguration fc = styledString.getStyle() == FontStyle.BOLD ? fontConfiguration.bold() : fontConfiguration; final Dimension2D dim = calculateDimension(fc.getFont(), styledString.getText()); - printSingleText(g2d, fc, styledString.getText(), x, y, mapper, param); + printSingleText(g2d, fc, styledString.getText(), x, y, mapper); x += dim.getWidth(); } } private void printSingleText(Graphics2D g2d, final FontConfiguration fontConfiguration, final String text, double x, - double y, ColorMapper mapper, UParam param) { - final UFont font = fontConfiguration.getFont().scaled(param.getScale()); + double y, ColorMapper mapper) { + final UFont font = fontConfiguration.getFont(); final HColor extended = fontConfiguration.getExtendedColor(); final int orientation = 0;