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:
commit
256d008215
@ -38,14 +38,11 @@ package net.sourceforge.plantuml.braille;
|
||||
import net.sourceforge.plantuml.ugraphic.UCenteredCharacter;
|
||||
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 DriverCenteredCharacterBraille implements UDriver<BrailleGrid> {
|
||||
|
||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, BrailleGrid grid) {
|
||||
final UCenteredCharacter characterCircled = (UCenteredCharacter) ushape;
|
||||
public class DriverCenteredCharacterBraille implements UDriver<UCenteredCharacter, BrailleGrid> {
|
||||
|
||||
public void draw(UCenteredCharacter characterCircled, double x, double y, ColorMapper mapper, UParam param, BrailleGrid grid) {
|
||||
final double xpos = x;
|
||||
final double ypos = y;
|
||||
|
||||
|
@ -38,14 +38,11 @@ package net.sourceforge.plantuml.braille;
|
||||
import net.sourceforge.plantuml.posimo.DotPath;
|
||||
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 DriverDotPathBraille implements UDriver<BrailleGrid> {
|
||||
|
||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, BrailleGrid grid) {
|
||||
final DotPath shape = (DotPath) ushape;
|
||||
public class DriverDotPathBraille implements UDriver<DotPath, BrailleGrid> {
|
||||
|
||||
public void draw(DotPath shape, double x, double y, ColorMapper mapper, UParam param, BrailleGrid grid) {
|
||||
if (param.getColor() != null) {
|
||||
grid.drawDotPath(x, y, shape);
|
||||
}
|
||||
|
@ -41,10 +41,9 @@ import net.sourceforge.plantuml.ugraphic.UClip;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.ULine;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
|
||||
|
||||
public class DriverLineBraille implements UDriver<BrailleGrid> {
|
||||
public class DriverLineBraille implements UDriver<ULine, BrailleGrid> {
|
||||
|
||||
private final ClipContainer clipContainer;
|
||||
|
||||
@ -52,9 +51,7 @@ public class DriverLineBraille implements UDriver<BrailleGrid> {
|
||||
this.clipContainer = clipContainer;
|
||||
}
|
||||
|
||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, BrailleGrid grid) {
|
||||
final ULine shape = (ULine) ushape;
|
||||
|
||||
public void draw(ULine shape , double x, double y, ColorMapper mapper, UParam param, BrailleGrid grid) {
|
||||
double x2 = x + shape.getDX();
|
||||
double y2 = y + shape.getDY();
|
||||
|
||||
|
@ -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) {
|
||||
}
|
||||
|
||||
}
|
@ -43,11 +43,10 @@ import net.sourceforge.plantuml.ugraphic.UClip;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.UPolygon;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
|
||||
|
||||
public class DriverPolygonBraille implements UDriver<BrailleGrid> {
|
||||
public class DriverPolygonBraille implements UDriver<UPolygon, BrailleGrid> {
|
||||
|
||||
private final ClipContainer clipContainer;
|
||||
|
||||
@ -55,9 +54,7 @@ public class DriverPolygonBraille implements UDriver<BrailleGrid> {
|
||||
this.clipContainer = clipContainer;
|
||||
}
|
||||
|
||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, BrailleGrid grid) {
|
||||
final UPolygon shape = (UPolygon) ushape;
|
||||
|
||||
public void draw(UPolygon shape, double x, double y, ColorMapper mapper, UParam param, BrailleGrid grid) {
|
||||
final List<Point2D> points = new ArrayList<>();
|
||||
int i = 0;
|
||||
|
||||
|
@ -41,10 +41,9 @@ import net.sourceforge.plantuml.ugraphic.UClip;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.URectangle;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
|
||||
|
||||
public class DriverRectangleBraille implements UDriver<BrailleGrid> {
|
||||
public class DriverRectangleBraille implements UDriver<URectangle, BrailleGrid> {
|
||||
|
||||
private final ClipContainer clipContainer;
|
||||
|
||||
@ -52,9 +51,7 @@ public class DriverRectangleBraille implements UDriver<BrailleGrid> {
|
||||
this.clipContainer = clipContainer;
|
||||
}
|
||||
|
||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, BrailleGrid grid) {
|
||||
final URectangle rect = (URectangle) ushape;
|
||||
|
||||
public void draw(URectangle rect, double x, double y, ColorMapper mapper, UParam param, BrailleGrid grid) {
|
||||
// final double rx = rect.getRx();
|
||||
// final double ry = rect.getRy();
|
||||
double width = rect.getWidth();
|
||||
|
@ -36,18 +36,15 @@ 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.UText;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
|
||||
|
||||
public class DriverTextBraille implements UDriver<BrailleGrid> {
|
||||
public class DriverTextBraille implements UDriver<UText, BrailleGrid> {
|
||||
|
||||
public DriverTextBraille() {
|
||||
}
|
||||
|
||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, BrailleGrid grid) {
|
||||
final UText text = (UText) ushape;
|
||||
|
||||
public void draw(UText text, double x, double y, ColorMapper mapper, UParam param, BrailleGrid grid) {
|
||||
y -= grid.getQuanta() * 3;
|
||||
x += grid.getQuanta();
|
||||
|
||||
|
@ -103,14 +103,14 @@ public class UGraphicBraille extends AbstractUGraphic<BrailleGrid> implements Cl
|
||||
}
|
||||
|
||||
private void register() {
|
||||
registerDriver(URectangle.class, new DriverNoneBraille());
|
||||
ignoreShape(URectangle.class);
|
||||
registerDriver(URectangle.class, new DriverRectangleBraille(this));
|
||||
registerDriver(UText.class, new DriverTextBraille());
|
||||
registerDriver(ULine.class, new DriverLineBraille(this));
|
||||
registerDriver(UPolygon.class, new DriverPolygonBraille(this));
|
||||
registerDriver(UEllipse.class, new DriverNoneBraille());
|
||||
registerDriver(UImage.class, new DriverNoneBraille());
|
||||
registerDriver(UPath.class, new DriverNoneBraille());
|
||||
ignoreShape(UEllipse.class);
|
||||
ignoreShape(UImage.class);
|
||||
ignoreShape(UPath.class);
|
||||
registerDriver(DotPath.class, new DriverDotPathBraille());
|
||||
registerDriver(UCenteredCharacter.class, new DriverCenteredCharacterBraille());
|
||||
}
|
||||
|
@ -48,7 +48,10 @@ public abstract class AbstractUGraphic<O> extends AbstractCommonUGraphic {
|
||||
|
||||
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) {
|
||||
super(Objects.requireNonNull(defaultBackground), colorMapper, stringBounder);
|
||||
@ -69,11 +72,22 @@ public abstract class AbstractUGraphic<O> extends AbstractCommonUGraphic {
|
||||
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);
|
||||
}
|
||||
|
||||
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) {
|
||||
((SpecialText) shape).getTitle().drawU(this);
|
||||
return;
|
||||
@ -85,7 +99,10 @@ public abstract class AbstractUGraphic<O> extends AbstractCommonUGraphic {
|
||||
drawComment((UComment) shape);
|
||||
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) {
|
||||
throw new UnsupportedOperationException(shape.getClass().toString() + " " + this.getClass());
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ package net.sourceforge.plantuml.ugraphic;
|
||||
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
|
||||
|
||||
public interface UDriver<O> {
|
||||
public void draw(UShape shape, double x, double y, ColorMapper mapper, UParam param, O object);
|
||||
public interface UDriver<SHAPE extends UShape, O> {
|
||||
public void draw(SHAPE shape, double x, double y, ColorMapper mapper, UParam param, O object);
|
||||
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ public interface UGraphic {
|
||||
|
||||
public UParam getParam();
|
||||
|
||||
public void draw(UShape shape);
|
||||
public <SHAPE extends UShape> void draw(SHAPE shape);
|
||||
|
||||
public UGraphic apply(UChange change);
|
||||
|
||||
|
@ -44,13 +44,11 @@ import net.sourceforge.plantuml.ugraphic.UCenteredCharacter;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
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) {
|
||||
final UCenteredCharacter centeredCharacter = (UCenteredCharacter) ushape;
|
||||
public void draw(UCenteredCharacter centeredCharacter, double x, double y, ColorMapper mapper, UParam param, EpsGraphics eps) {
|
||||
final char c = centeredCharacter.getChar();
|
||||
final UFont font = centeredCharacter.getFont();
|
||||
final UnusedSpace unusedSpace = UnusedSpace.getUnusedSpace(font, c);
|
||||
@ -61,7 +59,6 @@ public class DriverCenteredCharacterEps implements UDriver<EpsGraphics> {
|
||||
final TextLayout t = createTextLayout(font, "" + c);
|
||||
eps.setStrokeColor(mapper.toColor(param.getColor()));
|
||||
DriverTextEps.drawPathIterator(eps, xpos, ypos, t.getOutline(null));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -39,13 +39,11 @@ import net.sourceforge.plantuml.eps.EpsGraphics;
|
||||
import net.sourceforge.plantuml.posimo.DotPath;
|
||||
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 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) {
|
||||
final DotPath shape = (DotPath) ushape;
|
||||
public void draw(DotPath shape, double x, double y, ColorMapper mapper, UParam param, EpsGraphics eps) {
|
||||
//DriverLineG2d.manageStroke(param, g2d);
|
||||
|
||||
if (param.getColor() != null) {
|
||||
|
@ -40,10 +40,9 @@ import net.sourceforge.plantuml.ugraphic.UClip;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UEllipse;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
|
||||
|
||||
public class DriverEllipseEps implements UDriver<EpsGraphics> {
|
||||
public class DriverEllipseEps implements UDriver<UEllipse, EpsGraphics> {
|
||||
|
||||
private final ClipContainer clipContainer;
|
||||
|
||||
@ -51,8 +50,7 @@ public class DriverEllipseEps implements UDriver<EpsGraphics> {
|
||||
this.clipContainer = clipContainer;
|
||||
}
|
||||
|
||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, EpsGraphics eps) {
|
||||
final UEllipse shape = (UEllipse) ushape;
|
||||
public void draw(UEllipse shape, double x, double y, ColorMapper mapper, UParam param, EpsGraphics eps) {
|
||||
final double width = shape.getWidth();
|
||||
final double height = shape.getHeight();
|
||||
|
||||
|
@ -40,10 +40,9 @@ import net.sourceforge.plantuml.ugraphic.UClip;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UImage;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
|
||||
|
||||
public class DriverImageEps implements UDriver<EpsGraphics> {
|
||||
public class DriverImageEps implements UDriver<UImage, EpsGraphics> {
|
||||
|
||||
private final ClipContainer clipContainer;
|
||||
|
||||
@ -51,10 +50,7 @@ public class DriverImageEps implements UDriver<EpsGraphics> {
|
||||
this.clipContainer = clipContainer;
|
||||
}
|
||||
|
||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, EpsGraphics eps) {
|
||||
|
||||
final UImage shape = (UImage) ushape;
|
||||
|
||||
public void draw(UImage shape, double x, double y, ColorMapper mapper, UParam param, EpsGraphics eps) {
|
||||
final UClip clip = clipContainer.getClip();
|
||||
if (clip != null) {
|
||||
if (clip.isInside(x, y) == false) {
|
||||
|
@ -42,10 +42,9 @@ import net.sourceforge.plantuml.ugraphic.UClip;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.ULine;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
|
||||
|
||||
public class DriverLineEps implements UDriver<EpsGraphics> {
|
||||
public class DriverLineEps implements UDriver<ULine, EpsGraphics> {
|
||||
|
||||
private final ClipContainer clipContainer;
|
||||
|
||||
@ -53,9 +52,7 @@ public class DriverLineEps implements UDriver<EpsGraphics> {
|
||||
this.clipContainer = clipContainer;
|
||||
}
|
||||
|
||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, EpsGraphics eps) {
|
||||
final ULine shape = (ULine) ushape;
|
||||
|
||||
public void draw(ULine shape, double x, double y, ColorMapper mapper, UParam param, EpsGraphics eps) {
|
||||
double x2 = x + shape.getDX();
|
||||
double y2 = y + shape.getDY();
|
||||
|
||||
|
@ -38,14 +38,11 @@ import net.sourceforge.plantuml.eps.EpsGraphics;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.UPath;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
|
||||
|
||||
public class DriverPathEps implements UDriver<EpsGraphics> {
|
||||
|
||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, EpsGraphics eps) {
|
||||
final UPath shape = (UPath) ushape;
|
||||
public class DriverPathEps implements UDriver<UPath, EpsGraphics> {
|
||||
|
||||
public void draw(UPath shape, double x, double y, ColorMapper mapper, UParam param, EpsGraphics eps) {
|
||||
eps.setStrokeColor(mapper.toColor(param.getColor()));
|
||||
eps.setFillColor(mapper.toColor(param.getBackcolor()));
|
||||
eps.setStrokeWidth(param.getStroke().getThickness(), param.getStroke().getDashVisible(), param
|
||||
|
@ -42,12 +42,11 @@ import net.sourceforge.plantuml.ugraphic.UClip;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
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.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorGradient;
|
||||
|
||||
public class DriverPolygonEps implements UDriver<EpsGraphics> {
|
||||
public class DriverPolygonEps implements UDriver<UPolygon, EpsGraphics> {
|
||||
|
||||
private final ClipContainer clipContainer;
|
||||
|
||||
@ -55,9 +54,7 @@ public class DriverPolygonEps implements UDriver<EpsGraphics> {
|
||||
this.clipContainer = clipContainer;
|
||||
}
|
||||
|
||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, EpsGraphics eps) {
|
||||
final UPolygon shape = (UPolygon) ushape;
|
||||
|
||||
public void draw(UPolygon shape, double x, double y, ColorMapper mapper, UParam param, EpsGraphics eps) {
|
||||
final double points[] = new double[shape.getPoints().size() * 2];
|
||||
int i = 0;
|
||||
|
||||
|
@ -42,12 +42,11 @@ import net.sourceforge.plantuml.ugraphic.UClip;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
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.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorGradient;
|
||||
|
||||
public class DriverRectangleEps implements UDriver<EpsGraphics> {
|
||||
public class DriverRectangleEps implements UDriver<URectangle, EpsGraphics> {
|
||||
|
||||
private final ClipContainer clipContainer;
|
||||
|
||||
@ -55,9 +54,7 @@ public class DriverRectangleEps implements UDriver<EpsGraphics> {
|
||||
this.clipContainer = clipContainer;
|
||||
}
|
||||
|
||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, EpsGraphics eps) {
|
||||
final URectangle rect = (URectangle) ushape;
|
||||
|
||||
public void draw(URectangle rect, double x, double y, ColorMapper mapper, UParam param, EpsGraphics eps) {
|
||||
double width = rect.getWidth();
|
||||
double height = rect.getHeight();
|
||||
|
||||
@ -93,6 +90,5 @@ public class DriverRectangleEps implements UDriver<EpsGraphics> {
|
||||
.getStroke().getDashSpace());
|
||||
eps.epsRectangle(x, y, width, height, rx / 2, ry / 2);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -53,13 +53,12 @@ import net.sourceforge.plantuml.ugraphic.MinMax;
|
||||
import net.sourceforge.plantuml.ugraphic.UClip;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
import net.sourceforge.plantuml.ugraphic.UText;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
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 EpsStrategy strategy;
|
||||
@ -69,15 +68,12 @@ public class DriverTextEps implements UDriver<EpsGraphics> {
|
||||
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();
|
||||
if (clip != null && clip.isInside(x, y) == false) {
|
||||
return;
|
||||
}
|
||||
|
||||
final UText shape = (UText) ushape;
|
||||
|
||||
final FontConfiguration fontConfiguration = shape.getFontConfiguration();
|
||||
if (HColorUtils.isTransparent(fontConfiguration.getColor())) {
|
||||
return;
|
||||
|
@ -42,13 +42,11 @@ import net.sourceforge.plantuml.ugraphic.UCenteredCharacter;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
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) {
|
||||
final UCenteredCharacter characterCircled = (UCenteredCharacter) ushape;
|
||||
public void draw(UCenteredCharacter characterCircled, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) {
|
||||
final char c = characterCircled.getChar();
|
||||
final UFont font = characterCircled.getFont();
|
||||
final UnusedSpace unusedSpace = UnusedSpace.getUnusedSpace(font, c);
|
||||
|
@ -41,10 +41,9 @@ import net.sourceforge.plantuml.EnsureVisible;
|
||||
import net.sourceforge.plantuml.posimo.DotPath;
|
||||
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 DriverDotPathG2d implements UDriver<Graphics2D> {
|
||||
public class DriverDotPathG2d implements UDriver<DotPath, Graphics2D> {
|
||||
|
||||
private final EnsureVisible visible;
|
||||
|
||||
@ -52,8 +51,7 @@ public class DriverDotPathG2d implements UDriver<Graphics2D> {
|
||||
this.visible = visible;
|
||||
}
|
||||
|
||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) {
|
||||
final DotPath shape = (DotPath) ushape;
|
||||
public void draw(DotPath shape, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) {
|
||||
DriverLineG2d.manageStroke(param, g2d);
|
||||
|
||||
if (param.getColor() != null) {
|
||||
|
@ -46,12 +46,11 @@ import net.sourceforge.plantuml.EnsureVisible;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UEllipse;
|
||||
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.HColor;
|
||||
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 EnsureVisible visible;
|
||||
@ -61,8 +60,7 @@ public class DriverEllipseG2d extends DriverShadowedG2d implements UDriver<Graph
|
||||
this.visible = visible;
|
||||
}
|
||||
|
||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) {
|
||||
final UEllipse ellipse = (UEllipse) ushape;
|
||||
public void draw(UEllipse ellipse, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) {
|
||||
g2d.setStroke(new BasicStroke((float) param.getStroke().getThickness()));
|
||||
visible.ensureVisible(x, y);
|
||||
visible.ensureVisible(x + ellipse.getWidth(), y + ellipse.getHeight());
|
||||
|
@ -41,12 +41,10 @@ import java.awt.geom.AffineTransform;
|
||||
import net.sourceforge.plantuml.EnsureVisible;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UImage;
|
||||
import net.sourceforge.plantuml.ugraphic.UImageSvg;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
|
||||
|
||||
public class DriverImageG2d implements UDriver<Graphics2D> {
|
||||
public class DriverImageG2d implements UDriver<UImage, Graphics2D> {
|
||||
|
||||
private final EnsureVisible visible;
|
||||
|
||||
@ -57,11 +55,7 @@ public class DriverImageG2d implements UDriver<Graphics2D> {
|
||||
this.dpiFactor = dpiFactor;
|
||||
}
|
||||
|
||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) {
|
||||
if (ushape instanceof UImageSvg) {
|
||||
return;
|
||||
}
|
||||
final UImage shape = ((UImage) ushape);
|
||||
public void draw(UImage shape, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) {
|
||||
visible.ensureVisible(x, y);
|
||||
visible.ensureVisible(x + shape.getWidth(), y + shape.getHeight());
|
||||
if (dpiFactor == 1) {
|
||||
|
@ -43,12 +43,11 @@ import java.awt.geom.Line2D;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.ULine;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
|
||||
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;
|
||||
|
||||
@ -56,9 +55,7 @@ public class DriverLineG2d extends DriverShadowedG2d implements UDriver<Graphics
|
||||
this.dpiFactor = dpiFactor;
|
||||
}
|
||||
|
||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) {
|
||||
final ULine shape = (ULine) ushape;
|
||||
|
||||
public void draw(ULine shape, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) {
|
||||
final Shape line = new Line2D.Double(x, y, x + shape.getDX(), y + shape.getDY());
|
||||
manageStroke(param, g2d);
|
||||
// Shadow
|
||||
|
@ -44,14 +44,13 @@ import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.UPath;
|
||||
import net.sourceforge.plantuml.ugraphic.USegment;
|
||||
import net.sourceforge.plantuml.ugraphic.USegmentType;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
import net.sourceforge.plantuml.ugraphic.arc.ExtendedGeneralPath;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorGradient;
|
||||
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;
|
||||
|
||||
@ -59,8 +58,7 @@ public class DriverPathG2d extends DriverShadowedG2d implements UDriver<Graphics
|
||||
this.dpiFactor = dpiFactor;
|
||||
}
|
||||
|
||||
public void draw(UShape ushape, final double x, final double y, ColorMapper mapper, UParam param, Graphics2D g2d) {
|
||||
final UPath shape = (UPath) ushape;
|
||||
public void draw(UPath shape, final double x, final double y, ColorMapper mapper, UParam param, Graphics2D g2d) {
|
||||
DriverLineG2d.manageStroke(param, g2d);
|
||||
|
||||
final HColor back = param.getBackcolor();
|
||||
|
@ -39,12 +39,12 @@ import java.awt.Graphics2D;
|
||||
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
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;
|
||||
|
||||
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.fillRect((int) x, (int) y, 1, 1);
|
||||
}
|
||||
|
@ -45,13 +45,12 @@ import net.sourceforge.plantuml.EnsureVisible;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
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.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorGradient;
|
||||
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 EnsureVisible visible;
|
||||
@ -61,9 +60,7 @@ public class DriverPolygonG2d extends DriverShadowedG2d implements UDriver<Graph
|
||||
this.visible = visible;
|
||||
}
|
||||
|
||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) {
|
||||
final UPolygon shape = (UPolygon) ushape;
|
||||
|
||||
public void draw(UPolygon shape, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) {
|
||||
g2d.setStroke(new BasicStroke((float) param.getStroke().getThickness()));
|
||||
|
||||
final GeneralPath path = new GeneralPath();
|
||||
|
@ -50,7 +50,6 @@ import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.UPattern;
|
||||
import net.sourceforge.plantuml.ugraphic.URectangle;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
import net.sourceforge.plantuml.ugraphic.UShapeSized;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
|
||||
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.HColorUtils;
|
||||
|
||||
public class DriverRectangleG2d extends DriverShadowedG2d implements UDriver<Graphics2D> {
|
||||
public class DriverRectangleG2d extends DriverShadowedG2d implements UDriver<URectangle, Graphics2D> {
|
||||
|
||||
private final double dpiFactor;
|
||||
private final EnsureVisible visible;
|
||||
@ -68,9 +67,8 @@ public class DriverRectangleG2d extends DriverShadowedG2d implements UDriver<Gra
|
||||
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()));
|
||||
final URectangle rect = (URectangle) ushape;
|
||||
final double rx = rect.getRx();
|
||||
final double ry = rect.getRy();
|
||||
final Shape shape;
|
||||
|
@ -55,12 +55,11 @@ import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
import net.sourceforge.plantuml.ugraphic.UText;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
|
||||
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 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) {
|
||||
final UText shape = (UText) ushape;
|
||||
public void draw(UText shape, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) {
|
||||
final FontConfiguration fontConfiguration = shape.getFontConfiguration();
|
||||
|
||||
final UFont font = fontConfiguration.getFont();
|
||||
|
@ -56,14 +56,13 @@ import net.sourceforge.plantuml.text.StyledString;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
import net.sourceforge.plantuml.ugraphic.UText;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorGradient;
|
||||
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 StringBounder stringBounder;
|
||||
@ -73,8 +72,7 @@ public class DriverTextG2d implements UDriver<Graphics2D> {
|
||||
this.stringBounder = stringBounder;
|
||||
}
|
||||
|
||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) {
|
||||
final UText shape = (UText) ushape;
|
||||
public void draw(UText shape, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) {
|
||||
final FontConfiguration fontConfiguration = shape.getFontConfiguration();
|
||||
|
||||
if (HColorUtils.isTransparent(fontConfiguration.getColor())) {
|
||||
|
@ -148,7 +148,7 @@ public class UGraphicG2d extends AbstractUGraphic<Graphics2D> implements EnsureV
|
||||
registerDriver(UPixel.class, new DriverPixelG2d());
|
||||
registerDriver(UPolygon.class, new DriverPolygonG2d(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(DotPath.class, new DriverDotPathG2d(this));
|
||||
registerDriver(UPath.class, new DriverPathG2d(dpiFactor));
|
||||
|
@ -41,10 +41,9 @@ import net.sourceforge.plantuml.ugraphic.UClip;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.ULine;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
|
||||
|
||||
public class DriverLineHtml5 implements UDriver<Html5Drawer> {
|
||||
public class DriverLineHtml5 implements UDriver<ULine, Html5Drawer> {
|
||||
|
||||
private final ClipContainer clipContainer;
|
||||
|
||||
@ -52,9 +51,7 @@ public class DriverLineHtml5 implements UDriver<Html5Drawer> {
|
||||
this.clipContainer = clipContainer;
|
||||
}
|
||||
|
||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, Html5Drawer html) {
|
||||
final ULine shape = (ULine) ushape;
|
||||
|
||||
public void draw(ULine shape, double x, double y, ColorMapper mapper, UParam param, Html5Drawer html) {
|
||||
double x2 = x + shape.getDX();
|
||||
double y2 = y + shape.getDY();
|
||||
|
||||
|
@ -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) {
|
||||
}
|
||||
}
|
@ -41,12 +41,11 @@ import net.sourceforge.plantuml.ugraphic.UClip;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
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.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorGradient;
|
||||
|
||||
public class DriverRectangleHtml5 implements UDriver<Html5Drawer> {
|
||||
public class DriverRectangleHtml5 implements UDriver<URectangle, Html5Drawer> {
|
||||
|
||||
private final ClipContainer clipContainer;
|
||||
|
||||
@ -54,9 +53,7 @@ public class DriverRectangleHtml5 implements UDriver<Html5Drawer> {
|
||||
this.clipContainer = clipContainer;
|
||||
}
|
||||
|
||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, Html5Drawer html) {
|
||||
final URectangle rect = (URectangle) ushape;
|
||||
|
||||
public void draw(URectangle rect, double x, double y, ColorMapper mapper, UParam param, Html5Drawer html) {
|
||||
double width = rect.getWidth();
|
||||
double height = rect.getHeight();
|
||||
|
||||
@ -91,6 +88,5 @@ public class DriverRectangleHtml5 implements UDriver<Html5Drawer> {
|
||||
// .getStroke().getDashSpace());
|
||||
html.htmlRectangle(x, y, width, height, rx / 2, ry / 2);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -59,10 +59,10 @@ public class UGraphicHtml5 extends AbstractUGraphic<Html5Drawer> implements Clip
|
||||
super(defaultBackground, colorMapper, FileFormat.PNG.getDefaultStringBounder(), new Html5Drawer());
|
||||
registerDriver(URectangle.class, new DriverRectangleHtml5(this));
|
||||
// registerDriver(UText.class, new DriverTextEps(imDummy, this, strategy));
|
||||
registerDriver(UText.class, new DriverNopHtml5());
|
||||
ignoreShape(UText.class);
|
||||
registerDriver(ULine.class, new DriverLineHtml5(this));
|
||||
// registerDriver(UPolygon.class, new DriverPolygonEps(this));
|
||||
registerDriver(UPolygon.class, new DriverNopHtml5());
|
||||
ignoreShape(UPolygon.class);
|
||||
// registerDriver(UEllipse.class, new DriverEllipseEps());
|
||||
// registerDriver(UImage.class, new DriverImageEps());
|
||||
// registerDriver(UPath.class, new DriverPathEps());
|
||||
|
@ -44,13 +44,11 @@ import net.sourceforge.plantuml.ugraphic.UCenteredCharacter;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
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) {
|
||||
final UCenteredCharacter characterCircled = (UCenteredCharacter) ushape;
|
||||
public void draw(UCenteredCharacter characterCircled, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) {
|
||||
final char c = characterCircled.getChar();
|
||||
final UFont font = characterCircled.getFont();
|
||||
final UnusedSpace unusedSpace = UnusedSpace.getUnusedSpace(font, c);
|
||||
@ -61,6 +59,5 @@ public class DriverCenteredCharacterSvg implements UDriver<SvgGraphics> {
|
||||
final TextLayout t = createTextLayout(font, "" + c);
|
||||
svg.setFillColor(mapper.toRGB(param.getColor()));
|
||||
svg.drawPathIterator(xpos, ypos, t.getOutline(null).getPathIterator(null));
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -39,13 +39,11 @@ import net.sourceforge.plantuml.posimo.DotPath;
|
||||
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 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) {
|
||||
final DotPath shape = (DotPath) ushape;
|
||||
public void draw(DotPath shape, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) {
|
||||
// DriverLineG2d.manageStroke(param, g2d);
|
||||
|
||||
if (param.getColor() != null) {
|
||||
|
@ -40,13 +40,12 @@ import net.sourceforge.plantuml.ugraphic.UClip;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UEllipse;
|
||||
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.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorBackground;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorGradient;
|
||||
|
||||
public class DriverEllipseSvg implements UDriver<SvgGraphics> {
|
||||
public class DriverEllipseSvg implements UDriver<UEllipse, SvgGraphics> {
|
||||
|
||||
private final ClipContainer clipContainer;
|
||||
|
||||
@ -54,8 +53,7 @@ public class DriverEllipseSvg implements UDriver<SvgGraphics> {
|
||||
this.clipContainer = clipContainer;
|
||||
}
|
||||
|
||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) {
|
||||
final UEllipse shape = (UEllipse) ushape;
|
||||
public void draw(UEllipse shape, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) {
|
||||
final double width = shape.getWidth();
|
||||
final double height = shape.getHeight();
|
||||
|
||||
|
@ -43,10 +43,9 @@ import net.sourceforge.plantuml.ugraphic.UClip;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UImage;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
|
||||
|
||||
public class DriverImagePng implements UDriver<SvgGraphics> {
|
||||
public class DriverImagePng implements UDriver<UImage, SvgGraphics> {
|
||||
|
||||
private final ClipContainer clipContainer;
|
||||
|
||||
@ -54,9 +53,7 @@ public class DriverImagePng implements UDriver<SvgGraphics> {
|
||||
this.clipContainer = clipContainer;
|
||||
}
|
||||
|
||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) {
|
||||
|
||||
final UImage image = (UImage) ushape;
|
||||
public void draw(UImage image, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) {
|
||||
final UClip clip = clipContainer.getClip();
|
||||
if (clip != null) {
|
||||
if (clip.isInside(x, y) == false) {
|
||||
|
@ -38,13 +38,11 @@ import net.sourceforge.plantuml.svg.SvgGraphics;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UImageSvg;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
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) {
|
||||
final UImageSvg image = (UImageSvg) ushape;
|
||||
public void draw(UImageSvg image, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) {
|
||||
svg.svgImage(image, x, y);
|
||||
}
|
||||
}
|
||||
|
@ -42,12 +42,11 @@ import net.sourceforge.plantuml.ugraphic.UClip;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.ULine;
|
||||
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.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorGradient;
|
||||
|
||||
public class DriverLineSvg implements UDriver<SvgGraphics> {
|
||||
public class DriverLineSvg implements UDriver<ULine, SvgGraphics> {
|
||||
|
||||
private final ClipContainer clipContainer;
|
||||
|
||||
@ -55,9 +54,7 @@ public class DriverLineSvg implements UDriver<SvgGraphics> {
|
||||
this.clipContainer = clipContainer;
|
||||
}
|
||||
|
||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) {
|
||||
final ULine shape = (ULine) ushape;
|
||||
|
||||
public void draw(ULine shape, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) {
|
||||
double x2 = x + shape.getDX();
|
||||
double y2 = y + shape.getDY();
|
||||
|
||||
|
@ -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) {
|
||||
}
|
||||
|
||||
}
|
@ -40,13 +40,12 @@ import net.sourceforge.plantuml.ugraphic.UClip;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
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.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorGradient;
|
||||
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;
|
||||
|
||||
@ -54,9 +53,7 @@ public class DriverPathSvg extends DriverShadowedG2d implements UDriver<SvgGraph
|
||||
this.clipContainer = clipContainer;
|
||||
}
|
||||
|
||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) {
|
||||
final UPath shape = (UPath) ushape;
|
||||
|
||||
public void draw(UPath shape, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) {
|
||||
final UClip clip = clipContainer.getClip();
|
||||
if (clip != null && clip.isInside(x, y, shape) == false) {
|
||||
return;
|
||||
|
@ -37,14 +37,14 @@ 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.UPixel;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
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();
|
||||
if (color instanceof HColorGradient) {
|
||||
final HColorGradient gr = (HColorGradient) color;
|
||||
|
@ -40,12 +40,11 @@ import net.sourceforge.plantuml.ugraphic.UClip;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
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.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorGradient;
|
||||
|
||||
public class DriverPolygonSvg implements UDriver<SvgGraphics> {
|
||||
public class DriverPolygonSvg implements UDriver<UPolygon, SvgGraphics> {
|
||||
|
||||
private final ClipContainer clipContainer;
|
||||
|
||||
@ -53,9 +52,7 @@ public class DriverPolygonSvg implements UDriver<SvgGraphics> {
|
||||
this.clipContainer = clipContainer;
|
||||
}
|
||||
|
||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) {
|
||||
final UPolygon shape = (UPolygon) ushape;
|
||||
|
||||
public void draw(UPolygon shape, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) {
|
||||
final double points[] = shape.getPointArray(x, y);
|
||||
assert points.length % 2 == 0;
|
||||
final UClip clip = clipContainer.getClip();
|
||||
|
@ -42,12 +42,11 @@ import net.sourceforge.plantuml.ugraphic.UClip;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
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.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorGradient;
|
||||
|
||||
public class DriverRectangleSvg implements UDriver<SvgGraphics> {
|
||||
public class DriverRectangleSvg implements UDriver<URectangle, SvgGraphics> {
|
||||
|
||||
private final ClipContainer clipContainer;
|
||||
|
||||
@ -55,9 +54,7 @@ public class DriverRectangleSvg implements UDriver<SvgGraphics> {
|
||||
this.clipContainer = clipContainer;
|
||||
}
|
||||
|
||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) {
|
||||
final URectangle rect = (URectangle) ushape;
|
||||
|
||||
public void draw(URectangle rect, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) {
|
||||
final double rx = rect.getRx();
|
||||
final double ry = rect.getRy();
|
||||
double width = rect.getWidth();
|
||||
|
@ -43,11 +43,10 @@ import net.sourceforge.plantuml.ugraphic.ClipContainer;
|
||||
import net.sourceforge.plantuml.ugraphic.UClip;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
import net.sourceforge.plantuml.ugraphic.UText;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
|
||||
|
||||
public class DriverTextAsPathSvg implements UDriver<SvgGraphics> {
|
||||
public class DriverTextAsPathSvg implements UDriver<UText, SvgGraphics> {
|
||||
|
||||
private final ClipContainer clipContainer;
|
||||
|
||||
@ -55,14 +54,13 @@ public class DriverTextAsPathSvg implements UDriver<SvgGraphics> {
|
||||
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();
|
||||
if (clip != null && clip.isInside(x, y) == false) {
|
||||
return;
|
||||
}
|
||||
|
||||
final TextLayout t = createTextLayout((UText) ushape);
|
||||
final TextLayout t = createTextLayout(ushape);
|
||||
svg.drawPathIterator(x, y, t.getOutline(null).getPathIterator(null));
|
||||
}
|
||||
|
||||
|
@ -47,14 +47,13 @@ import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
import net.sourceforge.plantuml.ugraphic.UFontContext;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
import net.sourceforge.plantuml.ugraphic.UText;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorGradient;
|
||||
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 ClipContainer clipContainer;
|
||||
@ -64,14 +63,12 @@ public class DriverTextSvg implements UDriver<SvgGraphics> {
|
||||
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();
|
||||
if (clip != null && clip.isInside(x, y) == false) {
|
||||
return;
|
||||
}
|
||||
|
||||
final UText shape = (UText) ushape;
|
||||
final FontConfiguration fontConfiguration = shape.getFontConfiguration();
|
||||
if (HColorUtils.isTransparent(fontConfiguration.getColor())) {
|
||||
return;
|
||||
|
@ -41,14 +41,12 @@ import net.sourceforge.plantuml.tikz.TikzGraphics;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
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.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) {
|
||||
final AtomText text = (AtomText) shape;
|
||||
public void draw(AtomText text, double x, double y, ColorMapper mapper, UParam param, TikzGraphics tikz) {
|
||||
final FontConfiguration fontConfiguration = text.getFontConfiguration();
|
||||
final UFont font = fontConfiguration.getFont();
|
||||
final HColor col = fontConfiguration.getColor();
|
||||
@ -57,7 +55,6 @@ public class DriverAtomTextTikz implements UDriver<TikzGraphics> {
|
||||
final boolean italic = font.isItalic();
|
||||
final boolean bold = font.isBold();
|
||||
tikz.text(x, y, text.getText(), underline, italic, bold);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -44,13 +44,11 @@ import net.sourceforge.plantuml.ugraphic.UCenteredCharacter;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
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) {
|
||||
final UCenteredCharacter centeredCharacter = (UCenteredCharacter) ushape;
|
||||
public void draw(UCenteredCharacter centeredCharacter, double x, double y, ColorMapper mapper, UParam param, TikzGraphics tikz) {
|
||||
final char c = centeredCharacter.getChar();
|
||||
final UFont font = centeredCharacter.getFont();
|
||||
final UnusedSpace unusedSpace = UnusedSpace.getUnusedSpace(font, c);
|
||||
@ -61,7 +59,6 @@ public class DriverCenteredCharacterTikz implements UDriver<TikzGraphics> {
|
||||
final TextLayout t = createTextLayout(font, "" + c);
|
||||
tikz.setStrokeColor(mapper.toColor(param.getColor()));
|
||||
tikz.drawPathIterator(xpos, ypos, t.getOutline(null).getPathIterator(null));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -38,18 +38,15 @@ import net.sourceforge.plantuml.tikz.TikzGraphics;
|
||||
import net.sourceforge.plantuml.ugraphic.UCenteredCharacter;
|
||||
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 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) {
|
||||
final UCenteredCharacter centeredCharacter = (UCenteredCharacter) ushape;
|
||||
public void draw(UCenteredCharacter centeredCharacter, double x, double y, ColorMapper mapper, UParam param, TikzGraphics tikz) {
|
||||
final char c = centeredCharacter.getChar();
|
||||
|
||||
tikz.setStrokeColor(mapper.toColor(param.getColor()));
|
||||
tikz.drawSingleCharacter(x, y, c);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -38,13 +38,11 @@ import net.sourceforge.plantuml.posimo.DotPath;
|
||||
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 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) {
|
||||
final DotPath path = (DotPath) shape;
|
||||
public void draw(DotPath path, double x, double y, ColorMapper mapper, UParam param, TikzGraphics tikz) {
|
||||
tikz.setFillColor(null);
|
||||
tikz.setStrokeColor(mapper.toColor(param.getColor()));
|
||||
tikz.setStrokeWidth(param.getStroke().getThickness(), param.getStroke().getDashTikz());
|
||||
|
@ -38,13 +38,11 @@ import net.sourceforge.plantuml.tikz.TikzGraphics;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UEllipse;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
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) {
|
||||
final UEllipse shape = (UEllipse) ushape;
|
||||
public void draw(UEllipse shape, double x, double y, ColorMapper mapper, UParam param, TikzGraphics tikz) {
|
||||
final double width = shape.getWidth();
|
||||
final double height = shape.getHeight();
|
||||
|
||||
|
@ -38,13 +38,11 @@ import net.sourceforge.plantuml.tikz.TikzGraphics;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UImage;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
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) {
|
||||
final UImage shape = (UImage) ushape;
|
||||
public void draw(UImage shape, double x, double y, ColorMapper mapper, UParam param, TikzGraphics tikz) {
|
||||
final String rawFileName = shape.getRawFileName();
|
||||
if (rawFileName != null) {
|
||||
final String raw = "\\includegraphics{" + rawFileName + "}";
|
||||
|
@ -38,14 +38,11 @@ import net.sourceforge.plantuml.tikz.TikzGraphics;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.ULine;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
|
||||
|
||||
public class DriverLineTikz implements UDriver<TikzGraphics> {
|
||||
|
||||
public void draw(UShape shape, double x, double y, ColorMapper mapper, UParam param, TikzGraphics tikz) {
|
||||
final ULine line = (ULine) shape;
|
||||
public class DriverLineTikz implements UDriver<ULine, TikzGraphics> {
|
||||
|
||||
public void draw(ULine line, double x, double y, ColorMapper mapper, UParam param, TikzGraphics tikz) {
|
||||
double x2 = x + line.getDX();
|
||||
double y2 = y + line.getDY();
|
||||
tikz.setStrokeColor(mapper.toColor(param.getColor()));
|
||||
|
@ -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) {
|
||||
}
|
||||
|
||||
}
|
@ -40,15 +40,13 @@ import net.sourceforge.plantuml.tikz.TikzGraphics;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
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.HColor;
|
||||
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) {
|
||||
final UPath path = (UPath) shape;
|
||||
public void draw(UPath path, double x, double y, ColorMapper mapper, UParam param, TikzGraphics tikz) {
|
||||
final HColor back = param.getBackcolor();
|
||||
if (back instanceof HColorGradient) {
|
||||
final HColorGradient gr = (HColorGradient) back;
|
@ -40,15 +40,13 @@ import net.sourceforge.plantuml.tikz.TikzGraphics;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
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.HColor;
|
||||
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) {
|
||||
final UPolygon poly = (UPolygon) shape;
|
||||
public void draw(UPolygon poly, double x, double y, ColorMapper mapper, UParam param, TikzGraphics tikz) {
|
||||
final double points[] = poly.getPointArray(x, y);
|
||||
|
||||
final HColor back = param.getBackcolor();
|
||||
|
@ -40,17 +40,14 @@ import net.sourceforge.plantuml.tikz.TikzGraphics;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
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.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorGradient;
|
||||
import net.sourceforge.plantuml.utils.MathUtils;
|
||||
|
||||
public class DriverRectangleTikz implements UDriver<TikzGraphics> {
|
||||
|
||||
public void draw(UShape shape, double x, double y, ColorMapper mapper, UParam param, TikzGraphics tikz) {
|
||||
final URectangle rect = (URectangle) shape;
|
||||
public class DriverRectangleTikz implements UDriver<URectangle, TikzGraphics> {
|
||||
|
||||
public void draw(URectangle rect, double x, double y, ColorMapper mapper, UParam param, TikzGraphics tikz) {
|
||||
final double width = rect.getWidth();
|
||||
final double height = rect.getHeight();
|
||||
final double r = MathUtils.min(rect.getRx(), rect.getRy(), width / 2, height / 2);
|
||||
|
@ -40,15 +40,13 @@ import net.sourceforge.plantuml.tikz.TikzGraphics;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
import net.sourceforge.plantuml.ugraphic.UText;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
|
||||
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) {
|
||||
final UText shape = (UText) ushape;
|
||||
public void draw(UText shape, double x, double y, ColorMapper mapper, UParam param, TikzGraphics tikz) {
|
||||
final FontConfiguration fontConfiguration = shape.getFontConfiguration();
|
||||
final UFont font = fontConfiguration.getFont();
|
||||
final HColor col = fontConfiguration.getColor();
|
@ -76,14 +76,14 @@ public class UGraphicTikz extends AbstractUGraphic<TikzGraphics> implements Clip
|
||||
|
||||
private void register() {
|
||||
registerDriver(URectangle.class, new DriverRectangleTikz());
|
||||
registerDriver(UText.class, new DriverUTextTikz());
|
||||
registerDriver(UText.class, new DriverTextTikz());
|
||||
registerDriver(AtomText.class, new DriverAtomTextTikz());
|
||||
registerDriver(ULine.class, new DriverLineTikz());
|
||||
registerDriver(UPolygon.class, new DriverPolygonTikz());
|
||||
registerDriver(UEllipse.class, new DriverEllipseTikz());
|
||||
registerDriver(UImage.class, new DriverImageTikz());
|
||||
registerDriver(UImageSvg.class, new DriverNoneTikz());
|
||||
registerDriver(UPath.class, new DriverUPathTikz());
|
||||
ignoreShape(UImageSvg.class);
|
||||
registerDriver(UPath.class, new DriverPathTikz());
|
||||
registerDriver(DotPath.class, new DriverDotPathTikz());
|
||||
// registerDriver(UCenteredCharacter.class, new DriverCenteredCharacterTikz());
|
||||
registerDriver(UCenteredCharacter.class, new DriverCenteredCharacterTikz2());
|
||||
|
@ -37,13 +37,11 @@ package net.sourceforge.plantuml.ugraphic.visio;
|
||||
import net.sourceforge.plantuml.posimo.DotPath;
|
||||
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 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) {
|
||||
final DotPath path = (DotPath) shape;
|
||||
public void draw(DotPath path, double x, double y, ColorMapper mapper, UParam param, VisioGraphics visio) {
|
||||
visio.upath(x, y, path.toUPath());
|
||||
}
|
||||
|
||||
|
@ -37,19 +37,14 @@ package net.sourceforge.plantuml.ugraphic.visio;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.ULine;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
|
||||
|
||||
public class DriverLineVdx implements UDriver<VisioGraphics> {
|
||||
|
||||
public void draw(UShape shape, double x, double y, ColorMapper mapper, UParam param, VisioGraphics visio) {
|
||||
final ULine line = (ULine) shape;
|
||||
public class DriverLineVdx implements UDriver<ULine, VisioGraphics> {
|
||||
|
||||
public void draw(ULine line, double x, double y, ColorMapper mapper, UParam param, VisioGraphics visio) {
|
||||
final double dx = line.getDX();
|
||||
final double dy = line.getDY();
|
||||
|
||||
visio.line(x, y, x + dx, y + dy);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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) {
|
||||
}
|
||||
|
||||
}
|
@ -37,16 +37,12 @@ package net.sourceforge.plantuml.ugraphic.visio;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.UPath;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
|
||||
|
||||
public class DriverUPathVdx implements UDriver<VisioGraphics> {
|
||||
|
||||
public void draw(UShape shape, double x, double y, ColorMapper mapper, UParam param, VisioGraphics visio) {
|
||||
final UPath path = (UPath) shape;
|
||||
public class DriverPathVdx implements UDriver<UPath, VisioGraphics> {
|
||||
|
||||
public void draw(UPath path, double x, double y, ColorMapper mapper, UParam param, VisioGraphics visio) {
|
||||
visio.upath(x, y, path);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -37,13 +37,11 @@ package net.sourceforge.plantuml.ugraphic.visio;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.UPolygon;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
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) {
|
||||
final UPolygon poly = (UPolygon) shape;
|
||||
public void draw(UPolygon poly, double x, double y, ColorMapper mapper, UParam param, VisioGraphics visio) {
|
||||
visio.polygon(poly.translate(x, y));
|
||||
}
|
||||
|
||||
|
@ -37,19 +37,14 @@ package net.sourceforge.plantuml.ugraphic.visio;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.URectangle;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
|
||||
|
||||
public class DriverRectangleVdx implements UDriver<VisioGraphics> {
|
||||
|
||||
public void draw(UShape shape, double x, double y, ColorMapper mapper, UParam param, VisioGraphics visio) {
|
||||
final URectangle rect = (URectangle) shape;
|
||||
public class DriverRectangleVdx implements UDriver<URectangle, VisioGraphics> {
|
||||
|
||||
public void draw(URectangle rect, double x, double y, ColorMapper mapper, UParam param, VisioGraphics visio) {
|
||||
final double width = rect.getWidth();
|
||||
final double height = rect.getHeight();
|
||||
|
||||
visio.rectangle(x, y, width, height);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -43,11 +43,10 @@ import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
import net.sourceforge.plantuml.ugraphic.UFontContext;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
import net.sourceforge.plantuml.ugraphic.UText;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
|
||||
|
||||
public class DriverTextVdx implements UDriver<VisioGraphics> {
|
||||
public class DriverTextVdx implements UDriver<UText, VisioGraphics> {
|
||||
|
||||
private final StringBounder stringBounder;
|
||||
|
||||
@ -55,8 +54,7 @@ public class DriverTextVdx implements UDriver<VisioGraphics> {
|
||||
this.stringBounder = stringBounder;
|
||||
}
|
||||
|
||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, VisioGraphics visio) {
|
||||
final UText shape = (UText) ushape;
|
||||
public void draw(UText shape, double x, double y, ColorMapper mapper, UParam param, VisioGraphics visio) {
|
||||
Thread.dumpStack();
|
||||
|
||||
final FontConfiguration fontConfiguration = shape.getFontConfiguration();
|
||||
|
@ -85,15 +85,15 @@ public class UGraphicVdx extends AbstractUGraphic<VisioGraphics> implements Clip
|
||||
private void register() {
|
||||
registerDriver(URectangle.class, new DriverRectangleVdx());
|
||||
registerDriver(UText.class, new DriverTextVdx(getStringBounder()));
|
||||
registerDriver(AtomText.class, new DriverNoneVdx());
|
||||
ignoreShape(AtomText.class);
|
||||
registerDriver(ULine.class, new DriverLineVdx());
|
||||
registerDriver(UPolygon.class, new DriverPolygonVdx());
|
||||
registerDriver(UEllipse.class, new DriverNoneVdx());
|
||||
registerDriver(UImage.class, new DriverNoneVdx());
|
||||
registerDriver(UImageSvg.class, new DriverNoneVdx());
|
||||
registerDriver(UPath.class, new DriverUPathVdx());
|
||||
ignoreShape(UEllipse.class);
|
||||
ignoreShape(UImage.class);
|
||||
ignoreShape(UImageSvg.class);
|
||||
registerDriver(UPath.class, new DriverPathVdx());
|
||||
registerDriver(DotPath.class, new DriverDotPathVdx());
|
||||
registerDriver(UCenteredCharacter.class, new DriverNoneVdx());
|
||||
ignoreShape(UCenteredCharacter.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user