mirror of
https://github.com/octoleo/plantuml.git
synced 2024-11-15 17:57:10 +00:00
WIP
This commit is contained in:
parent
7141113050
commit
03c34c18c3
@ -351,8 +351,8 @@ public class ActivityDiagram3 extends UmlDiagram {
|
|||||||
|
|
||||||
public void startRepeat(HColor color, Display label, BoxStyle boxStyleIn, Colors colors) {
|
public void startRepeat(HColor color, Display label, BoxStyle boxStyleIn, Colors colors) {
|
||||||
manageSwimlaneStrategy();
|
manageSwimlaneStrategy();
|
||||||
final InstructionRepeat instructionRepeat = new InstructionRepeat(swinlanes.getCurrentSwimlane(), current(),
|
final InstructionRepeat instructionRepeat = new InstructionRepeat(swinlanes, current(), nextLinkRenderer(),
|
||||||
nextLinkRenderer(), color, label, boxStyleIn, colors);
|
color, label, boxStyleIn, colors);
|
||||||
current().add(instructionRepeat);
|
current().add(instructionRepeat);
|
||||||
setCurrent(instructionRepeat);
|
setCurrent(instructionRepeat);
|
||||||
setNextLinkRendererInternal(LinkRendering.none());
|
setNextLinkRendererInternal(LinkRendering.none());
|
||||||
|
@ -53,6 +53,7 @@ import net.sourceforge.plantuml.graphic.FontConfiguration;
|
|||||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||||
import net.sourceforge.plantuml.graphic.Rainbow;
|
import net.sourceforge.plantuml.graphic.Rainbow;
|
||||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||||
|
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||||
@ -212,7 +213,7 @@ public class Branch {
|
|||||||
public final LinkRendering getSpecial() {
|
public final LinkRendering getSpecial() {
|
||||||
return special;
|
return special;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final Display getDisplayPositive() {
|
public final Display getDisplayPositive() {
|
||||||
final LinkRendering in = ftile.getInLinkRendering();
|
final LinkRendering in = ftile.getInLinkRendering();
|
||||||
if (in != null && Display.isNull(in.getDisplay()) == false) {
|
if (in != null && Display.isNull(in.getDisplay()) == false) {
|
||||||
@ -221,8 +222,17 @@ public class Branch {
|
|||||||
return labelPositive.getDisplay();
|
return labelPositive.getDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Display getSpecialDisplay() {
|
||||||
public final TextBlock getTextBlockPositive() {
|
if (special != null && Display.isNull(special.getDisplay()) == false) {
|
||||||
|
return special.getDisplay();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private TextBlock getTextBlock(Display display) {
|
||||||
|
if (display == null)
|
||||||
|
return TextBlockUtils.EMPTY_TEXT_BLOCK;
|
||||||
|
|
||||||
LineBreakStrategy lineBreak = LineBreakStrategy.NONE;
|
LineBreakStrategy lineBreak = LineBreakStrategy.NONE;
|
||||||
final FontConfiguration fcArrow;
|
final FontConfiguration fcArrow;
|
||||||
if (UseStyle.useBetaStyle()) {
|
if (UseStyle.useBetaStyle()) {
|
||||||
@ -233,10 +243,16 @@ public class Branch {
|
|||||||
fcArrow = new FontConfiguration(skinParam(), FontParam.ARROW, null);
|
fcArrow = new FontConfiguration(skinParam(), FontParam.ARROW, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
return getDisplayPositive().create0(fcArrow, HorizontalAlignment.LEFT, skinParam(), lineBreak,
|
return display.create0(fcArrow, HorizontalAlignment.LEFT, skinParam(), lineBreak, CreoleMode.SIMPLE_LINE, null,
|
||||||
CreoleMode.SIMPLE_LINE, null, null);
|
null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final TextBlock getTextBlockPositive() {
|
||||||
|
return getTextBlock(getDisplayPositive());
|
||||||
|
}
|
||||||
|
|
||||||
|
public final TextBlock getTextBlockSpecial() {
|
||||||
|
return getTextBlock(getSpecialDisplay());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
|||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileKilled;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileKilled;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||||
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlanes;
|
||||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||||
@ -58,6 +59,7 @@ public class InstructionRepeat implements Instruction {
|
|||||||
private final Instruction parent;
|
private final Instruction parent;
|
||||||
private final LinkRendering nextLinkRenderer;
|
private final LinkRendering nextLinkRenderer;
|
||||||
private final Swimlane swimlane;
|
private final Swimlane swimlane;
|
||||||
|
private final Swimlanes swimlanes;
|
||||||
private Swimlane swimlaneOut;
|
private Swimlane swimlaneOut;
|
||||||
private BoxStyle boxStyle;
|
private BoxStyle boxStyle;
|
||||||
private boolean killed = false;
|
private boolean killed = false;
|
||||||
@ -81,13 +83,14 @@ public class InstructionRepeat implements Instruction {
|
|||||||
return repeatList.containsBreak();
|
return repeatList.containsBreak();
|
||||||
}
|
}
|
||||||
|
|
||||||
public InstructionRepeat(Swimlane swimlane, Instruction parent, LinkRendering nextLinkRenderer, HColor color,
|
public InstructionRepeat(Swimlanes swimlanes, Instruction parent, LinkRendering nextLinkRenderer, HColor color,
|
||||||
Display startLabel, BoxStyle boxStyleIn, Colors colors) {
|
Display startLabel, BoxStyle boxStyleIn, Colors colors) {
|
||||||
this.repeatList = new InstructionList(swimlane);
|
this.swimlanes = swimlanes;
|
||||||
|
this.swimlane = swimlanes.getCurrentSwimlane();
|
||||||
|
this.repeatList = new InstructionList(this.swimlane);
|
||||||
this.boxStyleIn = boxStyleIn;
|
this.boxStyleIn = boxStyleIn;
|
||||||
this.startLabel = startLabel;
|
this.startLabel = startLabel;
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
this.swimlane = swimlane;
|
|
||||||
this.nextLinkRenderer = Objects.requireNonNull(nextLinkRenderer);
|
this.nextLinkRenderer = Objects.requireNonNull(nextLinkRenderer);
|
||||||
this.colors = colors;
|
this.colors = colors;
|
||||||
}
|
}
|
||||||
@ -119,6 +122,8 @@ public class InstructionRepeat implements Instruction {
|
|||||||
public Ftile createFtile(FtileFactory factory) {
|
public Ftile createFtile(FtileFactory factory) {
|
||||||
final Ftile back = getBackward(factory);
|
final Ftile back = getBackward(factory);
|
||||||
final Ftile decorateOut = factory.decorateOut(repeatList.createFtile(factory), endRepeatLinkRendering);
|
final Ftile decorateOut = factory.decorateOut(repeatList.createFtile(factory), endRepeatLinkRendering);
|
||||||
|
if (this.testCalled == false && incoming1.isNone())
|
||||||
|
incoming1 = swimlanes.nextLinkRenderer();
|
||||||
final Ftile result = factory.repeat(boxStyleIn, swimlane, swimlaneOut, startLabel, decorateOut, test, yes, out,
|
final Ftile result = factory.repeat(boxStyleIn, swimlane, swimlaneOut, startLabel, decorateOut, test, yes, out,
|
||||||
colors, back, isLastOfTheParent(), incoming1, incoming2);
|
colors, back, isLastOfTheParent(), incoming1, incoming2);
|
||||||
if (killed) {
|
if (killed) {
|
||||||
|
@ -131,6 +131,8 @@ public class InstructionSwitch extends WithNote implements Instruction, Instruct
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean switchCase(Display labelCase, LinkRendering nextLinkRenderer) {
|
public boolean switchCase(Display labelCase, LinkRendering nextLinkRenderer) {
|
||||||
|
if (this.current != null)
|
||||||
|
this.current.setSpecial(nextLinkRenderer);
|
||||||
this.current = new Branch(skinParam.getCurrentStyleBuilder(), swimlane,
|
this.current = new Branch(skinParam.getCurrentStyleBuilder(), swimlane,
|
||||||
LinkRendering.none().withDisplay(labelCase), labelCase, null,
|
LinkRendering.none().withDisplay(labelCase), labelCase, null,
|
||||||
LinkRendering.none().withDisplay(labelCase));
|
LinkRendering.none().withDisplay(labelCase));
|
||||||
|
@ -120,13 +120,24 @@ public class FtileGeometry extends Dimension2D {
|
|||||||
return new FtileGeometry(width, height + northHeight, left, inY + northHeight, Double.MIN_NORMAL);
|
return new FtileGeometry(width, height + northHeight, left, inY + northHeight, Double.MIN_NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FtileGeometry addBottom(double southHeight) {
|
||||||
|
if (hasPointOut())
|
||||||
|
return new FtileGeometry(width, height + southHeight, left, inY, outY);
|
||||||
|
return new FtileGeometry(width, height + southHeight, left, inY, Double.MIN_NORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
public FtileGeometry incRight(double missing) {
|
public FtileGeometry incRight(double missing) {
|
||||||
return new FtileGeometry(width + missing, height, left, inY, outY);
|
return new FtileGeometry(width + missing, height, left, inY, outY);
|
||||||
}
|
}
|
||||||
|
|
||||||
// public FtileGeometry incInnerHeight(double northHeight) {
|
public FtileGeometry incLeft(double missing) {
|
||||||
// return new FtileGeometry(width, height + northHeight, left, inY, outY + northHeight);
|
return new FtileGeometry(width + missing, height, left + missing, inY, outY);
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
public FtileGeometry incVertically(double missing1, double missing2) {
|
||||||
|
return new FtileGeometry(width, height + missing1 + missing2, left, inY + missing1,
|
||||||
|
hasPointOut() ? outY + missing1 : outY);
|
||||||
|
}
|
||||||
|
|
||||||
public FtileGeometry(Dimension2D dim, double left, double inY, double outY) {
|
public FtileGeometry(Dimension2D dim, double left, double inY, double outY) {
|
||||||
this(dim.getWidth(), dim.getHeight(), left, inY, outY);
|
this(dim.getWidth(), dim.getHeight(), left, inY, outY);
|
||||||
|
@ -68,9 +68,7 @@ public class FtileMargedVertically extends FtileDecorate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private FtileGeometry calculateDimensionSlow(StringBounder stringBounder) {
|
private FtileGeometry calculateDimensionSlow(StringBounder stringBounder) {
|
||||||
final FtileGeometry orig = getFtileDelegated().calculateDimension(stringBounder);
|
return super.calculateDimension(stringBounder).incVertically(margin1, margin2);
|
||||||
return new FtileGeometry(orig.getWidth(), orig.getHeight() + margin1 + margin2, orig.getLeft(), orig.getInY()
|
|
||||||
+ margin1, orig.hasPointOut() ? orig.getOutY() + margin1 : orig.getOutY());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -35,10 +35,29 @@
|
|||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml.activitydiagram3.ftile;
|
package net.sourceforge.plantuml.activitydiagram3.ftile;
|
||||||
|
|
||||||
|
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDecorate;
|
||||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||||
|
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||||
|
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||||
|
|
||||||
public interface FtileOverpassing extends Ftile {
|
public class FtileMargedWest extends FtileDecorate {
|
||||||
|
|
||||||
public FtileGeometry getOverpassDimension(StringBounder stringBounder);
|
private final double margin;
|
||||||
|
|
||||||
|
public FtileMargedWest(Ftile tile, double margin) {
|
||||||
|
super(tile);
|
||||||
|
this.margin = margin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void drawU(UGraphic ug) {
|
||||||
|
super.drawU(ug.apply(UTranslate.dx(margin)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FtileGeometry calculateDimension(StringBounder stringBounder) {
|
||||||
|
FtileGeometry result = super.calculateDimension(stringBounder);
|
||||||
|
result = result.incLeft(margin);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -42,18 +42,18 @@ import net.sourceforge.plantuml.graphic.StringBounder;
|
|||||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||||
import net.sourceforge.plantuml.ugraphic.UPolygon;
|
import net.sourceforge.plantuml.ugraphic.UPolygon;
|
||||||
|
|
||||||
public class Diamond {
|
public class Hexagon {
|
||||||
|
|
||||||
final static public double diamondHalfSize = 12;
|
final static public double hexagonHalfSize = 12;
|
||||||
|
|
||||||
public static UPolygon asPolygon(double shadowing) {
|
public static UPolygon asPolygon(double shadowing) {
|
||||||
final UPolygon diams = new UPolygon();
|
final UPolygon diams = new UPolygon();
|
||||||
|
|
||||||
diams.addPoint(diamondHalfSize, 0);
|
diams.addPoint(hexagonHalfSize, 0);
|
||||||
diams.addPoint(diamondHalfSize * 2, diamondHalfSize);
|
diams.addPoint(hexagonHalfSize * 2, hexagonHalfSize);
|
||||||
diams.addPoint(diamondHalfSize, diamondHalfSize * 2);
|
diams.addPoint(hexagonHalfSize, hexagonHalfSize * 2);
|
||||||
diams.addPoint(0, diamondHalfSize);
|
diams.addPoint(0, hexagonHalfSize);
|
||||||
diams.addPoint(diamondHalfSize, 0);
|
diams.addPoint(hexagonHalfSize, 0);
|
||||||
|
|
||||||
// if (shadowing) {
|
// if (shadowing) {
|
||||||
// diams.setDeltaShadow(3);
|
// diams.setDeltaShadow(3);
|
||||||
@ -66,13 +66,13 @@ public class Diamond {
|
|||||||
public static UPolygon asPolygon(double shadowing, double width, double height) {
|
public static UPolygon asPolygon(double shadowing, double width, double height) {
|
||||||
final UPolygon diams = new UPolygon();
|
final UPolygon diams = new UPolygon();
|
||||||
|
|
||||||
diams.addPoint(diamondHalfSize, 0);
|
diams.addPoint(hexagonHalfSize, 0);
|
||||||
diams.addPoint(width - diamondHalfSize, 0);
|
diams.addPoint(width - hexagonHalfSize, 0);
|
||||||
diams.addPoint(width, height / 2);
|
diams.addPoint(width, height / 2);
|
||||||
diams.addPoint(width - diamondHalfSize, height);
|
diams.addPoint(width - hexagonHalfSize, height);
|
||||||
diams.addPoint(diamondHalfSize, height);
|
diams.addPoint(hexagonHalfSize, height);
|
||||||
diams.addPoint(0, height / 2);
|
diams.addPoint(0, height / 2);
|
||||||
diams.addPoint(diamondHalfSize, 0);
|
diams.addPoint(hexagonHalfSize, 0);
|
||||||
|
|
||||||
// if (shadowing) {
|
// if (shadowing) {
|
||||||
// diams.setDeltaShadow(3);
|
// diams.setDeltaShadow(3);
|
||||||
@ -88,9 +88,9 @@ public class Diamond {
|
|||||||
private final double getDeltaX(double height, double y) {
|
private final double getDeltaX(double height, double y) {
|
||||||
final double p = y / height * 2;
|
final double p = y / height * 2;
|
||||||
if (p <= 1) {
|
if (p <= 1) {
|
||||||
return diamondHalfSize * p;
|
return hexagonHalfSize * p;
|
||||||
}
|
}
|
||||||
return diamondHalfSize * (2 - p);
|
return hexagonHalfSize * (2 - p);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getStartingX(StringBounder stringBounder, double y) {
|
public double getStartingX(StringBounder stringBounder, double y) {
|
@ -134,7 +134,7 @@ public class Snake implements UShape {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Snake withLabel(TextBlock textBlock, VerticalAlignment verticalAlignment) {
|
public Snake withLabel(TextBlock textBlock, VerticalAlignment verticalAlignment) {
|
||||||
if (textBlock != null) {
|
if (textBlock != null && textBlock != TextBlockUtils.EMPTY_TEXT_BLOCK) {
|
||||||
this.texts.add(new Text(textBlock, verticalAlignment, null));
|
this.texts.add(new Text(textBlock, verticalAlignment, null));
|
||||||
}
|
}
|
||||||
if (verticalAlignment != VerticalAlignment.CENTER) {
|
if (verticalAlignment != VerticalAlignment.CENTER) {
|
||||||
@ -314,9 +314,10 @@ public class Snake implements UShape {
|
|||||||
if (this.startDecoration != null || other.startDecoration != null) {
|
if (this.startDecoration != null || other.startDecoration != null) {
|
||||||
throw new UnsupportedOperationException("Not yet coded: to be done");
|
throw new UnsupportedOperationException("Not yet coded: to be done");
|
||||||
}
|
}
|
||||||
|
final ArrayList<Text> mergeTexts = new ArrayList<Text>(this.texts);
|
||||||
|
mergeTexts.addAll(other.texts);
|
||||||
final Snake result = new Snake(null, color, oneOf, this.worm.merge(other.worm, strategy), strategy,
|
final Snake result = new Snake(null, color, oneOf, this.worm.merge(other.worm, strategy), strategy,
|
||||||
emphasizeDirection == null ? other.emphasizeDirection : emphasizeDirection, new ArrayList<Text>());
|
emphasizeDirection == null ? other.emphasizeDirection : emphasizeDirection, mergeTexts);
|
||||||
// result.textBlock = oneOf(this.textBlock, other.textBlock, stringBounder);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (same(this.getFirst(), other.getLast())) {
|
if (same(this.getFirst(), other.getLast())) {
|
||||||
|
@ -55,6 +55,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.FtileSwitch
|
|||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.FtileSwitchWithManyLinks;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.FtileSwitchWithManyLinks;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.FtileSwitchWithOneLink;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.FtileSwitchWithOneLink;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDecorateInLabel;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDecorateInLabel;
|
||||||
|
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDecorateOutLabel;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside;
|
||||||
import net.sourceforge.plantuml.creole.CreoleMode;
|
import net.sourceforge.plantuml.creole.CreoleMode;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||||
@ -106,9 +107,9 @@ public class FtileFactoryDelegatorSwitch extends FtileFactoryDelegator {
|
|||||||
final Ftile diamond2 = getDiamond2(swimlane, branches.get(0));
|
final Ftile diamond2 = getDiamond2(swimlane, branches.get(0));
|
||||||
|
|
||||||
for (Branch branch : branches) {
|
for (Branch branch : branches) {
|
||||||
final Dimension2D dimLabel = branch.getTextBlockPositive().calculateDimension(getStringBounder());
|
final Dimension2D dimLabelIn = branch.getTextBlockPositive().calculateDimension(getStringBounder());
|
||||||
// ftiles.add(new FtileMinWidthCentered(branch.getFtile(), 30));
|
final Dimension2D dimLabelOut = branch.getTextBlockSpecial().calculateDimension(getStringBounder());
|
||||||
ftiles.add(new FtileDecorateInLabel(branch.getFtile(), dimLabel.getWidth(), dimLabel.getHeight()));
|
ftiles.add(new FtileDecorateOutLabel(new FtileDecorateInLabel(branch.getFtile(), dimLabelIn), dimLabelOut));
|
||||||
}
|
}
|
||||||
|
|
||||||
final Rainbow arrowColor;
|
final Rainbow arrowColor;
|
||||||
@ -158,7 +159,7 @@ public class FtileFactoryDelegatorSwitch extends FtileFactoryDelegator {
|
|||||||
tbTest = test.create0(fcDiamond, branch0.skinParam().getDefaultTextAlignment(HorizontalAlignment.LEFT),
|
tbTest = test.create0(fcDiamond, branch0.skinParam().getDefaultTextAlignment(HorizontalAlignment.LEFT),
|
||||||
branch0.skinParam(), lineBreak, CreoleMode.FULL, null, null);
|
branch0.skinParam(), lineBreak, CreoleMode.FULL, null, null);
|
||||||
|
|
||||||
return new FtileDiamondInside(branch0.skinParam(), backColor, borderColor, swimlane, tbTest);
|
return new FtileDiamondInside(tbTest, branch0.skinParam(), backColor, borderColor, swimlane);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Ftile getDiamond2(Swimlane swimlane, Branch branch0) {
|
private Ftile getDiamond2(Swimlane swimlane, Branch branch0) {
|
||||||
@ -167,8 +168,8 @@ public class FtileFactoryDelegatorSwitch extends FtileFactoryDelegator {
|
|||||||
? getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBackground)
|
? getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBackground)
|
||||||
: branch0.getColor();
|
: branch0.getColor();
|
||||||
|
|
||||||
return new FtileDiamondInside(branch0.skinParam(), backColor, borderColor, swimlane,
|
return new FtileDiamondInside(TextBlockUtils.empty(0, 0), branch0.skinParam(), backColor, borderColor,
|
||||||
TextBlockUtils.empty(0, 0));
|
swimlane);
|
||||||
}
|
}
|
||||||
|
|
||||||
// private HColor fontColor(FontParam param) {
|
// private HColor fontColor(FontParam param) {
|
||||||
|
@ -44,7 +44,7 @@ import net.sourceforge.plantuml.activitydiagram3.Instruction;
|
|||||||
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
|
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Hexagon;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileBreak;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileBreak;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||||
@ -124,7 +124,7 @@ public class FtileFactoryDelegatorWhile extends FtileFactoryDelegator {
|
|||||||
|
|
||||||
final Snake snake = Snake.create(arrowColor, Arrows.asToLeft());
|
final Snake snake = Snake.create(arrowColor, Arrows.asToLeft());
|
||||||
snake.addPoint(tr1.getDx(), tr1.getDy());
|
snake.addPoint(tr1.getDx(), tr1.getDy());
|
||||||
snake.addPoint(Diamond.diamondHalfSize, tr1.getDy());
|
snake.addPoint(Hexagon.hexagonHalfSize, tr1.getDy());
|
||||||
ug.draw(snake);
|
ug.draw(snake);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection;
|
|||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Hexagon;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||||
@ -134,12 +134,12 @@ class FtileIfAndStop extends AbstractFtile {
|
|||||||
final Sheet sheet = Parser.build(fcTest, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), skinParam, CreoleMode.FULL)
|
final Sheet sheet = Parser.build(fcTest, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), skinParam, CreoleMode.FULL)
|
||||||
.createSheet(labelTest);
|
.createSheet(labelTest);
|
||||||
final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, LineBreakStrategy.NONE, skinParam.getPadding());
|
final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, LineBreakStrategy.NONE, skinParam.getPadding());
|
||||||
final TextBlock tbTest = new SheetBlock2(sheetBlock1, Diamond.asStencil(sheetBlock1),
|
final TextBlock tbTest = new SheetBlock2(sheetBlock1, Hexagon.asStencil(sheetBlock1),
|
||||||
tileNonStop.getThickness());
|
tileNonStop.getThickness());
|
||||||
|
|
||||||
final Ftile diamond1;
|
final Ftile diamond1;
|
||||||
if (conditionStyle == ConditionStyle.INSIDE_HEXAGON) {
|
if (conditionStyle == ConditionStyle.INSIDE_HEXAGON) {
|
||||||
diamond1 = new FtileDiamondInside(tileNonStop.skinParam(), backColor, borderColor, swimlane, tbTest);
|
diamond1 = new FtileDiamondInside(tbTest, tileNonStop.skinParam(), backColor, borderColor, swimlane);
|
||||||
// .withWest(tb1).withEast(tb2);
|
// .withWest(tb1).withEast(tb2);
|
||||||
} else if (conditionStyle == ConditionStyle.EMPTY_DIAMOND) {
|
} else if (conditionStyle == ConditionStyle.EMPTY_DIAMOND) {
|
||||||
diamond1 = new FtileDiamond(tileNonStop.skinParam(), backColor, borderColor, swimlane).withNorth(tbTest);
|
diamond1 = new FtileDiamond(tileNonStop.skinParam(), backColor, borderColor, swimlane).withNorth(tbTest);
|
||||||
|
@ -50,7 +50,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
|
|||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.ConnectionTranslatable;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.ConnectionTranslatable;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Hexagon;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileEmpty;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileEmpty;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||||
@ -328,7 +328,7 @@ public class FtileIfDown extends AbstractFtile {
|
|||||||
final double y2 = p2.getY();
|
final double y2 = p2.getY();
|
||||||
|
|
||||||
final FtileGeometry thenGeom = thenBlock.calculateDimension(stringBounder);
|
final FtileGeometry thenGeom = thenBlock.calculateDimension(stringBounder);
|
||||||
final double xmax = Math.max(x1 + Diamond.diamondHalfSize,
|
final double xmax = Math.max(x1 + Hexagon.hexagonHalfSize,
|
||||||
getTranslateForThen(stringBounder).getDx() + thenGeom.getWidth());
|
getTranslateForThen(stringBounder).getDx() + thenGeom.getWidth());
|
||||||
|
|
||||||
final Snake snake = Snake.create(endInlinkColor, Arrows.asToLeft()).emphasizeDirection(Direction.DOWN);
|
final Snake snake = Snake.create(endInlinkColor, Arrows.asToLeft()).emphasizeDirection(Direction.DOWN);
|
||||||
@ -336,7 +336,7 @@ public class FtileIfDown extends AbstractFtile {
|
|||||||
snake.addPoint(xmax, y1);
|
snake.addPoint(xmax, y1);
|
||||||
snake.addPoint(xmax, y2);
|
snake.addPoint(xmax, y2);
|
||||||
snake.addPoint(x2, y2);
|
snake.addPoint(x2, y2);
|
||||||
ug.apply(new UTranslate(x2, y2 - Diamond.diamondHalfSize)).draw(new UEmpty(5, Diamond.diamondHalfSize));
|
ug.apply(new UTranslate(x2, y2 - Hexagon.hexagonHalfSize)).draw(new UEmpty(5, Hexagon.hexagonHalfSize));
|
||||||
ug.draw(snake);
|
ug.draw(snake);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -367,7 +367,7 @@ public class FtileIfDown extends AbstractFtile {
|
|||||||
final double y2 = p2.getY();
|
final double y2 = p2.getY();
|
||||||
|
|
||||||
final FtileGeometry thenGeom = thenBlock.calculateDimension(stringBounder);
|
final FtileGeometry thenGeom = thenBlock.calculateDimension(stringBounder);
|
||||||
final double xmax = Math.max(x1 + Diamond.diamondHalfSize,
|
final double xmax = Math.max(x1 + Hexagon.hexagonHalfSize,
|
||||||
getTranslateForThen(stringBounder).getDx() + thenGeom.getWidth());
|
getTranslateForThen(stringBounder).getDx() + thenGeom.getWidth());
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -382,7 +382,7 @@ public class FtileIfDown extends AbstractFtile {
|
|||||||
snake.addPoint(x1, y1);
|
snake.addPoint(x1, y1);
|
||||||
snake.addPoint(xmax, y1);
|
snake.addPoint(xmax, y1);
|
||||||
snake.addPoint(xmax, y2);
|
snake.addPoint(xmax, y2);
|
||||||
ug.apply(new UTranslate(xmax, y2 - Diamond.diamondHalfSize)).draw(new UEmpty(5, Diamond.diamondHalfSize));
|
ug.apply(new UTranslate(xmax, y2 - Hexagon.hexagonHalfSize)).draw(new UEmpty(5, Hexagon.hexagonHalfSize));
|
||||||
ug.draw(snake);
|
ug.draw(snake);
|
||||||
/*
|
/*
|
||||||
* final Snake snake2 = Snake.create(arrowHorizontalAlignment(),
|
* final Snake snake2 = Snake.create(arrowHorizontalAlignment(),
|
||||||
@ -458,7 +458,7 @@ public class FtileIfDown extends AbstractFtile {
|
|||||||
final double y3 = p3.getY();
|
final double y3 = p3.getY();
|
||||||
|
|
||||||
final FtileGeometry thenGeom = thenBlock.calculateDimension(stringBounder);
|
final FtileGeometry thenGeom = thenBlock.calculateDimension(stringBounder);
|
||||||
final double xmax = Math.max(x1 + Diamond.diamondHalfSize,
|
final double xmax = Math.max(x1 + Hexagon.hexagonHalfSize,
|
||||||
getTranslateForThen(stringBounder).getDx() + thenGeom.getWidth());
|
getTranslateForThen(stringBounder).getDx() + thenGeom.getWidth());
|
||||||
|
|
||||||
final Snake snake = Snake.create(endInlinkColor).withMerge(MergeStrategy.NONE);
|
final Snake snake = Snake.create(endInlinkColor).withMerge(MergeStrategy.NONE);
|
||||||
@ -490,9 +490,9 @@ public class FtileIfDown extends AbstractFtile {
|
|||||||
final FtileGeometry geoThen = thenBlock.calculateDimension(stringBounder);
|
final FtileGeometry geoThen = thenBlock.calculateDimension(stringBounder);
|
||||||
final FtileGeometry geoDiamond2 = diamond2.calculateDimension(stringBounder);
|
final FtileGeometry geoDiamond2 = diamond2.calculateDimension(stringBounder);
|
||||||
final FtileGeometry geo = geoDiamond1.appendBottom(geoThen).appendBottom(geoDiamond2);
|
final FtileGeometry geo = geoDiamond1.appendBottom(geoThen).appendBottom(geoDiamond2);
|
||||||
final double height = geo.getHeight() + 3 * Diamond.diamondHalfSize
|
final double height = geo.getHeight() + 3 * Hexagon.hexagonHalfSize
|
||||||
+ Math.max(Diamond.diamondHalfSize * 1, getSouthLabelHeight(stringBounder));
|
+ Math.max(Hexagon.hexagonHalfSize * 1, getSouthLabelHeight(stringBounder));
|
||||||
double width = geo.getWidth() + Diamond.diamondHalfSize;
|
double width = geo.getWidth() + Hexagon.hexagonHalfSize;
|
||||||
if (optionalStop != null) {
|
if (optionalStop != null) {
|
||||||
width += optionalStop.calculateDimension(stringBounder).getWidth() + getAdditionalWidth(stringBounder);
|
width += optionalStop.calculateDimension(stringBounder).getWidth() + getAdditionalWidth(stringBounder);
|
||||||
}
|
}
|
||||||
|
@ -163,8 +163,8 @@ class FtileIfLongHorizontal extends AbstractFtile {
|
|||||||
ftileFactory.skinParam());
|
ftileFactory.skinParam());
|
||||||
final HColor diamondColor = branch.getColor() == null ? backColor : branch.getColor();
|
final HColor diamondColor = branch.getColor() == null ? backColor : branch.getColor();
|
||||||
|
|
||||||
FtileDiamondInside2 diamond = new FtileDiamondInside2(branch.skinParam(), diamondColor, borderColor,
|
FtileDiamondInside2 diamond = new FtileDiamondInside2(tbTest, branch.skinParam(), diamondColor,
|
||||||
swimlane, tbTest);
|
borderColor, swimlane);
|
||||||
TextBlock tbInlabel = null;
|
TextBlock tbInlabel = null;
|
||||||
if (Display.isNull(branch.getInlabel())) {
|
if (Display.isNull(branch.getInlabel())) {
|
||||||
inlabelSizes.add(0.0);
|
inlabelSizes.add(0.0);
|
||||||
|
@ -53,18 +53,20 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
|
|||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||||
|
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileMargedWest;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileMinWidthCentered;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileMinWidthCentered;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileOverpassing;
|
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamond;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamond;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside3;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside2;
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||||
import net.sourceforge.plantuml.graphic.Rainbow;
|
import net.sourceforge.plantuml.graphic.Rainbow;
|
||||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||||
|
import net.sourceforge.plantuml.graphic.VerticalAlignment;
|
||||||
import net.sourceforge.plantuml.svek.ConditionStyle;
|
import net.sourceforge.plantuml.svek.ConditionStyle;
|
||||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||||
@ -128,35 +130,39 @@ class FtileIfLongVertical extends AbstractFtile {
|
|||||||
static Ftile create(Swimlane swimlane, HColor borderColor, HColor backColor, Rainbow arrowColor,
|
static Ftile create(Swimlane swimlane, HColor borderColor, HColor backColor, Rainbow arrowColor,
|
||||||
FtileFactory ftileFactory, ConditionStyle conditionStyle, List<Branch> thens, Branch branch2,
|
FtileFactory ftileFactory, ConditionStyle conditionStyle, List<Branch> thens, Branch branch2,
|
||||||
FontConfiguration fc, LinkRendering topInlinkRendering, LinkRendering afterEndwhile) {
|
FontConfiguration fc, LinkRendering topInlinkRendering, LinkRendering afterEndwhile) {
|
||||||
final List<Ftile> tiles = new ArrayList<>();
|
|
||||||
|
|
||||||
for (Branch branch : thens) {
|
|
||||||
tiles.add(new FtileMinWidthCentered(branch.getFtile(), 30));
|
|
||||||
}
|
|
||||||
|
|
||||||
final Ftile tile2 = new FtileMinWidthCentered(branch2.getFtile(), 30);
|
|
||||||
|
|
||||||
List<Ftile> diamonds = new ArrayList<>();
|
List<Ftile> diamonds = new ArrayList<>();
|
||||||
|
|
||||||
|
double west = 10;
|
||||||
for (Branch branch : thens) {
|
for (Branch branch : thens) {
|
||||||
final TextBlock tb1 = branch.getDisplayPositive().create(fc, HorizontalAlignment.LEFT,
|
final TextBlock tb1 = branch.getDisplayPositive().create(fc, HorizontalAlignment.LEFT,
|
||||||
ftileFactory.skinParam());
|
ftileFactory.skinParam());
|
||||||
final TextBlock tbTest = branch.getLabelTest().create(fc,
|
final TextBlock tbTest = branch.getLabelTest().create(fc,
|
||||||
ftileFactory.skinParam().getDefaultTextAlignment(HorizontalAlignment.LEFT),
|
ftileFactory.skinParam().getDefaultTextAlignment(HorizontalAlignment.LEFT),
|
||||||
ftileFactory.skinParam());
|
ftileFactory.skinParam());
|
||||||
FtileDiamondInside3 diamond = new FtileDiamondInside3(branch.skinParam(), backColor, borderColor, swimlane,
|
FtileDiamondInside2 diamond = new FtileDiamondInside2(tbTest, branch.skinParam(), backColor, borderColor,
|
||||||
tbTest);
|
swimlane);
|
||||||
|
|
||||||
diamond = diamond.withEast(tb1);
|
diamond = diamond.withEast(tb1);
|
||||||
diamonds.add(diamond);
|
diamonds.add(diamond);
|
||||||
|
|
||||||
|
if (Display.isNull(branch.getInlabel()) == false) {
|
||||||
|
final TextBlock tbInlabel = branch.getInlabel().create(fc, HorizontalAlignment.LEFT,
|
||||||
|
ftileFactory.skinParam());
|
||||||
|
west = Math.max(west, tbInlabel.calculateDimension(ftileFactory.getStringBounder()).getWidth());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final TextBlock tb2 = branch2.getDisplayPositive().create(fc, HorizontalAlignment.LEFT, ftileFactory.skinParam());
|
final List<Ftile> tiles = new ArrayList<>();
|
||||||
final int last = diamonds.size() - 1;
|
|
||||||
diamonds.set(last, ((FtileDiamondInside3) diamonds.get(last)).withSouth(tb2));
|
|
||||||
|
|
||||||
// diamonds = alignDiamonds(diamonds, ftileFactory.getStringBounder());
|
for (Branch branch : thens) {
|
||||||
|
tiles.add(new FtileMargedWest(branch.getFtile(), west));
|
||||||
|
}
|
||||||
|
|
||||||
final Ftile lastDiamond = new FtileDiamond(tiles.get(0).skinParam(), backColor, borderColor, swimlane);
|
final Ftile lastDiamond = new FtileDiamond(tiles.get(0).skinParam(), backColor, borderColor, swimlane);
|
||||||
|
|
||||||
|
final Ftile tile2 = new FtileMinWidthCentered(branch2.getFtile(), 30);
|
||||||
final FtileIfLongVertical result = new FtileIfLongVertical(diamonds, tiles, tile2, arrowColor, lastDiamond);
|
final FtileIfLongVertical result = new FtileIfLongVertical(diamonds, tiles, tile2, arrowColor, lastDiamond);
|
||||||
|
|
||||||
final List<Connection> conns = new ArrayList<>();
|
final List<Connection> conns = new ArrayList<>();
|
||||||
@ -165,12 +171,17 @@ class FtileIfLongVertical extends AbstractFtile {
|
|||||||
final Ftile diam = diamonds.get(i);
|
final Ftile diam = diamonds.get(i);
|
||||||
|
|
||||||
final Rainbow color = thens.get(i).getInColor(arrowColor);
|
final Rainbow color = thens.get(i).getInColor(arrowColor);
|
||||||
|
|
||||||
conns.add(result.new ConnectionVerticalIn(diam, ftile, color == null ? arrowColor : color));
|
conns.add(result.new ConnectionVerticalIn(diam, ftile, color == null ? arrowColor : color));
|
||||||
// conns.add(result.new ConnectionVerticalOut(ftile, arrowColor));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < diamonds.size() - 1; i++) {
|
for (int i = 0; i < diamonds.size() - 1; i++) {
|
||||||
conns.add(result.new ConnectionVertical(diamonds.get(i), diamonds.get(i + 1), arrowColor));
|
final Branch branch = thens.get(i + 1);
|
||||||
|
TextBlock tbInlabel = null;
|
||||||
|
if (Display.isNull(branch.getInlabel()) == false)
|
||||||
|
tbInlabel = branch.getInlabel().create(fc, HorizontalAlignment.LEFT, ftileFactory.skinParam());
|
||||||
|
|
||||||
|
conns.add(result.new ConnectionVertical(diamonds.get(i), diamonds.get(i + 1), arrowColor, tbInlabel));
|
||||||
}
|
}
|
||||||
conns.add(result.new ConnectionThenOut(tiles.get(0), arrowColor));
|
conns.add(result.new ConnectionThenOut(tiles.get(0), arrowColor));
|
||||||
for (int i = 1; i < tiles.size(); i++) {
|
for (int i = 1; i < tiles.size(); i++) {
|
||||||
@ -179,7 +190,10 @@ class FtileIfLongVertical extends AbstractFtile {
|
|||||||
|
|
||||||
final Rainbow topInColor = topInlinkRendering.getRainbow(arrowColor);
|
final Rainbow topInColor = topInlinkRendering.getRainbow(arrowColor);
|
||||||
conns.add(result.new ConnectionIn(topInColor));
|
conns.add(result.new ConnectionIn(topInColor));
|
||||||
conns.add(result.new ConnectionLastElse(topInColor));
|
|
||||||
|
final TextBlock tb2 = branch2.getDisplayPositive().create(fc, HorizontalAlignment.LEFT,
|
||||||
|
ftileFactory.skinParam());
|
||||||
|
conns.add(result.new ConnectionLastElse(topInColor, tb2));
|
||||||
conns.add(result.new ConnectionLastElseOut(arrowColor));
|
conns.add(result.new ConnectionLastElseOut(arrowColor));
|
||||||
|
|
||||||
return FtileUtils.addConnection(result, conns);
|
return FtileUtils.addConnection(result, conns);
|
||||||
@ -247,10 +261,12 @@ class FtileIfLongVertical extends AbstractFtile {
|
|||||||
class ConnectionVertical extends AbstractConnection {
|
class ConnectionVertical extends AbstractConnection {
|
||||||
|
|
||||||
private final Rainbow color;
|
private final Rainbow color;
|
||||||
|
private final TextBlock label;
|
||||||
|
|
||||||
public ConnectionVertical(Ftile diamond1, Ftile diamond2, Rainbow color) {
|
public ConnectionVertical(Ftile diamond1, Ftile diamond2, Rainbow color, TextBlock label) {
|
||||||
super(diamond1, diamond2);
|
super(diamond1, diamond2);
|
||||||
this.color = color;
|
this.color = color;
|
||||||
|
this.label = label;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawU(UGraphic ug) {
|
public void drawU(UGraphic ug) {
|
||||||
@ -258,7 +274,7 @@ class FtileIfLongVertical extends AbstractFtile {
|
|||||||
final Point2D p1 = getP1(stringBounder);
|
final Point2D p1 = getP1(stringBounder);
|
||||||
final Point2D p2 = getP2(stringBounder);
|
final Point2D p2 = getP2(stringBounder);
|
||||||
|
|
||||||
final Snake snake = Snake.create(color, Arrows.asToDown());
|
final Snake snake = Snake.create(color, Arrows.asToDown()).withLabel(label, VerticalAlignment.CENTER);
|
||||||
snake.addPoint(p1);
|
snake.addPoint(p1);
|
||||||
snake.addPoint(p2);
|
snake.addPoint(p2);
|
||||||
ug.draw(snake);
|
ug.draw(snake);
|
||||||
@ -279,10 +295,12 @@ class FtileIfLongVertical extends AbstractFtile {
|
|||||||
class ConnectionLastElse extends AbstractConnection {
|
class ConnectionLastElse extends AbstractConnection {
|
||||||
|
|
||||||
private final Rainbow arrowColor;
|
private final Rainbow arrowColor;
|
||||||
|
private final TextBlock label;
|
||||||
|
|
||||||
public ConnectionLastElse(Rainbow arrowColor) {
|
public ConnectionLastElse(Rainbow arrowColor, TextBlock label) {
|
||||||
super(diamonds.get(diamonds.size() - 1), tile2);
|
super(diamonds.get(diamonds.size() - 1), tile2);
|
||||||
this.arrowColor = arrowColor;
|
this.arrowColor = arrowColor;
|
||||||
|
this.label = label;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawU(UGraphic ug) {
|
public void drawU(UGraphic ug) {
|
||||||
@ -294,7 +312,7 @@ class FtileIfLongVertical extends AbstractFtile {
|
|||||||
final Point2D p2 = getTranslate2(stringBounder)
|
final Point2D p2 = getTranslate2(stringBounder)
|
||||||
.getTranslated(getFtile2().calculateDimension(stringBounder).getPointIn());
|
.getTranslated(getFtile2().calculateDimension(stringBounder).getPointIn());
|
||||||
|
|
||||||
final Snake snake = Snake.create(arrowColor, Arrows.asToDown());
|
final Snake snake = Snake.create(arrowColor, Arrows.asToDown()).withLabel(label, VerticalAlignment.CENTER);
|
||||||
snake.addPoint(p1);
|
snake.addPoint(p1);
|
||||||
snake.addPoint(p1.getX(), p2.getY() - 15);
|
snake.addPoint(p1.getX(), p2.getY() - 15);
|
||||||
snake.addPoint(p2.getX(), p2.getY() - 15);
|
snake.addPoint(p2.getX(), p2.getY() - 15);
|
||||||
@ -480,21 +498,22 @@ class FtileIfLongVertical extends AbstractFtile {
|
|||||||
|
|
||||||
private FtileGeometry calculateDimensionInternal(StringBounder stringBounder) {
|
private FtileGeometry calculateDimensionInternal(StringBounder stringBounder) {
|
||||||
double col1 = 0;
|
double col1 = 0;
|
||||||
double col1overpass = 0;
|
// double col1overpass = 0;
|
||||||
double col2 = 0;
|
double col2 = 0;
|
||||||
double height = marginy1;
|
double height = marginy1;
|
||||||
for (int i = 0; i < tiles.size(); i++) {
|
for (int i = 0; i < tiles.size(); i++) {
|
||||||
final FtileGeometry dim1 = tiles.get(i).calculateDimension(stringBounder);
|
final FtileGeometry dim1 = tiles.get(i).calculateDimension(stringBounder);
|
||||||
final FtileGeometry diamondOverpassing = ((FtileOverpassing) diamonds.get(i))
|
// final FtileGeometry diamondOverpassing = ((FtileOverpassing) diamonds.get(i))
|
||||||
.getOverpassDimension(stringBounder);
|
// .getOverpassDimension(stringBounder);
|
||||||
final FtileGeometry diamondDim = diamonds.get(i).calculateDimension(stringBounder);
|
final FtileGeometry diamondDim = diamonds.get(i).calculateDimension(stringBounder);
|
||||||
|
|
||||||
height += diamondDim.getHeight() + dim1.getHeight();
|
height += diamondDim.getHeight() + dim1.getHeight();
|
||||||
col1 = Math.max(col1, diamondDim.getWidth());
|
col1 = Math.max(col1, diamondDim.getWidth());
|
||||||
col1overpass = Math.max(col1overpass, diamondOverpassing.getWidth());
|
// col1overpass = Math.max(col1overpass, diamondOverpassing.getWidth());
|
||||||
col2 = Math.max(col2, dim1.getWidth());
|
col2 = Math.max(col2, dim1.getWidth());
|
||||||
}
|
}
|
||||||
final double width = Math.max(col1 + col2, col1overpass);
|
// final double width = Math.max(col1 + col2, col1overpass);
|
||||||
|
final double width = col1 + col2;
|
||||||
FtileGeometry result = new FtileGeometry(width, height, width / 2, 0);
|
FtileGeometry result = new FtileGeometry(width, height, width / 2, 0);
|
||||||
|
|
||||||
final FtileGeometry dimTile2 = tile2.calculateDimension(stringBounder);
|
final FtileGeometry dimTile2 = tile2.calculateDimension(stringBounder);
|
||||||
|
@ -54,7 +54,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
|
|||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.ConnectionTranslatable;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.ConnectionTranslatable;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Hexagon;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileEmpty;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileEmpty;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||||
@ -143,7 +143,7 @@ class FtileRepeat extends AbstractFtile {
|
|||||||
if (noOut && Display.isNull(test)) {
|
if (noOut && Display.isNull(test)) {
|
||||||
diamond2 = new FtileEmpty(repeat.skinParam());
|
diamond2 = new FtileEmpty(repeat.skinParam());
|
||||||
} else {
|
} else {
|
||||||
diamond2 = new FtileDiamondInside(repeat.skinParam(), diamondColor, borderColor, swimlaneOut, tbTest)
|
diamond2 = new FtileDiamondInside(tbTest, repeat.skinParam(), diamondColor, borderColor, swimlaneOut)
|
||||||
.withEast(yesTb).withSouth(outTb);
|
.withEast(yesTb).withSouth(outTb);
|
||||||
}
|
}
|
||||||
result = new FtileRepeat(repeat, diamond1, diamond2, TextBlockUtils.empty(0, 0), backward);
|
result = new FtileRepeat(repeat, diamond1, diamond2, TextBlockUtils.empty(0, 0), backward);
|
||||||
@ -152,8 +152,8 @@ class FtileRepeat extends AbstractFtile {
|
|||||||
.withEast(tbTest);
|
.withEast(tbTest);
|
||||||
result = new FtileRepeat(repeat, diamond1, diamond2, tbTest, backward);
|
result = new FtileRepeat(repeat, diamond1, diamond2, tbTest, backward);
|
||||||
} else if (conditionStyle == ConditionStyle.INSIDE_DIAMOND) {
|
} else if (conditionStyle == ConditionStyle.INSIDE_DIAMOND) {
|
||||||
final Ftile diamond2 = new FtileDiamondSquare(repeat.skinParam(), diamondColor, borderColor, swimlane,
|
final Ftile diamond2 = new FtileDiamondSquare(tbTest, repeat.skinParam(), diamondColor, borderColor,
|
||||||
tbTest);
|
swimlane);
|
||||||
result = new FtileRepeat(repeat, diamond1, diamond2, TextBlockUtils.empty(0, 0), backward);
|
result = new FtileRepeat(repeat, diamond1, diamond2, TextBlockUtils.empty(0, 0), backward);
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
@ -165,9 +165,12 @@ class FtileRepeat extends AbstractFtile {
|
|||||||
: in1.create7(fcArrow, HorizontalAlignment.LEFT, spriteContainer, CreoleMode.SIMPLE_LINE);
|
: in1.create7(fcArrow, HorizontalAlignment.LEFT, spriteContainer, CreoleMode.SIMPLE_LINE);
|
||||||
conns.add(result.new ConnectionIn(repeat.getInLinkRendering().getRainbow(arrowColor), tbin1));
|
conns.add(result.new ConnectionIn(repeat.getInLinkRendering().getRainbow(arrowColor), tbin1));
|
||||||
|
|
||||||
final TextBlock incomingText = incoming1 == null || incoming1.getDisplay() == null ? null
|
final TextBlock incomingText;
|
||||||
: incoming1.getDisplay().create7(fcArrow, HorizontalAlignment.LEFT, spriteContainer,
|
if (incoming1 == null || incoming1.getDisplay() == null)
|
||||||
CreoleMode.SIMPLE_LINE);
|
incomingText = null;
|
||||||
|
else
|
||||||
|
incomingText = incoming1.getDisplay().create7(fcArrow, HorizontalAlignment.LEFT, spriteContainer,
|
||||||
|
CreoleMode.SIMPLE_LINE);
|
||||||
|
|
||||||
if (backward != null) {
|
if (backward != null) {
|
||||||
final Rainbow rainbow1 = incoming1.getRainbow(arrowColor);
|
final Rainbow rainbow1 = incoming1.getRainbow(arrowColor);
|
||||||
@ -326,7 +329,7 @@ class FtileRepeat extends AbstractFtile {
|
|||||||
final double x1_a = p1.getX() + dimDiamond2.getWidth();
|
final double x1_a = p1.getX() + dimDiamond2.getWidth();
|
||||||
|
|
||||||
final double x1_b = p1.getX() + dimDiamond2.getWidth() / 2 + dimRepeat.getWidth() / 2
|
final double x1_b = p1.getX() + dimDiamond2.getWidth() / 2 + dimRepeat.getWidth() / 2
|
||||||
+ Diamond.diamondHalfSize;
|
+ Hexagon.hexagonHalfSize;
|
||||||
|
|
||||||
UPolygon arrow = Arrows.asToLeft();
|
UPolygon arrow = Arrows.asToLeft();
|
||||||
if (x1_b < x2) {
|
if (x1_b < x2) {
|
||||||
@ -499,7 +502,7 @@ class FtileRepeat extends AbstractFtile {
|
|||||||
final double y2 = p2.getY() + dimDiamond1.getHeight() / 2;
|
final double y2 = p2.getY() + dimDiamond1.getHeight() / 2;
|
||||||
|
|
||||||
snake.addPoint(x1, y1);
|
snake.addPoint(x1, y1);
|
||||||
final double xmax = dimTotal.getWidth() - Diamond.diamondHalfSize;
|
final double xmax = dimTotal.getWidth() - Hexagon.hexagonHalfSize;
|
||||||
snake.addPoint(xmax, y1);
|
snake.addPoint(xmax, y1);
|
||||||
snake.addPoint(xmax, y2);
|
snake.addPoint(xmax, y2);
|
||||||
snake.addPoint(x2, y2);
|
snake.addPoint(x2, y2);
|
||||||
@ -527,7 +530,7 @@ class FtileRepeat extends AbstractFtile {
|
|||||||
|
|
||||||
snake.addPoint(x1, y1);
|
snake.addPoint(x1, y1);
|
||||||
final double xmax = p1.getX() + dimDiamond2.getWidth() / 2 + dimRepeat.getWidth() / 2
|
final double xmax = p1.getX() + dimDiamond2.getWidth() / 2 + dimRepeat.getWidth() / 2
|
||||||
+ Diamond.diamondHalfSize;
|
+ Hexagon.hexagonHalfSize;
|
||||||
snake.addPoint(xmax, y1);
|
snake.addPoint(xmax, y1);
|
||||||
snake.addPoint(xmax, y2);
|
snake.addPoint(xmax, y2);
|
||||||
snake.addPoint(x2, y2);
|
snake.addPoint(x2, y2);
|
||||||
@ -562,13 +565,13 @@ class FtileRepeat extends AbstractFtile {
|
|||||||
final double w = tbTest.calculateDimension(stringBounder).getWidth();
|
final double w = tbTest.calculateDimension(stringBounder).getWidth();
|
||||||
|
|
||||||
double width = getLeft(stringBounder) + getRight(stringBounder);
|
double width = getLeft(stringBounder) + getRight(stringBounder);
|
||||||
width = Math.max(width, w + 2 * Diamond.diamondHalfSize);
|
width = Math.max(width, w + 2 * Hexagon.hexagonHalfSize);
|
||||||
if (backward != null) {
|
if (backward != null) {
|
||||||
width += backward.calculateDimension(stringBounder).getWidth();
|
width += backward.calculateDimension(stringBounder).getWidth();
|
||||||
}
|
}
|
||||||
final double height = dimDiamond1.getHeight() + dimRepeat.getHeight() + dimDiamond2.getHeight()
|
final double height = dimDiamond1.getHeight() + dimRepeat.getHeight() + dimDiamond2.getHeight()
|
||||||
+ 8 * Diamond.diamondHalfSize;
|
+ 8 * Hexagon.hexagonHalfSize;
|
||||||
return new Dimension2DDouble(width + 2 * Diamond.diamondHalfSize, height);
|
return new Dimension2DDouble(width + 2 * Hexagon.hexagonHalfSize, height);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,8 +115,8 @@ class FtileSwitch extends AbstractFtile {
|
|||||||
ftileFactory.skinParam());
|
ftileFactory.skinParam());
|
||||||
final HColor diamondColor = branch.getColor() == null ? backColor : branch.getColor();
|
final HColor diamondColor = branch.getColor() == null ? backColor : branch.getColor();
|
||||||
|
|
||||||
FtileDiamondInside2 diamond = new FtileDiamondInside2(branch.skinParam(), diamondColor, borderColor,
|
FtileDiamondInside2 diamond = new FtileDiamondInside2(tbTest, branch.skinParam(), diamondColor,
|
||||||
swimlane, tbTest);
|
borderColor, swimlane);
|
||||||
TextBlock tbInlabel = null;
|
TextBlock tbInlabel = null;
|
||||||
if (Display.isNull(branch.getInlabel())) {
|
if (Display.isNull(branch.getInlabel())) {
|
||||||
inlabelSizes.add(0.0);
|
inlabelSizes.add(0.0);
|
||||||
|
@ -52,7 +52,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
|
|||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.ConnectionTranslatable;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.ConnectionTranslatable;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Hexagon;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||||
@ -127,10 +127,10 @@ class FtileWhile extends AbstractFtile {
|
|||||||
|
|
||||||
final Ftile diamond1;
|
final Ftile diamond1;
|
||||||
if (conditionStyle == ConditionStyle.INSIDE_HEXAGON) {
|
if (conditionStyle == ConditionStyle.INSIDE_HEXAGON) {
|
||||||
diamond1 = new FtileDiamondInside(whileBlock.skinParam(), backColor, borderColor, swimlane, testTb)
|
diamond1 = new FtileDiamondInside(testTb, whileBlock.skinParam(), backColor, borderColor, swimlane)
|
||||||
.withNorth(yesTb).withWest(outTb);
|
.withNorth(yesTb).withWest(outTb);
|
||||||
} else if (conditionStyle == ConditionStyle.INSIDE_DIAMOND) {
|
} else if (conditionStyle == ConditionStyle.INSIDE_DIAMOND) {
|
||||||
diamond1 = new FtileDiamondSquare(whileBlock.skinParam(), backColor, borderColor, swimlane, testTb)
|
diamond1 = new FtileDiamondSquare(testTb, whileBlock.skinParam(), backColor, borderColor, swimlane)
|
||||||
.withNorth(yesTb).withWest(outTb);
|
.withNorth(yesTb).withWest(outTb);
|
||||||
} else if (conditionStyle == ConditionStyle.EMPTY_DIAMOND) {
|
} else if (conditionStyle == ConditionStyle.EMPTY_DIAMOND) {
|
||||||
diamond1 = new FtileDiamond(whileBlock.skinParam(), backColor, borderColor, swimlane).withNorth(testTb)
|
diamond1 = new FtileDiamond(whileBlock.skinParam(), backColor, borderColor, swimlane).withNorth(testTb)
|
||||||
@ -260,7 +260,7 @@ class FtileWhile extends AbstractFtile {
|
|||||||
final Snake snake = Snake.create(endInlinkColor, Arrows.asToLeft()).emphasizeDirection(Direction.UP)
|
final Snake snake = Snake.create(endInlinkColor, Arrows.asToLeft()).emphasizeDirection(Direction.UP)
|
||||||
.withLabel(back, arrowHorizontalAlignment());
|
.withLabel(back, arrowHorizontalAlignment());
|
||||||
snake.addPoint(x1, y1);
|
snake.addPoint(x1, y1);
|
||||||
final double y1bis = Math.max(y1, getBottom(stringBounder)) + Diamond.diamondHalfSize;
|
final double y1bis = Math.max(y1, getBottom(stringBounder)) + Hexagon.hexagonHalfSize;
|
||||||
snake.addPoint(x1, y1bis);
|
snake.addPoint(x1, y1bis);
|
||||||
final double xx = dimTotal.getWidth();
|
final double xx = dimTotal.getWidth();
|
||||||
snake.addPoint(xx, y1bis);
|
snake.addPoint(xx, y1bis);
|
||||||
@ -268,7 +268,7 @@ class FtileWhile extends AbstractFtile {
|
|||||||
snake.addPoint(x2, y2);
|
snake.addPoint(x2, y2);
|
||||||
|
|
||||||
ug.draw(snake);
|
ug.draw(snake);
|
||||||
ug.apply(new UTranslate(x1, y1bis)).draw(new UEmpty(5, Diamond.diamondHalfSize));
|
ug.apply(new UTranslate(x1, y1bis)).draw(new UEmpty(5, Hexagon.hexagonHalfSize));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,15 +291,15 @@ class FtileWhile extends AbstractFtile {
|
|||||||
final double y2 = p2.getY() + dimDiamond1.getInY() + half;
|
final double y2 = p2.getY() + dimDiamond1.getInY() + half;
|
||||||
|
|
||||||
snake.addPoint(x1, y1);
|
snake.addPoint(x1, y1);
|
||||||
snake.addPoint(x1, y1 + Diamond.diamondHalfSize);
|
snake.addPoint(x1, y1 + Hexagon.hexagonHalfSize);
|
||||||
final double xx = Math.max(translate1.getDx(), translate2.getDx()) + dimTotal.getWidth();
|
final double xx = Math.max(translate1.getDx(), translate2.getDx()) + dimTotal.getWidth();
|
||||||
snake.addPoint(xx, y1 + Diamond.diamondHalfSize);
|
snake.addPoint(xx, y1 + Hexagon.hexagonHalfSize);
|
||||||
snake.addPoint(xx, y2);
|
snake.addPoint(xx, y2);
|
||||||
snake.addPoint(x2, y2);
|
snake.addPoint(x2, y2);
|
||||||
|
|
||||||
ug.draw(snake);
|
ug.draw(snake);
|
||||||
|
|
||||||
ug.apply(new UTranslate(x1, y1 + Diamond.diamondHalfSize)).draw(new UEmpty(5, Diamond.diamondHalfSize));
|
ug.apply(new UTranslate(x1, y1 + Hexagon.hexagonHalfSize)).draw(new UEmpty(5, Hexagon.hexagonHalfSize));
|
||||||
|
|
||||||
ug = ug.apply(endInlinkColor.getColor()).apply(endInlinkColor.getColor().bg());
|
ug = ug.apply(endInlinkColor.getColor()).apply(endInlinkColor.getColor().bg());
|
||||||
ug.apply(new UTranslate(xx, (y1 + y2) / 2)).draw(Arrows.asToUp());
|
ug.apply(new UTranslate(xx, (y1 + y2) / 2)).draw(Arrows.asToUp());
|
||||||
@ -352,13 +352,13 @@ class FtileWhile extends AbstractFtile {
|
|||||||
final Snake snake = Snake.create(endInlinkColor, Arrows.asToUp()).withLabel(back,
|
final Snake snake = Snake.create(endInlinkColor, Arrows.asToUp()).withLabel(back,
|
||||||
arrowHorizontalAlignment());
|
arrowHorizontalAlignment());
|
||||||
snake.addPoint(x1, y1);
|
snake.addPoint(x1, y1);
|
||||||
final double y1bis = Math.max(y1, getBottom(stringBounder)) + Diamond.diamondHalfSize;
|
final double y1bis = Math.max(y1, getBottom(stringBounder)) + Hexagon.hexagonHalfSize;
|
||||||
snake.addPoint(x1, y1bis);
|
snake.addPoint(x1, y1bis);
|
||||||
snake.addPoint(x2, y1bis);
|
snake.addPoint(x2, y1bis);
|
||||||
snake.addPoint(x2, y2);
|
snake.addPoint(x2, y2);
|
||||||
|
|
||||||
ug.draw(snake);
|
ug.draw(snake);
|
||||||
ug.apply(new UTranslate(x1, y1bis)).draw(new UEmpty(5, Diamond.diamondHalfSize));
|
ug.apply(new UTranslate(x1, y1bis)).draw(new UEmpty(5, Hexagon.hexagonHalfSize));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -444,7 +444,7 @@ class FtileWhile extends AbstractFtile {
|
|||||||
final double y2 = p2.getY() + dimDiamond1.getInY() + half;
|
final double y2 = p2.getY() + dimDiamond1.getInY() + half;
|
||||||
|
|
||||||
snake.addPoint(x1, y1);
|
snake.addPoint(x1, y1);
|
||||||
final double y1bis = Math.max(y1, getBottom(stringBounder)) + Diamond.diamondHalfSize;
|
final double y1bis = Math.max(y1, getBottom(stringBounder)) + Hexagon.hexagonHalfSize;
|
||||||
snake.addPoint(x1, y1bis);
|
snake.addPoint(x1, y1bis);
|
||||||
final double xx = dimTotal.getWidth();
|
final double xx = dimTotal.getWidth();
|
||||||
snake.addPoint(xx, y1bis);
|
snake.addPoint(xx, y1bis);
|
||||||
@ -453,7 +453,7 @@ class FtileWhile extends AbstractFtile {
|
|||||||
|
|
||||||
ug.draw(snake);
|
ug.draw(snake);
|
||||||
|
|
||||||
ug.apply(new UTranslate(x1, y1bis)).draw(new UEmpty(5, Diamond.diamondHalfSize));
|
ug.apply(new UTranslate(x1, y1bis)).draw(new UEmpty(5, Hexagon.hexagonHalfSize));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -493,13 +493,13 @@ class FtileWhile extends AbstractFtile {
|
|||||||
final double y2 = p2.getY();
|
final double y2 = p2.getY();
|
||||||
|
|
||||||
snake.addPoint(x1, y1);
|
snake.addPoint(x1, y1);
|
||||||
snake.addPoint(Diamond.diamondHalfSize, y1);
|
snake.addPoint(Hexagon.hexagonHalfSize, y1);
|
||||||
snake.addPoint(Diamond.diamondHalfSize, y2);
|
snake.addPoint(Hexagon.hexagonHalfSize, y2);
|
||||||
|
|
||||||
ug.draw(snake);
|
ug.draw(snake);
|
||||||
|
|
||||||
final Snake snake2 = Snake.create(afterEndwhileColor);
|
final Snake snake2 = Snake.create(afterEndwhileColor);
|
||||||
snake2.addPoint(Diamond.diamondHalfSize, y2);
|
snake2.addPoint(Hexagon.hexagonHalfSize, y2);
|
||||||
snake2.addPoint(x2, y2);
|
snake2.addPoint(x2, y2);
|
||||||
// snake2.goUnmergeable(MergeStrategy.LIMITED);
|
// snake2.goUnmergeable(MergeStrategy.LIMITED);
|
||||||
ug.draw(snake2);
|
ug.draw(snake2);
|
||||||
@ -579,14 +579,14 @@ class FtileWhile extends AbstractFtile {
|
|||||||
assert false;
|
assert false;
|
||||||
}
|
}
|
||||||
final FtileGeometry geo = geoDiamond1.appendBottom(geoWhile);
|
final FtileGeometry geo = geoDiamond1.appendBottom(geoWhile);
|
||||||
final double height = geo.getHeight() + 4 * Diamond.diamondHalfSize;
|
final double height = geo.getHeight() + 4 * Hexagon.hexagonHalfSize;
|
||||||
final double dx = 2 * Diamond.diamondHalfSize;
|
final double dx = 2 * Hexagon.hexagonHalfSize;
|
||||||
double backwardWidth = 0;
|
double backwardWidth = 0;
|
||||||
if (backward != null) {
|
if (backward != null) {
|
||||||
backwardWidth += backward.calculateDimension(stringBounder).getWidth();
|
backwardWidth += backward.calculateDimension(stringBounder).getWidth();
|
||||||
}
|
}
|
||||||
return new FtileGeometry(
|
return new FtileGeometry(
|
||||||
xDeltaBecauseSpecial(stringBounder) + geo.getWidth() + dx + Diamond.diamondHalfSize + backwardWidth,
|
xDeltaBecauseSpecial(stringBounder) + geo.getWidth() + dx + Hexagon.hexagonHalfSize + backwardWidth,
|
||||||
height, xDeltaBecauseSpecial(stringBounder) + geo.getLeft() + dx, geoDiamond1.getInY(), height);
|
height, xDeltaBecauseSpecial(stringBounder) + geo.getLeft() + dx, geoDiamond1.getInY(), height);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -635,8 +635,8 @@ class FtileWhile extends AbstractFtile {
|
|||||||
private UTranslate getTranslateForSpecial(StringBounder stringBounder) {
|
private UTranslate getTranslateForSpecial(StringBounder stringBounder) {
|
||||||
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
||||||
final double half = (dimDiamond1.getOutY() - dimDiamond1.getInY()) / 2;
|
final double half = (dimDiamond1.getOutY() - dimDiamond1.getInY()) / 2;
|
||||||
final double y1 = Math.max(3 * half, 4 * Diamond.diamondHalfSize);
|
final double y1 = Math.max(3 * half, 4 * Hexagon.hexagonHalfSize);
|
||||||
final double xWhile = getTranslateForWhile(stringBounder).getDx() - Diamond.diamondHalfSize;
|
final double xWhile = getTranslateForWhile(stringBounder).getDx() - Hexagon.hexagonHalfSize;
|
||||||
final double xDiamond = getTranslateDiamond1(stringBounder).getDx();
|
final double xDiamond = getTranslateDiamond1(stringBounder).getDx();
|
||||||
// final double x1 = xWhile - xDeltaBecauseSpecial(stringBounder);
|
// final double x1 = xWhile - xDeltaBecauseSpecial(stringBounder);
|
||||||
final double x1 = Math.min(xWhile, xDiamond) - xDeltaBecauseSpecial(stringBounder);
|
final double x1 = Math.min(xWhile, xDiamond) - xDeltaBecauseSpecial(stringBounder);
|
||||||
|
@ -84,7 +84,6 @@ public class FtileWithNoteOpale extends AbstractFtile implements Stencil, Stylea
|
|||||||
private final Ftile tile;
|
private final Ftile tile;
|
||||||
private final Opale opale;
|
private final Opale opale;
|
||||||
|
|
||||||
// private final HtmlColor arrowColor;
|
|
||||||
private final NotePosition notePosition;
|
private final NotePosition notePosition;
|
||||||
private final double suppSpace = 20;
|
private final double suppSpace = 20;
|
||||||
private final Swimlane swimlaneNote;
|
private final Swimlane swimlaneNote;
|
||||||
@ -184,6 +183,13 @@ public class FtileWithNoteOpale extends AbstractFtile implements Stencil, Stylea
|
|||||||
}
|
}
|
||||||
|
|
||||||
return new UTranslate(marge, yForFtile);
|
return new UTranslate(marge, yForFtile);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UTranslate getTranslateFor(Ftile child, StringBounder stringBounder) {
|
||||||
|
if (child == tile)
|
||||||
|
return new UTranslate();
|
||||||
|
return super.getTranslateFor(child, stringBounder);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ import net.sourceforge.plantuml.LineBreakStrategy;
|
|||||||
import net.sourceforge.plantuml.Url;
|
import net.sourceforge.plantuml.Url;
|
||||||
import net.sourceforge.plantuml.UseStyle;
|
import net.sourceforge.plantuml.UseStyle;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.Branch;
|
import net.sourceforge.plantuml.activitydiagram3.Branch;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Hexagon;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileEmpty;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileEmpty;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||||
@ -180,8 +180,8 @@ public class ConditionalBuilder {
|
|||||||
final Ftile tile2 = new FtileMinWidthCentered(branch2.getFtile(), 30);
|
final Ftile tile2 = new FtileMinWidthCentered(branch2.getFtile(), 30);
|
||||||
final TextBlock tb1 = getLabelPositive(branch1);
|
final TextBlock tb1 = getLabelPositive(branch1);
|
||||||
final TextBlock tb2 = getLabelPositive(branch2);
|
final TextBlock tb2 = getLabelPositive(branch2);
|
||||||
final Ftile diamond1 = getDiamond1(false, tb1, tb2);
|
final Ftile diamond1 = getShape1(false, tb1, tb2);
|
||||||
final Ftile diamond2 = getDiamond2(branch1, branch2, true);
|
final Ftile diamond2 = getShape2(branch1, branch2, true);
|
||||||
if (branch2.isOnlySingleStopOrSpot()) {
|
if (branch2.isOnlySingleStopOrSpot()) {
|
||||||
return FtileIfDown.create(diamond1, diamond2, swimlane, FtileUtils.addHorizontalMargin(tile1, 10),
|
return FtileIfDown.create(diamond1, diamond2, swimlane, FtileUtils.addHorizontalMargin(tile1, 10),
|
||||||
arrowColor, conditionEndStyle, ftileFactory, branch2.getFtile(), branch2.getOut());
|
arrowColor, conditionEndStyle, ftileFactory, branch2.getFtile(), branch2.getOut());
|
||||||
@ -205,7 +205,7 @@ public class ConditionalBuilder {
|
|||||||
|
|
||||||
private Ftile createWithDiamonds() {
|
private Ftile createWithDiamonds() {
|
||||||
final Ftile diamond1 = getDiamond1(true);
|
final Ftile diamond1 = getDiamond1(true);
|
||||||
final Ftile diamond2 = getDiamond2(branch1, branch2, false);
|
final Ftile diamond2 = getShape2(branch1, branch2, false);
|
||||||
final FtileIfWithDiamonds ftile = new FtileIfWithDiamonds(diamond1, tile1, tile2, diamond2, swimlane,
|
final FtileIfWithDiamonds ftile = new FtileIfWithDiamonds(diamond1, tile1, tile2, diamond2, swimlane,
|
||||||
stringBounder);
|
stringBounder);
|
||||||
final Dimension2D label1 = getLabelPositive(branch1).calculateDimension(stringBounder);
|
final Dimension2D label1 = getLabelPositive(branch1).calculateDimension(stringBounder);
|
||||||
@ -223,7 +223,7 @@ public class ConditionalBuilder {
|
|||||||
if (url != null) {
|
if (url != null) {
|
||||||
diamond1 = new FtileWithUrl(diamond1, url);
|
diamond1 = new FtileWithUrl(diamond1, url);
|
||||||
}
|
}
|
||||||
final Ftile diamond2 = getDiamond2(branch1, branch2, false);
|
final Ftile diamond2 = getShape2(branch1, branch2, false);
|
||||||
final Ftile tmp1 = FtileUtils.addHorizontalMargin(tile1, 10);
|
final Ftile tmp1 = FtileUtils.addHorizontalMargin(tile1, 10);
|
||||||
final Ftile tmp2 = FtileUtils.addHorizontalMargin(tile2, 10);
|
final Ftile tmp2 = FtileUtils.addHorizontalMargin(tile2, 10);
|
||||||
final FtileIfWithLinks ftile = new FtileIfWithLinks(diamond1, tmp1, tmp2, diamond2, swimlane, arrowColor,
|
final FtileIfWithLinks ftile = new FtileIfWithLinks(diamond1, tmp1, tmp2, diamond2, swimlane, arrowColor,
|
||||||
@ -240,46 +240,46 @@ public class ConditionalBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Ftile getDiamond1(boolean eastWest) {
|
private Ftile getDiamond1(boolean eastWest) {
|
||||||
return getDiamond1(eastWest, getLabelPositive(branch1), getLabelPositive(branch2));
|
return getShape1(eastWest, getLabelPositive(branch1), getLabelPositive(branch2));
|
||||||
}
|
}
|
||||||
|
|
||||||
private Ftile getDiamond1(boolean eastWest, TextBlock tb1, TextBlock tb2) {
|
private Ftile getShape1(boolean eastWest, TextBlock tb1, TextBlock tb2) {
|
||||||
final Display labelTest = branch1.getLabelTest();
|
final Display labelTest = branch1.getLabelTest();
|
||||||
|
|
||||||
final Sheet sheet = Parser.build(fontTest, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT),
|
final Sheet sheet = Parser.build(fontTest, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT),
|
||||||
skinParam, CreoleMode.FULL).createSheet(labelTest);
|
skinParam, CreoleMode.FULL).createSheet(labelTest);
|
||||||
final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, diamondLineBreak, skinParam.getPadding());
|
final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, diamondLineBreak, skinParam.getPadding());
|
||||||
final TextBlock tbTest = new SheetBlock2(sheetBlock1, Diamond.asStencil(sheetBlock1), tile1.getThickness());
|
final TextBlock tbTest = new SheetBlock2(sheetBlock1, Hexagon.asStencil(sheetBlock1), tile1.getThickness());
|
||||||
|
|
||||||
final Ftile diamond1;
|
final Ftile shape1;
|
||||||
if (conditionStyle == ConditionStyle.INSIDE_HEXAGON) {
|
if (conditionStyle == ConditionStyle.INSIDE_HEXAGON) {
|
||||||
if (eastWest) {
|
if (eastWest) {
|
||||||
diamond1 = new FtileDiamondInside(tile1.skinParam(), backColor, borderColor, swimlane, tbTest)
|
shape1 = new FtileDiamondInside(tbTest, tile1.skinParam(), backColor, borderColor, swimlane)
|
||||||
.withWestAndEast(tb1, tb2);
|
.withWestAndEast(tb1, tb2);
|
||||||
} else {
|
} else {
|
||||||
diamond1 = new FtileDiamondInside(tile1.skinParam(), backColor, borderColor, swimlane, tbTest)
|
shape1 = new FtileDiamondInside(tbTest, tile1.skinParam(), backColor, borderColor, swimlane)
|
||||||
.withSouth(tb1).withEast(tb2);
|
.withSouth(tb1).withEast(tb2);
|
||||||
}
|
}
|
||||||
} else if (conditionStyle == ConditionStyle.EMPTY_DIAMOND) {
|
} else if (conditionStyle == ConditionStyle.EMPTY_DIAMOND) {
|
||||||
if (eastWest) {
|
if (eastWest) {
|
||||||
diamond1 = new FtileDiamond(tile1.skinParam(), backColor, borderColor, swimlane).withNorth(tbTest)
|
shape1 = new FtileDiamond(tile1.skinParam(), backColor, borderColor, swimlane).withNorth(tbTest)
|
||||||
.withWestAndEast(tb1, tb2);
|
.withWestAndEast(tb1, tb2);
|
||||||
} else {
|
} else {
|
||||||
diamond1 = new FtileDiamond(tile1.skinParam(), backColor, borderColor, swimlane).withNorth(tbTest)
|
shape1 = new FtileDiamond(tile1.skinParam(), backColor, borderColor, swimlane).withNorth(tbTest)
|
||||||
.withSouth(tb1).withEast(tb2);
|
.withSouth(tb1).withEast(tb2);
|
||||||
}
|
}
|
||||||
} else if (conditionStyle == ConditionStyle.INSIDE_DIAMOND) {
|
} else if (conditionStyle == ConditionStyle.INSIDE_DIAMOND) {
|
||||||
if (eastWest) {
|
if (eastWest) {
|
||||||
diamond1 = new FtileDiamondSquare(tile1.skinParam(), backColor, borderColor, swimlane, tbTest)
|
shape1 = new FtileDiamondSquare(tbTest, tile1.skinParam(), backColor, borderColor, swimlane)
|
||||||
.withWestAndEast(tb1, tb2);
|
.withWestAndEast(tb1, tb2);
|
||||||
} else {
|
} else {
|
||||||
diamond1 = new FtileDiamondSquare(tile1.skinParam(), backColor, borderColor, swimlane, tbTest)
|
shape1 = new FtileDiamondSquare(tbTest, tile1.skinParam(), backColor, borderColor, swimlane)
|
||||||
.withSouth(tb1).withEast(tb2);
|
.withSouth(tb1).withEast(tb2);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
return diamond1;
|
return shape1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private TextBlock getLabelPositive(Branch branch) {
|
private TextBlock getLabelPositive(Branch branch) {
|
||||||
@ -287,10 +287,10 @@ public class ConditionalBuilder {
|
|||||||
labelLineBreak, CreoleMode.SIMPLE_LINE, null, null);
|
labelLineBreak, CreoleMode.SIMPLE_LINE, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Ftile getDiamond2(Branch branch1, Branch branch2, boolean useNorth) {
|
private Ftile getShape2(Branch branch1, Branch branch2, boolean useNorth) {
|
||||||
final Ftile diamond2;
|
final Ftile shape2;
|
||||||
if (conditionEndStyle == ConditionEndStyle.HLINE) {
|
if (conditionEndStyle == ConditionEndStyle.HLINE) {
|
||||||
return new FtileEmpty(tile1.skinParam(), 0, Diamond.diamondHalfSize, swimlane, swimlane);
|
return new FtileEmpty(tile1.skinParam(), 0, Hexagon.hexagonHalfSize, swimlane, swimlane);
|
||||||
}
|
}
|
||||||
// else use default ConditionEndStyle.DIAMOND
|
// else use default ConditionEndStyle.DIAMOND
|
||||||
if (hasTwoBranches()) {
|
if (hasTwoBranches()) {
|
||||||
@ -305,11 +305,11 @@ public class ConditionalBuilder {
|
|||||||
FtileDiamond tmp = new FtileDiamond(tile1.skinParam(), backColor, borderColor, swimlane);
|
FtileDiamond tmp = new FtileDiamond(tile1.skinParam(), backColor, borderColor, swimlane);
|
||||||
tmp = useNorth ? tmp.withNorth(tbout1) : tmp.withWest(tbout1);
|
tmp = useNorth ? tmp.withNorth(tbout1) : tmp.withWest(tbout1);
|
||||||
tmp = tmp.withEast(tbout2);
|
tmp = tmp.withEast(tbout2);
|
||||||
diamond2 = tmp;
|
shape2 = tmp;
|
||||||
} else {
|
} else {
|
||||||
diamond2 = new FtileEmpty(tile1.skinParam(), 0, Diamond.diamondHalfSize / 2, swimlane, swimlane);
|
shape2 = new FtileEmpty(tile1.skinParam(), 0, Hexagon.hexagonHalfSize / 2, swimlane, swimlane);
|
||||||
}
|
}
|
||||||
return diamond2;
|
return shape2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasTwoBranches() {
|
public boolean hasTwoBranches() {
|
||||||
|
@ -46,7 +46,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection;
|
|||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.ConnectionTranslatable;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.ConnectionTranslatable;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Hexagon;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
|
||||||
@ -145,7 +145,7 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
|
|||||||
p2 = translate2.getTranslated(p2);
|
p2 = translate2.getTranslated(p2);
|
||||||
final Direction newDirection = Direction.leftOrRight(p1, p2);
|
final Direction newDirection = Direction.leftOrRight(p1, p2);
|
||||||
if (originalDirection != newDirection) {
|
if (originalDirection != newDirection) {
|
||||||
final double delta = (originalDirection == Direction.RIGHT ? -1 : 1) * Diamond.diamondHalfSize;
|
final double delta = (originalDirection == Direction.RIGHT ? -1 : 1) * Hexagon.hexagonHalfSize;
|
||||||
final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
||||||
final Snake small = Snake.create(color);
|
final Snake small = Snake.create(color);
|
||||||
small.addPoint(p1);
|
small.addPoint(p1);
|
||||||
@ -242,7 +242,7 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
|
|||||||
final Direction newDirection = Direction.leftOrRight(mp1a, mp2b);
|
final Direction newDirection = Direction.leftOrRight(mp1a, mp2b);
|
||||||
final UPolygon arrow = x2 > x1 ? Arrows.asToRight() : Arrows.asToLeft();
|
final UPolygon arrow = x2 > x1 ? Arrows.asToRight() : Arrows.asToLeft();
|
||||||
if (originalDirection == newDirection) {
|
if (originalDirection == newDirection) {
|
||||||
final double delta = (x2 > x1 ? -1 : 1) * 1.5 * Diamond.diamondHalfSize;
|
final double delta = (x2 > x1 ? -1 : 1) * 1.5 * Hexagon.hexagonHalfSize;
|
||||||
final Point2D mp2bc = new Point2D.Double(mp2b.getX() + delta, mp2b.getY());
|
final Point2D mp2bc = new Point2D.Double(mp2b.getX() + delta, mp2b.getY());
|
||||||
final Snake snake = Snake.create(myArrowColor).withMerge(MergeStrategy.LIMITED);
|
final Snake snake = Snake.create(myArrowColor).withMerge(MergeStrategy.LIMITED);
|
||||||
final double middle = (mp1a.getY() + mp2b.getY()) / 2.0;
|
final double middle = (mp1a.getY() + mp2b.getY()) / 2.0;
|
||||||
@ -257,9 +257,9 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
|
|||||||
small.addPoint(mp2b);
|
small.addPoint(mp2b);
|
||||||
ug.draw(small);
|
ug.draw(small);
|
||||||
} else {
|
} else {
|
||||||
final double delta = (x2 > x1 ? -1 : 1) * 1.5 * Diamond.diamondHalfSize;
|
final double delta = (x2 > x1 ? -1 : 1) * 1.5 * Hexagon.hexagonHalfSize;
|
||||||
final Point2D mp2bb = new Point2D.Double(mp2b.getX() + delta,
|
final Point2D mp2bb = new Point2D.Double(mp2b.getX() + delta,
|
||||||
mp2b.getY() - 1.5 * Diamond.diamondHalfSize);
|
mp2b.getY() - 1.5 * Hexagon.hexagonHalfSize);
|
||||||
final Snake snake = Snake.create(myArrowColor).withMerge(MergeStrategy.LIMITED);
|
final Snake snake = Snake.create(myArrowColor).withMerge(MergeStrategy.LIMITED);
|
||||||
snake.addPoint(mp1a);
|
snake.addPoint(mp1a);
|
||||||
snake.addPoint(mp1a.getX(), mp2bb.getY());
|
snake.addPoint(mp1a.getX(), mp2bb.getY());
|
||||||
@ -325,7 +325,7 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final Point2D p1 = geo.translate(translate(stringBounder)).getPointOut();
|
final Point2D p1 = geo.translate(translate(stringBounder)).getPointOut();
|
||||||
final Point2D p2 = new Point2D.Double(dimTotal.getLeft(), dimTotal.getHeight() - Diamond.diamondHalfSize);
|
final Point2D p2 = new Point2D.Double(dimTotal.getLeft(), dimTotal.getHeight() - Hexagon.hexagonHalfSize);
|
||||||
|
|
||||||
final Point2D mp1a = translate1.getTranslated(p1);
|
final Point2D mp1a = translate1.getTranslated(p1);
|
||||||
final Point2D mp2b = translate2.getTranslated(p2);
|
final Point2D mp2b = translate2.getTranslated(p2);
|
||||||
|
@ -41,6 +41,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import net.sourceforge.plantuml.Direction;
|
import net.sourceforge.plantuml.Direction;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.Branch;
|
import net.sourceforge.plantuml.activitydiagram3.Branch;
|
||||||
|
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
|
||||||
@ -49,8 +50,10 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
|||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||||
import net.sourceforge.plantuml.graphic.Rainbow;
|
import net.sourceforge.plantuml.graphic.Rainbow;
|
||||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||||
|
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||||
import net.sourceforge.plantuml.graphic.VerticalAlignment;
|
import net.sourceforge.plantuml.graphic.VerticalAlignment;
|
||||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||||
import net.sourceforge.plantuml.ugraphic.UPolygon;
|
import net.sourceforge.plantuml.ugraphic.UPolygon;
|
||||||
@ -85,8 +88,8 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
|
|||||||
final double x2 = p2.getX();
|
final double x2 = p2.getX();
|
||||||
final double y2 = p2.getY();
|
final double y2 = p2.getY();
|
||||||
|
|
||||||
final Snake snake = Snake.create(null, arrowColor, Arrows.asToDown()).withLabel(branch.getTextBlockPositive(),
|
final Snake snake = Snake.create(null, arrowColor, Arrows.asToDown())
|
||||||
arrowHorizontalAlignment());
|
.withLabel(branch.getTextBlockPositive(), arrowHorizontalAlignment());
|
||||||
snake.addPoint(x1, y1);
|
snake.addPoint(x1, y1);
|
||||||
snake.addPoint(x2, y1);
|
snake.addPoint(x2, y1);
|
||||||
snake.addPoint(x2, y2);
|
snake.addPoint(x2, y2);
|
||||||
@ -116,8 +119,11 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
|
|||||||
|
|
||||||
class ConnectionVerticalThenHorizontal extends AbstractConnection {
|
class ConnectionVerticalThenHorizontal extends AbstractConnection {
|
||||||
|
|
||||||
public ConnectionVerticalThenHorizontal(Ftile tile) {
|
private final TextBlock outLabel;
|
||||||
|
|
||||||
|
public ConnectionVerticalThenHorizontal(Ftile tile, TextBlock outLabel) {
|
||||||
super(tile, diamond2);
|
super(tile, diamond2);
|
||||||
|
this.outLabel = outLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawU(UGraphic ug) {
|
public void drawU(UGraphic ug) {
|
||||||
@ -154,7 +160,7 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
|
|||||||
final double x2 = p2.getX();
|
final double x2 = p2.getX();
|
||||||
final double y2 = p2.getY();
|
final double y2 = p2.getY();
|
||||||
|
|
||||||
final Snake snake = Snake.create(arrowColor, arrow);
|
final Snake snake = Snake.create(arrowColor, arrow).withLabel(outLabel, VerticalAlignment.CENTER);
|
||||||
snake.addPoint(x1, y1);
|
snake.addPoint(x1, y1);
|
||||||
if (direction == Direction.LEFT && x2 > x1 - 10) {
|
if (direction == Direction.LEFT && x2 > x1 - 10) {
|
||||||
snake.addPoint(x1, y2 - 8);
|
snake.addPoint(x1, y2 - 8);
|
||||||
@ -195,8 +201,8 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
|
|||||||
final double x2 = p2.getX();
|
final double x2 = p2.getX();
|
||||||
final double y2 = p2.getY();
|
final double y2 = p2.getY();
|
||||||
|
|
||||||
final Snake snake = Snake.create(null, arrowColor, Arrows.asToDown()).withLabel(branch.getTextBlockPositive(),
|
final Snake snake = Snake.create(null, arrowColor, Arrows.asToDown())
|
||||||
VerticalAlignment.CENTER);
|
.withLabel(branch.getTextBlockPositive(), VerticalAlignment.CENTER);
|
||||||
if (x2 < p1d.getX() - margin || x2 > p1b.getX() + margin) {
|
if (x2 < p1d.getX() - margin || x2 > p1b.getX() + margin) {
|
||||||
snake.addPoint(x2, p1d.getY());
|
snake.addPoint(x2, p1d.getY());
|
||||||
snake.addPoint(x2, y2);
|
snake.addPoint(x2, y2);
|
||||||
@ -222,8 +228,11 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
|
|||||||
|
|
||||||
class ConnectionVerticalBottom extends AbstractConnection {
|
class ConnectionVerticalBottom extends AbstractConnection {
|
||||||
|
|
||||||
public ConnectionVerticalBottom(Ftile tile) {
|
final private TextBlock outLabel;
|
||||||
|
|
||||||
|
public ConnectionVerticalBottom(Ftile tile, TextBlock textBlock) {
|
||||||
super(tile, diamond2);
|
super(tile, diamond2);
|
||||||
|
this.outLabel = textBlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawU(UGraphic ug) {
|
public void drawU(UGraphic ug) {
|
||||||
@ -248,7 +257,8 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
|
|||||||
|
|
||||||
final double ym = (y1 + y2) / 2;
|
final double ym = (y1 + y2) / 2;
|
||||||
|
|
||||||
final Snake snake = Snake.create(null, arrowColor, Arrows.asToDown());
|
final Snake snake = Snake.create(null, arrowColor, Arrows.asToDown()).withLabel(outLabel,
|
||||||
|
VerticalAlignment.CENTER);
|
||||||
|
|
||||||
if (x1 < p1d.getX() - margin || x1 > p1b.getX() + margin) {
|
if (x1 < p1d.getX() - margin || x1 > p1b.getX() + margin) {
|
||||||
snake.addPoint(x1, y1);
|
snake.addPoint(x1, y1);
|
||||||
@ -303,13 +313,15 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
|
|||||||
final int firstOutgoingArrow = getFirstOutgoingArrow(stringBounder);
|
final int firstOutgoingArrow = getFirstOutgoingArrow(stringBounder);
|
||||||
final int lastOutgoingArrow = getLastOutgoingArrow(stringBounder);
|
final int lastOutgoingArrow = getLastOutgoingArrow(stringBounder);
|
||||||
if (firstOutgoingArrow < tiles.size())
|
if (firstOutgoingArrow < tiles.size())
|
||||||
conns.add(new ConnectionVerticalThenHorizontal(tiles.get(firstOutgoingArrow)));
|
conns.add(new ConnectionVerticalThenHorizontal(tiles.get(firstOutgoingArrow),
|
||||||
|
branches.get(firstOutgoingArrow).getTextBlockSpecial()));
|
||||||
if (lastOutgoingArrow > 0)
|
if (lastOutgoingArrow > 0)
|
||||||
conns.add(new ConnectionVerticalThenHorizontal(tiles.get(lastOutgoingArrow)));
|
conns.add(new ConnectionVerticalThenHorizontal(tiles.get(lastOutgoingArrow),
|
||||||
|
branches.get(lastOutgoingArrow).getTextBlockSpecial()));
|
||||||
for (int i = firstOutgoingArrow + 1; i < lastOutgoingArrow; i++) {
|
for (int i = firstOutgoingArrow + 1; i < lastOutgoingArrow; i++) {
|
||||||
final Ftile tile = tiles.get(i);
|
final Ftile tile = tiles.get(i);
|
||||||
if (tile.calculateDimension(stringBounder).hasPointOut()) {
|
if (tile.calculateDimension(stringBounder).hasPointOut()) {
|
||||||
conns.add(new ConnectionVerticalBottom(tile));
|
conns.add(new ConnectionVerticalBottom(tile, branches.get(i).getTextBlockSpecial()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,6 @@ import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft;
|
|||||||
import net.sourceforge.plantuml.style.PName;
|
import net.sourceforge.plantuml.style.PName;
|
||||||
import net.sourceforge.plantuml.style.SName;
|
import net.sourceforge.plantuml.style.SName;
|
||||||
import net.sourceforge.plantuml.style.Style;
|
import net.sourceforge.plantuml.style.Style;
|
||||||
import net.sourceforge.plantuml.style.StyleBuilder;
|
|
||||||
import net.sourceforge.plantuml.style.StyleSignature;
|
import net.sourceforge.plantuml.style.StyleSignature;
|
||||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||||
|
@ -73,7 +73,6 @@ import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft;
|
|||||||
import net.sourceforge.plantuml.style.PName;
|
import net.sourceforge.plantuml.style.PName;
|
||||||
import net.sourceforge.plantuml.style.SName;
|
import net.sourceforge.plantuml.style.SName;
|
||||||
import net.sourceforge.plantuml.style.Style;
|
import net.sourceforge.plantuml.style.Style;
|
||||||
import net.sourceforge.plantuml.style.StyleBuilder;
|
|
||||||
import net.sourceforge.plantuml.style.StyleSignature;
|
import net.sourceforge.plantuml.style.StyleSignature;
|
||||||
import net.sourceforge.plantuml.ugraphic.UEmpty;
|
import net.sourceforge.plantuml.ugraphic.UEmpty;
|
||||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||||
|
@ -35,6 +35,8 @@
|
|||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml.activitydiagram3.ftile.vertical;
|
package net.sourceforge.plantuml.activitydiagram3.ftile.vertical;
|
||||||
|
|
||||||
|
import java.awt.geom.Dimension2D;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||||
@ -46,7 +48,11 @@ public class FtileDecorateInLabel extends FtileDecorate {
|
|||||||
final private double xl;
|
final private double xl;
|
||||||
final private double yl;
|
final private double yl;
|
||||||
|
|
||||||
public FtileDecorateInLabel(final Ftile ftile, double xl, double yl) {
|
public FtileDecorateInLabel(Ftile ftile, Dimension2D dim) {
|
||||||
|
this(ftile, dim.getWidth(), dim.getHeight());
|
||||||
|
}
|
||||||
|
|
||||||
|
private FtileDecorateInLabel(final Ftile ftile, double xl, double yl) {
|
||||||
super(ftile);
|
super(ftile);
|
||||||
this.xl = xl;
|
this.xl = xl;
|
||||||
this.yl = yl;
|
this.yl = yl;
|
||||||
|
@ -0,0 +1,76 @@
|
|||||||
|
/* ========================================================================
|
||||||
|
* PlantUML : a free UML diagram generator
|
||||||
|
* ========================================================================
|
||||||
|
*
|
||||||
|
* (C) Copyright 2009-2020, Arnaud Roques
|
||||||
|
*
|
||||||
|
* Project Info: http://plantuml.com
|
||||||
|
*
|
||||||
|
* If you like this project or if you find it useful, you can support us at:
|
||||||
|
*
|
||||||
|
* http://plantuml.com/patreon (only 1$ per month!)
|
||||||
|
* http://plantuml.com/paypal
|
||||||
|
*
|
||||||
|
* This file is part of PlantUML.
|
||||||
|
*
|
||||||
|
* PlantUML is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* PlantUML distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||||
|
* License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||||
|
* USA.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Original Author: Arnaud Roques
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package net.sourceforge.plantuml.activitydiagram3.ftile.vertical;
|
||||||
|
|
||||||
|
import java.awt.geom.Dimension2D;
|
||||||
|
|
||||||
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||||
|
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||||
|
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||||
|
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||||
|
|
||||||
|
public class FtileDecorateOutLabel extends FtileDecorate {
|
||||||
|
|
||||||
|
final private double xl;
|
||||||
|
final private double yl;
|
||||||
|
|
||||||
|
public FtileDecorateOutLabel(Ftile ftile, Dimension2D dim) {
|
||||||
|
this(ftile, dim.getWidth(), dim.getHeight());
|
||||||
|
}
|
||||||
|
|
||||||
|
private FtileDecorateOutLabel(Ftile ftile, double xl, double yl) {
|
||||||
|
super(ftile);
|
||||||
|
this.xl = xl;
|
||||||
|
this.yl = yl;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FtileGeometry calculateDimension(StringBounder stringBounder) {
|
||||||
|
FtileGeometry result = super.calculateDimension(stringBounder);
|
||||||
|
result = result.addBottom(yl);
|
||||||
|
final double missing = xl - result.getRight();
|
||||||
|
if (missing > 0)
|
||||||
|
result = result.incRight(missing);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawU(UGraphic ug) {
|
||||||
|
super.drawU(ug);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -36,136 +36,81 @@
|
|||||||
package net.sourceforge.plantuml.activitydiagram3.ftile.vertical;
|
package net.sourceforge.plantuml.activitydiagram3.ftile.vertical;
|
||||||
|
|
||||||
import java.awt.geom.Dimension2D;
|
import java.awt.geom.Dimension2D;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||||
import net.sourceforge.plantuml.ISkinParam;
|
import net.sourceforge.plantuml.ISkinParam;
|
||||||
import net.sourceforge.plantuml.UseStyle;
|
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
|
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
|
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||||
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Hexagon;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||||
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.UGraphic;
|
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||||
|
|
||||||
public class FtileDiamond extends AbstractFtile {
|
public class FtileDiamond extends FtileDiamondWIP {
|
||||||
|
|
||||||
private final HColor backColor;
|
|
||||||
private final HColor borderColor;
|
|
||||||
private final Swimlane swimlane;
|
|
||||||
private final TextBlock north;
|
|
||||||
private final TextBlock south;
|
|
||||||
private final TextBlock west1;
|
|
||||||
private final TextBlock east1;
|
|
||||||
private final double shadowing;
|
|
||||||
|
|
||||||
public FtileDiamond(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane) {
|
public FtileDiamond(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane) {
|
||||||
this(skinParam, backColor, borderColor, swimlane, TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0),
|
this(skinParam, backColor, borderColor, swimlane, TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0),
|
||||||
TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0));
|
TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
public StyleSignature getDefaultStyleDefinitionDiamond() {
|
|
||||||
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.diamond);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Collection<Ftile> getMyChildren() {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public FtileDiamond withNorth(TextBlock north) {
|
public FtileDiamond withNorth(TextBlock north) {
|
||||||
return new FtileDiamond(skinParam(), backColor, borderColor, swimlane, north, south, east1, west1);
|
return new FtileDiamond(skinParam(), backColor, borderColor, swimlane, north, south, east, west);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FtileDiamond withWest(TextBlock west1) {
|
public FtileDiamond withWest(TextBlock west1) {
|
||||||
if (west1 == null) {
|
if (west1 == null) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
return new FtileDiamond(skinParam(), backColor, borderColor, swimlane, north, south, east1, west1);
|
return new FtileDiamond(skinParam(), backColor, borderColor, swimlane, north, south, east, west1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FtileDiamond withEast(TextBlock east1) {
|
public FtileDiamond withEast(TextBlock east1) {
|
||||||
if (east1 == null) {
|
if (east1 == null) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
return new FtileDiamond(skinParam(), backColor, borderColor, swimlane, north, south, east1, west1);
|
return new FtileDiamond(skinParam(), backColor, borderColor, swimlane, north, south, east1, west);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FtileDiamond withSouth(TextBlock south) {
|
public FtileDiamond withSouth(TextBlock south) {
|
||||||
return new FtileDiamond(skinParam(), backColor, borderColor, swimlane, north, south, east1, west1);
|
return new FtileDiamond(skinParam(), backColor, borderColor, swimlane, north, south, east, west);
|
||||||
}
|
}
|
||||||
|
|
||||||
private FtileDiamond(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane,
|
private FtileDiamond(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane, TextBlock north,
|
||||||
TextBlock north, TextBlock south, TextBlock east1, TextBlock west1) {
|
TextBlock south, TextBlock east, TextBlock west) {
|
||||||
super(skinParam);
|
super(null, skinParam, backColor, borderColor, swimlane, north, south, east, west);
|
||||||
if (UseStyle.useBetaStyle()) {
|
|
||||||
Style style = getDefaultStyleDefinitionDiamond().getMergedStyle(skinParam.getCurrentStyleBuilder());
|
|
||||||
shadowing = style.value(PName.Shadowing).asDouble();
|
|
||||||
} else {
|
|
||||||
shadowing = skinParam().shadowing(null) ? 3 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.backColor = backColor;
|
|
||||||
this.swimlane = swimlane;
|
|
||||||
this.borderColor = borderColor;
|
|
||||||
this.north = north;
|
|
||||||
this.west1 = west1;
|
|
||||||
this.east1 = east1;
|
|
||||||
this.south = south;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<Swimlane> getSwimlanes() {
|
|
||||||
if (swimlane == null) {
|
|
||||||
return Collections.emptySet();
|
|
||||||
}
|
|
||||||
return Collections.singleton(swimlane);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Swimlane getSwimlaneIn() {
|
|
||||||
return swimlane;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Swimlane getSwimlaneOut() {
|
|
||||||
return swimlane;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawU(UGraphic ug) {
|
public void drawU(UGraphic ug) {
|
||||||
|
|
||||||
final double suppY1 = north.calculateDimension(ug.getStringBounder()).getHeight();
|
final double suppY1 = north.calculateDimension(ug.getStringBounder()).getHeight();
|
||||||
ug = ug.apply(UTranslate.dy(suppY1));
|
ug = ug.apply(UTranslate.dy(suppY1));
|
||||||
ug.apply(borderColor).apply(getThickness()).apply(backColor.bg())
|
ug.apply(borderColor).apply(getThickness()).apply(backColor.bg()).draw(Hexagon.asPolygon(shadowing));
|
||||||
.draw(Diamond.asPolygon(shadowing));
|
|
||||||
// final Dimension2D dimNorth = north.calculateDimension(ug.getStringBounder());
|
// final Dimension2D dimNorth = north.calculateDimension(ug.getStringBounder());
|
||||||
north.drawU(ug.apply(new UTranslate(Diamond.diamondHalfSize * 1.5, -suppY1)));
|
north.drawU(ug.apply(new UTranslate(Hexagon.hexagonHalfSize * 1.5, -suppY1)));
|
||||||
|
|
||||||
// final Dimension2D dimSouth = south.calculateDimension(ug.getStringBounder());
|
// final Dimension2D dimSouth = south.calculateDimension(ug.getStringBounder());
|
||||||
south.drawU(ug.apply(new UTranslate(Diamond.diamondHalfSize * 1.5, 2 * Diamond.diamondHalfSize)));
|
south.drawU(ug.apply(new UTranslate(Hexagon.hexagonHalfSize * 1.5, 2 * Hexagon.hexagonHalfSize)));
|
||||||
// south.drawU(ug.apply(new UTranslate(-(dimSouth.getWidth() - 2 * Diamond.diamondHalfSize) / 2,
|
// south.drawU(ug.apply(new UTranslate(-(dimSouth.getWidth() - 2 *
|
||||||
|
// Diamond.diamondHalfSize) / 2,
|
||||||
// 2 * Diamond.diamondHalfSize)));
|
// 2 * Diamond.diamondHalfSize)));
|
||||||
|
|
||||||
final Dimension2D dimWeat1 = west1.calculateDimension(ug.getStringBounder());
|
final Dimension2D dimWeat1 = west.calculateDimension(ug.getStringBounder());
|
||||||
west1.drawU(ug.apply(new UTranslate(-dimWeat1.getWidth(), -dimWeat1.getHeight() + Diamond.diamondHalfSize)));
|
west.drawU(ug.apply(new UTranslate(-dimWeat1.getWidth(), -dimWeat1.getHeight() + Hexagon.hexagonHalfSize)));
|
||||||
|
|
||||||
final Dimension2D dimEast1 = east1.calculateDimension(ug.getStringBounder());
|
final Dimension2D dimEast1 = east.calculateDimension(ug.getStringBounder());
|
||||||
east1.drawU(ug.apply(new UTranslate(Diamond.diamondHalfSize * 2, -dimEast1.getHeight()
|
east.drawU(
|
||||||
+ Diamond.diamondHalfSize)));
|
ug.apply(new UTranslate(Hexagon.hexagonHalfSize * 2, -dimEast1.getHeight() + Hexagon.hexagonHalfSize)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected FtileGeometry calculateDimensionFtile(StringBounder stringBounder) {
|
protected FtileGeometry calculateDimensionFtile(StringBounder stringBounder) {
|
||||||
final double suppY1 = north.calculateDimension(stringBounder).getHeight();
|
final double suppY1 = north.calculateDimension(stringBounder).getHeight();
|
||||||
final Dimension2D dim = new Dimension2DDouble(Diamond.diamondHalfSize * 2, Diamond.diamondHalfSize * 2 + suppY1);
|
final Dimension2D dim = new Dimension2DDouble(Hexagon.hexagonHalfSize * 2,
|
||||||
|
Hexagon.hexagonHalfSize * 2 + suppY1);
|
||||||
return new FtileGeometry(dim, dim.getWidth() / 2, suppY1, dim.getHeight());
|
return new FtileGeometry(dim, dim.getWidth() / 2, suppY1, dim.getHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,7 +119,7 @@ public class FtileDiamond extends AbstractFtile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public double getEastLabelWidth(StringBounder stringBounder) {
|
public double getEastLabelWidth(StringBounder stringBounder) {
|
||||||
final Dimension2D dimEast = east1.calculateDimension(stringBounder);
|
final Dimension2D dimEast = east.calculateDimension(stringBounder);
|
||||||
return dimEast.getWidth();
|
return dimEast.getWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,67 +36,38 @@
|
|||||||
package net.sourceforge.plantuml.activitydiagram3.ftile.vertical;
|
package net.sourceforge.plantuml.activitydiagram3.ftile.vertical;
|
||||||
|
|
||||||
import java.awt.geom.Dimension2D;
|
import java.awt.geom.Dimension2D;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||||
import net.sourceforge.plantuml.ISkinParam;
|
import net.sourceforge.plantuml.ISkinParam;
|
||||||
import net.sourceforge.plantuml.UseStyle;
|
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
|
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
|
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||||
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Hexagon;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||||
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.style.Styleable;
|
|
||||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||||
|
|
||||||
public class FtileDiamondInside extends AbstractFtile implements Styleable {
|
public class FtileDiamondInside extends FtileDiamondWIP {
|
||||||
|
|
||||||
private final HColor backColor;
|
public FtileDiamondInside(TextBlock label, ISkinParam skinParam, HColor backColor, HColor borderColor,
|
||||||
private final HColor borderColor;
|
Swimlane swimlane) {
|
||||||
private final Swimlane swimlane;
|
this(label, skinParam, backColor, borderColor, swimlane, TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0),
|
||||||
private final TextBlock label;
|
|
||||||
private final TextBlock west;
|
|
||||||
private final TextBlock east;
|
|
||||||
private final TextBlock north;
|
|
||||||
private final TextBlock south;
|
|
||||||
private final double shadowing;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Collection<Ftile> getMyChildren() {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public StyleSignature getDefaultStyleDefinition() {
|
|
||||||
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activity, SName.diamond);
|
|
||||||
}
|
|
||||||
|
|
||||||
public FtileDiamondInside(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane,
|
|
||||||
TextBlock label) {
|
|
||||||
this(skinParam, backColor, borderColor, swimlane, label, TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0),
|
|
||||||
TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0));
|
TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
public FtileDiamondInside withNorth(TextBlock north) {
|
public FtileDiamondInside withNorth(TextBlock north) {
|
||||||
return new FtileDiamondInside(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east);
|
return new FtileDiamondInside(label, skinParam(), backColor, borderColor, swimlane, north, south, west, east);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FtileDiamondInside withWest(TextBlock west) {
|
public FtileDiamondInside withWest(TextBlock west) {
|
||||||
return new FtileDiamondInside(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east);
|
return new FtileDiamondInside(label, skinParam(), backColor, borderColor, swimlane, north, south, west, east);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FtileDiamondInside withEast(TextBlock east) {
|
public FtileDiamondInside withEast(TextBlock east) {
|
||||||
return new FtileDiamondInside(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east);
|
return new FtileDiamondInside(label, skinParam(), backColor, borderColor, swimlane, north, south, west, east);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Ftile withWestAndEast(TextBlock tb1, TextBlock tb2) {
|
public Ftile withWestAndEast(TextBlock tb1, TextBlock tb2) {
|
||||||
@ -104,43 +75,12 @@ public class FtileDiamondInside extends AbstractFtile implements Styleable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public FtileDiamondInside withSouth(TextBlock south) {
|
public FtileDiamondInside withSouth(TextBlock south) {
|
||||||
return new FtileDiamondInside(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east);
|
return new FtileDiamondInside(label, skinParam(), backColor, borderColor, swimlane, north, south, west, east);
|
||||||
}
|
}
|
||||||
|
|
||||||
private FtileDiamondInside(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane,
|
private FtileDiamondInside(TextBlock label, ISkinParam skinParam, HColor backColor, HColor borderColor,
|
||||||
TextBlock label, TextBlock north, TextBlock south, TextBlock west, TextBlock east) {
|
Swimlane swimlane, TextBlock north, TextBlock south, TextBlock west, TextBlock east) {
|
||||||
super(skinParam);
|
super(label, skinParam, backColor, borderColor, swimlane, north, south, east, west);
|
||||||
if (UseStyle.useBetaStyle()) {
|
|
||||||
final Style style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder());
|
|
||||||
this.borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet());
|
|
||||||
this.backColor = style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet());
|
|
||||||
this.shadowing = style.value(PName.Shadowing).asDouble();
|
|
||||||
} else {
|
|
||||||
this.backColor = backColor;
|
|
||||||
this.borderColor = borderColor;
|
|
||||||
this.shadowing = skinParam().shadowing(null) ? 3 : 0;
|
|
||||||
}
|
|
||||||
this.swimlane = swimlane;
|
|
||||||
this.label = label;
|
|
||||||
this.west = west;
|
|
||||||
this.east = east;
|
|
||||||
this.north = north;
|
|
||||||
this.south = south;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<Swimlane> getSwimlanes() {
|
|
||||||
if (swimlane == null) {
|
|
||||||
return Collections.emptySet();
|
|
||||||
}
|
|
||||||
return Collections.singleton(swimlane);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Swimlane getSwimlaneIn() {
|
|
||||||
return swimlane;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Swimlane getSwimlaneOut() {
|
|
||||||
return swimlane;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawU(UGraphic ug) {
|
public void drawU(UGraphic ug) {
|
||||||
@ -148,7 +88,7 @@ public class FtileDiamondInside extends AbstractFtile implements Styleable {
|
|||||||
final Dimension2D dimLabel = label.calculateDimension(stringBounder);
|
final Dimension2D dimLabel = label.calculateDimension(stringBounder);
|
||||||
final Dimension2D dimTotal = calculateDimensionAlone(stringBounder);
|
final Dimension2D dimTotal = calculateDimensionAlone(stringBounder);
|
||||||
ug = ug.apply(borderColor).apply(getThickness()).apply(backColor.bg());
|
ug = ug.apply(borderColor).apply(getThickness()).apply(backColor.bg());
|
||||||
ug.draw(Diamond.asPolygon(shadowing, dimTotal.getWidth(), dimTotal.getHeight()));
|
ug.draw(Hexagon.asPolygon(shadowing, dimTotal.getWidth(), dimTotal.getHeight()));
|
||||||
|
|
||||||
north.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight())));
|
north.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight())));
|
||||||
south.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight())));
|
south.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight())));
|
||||||
@ -169,11 +109,11 @@ public class FtileDiamondInside extends AbstractFtile implements Styleable {
|
|||||||
final Dimension2D dimLabel = label.calculateDimension(stringBounder);
|
final Dimension2D dimLabel = label.calculateDimension(stringBounder);
|
||||||
final Dimension2D dim;
|
final Dimension2D dim;
|
||||||
if (dimLabel.getWidth() == 0 || dimLabel.getHeight() == 0) {
|
if (dimLabel.getWidth() == 0 || dimLabel.getHeight() == 0) {
|
||||||
dim = new Dimension2DDouble(Diamond.diamondHalfSize * 2, Diamond.diamondHalfSize * 2);
|
dim = new Dimension2DDouble(Hexagon.hexagonHalfSize * 2, Hexagon.hexagonHalfSize * 2);
|
||||||
} else {
|
} else {
|
||||||
dim = Dimension2DDouble.delta(
|
dim = Dimension2DDouble.delta(
|
||||||
Dimension2DDouble.atLeast(dimLabel, Diamond.diamondHalfSize * 2, Diamond.diamondHalfSize * 2),
|
Dimension2DDouble.atLeast(dimLabel, Hexagon.hexagonHalfSize * 2, Hexagon.hexagonHalfSize * 2),
|
||||||
Diamond.diamondHalfSize * 2, 0);
|
Hexagon.hexagonHalfSize * 2, 0);
|
||||||
}
|
}
|
||||||
return new FtileGeometry(dim, dim.getWidth() / 2, 0, dim.getHeight());
|
return new FtileGeometry(dim, dim.getWidth() / 2, 0, dim.getHeight());
|
||||||
}
|
}
|
||||||
@ -185,8 +125,6 @@ public class FtileDiamondInside extends AbstractFtile implements Styleable {
|
|||||||
final Dimension2D dimEast = east.calculateDimension(stringBounder);
|
final Dimension2D dimEast = east.calculateDimension(stringBounder);
|
||||||
final double northHeight = north.calculateDimension(stringBounder).getHeight();
|
final double northHeight = north.calculateDimension(stringBounder).getHeight();
|
||||||
return dimDiamonAlone.incHeight(northHeight);
|
return dimDiamonAlone.incHeight(northHeight);
|
||||||
// return dimDiamonAlone.incHeight(northHeight).addMarginX(dimWest.getWidth(),
|
|
||||||
// dimEast.getWidth());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getEastLabelWidth(StringBounder stringBounder) {
|
public double getEastLabelWidth(StringBounder stringBounder) {
|
||||||
|
@ -36,97 +36,46 @@
|
|||||||
package net.sourceforge.plantuml.activitydiagram3.ftile.vertical;
|
package net.sourceforge.plantuml.activitydiagram3.ftile.vertical;
|
||||||
|
|
||||||
import java.awt.geom.Dimension2D;
|
import java.awt.geom.Dimension2D;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||||
import net.sourceforge.plantuml.ISkinParam;
|
import net.sourceforge.plantuml.ISkinParam;
|
||||||
import net.sourceforge.plantuml.UseStyle;
|
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
|
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
|
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||||
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Hexagon;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||||
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.UGraphic;
|
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||||
|
|
||||||
public class FtileDiamondInside2 extends AbstractFtile {
|
public class FtileDiamondInside2 extends FtileDiamondWIP {
|
||||||
|
|
||||||
private final HColor backColor;
|
public FtileDiamondInside2(TextBlock label, ISkinParam skinParam, HColor backColor, HColor borderColor,
|
||||||
private final HColor borderColor;
|
Swimlane swimlane) {
|
||||||
private final Swimlane swimlane;
|
this(label, skinParam, backColor, borderColor, swimlane, TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0),
|
||||||
private final TextBlock label;
|
TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0));
|
||||||
private final TextBlock west;
|
|
||||||
private final TextBlock east;
|
|
||||||
private final TextBlock north;
|
|
||||||
private final TextBlock south;
|
|
||||||
private final double shadowing;
|
|
||||||
|
|
||||||
public FtileDiamondInside2(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane,
|
|
||||||
TextBlock label) {
|
|
||||||
this(skinParam, backColor, borderColor, swimlane, label, TextBlockUtils.empty(0, 0),
|
|
||||||
TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public FtileDiamondInside2 withNorth(TextBlock north) {
|
public FtileDiamondInside2 withNorth(TextBlock north) {
|
||||||
return new FtileDiamondInside2(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east);
|
return new FtileDiamondInside2(label, skinParam(), backColor, borderColor, swimlane, north, south, west, east);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FtileDiamondInside2 withWest(TextBlock west) {
|
public FtileDiamondInside2 withWest(TextBlock west) {
|
||||||
return new FtileDiamondInside2(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east);
|
return new FtileDiamondInside2(label, skinParam(), backColor, borderColor, swimlane, north, south, west, east);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FtileDiamondInside2 withEast(TextBlock east) {
|
public FtileDiamondInside2 withEast(TextBlock east) {
|
||||||
return new FtileDiamondInside2(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east);
|
return new FtileDiamondInside2(label, skinParam(), backColor, borderColor, swimlane, north, south, west, east);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FtileDiamondInside2 withSouth(TextBlock south) {
|
public FtileDiamondInside2 withSouth(TextBlock south) {
|
||||||
return new FtileDiamondInside2(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east);
|
return new FtileDiamondInside2(label, skinParam(), backColor, borderColor, swimlane, north, south, west, east);
|
||||||
}
|
|
||||||
|
|
||||||
public StyleSignature getDefaultStyleDefinition() {
|
|
||||||
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activity, SName.diamond);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private FtileDiamondInside2(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane,
|
private FtileDiamondInside2(TextBlock label, ISkinParam skinParam, HColor backColor, HColor borderColor,
|
||||||
TextBlock label, TextBlock north, TextBlock south, TextBlock west, TextBlock east) {
|
Swimlane swimlane, TextBlock north, TextBlock south, TextBlock west, TextBlock east) {
|
||||||
super(skinParam);
|
super(label, skinParam, backColor, borderColor, swimlane, north, south, east, west);
|
||||||
if (UseStyle.useBetaStyle()) {
|
|
||||||
final Style style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder());
|
|
||||||
this.shadowing = style.value(PName.Shadowing).asDouble();
|
|
||||||
} else {
|
|
||||||
this.shadowing = skinParam().shadowing(null) ? 3 : 0;
|
|
||||||
}
|
|
||||||
this.backColor = backColor;
|
|
||||||
this.swimlane = swimlane;
|
|
||||||
this.borderColor = borderColor;
|
|
||||||
this.label = label;
|
|
||||||
this.west = west;
|
|
||||||
this.east = east;
|
|
||||||
this.north = north;
|
|
||||||
this.south = south;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<Swimlane> getSwimlanes() {
|
|
||||||
if (swimlane == null) {
|
|
||||||
return Collections.emptySet();
|
|
||||||
}
|
|
||||||
return Collections.singleton(swimlane);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Swimlane getSwimlaneIn() {
|
|
||||||
return swimlane;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Swimlane getSwimlaneOut() {
|
|
||||||
return swimlane;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawU(UGraphic ug) {
|
public void drawU(UGraphic ug) {
|
||||||
@ -134,7 +83,7 @@ public class FtileDiamondInside2 extends AbstractFtile {
|
|||||||
final Dimension2D dimLabel = label.calculateDimension(stringBounder);
|
final Dimension2D dimLabel = label.calculateDimension(stringBounder);
|
||||||
final Dimension2D dimTotal = calculateDimensionAlone(stringBounder);
|
final Dimension2D dimTotal = calculateDimensionAlone(stringBounder);
|
||||||
ug = ug.apply(borderColor).apply(getThickness()).apply(backColor.bg());
|
ug = ug.apply(borderColor).apply(getThickness()).apply(backColor.bg());
|
||||||
ug.draw(Diamond.asPolygon(shadowing, dimTotal.getWidth(), dimTotal.getHeight()));
|
ug.draw(Hexagon.asPolygon(shadowing, dimTotal.getWidth(), dimTotal.getHeight()));
|
||||||
|
|
||||||
north.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight())));
|
north.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight())));
|
||||||
south.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight())));
|
south.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight())));
|
||||||
@ -155,11 +104,11 @@ public class FtileDiamondInside2 extends AbstractFtile {
|
|||||||
final Dimension2D dimLabel = label.calculateDimension(stringBounder);
|
final Dimension2D dimLabel = label.calculateDimension(stringBounder);
|
||||||
final Dimension2D dim;
|
final Dimension2D dim;
|
||||||
if (dimLabel.getWidth() == 0 || dimLabel.getHeight() == 0) {
|
if (dimLabel.getWidth() == 0 || dimLabel.getHeight() == 0) {
|
||||||
dim = new Dimension2DDouble(Diamond.diamondHalfSize * 2, Diamond.diamondHalfSize * 2);
|
dim = new Dimension2DDouble(Hexagon.hexagonHalfSize * 2, Hexagon.hexagonHalfSize * 2);
|
||||||
} else {
|
} else {
|
||||||
dim = Dimension2DDouble.delta(
|
dim = Dimension2DDouble.delta(
|
||||||
Dimension2DDouble.atLeast(dimLabel, Diamond.diamondHalfSize * 2, Diamond.diamondHalfSize * 2),
|
Dimension2DDouble.atLeast(dimLabel, Hexagon.hexagonHalfSize * 2, Hexagon.hexagonHalfSize * 2),
|
||||||
Diamond.diamondHalfSize * 2, 0);
|
Hexagon.hexagonHalfSize * 2, 0);
|
||||||
}
|
}
|
||||||
return new FtileGeometry(dim, dim.getWidth() / 2, 0, dim.getHeight());
|
return new FtileGeometry(dim, dim.getWidth() / 2, 0, dim.getHeight());
|
||||||
}
|
}
|
||||||
|
@ -1,178 +0,0 @@
|
|||||||
/* ========================================================================
|
|
||||||
* PlantUML : a free UML diagram generator
|
|
||||||
* ========================================================================
|
|
||||||
*
|
|
||||||
* (C) Copyright 2009-2020, Arnaud Roques
|
|
||||||
*
|
|
||||||
* Project Info: http://plantuml.com
|
|
||||||
*
|
|
||||||
* If you like this project or if you find it useful, you can support us at:
|
|
||||||
*
|
|
||||||
* http://plantuml.com/patreon (only 1$ per month!)
|
|
||||||
* http://plantuml.com/paypal
|
|
||||||
*
|
|
||||||
* This file is part of PlantUML.
|
|
||||||
*
|
|
||||||
* PlantUML is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* PlantUML distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
|
||||||
* License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
|
||||||
* USA.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Original Author: Arnaud Roques
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package net.sourceforge.plantuml.activitydiagram3.ftile.vertical;
|
|
||||||
|
|
||||||
import java.awt.geom.Dimension2D;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
|
||||||
import net.sourceforge.plantuml.ISkinParam;
|
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
|
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
|
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileOverpassing;
|
|
||||||
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.UGraphic;
|
|
||||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
|
||||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
|
||||||
import net.sourceforge.plantuml.utils.MathUtils;
|
|
||||||
|
|
||||||
public class FtileDiamondInside3 extends AbstractFtile implements FtileOverpassing {
|
|
||||||
|
|
||||||
private final HColor backColor;
|
|
||||||
private final HColor borderColor;
|
|
||||||
private final Swimlane swimlane;
|
|
||||||
private final TextBlock label;
|
|
||||||
private final TextBlock west;
|
|
||||||
private final TextBlock east;
|
|
||||||
private final TextBlock north;
|
|
||||||
private final TextBlock south;
|
|
||||||
|
|
||||||
public FtileDiamondInside3(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane,
|
|
||||||
TextBlock label) {
|
|
||||||
this(skinParam, backColor, borderColor, swimlane, label, TextBlockUtils.empty(0, 0),
|
|
||||||
TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
public FtileDiamondInside3 withNorth(TextBlock north) {
|
|
||||||
return new FtileDiamondInside3(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east);
|
|
||||||
}
|
|
||||||
|
|
||||||
public FtileDiamondInside3 withWest(TextBlock west) {
|
|
||||||
return new FtileDiamondInside3(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east);
|
|
||||||
}
|
|
||||||
|
|
||||||
public FtileDiamondInside3 withEast(TextBlock east) {
|
|
||||||
return new FtileDiamondInside3(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east);
|
|
||||||
}
|
|
||||||
|
|
||||||
public FtileDiamondInside3 withSouth(TextBlock south) {
|
|
||||||
return new FtileDiamondInside3(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east);
|
|
||||||
}
|
|
||||||
|
|
||||||
private FtileDiamondInside3(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane,
|
|
||||||
TextBlock label, TextBlock north, TextBlock south, TextBlock west, TextBlock east) {
|
|
||||||
super(skinParam);
|
|
||||||
this.backColor = backColor;
|
|
||||||
this.swimlane = swimlane;
|
|
||||||
this.borderColor = borderColor;
|
|
||||||
this.label = label;
|
|
||||||
this.west = west;
|
|
||||||
this.east = east;
|
|
||||||
this.north = north;
|
|
||||||
this.south = south;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<Swimlane> getSwimlanes() {
|
|
||||||
if (swimlane == null) {
|
|
||||||
return Collections.emptySet();
|
|
||||||
}
|
|
||||||
return Collections.singleton(swimlane);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Swimlane getSwimlaneIn() {
|
|
||||||
return swimlane;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Swimlane getSwimlaneOut() {
|
|
||||||
return swimlane;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void drawU(UGraphic ug) {
|
|
||||||
final StringBounder stringBounder = ug.getStringBounder();
|
|
||||||
final Dimension2D dimLabel = label.calculateDimension(stringBounder);
|
|
||||||
final Dimension2D dimTotal = calculateDimensionAlone(stringBounder);
|
|
||||||
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()));
|
|
||||||
|
|
||||||
north.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight())));
|
|
||||||
south.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight())));
|
|
||||||
|
|
||||||
final double lx = (dimTotal.getWidth() - dimLabel.getWidth()) / 2;
|
|
||||||
final double ly = (dimTotal.getHeight() - dimLabel.getHeight()) / 2;
|
|
||||||
label.drawU(ug.apply(new UTranslate(lx, ly)));
|
|
||||||
|
|
||||||
final Dimension2D dimWeat = west.calculateDimension(stringBounder);
|
|
||||||
west.drawU(ug.apply(new UTranslate(-dimWeat.getWidth(), -dimWeat.getHeight() + dimTotal.getHeight() / 2)));
|
|
||||||
|
|
||||||
final Dimension2D dimEast = east.calculateDimension(stringBounder);
|
|
||||||
east.drawU(ug.apply(new UTranslate(dimTotal.getWidth(), -dimEast.getHeight() + dimTotal.getHeight() / 2)));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private FtileGeometry calculateDimensionAlone(StringBounder stringBounder) {
|
|
||||||
final Dimension2D dimLabel = label.calculateDimension(stringBounder);
|
|
||||||
final Dimension2D dim;
|
|
||||||
if (dimLabel.getWidth() == 0 || dimLabel.getHeight() == 0) {
|
|
||||||
dim = new Dimension2DDouble(Diamond.diamondHalfSize * 2, Diamond.diamondHalfSize * 2);
|
|
||||||
} else {
|
|
||||||
dim = Dimension2DDouble.delta(
|
|
||||||
Dimension2DDouble.atLeast(dimLabel, Diamond.diamondHalfSize * 2, Diamond.diamondHalfSize * 2),
|
|
||||||
Diamond.diamondHalfSize * 2, 0);
|
|
||||||
}
|
|
||||||
return new FtileGeometry(dim, dim.getWidth() / 2, 0, dim.getHeight());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected FtileGeometry calculateDimensionFtile(StringBounder stringBounder) {
|
|
||||||
final Dimension2D diamond = calculateDimensionAlone(stringBounder);
|
|
||||||
final Dimension2D north = this.north.calculateDimension(stringBounder);
|
|
||||||
final double height = diamond.getHeight() + north.getHeight();
|
|
||||||
final double left = diamond.getWidth() / 2;
|
|
||||||
// final double width = north.getWidth() > left ? left + north.getWidth() : diamond.getWidth();
|
|
||||||
final double width = diamond.getWidth();
|
|
||||||
return new FtileGeometry(width, height, left, 0, diamond.getHeight());
|
|
||||||
}
|
|
||||||
|
|
||||||
public FtileGeometry getOverpassDimension(StringBounder stringBounder) {
|
|
||||||
final Dimension2D total = calculateDimension(stringBounder);
|
|
||||||
final Dimension2D north = this.north.calculateDimension(stringBounder);
|
|
||||||
final Dimension2D east = this.east.calculateDimension(stringBounder);
|
|
||||||
final Dimension2D west = this.west.calculateDimension(stringBounder);
|
|
||||||
final double height = total.getHeight(); // + north.getHeight();
|
|
||||||
final double left = total.getWidth() / 2;
|
|
||||||
final double supp = MathUtils.max(north.getWidth(), east.getWidth(), west.getWidth());
|
|
||||||
// final double width = supp > left ? left + supp : diamond.getWidth();
|
|
||||||
final double width = total.getWidth() + supp;
|
|
||||||
return new FtileGeometry(width, height, left, 0, total.getHeight());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -36,16 +36,12 @@
|
|||||||
package net.sourceforge.plantuml.activitydiagram3.ftile.vertical;
|
package net.sourceforge.plantuml.activitydiagram3.ftile.vertical;
|
||||||
|
|
||||||
import java.awt.geom.Dimension2D;
|
import java.awt.geom.Dimension2D;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||||
import net.sourceforge.plantuml.ISkinParam;
|
import net.sourceforge.plantuml.ISkinParam;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
|
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
|
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||||
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Hexagon;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||||
@ -54,74 +50,37 @@ import net.sourceforge.plantuml.ugraphic.UGraphic;
|
|||||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||||
|
|
||||||
public class FtileDiamondSquare extends AbstractFtile {
|
public class FtileDiamondSquare extends FtileDiamondWIP {
|
||||||
|
|
||||||
private final HColor backColor;
|
public FtileDiamondSquare(TextBlock label, ISkinParam skinParam, HColor backColor, HColor borderColor,
|
||||||
private final HColor borderColor;
|
Swimlane swimlane) {
|
||||||
private final Swimlane swimlane;
|
this(label, skinParam, backColor, borderColor, swimlane, TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0),
|
||||||
private final TextBlock label;
|
|
||||||
private final TextBlock west;
|
|
||||||
private final TextBlock east;
|
|
||||||
private final TextBlock north;
|
|
||||||
private final TextBlock south;
|
|
||||||
|
|
||||||
public FtileDiamondSquare(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane,
|
|
||||||
TextBlock label) {
|
|
||||||
this(skinParam, backColor, borderColor, swimlane, label, TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0),
|
|
||||||
TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0));
|
TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Collection<Ftile> getMyChildren() {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public FtileDiamondSquare withNorth(TextBlock north) {
|
public FtileDiamondSquare withNorth(TextBlock north) {
|
||||||
return new FtileDiamondSquare(skinParam(), backColor, borderColor, swimlane, label, north, west, east, south);
|
return new FtileDiamondSquare(label, skinParam(), backColor, borderColor, swimlane, north, west, east, south);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FtileDiamondSquare withWest(TextBlock west) {
|
public FtileDiamondSquare withWest(TextBlock west) {
|
||||||
return new FtileDiamondSquare(skinParam(), backColor, borderColor, swimlane, label, north, west, east, south);
|
return new FtileDiamondSquare(label, skinParam(), backColor, borderColor, swimlane, north, west, east, south);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FtileDiamondSquare withEast(TextBlock east) {
|
public FtileDiamondSquare withEast(TextBlock east) {
|
||||||
return new FtileDiamondSquare(skinParam(), backColor, borderColor, swimlane, label, north, west, east, south);
|
return new FtileDiamondSquare(label, skinParam(), backColor, borderColor, swimlane, north, west, east, south);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FtileDiamondSquare withSouth(TextBlock south) {
|
public FtileDiamondSquare withSouth(TextBlock south) {
|
||||||
return new FtileDiamondSquare(skinParam(), backColor, borderColor, swimlane, label, north, west, east, south);
|
return new FtileDiamondSquare(label, skinParam(), backColor, borderColor, swimlane, north, west, east, south);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Ftile withWestAndEast(TextBlock tb1, TextBlock tb2) {
|
public Ftile withWestAndEast(TextBlock tb1, TextBlock tb2) {
|
||||||
return withWest(tb1).withEast(tb2);
|
return withWest(tb1).withEast(tb2);
|
||||||
}
|
}
|
||||||
|
|
||||||
private FtileDiamondSquare(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane,
|
private FtileDiamondSquare(TextBlock label, ISkinParam skinParam, HColor backColor, HColor borderColor,
|
||||||
TextBlock label, TextBlock north, TextBlock west, TextBlock east, TextBlock south) {
|
Swimlane swimlane, TextBlock north, TextBlock west, TextBlock east, TextBlock south) {
|
||||||
super(skinParam);
|
super(label, skinParam, backColor, borderColor, swimlane, north, south, east, west);
|
||||||
this.backColor = backColor;
|
|
||||||
this.swimlane = swimlane;
|
|
||||||
this.borderColor = borderColor;
|
|
||||||
this.label = label;
|
|
||||||
this.west = west;
|
|
||||||
this.east = east;
|
|
||||||
this.north = north;
|
|
||||||
this.south = south;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<Swimlane> getSwimlanes() {
|
|
||||||
if (swimlane == null) {
|
|
||||||
return Collections.emptySet();
|
|
||||||
}
|
|
||||||
return Collections.singleton(swimlane);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Swimlane getSwimlaneIn() {
|
|
||||||
return swimlane;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Swimlane getSwimlaneOut() {
|
|
||||||
return swimlane;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawU(UGraphic ug) {
|
public void drawU(UGraphic ug) {
|
||||||
@ -129,7 +88,7 @@ public class FtileDiamondSquare extends AbstractFtile {
|
|||||||
final Dimension2D dimLabel = label.calculateDimension(stringBounder);
|
final Dimension2D dimLabel = label.calculateDimension(stringBounder);
|
||||||
final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
|
final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
|
||||||
ug = ug.apply(borderColor).apply(getThickness()).apply(backColor.bg());
|
ug = ug.apply(borderColor).apply(getThickness()).apply(backColor.bg());
|
||||||
ug.draw(Diamond.asPolygonSquare(skinParam().shadowing(null), dimTotal.getWidth(), dimTotal.getHeight()));
|
ug.draw(Hexagon.asPolygonSquare(skinParam().shadowing(null), dimTotal.getWidth(), dimTotal.getHeight()));
|
||||||
|
|
||||||
// Fix why north and south are the same
|
// Fix why north and south are the same
|
||||||
north.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight())));
|
north.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight())));
|
||||||
@ -140,10 +99,10 @@ public class FtileDiamondSquare extends AbstractFtile {
|
|||||||
label.drawU(ug.apply(new UTranslate(lx, ly)));
|
label.drawU(ug.apply(new UTranslate(lx, ly)));
|
||||||
|
|
||||||
final Dimension2D dimWeat = west.calculateDimension(stringBounder);
|
final Dimension2D dimWeat = west.calculateDimension(stringBounder);
|
||||||
west.drawU(ug.apply(new UTranslate(-dimWeat.getWidth(), -dimWeat.getHeight() + Diamond.diamondHalfSize)));
|
west.drawU(ug.apply(new UTranslate(-dimWeat.getWidth(), -dimWeat.getHeight() + Hexagon.hexagonHalfSize)));
|
||||||
|
|
||||||
final Dimension2D dimEast = east.calculateDimension(stringBounder);
|
final Dimension2D dimEast = east.calculateDimension(stringBounder);
|
||||||
east.drawU(ug.apply(new UTranslate(dimTotal.getWidth(), -dimEast.getHeight() + Diamond.diamondHalfSize)));
|
east.drawU(ug.apply(new UTranslate(dimTotal.getWidth(), -dimEast.getHeight() + Hexagon.hexagonHalfSize)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,10 +115,10 @@ public class FtileDiamondSquare extends AbstractFtile {
|
|||||||
private Dimension2D calculateDimensionInternal(StringBounder stringBounder) {
|
private Dimension2D calculateDimensionInternal(StringBounder stringBounder) {
|
||||||
final Dimension2D dimLabel = label.calculateDimension(stringBounder);
|
final Dimension2D dimLabel = label.calculateDimension(stringBounder);
|
||||||
if (dimLabel.getWidth() == 0 || dimLabel.getHeight() == 0) {
|
if (dimLabel.getWidth() == 0 || dimLabel.getHeight() == 0) {
|
||||||
return new Dimension2DDouble(Diamond.diamondHalfSize * 2, Diamond.diamondHalfSize * 2);
|
return new Dimension2DDouble(Hexagon.hexagonHalfSize * 2, Hexagon.hexagonHalfSize * 2);
|
||||||
}
|
}
|
||||||
Dimension2D result = dimLabel;
|
Dimension2D result = dimLabel;
|
||||||
result = Dimension2DDouble.delta(result, Diamond.diamondHalfSize * 2, Diamond.diamondHalfSize * 2);
|
result = Dimension2DDouble.delta(result, Hexagon.hexagonHalfSize * 2, Hexagon.hexagonHalfSize * 2);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,117 @@
|
|||||||
|
/* ========================================================================
|
||||||
|
* PlantUML : a free UML diagram generator
|
||||||
|
* ========================================================================
|
||||||
|
*
|
||||||
|
* (C) Copyright 2009-2020, Arnaud Roques
|
||||||
|
*
|
||||||
|
* Project Info: http://plantuml.com
|
||||||
|
*
|
||||||
|
* If you like this project or if you find it useful, you can support us at:
|
||||||
|
*
|
||||||
|
* http://plantuml.com/patreon (only 1$ per month!)
|
||||||
|
* http://plantuml.com/paypal
|
||||||
|
*
|
||||||
|
* This file is part of PlantUML.
|
||||||
|
*
|
||||||
|
* PlantUML is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* PlantUML distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||||
|
* License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||||
|
* USA.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Original Author: Arnaud Roques
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package net.sourceforge.plantuml.activitydiagram3.ftile.vertical;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import net.sourceforge.plantuml.ISkinParam;
|
||||||
|
import net.sourceforge.plantuml.UseStyle;
|
||||||
|
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
|
||||||
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||||
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||||
|
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||||
|
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.style.Styleable;
|
||||||
|
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||||
|
|
||||||
|
abstract class FtileDiamondWIP extends AbstractFtile implements Styleable {
|
||||||
|
|
||||||
|
protected final HColor backColor;
|
||||||
|
protected final HColor borderColor;
|
||||||
|
protected final Swimlane swimlane;
|
||||||
|
|
||||||
|
protected final TextBlock label;
|
||||||
|
|
||||||
|
protected final TextBlock north;
|
||||||
|
protected final TextBlock south;
|
||||||
|
protected final TextBlock west;
|
||||||
|
protected final TextBlock east;
|
||||||
|
|
||||||
|
protected final double shadowing;
|
||||||
|
|
||||||
|
final public StyleSignature getDefaultStyleDefinition() {
|
||||||
|
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activity, SName.diamond);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
final public Collection<Ftile> getMyChildren() {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected FtileDiamondWIP(TextBlock label, ISkinParam skinParam, HColor backColor, HColor borderColor,
|
||||||
|
Swimlane swimlane, TextBlock north, TextBlock south, TextBlock east, TextBlock west) {
|
||||||
|
super(skinParam);
|
||||||
|
if (UseStyle.useBetaStyle()) {
|
||||||
|
Style style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder());
|
||||||
|
this.borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet());
|
||||||
|
this.backColor = style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet());
|
||||||
|
this.shadowing = style.value(PName.Shadowing).asDouble();
|
||||||
|
} else {
|
||||||
|
this.backColor = backColor;
|
||||||
|
this.borderColor = borderColor;
|
||||||
|
this.shadowing = skinParam().shadowing(null) ? 3 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.swimlane = swimlane;
|
||||||
|
|
||||||
|
this.label = label;
|
||||||
|
this.north = north;
|
||||||
|
this.west = west;
|
||||||
|
this.east = east;
|
||||||
|
this.south = south;
|
||||||
|
}
|
||||||
|
|
||||||
|
final public Set<Swimlane> getSwimlanes() {
|
||||||
|
if (swimlane == null) {
|
||||||
|
return Collections.emptySet();
|
||||||
|
}
|
||||||
|
return Collections.singleton(swimlane);
|
||||||
|
}
|
||||||
|
|
||||||
|
final public Swimlane getSwimlaneIn() {
|
||||||
|
return swimlane;
|
||||||
|
}
|
||||||
|
|
||||||
|
final public Swimlane getSwimlaneOut() {
|
||||||
|
return swimlane;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -50,8 +50,8 @@ import net.sourceforge.plantuml.command.regex.IRegex;
|
|||||||
import net.sourceforge.plantuml.command.regex.RegexConcat;
|
import net.sourceforge.plantuml.command.regex.RegexConcat;
|
||||||
import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||||
import net.sourceforge.plantuml.security.SFile;
|
|
||||||
import net.sourceforge.plantuml.security.SImageIO;
|
import net.sourceforge.plantuml.security.SImageIO;
|
||||||
|
import net.sourceforge.plantuml.security.SFile;
|
||||||
import net.sourceforge.plantuml.sprite.Sprite;
|
import net.sourceforge.plantuml.sprite.Sprite;
|
||||||
import net.sourceforge.plantuml.sprite.SpriteImage;
|
import net.sourceforge.plantuml.sprite.SpriteImage;
|
||||||
import net.sourceforge.plantuml.sprite.SpriteSvg;
|
import net.sourceforge.plantuml.sprite.SpriteSvg;
|
||||||
|
@ -37,6 +37,7 @@ package net.sourceforge.plantuml.creole.legacy;
|
|||||||
|
|
||||||
import java.awt.geom.Dimension2D;
|
import java.awt.geom.Dimension2D;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -111,7 +112,7 @@ public class StripeCode implements Stripe, Atom {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<Atom> splitInTwo(StringBounder stringBounder, double width) {
|
public List<Atom> splitInTwo(StringBounder stringBounder, double width) {
|
||||||
throw new UnsupportedOperationException();
|
return Arrays.asList((Atom) this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -35,9 +35,9 @@
|
|||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml.png;
|
package net.sourceforge.plantuml.png;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import javax.imageio.ImageReader;
|
import javax.imageio.ImageReader;
|
||||||
@ -52,7 +52,7 @@ import net.sourceforge.plantuml.security.SFile;
|
|||||||
|
|
||||||
public class MetadataTag {
|
public class MetadataTag {
|
||||||
|
|
||||||
private final Object source;
|
private final File source;
|
||||||
private final String tag;
|
private final String tag;
|
||||||
|
|
||||||
public MetadataTag(SFile file, String tag) throws FileNotFoundException {
|
public MetadataTag(SFile file, String tag) throws FileNotFoundException {
|
||||||
@ -65,11 +65,6 @@ public class MetadataTag {
|
|||||||
this.tag = tag;
|
this.tag = tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MetadataTag(InputStream is, String tag) {
|
|
||||||
this.source = is;
|
|
||||||
this.tag = tag;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getData() throws IOException {
|
public String getData() throws IOException {
|
||||||
final ImageInputStream iis = SImageIO.createImageInputStream(source);
|
final ImageInputStream iis = SImageIO.createImageInputStream(source);
|
||||||
final Iterator<ImageReader> readers = SImageIO.getImageReaders(iis);
|
final Iterator<ImageReader> readers = SImageIO.getImageReaders(iis);
|
||||||
|
@ -38,6 +38,7 @@ package net.sourceforge.plantuml.security;
|
|||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.awt.image.RenderedImage;
|
import java.awt.image.RenderedImage;
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
@ -58,10 +59,6 @@ public class SImageIO {
|
|||||||
javax.imageio.ImageIO.write(image, format, os);
|
javax.imageio.ImageIO.write(image, format, os);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void write(RenderedImage image, String format, java.io.File file) throws IOException {
|
|
||||||
javax.imageio.ImageIO.write(image, format, file);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void write(RenderedImage image, String format, SFile file) throws IOException {
|
public static void write(RenderedImage image, String format, SFile file) throws IOException {
|
||||||
javax.imageio.ImageIO.write(image, format, file.conv());
|
javax.imageio.ImageIO.write(image, format, file.conv());
|
||||||
}
|
}
|
||||||
@ -77,23 +74,19 @@ public class SImageIO {
|
|||||||
public static BufferedImage read(InputStream is) throws IOException {
|
public static BufferedImage read(InputStream is) throws IOException {
|
||||||
return javax.imageio.ImageIO.read(is);
|
return javax.imageio.ImageIO.read(is);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BufferedImage read(byte[] bytes) throws IOException {
|
public static BufferedImage read(byte[] bytes) throws IOException {
|
||||||
return javax.imageio.ImageIO.read(new ByteArrayInputStream(bytes));
|
return javax.imageio.ImageIO.read(new ByteArrayInputStream(bytes));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ImageInputStream createImageInputStream(java.io.File file) throws IOException {
|
|
||||||
return javax.imageio.ImageIO.createImageInputStream(file);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ImageInputStream createImageInputStream(SFile file) throws IOException {
|
public static ImageInputStream createImageInputStream(SFile file) throws IOException {
|
||||||
return javax.imageio.ImageIO.createImageInputStream(file.conv());
|
return javax.imageio.ImageIO.createImageInputStream(file.conv());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ImageInputStream createImageInputStream(Object obj) throws IOException {
|
public static ImageInputStream createImageInputStream(File obj) throws IOException {
|
||||||
if (obj instanceof SFile) {
|
// if (obj instanceof SFile) {
|
||||||
obj = ((SFile) obj).conv();
|
// obj = ((SFile) obj).conv();
|
||||||
}
|
// }
|
||||||
return javax.imageio.ImageIO.createImageInputStream(obj);
|
return javax.imageio.ImageIO.createImageInputStream(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,6 +72,7 @@ public abstract class AbstractMessage implements EventWithDeactivate, WithStyle
|
|||||||
private Url url;
|
private Url url;
|
||||||
private final String messageNumber;
|
private final String messageNumber;
|
||||||
private boolean parallel = false;
|
private boolean parallel = false;
|
||||||
|
private AbstractMessage parallelBrother;
|
||||||
private final StyleBuilder styleBuilder;
|
private final StyleBuilder styleBuilder;
|
||||||
|
|
||||||
private List<Note> noteOnMessages = new ArrayList<>();
|
private List<Note> noteOnMessages = new ArrayList<>();
|
||||||
@ -93,6 +94,10 @@ public abstract class AbstractMessage implements EventWithDeactivate, WithStyle
|
|||||||
this.parallel = true;
|
this.parallel = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setParallelBrother(AbstractMessage brother) {
|
||||||
|
this.parallelBrother = brother;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isParallel() {
|
public boolean isParallel() {
|
||||||
return parallel;
|
return parallel;
|
||||||
}
|
}
|
||||||
@ -262,4 +267,5 @@ public abstract class AbstractMessage implements EventWithDeactivate, WithStyle
|
|||||||
public abstract Participant getParticipant1();
|
public abstract Participant getParticipant1();
|
||||||
|
|
||||||
public abstract Participant getParticipant2();
|
public abstract Participant getParticipant2();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -151,6 +151,9 @@ public class SequenceDiagram extends UmlDiagram {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String addMessage(AbstractMessage m) {
|
public String addMessage(AbstractMessage m) {
|
||||||
|
if (m.isParallel()) {
|
||||||
|
m.setParallelBrother(getLastAbstractMessage());
|
||||||
|
}
|
||||||
lastEventWithDeactivate = m;
|
lastEventWithDeactivate = m;
|
||||||
lastDelay = null;
|
lastDelay = null;
|
||||||
events.add(m);
|
events.add(m);
|
||||||
@ -164,6 +167,14 @@ public class SequenceDiagram extends UmlDiagram {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private AbstractMessage getLastAbstractMessage() {
|
||||||
|
for (int i = events.size() - 1; i > 0; i--)
|
||||||
|
if (events.get(i) instanceof AbstractMessage)
|
||||||
|
return (AbstractMessage) events.get(i);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public void addNote(Note n, boolean tryMerge) {
|
public void addNote(Note n, boolean tryMerge) {
|
||||||
// this.lastEventWithDeactivate = null;
|
// this.lastEventWithDeactivate = null;
|
||||||
if (tryMerge && events.size() > 0) {
|
if (tryMerge && events.size() > 0) {
|
||||||
|
@ -80,7 +80,7 @@ public class Version {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static int beta() {
|
public static int beta() {
|
||||||
final int beta = 3;
|
final int beta = 7;
|
||||||
return beta;
|
return beta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user