mirror of
https://github.com/octoleo/plantuml.git
synced 2024-11-26 06:46:45 +00:00
Inject StringBounder into UGraphicBraille, UGraphicEps, UGraphicHtml5, UGraphicVdx. Also minor nearby tidying.
This commit is contained in:
parent
7141113050
commit
d6737bb6aa
@ -39,7 +39,7 @@ import static net.sourceforge.plantuml.ugraphic.ImageBuilder.plainPngBuilder;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import net.sourceforge.plantuml.FileFormat;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.posimo.DotPath;
|
||||
import net.sourceforge.plantuml.ugraphic.AbstractCommonUGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.AbstractUGraphic;
|
||||
@ -59,20 +59,19 @@ import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
public class UGraphicBraille extends AbstractUGraphic<BrailleGrid> implements ClipContainer {
|
||||
|
||||
public static final int QUANTA = 4;
|
||||
private final BrailleGrid grid;
|
||||
|
||||
@Override
|
||||
protected AbstractCommonUGraphic copyUGraphic() {
|
||||
return new UGraphicBraille(this);
|
||||
}
|
||||
|
||||
public UGraphicBraille(HColor defaultBackground, ColorMapper colorMapper) {
|
||||
this(defaultBackground, colorMapper, new BrailleGrid(QUANTA));
|
||||
public UGraphicBraille(HColor defaultBackground, ColorMapper colorMapper, StringBounder stringBounder) {
|
||||
super(defaultBackground, colorMapper, stringBounder, new BrailleGrid(QUANTA));
|
||||
register();
|
||||
}
|
||||
|
||||
private UGraphicBraille(UGraphicBraille other) {
|
||||
super(other);
|
||||
this.grid = other.grid;
|
||||
register();
|
||||
}
|
||||
|
||||
@ -96,12 +95,6 @@ public class UGraphicBraille extends AbstractUGraphic<BrailleGrid> implements Cl
|
||||
// svg.paintBackcolorGradient(mapper, gr);
|
||||
// }
|
||||
|
||||
private UGraphicBraille(HColor defaultBackground, ColorMapper colorMapper, BrailleGrid grid) {
|
||||
super(defaultBackground, colorMapper, FileFormat.BRAILLE_PNG.getDefaultStringBounder(), grid);
|
||||
this.grid = grid;
|
||||
register();
|
||||
}
|
||||
|
||||
private void register() {
|
||||
ignoreShape(URectangle.class);
|
||||
registerDriver(URectangle.class, new DriverRectangleBraille(this));
|
||||
|
@ -81,7 +81,7 @@ public class GraphicsSudoku {
|
||||
|
||||
public ImageData writeImageEps(OutputStream os) throws IOException {
|
||||
final UGraphicEps ug = new UGraphicEps(HColorUtils.WHITE, new ColorMapperIdentity(),
|
||||
EpsStrategy.WITH_MACRO_AND_TEXT);
|
||||
FileFormat.EPS_TEXT.getDefaultStringBounder(), EpsStrategy.WITH_MACRO_AND_TEXT);
|
||||
drawInternal(ug);
|
||||
os.write(ug.getEPSCode().getBytes());
|
||||
return ImageDataSimple.ok();
|
||||
|
@ -406,19 +406,19 @@ public class ImageBuilder {
|
||||
case SVG:
|
||||
return createUGraphicSVG(scaleFactor, dim);
|
||||
case EPS:
|
||||
return new UGraphicEps(backcolor, colorMapper, EpsStrategy.getDefault2());
|
||||
return new UGraphicEps(backcolor, colorMapper, stringBounder, EpsStrategy.getDefault2());
|
||||
case EPS_TEXT:
|
||||
return new UGraphicEps(backcolor, colorMapper, EpsStrategy.WITH_MACRO_AND_TEXT);
|
||||
return new UGraphicEps(backcolor, colorMapper, stringBounder, EpsStrategy.WITH_MACRO_AND_TEXT);
|
||||
case HTML5:
|
||||
return new UGraphicHtml5(backcolor, colorMapper);
|
||||
return new UGraphicHtml5(backcolor, colorMapper, stringBounder);
|
||||
case VDX:
|
||||
return new UGraphicVdx(backcolor, colorMapper);
|
||||
return new UGraphicVdx(backcolor, colorMapper, stringBounder);
|
||||
case LATEX:
|
||||
return new UGraphicTikz(backcolor, colorMapper, stringBounder, scaleFactor, true);
|
||||
case LATEX_NO_PREAMBLE:
|
||||
return new UGraphicTikz(backcolor, colorMapper, stringBounder, scaleFactor, false);
|
||||
case BRAILLE_PNG:
|
||||
return new UGraphicBraille(backcolor, colorMapper);
|
||||
return new UGraphicBraille(backcolor, colorMapper, stringBounder);
|
||||
case UTXT:
|
||||
case ATXT:
|
||||
return new UGraphicTxt();
|
||||
|
@ -41,6 +41,7 @@ import net.sourceforge.plantuml.FileFormat;
|
||||
import net.sourceforge.plantuml.Url;
|
||||
import net.sourceforge.plantuml.eps.EpsGraphics;
|
||||
import net.sourceforge.plantuml.eps.EpsStrategy;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||
import net.sourceforge.plantuml.posimo.DotPath;
|
||||
import net.sourceforge.plantuml.ugraphic.AbstractCommonUGraphic;
|
||||
@ -69,22 +70,18 @@ public class UGraphicEps extends AbstractUGraphic<EpsGraphics> implements ClipCo
|
||||
protected UGraphicEps(UGraphicEps other) {
|
||||
super(other);
|
||||
this.strategyTOBEREMOVED = other.strategyTOBEREMOVED;
|
||||
register(strategyTOBEREMOVED);
|
||||
register();
|
||||
}
|
||||
|
||||
public UGraphicEps(HColor defaultBackground, ColorMapper colorMapper, EpsStrategy strategy) {
|
||||
this(defaultBackground, colorMapper, strategy, strategy.creatEpsGraphics());
|
||||
}
|
||||
|
||||
private UGraphicEps(HColor defaultBackground, ColorMapper colorMapper, EpsStrategy strategy, EpsGraphics eps) {
|
||||
super(defaultBackground, colorMapper, FileFormat.PNG.getDefaultStringBounder(), eps);
|
||||
public UGraphicEps(HColor defaultBackground, ColorMapper colorMapper, StringBounder stringBounder, EpsStrategy strategy) {
|
||||
super(defaultBackground, colorMapper, stringBounder, strategy.creatEpsGraphics());
|
||||
this.strategyTOBEREMOVED = strategy;
|
||||
register(strategy);
|
||||
register();
|
||||
}
|
||||
|
||||
private void register(EpsStrategy strategy) {
|
||||
private void register() {
|
||||
registerDriver(URectangle.class, new DriverRectangleEps(this));
|
||||
registerDriver(UText.class, new DriverTextEps(this, strategy));
|
||||
registerDriver(UText.class, new DriverTextEps(this, strategyTOBEREMOVED));
|
||||
registerDriver(ULine.class, new DriverLineEps(this));
|
||||
registerDriver(UPolygon.class, new DriverPolygonEps(this));
|
||||
registerDriver(UEllipse.class, new DriverEllipseEps(this));
|
||||
@ -112,7 +109,7 @@ public class UGraphicEps extends AbstractUGraphic<EpsGraphics> implements ClipCo
|
||||
|
||||
static public String getEpsString(HColor defaultBackground, ColorMapper colorMapper, EpsStrategy epsStrategy,
|
||||
UDrawable udrawable) throws IOException {
|
||||
final UGraphicEps ug = new UGraphicEps(defaultBackground, colorMapper, epsStrategy);
|
||||
final UGraphicEps ug = new UGraphicEps(defaultBackground, colorMapper, FileFormat.EPS_TEXT.getDefaultStringBounder(), epsStrategy);
|
||||
udrawable.drawU(ug);
|
||||
return ug.getEPSCode();
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ package net.sourceforge.plantuml.ugraphic.html5;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import net.sourceforge.plantuml.FileFormat;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.ugraphic.AbstractCommonUGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.AbstractUGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.ClipContainer;
|
||||
@ -55,8 +55,8 @@ public class UGraphicHtml5 extends AbstractUGraphic<Html5Drawer> implements Clip
|
||||
return this;
|
||||
}
|
||||
|
||||
public UGraphicHtml5(HColor defaultBackground, ColorMapper colorMapper) {
|
||||
super(defaultBackground, colorMapper, FileFormat.PNG.getDefaultStringBounder(), new Html5Drawer());
|
||||
public UGraphicHtml5(HColor defaultBackground, ColorMapper colorMapper, StringBounder stringBounder) {
|
||||
super(defaultBackground, colorMapper, stringBounder, new Html5Drawer());
|
||||
registerDriver(URectangle.class, new DriverRectangleHtml5(this));
|
||||
// registerDriver(UText.class, new DriverTextEps(imDummy, this, strategy));
|
||||
ignoreShape(UText.class);
|
||||
|
@ -37,8 +37,8 @@ package net.sourceforge.plantuml.ugraphic.visio;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import net.sourceforge.plantuml.FileFormat;
|
||||
import net.sourceforge.plantuml.creole.legacy.AtomText;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.posimo.DotPath;
|
||||
import net.sourceforge.plantuml.ugraphic.AbstractCommonUGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.AbstractUGraphic;
|
||||
@ -61,15 +61,9 @@ public class UGraphicVdx extends AbstractUGraphic<VisioGraphics> implements Clip
|
||||
return 1;
|
||||
}
|
||||
|
||||
private UGraphicVdx(HColor defaultBackground, ColorMapper colorMapper, VisioGraphics visio) {
|
||||
super(defaultBackground, colorMapper, FileFormat.PNG.getDefaultStringBounder(), visio);
|
||||
public UGraphicVdx(HColor defaultBackground, ColorMapper colorMapper, StringBounder stringBounder) {
|
||||
super(defaultBackground, colorMapper, stringBounder, new VisioGraphics());
|
||||
register();
|
||||
|
||||
}
|
||||
|
||||
public UGraphicVdx(HColor defaultBackground, ColorMapper colorMapper) {
|
||||
this(defaultBackground, colorMapper, new VisioGraphics());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user