mirror of
https://github.com/octoleo/plantuml.git
synced 2024-11-22 21:15:09 +00:00
Delete UScale and related code as it is now unused.
This commit is contained in:
parent
4ac9b7cd90
commit
a02ff86cbd
@ -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;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -93,13 +93,7 @@ public abstract class AbstractUGraphic<O> 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();
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,6 @@ public class LimitFinder extends UGraphicNo {
|
||||
UClip.class,
|
||||
HColor.class,
|
||||
UHidden.class,
|
||||
UScale.class,
|
||||
UStroke.class,
|
||||
UTranslate.class
|
||||
)) {
|
||||
|
@ -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);
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -48,6 +48,4 @@ public interface UParam {
|
||||
public boolean isHidden();
|
||||
|
||||
public UPattern getPattern();
|
||||
|
||||
public double getScale();
|
||||
}
|
||||
|
@ -58,10 +58,4 @@ public class UParamNull implements UParam {
|
||||
public UPattern getPattern() {
|
||||
return UPattern.FULL;
|
||||
}
|
||||
|
||||
public double getScale() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
// }
|
||||
|
||||
}
|
@ -73,7 +73,7 @@ public class DriverLineG2d extends DriverShadowedG2d implements UDriver<Graphics
|
||||
|
||||
static void manageStroke(UParam param, Graphics2D g2d) {
|
||||
final UStroke stroke = param.getStroke();
|
||||
final float thickness = (float) (stroke.getThickness() * param.getScale());
|
||||
final float thickness = (float) stroke.getThickness();
|
||||
if (stroke.getDashVisible() == 0) {
|
||||
g2d.setStroke(new BasicStroke(thickness));
|
||||
} else {
|
||||
|
@ -83,7 +83,7 @@ public class DriverTextAsPathG2d implements UDriver<Graphics2D> {
|
||||
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());
|
||||
|
@ -83,20 +83,18 @@ public class DriverTextG2d implements UDriver<Graphics2D> {
|
||||
|
||||
final List<StyledString> 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;
|
||||
|
Loading…
Reference in New Issue
Block a user