1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-27 23:36:35 +00:00

version 1.2020.7

This commit is contained in:
Arnaud Roques 2020-04-19 18:04:39 +02:00
parent f03afa2f96
commit 9077d971d7
372 changed files with 1727 additions and 1276 deletions

View File

@ -20,7 +20,7 @@
<target name="compile">
<delete dir="build" />
<mkdir dir="build" />
<javac target="1.6" srcdir="src" destdir="build" debug="on" />
<javac target="1.7" srcdir="src" destdir="build" debug="on" />
<copy file="src/net/sourceforge/plantuml/version/logo.png"
todir="build/net/sourceforge/plantuml/version" />
<copy file="src/net/sourceforge/plantuml/version/favicon.png"

View File

@ -35,7 +35,7 @@
<groupId>net.sourceforge.plantuml</groupId>
<artifactId>plantuml</artifactId>
<version>1.2020.5-SNAPSHOT</version>
<version>1.2020.8-SNAPSHOT</version>
<packaging>jar</packaging>
<name>PlantUML</name>
@ -133,8 +133,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<source>1.7</source>
<target>1.7</target>
<debug>false</debug>
</configuration>
</plugin>

View File

@ -154,26 +154,26 @@ public class FileUtils {
// http://forum.plantuml.net/9048/img-tag-for-sequence-diagram-participants-does-always-render
public synchronized static BufferedImage ImageIO_read(File f) {
public synchronized static BufferedImage readRasterImageFromFile(File f) {
// https://www.experts-exchange.com/questions/26171948/Why-are-ImageIO-read-images-losing-their-transparency.html
// https://stackoverflow.com/questions/18743790/can-java-load-images-with-transparency
try {
return readImage(new ImageIcon(f.getAbsolutePath()));
return readRasterImage(new ImageIcon(f.getAbsolutePath()));
} catch (Exception e) {
return null;
}
}
public synchronized static BufferedImage ImageIO_read(URL url) {
public synchronized static BufferedImage readRasterImageFromURL(URL url) {
try {
return readImage(new ImageIcon(url));
return readRasterImage(new ImageIcon(url));
} catch (Exception e) {
return null;
}
}
private synchronized static BufferedImage readImage(final ImageIcon imageIcon) {
private synchronized static BufferedImage readRasterImage(final ImageIcon imageIcon) {
final Image tmpImage = imageIcon.getImage();
final BufferedImage image = new BufferedImage(imageIcon.getIconWidth(), imageIcon.getIconHeight(),
BufferedImage.TYPE_INT_ARGB);

View File

@ -456,7 +456,7 @@ public class Option {
}
public final static String getPattern() {
return "(?i)^.*\\.(txt|tex|java|htm|html|c|h|cpp|apt|pu|pump|hpp|hh)$";
return "(?i)^.*\\.(txt|tex|java|htm|html|c|h|cpp|apt|pu|puml|hpp|hh)$";
}
public void setOutputDir(File f) {

View File

@ -47,14 +47,14 @@ import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
import ext.plantuml.com.ctreber.acearth.ACearth;
import ext.plantuml.com.ctreber.acearth.ConfigurationACearth;
import ext.plantuml.com.ctreber.acearth.plugins.markers.Marker;
import net.sourceforge.plantuml.AbstractPSystem;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.api.ImageDataSimple;
import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.ImageData;
import ext.plantuml.com.ctreber.acearth.ACearth;
import ext.plantuml.com.ctreber.acearth.ConfigurationACearth;
import ext.plantuml.com.ctreber.acearth.plugins.markers.Marker;
public class PSystemXearth extends AbstractPSystem {

View File

@ -40,11 +40,11 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import ext.plantuml.com.ctreber.acearth.plugins.markers.Marker;
import net.sourceforge.plantuml.command.PSystemBasicFactory;
import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.command.regex.MyPattern;
import net.sourceforge.plantuml.command.regex.Pattern2;
import ext.plantuml.com.ctreber.acearth.plugins.markers.Marker;
public class PSystemXearthFactory extends PSystemBasicFactory<PSystemXearth> {

View File

@ -40,7 +40,6 @@ import java.util.List;
import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.cucadiagram.Code;

View File

@ -436,11 +436,12 @@ public class ActivityDiagram3 extends UmlDiagram {
manageSwimlaneStrategy();
if (current() instanceof InstructionRepeat) {
final InstructionRepeat instructionRepeat = (InstructionRepeat) current();
// final LinkRendering back = new
// LinkRendering(linkColor).withDisplay(linkLabel);
instructionRepeat.setBackward(label, swinlanes.getCurrentSwimlane(), boxStyle);
// setCurrent(instructionRepeat.getParent());
// this.setNextLinkRendererInternal(LinkRendering.none());
return CommandExecutionResult.ok();
}
if (current() instanceof InstructionWhile) {
final InstructionWhile instructionWhile = (InstructionWhile) current();
instructionWhile.setBackward(label, swinlanes.getCurrentSwimlane(), boxStyle);
return CommandExecutionResult.ok();
}
return CommandExecutionResult.error("Cannot find repeat");

View File

@ -56,7 +56,6 @@ public class InstructionRepeat implements Instruction {
private final Swimlane swimlane;
private Swimlane swimlaneOut;
private BoxStyle boxStyle;
// private final HtmlColor color;
private boolean killed = false;
private final BoxStyle boxStyleIn;

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.activitydiagram3;
import java.util.Set;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileKilled;
@ -97,8 +98,10 @@ public class InstructionWhile extends WithNote implements Instruction, Instructi
}
public Ftile createFtile(FtileFactory factory) {
final Ftile back = Display.isNull(backward) ? null
: factory.activity(backward, swimlane, boxStyle, Colors.empty());
Ftile tmp = factory.decorateOut(repeatList.createFtile(factory), endInlinkRendering);
tmp = factory.createWhile(swimlane, tmp, test, yes, out, afterEndwhile, color, specialOut);
tmp = factory.createWhile(swimlane, tmp, test, yes, out, afterEndwhile, color, specialOut, back);
if (getPositionedNotes().size() > 0) {
tmp = FtileWithNoteOpale.create(tmp, getPositionedNotes(), skinParam, false);
}
@ -170,4 +173,14 @@ public class InstructionWhile extends WithNote implements Instruction, Instructi
return repeatList.containsBreak();
}
private BoxStyle boxStyle;
private Swimlane swimlaneOut;
private Display backward = Display.NULL;
public void setBackward(Display label, Swimlane swimlaneOut, BoxStyle boxStyle) {
this.backward = label;
this.swimlaneOut = swimlaneOut;
this.boxStyle = boxStyle;
}
}

View File

@ -43,8 +43,7 @@ import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.ugraphic.MinMax;
import net.sourceforge.plantuml.ugraphic.UChange;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UBackground;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.ULine;
import net.sourceforge.plantuml.ugraphic.UParam;
@ -65,9 +64,9 @@ public class CollisionDetector implements UGraphic {
return new CollisionDetector(stringBounder, translate.compose((UTranslate) change), this.context);
} else if (change instanceof UStroke) {
return new CollisionDetector(this);
} else if (change instanceof UChangeBackColor) {
} else if (change instanceof UBackground) {
return new CollisionDetector(this);
} else if (change instanceof UChangeColor) {
} else if (change instanceof HColor) {
return new CollisionDetector(this);
}
throw new UnsupportedOperationException();
@ -89,7 +88,7 @@ public class CollisionDetector implements UGraphic {
}
}
final HColor color = HColorUtils.BLACK;
ug = ug.apply(new UChangeColor(color)).apply(new UStroke(5));
ug = ug.apply(color).apply(new UStroke(5));
for (Snake snake : snakes) {
for (Line2D line : snake.getHorizontalLines()) {
if (collision(line)) {

View File

@ -82,7 +82,7 @@ public interface FtileFactory {
Ftile backward, boolean noOut);
public Ftile createWhile(Swimlane swimlane, Ftile whileBlock, Display test, Display yes, Display out,
LinkRendering afterEndwhile, HColor color, Instruction specialOut);
LinkRendering afterEndwhile, HColor color, Instruction specialOut, Ftile backward);
public Ftile createIf(Swimlane swimlane, List<Branch> thens, Branch elseBranch, LinkRendering afterEndwhile,
LinkRendering topInlinkRendering, Url url);

View File

@ -180,15 +180,15 @@ public class FtileFactoryDelegator implements FtileFactory {
}
public Ftile repeat(BoxStyle boxStyleIn, Swimlane swimlane, Swimlane swimlaneOut, Display startLabel, Ftile repeat,
Display test, Display yes, Display out, Colors colors, LinkRendering backRepeatLinkRendering, Ftile backward,
boolean noOut) {
Display test, Display yes, Display out, Colors colors, LinkRendering backRepeatLinkRendering,
Ftile backward, boolean noOut) {
return factory.repeat(boxStyleIn, swimlane, swimlaneOut, startLabel, repeat, test, yes, out, colors,
backRepeatLinkRendering, backward, noOut);
}
public Ftile createWhile(Swimlane swimlane, Ftile whileBlock, Display test, Display yes, Display out,
LinkRendering afterEndwhile, HColor color, Instruction specialOut) {
return factory.createWhile(swimlane, whileBlock, test, yes, out, afterEndwhile, color, specialOut);
LinkRendering afterEndwhile, HColor color, Instruction specialOut, Ftile back) {
return factory.createWhile(swimlane, whileBlock, test, yes, out, afterEndwhile, color, specialOut, back);
}
public Ftile createIf(Swimlane swimlane, List<Branch> thens, Branch elseBranch, LinkRendering afterEndwhile,

View File

@ -49,7 +49,6 @@ import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UEmpty;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.ULine;
@ -91,7 +90,7 @@ public class LaneDivider extends AbstractTextBlock {
public void drawU(UGraphic ug) {
// final UShape back = new URectangle(x1 + x2, height).ignoreForCompressionOnY();
// ug.apply(new UChangeColor(HColorUtils.BLUE)).draw(back);
// ug.apply(UChangeColor.nnn(HColorUtils.BLUE)).draw(back);
final UShape back = new UEmpty(x1 + x2, 1);
ug.draw(back);
@ -104,7 +103,7 @@ public class LaneDivider extends AbstractTextBlock {
color = getStyle().value(PName.LineColor).asColor(skinParam.getIHtmlColorSet());
thickness = getStyle().getStroke();
}
ug.apply(UTranslate.dx(x1)).apply(thickness).apply(new UChangeColor(color)).draw(ULine.vline(height));
ug.apply(UTranslate.dx(x1)).apply(thickness).apply(color).draw(ULine.vline(height));
}

View File

@ -70,8 +70,6 @@ import net.sourceforge.plantuml.svek.UGraphicForSnake;
import net.sourceforge.plantuml.ugraphic.LimitFinder;
import net.sourceforge.plantuml.ugraphic.MinMax;
import net.sourceforge.plantuml.ugraphic.UChange;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.URectangle;
import net.sourceforge.plantuml.ugraphic.UShape;
@ -211,8 +209,7 @@ public class SwimlanesA extends AbstractTextBlock implements ISwimlanesA, TextBl
}
static private void printDebug(UGraphic ug, SlotSet slot, HColor col, TextBlock full) {
slot.drawDebugX(ug.apply(new UChangeColor(col)).apply(new UChangeBackColor(col)),
full.calculateDimension(ug.getStringBounder()).getHeight());
slot.drawDebugX(ug.apply(col).apply(col.bg()), full.calculateDimension(ug.getStringBounder()).getHeight());
}
@ -224,12 +221,12 @@ public class SwimlanesA extends AbstractTextBlock implements ISwimlanesA, TextBl
for (Swimlane swimlane : swimlanes) {
final HColor back = swimlane.getColors(skinParam).getColor(ColorType.BACK);
if (back != null) {
UGraphic background = ug.apply(new UChangeBackColor(back)).apply(new UChangeColor(back));
UGraphic background = ug.apply(back.bg()).apply(back);
background = background.apply(UTranslate.dx(x2));
drawBackColor(background, swimlane, dimensionFull);
}
full.drawU(new UGraphicInterceptorOneSwimlane(ug, swimlane).apply(swimlane.getTranslate())
full.drawU(new UGraphicInterceptorOneSwimlane(ug, swimlane, swimlanes).apply(swimlane.getTranslate())
.apply(getTitleHeightTranslate(stringBounder)));
x2 += swimlane.getActualWidth();
@ -242,7 +239,8 @@ public class SwimlanesA extends AbstractTextBlock implements ISwimlanesA, TextBl
protected void drawBackColor(UGraphic ug, Swimlane swimlane, Dimension2D dimensionFull) {
final StringBounder stringBounder = ug.getStringBounder();
final double height = dimensionFull.getHeight() + getTitleHeightTranslate(stringBounder).getDy();
final URectangle rectangle = new URectangle(swimlane.getActualWidth(), height).ignoreForCompressionOnX().ignoreForCompressionOnY();
final URectangle rectangle = new URectangle(swimlane.getActualWidth(), height).ignoreForCompressionOnX()
.ignoreForCompressionOnY();
ug.draw(rectangle);
}
@ -255,7 +253,7 @@ public class SwimlanesA extends AbstractTextBlock implements ISwimlanesA, TextBl
for (Swimlane swimlane : swimlanes) {
final LimitFinder limitFinder = new LimitFinder(stringBounder, false);
final UGraphicInterceptorOneSwimlane interceptor = new UGraphicInterceptorOneSwimlane(
new UGraphicForSnake(limitFinder), swimlane);
new UGraphicForSnake(limitFinder), swimlane, swimlanes);
full.drawU(interceptor);
interceptor.flushUg();
final MinMax minMax = limitFinder.getMinMax();

View File

@ -78,8 +78,6 @@ import net.sourceforge.plantuml.svek.UGraphicForSnake;
import net.sourceforge.plantuml.ugraphic.LimitFinder;
import net.sourceforge.plantuml.ugraphic.MinMax;
import net.sourceforge.plantuml.ugraphic.UChange;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.URectangle;
import net.sourceforge.plantuml.ugraphic.UShape;
@ -279,14 +277,14 @@ public class SwimlanesAAA extends AbstractTextBlock implements ISwimlanesA, Text
final HColor back = swimlane.getColors(skinParam).getColor(ColorType.BACK);
if (back != null) {
final LaneDivider divider2 = dividers.get(i + 1);
final UGraphic background = ug.apply(new UChangeBackColor(back)).apply(new UChangeColor(back))
final UGraphic background = ug.apply(back.bg()).apply(back)
.apply(UTranslate.dx(xpos - divider1.getX2()));
final double width = swimlane.getActualWidth() + divider1.getX2() + divider2.getX1();
final double height = dimensionFull.getHeight() + titleHeightTranslate.getDy();
background.draw(new URectangle(width, height).ignoreForCompressionOnX().ignoreForCompressionOnY());
}
full.drawU(new UGraphicInterceptorOneSwimlane(ug, swimlane).apply(swimlane.getTranslate())
full.drawU(new UGraphicInterceptorOneSwimlane(ug, swimlane, swimlanes()).apply(swimlane.getTranslate())
.apply(getTitleHeightTranslate(stringBounder)));
final double dividerWith = divider1.calculateDimension(stringBounder).getWidth();
@ -312,7 +310,7 @@ public class SwimlanesAAA extends AbstractTextBlock implements ISwimlanesA, Text
double fullWidth = swimlanesSpecial().get(swimlanesSpecial().size() - 1).getTranslate().getDx() - 2 * 5 - 1;
final URectangle back = new URectangle(fullWidth, titleHeight).ignoreForCompressionOnX()
.ignoreForCompressionOnY();
ug.apply(UTranslate.dx(5)).apply(new UChangeBackColor(color)).apply(new UChangeColor(color)).draw(back);
ug.apply(UTranslate.dx(5)).apply(color.bg()).apply(color).draw(back);
}
}
@ -330,7 +328,7 @@ public class SwimlanesAAA extends AbstractTextBlock implements ISwimlanesA, Text
for (Swimlane swimlane : swimlanes()) {
final LimitFinder limitFinder = new LimitFinder(stringBounder, false);
final UGraphicInterceptorOneSwimlane interceptor = new UGraphicInterceptorOneSwimlane(
new UGraphicForSnake(limitFinder), swimlane);
new UGraphicForSnake(limitFinder), swimlane, swimlanes());
full.drawU(interceptor);
interceptor.flushUg();
final MinMax minMax = limitFinder.getMinMax();

View File

@ -46,8 +46,6 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.URectangle;
import net.sourceforge.plantuml.ugraphic.UTranslate;
@ -74,7 +72,7 @@ public class SwimlanesB extends SwimlanesA {
if (color != null) {
final double titleHeight = getTitlesHeight(stringBounder);
final URectangle back = new URectangle(getTitlesWidth(stringBounder), titleHeight).ignoreForCompressionOnX().ignoreForCompressionOnY();
ug.apply(new UChangeBackColor(color)).apply(new UChangeColor(color)).draw(back);
ug.apply(color.bg()).apply(color).draw(back);
}
for (Swimlane swimlane : swimlanes) {
final TextBlock swTitle = getTitle(swimlane);

View File

@ -46,7 +46,6 @@ import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.ULine;
import net.sourceforge.plantuml.ugraphic.UStroke;
@ -89,6 +88,6 @@ public class SwimlanesC extends SwimlanesB {
color = getStyle().value(PName.LineColor).asColor(skinParam.getIHtmlColorSet());
thickness = getStyle().getStroke();
}
ug.apply(thickness).apply(new UChangeColor(color)).draw(ULine.vline(height));
ug.apply(thickness).apply(color).draw(ULine.vline(height));
}
}

View File

@ -42,8 +42,6 @@ import net.sourceforge.plantuml.graphic.UDrawable;
import net.sourceforge.plantuml.graphic.UGraphicDelegator;
import net.sourceforge.plantuml.svek.UGraphicForSnake;
import net.sourceforge.plantuml.ugraphic.UChange;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UEllipse;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.ULine;
@ -89,8 +87,8 @@ public class UGraphicInterceptorUDrawable2 extends UGraphicDelegator {
private void drawGoto(FtileGoto ftile) {
final FtileGeometry geom = ftile.calculateDimension(getStringBounder());
final Point2D pt = geom.getPointIn();
UGraphic ugGoto = getUg().apply(new UChangeColor(HColorUtils.GREEN)).apply(
new UChangeBackColor(HColorUtils.GREEN));
UGraphic ugGoto = getUg().apply(HColorUtils.GREEN).apply(
HColorUtils.GREEN.bg());
ugGoto = ugGoto.apply(new UTranslate(pt));
final UTranslate posNow = getPosition();
final UTranslate dest = positions.get(ftile.getName());

View File

@ -47,8 +47,6 @@ import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.cucadiagram.LinkStyle;
import net.sourceforge.plantuml.graphic.HtmlColorAndStyle;
import net.sourceforge.plantuml.ugraphic.MinMax;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.ULine;
import net.sourceforge.plantuml.ugraphic.UPolygon;
@ -81,8 +79,8 @@ public class Worm implements Iterable<Point2D.Double> {
if (style.isInvisible()) {
return;
}
ug = ug.apply(new UChangeColor(color2));
ug = ug.apply(new UChangeBackColor(color2));
ug = ug.apply(color2);
ug = ug.apply(color2.bg());
if (style.isNormal()) {
ug = ug.apply(new UStroke(stroke));
} else {

View File

@ -39,8 +39,6 @@ import java.util.ArrayList;
import java.util.List;
import net.sourceforge.plantuml.ugraphic.MinMax;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
@ -55,7 +53,7 @@ public class Zad {
}
public void drawDebug(UGraphic ug) {
ug = ug.apply(new UChangeBackColor(HColorUtils.BLUE)).apply(new UChangeColor(HColorUtils.RED_LIGHT));
ug = ug.apply(HColorUtils.BLUE.bg()).apply(HColorUtils.RED_LIGHT);
for (MinMax minMax : rectangles) {
System.err.println("minmax=" + minMax);
minMax.drawGrey(ug);

View File

@ -39,8 +39,7 @@ import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.ugraphic.MinMax;
import net.sourceforge.plantuml.ugraphic.UChange;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UBackground;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UParamNull;
@ -49,6 +48,7 @@ import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor;
public class ZadBuilder implements UGraphic {
@ -57,9 +57,9 @@ public class ZadBuilder implements UGraphic {
return new ZadBuilder(stringBounder, translate.compose((UTranslate) change), this.context);
} else if (change instanceof UStroke) {
return new ZadBuilder(this);
} else if (change instanceof UChangeBackColor) {
} else if (change instanceof UBackground) {
return new ZadBuilder(this);
} else if (change instanceof UChangeColor) {
} else if (change instanceof HColor) {
return new ZadBuilder(this);
}
throw new UnsupportedOperationException();

View File

@ -72,7 +72,7 @@ public class FtileFactoryDelegatorWhile extends FtileFactoryDelegator {
@Override
public Ftile createWhile(Swimlane swimlane, Ftile whileBlock, Display test, Display yes, Display out,
LinkRendering afterEndwhile, HColor color, Instruction specialOut) {
LinkRendering afterEndwhile, HColor color, Instruction specialOut, Ftile backward) {
final HColor borderColor;
final HColor backColor;
@ -83,10 +83,10 @@ public class FtileFactoryDelegatorWhile extends FtileFactoryDelegator {
final FontParam testParam = conditionStyle == ConditionStyle.INSIDE ? FontParam.ACTIVITY_DIAMOND
: FontParam.ARROW;
if (SkinParam.USE_STYLES()) {
final Style styleArrow = getDefaultStyleDefinitionArrow().getMergedStyle(
skinParam().getCurrentStyleBuilder());
final Style styleDiamond = getDefaultStyleDefinitionDiamond().getMergedStyle(
skinParam().getCurrentStyleBuilder());
final Style styleArrow = getDefaultStyleDefinitionArrow()
.getMergedStyle(skinParam().getCurrentStyleBuilder());
final Style styleDiamond = getDefaultStyleDefinitionDiamond()
.getMergedStyle(skinParam().getCurrentStyleBuilder());
borderColor = styleDiamond.value(PName.LineColor).asColor(skinParam().getIHtmlColorSet());
backColor = styleDiamond.value(PName.BackGroundColor).asColor(skinParam().getIHtmlColorSet());
arrowColor = Rainbow.build(styleArrow, skinParam().getIHtmlColorSet());
@ -102,11 +102,12 @@ public class FtileFactoryDelegatorWhile extends FtileFactoryDelegator {
}
final LinkRendering endInlinkRendering = whileBlock.getOutLinkRendering();
final Rainbow endInlinkColor = endInlinkRendering == null || endInlinkRendering.getRainbow().size() == 0 ? arrowColor
final Rainbow endInlinkColor = endInlinkRendering == null || endInlinkRendering.getRainbow().size() == 0
? arrowColor
: endInlinkRendering.getRainbow();
Ftile result = FtileWhile.create(swimlane, whileBlock, test, borderColor, backColor, arrowColor, yes, out,
endInlinkColor, afterEndwhile, fontArrow, getFactory(), conditionStyle, fcTest, specialOut);
endInlinkColor, afterEndwhile, fontArrow, getFactory(), conditionStyle, fcTest, specialOut, backward);
final List<WeldingPoint> weldingPoints = whileBlock.getWeldingPoints();
if (weldingPoints.size() > 0) {
@ -120,8 +121,8 @@ public class FtileFactoryDelegatorWhile extends FtileFactoryDelegator {
public void drawU(UGraphic ug) {
final UTranslate tr1 = genealogy.getTranslate(ftileBreak, ug.getStringBounder());
final Snake snake = new Snake(getFtile1().arrowHorizontalAlignment(), arrowColor, Arrows
.asToLeft());
final Snake snake = new Snake(getFtile1().arrowHorizontalAlignment(), arrowColor,
Arrows.asToLeft());
snake.addPoint(tr1.getDx(), tr1.getDy());
snake.addPoint(Diamond.diamondHalfSize, tr1.getDy());
ug.draw(snake);

View File

@ -37,6 +37,7 @@ package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact;
import java.awt.geom.Dimension2D;
import java.awt.geom.Point2D;
import java.nio.channels.IllegalSelectorException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@ -187,7 +188,8 @@ class FtileIfLongHorizontal extends AbstractFtile {
diamonds = alignDiamonds(diamonds, ftileFactory.getStringBounder());
final FtileIfLongHorizontal result = new FtileIfLongHorizontal(diamonds, inlabelSizes, tiles, tile2, arrowColor);
final FtileIfLongHorizontal result = new FtileIfLongHorizontal(diamonds, inlabelSizes, tiles, tile2,
arrowColor);
final List<Connection> conns = new ArrayList<Connection>();
int nbOut = 0;
@ -205,8 +207,8 @@ class FtileIfLongHorizontal extends AbstractFtile {
final Rainbow rainbowOut = branch.getInlinkRenderingColorAndStyle();
TextBlock out2 = null;
if (branch.getSpecial() != null) {
out2 = branch.getSpecial().getDisplay()
.create(fcTest, HorizontalAlignment.LEFT, ftileFactory.skinParam());
out2 = branch.getSpecial().getDisplay().create(fcTest, HorizontalAlignment.LEFT,
ftileFactory.skinParam());
}
conns.add(result.new ConnectionVerticalIn(diam, ftile, rainbowIn.size() == 0 ? arrowColor : rainbowIn));
conns.add(result.new ConnectionVerticalOut(ftile, rainbowOut.size() == 0 ? arrowColor : rainbowOut, out2));
@ -264,8 +266,8 @@ class FtileIfLongHorizontal extends AbstractFtile {
private Point2D getP1(StringBounder stringBounder) {
final FtileGeometry dimDiamond1 = getFtile1().calculateDimension(stringBounder);
final Point2D p = new Point2D.Double(dimDiamond1.getLeft() * 2, getYdiamontOutToLeft(dimDiamond1,
stringBounder));
final Point2D p = new Point2D.Double(dimDiamond1.getLeft() * 2,
getYdiamontOutToLeft(dimDiamond1, stringBounder));
return getTranslateDiamond1(getFtile1(), stringBounder).getTranslated(p);
}
@ -327,8 +329,8 @@ class FtileIfLongHorizontal extends AbstractFtile {
private Point2D getP1(StringBounder stringBounder) {
final FtileGeometry dimDiamond1 = getFtile1().calculateDimension(stringBounder);
final Point2D p = new Point2D.Double(dimDiamond1.getLeft() * 2, getYdiamontOutToLeft(dimDiamond1,
stringBounder));
final Point2D p = new Point2D.Double(dimDiamond1.getLeft() * 2,
getYdiamontOutToLeft(dimDiamond1, stringBounder));
return getTranslateDiamond1(getFtile1(), stringBounder).getTranslated(p);
}
@ -470,45 +472,103 @@ class FtileIfLongHorizontal extends AbstractFtile {
final StringBounder stringBounder = ug.getStringBounder();
final Dimension2D totalDim = calculateDimensionInternal(stringBounder);
final Swimlane intoSw;
final List<Ftile> allTiles = new ArrayList<Ftile>(couples);
allTiles.add(tile2);
final double[] minmax;
if (ug instanceof UGraphicInterceptorOneSwimlane) {
intoSw = ((UGraphicInterceptorOneSwimlane) ug).getSwimlane();
final UGraphicInterceptorOneSwimlane interceptor = (UGraphicInterceptorOneSwimlane) ug;
final List<Swimlane> allSwimlanes = interceptor.getOrderedListOfAllSwimlanes();
minmax = getMinmax(stringBounder, totalDim.getWidth(), allTiles, interceptor.getSwimlane(),
allSwimlanes);
} else {
intoSw = null;
minmax = getMinmaxSimple(stringBounder, totalDim.getWidth(), allTiles);
}
final List<Ftile> all = new ArrayList<Ftile>(couples);
all.add(tile2);
double minX = totalDim.getWidth() / 2;
double maxX = totalDim.getWidth() / 2;
boolean atLeastOne = false;
for (Ftile tmp : all) {
if (tmp.calculateDimension(stringBounder).hasPointOut() == false) {
continue;
}
if (intoSw != null && tmp.getSwimlanes().contains(intoSw) == false) {
continue;
}
if (intoSw != null && tmp.getSwimlaneOut() != intoSw) {
continue;
}
atLeastOne = true;
final UTranslate ut = getTranslateFor(tmp, stringBounder);
final double out = tmp.calculateDimension(stringBounder).translate(ut).getLeft();
minX = Math.min(minX, out);
maxX = Math.max(maxX, out);
}
if (atLeastOne == false) {
final double minX = minmax[0];
final double maxX = minmax[1];
if (minX == Double.NaN || maxX == Double.NaN) {
return;
}
final Snake s = new Snake(arrowHorizontalAlignment(), arrowColor);
s.goUnmergeable(MergeStrategy.NONE);
final double height = totalDim.getHeight();
s.addPoint(minX, height);
s.addPoint(maxX, height);
s.addPoint(minX, totalDim.getHeight());
s.addPoint(maxX, totalDim.getHeight());
ug.draw(s);
}
private double[] getMinmax(StringBounder stringBounder, double width, List<Ftile> allTiles, Swimlane intoSw,
List<Swimlane> allSwimlanes) {
final int current = allSwimlanes.indexOf(intoSw);
if (current == -1) {
throw new IllegalStateException();
}
final int first = getFirstSwimlane(stringBounder, allTiles, allSwimlanes);
final int last = getLastSwimlane(stringBounder, allTiles, allSwimlanes);
if (current < first || current > last)
return new double[] { Double.NaN, Double.NaN };
double minX = current != first ? 0 : width;
double maxX = current != last ? width : 0;
for (Ftile tmp : allTiles) {
if (tmp.calculateDimension(stringBounder).hasPointOut() == false) {
continue;
}
if (ftileDoesOutcomeInThatSwimlane(tmp, intoSw) == false) {
continue;
}
final UTranslate ut = getTranslateFor(tmp, stringBounder);
final double out = tmp.calculateDimension(stringBounder).translate(ut).getLeft();
minX = Math.min(minX, out);
maxX = Math.max(maxX, out);
}
return new double[] { minX, maxX };
}
private double[] getMinmaxSimple(StringBounder stringBounder, double width, List<Ftile> allTiles) {
double minX = width / 2;
double maxX = width / 2;
for (Ftile tmp : allTiles) {
if (tmp.calculateDimension(stringBounder).hasPointOut() == false) {
continue;
}
final UTranslate ut = getTranslateFor(tmp, stringBounder);
final double out = tmp.calculateDimension(stringBounder).translate(ut).getLeft();
minX = Math.min(minX, out);
maxX = Math.max(maxX, out);
}
return new double[] { minX, maxX };
}
private int getFirstSwimlane(StringBounder stringBounder, List<Ftile> allTiles, List<Swimlane> allSwimlanes) {
for (int i = 0; i < allSwimlanes.size(); i++) {
if (atLeastOne(stringBounder, allSwimlanes.get(i), allTiles)) {
return i;
}
}
throw new IllegalStateException();
}
private int getLastSwimlane(StringBounder stringBounder, List<Ftile> allTiles, List<Swimlane> allSwimlanes) {
for (int i = allSwimlanes.size() - 1; i >= 0; i--) {
if (atLeastOne(stringBounder, allSwimlanes.get(i), allTiles)) {
return i;
}
}
throw new IllegalStateException();
}
private boolean atLeastOne(StringBounder stringBounder, Swimlane intoSw, List<Ftile> allTiles) {
for (Ftile tmp : allTiles)
if (tmp.calculateDimension(stringBounder).hasPointOut() && ftileDoesOutcomeInThatSwimlane(tmp, intoSw))
return true;
return false;
}
private boolean ftileDoesOutcomeInThatSwimlane(Ftile ftile, Swimlane swimlane) {
return ftile.getSwimlaneOut() == swimlane && ftile.getSwimlanes().contains(swimlane);
}
}
@Override

View File

@ -71,8 +71,6 @@ import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.svek.ConditionStyle;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UEmpty;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
@ -83,6 +81,7 @@ class FtileWhile extends AbstractFtile {
private final Ftile whileBlock;
private final Ftile diamond1;
private final Ftile specialOut;
private final Ftile backward;
@Override
public Collection<Ftile> getMyChildren() {
@ -106,21 +105,23 @@ class FtileWhile extends AbstractFtile {
return getSwimlaneIn();
}
private FtileWhile(Ftile whileBlock, Ftile diamond1, Ftile specialOut) {
private FtileWhile(Ftile whileBlock, Ftile diamond1, Ftile specialOut, Ftile backward) {
super(whileBlock.skinParam());
this.whileBlock = whileBlock;
this.diamond1 = diamond1;
this.specialOut = specialOut;
this.backward = backward;
}
public static Ftile create(Swimlane swimlane, Ftile whileBlock, Display test, HColor borderColor,
HColor backColor, Rainbow arrowColor, Display yes, Display out2, Rainbow endInlinkColor,
LinkRendering afterEndwhile, FontConfiguration fontArrow, FtileFactory ftileFactory,
ConditionStyle conditionStyle, FontConfiguration fcTest, Instruction specialOut) {
public static Ftile create(Swimlane swimlane, Ftile whileBlock, Display test, HColor borderColor, HColor backColor,
Rainbow arrowColor, Display yes, Display out2, Rainbow endInlinkColor, LinkRendering afterEndwhile,
FontConfiguration fontArrow, FtileFactory ftileFactory, ConditionStyle conditionStyle,
FontConfiguration fcTest, Instruction specialOut, Ftile backward) {
final TextBlock yesTb = yes.create(fontArrow, HorizontalAlignment.LEFT, ftileFactory.skinParam());
final TextBlock testTb = test.isWhite() ? TextBlockUtils.empty(0, 0) : test.create(fcTest, whileBlock
.skinParam().getDefaultTextAlignment(HorizontalAlignment.LEFT), ftileFactory.skinParam());
final TextBlock testTb = test.isWhite() ? TextBlockUtils.empty(0, 0)
: test.create(fcTest, whileBlock.skinParam().getDefaultTextAlignment(HorizontalAlignment.LEFT),
ftileFactory.skinParam());
final TextBlock out = out2.create(fontArrow, HorizontalAlignment.LEFT, ftileFactory.skinParam());
final Ftile diamond1;
@ -139,7 +140,7 @@ class FtileWhile extends AbstractFtile {
final Ftile special = specialOut == null ? null : specialOut.createFtile(ftileFactory);
final FtileWhile result = new FtileWhile(whileBlock, diamond1, special);
final FtileWhile result = new FtileWhile(whileBlock, diamond1, special, backward);
Rainbow afterEndwhileColor = arrowColor;
if (afterEndwhile != null && afterEndwhile.getRainbow() != null && afterEndwhile.getRainbow().size() != 0) {
afterEndwhileColor = afterEndwhile.getRainbow();
@ -154,7 +155,12 @@ class FtileWhile extends AbstractFtile {
conns.add(result.new ConnectionBackEmpty(endInlinkColor));
} else {
conns.add(result.new ConnectionIn(whileBlock.getInLinkRendering().getRainbow(arrowColor)));
conns.add(result.new ConnectionBack(endInlinkColor, back));
if (backward == null) {
conns.add(result.new ConnectionBackSimple(endInlinkColor, back));
} else {
conns.add(result.new ConnectionBackBackward1(endInlinkColor, back));
conns.add(result.new ConnectionBackBackward2(endInlinkColor));
}
}
if (specialOut == null) {
conns.add(result.new ConnectionOut(afterEndwhileColor));
@ -173,13 +179,13 @@ class FtileWhile extends AbstractFtile {
}
private Point2D getP1(final StringBounder stringBounder) {
return getTranslateDiamond1(stringBounder).getTranslated(
getFtile1().calculateDimension(stringBounder).getPointOut());
return getTranslateDiamond1(stringBounder)
.getTranslated(getFtile1().calculateDimension(stringBounder).getPointOut());
}
private Point2D getP2(final StringBounder stringBounder) {
return getTranslateForWhile(stringBounder).getTranslated(
getFtile2().calculateDimension(stringBounder).getPointIn());
return getTranslateForWhile(stringBounder)
.getTranslated(getFtile2().calculateDimension(stringBounder).getPointIn());
}
public void drawU(UGraphic ug) {
@ -209,11 +215,11 @@ class FtileWhile extends AbstractFtile {
}
}
class ConnectionBack extends AbstractConnection implements ConnectionTranslatable {
class ConnectionBackSimple extends AbstractConnection implements ConnectionTranslatable {
private final Rainbow endInlinkColor;
private final TextBlock back;
public ConnectionBack(Rainbow endInlinkColor, TextBlock back) {
public ConnectionBackSimple(Rainbow endInlinkColor, TextBlock back) {
super(whileBlock, diamond1);
this.endInlinkColor = endInlinkColor;
this.back = back;
@ -299,14 +305,105 @@ class FtileWhile extends AbstractFtile {
ug.apply(new UTranslate(x1, y1 + Diamond.diamondHalfSize)).draw(new UEmpty(5, Diamond.diamondHalfSize));
ug = ug.apply(new UChangeColor(endInlinkColor.getColor())).apply(
new UChangeBackColor(endInlinkColor.getColor()));
ug = ug.apply(endInlinkColor.getColor()).apply(endInlinkColor.getColor().bg());
ug.apply(new UTranslate(xx, (y1 + y2) / 2)).draw(Arrows.asToUp());
}
}
class ConnectionBackBackward1 extends AbstractConnection {
private final Rainbow endInlinkColor;
private final TextBlock back;
public ConnectionBackBackward1(Rainbow endInlinkColor, TextBlock back) {
super(whileBlock, backward);
this.endInlinkColor = endInlinkColor;
this.back = back;
}
private Point2D getP1(final StringBounder stringBounder) {
final FtileGeometry geo = whileBlock.calculateDimension(stringBounder);
if (geo.hasPointOut() == false) {
return null;
}
return getTranslateForWhile(stringBounder).getTranslated(geo.getPointOut());
}
private double getBottom(final StringBounder stringBounder) {
final FtileGeometry geo = whileBlock.calculateDimension(stringBounder);
return getTranslateForWhile(stringBounder).getDy() + geo.getHeight();
}
private Point2D getP2(final StringBounder stringBounder) {
final FtileGeometry dim = backward.calculateDimension(stringBounder);
return getTranslateBackward(stringBounder).getTranslated(new Point2D.Double(dim.getLeft(), dim.getOutY()));
}
public void drawU(UGraphic ug) {
final StringBounder stringBounder = ug.getStringBounder();
final Snake snake = new Snake(arrowHorizontalAlignment(), endInlinkColor, Arrows.asToUp());
final Point2D p1 = getP1(stringBounder);
if (p1 == null) {
return;
}
final Point2D p2 = getP2(stringBounder);
final double x1 = p1.getX();
final double y1 = p1.getY();
final double x2 = p2.getX();
final double y2 = p2.getY();
snake.setLabel(back);
snake.addPoint(x1, y1);
final double y1bis = Math.max(y1, getBottom(stringBounder)) + Diamond.diamondHalfSize;
snake.addPoint(x1, y1bis);
snake.addPoint(x2, y1bis);
snake.addPoint(x2, y2);
ug.draw(snake);
}
}
class ConnectionBackBackward2 extends AbstractConnection {
private final Rainbow endInlinkColor;
public ConnectionBackBackward2(Rainbow endInlinkColor) {
super(backward, diamond1);
this.endInlinkColor = endInlinkColor;
}
private Point2D getP1(final StringBounder stringBounder) {
final FtileGeometry dim = backward.calculateDimension(stringBounder);
return getTranslateBackward(stringBounder).getTranslated(new Point2D.Double(dim.getLeft(), dim.getInY()));
}
private Point2D getP2(final StringBounder stringBounder) {
return getTranslateDiamond1(stringBounder).getTranslated(new Point2D.Double(0, 0));
}
public void drawU(UGraphic ug) {
final StringBounder stringBounder = ug.getStringBounder();
final Snake snake = new Snake(arrowHorizontalAlignment(), endInlinkColor, Arrows.asToLeft());
final Point2D p1 = getP1(stringBounder);
final Point2D p2 = getP2(stringBounder);
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
final double x1 = p1.getX();
final double y1 = p1.getY();
final double x2 = p2.getX() + dimDiamond1.getWidth();
final double half = (dimDiamond1.getOutY() - dimDiamond1.getInY()) / 2;
final double y2 = p2.getY() + dimDiamond1.getInY() + half;
snake.addPoint(x1, y1);
snake.addPoint(x1, y2);
snake.addPoint(x2, y2);
ug.draw(snake);
}
}
class ConnectionBackEmpty extends AbstractConnection {
private final Rainbow endInlinkColor;
@ -316,8 +413,8 @@ class FtileWhile extends AbstractFtile {
}
private Point2D getP1(final StringBounder stringBounder) {
return getTranslateDiamond1(stringBounder).getTranslated(
diamond1.calculateDimension(stringBounder).getPointOut());
return getTranslateDiamond1(stringBounder)
.getTranslated(diamond1.calculateDimension(stringBounder).getPointOut());
}
private double getBottom(final StringBounder stringBounder) {
@ -424,8 +521,8 @@ class FtileWhile extends AbstractFtile {
}
private Point2D getP2(final StringBounder stringBounder) {
return getTranslateForSpecial(stringBounder).getTranslated(
specialOut.calculateDimension(stringBounder).getPointIn());
return getTranslateForSpecial(stringBounder)
.getTranslated(specialOut.calculateDimension(stringBounder).getPointIn());
}
public void drawU(UGraphic ug) {
@ -459,6 +556,18 @@ class FtileWhile extends AbstractFtile {
if (specialOut != null) {
ug.apply(getTranslateForSpecial(stringBounder)).draw(specialOut);
}
if (backward != null) {
ug.apply(getTranslateBackward(stringBounder)).draw(backward);
}
}
private UTranslate getTranslateBackward(StringBounder stringBounder) {
final Dimension2D dimTotal = calculateDimensionFtile(stringBounder);
final Dimension2D dimBackward = backward.calculateDimension(stringBounder);
final double x = dimTotal.getWidth() - dimBackward.getWidth();
final double y = (dimTotal.getHeight() - dimBackward.getHeight()) / 2;
return new UTranslate(x, y);
}
@Override
@ -473,7 +582,12 @@ class FtileWhile extends AbstractFtile {
final FtileGeometry geo = geoDiamond1.appendBottom(geoWhile);
final double height = geo.getHeight() + 4 * Diamond.diamondHalfSize;
final double dx = 2 * Diamond.diamondHalfSize;
return new FtileGeometry(xDeltaBecauseSpecial(stringBounder) + geo.getWidth() + dx + Diamond.diamondHalfSize,
double backwardWidth = 0;
if (backward != null) {
backwardWidth += backward.calculateDimension(stringBounder).getWidth();
}
return new FtileGeometry(
xDeltaBecauseSpecial(stringBounder) + geo.getWidth() + dx + Diamond.diamondHalfSize + backwardWidth,
height, xDeltaBecauseSpecial(stringBounder) + geo.getLeft() + dx, geoDiamond1.getInY(), height);
}
@ -527,7 +641,8 @@ class FtileWhile extends AbstractFtile {
final double xDiamond = getTranslateDiamond1(stringBounder).getDx();
// final double x1 = xWhile - xDeltaBecauseSpecial(stringBounder);
final double x1 = Math.min(xWhile, xDiamond) - xDeltaBecauseSpecial(stringBounder);
// final double x1 = getTranslateForWhile(stringBounder).getDx() - dimDiamond1.getWidth()
// final double x1 = getTranslateForWhile(stringBounder).getDx() -
// dimDiamond1.getWidth()
// - xDeltaBecauseSpecial(stringBounder);
return new UTranslate(x1, y1);
}

View File

@ -35,6 +35,8 @@
*/
package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
@ -42,8 +44,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.graphic.UGraphicDelegator;
import net.sourceforge.plantuml.ugraphic.UChange;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.ULine;
import net.sourceforge.plantuml.ugraphic.UShape;
@ -52,10 +52,12 @@ import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
public class UGraphicInterceptorOneSwimlane extends UGraphicDelegator {
private final Swimlane swimlane;
private final List<Swimlane> orderedList;
public UGraphicInterceptorOneSwimlane(UGraphic ug, Swimlane swimlane) {
public UGraphicInterceptorOneSwimlane(UGraphic ug, Swimlane swimlane, List<Swimlane> orderedList) {
super(ug);
this.swimlane = swimlane;
this.orderedList = orderedList;
}
public void draw(UShape shape) {
@ -88,17 +90,20 @@ public class UGraphicInterceptorOneSwimlane extends UGraphicDelegator {
}
private void drawGoto() {
final UGraphic ugGoto = getUg().apply(new UChangeColor(HColorUtils.GREEN)).apply(
new UChangeBackColor(HColorUtils.GREEN));
final UGraphic ugGoto = getUg().apply(HColorUtils.GREEN).apply(HColorUtils.GREEN.bg());
ugGoto.draw(new ULine(100, 100));
}
public UGraphic apply(UChange change) {
return new UGraphicInterceptorOneSwimlane(getUg().apply(change), swimlane);
return new UGraphicInterceptorOneSwimlane(getUg().apply(change), swimlane, orderedList);
}
public final Swimlane getSwimlane() {
return swimlane;
}
public final List<Swimlane> getOrderedListOfAllSwimlanes() {
return Collections.unmodifiableList(orderedList);
}
}

View File

@ -169,7 +169,7 @@ public class VCompactFactory implements FtileFactory {
}
public Ftile createWhile(Swimlane swimlane, Ftile whileBlock, Display test, Display yes, Display out,
LinkRendering afterEndwhile, HColor color, Instruction specialOut) {
LinkRendering afterEndwhile, HColor color, Instruction specialOut, Ftile back) {
return whileBlock;
}

View File

@ -46,8 +46,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.URectangle;
import net.sourceforge.plantuml.ugraphic.UTranslate;
@ -95,7 +93,7 @@ public class FtileBlackBlock extends AbstractFtile {
if (skinParam().shadowing(null)) {
rect.setDeltaShadow(3);
}
ug.apply(new UChangeColor(colorBar)).apply(new UChangeBackColor(colorBar)).draw(rect);
ug.apply(colorBar).apply(colorBar.bg()).draw(rect);
final Dimension2D dimLabel = label.calculateDimension(ug.getStringBounder());
label.drawU(ug.apply(new UTranslate(width + labelMargin, -dimLabel.getHeight() / 2)));
}

View File

@ -73,12 +73,11 @@ import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleBuilder;
import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorNone;
public class FtileBox extends AbstractFtile {
@ -243,7 +242,12 @@ public class FtileBox extends AbstractFtile {
thickness = getThickness();
}
ug = ug.apply(new UChangeColor(borderColor)).apply(new UChangeBackColor(backColor)).apply(thickness);
if (borderColor == null) {
ug = ug.apply(new HColorNone());
} else {
ug = ug.apply(borderColor);
}
ug = ug.apply(backColor.bg()).apply(thickness);
rect.drawU(ug);
if (horizontalAlignment == HorizontalAlignment.LEFT) {

View File

@ -48,8 +48,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UEllipse;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.ULine;
@ -107,9 +105,9 @@ public class FtileCircleEnd extends AbstractFtile {
final UEllipse circle = new UEllipse(SIZE, SIZE);
circle.setDeltaShadow(shadowing);
ug = ug.apply(new UChangeColor(backColor));
ug = ug.apply(backColor);
final double thickness = 2.5;
ug.apply(new UChangeBackColor(HColorUtils.WHITE)).apply(new UStroke(1.5))
ug.apply(HColorUtils.WHITE.bg()).apply(new UStroke(1.5))
.apply(new UTranslate(xTheoricalPosition, yTheoricalPosition)).draw(circle);
final double size2 = (SIZE - thickness) / Math.sqrt(2);

View File

@ -50,8 +50,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.ugraphic.UCenteredCharacter;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UEllipse;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UGraphic;
@ -105,10 +103,10 @@ public class FtileCircleSpot extends AbstractFtile {
if (skinParam().shadowing(null)) {
circle.setDeltaShadow(3);
}
ug.apply(new UChangeColor(borderColor)).apply(new UChangeBackColor(backColor)).apply(getThickness())
ug.apply(borderColor).apply(backColor.bg()).apply(getThickness())
.draw(circle);
ug.apply(new UChangeColor(fc.getColor())).apply(new UTranslate(SIZE / 2, SIZE / 2))
ug.apply(fc.getColor()).apply(new UTranslate(SIZE / 2, SIZE / 2))
.draw(new UCenteredCharacter(spot.charAt(0), fc.getFont()));
}

View File

@ -48,11 +48,10 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UEllipse;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorNone;
public class FtileCircleStart extends AbstractFtile {
@ -99,7 +98,7 @@ public class FtileCircleStart extends AbstractFtile {
public void drawU(UGraphic ug) {
final UEllipse circle = new UEllipse(SIZE, SIZE);
circle.setDeltaShadow(shadowing);
ug.apply(new UChangeColor(null)).apply(new UChangeBackColor(backColor)).draw(circle);
ug.apply(new HColorNone()).apply(backColor.bg()).draw(circle);
}
@Override

View File

@ -48,8 +48,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UEllipse;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
@ -101,15 +99,15 @@ public class FtileCircleStop extends AbstractFtile {
public void drawU(UGraphic ug) {
final UEllipse circle = new UEllipse(SIZE, SIZE);
circle.setDeltaShadow(shadowing);
ug.apply(new UChangeColor(backColor)).apply(new UChangeBackColor(HColorUtils.WHITE)).draw(circle);
ug.apply(backColor).apply(HColorUtils.WHITE.bg()).draw(circle);
final double delta = 5;
final UEllipse circleSmall = new UEllipse(SIZE - delta * 2, SIZE - delta * 2);
// if (skinParam().shadowing(null)) {
// circleSmall.setDeltaShadow(3);
// }
ug.apply(new UChangeColor(new HColorMiddle(backColor, HColorUtils.WHITE)))
.apply(new UChangeBackColor(backColor)).apply(new UTranslate(delta, delta)).draw(circleSmall);
ug.apply(new HColorMiddle(backColor, HColorUtils.WHITE))
.apply(backColor.bg()).apply(new UTranslate(delta, delta)).draw(circleSmall);
}
@Override

View File

@ -55,8 +55,6 @@ import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColor;
@ -146,7 +144,7 @@ public class FtileDiamond extends AbstractFtile {
final double suppY1 = north.calculateDimension(ug.getStringBounder()).getHeight();
ug = ug.apply(UTranslate.dy(suppY1));
ug.apply(new UChangeColor(borderColor)).apply(getThickness()).apply(new UChangeBackColor(backColor))
ug.apply(borderColor).apply(getThickness()).apply(backColor.bg())
.draw(Diamond.asPolygon(shadowing));
// final Dimension2D dimNorth = north.calculateDimension(ug.getStringBounder());
north.drawU(ug.apply(new UTranslate(Diamond.diamondHalfSize * 1.5, -suppY1)));

View File

@ -48,8 +48,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColor;
@ -113,7 +111,7 @@ public class FtileDiamondFoo1 extends AbstractFtile {
final StringBounder stringBounder = ug.getStringBounder();
final Dimension2D dimLabel = label.calculateDimension(stringBounder);
final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
ug = ug.apply(new UChangeColor(borderColor)).apply(getThickness()).apply(new UChangeBackColor(backColor));
ug = ug.apply(borderColor).apply(getThickness()).apply(backColor.bg());
ug.draw(Diamond.asPolygonFoo1(skinParam().shadowing(null), dimTotal.getWidth(), dimTotal.getHeight()));
north.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight())));

View File

@ -56,8 +56,6 @@ import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.style.Styleable;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColor;
@ -149,7 +147,7 @@ public class FtileDiamondInside extends AbstractFtile implements Styleable {
final StringBounder stringBounder = ug.getStringBounder();
final Dimension2D dimLabel = label.calculateDimension(stringBounder);
final Dimension2D dimTotal = calculateDimensionAlone(stringBounder);
ug = ug.apply(new UChangeColor(borderColor)).apply(getThickness()).apply(new UChangeBackColor(backColor));
ug = ug.apply(borderColor).apply(getThickness()).apply(backColor.bg());
ug.draw(Diamond.asPolygon(shadowing, dimTotal.getWidth(), dimTotal.getHeight()));
north.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight())));

View File

@ -53,8 +53,6 @@ import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColor;
@ -135,7 +133,7 @@ public class FtileDiamondInside2 extends AbstractFtile {
final StringBounder stringBounder = ug.getStringBounder();
final Dimension2D dimLabel = label.calculateDimension(stringBounder);
final Dimension2D dimTotal = calculateDimensionAlone(stringBounder);
ug = ug.apply(new UChangeColor(borderColor)).apply(getThickness()).apply(new UChangeBackColor(backColor));
ug = ug.apply(borderColor).apply(getThickness()).apply(backColor.bg());
ug.draw(Diamond.asPolygon(shadowing, dimTotal.getWidth(), dimTotal.getHeight()));
north.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight())));

View File

@ -49,8 +49,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColor;
@ -121,7 +119,7 @@ public class FtileDiamondInside3 extends AbstractFtile implements FtileOverpassi
final StringBounder stringBounder = ug.getStringBounder();
final Dimension2D dimLabel = label.calculateDimension(stringBounder);
final Dimension2D dimTotal = calculateDimensionAlone(stringBounder);
ug = ug.apply(new UChangeColor(borderColor)).apply(getThickness()).apply(new UChangeBackColor(backColor));
ug = ug.apply(borderColor).apply(getThickness()).apply(backColor.bg());
final double shadowing = skinParam().shadowing(null) ? 3 : 0;
ug.draw(Diamond.asPolygon(shadowing, dimTotal.getWidth(), dimTotal.getHeight()));

View File

@ -43,13 +43,13 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.ULine;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorNone;
public class FtileThinSplit extends AbstractFtile {
@ -80,7 +80,12 @@ public class FtileThinSplit extends AbstractFtile {
public void drawU(UGraphic ug) {
final UShape rect = ULine.hline(last - first);
ug = ug.apply(UTranslate.dx(first));
ug.apply(new UChangeColor(colorBar)).apply(new UStroke(1.5)).draw(rect);
if (colorBar == null) {
ug = ug.apply(new HColorNone());
} else {
ug = ug.apply(colorBar);
}
ug.apply(new UStroke(1.5)).draw(rect);
}
public Set<Swimlane> getSwimlanes() {

View File

@ -46,6 +46,12 @@ import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.FileList;
import org.apache.tools.ant.types.FileSet;
import net.sourceforge.plantuml.FileFormat;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.GeneratedImage;
@ -57,12 +63,6 @@ import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils;
import net.sourceforge.plantuml.preproc.Defines;
import net.sourceforge.plantuml.stats.StatsUtils;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.FileList;
import org.apache.tools.ant.types.FileSet;
// <?xml version="1.0"?>
//
// <project name="OwnTaskExample" default="main" basedir=".">

View File

@ -37,7 +37,6 @@ package net.sourceforge.plantuml.asciiart;
import java.awt.geom.Dimension2D;
import java.awt.geom.Point2D;
import java.awt.geom.Point2D.Double;
import net.sourceforge.plantuml.FileFormat;
import net.sourceforge.plantuml.StringUtils;

View File

@ -51,7 +51,6 @@ import net.sourceforge.plantuml.graphic.InnerStrategy;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.ugraphic.MinMax;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.ULine;
@ -97,7 +96,7 @@ public class BpmElement extends AbstractConnectorPuzzle implements ConnectorPuzz
public void drawU(UGraphic ug) {
raw.drawU(ug);
ug = ug.apply(new UChangeColor(HColorUtils.RED));
ug = ug.apply(HColorUtils.RED);
for (Where w : Where.values()) {
if (have(w)) {
drawLine(ug, w, raw.calculateDimension(ug.getStringBounder()));

View File

@ -44,7 +44,6 @@ import net.sourceforge.plantuml.graphic.InnerStrategy;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.ugraphic.MinMax;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.ULine;
import net.sourceforge.plantuml.ugraphic.UTranslate;
@ -89,7 +88,7 @@ public class ConnectorPuzzleEmpty extends AbstractConnectorPuzzle implements Pla
public void drawU(UGraphic ug) {
// System.err.println("DRAWING " + toString());
ug = ug.apply(new UChangeColor(HColorUtils.BLUE));
ug = ug.apply(HColorUtils.BLUE);
for (Where w : Where.values()) {
if (have(w)) {
drawLine(ug, w);

View File

@ -41,7 +41,6 @@ import java.awt.geom.Point2D;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.UDrawable;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.ULine;
import net.sourceforge.plantuml.ugraphic.UTranslate;
@ -155,7 +154,7 @@ public class GridArray implements UDrawable {
for (int c = 0; c < cols; c++) {
widthMax += getWidthOfCol(ug.getStringBounder(), c) + margin;
}
ug = ug.apply(new UChangeColor(HColorUtils.BLACK));
ug = ug.apply(HColorUtils.BLACK);
double y = 0;
for (int l = 0; l < lines; l++) {
ug.apply(UTranslate.dy(y)).draw(ULine.hline(widthMax));
@ -170,7 +169,7 @@ public class GridArray implements UDrawable {
}
private void drawArrow(UGraphic ug, Point2D pt1, Point2D pt2) {
ug = ug.apply(new UChangeColor(HColorUtils.BLUE));
ug = ug.apply(HColorUtils.BLUE);
final ULine line = new ULine(pt2.getX() - pt1.getX(), pt2.getY() - pt1.getY());
ug.apply(new UTranslate(pt1)).draw(line);
}

View File

@ -36,8 +36,6 @@
package net.sourceforge.plantuml.braille;
import net.sourceforge.plantuml.graphic.UDrawable;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UEllipse;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.ULine;
@ -56,7 +54,7 @@ public class BrailleDrawer implements UDrawable {
}
public void drawU(UGraphic ug) {
ug = ug.apply(new UChangeColor(HColorSet.instance().getColorIfValid("#F0F0F0")));
ug = ug.apply(HColorSet.instance().getColorIfValid("#F0F0F0"));
for (int x = grid.getMinX(); x <= grid.getMaxX(); x++) {
ug.apply(UTranslate.dx(x * step + spotSize + 1)).draw(
ULine.vline((grid.getMaxY() - grid.getMinY()) * step));
@ -65,7 +63,7 @@ public class BrailleDrawer implements UDrawable {
ug.apply(UTranslate.dy(y * step + spotSize + 1)).draw(
ULine.hline((grid.getMaxX() - grid.getMinX()) * step));
}
ug = ug.apply(new UChangeColor(HColorUtils.BLACK)).apply(new UChangeBackColor(HColorUtils.BLACK));
ug = ug.apply(HColorUtils.BLACK).apply(HColorUtils.BLACK.bg());
for (int x = grid.getMinX(); x <= grid.getMaxX(); x++) {
for (int y = grid.getMinY(); y <= grid.getMaxY(); y++) {
if (grid.getState(x, y)) {

View File

@ -37,11 +37,9 @@ package net.sourceforge.plantuml.classdiagram;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Set;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.creole.CreoleMode;
@ -54,7 +52,6 @@ import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.SuperGroup;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.objectdiagram.AbstractClassOrObjectDiagram;

View File

@ -36,7 +36,6 @@
package net.sourceforge.plantuml.classdiagram.command;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.classdiagram.ClassDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;

View File

@ -37,7 +37,6 @@ package net.sourceforge.plantuml.classdiagram.command;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;

View File

@ -36,7 +36,6 @@
package net.sourceforge.plantuml.classdiagram.command;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.StringLocated;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;

View File

@ -37,7 +37,6 @@ package net.sourceforge.plantuml.classdiagram.command;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;

View File

@ -36,7 +36,6 @@
package net.sourceforge.plantuml.classdiagram.command;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.classdiagram.ClassDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;

View File

@ -36,7 +36,6 @@
package net.sourceforge.plantuml.classdiagram.command;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;

View File

@ -37,7 +37,6 @@ package net.sourceforge.plantuml.classdiagram.command;
import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.Url;

View File

@ -36,7 +36,6 @@
package net.sourceforge.plantuml.classdiagram.command;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.command.CommandExecutionResult;

View File

@ -37,7 +37,6 @@ package net.sourceforge.plantuml.classdiagram.command;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.classdiagram.ClassDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;

View File

@ -36,7 +36,6 @@
package net.sourceforge.plantuml.classdiagram.command;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlBuilder.ModeUrl;

View File

@ -36,7 +36,6 @@
package net.sourceforge.plantuml.command;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlBuilder.ModeUrl;

View File

@ -36,7 +36,6 @@
package net.sourceforge.plantuml.command;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlBuilder.ModeUrl;

View File

@ -36,7 +36,6 @@
package net.sourceforge.plantuml.command;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlBuilder.ModeUrl;

View File

@ -36,7 +36,6 @@
package net.sourceforge.plantuml.command;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
@ -130,10 +129,13 @@ public class CommandPackage extends SingleLineCommand2<AbstractEntityDiagram> {
NamespaceStrategy.SINGLE);
final IEntity p = diagram.getCurrentGroup();
final String stereotype = arg.get("STEREOTYPE", 0);
final USymbol type = USymbol.getFromString(arg.get("TYPE", 0), diagram.getSkinParam().getActorStyle());
if (type == USymbol.TOGETHER) {
p.setUSymbol(type);
} else if (stereotype != null) {
// final USymbol type = USymbol.getFromString(arg.get("TYPE", 0),
// diagram.getSkinParam().getActorStyle());
// if (type == USymbol.TOGETHER) {
// p.setUSymbol(type);
// p.setThisIsTogether();
// } else
if (stereotype != null) {
final USymbol usymbol = USymbol.getFromString(stereotype, diagram.getSkinParam().getActorStyle());
if (usymbol == null) {
p.setStereotype(new Stereotype(stereotype));

View File

@ -36,7 +36,6 @@
package net.sourceforge.plantuml.command;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.command.regex.IRegex;

View File

@ -105,7 +105,7 @@ public class CommandSpriteFile extends SingleLineCommand2<UmlDiagram> {
if (isSvg(f.getName())) {
sprite = new SpriteSvg(f);
} else {
sprite = new SpriteImage(FileUtils.ImageIO_read(f));
sprite = new SpriteImage(FileUtils.readRasterImageFromFile(f));
}
}
} catch (IOException e) {

View File

@ -38,30 +38,17 @@ package net.sourceforge.plantuml.command.note;
import java.util.List;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlBuilder.ModeUrl;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.command.BlocLines;
import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.CommandMultilines2;
import net.sourceforge.plantuml.command.CommandPackage;
import net.sourceforge.plantuml.command.MultilinesStrategy;
import net.sourceforge.plantuml.command.Position;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.Stereotag;
import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors;
public final class CommandConstraintOnLinks extends SingleLineCommand2<CucaDiagram> {

View File

@ -36,7 +36,6 @@
package net.sourceforge.plantuml.command.note;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.classdiagram.command.CommandCreateClassMultilines;
import net.sourceforge.plantuml.command.BlocLines;

View File

@ -36,7 +36,6 @@
package net.sourceforge.plantuml.command.note;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;

View File

@ -36,7 +36,6 @@
package net.sourceforge.plantuml.command.note;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;

View File

@ -35,7 +35,6 @@
*/
package net.sourceforge.plantuml.command.note;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;

View File

@ -43,7 +43,6 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.compositediagram.CompositeDiagram;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.Link;

View File

@ -90,7 +90,7 @@ public class CreoleHorizontalLine extends AbstractAtom implements Atom {
}
public void drawU(UGraphic ug) {
// ug = ug.apply(new UChangeColor(fontConfiguration.getColor()));
// ug = ug.apply(UChangeColor.nnn(fontConfiguration.getColor()));
final Dimension2D dim = calculateDimension(ug.getStringBounder());
ug = ug.apply(UTranslate.dy(dim.getHeight() / 2));
ug.draw(getHorizontalLine());

View File

@ -38,11 +38,10 @@ package net.sourceforge.plantuml.creole;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.ugraphic.MinMax;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.URectangle;
import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColorNone;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
public class Position {
@ -98,8 +97,7 @@ public class Position {
}
public void drawDebug(UGraphic ug) {
// ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK)).apply(new UChangeBackColor(HtmlColorUtils.LIGHT_GRAY));
ug = ug.apply(new UChangeColor(HColorUtils.BLACK)).apply(new UChangeBackColor(null));
ug = ug.apply(HColorUtils.BLACK).apply(new HColorNone().bg());
ug = ug.apply(new UTranslate(x, y));
ug.draw(new URectangle(dim));
}

View File

@ -58,6 +58,20 @@ public class SheetBlock2 extends AbstractTextBlock implements TextBlock, Atom {
private final UStroke defaultStroke;
private final Stencil stencil;
public SheetBlock2 enlargeMe(final double delta) {
final Stencil newStencil = new Stencil() {
public double getStartingX(StringBounder stringBounder, double y) {
return stencil.getStartingX(stringBounder, y) - delta;
}
public double getEndingX(StringBounder stringBounder, double y) {
return stencil.getEndingX(stringBounder, y) + delta;
}
};
return new SheetBlock2(block, newStencil, defaultStroke);
}
public SheetBlock2(SheetBlock1 block, Stencil stencil, UStroke defaultStroke) {
this.block = block;
this.stencil = stencil;

View File

@ -95,7 +95,7 @@ public class AtomImg extends AbstractAtom implements Atom {
final String data = src.substring(DATA_IMAGE_PNG_BASE64.length(), src.length());
try {
final byte bytes[] = Base64Coder.decode(data);
return build(src, fc, bytes, scale, url);
return buildRasterFromData(src, fc, bytes, scale, url);
} catch (Exception e) {
return AtomText.create("ERROR " + e.toString(), fc);
}
@ -104,8 +104,10 @@ public class AtomImg extends AbstractAtom implements Atom {
try {
// Check if valid URL
if (src.startsWith("http:") || src.startsWith("https:")) {
// final byte image[] = getFile(src);
return build(src, fc, new URL(src), scale, url);
if (src.endsWith(".svg")) {
return buildSvgFromUrl(src, fc, new URL(src), scale, url);
}
return buildRasterFromUrl(src, fc, new URL(src), scale, url);
}
final File f = FileSystem.getInstance().getFile(src);
if (f.exists() == false) {
@ -114,18 +116,18 @@ public class AtomImg extends AbstractAtom implements Atom {
if (f.getName().endsWith(".svg")) {
return new AtomImgSvg(new TileImageSvg(f));
}
final BufferedImage read = FileUtils.ImageIO_read(f);
final BufferedImage read = FileUtils.readRasterImageFromFile(f);
if (read == null) {
return AtomText.create("(Cannot decode: " + f.getCanonicalPath() + ")", fc);
}
return new AtomImg(FileUtils.ImageIO_read(f), scale, url, src);
return new AtomImg(FileUtils.readRasterImageFromFile(f), scale, url, src);
} catch (IOException e) {
return AtomText.create("ERROR " + e.toString(), fc);
}
}
private static Atom build(String source, final FontConfiguration fc, final byte[] data, double scale, Url url)
throws IOException {
private static Atom buildRasterFromData(String source, final FontConfiguration fc, final byte[] data, double scale,
Url url) throws IOException {
final BufferedImage read = ImageIO.read(new ByteArrayInputStream(data));
if (read == null) {
return AtomText.create("(Cannot decode: " + source + ")", fc);
@ -133,21 +135,30 @@ public class AtomImg extends AbstractAtom implements Atom {
return new AtomImg(read, scale, url, null);
}
private static Atom build(String text, final FontConfiguration fc, URL source, double scale, Url url)
private static Atom buildRasterFromUrl(String text, final FontConfiguration fc, URL source, double scale, Url url)
throws IOException {
final BufferedImage read = FileUtils.ImageIO_read(source);
final BufferedImage read = FileUtils.readRasterImageFromURL(source);
if (read == null) {
return AtomText.create("(Cannot decode: " + text + ")", fc);
}
return new AtomImg(read, scale, url, source.getPath());
}
private static Atom buildSvgFromUrl(String text, final FontConfiguration fc, URL source, double scale, Url url)
throws IOException {
final byte[] read = getFile(source);
if (read == null) {
return AtomText.create("(Cannot decode SVG: " + text + ")", fc);
}
return new AtomImgSvg(new TileImageSvg(new String(read, "UTF-8")));
}
// Added by Alain Corbiere
private static byte[] getFile(String host) throws IOException {
private static byte[] getFile(URL url) {
final ByteArrayOutputStream image = new ByteArrayOutputStream();
try {
InputStream input = null;
try {
final URL url = new URL(host);
final URLConnection connection = url.openConnection();
input = connection.getInputStream();
final byte[] buffer = new byte[1024];
@ -162,6 +173,10 @@ public class AtomImg extends AbstractAtom implements Atom {
input.close();
}
}
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
// End

View File

@ -46,13 +46,12 @@ import net.sourceforge.plantuml.creole.Position;
import net.sourceforge.plantuml.creole.SheetBlock1;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.ULine;
import net.sourceforge.plantuml.ugraphic.URectangle;
import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorNone;
public class AtomTable extends AbstractAtom implements Atom {
@ -108,7 +107,7 @@ public class AtomTable extends AbstractAtom implements Atom {
final double y2 = getStartingY(i + 1);
final double x1 = getStartingX(0);
final double x2 = getStartingX(getNbCols());
ug.apply(new UChangeColor(null)).apply(new UChangeBackColor(line.lineBackColor))
ug.apply(new HColorNone()).apply(line.lineBackColor.bg())
.apply(new UTranslate(x1, y1)).draw(new URectangle(x2 - x1, y2 - y1));
}
for (int j = 0; j < getNbCols(); j++) {
@ -127,7 +126,7 @@ public class AtomTable extends AbstractAtom implements Atom {
if (cellBackColor != null) {
final double y1 = getStartingY(i);
final double y2 = getStartingY(i + 1);
ug.apply(new UChangeColor(null)).apply(new UChangeBackColor(cellBackColor))
ug.apply(new HColorNone()).apply(cellBackColor.bg())
.apply(new UTranslate(x1, y1)).draw(new URectangle(x2 - x1, y2 - y1));
}
final Position pos = positions.get(cell);
@ -141,7 +140,7 @@ public class AtomTable extends AbstractAtom implements Atom {
cell.drawU(ug.apply(pos.getTranslate().compose(UTranslate.dx(dx))));
}
}
ug = ug.apply(new UChangeColor(lineColor));
ug = ug.apply(lineColor);
final ULine hline = ULine.hline(getEndingX(getNbCols() - 1));
for (int i = 0; i <= getNbLines(); i++) {
ug.apply(UTranslate.dy(getStartingY(i))).draw(hline);

View File

@ -44,7 +44,6 @@ import java.util.Map;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.salt.element.Skeleton2;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColor;
@ -89,7 +88,7 @@ public class AtomTree extends AbstractAtom implements Atom {
ug = ug.apply(UTranslate.dy(dim.getHeight()));
y += dim.getHeight();
}
skeleton.draw(ugInit.apply(new UChangeColor(this.lineColor)));
skeleton.draw(ugInit.apply(this.lineColor));
}
private int getLevel(Atom atom) {

View File

@ -40,8 +40,6 @@ import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UEllipse;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.URectangle;
@ -81,7 +79,7 @@ public class Bullet extends AbstractAtom implements Atom {
private void drawU0(UGraphic ug) {
final HColor color = fontConfiguration.getColor();
ug = ug.apply(new UChangeColor(color)).apply(new UChangeBackColor(color)).apply(new UStroke(0));
ug = ug.apply(color).apply(color.bg()).apply(new UStroke(0));
// final double width = getWidth(ug.getStringBounder());
ug = ug.apply(UTranslate.dx(3));
ug.draw(new UEllipse(5, 5));
@ -97,7 +95,7 @@ public class Bullet extends AbstractAtom implements Atom {
private void drawU1(UGraphic ug) {
final HColor color = fontConfiguration.getColor();
ug = ug.apply(new UChangeColor(color)).apply(new UChangeBackColor(color)).apply(new UStroke(0));
ug = ug.apply(color).apply(color.bg()).apply(new UStroke(0));
final double width = getWidth(ug.getStringBounder());
ug = ug.apply(UTranslate.dx(width - 5));
ug.draw(new URectangle(3.5, 3.5));

View File

@ -35,44 +35,41 @@
*/
package net.sourceforge.plantuml.cucadiagram;
import net.sourceforge.plantuml.svek.Ports;
public class EntityPort {
private final String uid;
private final String portName;
private final String entityUid;
private final String portId;
public EntityPort(String uid, String portName) {
this.uid = uid;
this.portName = portName;
public EntityPort(String entityUid, String portName) {
this.entityUid = entityUid;
this.portId = portName == null ? null : Ports.encodePortNameToId(portName);
}
public String getFullString() {
if (portName != null) {
return uid + ":" + portName;
if (portId != null) {
return entityUid + ":" + portId;
}
return uid;
return entityUid;
}
private boolean isShielded() {
return uid.endsWith(":h");
return entityUid.endsWith(":h");
}
public String getPrefix() {
if (isShielded()) {
return uid.substring(0, uid.length() - 2);
return entityUid.substring(0, entityUid.length() - 2);
}
return uid;
return entityUid;
}
public boolean startsWith(String centerId) {
return uid.startsWith(centerId);
return entityUid.startsWith(centerId);
}
public boolean equalsId(EntityPort other) {
return this.uid.equals(other.uid);
return this.entityUid.equals(other.entityUid);
}
// private String getPortName() {
// return portName;
// }
}

View File

@ -286,4 +286,8 @@ public class GroupRoot implements IGroup {
public boolean isAloneAndUnlinked() {
throw new UnsupportedOperationException();
}
public void setThisIsTogether() {
throw new UnsupportedOperationException();
}
}

View File

@ -97,5 +97,7 @@ public interface IEntity extends SpecificBackcolorable, Hideable, Removeable, Li
public boolean isAloneAndUnlinked();
public void setThisIsTogether();
}

View File

@ -43,7 +43,6 @@ import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.ULine;
import net.sourceforge.plantuml.ugraphic.UStroke;
@ -86,7 +85,7 @@ public class LinkConstraint {
if (x2 == 0 && y2 == 0) {
return;
}
ug = ug.apply(new UChangeColor(HColorUtils.BLACK));
ug = ug.apply(HColorUtils.BLACK);
// ug.apply(new UTranslate(x1, y1)).draw(new URectangle(10, 10));
// ug.apply(new UTranslate(x2, y2)).draw(new URectangle(10, 10));

View File

@ -53,8 +53,6 @@ import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.svek.Ports;
import net.sourceforge.plantuml.svek.WithPorts;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UEllipse;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.ULine;
@ -189,7 +187,7 @@ public class TextBlockMap extends AbstractTextBlock implements WithPorts {
public void drawU(UGraphic ug) {
final UShape point = new UEllipse(getDiameter(), getDiameter());
ug = ug.apply(new UChangeColor(color)).apply(new UChangeBackColor(color));
ug = ug.apply(color).apply(color.bg());
ug.draw(point);
}

View File

@ -110,19 +110,20 @@ public final class CucaDiagramTxtMaker {
for (Link link : diagram.getLinks()) {
final Block b1 = blocks.get(link.getEntity1());
final Block b2 = blocks.get(link.getEntity2());
paths.add(new Path(b1, b2, null, link.getLength()));
paths.add(new Path(b1, b2, null, link.getLength(), link.isInvis()));
}
solver.solve(root, paths);
for (Path p : paths) {
if (p.isInvis()) {
continue;
}
p.getDotPath().draw(globalUg.getCharArea(), getXPixelPerChar(), getYPixelPerChar());
}
for (IEntity ent : diagram.getLeafsvalues()) {
final Block b = blocks.get(ent);
final Point2D p = b.getPosition();
printClass(
ent,
(UGraphicTxt) globalUg.apply(new UTranslate(p.getX() / getXPixelPerChar(), p.getY()
/ getYPixelPerChar())));
printClass(ent, (UGraphicTxt) globalUg
.apply(new UTranslate(p.getX() / getXPixelPerChar(), p.getY() / getYPixelPerChar())));
}
}

View File

@ -38,8 +38,6 @@ package net.sourceforge.plantuml.cucadiagram.dot;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

View File

@ -45,15 +45,11 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.swing.text.html.HTMLDocument.HTMLReader.IsindexAction;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.Guillemet;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.cucadiagram.Bodier;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
@ -798,4 +794,11 @@ final public class EntityImpl implements ILeaf, IGroup {
return originalGroup;
}
private boolean together;
public void setThisIsTogether() {
this.together = true;
// System.err.println("setThisIsTogether");
}
}

View File

@ -71,7 +71,6 @@ public class Cheese implements CuteShape {
final Point2D ptA = balloon.getPointOnCircle(angle1);
final Point2D ptB = balloon.getPointOnCircle(angle2);
// balloon.drawU(ug.apply(new UChangeBackColor(null)).apply(new UChangeColor(HtmlColorUtils.BLACK)));
final UPath path = new UPath();
final Point2D ptA0;
if (radius.hasCurvation()) {
@ -116,12 +115,6 @@ public class Cheese implements CuteShape {
path.closePath();
ug.draw(path);
// if (startAngle.hasCurvation()) {
// insideA.drawU(ug.apply(new UChangeColor(HtmlColorUtils.BLACK)).apply(new UChangeBackColor(null)));
// }
// if (endAngle.hasCurvation()) {
// insideB.drawU(ug.apply(new UChangeColor(HtmlColorUtils.BLACK)).apply(new UChangeBackColor(null)));
// }
}
public CuteShape rotateZoom(RotationZoom other) {

View File

@ -40,10 +40,9 @@ import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UPath;
import net.sourceforge.plantuml.ugraphic.color.HColorNone;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
public class CutePath {
@ -141,7 +140,7 @@ public class CutePath {
for (int i = 0; i < arcs.size(); i++) {
final BetweenCorners betweenCorners = new BetweenCorners(getCorner(i), getCorner(i + 1), arcs.get(i)
.getTension());
betweenCorners.debugMe(ug.apply(new UChangeColor(HColorUtils.BLACK)).apply(new UChangeBackColor(null)));
betweenCorners.debugMe(ug.apply(HColorUtils.BLACK).apply(new HColorNone().bg()));
}
}

View File

@ -36,8 +36,6 @@
package net.sourceforge.plantuml.cute;
import net.sourceforge.plantuml.graphic.UDrawable;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColor;
@ -84,7 +82,7 @@ public class PositionnedImpl implements Positionned {
}
private UGraphic applyColor(UGraphic ug) {
return ug.apply(new UChangeBackColor(color)).apply(new UChangeColor(color));
return ug.apply(color.bg()).apply(color);
}

View File

@ -47,9 +47,6 @@ public class Triangle implements CuteShape {
private Triangle(CutePath cutePath) {
this.cutePath = cutePath;
// if (points.size() != 3) {
// throw new IllegalArgumentException();
// }
}
public Triangle rotateZoom(final RotationZoom angle) {
@ -61,9 +58,5 @@ public class Triangle implements CuteShape {
public void drawU(UGraphic ug) {
cutePath.drawU(ug);
// ug = ug.apply(new UChangeBackColor(null)).apply(new UChangeColor(HtmlColorUtils.BLACK));
// cutePath.withNoTension().drawU(
// ug.apply(new UChangeBackColor(null)).apply(new UChangeColor(HtmlColorUtils.BLACK)));
}
}

View File

@ -42,13 +42,12 @@ import net.sourceforge.plantuml.graphic.AbstractTextBlock;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.ugraphic.UCenteredCharacter;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.URectangle;
import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorNone;
public class BoxedCharacter extends AbstractTextBlock implements TextBlock {
@ -70,12 +69,15 @@ public class BoxedCharacter extends AbstractTextBlock implements TextBlock {
public void drawU(UGraphic ug) {
if (circle != null) {
ug = ug.apply(new UChangeColor(circle));
ug = ug.apply(circle);
}
if (innerCircle == null) {
ug = ug.apply(new HColorNone().bg());
} else {
ug = ug.apply(innerCircle.bg());
}
// final HtmlColor back = ug.getParam().getBackcolor();
ug = ug.apply(new UChangeBackColor(innerCircle));
ug.draw(new URectangle(2 * radius, 2 * radius));
ug = ug.apply(new UChangeColor(fontColor));
ug = ug.apply(fontColor);
ug = ug.apply(new UTranslate(radius, radius));
ug.draw(new UCenteredCharacter(c.charAt(0), font));
}

View File

@ -37,7 +37,6 @@ package net.sourceforge.plantuml.descdiagram;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlBuilder.ModeUrl;

View File

@ -36,7 +36,6 @@
package net.sourceforge.plantuml.descdiagram;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;

View File

@ -57,8 +57,6 @@ import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.svek.AbstractEntityImage;
import net.sourceforge.plantuml.svek.ShapeType;
import net.sourceforge.plantuml.ugraphic.PlacementStrategyY1Y2;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.ULayoutGroup;
import net.sourceforge.plantuml.ugraphic.URectangle;
@ -128,12 +126,12 @@ public class EntityImageDesignedDomain extends AbstractEntityImage {
final URectangle rect = new URectangle(widthTotal, heightTotal);
URectangle rect2 = new URectangle(4, heightTotal);
ug = ug.apply(new UChangeColor(SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.designedBorder)));
ug = ug.apply(SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.designedBorder));
HColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK);
if (backcolor == null) {
backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.designedBackground);
}
ug = ug.apply(new UChangeBackColor(backcolor));
ug = ug.apply(backcolor.bg());
if (url != null) {
ug.startUrl(url);
}

View File

@ -57,8 +57,6 @@ import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.svek.AbstractEntityImage;
import net.sourceforge.plantuml.svek.ShapeType;
import net.sourceforge.plantuml.ugraphic.PlacementStrategyY1Y2;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.ULayoutGroup;
@ -130,12 +128,12 @@ public class EntityImageDomain extends AbstractEntityImage {
final double heightTotal = dimTotal.getHeight();
final URectangle rect = new URectangle(widthTotal, heightTotal);
ug = ug.apply(new UChangeColor(SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.domainBorder)));
ug = ug.apply(SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.domainBorder));
HColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK);
if (backcolor == null) {
backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.domainBackground);
}
ug = ug.apply(new UChangeBackColor(backcolor));
ug = ug.apply(backcolor.bg());
if (url != null) {
ug.startUrl(url);
}

View File

@ -57,8 +57,6 @@ import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.svek.AbstractEntityImage;
import net.sourceforge.plantuml.svek.ShapeType;
import net.sourceforge.plantuml.ugraphic.PlacementStrategyY1Y2;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.ULayoutGroup;
import net.sourceforge.plantuml.ugraphic.URectangle;
@ -127,12 +125,12 @@ public class EntityImageMachine extends AbstractEntityImage {
final URectangle rect = new URectangle(widthTotal, heightTotal);
URectangle rect2 = new URectangle(4, heightTotal);
ug = ug.apply(new UChangeColor(SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.machineBorder)));
ug = ug.apply(SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.machineBorder));
HColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK);
if (backcolor == null) {
backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.machineBackground);
}
ug = ug.apply(new UChangeBackColor(backcolor));
ug = ug.apply(backcolor.bg());
if (url != null) {
ug.startUrl(url);
}

View File

@ -60,8 +60,6 @@ import net.sourceforge.plantuml.svek.AbstractEntityImage;
import net.sourceforge.plantuml.svek.ShapeType;
import net.sourceforge.plantuml.ugraphic.AbstractUGraphicHorizontalLine;
import net.sourceforge.plantuml.ugraphic.TextBlockInEllipse;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UEllipse;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UHorizontalLine;
@ -123,12 +121,12 @@ public class EntityImageRequirement extends AbstractEntityImage {
if (linecolor == null) {
linecolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.requirementBorder);
}
ug = ug.apply(new UChangeColor(linecolor));
ug = ug.apply(linecolor);
HColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK);
if (backcolor == null) {
backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.requirementBackground);
}
ug = ug.apply(new UChangeBackColor(backcolor));
ug = ug.apply(backcolor.bg());
final UGraphic ug2 = new MyUGraphicEllipse(ug, 0, 0, ellipse.getUEllipse());
ellipse.drawU(ug2);

View File

@ -37,7 +37,6 @@ package net.sourceforge.plantuml.descdiagram.command;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;

View File

@ -36,7 +36,6 @@
package net.sourceforge.plantuml.descdiagram.command;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;

View File

@ -37,7 +37,6 @@ package net.sourceforge.plantuml.descdiagram.command;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;

View File

@ -38,7 +38,6 @@ package net.sourceforge.plantuml.descdiagram.command;
import java.util.List;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;

View File

@ -37,7 +37,6 @@ package net.sourceforge.plantuml.descdiagram.command;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
@ -59,7 +58,6 @@ import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.descdiagram.DescriptionDiagram;
import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType;

View File

@ -36,7 +36,6 @@
package net.sourceforge.plantuml.descdiagram.command;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
@ -73,9 +72,7 @@ public class CommandPackageWithUSymbol extends SingleLineCommand2<AbstractEntity
}
private static IRegex getRegexConcat() {
return RegexConcat
.build(CommandPackageWithUSymbol.class.getName(),
RegexLeaf.start(), //
return RegexConcat.build(CommandPackageWithUSymbol.class.getName(), RegexLeaf.start(), //
new RegexLeaf("SYMBOL",
"(package|rectangle|node|artifact|folder|file|frame|cloud|database|storage|component|card|together|queue|stack)"), //
RegexLeaf.spaceOneOrMore(), //
@ -159,7 +156,11 @@ public class CommandPackageWithUSymbol extends SingleLineCommand2<AbstractEntity
diagram.gotoGroup(ident, code, Display.getWithNewlines(display), GroupType.PACKAGE, currentPackage,
NamespaceStrategy.SINGLE);
final IEntity p = diagram.getCurrentGroup();
p.setUSymbol(USymbol.getFromString(arg.get("SYMBOL", 0), diagram.getSkinParam().getActorStyle()));
final String symbol = arg.get("SYMBOL", 0);
if ("together".equalsIgnoreCase(symbol)) {
p.setThisIsTogether();
}
p.setUSymbol(USymbol.getFromString(symbol, diagram.getSkinParam().getActorStyle()));
final String stereotype = arg.getLazzy("STEREOTYPE", 0);
if (stereotype != null) {
p.setStereotype(new Stereotype(stereotype, false));

Some files were not shown because too many files have changed in this diff Show More