1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-20 04:00:53 +00:00

Merge pull request #706 from matthew16550/UDriver-shape-type

Simplify UDriver code a little
This commit is contained in:
arnaudroques 2021-10-15 13:09:35 +02:00 committed by GitHub
commit 256d008215
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
70 changed files with 157 additions and 531 deletions

View File

@ -38,14 +38,11 @@ package net.sourceforge.plantuml.braille;
import net.sourceforge.plantuml.ugraphic.UCenteredCharacter; import net.sourceforge.plantuml.ugraphic.UCenteredCharacter;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverCenteredCharacterBraille implements UDriver<BrailleGrid> { public class DriverCenteredCharacterBraille implements UDriver<UCenteredCharacter, BrailleGrid> {
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, BrailleGrid grid) {
final UCenteredCharacter characterCircled = (UCenteredCharacter) ushape;
public void draw(UCenteredCharacter characterCircled, double x, double y, ColorMapper mapper, UParam param, BrailleGrid grid) {
final double xpos = x; final double xpos = x;
final double ypos = y; final double ypos = y;

View File

@ -38,14 +38,11 @@ package net.sourceforge.plantuml.braille;
import net.sourceforge.plantuml.posimo.DotPath; import net.sourceforge.plantuml.posimo.DotPath;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverDotPathBraille implements UDriver<BrailleGrid> { public class DriverDotPathBraille implements UDriver<DotPath, BrailleGrid> {
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, BrailleGrid grid) {
final DotPath shape = (DotPath) ushape;
public void draw(DotPath shape, double x, double y, ColorMapper mapper, UParam param, BrailleGrid grid) {
if (param.getColor() != null) { if (param.getColor() != null) {
grid.drawDotPath(x, y, shape); grid.drawDotPath(x, y, shape);
} }

View File

@ -41,10 +41,9 @@ import net.sourceforge.plantuml.ugraphic.UClip;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.ULine;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverLineBraille implements UDriver<BrailleGrid> { public class DriverLineBraille implements UDriver<ULine, BrailleGrid> {
private final ClipContainer clipContainer; private final ClipContainer clipContainer;
@ -52,9 +51,7 @@ public class DriverLineBraille implements UDriver<BrailleGrid> {
this.clipContainer = clipContainer; this.clipContainer = clipContainer;
} }
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, BrailleGrid grid) { public void draw(ULine shape , double x, double y, ColorMapper mapper, UParam param, BrailleGrid grid) {
final ULine shape = (ULine) ushape;
double x2 = x + shape.getDX(); double x2 = x + shape.getDX();
double y2 = y + shape.getDY(); double y2 = y + shape.getDY();

View File

@ -1,47 +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.braille;
import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverNoneBraille implements UDriver<BrailleGrid> {
public void draw(UShape shape, double x, double y, ColorMapper mapper, UParam param, BrailleGrid object) {
}
}

View File

@ -43,11 +43,10 @@ import net.sourceforge.plantuml.ugraphic.UClip;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UPolygon;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverPolygonBraille implements UDriver<BrailleGrid> { public class DriverPolygonBraille implements UDriver<UPolygon, BrailleGrid> {
private final ClipContainer clipContainer; private final ClipContainer clipContainer;
@ -55,9 +54,7 @@ public class DriverPolygonBraille implements UDriver<BrailleGrid> {
this.clipContainer = clipContainer; this.clipContainer = clipContainer;
} }
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, BrailleGrid grid) { public void draw(UPolygon shape, double x, double y, ColorMapper mapper, UParam param, BrailleGrid grid) {
final UPolygon shape = (UPolygon) ushape;
final List<Point2D> points = new ArrayList<>(); final List<Point2D> points = new ArrayList<>();
int i = 0; int i = 0;

View File

@ -41,10 +41,9 @@ import net.sourceforge.plantuml.ugraphic.UClip;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.URectangle;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverRectangleBraille implements UDriver<BrailleGrid> { public class DriverRectangleBraille implements UDriver<URectangle, BrailleGrid> {
private final ClipContainer clipContainer; private final ClipContainer clipContainer;
@ -52,9 +51,7 @@ public class DriverRectangleBraille implements UDriver<BrailleGrid> {
this.clipContainer = clipContainer; this.clipContainer = clipContainer;
} }
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, BrailleGrid grid) { public void draw(URectangle rect, double x, double y, ColorMapper mapper, UParam param, BrailleGrid grid) {
final URectangle rect = (URectangle) ushape;
// final double rx = rect.getRx(); // final double rx = rect.getRx();
// final double ry = rect.getRy(); // final double ry = rect.getRy();
double width = rect.getWidth(); double width = rect.getWidth();

View File

@ -36,18 +36,15 @@ package net.sourceforge.plantuml.braille;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.UText; import net.sourceforge.plantuml.ugraphic.UText;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverTextBraille implements UDriver<BrailleGrid> { public class DriverTextBraille implements UDriver<UText, BrailleGrid> {
public DriverTextBraille() { public DriverTextBraille() {
} }
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, BrailleGrid grid) { public void draw(UText text, double x, double y, ColorMapper mapper, UParam param, BrailleGrid grid) {
final UText text = (UText) ushape;
y -= grid.getQuanta() * 3; y -= grid.getQuanta() * 3;
x += grid.getQuanta(); x += grid.getQuanta();

View File

@ -103,14 +103,14 @@ public class UGraphicBraille extends AbstractUGraphic<BrailleGrid> implements Cl
} }
private void register() { private void register() {
registerDriver(URectangle.class, new DriverNoneBraille()); ignoreShape(URectangle.class);
registerDriver(URectangle.class, new DriverRectangleBraille(this)); registerDriver(URectangle.class, new DriverRectangleBraille(this));
registerDriver(UText.class, new DriverTextBraille()); registerDriver(UText.class, new DriverTextBraille());
registerDriver(ULine.class, new DriverLineBraille(this)); registerDriver(ULine.class, new DriverLineBraille(this));
registerDriver(UPolygon.class, new DriverPolygonBraille(this)); registerDriver(UPolygon.class, new DriverPolygonBraille(this));
registerDriver(UEllipse.class, new DriverNoneBraille()); ignoreShape(UEllipse.class);
registerDriver(UImage.class, new DriverNoneBraille()); ignoreShape(UImage.class);
registerDriver(UPath.class, new DriverNoneBraille()); ignoreShape(UPath.class);
registerDriver(DotPath.class, new DriverDotPathBraille()); registerDriver(DotPath.class, new DriverDotPathBraille());
registerDriver(UCenteredCharacter.class, new DriverCenteredCharacterBraille()); registerDriver(UCenteredCharacter.class, new DriverCenteredCharacterBraille());
} }

View File

@ -48,7 +48,10 @@ public abstract class AbstractUGraphic<O> extends AbstractCommonUGraphic {
private final O graphic; private final O graphic;
private final Map<Class<? extends UShape>, UDriver<O>> drivers = new HashMap<Class<? extends UShape>, UDriver<O>>(); // It would be nice to do something like this but not sure how:
// Map<Class<SHAPE>, UDriver<SHAPE, O>>
// See https://stackoverflow.com/questions/416540/java-map-with-values-limited-by-keys-type-parameter
private final Map<Class<? extends UShape>, UDriver<?, O>> drivers = new HashMap<>();
public AbstractUGraphic(HColor defaultBackground, ColorMapper colorMapper, StringBounder stringBounder, O graphic) { public AbstractUGraphic(HColor defaultBackground, ColorMapper colorMapper, StringBounder stringBounder, O graphic) {
super(Objects.requireNonNull(defaultBackground), colorMapper, stringBounder); super(Objects.requireNonNull(defaultBackground), colorMapper, stringBounder);
@ -69,11 +72,22 @@ public abstract class AbstractUGraphic<O> extends AbstractCommonUGraphic {
return true; return true;
} }
final protected void registerDriver(Class<? extends UShape> cl, UDriver<O> driver) { final protected <SHAPE extends UShape> void registerDriver(Class<SHAPE> cl, UDriver<SHAPE, O> driver) {
this.drivers.put(cl, driver); this.drivers.put(cl, driver);
} }
public final void draw(UShape shape) { private static final UDriver<?,?> NOOP_DRIVER = new UDriver<UShape, Object>() {
@Override
public void draw(UShape shape, double x, double y, ColorMapper mapper, UParam param, Object object) {
}
};
@SuppressWarnings("unchecked")
final protected <SHAPE extends UShape> void ignoreShape(Class<SHAPE> cl) {
registerDriver(cl, (UDriver<SHAPE, O>) NOOP_DRIVER);
}
public final <SHAPE extends UShape> void draw(SHAPE shape) {
if (shape instanceof SpecialText) { if (shape instanceof SpecialText) {
((SpecialText) shape).getTitle().drawU(this); ((SpecialText) shape).getTitle().drawU(this);
return; return;
@ -85,7 +99,10 @@ public abstract class AbstractUGraphic<O> extends AbstractCommonUGraphic {
drawComment((UComment) shape); drawComment((UComment) shape);
return; return;
} }
final UDriver<O> driver = drivers.get(shape.getClass());
@SuppressWarnings("unchecked")
final UDriver<SHAPE, O> driver = (UDriver<SHAPE, O>) drivers.get(shape.getClass());
if (driver == null) { if (driver == null) {
throw new UnsupportedOperationException(shape.getClass().toString() + " " + this.getClass()); throw new UnsupportedOperationException(shape.getClass().toString() + " " + this.getClass());
} }

View File

@ -37,7 +37,7 @@ package net.sourceforge.plantuml.ugraphic;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public interface UDriver<O> { public interface UDriver<SHAPE extends UShape, O> {
public void draw(UShape shape, double x, double y, ColorMapper mapper, UParam param, O object); public void draw(SHAPE shape, double x, double y, ColorMapper mapper, UParam param, O object);
} }

View File

@ -49,7 +49,7 @@ public interface UGraphic {
public UParam getParam(); public UParam getParam();
public void draw(UShape shape); public <SHAPE extends UShape> void draw(SHAPE shape);
public UGraphic apply(UChange change); public UGraphic apply(UChange change);

View File

@ -44,13 +44,11 @@ import net.sourceforge.plantuml.ugraphic.UCenteredCharacter;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverCenteredCharacterEps implements UDriver<EpsGraphics> { public class DriverCenteredCharacterEps implements UDriver<UCenteredCharacter, EpsGraphics> {
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, EpsGraphics eps) { public void draw(UCenteredCharacter centeredCharacter, double x, double y, ColorMapper mapper, UParam param, EpsGraphics eps) {
final UCenteredCharacter centeredCharacter = (UCenteredCharacter) ushape;
final char c = centeredCharacter.getChar(); final char c = centeredCharacter.getChar();
final UFont font = centeredCharacter.getFont(); final UFont font = centeredCharacter.getFont();
final UnusedSpace unusedSpace = UnusedSpace.getUnusedSpace(font, c); final UnusedSpace unusedSpace = UnusedSpace.getUnusedSpace(font, c);
@ -61,7 +59,6 @@ public class DriverCenteredCharacterEps implements UDriver<EpsGraphics> {
final TextLayout t = createTextLayout(font, "" + c); final TextLayout t = createTextLayout(font, "" + c);
eps.setStrokeColor(mapper.toColor(param.getColor())); eps.setStrokeColor(mapper.toColor(param.getColor()));
DriverTextEps.drawPathIterator(eps, xpos, ypos, t.getOutline(null)); DriverTextEps.drawPathIterator(eps, xpos, ypos, t.getOutline(null));
} }
} }

View File

@ -39,13 +39,11 @@ import net.sourceforge.plantuml.eps.EpsGraphics;
import net.sourceforge.plantuml.posimo.DotPath; import net.sourceforge.plantuml.posimo.DotPath;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverDotPathEps implements UDriver<EpsGraphics> { public class DriverDotPathEps implements UDriver<DotPath, EpsGraphics> {
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, EpsGraphics eps) { public void draw(DotPath shape, double x, double y, ColorMapper mapper, UParam param, EpsGraphics eps) {
final DotPath shape = (DotPath) ushape;
//DriverLineG2d.manageStroke(param, g2d); //DriverLineG2d.manageStroke(param, g2d);
if (param.getColor() != null) { if (param.getColor() != null) {

View File

@ -40,10 +40,9 @@ import net.sourceforge.plantuml.ugraphic.UClip;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UEllipse;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverEllipseEps implements UDriver<EpsGraphics> { public class DriverEllipseEps implements UDriver<UEllipse, EpsGraphics> {
private final ClipContainer clipContainer; private final ClipContainer clipContainer;
@ -51,8 +50,7 @@ public class DriverEllipseEps implements UDriver<EpsGraphics> {
this.clipContainer = clipContainer; this.clipContainer = clipContainer;
} }
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, EpsGraphics eps) { public void draw(UEllipse shape, double x, double y, ColorMapper mapper, UParam param, EpsGraphics eps) {
final UEllipse shape = (UEllipse) ushape;
final double width = shape.getWidth(); final double width = shape.getWidth();
final double height = shape.getHeight(); final double height = shape.getHeight();

View File

@ -40,10 +40,9 @@ import net.sourceforge.plantuml.ugraphic.UClip;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UImage; import net.sourceforge.plantuml.ugraphic.UImage;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverImageEps implements UDriver<EpsGraphics> { public class DriverImageEps implements UDriver<UImage, EpsGraphics> {
private final ClipContainer clipContainer; private final ClipContainer clipContainer;
@ -51,10 +50,7 @@ public class DriverImageEps implements UDriver<EpsGraphics> {
this.clipContainer = clipContainer; this.clipContainer = clipContainer;
} }
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, EpsGraphics eps) { public void draw(UImage shape, double x, double y, ColorMapper mapper, UParam param, EpsGraphics eps) {
final UImage shape = (UImage) ushape;
final UClip clip = clipContainer.getClip(); final UClip clip = clipContainer.getClip();
if (clip != null) { if (clip != null) {
if (clip.isInside(x, y) == false) { if (clip.isInside(x, y) == false) {

View File

@ -42,10 +42,9 @@ import net.sourceforge.plantuml.ugraphic.UClip;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.ULine;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverLineEps implements UDriver<EpsGraphics> { public class DriverLineEps implements UDriver<ULine, EpsGraphics> {
private final ClipContainer clipContainer; private final ClipContainer clipContainer;
@ -53,9 +52,7 @@ public class DriverLineEps implements UDriver<EpsGraphics> {
this.clipContainer = clipContainer; this.clipContainer = clipContainer;
} }
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, EpsGraphics eps) { public void draw(ULine shape, double x, double y, ColorMapper mapper, UParam param, EpsGraphics eps) {
final ULine shape = (ULine) ushape;
double x2 = x + shape.getDX(); double x2 = x + shape.getDX();
double y2 = y + shape.getDY(); double y2 = y + shape.getDY();

View File

@ -38,14 +38,11 @@ import net.sourceforge.plantuml.eps.EpsGraphics;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.UPath;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverPathEps implements UDriver<EpsGraphics> { public class DriverPathEps implements UDriver<UPath, EpsGraphics> {
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, EpsGraphics eps) {
final UPath shape = (UPath) ushape;
public void draw(UPath shape, double x, double y, ColorMapper mapper, UParam param, EpsGraphics eps) {
eps.setStrokeColor(mapper.toColor(param.getColor())); eps.setStrokeColor(mapper.toColor(param.getColor()));
eps.setFillColor(mapper.toColor(param.getBackcolor())); eps.setFillColor(mapper.toColor(param.getBackcolor()));
eps.setStrokeWidth(param.getStroke().getThickness(), param.getStroke().getDashVisible(), param eps.setStrokeWidth(param.getStroke().getThickness(), param.getStroke().getDashVisible(), param

View File

@ -42,12 +42,11 @@ import net.sourceforge.plantuml.ugraphic.UClip;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UPolygon;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorGradient; import net.sourceforge.plantuml.ugraphic.color.HColorGradient;
public class DriverPolygonEps implements UDriver<EpsGraphics> { public class DriverPolygonEps implements UDriver<UPolygon, EpsGraphics> {
private final ClipContainer clipContainer; private final ClipContainer clipContainer;
@ -55,9 +54,7 @@ public class DriverPolygonEps implements UDriver<EpsGraphics> {
this.clipContainer = clipContainer; this.clipContainer = clipContainer;
} }
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, EpsGraphics eps) { public void draw(UPolygon shape, double x, double y, ColorMapper mapper, UParam param, EpsGraphics eps) {
final UPolygon shape = (UPolygon) ushape;
final double points[] = new double[shape.getPoints().size() * 2]; final double points[] = new double[shape.getPoints().size() * 2];
int i = 0; int i = 0;

View File

@ -42,12 +42,11 @@ import net.sourceforge.plantuml.ugraphic.UClip;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.URectangle;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorGradient; import net.sourceforge.plantuml.ugraphic.color.HColorGradient;
public class DriverRectangleEps implements UDriver<EpsGraphics> { public class DriverRectangleEps implements UDriver<URectangle, EpsGraphics> {
private final ClipContainer clipContainer; private final ClipContainer clipContainer;
@ -55,9 +54,7 @@ public class DriverRectangleEps implements UDriver<EpsGraphics> {
this.clipContainer = clipContainer; this.clipContainer = clipContainer;
} }
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, EpsGraphics eps) { public void draw(URectangle rect, double x, double y, ColorMapper mapper, UParam param, EpsGraphics eps) {
final URectangle rect = (URectangle) ushape;
double width = rect.getWidth(); double width = rect.getWidth();
double height = rect.getHeight(); double height = rect.getHeight();
@ -93,6 +90,5 @@ public class DriverRectangleEps implements UDriver<EpsGraphics> {
.getStroke().getDashSpace()); .getStroke().getDashSpace());
eps.epsRectangle(x, y, width, height, rx / 2, ry / 2); eps.epsRectangle(x, y, width, height, rx / 2, ry / 2);
} }
} }
} }

View File

@ -53,13 +53,12 @@ import net.sourceforge.plantuml.ugraphic.MinMax;
import net.sourceforge.plantuml.ugraphic.UClip; import net.sourceforge.plantuml.ugraphic.UClip;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.UText; import net.sourceforge.plantuml.ugraphic.UText;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils; import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
public class DriverTextEps implements UDriver<EpsGraphics> { public class DriverTextEps implements UDriver<UText, EpsGraphics> {
private final ClipContainer clipContainer; private final ClipContainer clipContainer;
private final EpsStrategy strategy; private final EpsStrategy strategy;
@ -69,15 +68,12 @@ public class DriverTextEps implements UDriver<EpsGraphics> {
this.strategy = strategy; this.strategy = strategy;
} }
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, EpsGraphics eps) { public void draw(UText shape, double x, double y, ColorMapper mapper, UParam param, EpsGraphics eps) {
final UClip clip = clipContainer.getClip(); final UClip clip = clipContainer.getClip();
if (clip != null && clip.isInside(x, y) == false) { if (clip != null && clip.isInside(x, y) == false) {
return; return;
} }
final UText shape = (UText) ushape;
final FontConfiguration fontConfiguration = shape.getFontConfiguration(); final FontConfiguration fontConfiguration = shape.getFontConfiguration();
if (HColorUtils.isTransparent(fontConfiguration.getColor())) { if (HColorUtils.isTransparent(fontConfiguration.getColor())) {
return; return;

View File

@ -42,13 +42,11 @@ import net.sourceforge.plantuml.ugraphic.UCenteredCharacter;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverCenteredCharacterG2d implements UDriver<Graphics2D> { public class DriverCenteredCharacterG2d implements UDriver<UCenteredCharacter, Graphics2D> {
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) { public void draw(UCenteredCharacter characterCircled, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) {
final UCenteredCharacter characterCircled = (UCenteredCharacter) ushape;
final char c = characterCircled.getChar(); final char c = characterCircled.getChar();
final UFont font = characterCircled.getFont(); final UFont font = characterCircled.getFont();
final UnusedSpace unusedSpace = UnusedSpace.getUnusedSpace(font, c); final UnusedSpace unusedSpace = UnusedSpace.getUnusedSpace(font, c);

View File

@ -41,10 +41,9 @@ import net.sourceforge.plantuml.EnsureVisible;
import net.sourceforge.plantuml.posimo.DotPath; import net.sourceforge.plantuml.posimo.DotPath;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverDotPathG2d implements UDriver<Graphics2D> { public class DriverDotPathG2d implements UDriver<DotPath, Graphics2D> {
private final EnsureVisible visible; private final EnsureVisible visible;
@ -52,8 +51,7 @@ public class DriverDotPathG2d implements UDriver<Graphics2D> {
this.visible = visible; this.visible = visible;
} }
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) { public void draw(DotPath shape, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) {
final DotPath shape = (DotPath) ushape;
DriverLineG2d.manageStroke(param, g2d); DriverLineG2d.manageStroke(param, g2d);
if (param.getColor() != null) { if (param.getColor() != null) {

View File

@ -46,12 +46,11 @@ import net.sourceforge.plantuml.EnsureVisible;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UEllipse;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorGradient; import net.sourceforge.plantuml.ugraphic.color.HColorGradient;
public class DriverEllipseG2d extends DriverShadowedG2d implements UDriver<Graphics2D> { public class DriverEllipseG2d extends DriverShadowedG2d implements UDriver<UEllipse, Graphics2D> {
private final double dpiFactor; private final double dpiFactor;
private final EnsureVisible visible; private final EnsureVisible visible;
@ -61,8 +60,7 @@ public class DriverEllipseG2d extends DriverShadowedG2d implements UDriver<Graph
this.visible = visible; this.visible = visible;
} }
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) { public void draw(UEllipse ellipse, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) {
final UEllipse ellipse = (UEllipse) ushape;
g2d.setStroke(new BasicStroke((float) param.getStroke().getThickness())); g2d.setStroke(new BasicStroke((float) param.getStroke().getThickness()));
visible.ensureVisible(x, y); visible.ensureVisible(x, y);
visible.ensureVisible(x + ellipse.getWidth(), y + ellipse.getHeight()); visible.ensureVisible(x + ellipse.getWidth(), y + ellipse.getHeight());

View File

@ -41,12 +41,10 @@ import java.awt.geom.AffineTransform;
import net.sourceforge.plantuml.EnsureVisible; import net.sourceforge.plantuml.EnsureVisible;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UImage; import net.sourceforge.plantuml.ugraphic.UImage;
import net.sourceforge.plantuml.ugraphic.UImageSvg;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverImageG2d implements UDriver<Graphics2D> { public class DriverImageG2d implements UDriver<UImage, Graphics2D> {
private final EnsureVisible visible; private final EnsureVisible visible;
@ -57,11 +55,7 @@ public class DriverImageG2d implements UDriver<Graphics2D> {
this.dpiFactor = dpiFactor; this.dpiFactor = dpiFactor;
} }
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) { public void draw(UImage shape, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) {
if (ushape instanceof UImageSvg) {
return;
}
final UImage shape = ((UImage) ushape);
visible.ensureVisible(x, y); visible.ensureVisible(x, y);
visible.ensureVisible(x + shape.getWidth(), y + shape.getHeight()); visible.ensureVisible(x + shape.getWidth(), y + shape.getHeight());
if (dpiFactor == 1) { if (dpiFactor == 1) {

View File

@ -43,12 +43,11 @@ import java.awt.geom.Line2D;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.ULine;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
public class DriverLineG2d extends DriverShadowedG2d implements UDriver<Graphics2D> { public class DriverLineG2d extends DriverShadowedG2d implements UDriver<ULine, Graphics2D> {
private final double dpiFactor; private final double dpiFactor;
@ -56,9 +55,7 @@ public class DriverLineG2d extends DriverShadowedG2d implements UDriver<Graphics
this.dpiFactor = dpiFactor; this.dpiFactor = dpiFactor;
} }
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) { public void draw(ULine shape, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) {
final ULine shape = (ULine) ushape;
final Shape line = new Line2D.Double(x, y, x + shape.getDX(), y + shape.getDY()); final Shape line = new Line2D.Double(x, y, x + shape.getDX(), y + shape.getDY());
manageStroke(param, g2d); manageStroke(param, g2d);
// Shadow // Shadow

View File

@ -44,14 +44,13 @@ import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.UPath;
import net.sourceforge.plantuml.ugraphic.USegment; import net.sourceforge.plantuml.ugraphic.USegment;
import net.sourceforge.plantuml.ugraphic.USegmentType; import net.sourceforge.plantuml.ugraphic.USegmentType;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.arc.ExtendedGeneralPath; import net.sourceforge.plantuml.ugraphic.arc.ExtendedGeneralPath;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorGradient; import net.sourceforge.plantuml.ugraphic.color.HColorGradient;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils; import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
public class DriverPathG2d extends DriverShadowedG2d implements UDriver<Graphics2D> { public class DriverPathG2d extends DriverShadowedG2d implements UDriver<UPath, Graphics2D> {
private final double dpiFactor; private final double dpiFactor;
@ -59,8 +58,7 @@ public class DriverPathG2d extends DriverShadowedG2d implements UDriver<Graphics
this.dpiFactor = dpiFactor; this.dpiFactor = dpiFactor;
} }
public void draw(UShape ushape, final double x, final double y, ColorMapper mapper, UParam param, Graphics2D g2d) { public void draw(UPath shape, final double x, final double y, ColorMapper mapper, UParam param, Graphics2D g2d) {
final UPath shape = (UPath) ushape;
DriverLineG2d.manageStroke(param, g2d); DriverLineG2d.manageStroke(param, g2d);
final HColor back = param.getBackcolor(); final HColor back = param.getBackcolor();

View File

@ -39,12 +39,12 @@ import java.awt.Graphics2D;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.UPixel;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverPixelG2d implements UDriver<Graphics2D> { public class DriverPixelG2d implements UDriver<UPixel, Graphics2D> {
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) { public void draw(UPixel pixel, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) {
g2d.setColor(mapper.toColor(param.getColor())); g2d.setColor(mapper.toColor(param.getColor()));
g2d.fillRect((int) x, (int) y, 1, 1); g2d.fillRect((int) x, (int) y, 1, 1);
} }

View File

@ -45,13 +45,12 @@ import net.sourceforge.plantuml.EnsureVisible;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UPolygon;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorGradient; import net.sourceforge.plantuml.ugraphic.color.HColorGradient;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils; import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
public class DriverPolygonG2d extends DriverShadowedG2d implements UDriver<Graphics2D> { public class DriverPolygonG2d extends DriverShadowedG2d implements UDriver<UPolygon, Graphics2D> {
private final double dpiFactor; private final double dpiFactor;
private final EnsureVisible visible; private final EnsureVisible visible;
@ -61,9 +60,7 @@ public class DriverPolygonG2d extends DriverShadowedG2d implements UDriver<Graph
this.visible = visible; this.visible = visible;
} }
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) { public void draw(UPolygon shape, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) {
final UPolygon shape = (UPolygon) ushape;
g2d.setStroke(new BasicStroke((float) param.getStroke().getThickness())); g2d.setStroke(new BasicStroke((float) param.getStroke().getThickness()));
final GeneralPath path = new GeneralPath(); final GeneralPath path = new GeneralPath();

View File

@ -50,7 +50,6 @@ import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UPattern; import net.sourceforge.plantuml.ugraphic.UPattern;
import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.URectangle;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.UShapeSized; import net.sourceforge.plantuml.ugraphic.UShapeSized;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
@ -58,7 +57,7 @@ import net.sourceforge.plantuml.ugraphic.color.HColorGradient;
import net.sourceforge.plantuml.ugraphic.color.HColorSimple; import net.sourceforge.plantuml.ugraphic.color.HColorSimple;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils; import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
public class DriverRectangleG2d extends DriverShadowedG2d implements UDriver<Graphics2D> { public class DriverRectangleG2d extends DriverShadowedG2d implements UDriver<URectangle, Graphics2D> {
private final double dpiFactor; private final double dpiFactor;
private final EnsureVisible visible; private final EnsureVisible visible;
@ -68,9 +67,8 @@ public class DriverRectangleG2d extends DriverShadowedG2d implements UDriver<Gra
this.visible = visible; this.visible = visible;
} }
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) { public void draw(URectangle rect, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) {
g2d.setStroke(new BasicStroke((float) param.getStroke().getThickness())); g2d.setStroke(new BasicStroke((float) param.getStroke().getThickness()));
final URectangle rect = (URectangle) ushape;
final double rx = rect.getRx(); final double rx = rect.getRx();
final double ry = rect.getRy(); final double ry = rect.getRy();
final Shape shape; final Shape shape;

View File

@ -55,12 +55,11 @@ import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.UText; import net.sourceforge.plantuml.ugraphic.UText;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
public class DriverTextAsPathG2d implements UDriver<Graphics2D> { public class DriverTextAsPathG2d implements UDriver<UText, Graphics2D> {
private final EnsureVisible visible; private final EnsureVisible visible;
private final StringBounder stringBounder; private final StringBounder stringBounder;
@ -79,8 +78,7 @@ public class DriverTextAsPathG2d implements UDriver<Graphics2D> {
} }
} }
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) { public void draw(UText shape, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) {
final UText shape = (UText) ushape;
final FontConfiguration fontConfiguration = shape.getFontConfiguration(); final FontConfiguration fontConfiguration = shape.getFontConfiguration();
final UFont font = fontConfiguration.getFont(); final UFont font = fontConfiguration.getFont();

View File

@ -56,14 +56,13 @@ import net.sourceforge.plantuml.text.StyledString;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.UText; import net.sourceforge.plantuml.ugraphic.UText;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorGradient; import net.sourceforge.plantuml.ugraphic.color.HColorGradient;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils; import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
public class DriverTextG2d implements UDriver<Graphics2D> { public class DriverTextG2d implements UDriver<UText, Graphics2D> {
private final EnsureVisible visible; private final EnsureVisible visible;
private final StringBounder stringBounder; private final StringBounder stringBounder;
@ -73,8 +72,7 @@ public class DriverTextG2d implements UDriver<Graphics2D> {
this.stringBounder = stringBounder; this.stringBounder = stringBounder;
} }
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) { public void draw(UText shape, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) {
final UText shape = (UText) ushape;
final FontConfiguration fontConfiguration = shape.getFontConfiguration(); final FontConfiguration fontConfiguration = shape.getFontConfiguration();
if (HColorUtils.isTransparent(fontConfiguration.getColor())) { if (HColorUtils.isTransparent(fontConfiguration.getColor())) {

View File

@ -148,7 +148,7 @@ public class UGraphicG2d extends AbstractUGraphic<Graphics2D> implements EnsureV
registerDriver(UPixel.class, new DriverPixelG2d()); registerDriver(UPixel.class, new DriverPixelG2d());
registerDriver(UPolygon.class, new DriverPolygonG2d(dpiFactor, this)); registerDriver(UPolygon.class, new DriverPolygonG2d(dpiFactor, this));
registerDriver(UEllipse.class, new DriverEllipseG2d(dpiFactor, this)); registerDriver(UEllipse.class, new DriverEllipseG2d(dpiFactor, this));
registerDriver(UImageSvg.class, new DriverImageG2d(dpiFactor, this)); ignoreShape(UImageSvg.class);
registerDriver(UImage.class, new DriverImageG2d(dpiFactor, this)); registerDriver(UImage.class, new DriverImageG2d(dpiFactor, this));
registerDriver(DotPath.class, new DriverDotPathG2d(this)); registerDriver(DotPath.class, new DriverDotPathG2d(this));
registerDriver(UPath.class, new DriverPathG2d(dpiFactor)); registerDriver(UPath.class, new DriverPathG2d(dpiFactor));

View File

@ -41,10 +41,9 @@ import net.sourceforge.plantuml.ugraphic.UClip;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.ULine;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverLineHtml5 implements UDriver<Html5Drawer> { public class DriverLineHtml5 implements UDriver<ULine, Html5Drawer> {
private final ClipContainer clipContainer; private final ClipContainer clipContainer;
@ -52,9 +51,7 @@ public class DriverLineHtml5 implements UDriver<Html5Drawer> {
this.clipContainer = clipContainer; this.clipContainer = clipContainer;
} }
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, Html5Drawer html) { public void draw(ULine shape, double x, double y, ColorMapper mapper, UParam param, Html5Drawer html) {
final ULine shape = (ULine) ushape;
double x2 = x + shape.getDX(); double x2 = x + shape.getDX();
double y2 = y + shape.getDY(); double y2 = y + shape.getDY();

View File

@ -1,46 +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.html5;
import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverNopHtml5 implements UDriver<Html5Drawer> {
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, Html5Drawer html) {
}
}

View File

@ -41,12 +41,11 @@ import net.sourceforge.plantuml.ugraphic.UClip;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.URectangle;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorGradient; import net.sourceforge.plantuml.ugraphic.color.HColorGradient;
public class DriverRectangleHtml5 implements UDriver<Html5Drawer> { public class DriverRectangleHtml5 implements UDriver<URectangle, Html5Drawer> {
private final ClipContainer clipContainer; private final ClipContainer clipContainer;
@ -54,9 +53,7 @@ public class DriverRectangleHtml5 implements UDriver<Html5Drawer> {
this.clipContainer = clipContainer; this.clipContainer = clipContainer;
} }
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, Html5Drawer html) { public void draw(URectangle rect, double x, double y, ColorMapper mapper, UParam param, Html5Drawer html) {
final URectangle rect = (URectangle) ushape;
double width = rect.getWidth(); double width = rect.getWidth();
double height = rect.getHeight(); double height = rect.getHeight();
@ -91,6 +88,5 @@ public class DriverRectangleHtml5 implements UDriver<Html5Drawer> {
// .getStroke().getDashSpace()); // .getStroke().getDashSpace());
html.htmlRectangle(x, y, width, height, rx / 2, ry / 2); html.htmlRectangle(x, y, width, height, rx / 2, ry / 2);
} }
} }
} }

View File

@ -59,10 +59,10 @@ public class UGraphicHtml5 extends AbstractUGraphic<Html5Drawer> implements Clip
super(defaultBackground, colorMapper, FileFormat.PNG.getDefaultStringBounder(), new Html5Drawer()); super(defaultBackground, colorMapper, FileFormat.PNG.getDefaultStringBounder(), new Html5Drawer());
registerDriver(URectangle.class, new DriverRectangleHtml5(this)); registerDriver(URectangle.class, new DriverRectangleHtml5(this));
// registerDriver(UText.class, new DriverTextEps(imDummy, this, strategy)); // registerDriver(UText.class, new DriverTextEps(imDummy, this, strategy));
registerDriver(UText.class, new DriverNopHtml5()); ignoreShape(UText.class);
registerDriver(ULine.class, new DriverLineHtml5(this)); registerDriver(ULine.class, new DriverLineHtml5(this));
// registerDriver(UPolygon.class, new DriverPolygonEps(this)); // registerDriver(UPolygon.class, new DriverPolygonEps(this));
registerDriver(UPolygon.class, new DriverNopHtml5()); ignoreShape(UPolygon.class);
// registerDriver(UEllipse.class, new DriverEllipseEps()); // registerDriver(UEllipse.class, new DriverEllipseEps());
// registerDriver(UImage.class, new DriverImageEps()); // registerDriver(UImage.class, new DriverImageEps());
// registerDriver(UPath.class, new DriverPathEps()); // registerDriver(UPath.class, new DriverPathEps());

View File

@ -44,13 +44,11 @@ import net.sourceforge.plantuml.ugraphic.UCenteredCharacter;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverCenteredCharacterSvg implements UDriver<SvgGraphics> { public class DriverCenteredCharacterSvg implements UDriver<UCenteredCharacter, SvgGraphics> {
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) { public void draw(UCenteredCharacter characterCircled, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) {
final UCenteredCharacter characterCircled = (UCenteredCharacter) ushape;
final char c = characterCircled.getChar(); final char c = characterCircled.getChar();
final UFont font = characterCircled.getFont(); final UFont font = characterCircled.getFont();
final UnusedSpace unusedSpace = UnusedSpace.getUnusedSpace(font, c); final UnusedSpace unusedSpace = UnusedSpace.getUnusedSpace(font, c);
@ -61,6 +59,5 @@ public class DriverCenteredCharacterSvg implements UDriver<SvgGraphics> {
final TextLayout t = createTextLayout(font, "" + c); final TextLayout t = createTextLayout(font, "" + c);
svg.setFillColor(mapper.toRGB(param.getColor())); svg.setFillColor(mapper.toRGB(param.getColor()));
svg.drawPathIterator(xpos, ypos, t.getOutline(null).getPathIterator(null)); svg.drawPathIterator(xpos, ypos, t.getOutline(null).getPathIterator(null));
} }
} }

View File

@ -39,13 +39,11 @@ import net.sourceforge.plantuml.posimo.DotPath;
import net.sourceforge.plantuml.svg.SvgGraphics; import net.sourceforge.plantuml.svg.SvgGraphics;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverDotPathSvg implements UDriver<SvgGraphics> { public class DriverDotPathSvg implements UDriver<DotPath, SvgGraphics> {
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) { public void draw(DotPath shape, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) {
final DotPath shape = (DotPath) ushape;
// DriverLineG2d.manageStroke(param, g2d); // DriverLineG2d.manageStroke(param, g2d);
if (param.getColor() != null) { if (param.getColor() != null) {

View File

@ -40,13 +40,12 @@ import net.sourceforge.plantuml.ugraphic.UClip;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UEllipse;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorBackground; import net.sourceforge.plantuml.ugraphic.color.HColorBackground;
import net.sourceforge.plantuml.ugraphic.color.HColorGradient; import net.sourceforge.plantuml.ugraphic.color.HColorGradient;
public class DriverEllipseSvg implements UDriver<SvgGraphics> { public class DriverEllipseSvg implements UDriver<UEllipse, SvgGraphics> {
private final ClipContainer clipContainer; private final ClipContainer clipContainer;
@ -54,8 +53,7 @@ public class DriverEllipseSvg implements UDriver<SvgGraphics> {
this.clipContainer = clipContainer; this.clipContainer = clipContainer;
} }
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) { public void draw(UEllipse shape, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) {
final UEllipse shape = (UEllipse) ushape;
final double width = shape.getWidth(); final double width = shape.getWidth();
final double height = shape.getHeight(); final double height = shape.getHeight();

View File

@ -43,10 +43,9 @@ import net.sourceforge.plantuml.ugraphic.UClip;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UImage; import net.sourceforge.plantuml.ugraphic.UImage;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverImagePng implements UDriver<SvgGraphics> { public class DriverImagePng implements UDriver<UImage, SvgGraphics> {
private final ClipContainer clipContainer; private final ClipContainer clipContainer;
@ -54,9 +53,7 @@ public class DriverImagePng implements UDriver<SvgGraphics> {
this.clipContainer = clipContainer; this.clipContainer = clipContainer;
} }
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) { public void draw(UImage image, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) {
final UImage image = (UImage) ushape;
final UClip clip = clipContainer.getClip(); final UClip clip = clipContainer.getClip();
if (clip != null) { if (clip != null) {
if (clip.isInside(x, y) == false) { if (clip.isInside(x, y) == false) {

View File

@ -38,13 +38,11 @@ import net.sourceforge.plantuml.svg.SvgGraphics;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UImageSvg; import net.sourceforge.plantuml.ugraphic.UImageSvg;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverImageSvgSvg implements UDriver<SvgGraphics> { public class DriverImageSvgSvg implements UDriver<UImageSvg, SvgGraphics> {
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) { public void draw(UImageSvg image, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) {
final UImageSvg image = (UImageSvg) ushape;
svg.svgImage(image, x, y); svg.svgImage(image, x, y);
} }
} }

View File

@ -42,12 +42,11 @@ import net.sourceforge.plantuml.ugraphic.UClip;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.ULine;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorGradient; import net.sourceforge.plantuml.ugraphic.color.HColorGradient;
public class DriverLineSvg implements UDriver<SvgGraphics> { public class DriverLineSvg implements UDriver<ULine, SvgGraphics> {
private final ClipContainer clipContainer; private final ClipContainer clipContainer;
@ -55,9 +54,7 @@ public class DriverLineSvg implements UDriver<SvgGraphics> {
this.clipContainer = clipContainer; this.clipContainer = clipContainer;
} }
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) { public void draw(ULine shape, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) {
final ULine shape = (ULine) ushape;
double x2 = x + shape.getDX(); double x2 = x + shape.getDX();
double y2 = y + shape.getDY(); double y2 = y + shape.getDY();

View File

@ -1,48 +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.svg;
import net.sourceforge.plantuml.svg.SvgGraphics;
import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverNoneSvg implements UDriver<SvgGraphics> {
public void draw(UShape shape, double x, double y, ColorMapper mapper, UParam param, SvgGraphics object) {
}
}

View File

@ -40,13 +40,12 @@ import net.sourceforge.plantuml.ugraphic.UClip;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.UPath;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorGradient; import net.sourceforge.plantuml.ugraphic.color.HColorGradient;
import net.sourceforge.plantuml.ugraphic.g2d.DriverShadowedG2d; import net.sourceforge.plantuml.ugraphic.g2d.DriverShadowedG2d;
public class DriverPathSvg extends DriverShadowedG2d implements UDriver<SvgGraphics> { public class DriverPathSvg extends DriverShadowedG2d implements UDriver<UPath, SvgGraphics> {
private final ClipContainer clipContainer; private final ClipContainer clipContainer;
@ -54,9 +53,7 @@ public class DriverPathSvg extends DriverShadowedG2d implements UDriver<SvgGraph
this.clipContainer = clipContainer; this.clipContainer = clipContainer;
} }
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) { public void draw(UPath shape, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) {
final UPath shape = (UPath) ushape;
final UClip clip = clipContainer.getClip(); final UClip clip = clipContainer.getClip();
if (clip != null && clip.isInside(x, y, shape) == false) { if (clip != null && clip.isInside(x, y, shape) == false) {
return; return;

View File

@ -37,14 +37,14 @@ package net.sourceforge.plantuml.ugraphic.svg;
import net.sourceforge.plantuml.svg.SvgGraphics; import net.sourceforge.plantuml.svg.SvgGraphics;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.UPixel;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorGradient; import net.sourceforge.plantuml.ugraphic.color.HColorGradient;
public class DriverPixelSvg implements UDriver<SvgGraphics> { public class DriverPixelSvg implements UDriver<UPixel, SvgGraphics> {
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) { public void draw(UPixel pixel, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) {
final HColor color = param.getColor(); final HColor color = param.getColor();
if (color instanceof HColorGradient) { if (color instanceof HColorGradient) {
final HColorGradient gr = (HColorGradient) color; final HColorGradient gr = (HColorGradient) color;

View File

@ -40,12 +40,11 @@ import net.sourceforge.plantuml.ugraphic.UClip;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UPolygon;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorGradient; import net.sourceforge.plantuml.ugraphic.color.HColorGradient;
public class DriverPolygonSvg implements UDriver<SvgGraphics> { public class DriverPolygonSvg implements UDriver<UPolygon, SvgGraphics> {
private final ClipContainer clipContainer; private final ClipContainer clipContainer;
@ -53,9 +52,7 @@ public class DriverPolygonSvg implements UDriver<SvgGraphics> {
this.clipContainer = clipContainer; this.clipContainer = clipContainer;
} }
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) { public void draw(UPolygon shape, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) {
final UPolygon shape = (UPolygon) ushape;
final double points[] = shape.getPointArray(x, y); final double points[] = shape.getPointArray(x, y);
assert points.length % 2 == 0; assert points.length % 2 == 0;
final UClip clip = clipContainer.getClip(); final UClip clip = clipContainer.getClip();

View File

@ -42,12 +42,11 @@ import net.sourceforge.plantuml.ugraphic.UClip;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.URectangle;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorGradient; import net.sourceforge.plantuml.ugraphic.color.HColorGradient;
public class DriverRectangleSvg implements UDriver<SvgGraphics> { public class DriverRectangleSvg implements UDriver<URectangle, SvgGraphics> {
private final ClipContainer clipContainer; private final ClipContainer clipContainer;
@ -55,9 +54,7 @@ public class DriverRectangleSvg implements UDriver<SvgGraphics> {
this.clipContainer = clipContainer; this.clipContainer = clipContainer;
} }
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) { public void draw(URectangle rect, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) {
final URectangle rect = (URectangle) ushape;
final double rx = rect.getRx(); final double rx = rect.getRx();
final double ry = rect.getRy(); final double ry = rect.getRy();
double width = rect.getWidth(); double width = rect.getWidth();

View File

@ -43,11 +43,10 @@ import net.sourceforge.plantuml.ugraphic.ClipContainer;
import net.sourceforge.plantuml.ugraphic.UClip; import net.sourceforge.plantuml.ugraphic.UClip;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.UText; import net.sourceforge.plantuml.ugraphic.UText;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverTextAsPathSvg implements UDriver<SvgGraphics> { public class DriverTextAsPathSvg implements UDriver<UText, SvgGraphics> {
private final ClipContainer clipContainer; private final ClipContainer clipContainer;
@ -55,14 +54,13 @@ public class DriverTextAsPathSvg implements UDriver<SvgGraphics> {
this.clipContainer = clipContainer; this.clipContainer = clipContainer;
} }
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) { public void draw(UText ushape, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) {
final UClip clip = clipContainer.getClip(); final UClip clip = clipContainer.getClip();
if (clip != null && clip.isInside(x, y) == false) { if (clip != null && clip.isInside(x, y) == false) {
return; return;
} }
final TextLayout t = createTextLayout((UText) ushape); final TextLayout t = createTextLayout(ushape);
svg.drawPathIterator(x, y, t.getOutline(null).getPathIterator(null)); svg.drawPathIterator(x, y, t.getOutline(null).getPathIterator(null));
} }

View File

@ -47,14 +47,13 @@ import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UFontContext; import net.sourceforge.plantuml.ugraphic.UFontContext;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.UText; import net.sourceforge.plantuml.ugraphic.UText;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorGradient; import net.sourceforge.plantuml.ugraphic.color.HColorGradient;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils; import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
public class DriverTextSvg implements UDriver<SvgGraphics> { public class DriverTextSvg implements UDriver<UText, SvgGraphics> {
private final StringBounder stringBounder; private final StringBounder stringBounder;
private final ClipContainer clipContainer; private final ClipContainer clipContainer;
@ -64,14 +63,12 @@ public class DriverTextSvg implements UDriver<SvgGraphics> {
this.clipContainer = clipContainer; this.clipContainer = clipContainer;
} }
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) { public void draw(UText shape, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) {
final UClip clip = clipContainer.getClip(); final UClip clip = clipContainer.getClip();
if (clip != null && clip.isInside(x, y) == false) { if (clip != null && clip.isInside(x, y) == false) {
return; return;
} }
final UText shape = (UText) ushape;
final FontConfiguration fontConfiguration = shape.getFontConfiguration(); final FontConfiguration fontConfiguration = shape.getFontConfiguration();
if (HColorUtils.isTransparent(fontConfiguration.getColor())) { if (HColorUtils.isTransparent(fontConfiguration.getColor())) {
return; return;

View File

@ -41,14 +41,12 @@ import net.sourceforge.plantuml.tikz.TikzGraphics;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
public class DriverAtomTextTikz implements UDriver<TikzGraphics> { public class DriverAtomTextTikz implements UDriver<AtomText, TikzGraphics> {
public void draw(UShape shape, double x, double y, ColorMapper mapper, UParam param, TikzGraphics tikz) { public void draw(AtomText text, double x, double y, ColorMapper mapper, UParam param, TikzGraphics tikz) {
final AtomText text = (AtomText) shape;
final FontConfiguration fontConfiguration = text.getFontConfiguration(); final FontConfiguration fontConfiguration = text.getFontConfiguration();
final UFont font = fontConfiguration.getFont(); final UFont font = fontConfiguration.getFont();
final HColor col = fontConfiguration.getColor(); final HColor col = fontConfiguration.getColor();
@ -57,7 +55,6 @@ public class DriverAtomTextTikz implements UDriver<TikzGraphics> {
final boolean italic = font.isItalic(); final boolean italic = font.isItalic();
final boolean bold = font.isBold(); final boolean bold = font.isBold();
tikz.text(x, y, text.getText(), underline, italic, bold); tikz.text(x, y, text.getText(), underline, italic, bold);
} }
} }

View File

@ -44,13 +44,11 @@ import net.sourceforge.plantuml.ugraphic.UCenteredCharacter;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverCenteredCharacterTikz implements UDriver<TikzGraphics> { public class DriverCenteredCharacterTikz implements UDriver<UCenteredCharacter, TikzGraphics> {
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, TikzGraphics tikz) { public void draw(UCenteredCharacter centeredCharacter, double x, double y, ColorMapper mapper, UParam param, TikzGraphics tikz) {
final UCenteredCharacter centeredCharacter = (UCenteredCharacter) ushape;
final char c = centeredCharacter.getChar(); final char c = centeredCharacter.getChar();
final UFont font = centeredCharacter.getFont(); final UFont font = centeredCharacter.getFont();
final UnusedSpace unusedSpace = UnusedSpace.getUnusedSpace(font, c); final UnusedSpace unusedSpace = UnusedSpace.getUnusedSpace(font, c);
@ -61,7 +59,6 @@ public class DriverCenteredCharacterTikz implements UDriver<TikzGraphics> {
final TextLayout t = createTextLayout(font, "" + c); final TextLayout t = createTextLayout(font, "" + c);
tikz.setStrokeColor(mapper.toColor(param.getColor())); tikz.setStrokeColor(mapper.toColor(param.getColor()));
tikz.drawPathIterator(xpos, ypos, t.getOutline(null).getPathIterator(null)); tikz.drawPathIterator(xpos, ypos, t.getOutline(null).getPathIterator(null));
} }
} }

View File

@ -38,18 +38,15 @@ import net.sourceforge.plantuml.tikz.TikzGraphics;
import net.sourceforge.plantuml.ugraphic.UCenteredCharacter; import net.sourceforge.plantuml.ugraphic.UCenteredCharacter;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverCenteredCharacterTikz2 implements UDriver<TikzGraphics> { public class DriverCenteredCharacterTikz2 implements UDriver<UCenteredCharacter, TikzGraphics> {
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, TikzGraphics tikz) { public void draw(UCenteredCharacter centeredCharacter, double x, double y, ColorMapper mapper, UParam param, TikzGraphics tikz) {
final UCenteredCharacter centeredCharacter = (UCenteredCharacter) ushape;
final char c = centeredCharacter.getChar(); final char c = centeredCharacter.getChar();
tikz.setStrokeColor(mapper.toColor(param.getColor())); tikz.setStrokeColor(mapper.toColor(param.getColor()));
tikz.drawSingleCharacter(x, y, c); tikz.drawSingleCharacter(x, y, c);
} }
} }

View File

@ -38,13 +38,11 @@ import net.sourceforge.plantuml.posimo.DotPath;
import net.sourceforge.plantuml.tikz.TikzGraphics; import net.sourceforge.plantuml.tikz.TikzGraphics;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverDotPathTikz implements UDriver<TikzGraphics> { public class DriverDotPathTikz implements UDriver<DotPath, TikzGraphics> {
public void draw(UShape shape, double x, double y, ColorMapper mapper, UParam param, TikzGraphics tikz) { public void draw(DotPath path, double x, double y, ColorMapper mapper, UParam param, TikzGraphics tikz) {
final DotPath path = (DotPath) shape;
tikz.setFillColor(null); tikz.setFillColor(null);
tikz.setStrokeColor(mapper.toColor(param.getColor())); tikz.setStrokeColor(mapper.toColor(param.getColor()));
tikz.setStrokeWidth(param.getStroke().getThickness(), param.getStroke().getDashTikz()); tikz.setStrokeWidth(param.getStroke().getThickness(), param.getStroke().getDashTikz());

View File

@ -38,13 +38,11 @@ import net.sourceforge.plantuml.tikz.TikzGraphics;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UEllipse;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverEllipseTikz implements UDriver<TikzGraphics> { public class DriverEllipseTikz implements UDriver<UEllipse, TikzGraphics> {
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, TikzGraphics tikz) { public void draw(UEllipse shape, double x, double y, ColorMapper mapper, UParam param, TikzGraphics tikz) {
final UEllipse shape = (UEllipse) ushape;
final double width = shape.getWidth(); final double width = shape.getWidth();
final double height = shape.getHeight(); final double height = shape.getHeight();

View File

@ -38,13 +38,11 @@ import net.sourceforge.plantuml.tikz.TikzGraphics;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UImage; import net.sourceforge.plantuml.ugraphic.UImage;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverImageTikz implements UDriver<TikzGraphics> { public class DriverImageTikz implements UDriver<UImage, TikzGraphics> {
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, TikzGraphics tikz) { public void draw(UImage shape, double x, double y, ColorMapper mapper, UParam param, TikzGraphics tikz) {
final UImage shape = (UImage) ushape;
final String rawFileName = shape.getRawFileName(); final String rawFileName = shape.getRawFileName();
if (rawFileName != null) { if (rawFileName != null) {
final String raw = "\\includegraphics{" + rawFileName + "}"; final String raw = "\\includegraphics{" + rawFileName + "}";

View File

@ -38,14 +38,11 @@ import net.sourceforge.plantuml.tikz.TikzGraphics;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.ULine;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverLineTikz implements UDriver<TikzGraphics> { public class DriverLineTikz implements UDriver<ULine, TikzGraphics> {
public void draw(UShape shape, double x, double y, ColorMapper mapper, UParam param, TikzGraphics tikz) {
final ULine line = (ULine) shape;
public void draw(ULine line, double x, double y, ColorMapper mapper, UParam param, TikzGraphics tikz) {
double x2 = x + line.getDX(); double x2 = x + line.getDX();
double y2 = y + line.getDY(); double y2 = y + line.getDY();
tikz.setStrokeColor(mapper.toColor(param.getColor())); tikz.setStrokeColor(mapper.toColor(param.getColor()));

View File

@ -1,48 +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.tikz;
import net.sourceforge.plantuml.tikz.TikzGraphics;
import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverNoneTikz implements UDriver<TikzGraphics> {
public void draw(UShape shape, double x, double y, ColorMapper mapper, UParam param, TikzGraphics object) {
}
}

View File

@ -40,15 +40,13 @@ import net.sourceforge.plantuml.tikz.TikzGraphics;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.UPath;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorGradient; import net.sourceforge.plantuml.ugraphic.color.HColorGradient;
public class DriverUPathTikz implements UDriver<TikzGraphics> { public class DriverPathTikz implements UDriver<UPath, TikzGraphics> {
public void draw(UShape shape, double x, double y, ColorMapper mapper, UParam param, TikzGraphics tikz) { public void draw(UPath path, double x, double y, ColorMapper mapper, UParam param, TikzGraphics tikz) {
final UPath path = (UPath) shape;
final HColor back = param.getBackcolor(); final HColor back = param.getBackcolor();
if (back instanceof HColorGradient) { if (back instanceof HColorGradient) {
final HColorGradient gr = (HColorGradient) back; final HColorGradient gr = (HColorGradient) back;

View File

@ -40,15 +40,13 @@ import net.sourceforge.plantuml.tikz.TikzGraphics;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UPolygon;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorGradient; import net.sourceforge.plantuml.ugraphic.color.HColorGradient;
public class DriverPolygonTikz implements UDriver<TikzGraphics> { public class DriverPolygonTikz implements UDriver<UPolygon, TikzGraphics> {
public void draw(UShape shape, double x, double y, ColorMapper mapper, UParam param, TikzGraphics tikz) { public void draw(UPolygon poly, double x, double y, ColorMapper mapper, UParam param, TikzGraphics tikz) {
final UPolygon poly = (UPolygon) shape;
final double points[] = poly.getPointArray(x, y); final double points[] = poly.getPointArray(x, y);
final HColor back = param.getBackcolor(); final HColor back = param.getBackcolor();

View File

@ -40,17 +40,14 @@ import net.sourceforge.plantuml.tikz.TikzGraphics;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.URectangle;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorGradient; import net.sourceforge.plantuml.ugraphic.color.HColorGradient;
import net.sourceforge.plantuml.utils.MathUtils; import net.sourceforge.plantuml.utils.MathUtils;
public class DriverRectangleTikz implements UDriver<TikzGraphics> { public class DriverRectangleTikz implements UDriver<URectangle, TikzGraphics> {
public void draw(UShape shape, double x, double y, ColorMapper mapper, UParam param, TikzGraphics tikz) {
final URectangle rect = (URectangle) shape;
public void draw(URectangle rect, double x, double y, ColorMapper mapper, UParam param, TikzGraphics tikz) {
final double width = rect.getWidth(); final double width = rect.getWidth();
final double height = rect.getHeight(); final double height = rect.getHeight();
final double r = MathUtils.min(rect.getRx(), rect.getRy(), width / 2, height / 2); final double r = MathUtils.min(rect.getRx(), rect.getRy(), width / 2, height / 2);

View File

@ -40,15 +40,13 @@ import net.sourceforge.plantuml.tikz.TikzGraphics;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.UText; import net.sourceforge.plantuml.ugraphic.UText;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
public class DriverUTextTikz implements UDriver<TikzGraphics> { public class DriverTextTikz implements UDriver<UText, TikzGraphics> {
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, TikzGraphics tikz) { public void draw(UText shape, double x, double y, ColorMapper mapper, UParam param, TikzGraphics tikz) {
final UText shape = (UText) ushape;
final FontConfiguration fontConfiguration = shape.getFontConfiguration(); final FontConfiguration fontConfiguration = shape.getFontConfiguration();
final UFont font = fontConfiguration.getFont(); final UFont font = fontConfiguration.getFont();
final HColor col = fontConfiguration.getColor(); final HColor col = fontConfiguration.getColor();

View File

@ -76,14 +76,14 @@ public class UGraphicTikz extends AbstractUGraphic<TikzGraphics> implements Clip
private void register() { private void register() {
registerDriver(URectangle.class, new DriverRectangleTikz()); registerDriver(URectangle.class, new DriverRectangleTikz());
registerDriver(UText.class, new DriverUTextTikz()); registerDriver(UText.class, new DriverTextTikz());
registerDriver(AtomText.class, new DriverAtomTextTikz()); registerDriver(AtomText.class, new DriverAtomTextTikz());
registerDriver(ULine.class, new DriverLineTikz()); registerDriver(ULine.class, new DriverLineTikz());
registerDriver(UPolygon.class, new DriverPolygonTikz()); registerDriver(UPolygon.class, new DriverPolygonTikz());
registerDriver(UEllipse.class, new DriverEllipseTikz()); registerDriver(UEllipse.class, new DriverEllipseTikz());
registerDriver(UImage.class, new DriverImageTikz()); registerDriver(UImage.class, new DriverImageTikz());
registerDriver(UImageSvg.class, new DriverNoneTikz()); ignoreShape(UImageSvg.class);
registerDriver(UPath.class, new DriverUPathTikz()); registerDriver(UPath.class, new DriverPathTikz());
registerDriver(DotPath.class, new DriverDotPathTikz()); registerDriver(DotPath.class, new DriverDotPathTikz());
// registerDriver(UCenteredCharacter.class, new DriverCenteredCharacterTikz()); // registerDriver(UCenteredCharacter.class, new DriverCenteredCharacterTikz());
registerDriver(UCenteredCharacter.class, new DriverCenteredCharacterTikz2()); registerDriver(UCenteredCharacter.class, new DriverCenteredCharacterTikz2());

View File

@ -37,13 +37,11 @@ package net.sourceforge.plantuml.ugraphic.visio;
import net.sourceforge.plantuml.posimo.DotPath; import net.sourceforge.plantuml.posimo.DotPath;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverDotPathVdx implements UDriver<VisioGraphics> { public class DriverDotPathVdx implements UDriver<DotPath, VisioGraphics> {
public void draw(UShape shape, double x, double y, ColorMapper mapper, UParam param, VisioGraphics visio) { public void draw(DotPath path, double x, double y, ColorMapper mapper, UParam param, VisioGraphics visio) {
final DotPath path = (DotPath) shape;
visio.upath(x, y, path.toUPath()); visio.upath(x, y, path.toUPath());
} }

View File

@ -37,19 +37,14 @@ package net.sourceforge.plantuml.ugraphic.visio;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.ULine;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverLineVdx implements UDriver<VisioGraphics> { public class DriverLineVdx implements UDriver<ULine, VisioGraphics> {
public void draw(UShape shape, double x, double y, ColorMapper mapper, UParam param, VisioGraphics visio) {
final ULine line = (ULine) shape;
public void draw(ULine line, double x, double y, ColorMapper mapper, UParam param, VisioGraphics visio) {
final double dx = line.getDX(); final double dx = line.getDX();
final double dy = line.getDY(); final double dy = line.getDY();
visio.line(x, y, x + dx, y + dy); visio.line(x, y, x + dx, y + dy);
} }
} }

View File

@ -1,47 +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.visio;
import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverNoneVdx implements UDriver<VisioGraphics> {
public void draw(UShape shape, double x, double y, ColorMapper mapper, UParam param, VisioGraphics object) {
}
}

View File

@ -37,16 +37,12 @@ package net.sourceforge.plantuml.ugraphic.visio;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.UPath;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverUPathVdx implements UDriver<VisioGraphics> { public class DriverPathVdx implements UDriver<UPath, VisioGraphics> {
public void draw(UShape shape, double x, double y, ColorMapper mapper, UParam param, VisioGraphics visio) {
final UPath path = (UPath) shape;
public void draw(UPath path, double x, double y, ColorMapper mapper, UParam param, VisioGraphics visio) {
visio.upath(x, y, path); visio.upath(x, y, path);
} }
} }

View File

@ -37,13 +37,11 @@ package net.sourceforge.plantuml.ugraphic.visio;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UPolygon;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverPolygonVdx implements UDriver<VisioGraphics> { public class DriverPolygonVdx implements UDriver<UPolygon, VisioGraphics> {
public void draw(UShape shape, double x, double y, ColorMapper mapper, UParam param, VisioGraphics visio) { public void draw(UPolygon poly, double x, double y, ColorMapper mapper, UParam param, VisioGraphics visio) {
final UPolygon poly = (UPolygon) shape;
visio.polygon(poly.translate(x, y)); visio.polygon(poly.translate(x, y));
} }

View File

@ -37,19 +37,14 @@ package net.sourceforge.plantuml.ugraphic.visio;
import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.URectangle;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverRectangleVdx implements UDriver<VisioGraphics> { public class DriverRectangleVdx implements UDriver<URectangle, VisioGraphics> {
public void draw(UShape shape, double x, double y, ColorMapper mapper, UParam param, VisioGraphics visio) {
final URectangle rect = (URectangle) shape;
public void draw(URectangle rect, double x, double y, ColorMapper mapper, UParam param, VisioGraphics visio) {
final double width = rect.getWidth(); final double width = rect.getWidth();
final double height = rect.getHeight(); final double height = rect.getHeight();
visio.rectangle(x, y, width, height); visio.rectangle(x, y, width, height);
} }
} }

View File

@ -43,11 +43,10 @@ import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UFontContext; import net.sourceforge.plantuml.ugraphic.UFontContext;
import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.UText; import net.sourceforge.plantuml.ugraphic.UText;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public class DriverTextVdx implements UDriver<VisioGraphics> { public class DriverTextVdx implements UDriver<UText, VisioGraphics> {
private final StringBounder stringBounder; private final StringBounder stringBounder;
@ -55,8 +54,7 @@ public class DriverTextVdx implements UDriver<VisioGraphics> {
this.stringBounder = stringBounder; this.stringBounder = stringBounder;
} }
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, VisioGraphics visio) { public void draw(UText shape, double x, double y, ColorMapper mapper, UParam param, VisioGraphics visio) {
final UText shape = (UText) ushape;
Thread.dumpStack(); Thread.dumpStack();
final FontConfiguration fontConfiguration = shape.getFontConfiguration(); final FontConfiguration fontConfiguration = shape.getFontConfiguration();

View File

@ -85,15 +85,15 @@ public class UGraphicVdx extends AbstractUGraphic<VisioGraphics> implements Clip
private void register() { private void register() {
registerDriver(URectangle.class, new DriverRectangleVdx()); registerDriver(URectangle.class, new DriverRectangleVdx());
registerDriver(UText.class, new DriverTextVdx(getStringBounder())); registerDriver(UText.class, new DriverTextVdx(getStringBounder()));
registerDriver(AtomText.class, new DriverNoneVdx()); ignoreShape(AtomText.class);
registerDriver(ULine.class, new DriverLineVdx()); registerDriver(ULine.class, new DriverLineVdx());
registerDriver(UPolygon.class, new DriverPolygonVdx()); registerDriver(UPolygon.class, new DriverPolygonVdx());
registerDriver(UEllipse.class, new DriverNoneVdx()); ignoreShape(UEllipse.class);
registerDriver(UImage.class, new DriverNoneVdx()); ignoreShape(UImage.class);
registerDriver(UImageSvg.class, new DriverNoneVdx()); ignoreShape(UImageSvg.class);
registerDriver(UPath.class, new DriverUPathVdx()); registerDriver(UPath.class, new DriverPathVdx());
registerDriver(DotPath.class, new DriverDotPathVdx()); registerDriver(DotPath.class, new DriverDotPathVdx());
registerDriver(UCenteredCharacter.class, new DriverNoneVdx()); ignoreShape(UCenteredCharacter.class);
} }
@Override @Override