1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-22 21:15:09 +00:00

Import version 1.2021.11

This commit is contained in:
Arnaud Roques 2021-10-03 23:01:18 +02:00
parent 57953f4e5b
commit 11de152d92
25 changed files with 315 additions and 176 deletions

View File

@ -131,9 +131,9 @@ public class InstructionRepeat implements Instruction {
if (Display.isNull(backward)) {
return null;
}
Ftile result = factory.activity(backward, swimlane, boxStyle, Colors.empty(), null);
Ftile result = factory.activity(backward, swimlaneOut, boxStyle, Colors.empty(), null);
if (backwardNotes.size() > 0) {
result = factory.addNote(result, swimlane, backwardNotes);
result = factory.addNote(result, swimlaneOut, backwardNotes);
}
return result;
}

View File

@ -76,16 +76,15 @@ public class ConnectionVerticalDown extends AbstractConnection implements Connec
}
private Snake getSimpleSnake() {
final Snake snake = Snake.create(color, Arrows.asToDown()).withLabel(textBlock,
arrowHorizontalAlignment());
final Snake snake = Snake.create(color, Arrows.asToDown()).withLabel(textBlock, arrowHorizontalAlignment());
snake.addPoint(p1);
snake.addPoint(p2);
return snake;
}
@Override
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
final Snake snake = Snake.create(color, Arrows.asToDown()).withLabel(textBlock,
arrowHorizontalAlignment());
final Snake snake = Snake.create(color, Arrows.asToDown()).withLabel(textBlock, arrowHorizontalAlignment());
final Point2D mp1a = translate1.getTranslated(p1);
final Point2D mp2b = translate2.getTranslated(p2);
final double middle = (mp1a.getY() + mp2b.getY()) / 2.0;

View File

@ -114,7 +114,7 @@ public class FtileFactoryDelegatorRepeat extends FtileFactoryDelegator {
final LinkRendering endRepeatLinkRendering = repeat.getOutLinkRendering();
final Rainbow endRepeatLinkColor = endRepeatLinkRendering == null ? null : endRepeatLinkRendering.getRainbow();
final Ftile entry = getEntry(swimlane, startLabel, colors, boxStyleIn);
final Ftile entry = getEntry(repeat.getSwimlaneIn(), startLabel, colors, boxStyleIn);
Ftile result = FtileRepeat.create(swimlane, swimlaneOut, entry, repeat, test, yes, out, borderColor,
diamondColor, arrowColor, endRepeatLinkColor, conditionStyle, this.skinParam(), fcDiamond, fcArrow,

View File

@ -205,6 +205,7 @@ public class FtileIfDown extends AbstractFtile {
ug.draw(snake);
}
@Override
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
final StringBounder stringBounder = ug.getStringBounder();
final Point2D p1 = getP1(stringBounder);
@ -266,6 +267,7 @@ public class FtileIfDown extends AbstractFtile {
ug.draw(snake);
}
@Override
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
if (getFtile1().calculateDimension(ug.getStringBounder()).hasPointOut() == false) {
@ -329,8 +331,7 @@ public class FtileIfDown extends AbstractFtile {
final double xmax = Math.max(x1 + Diamond.diamondHalfSize,
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);
snake.addPoint(x1, y1);
snake.addPoint(xmax, y1);
snake.addPoint(xmax, y2);

View File

@ -402,6 +402,7 @@ class FtileIfLongHorizontal extends AbstractFtile {
return getTranslate1(getFtile2(), stringBounder).getTranslated(p);
}
@Override
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
final Point2D p1 = getP1(ug.getStringBounder());
final Point2D p2 = getP2(ug.getStringBounder());

View File

@ -121,7 +121,8 @@ class FtileRepeat extends AbstractFtile {
FontConfiguration fcDiamond, FontConfiguration fcArrow, Ftile backward, boolean noOut,
LinkRendering incoming1, LinkRendering incoming2) {
final FontConfiguration fontConfiguration1 = conditionStyle == ConditionStyle.INSIDE_HEXAGON ? fcDiamond : fcArrow;
final FontConfiguration fontConfiguration1 = conditionStyle == ConditionStyle.INSIDE_HEXAGON ? fcDiamond
: fcArrow;
final TextBlock tbTest = (Display.isNull(test) || test.isWhite()) ? TextBlockUtils.empty(0, 0)
: test.create(fontConfiguration1, repeat.skinParam().getDefaultTextAlignment(HorizontalAlignment.LEFT),
@ -168,22 +169,17 @@ class FtileRepeat extends AbstractFtile {
: incoming1.getDisplay().create7(fcArrow, HorizontalAlignment.LEFT, spriteContainer,
CreoleMode.SIMPLE_LINE);
if (repeat.getSwimlaneIn() == null || repeat.getSwimlaneIn() == swimlaneOut) {
if (backward == null) {
conns.add(result.new ConnectionBackSimple(incoming1.getRainbow(arrowColor), incomingText));
} else {
final Rainbow rainbow1 = incoming1.getRainbow(arrowColor);
conns.add(result.new ConnectionBackBackward1(rainbow1, incomingText));
final TextBlock backArrowLabel = incoming2 == null || incoming2.getDisplay() == null ? null
: incoming2.getDisplay().create(fcArrow, HorizontalAlignment.LEFT, spriteContainer);
final Rainbow rainbow2 = incoming2.getRainbow(arrowColor);
conns.add(result.new ConnectionBackBackward2(rainbow2, backArrowLabel));
}
if (backward != null) {
final Rainbow rainbow1 = incoming1.getRainbow(arrowColor);
conns.add(result.new ConnectionBackBackward1(rainbow1, incomingText));
final TextBlock backArrowLabel = incoming2 == null || incoming2.getDisplay() == null ? null
: incoming2.getDisplay().create(fcArrow, HorizontalAlignment.LEFT, spriteContainer);
final Rainbow rainbow2 = incoming2.getRainbow(arrowColor);
conns.add(result.new ConnectionBackBackward2(rainbow2, backArrowLabel));
} else if (repeat.getSwimlaneIn() == null || repeat.getSwimlaneIn() == swimlaneOut) {
conns.add(result.new ConnectionBackSimple(incoming1.getRainbow(arrowColor), incomingText));
} else {
conns.add(result.new ConnectionBackComplex1(incoming1.getRainbow(arrowColor)));
// conns.add(result.new
// ConnectionBackComplexHorizontalOnly(incoming1.getRainbow(arrowColor),
// incomingText));
}
final Display out1 = repeat.getOutLinkRendering().getDisplay();
@ -260,6 +256,7 @@ class FtileRepeat extends AbstractFtile {
ug.draw(snake);
}
@Override
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
final StringBounder stringBounder = ug.getStringBounder();
if (getFtile1().calculateDimension(stringBounder).hasPointOut() == false) {
@ -304,6 +301,7 @@ class FtileRepeat extends AbstractFtile {
// throw new UnsupportedOperationException();
}
@Override
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
final StringBounder stringBounder = ug.getStringBounder();
final Dimension2D dimRepeat = repeat.calculateDimension(stringBounder);
@ -345,39 +343,6 @@ class FtileRepeat extends AbstractFtile {
}
// class ConnectionBackComplexHorizontalOnly extends AbstractConnection {
// private final Rainbow arrowColor;
// private final TextBlock tbback;
//
// public ConnectionBackComplexHorizontalOnly(Rainbow arrowColor, TextBlock tbback) {
// super(diamond2, diamond2);
// this.arrowColor = arrowColor;
// this.tbback = tbback;
// }
//
// private Point2D getP1(final StringBounder stringBounder) {
// return getTranslateDiamond2(stringBounder).getTranslated(new Point2D.Double(0, 0));
// }
//
// public void drawU(UGraphic ug) {
// final StringBounder stringBounder = ug.getStringBounder();
//
// final Snake snake = Snake.create(arrowColor, null).withLabel(tbback, arrowHorizontalAlignment());
// final Dimension2D dimRepeat = repeat.calculateDimension(stringBounder);
// final Point2D p1 = getP1(stringBounder);
// final Dimension2D dimDiamond2 = diamond2.calculateDimension(stringBounder);
// final double x1 = p1.getX() + dimDiamond2.getWidth();
// final double y1 = p1.getY() + dimDiamond2.getHeight() / 2;
//
// snake.addPoint(x1, y1);
// final double xmax = p1.getX() + dimDiamond2.getWidth() / 2 + dimRepeat.getWidth() / 2
// + Diamond.diamondHalfSize;
// snake.addPoint(xmax, y1);
// ug.draw(snake);
// }
//
// }
class ConnectionBackBackward1 extends AbstractConnection {
private final Rainbow arrowColor;
private final TextBlock tbback;
@ -400,7 +365,6 @@ class FtileRepeat extends AbstractFtile {
public void drawU(UGraphic ug) {
final StringBounder stringBounder = ug.getStringBounder();
final Snake snake = Snake.create(arrowColor, Arrows.asToUp()).withLabel(tbback, arrowHorizontalAlignment());
final Point2D p1 = getP1(stringBounder);
final Point2D p2 = getP2(stringBounder);
final Dimension2D dimDiamond2 = diamond2.calculateDimension(stringBounder);
@ -409,6 +373,8 @@ class FtileRepeat extends AbstractFtile {
final double x2 = p2.getX();
final double y2 = p2.getY();
final Snake snake = Snake.create(arrowColor, Arrows.asToUp()).withLabel(tbback, arrowHorizontalAlignment());
snake.addPoint(x1, y1);
snake.addPoint(x2, y1);
snake.addPoint(x2, y2);
@ -418,7 +384,7 @@ class FtileRepeat extends AbstractFtile {
}
class ConnectionBackBackward2 extends AbstractConnection {
class ConnectionBackBackward2 extends AbstractConnection implements ConnectionTranslatable {
private final Rainbow arrowColor;
private final TextBlock label;
@ -437,11 +403,41 @@ class FtileRepeat extends AbstractFtile {
return getTranslateDiamond1(stringBounder).getTranslated(new Point2D.Double(0, 0));
}
@Override
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
final StringBounder stringBounder = ug.getStringBounder();
Point2D p1 = getP1(stringBounder);
Point2D p2 = getP2(stringBounder);
p1 = translate1.getTranslated(p1);
p2 = translate2.getTranslated(p2);
final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder);
final double x1 = p1.getX();
final double y1 = p1.getY();
double x2 = p2.getX();
if (x2 < x1)
x2 += dimDiamond1.getWidth();
final double y2 = p2.getY() + dimDiamond1.getHeight() / 2;
Snake snake = Snake.create(arrowColor, x2 < x1 ? Arrows.asToLeft() : Arrows.asToRight());
if (label != null) {
snake = snake.withLabel(label, arrowHorizontalAlignment());
}
snake.addPoint(x1, y1);
snake.addPoint(x1, y2);
snake.addPoint(x2, y2);
ug.draw(snake);
}
public void drawU(UGraphic ug) {
final StringBounder stringBounder = ug.getStringBounder();
Snake snake = Snake.create(arrowColor, Arrows.asToLeft());
// .emphasizeDirection(Direction.UP);
if (label != null) {
snake = snake.withLabel(label, arrowHorizontalAlignment());
}
@ -504,6 +500,7 @@ class FtileRepeat extends AbstractFtile {
ug.draw(snake);
}
@Override
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
final StringBounder stringBounder = ug.getStringBounder();
final Snake snake = Snake.create(arrowColor, Arrows.asToLeft()).emphasizeDirection(Direction.UP)

View File

@ -196,6 +196,7 @@ class FtileWhile extends AbstractFtile {
ug.draw(snake);
}
@Override
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
final StringBounder stringBounder = ug.getStringBounder();
final Point2D p1 = getP1(stringBounder);
@ -271,6 +272,7 @@ class FtileWhile extends AbstractFtile {
}
@Override
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
final StringBounder stringBounder = ug.getStringBounder();
final Snake snake = Snake.create(endInlinkColor, Arrows.asToLeft()).withMerge(MergeStrategy.LIMITED);

View File

@ -244,6 +244,7 @@ public class ParallelBuilderFork extends AbstractParallelFtilesBuilder {
ug.draw(snake);
}
@Override
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
ug = ug.apply(UTranslate.dx(x));
final FtileGeometry geo2 = getFtile2().calculateDimension(getStringBounder());
@ -297,6 +298,7 @@ public class ParallelBuilderFork extends AbstractParallelFtilesBuilder {
ug.draw(snake);
}
@Override
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
ug = ug.apply(UTranslate.dx(x));
final FtileGeometry geo = getFtile1().calculateDimension(getStringBounder());

View File

@ -225,6 +225,7 @@ public class ParallelBuilderMerge extends AbstractParallelFtilesBuilder {
ug.draw(snake);
}
@Override
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
ug = ug.apply(UTranslate.dx(x));
final FtileGeometry geo = getFtile2().calculateDimension(getStringBounder());

View File

@ -236,6 +236,7 @@ public class ParallelBuilderSplit extends AbstractParallelFtilesBuilder {
ug.draw(snake);
}
@Override
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
ug = ug.apply(UTranslate.dx(x));
final FtileGeometry geo = getFtile2().calculateDimension(getStringBounder());
@ -292,6 +293,7 @@ public class ParallelBuilderSplit extends AbstractParallelFtilesBuilder {
ug.draw(snake);
}
@Override
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
ug = ug.apply(UTranslate.dx(x));
final FtileGeometry geo = getFtile1().calculateDimension(getStringBounder());

View File

@ -135,6 +135,7 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
throw new IllegalStateException();
}
@Override
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
final StringBounder stringBounder = ug.getStringBounder();
Point2D p1 = getP1(stringBounder);
@ -223,6 +224,7 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
throw new IllegalStateException();
}
@Override
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
final StringBounder stringBounder = ug.getStringBounder();
final FtileGeometry geo = getFtile1().calculateDimension(stringBounder);
@ -313,6 +315,7 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
ug.draw(snake);
}
@Override
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
final StringBounder stringBounder = ug.getStringBounder();
final FtileGeometry dimTotal = calculateDimensionInternal(stringBounder);
@ -416,7 +419,7 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
super(null, null);
this.arrowColor = arrowColor;
}
public void drawU(UGraphic ug) {
final StringBounder stringBounder = ug.getStringBounder();
final Dimension2D totalDim = calculateDimensionInternal(stringBounder);
@ -446,7 +449,7 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
s.addPoint(maxX, totalDim.getHeight());
ug.draw(s);
}
private double[] getMinmax(StringBounder stringBounder, double width, List<Ftile> allTiles, Swimlane intoSw,
List<Swimlane> allSwimlanes) {
final int current = allSwimlanes.indexOf(intoSw);
@ -499,7 +502,7 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
}
return new double[] { minX, maxX };
}
private int getFirstSwimlane(StringBounder stringBounder, List<Ftile> allTiles, List<Swimlane> allSwimlanes) {
for (int i = 0; i < allSwimlanes.size(); i++) {
if (atLeastOne(stringBounder, allSwimlanes.get(i), allTiles)) {
@ -529,7 +532,6 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
return ftile.getSwimlaneOut() == swimlane && ftile.getSwimlanes().contains(swimlane);
}
}
public Ftile addLinks(Branch branch1, Branch branch2, StringBounder stringBounder) {

View File

@ -70,29 +70,29 @@ public class PSystemDonors extends PlainDiagram {
private static final int COLS = 6;
private static final int FREE_LINES = 6;
public static final String DONORS = "6zeD0AmFjCllA6nYeh4EstErPvQF9MScYM1vdb2SMCJfBY3-0FTEZ_kDz1VHbUvzqunHwxL9EOEeFWXw"
+ "mBlRGljG-byVX3bBNWHtfWGNa0AYEBf4VgGRsKwVL1bIWcUfwEzlcRYztJekL2Q9lX7AWU9-EMJWRVfi"
+ "dft6XqOlK0t-zf1sN_tVfRDrULKLfWNThS08Z3gDSAJiDVwFQb575Em4DUpqOpgLgreErQh4PjkR8bf9"
+ "SyUiqD3EHvqc5yLaf4ZnraOANZ6OeIadiq-HN_f5uu-w2HrQgsk8vGuWpfdIe-kstgx7WrX-iSG7mHLy"
+ "GHQ1EP1o95v4otFJZOQB1muDkwZ6bfNSyyGAGIgqa3V_A9AItaCykmnk6curGE3rDWf8ng0cJJZRTpUW"
+ "qXviqQM1gwxr5-RMTLYUoisauGd4mis2Ma0DGUA3Nj0PVUMMoJqFXIqXJqayfwr6_Pbu9srpGT_uKX8m"
+ "NpjFpSp-Y56s7j8uSf_phyuEUDUGbQlVZ3d2EOEwlCm5CTzQe7u4UcnEM1BVK-uif23KH-gc3vrhJseL"
+ "uPHSKYhMwKjiUItt3rrfams9vEbWoNotV5rhYWTRw2ga6dX3gpJDEb_0f8Rw-qiUBPtlWcjAnUuDYpOY"
+ "kuRelvzRcXcA0tHeYjdGJG26iKghpc834UmMEZRW9e4SXF9fSicVbb-Yj_m4m5jA15rXGz8CVlzIyf23"
+ "2p6GgUjIN00idbBgHSFZ0GkLEWJTZYgXz3Pt_GoJbctBni8oQHVFEmt6o8_fbEB2V9bBU8HXgLeqvpwi"
+ "7S0kmRFvECshxZFDLO1BXVUOZMl_ae4ymvmHaQBJ5Oz7sXRpK8TX5cFEIrrqJxUJWuTkFN0sY-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UmddW81B9G5gYbpKn0lZkZxlLqsiTvl6tBwSO1qaBIGHK"
+ "GQOptb1cwgazmiPwY_wVj6MB2t_-jKURd9hisdi8edKG5u08Bz1HBWWXdW9V7pPC1vnWYOiECbovPkbP"
+ "8B9W2trm4tLvcz6uunVBZSj5QyyFLVBTt0uNyy4tfBW85ULzJIcPjfb1DT8ltdMuoK7nTr5bM2INlJcP"
+ "Z8HDe8fpT-pMDjHZoG0pc0EL2UpT_LbPQ6ZC_Ggaod02vFijaaf6XHPMQreH2u4rSk7stfQJyepwJ4Rq"
+ "axNE6Nlrq3Z8rVKN8GhV3WbvGPYuNIHE1EZDDISMTFDD0FcYMYY9fHqTTkvWXVmF_WZUI3Xc6nzOv0cb"
+ "UPODENIJx8EpG7qWxo4ia8d5Ibr5B9HoF90YAPYpMiQpIDjf2yxe7K2dA1Z_tziGBYVH_8fcbrxLIEPo"
+ "pBsuWiY6-xj8R56oDI0T-rhcigqpSZld8Xrswd_WEyvtFg9kNKH00b5BWjUMWtHtOvzQ6ZQrvteLnt6P"
+ "fuF9BsHNjFELWQtnOWkodCr0YIS1X1q85P9NuLVx1wuvvyYlzwbI6AZXUUOMTEEvDp0MAvR4KzA0waqM"
+ "vTht1-xanGc54ui5BYmLRlGmgLihd6h7JPlrf569NALYl8Snkxcav9yg1fNIDRcze6P9Q5rtbj4Pd6nX"
+ "Bi_xl7jX1fNw9UfJmHu33TU7RvmXlRAiOXyX50RLk31POW00";
/*
* Special thanks to our sponsors and donors:

View File

@ -304,8 +304,8 @@ public class QuoteUtils {
"Lbh jnag gb tb ubzr naq erguvax lbhe yvsr", "V'z trggva gbb byq sbe guvf fuvg",
"Vg'f n jryy xabja snpg gung n tybony pbafcvenpl jbhyq or ng gur bevtva bs znal snxr pbafcvenpl gurbevrf",
"Gh nhenvf ienvzrag qh pubvfve ha nhger zrgvre.",
"...rg qrf srfgvaf qr ebv fhe yr mvap q'ha ohssrg qr tner",
"Obevf, V guvax lbh'er tbaan arrq n ovttre ohf");
"...rg qrf srfgvaf qr ebv fhe yr mvap q'ha ohssrg qr tner", "Obevf, V guvax lbh'er tbaan arrq n ovttre ohf",
"Cebtenzzvat vf na neg sbez gung svtugf onpx", "Jr ernyyl fubhyq trg fbzr cncrejrvtugf");
private QuoteUtils() {
}

View File

@ -58,7 +58,7 @@ public class CommandEndSomething extends SingleLineCommand2<NwDiagram> {
@Override
protected CommandExecutionResult executeArg(NwDiagram diagram, LineLocation location, RegexResult arg) {
return diagram.endSomething();
return diagram.closeSomething();
}
}

View File

@ -63,6 +63,7 @@ import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.UDrawable;
import net.sourceforge.plantuml.nwdiag.core.NServer;
import net.sourceforge.plantuml.nwdiag.core.NStackable;
import net.sourceforge.plantuml.nwdiag.core.Network;
import net.sourceforge.plantuml.nwdiag.core.NwGroup;
import net.sourceforge.plantuml.nwdiag.next.GridTextBlockDecorated;
@ -103,19 +104,41 @@ public class NwDiagram extends UmlDiagram {
initDone = true;
}
private Network currentNetwork() {
private Network lastNetwork() {
if (networks.size() == 0) {
return null;
}
return networks.get(networks.size() - 1);
}
private Network stackedNetwork() {
for (NStackable element : stack)
if (element instanceof Network)
return (Network) element;
return null;
}
private NwGroup stakedGroup() {
for (NStackable element : stack)
if (element instanceof NwGroup)
return (NwGroup) element;
return null;
}
private final List<NStackable> stack = new ArrayList<NStackable>();
public CommandExecutionResult openGroup(String name) {
if (initDone == false) {
return errorNoInit();
}
currentGroup = new NwGroup(name, currentNetwork());
groups.add(currentGroup);
for (NStackable element : stack)
if (element instanceof NwGroup)
return CommandExecutionResult.error("Cannot nest group");
final NwGroup newGroup = new NwGroup(name);
stack.add(0, newGroup);
groups.add(newGroup);
currentGroup = newGroup;
return CommandExecutionResult.ok();
}
@ -123,7 +146,21 @@ public class NwDiagram extends UmlDiagram {
if (initDone == false) {
return errorNoInit();
}
createNetwork(name);
for (NStackable element : stack)
if (element instanceof Network)
return CommandExecutionResult.error("Cannot nest network");
final Network network = createNetwork(name);
stack.add(0, network);
return CommandExecutionResult.ok();
}
public CommandExecutionResult closeSomething() {
if (initDone == false) {
return errorNoInit();
}
if (stack.size() > 0)
stack.remove(0);
this.currentGroup = null;
return CommandExecutionResult.ok();
}
@ -137,41 +174,25 @@ public class NwDiagram extends UmlDiagram {
if (initDone == false) {
return errorNoInit();
}
final NServer element;
if (currentNetwork() == null) {
final NServer server2;
if (lastNetwork() == null) {
createNetwork(name1);
element = new NServer(name2);
server2 = new NServer(name2);
} else {
final NServer already = servers.get(name1);
final NServer server1 = servers.get(name1);
final Network network1 = createNetwork("");
network1.goInvisible();
if (already != null) {
connect(already, toSet(null));
if (server1 != null) {
server1.connectTo(lastNetwork());
}
element = new NServer(name2, already.getBar());
server2 = new NServer(name2, server1.getBar());
}
servers.put(name2, element);
addInternal(element, toSet(null));
servers.put(name2, server2);
server2.connectTo(lastNetwork());
playField.addInPlayfield(server2.getBar());
return CommandExecutionResult.ok();
}
private void addInternal(NServer server, Map<String, String> props) {
connect(server, props);
final String description = props.get("description");
if (description != null) {
server.setDescription(description);
}
final String shape = props.get("shape");
if (shape != null) {
server.setShape(shape);
}
playField.addInPlayfield(server.getBar());
}
private void connect(NServer server, final Map<String, String> props) {
server.connect(currentNetwork(), props);
}
public CommandExecutionResult addElement(String name, String definition) {
if (initDone == false) {
return errorNoInit();
@ -180,7 +201,7 @@ public class NwDiagram extends UmlDiagram {
currentGroup.addName(name);
}
NServer server = null;
if (currentNetwork() == null) {
if (lastNetwork() == null) {
if (currentGroup != null) {
return CommandExecutionResult.ok();
}
@ -197,15 +218,10 @@ public class NwDiagram extends UmlDiagram {
servers.put(name, server);
}
}
addInternal(server, toSet(definition));
return CommandExecutionResult.ok();
}
public CommandExecutionResult endSomething() {
if (initDone == false) {
return errorNoInit();
}
this.currentGroup = null;
final Map<String, String> props = toSet(definition);
server.connectTo(lastNetwork(), props.get("address"));
server.updateProperties(props);
playField.addInPlayfield(server.getBar());
return CommandExecutionResult.ok();
}
@ -357,7 +373,7 @@ public class NwDiagram extends UmlDiagram {
NwGroup group = getGroupOf(server);
if (group != null)
topMargin += group.getTopHeaderHeight(stringBounder, getSkinParam());
grid.add(i, col, server.asTextBlock(topMargin, conns, networks, getSkinParam()));
grid.add(i, col, server.getLinkedElement(topMargin, conns, networks, getSkinParam()));
}
}
}
@ -378,24 +394,24 @@ public class NwDiagram extends UmlDiagram {
if (initDone == false) {
return errorNoInit();
}
if ("address".equalsIgnoreCase(property) && currentNetwork() != null) {
currentNetwork().setOwnAdress(value);
if ("address".equalsIgnoreCase(property) && lastNetwork() != null) {
lastNetwork().setOwnAdress(value);
}
if ("width".equalsIgnoreCase(property) && currentNetwork() != null) {
currentNetwork().setFullWidth("full".equalsIgnoreCase(value));
if ("width".equalsIgnoreCase(property) && lastNetwork() != null) {
lastNetwork().setFullWidth("full".equalsIgnoreCase(value));
}
if ("color".equalsIgnoreCase(property)) {
final HColor color = value == null ? null
: getSkinParam().getIHtmlColorSet().getColorOrWhite(getSkinParam().getThemeStyle(), value);
if (currentGroup != null) {
currentGroup.setColor(color);
} else if (currentNetwork() != null) {
currentNetwork().setColor(color);
} else if (lastNetwork() != null) {
lastNetwork().setColor(color);
}
}
if ("description".equalsIgnoreCase(property)) {
if (currentGroup == null) {
currentNetwork().setDescription(value);
lastNetwork().setDescription(value);
} else {
currentGroup.setDescription(value);
}

View File

@ -106,7 +106,7 @@ public class NServer {
return style.getFontConfiguration(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet());
}
public LinkedElement asTextBlock(double topMargin, Map<Network, String> conns, List<Network> networks,
public LinkedElement getLinkedElement(double topMargin, Map<Network, String> conns, List<Network> networks,
ISkinParam skinParam) {
final StyleBuilder styleBuilder = skinParam.getCurrentStyleBuilder();
final SymbolContext symbolContext = getStyleDefinition(SName.server).getMergedStyle(styleBuilder)
@ -123,11 +123,13 @@ public class NServer {
return new LinkedElement(topMargin, this, box, conns2, networks);
}
public void connect(Network network, Map<String, String> props) {
String address = props.get("address");
if (address == null) {
public void connectTo(Network network) {
connectTo(network, "");
}
public void connectTo(Network network, String address) {
if (address == null)
address = "";
}
if (address.length() == 0 && connections.containsKey(network)) {
return;
}
@ -138,6 +140,17 @@ public class NServer {
bar.addStage(network.getUp());
}
public void updateProperties(Map<String, String> props) {
final String description = props.get("description");
if (description != null) {
this.setDescription(description);
}
final String shape = props.get("shape");
if (shape != null) {
this.setShape(shape);
}
}
@Override
public final String toString() {
return name;

View File

@ -0,0 +1,45 @@
/* ========================================================================
* 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.nwdiag.core;
import net.sourceforge.plantuml.ugraphic.color.HColor;
public interface NStackable {
public void setDescription(String description);
public void setColor(HColor color);
}

View File

@ -37,7 +37,7 @@ package net.sourceforge.plantuml.nwdiag.core;
import net.sourceforge.plantuml.nwdiag.next.NStage;
import net.sourceforge.plantuml.ugraphic.color.HColor;
public class Network {
public class Network implements NStackable {
private final String name;
private String description;
@ -93,6 +93,7 @@ public class Network {
return this.description;
}
@Override
public void setDescription(String description) {
this.description = description;
}
@ -101,6 +102,7 @@ public class Network {
return color;
}
@Override
public final void setColor(HColor color) {
this.color = color;
}

View File

@ -57,7 +57,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColor;
public class NwGroup {
public class NwGroup implements NStackable {
private final Set<String> names = new HashSet<>();
@ -94,7 +94,7 @@ public class NwGroup {
return "NwGroup:" + name + " " + names + " " + nbox;
}
public NwGroup(String name, Object... unused) {
public NwGroup(String name) {
this.name = name;
}
@ -106,10 +106,12 @@ public class NwGroup {
return color;
}
@Override
public final void setColor(HColor color) {
this.color = color;
}
@Override
public final void setDescription(String value) {
this.description = value;
}

View File

@ -98,9 +98,6 @@ public class PlayerAnalog extends Player {
return suggestedHeight;
}
public void drawFrameTitle(UGraphic ug) {
}
private SymbolContext getContext() {
return new SymbolContext(HColorUtils.COL_D7E0F2, HColorUtils.COL_038048).withStroke(new UStroke(1.5));
}

View File

@ -78,9 +78,6 @@ public class PlayerBinary extends Player {
return getHeightForConstraints(stringBounder) + suggestedHeight;
}
public void drawFrameTitle(UGraphic ug) {
}
private SymbolContext getContext() {
return new SymbolContext(HColorUtils.COL_D7E0F2, HColorUtils.COL_038048).withStroke(new UStroke(1.5));
}

View File

@ -34,11 +34,13 @@
*/
package net.sourceforge.plantuml.timingdiagram;
import java.awt.geom.Dimension2D;
import java.math.BigDecimal;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.command.Position;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.SymbolContext;
import net.sourceforge.plantuml.graphic.TextBlock;
@ -46,6 +48,7 @@ import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.UDrawable;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.timingdiagram.graphic.IntricatedPoint;
import net.sourceforge.plantuml.timingdiagram.graphic.PlayerFrame;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.ULine;
import net.sourceforge.plantuml.ugraphic.UStroke;
@ -56,20 +59,32 @@ public class PlayerClock extends Player {
private final int period;
private final int pulse;
private final int offset;
private final double ymargin = 8;
private final boolean displayTitle;
public PlayerClock(ISkinParam skinParam, TimingRuler ruler, int period, int pulse, boolean compact) {
super("", skinParam, ruler, compact);
public PlayerClock(String title, ISkinParam skinParam, TimingRuler ruler, int period, int pulse, int offset,
boolean compact) {
super(title, skinParam, ruler, compact);
this.displayTitle = title.length() > 0;
this.period = period;
this.pulse = pulse;
this.offset = offset;
this.suggestedHeight = 30;
}
public double getFullHeight(StringBounder striWngBounder) {
return suggestedHeight;
public double getFullHeight(StringBounder stringBounder) {
return suggestedHeight + getTitleHeight(stringBounder);
}
public void drawFrameTitle(UGraphic ug) {
private double getLineHeight(StringBounder stringBounder) {
return suggestedHeight - 2 * ymargin;
}
private double getTitleHeight(StringBounder stringBounder) {
if (displayTitle)
return getTitle().calculateDimension(stringBounder).getHeight();
return 0;
}
private SymbolContext getContext() {
@ -103,11 +118,26 @@ public class PlayerClock extends Player {
return 1.0 * pulse / period;
}
private double getOffsetCoef() {
return 1.0 * offset / period;
}
public final int getPeriod() {
return period;
}
public TextBlock getPart1(double fullAvailableWidth, double specialVSpace) {
if (displayTitle)
return new AbstractTextBlock() {
public void drawU(UGraphic ug) {
new PlayerFrame(getTitle()).drawFrameTitle(ug);
}
public Dimension2D calculateDimension(StringBounder stringBounder) {
return getTitle().calculateDimension(stringBounder);
}
};
return TextBlockUtils.empty(0, 0);
}
@ -115,7 +145,8 @@ public class PlayerClock extends Player {
return new UDrawable() {
public void drawU(UGraphic ug) {
ug = getContext().apply(ug);
final ULine vline = ULine.vline(getFullHeight(ug.getStringBounder()) - 2 * ymargin);
ug = ug.apply(UTranslate.dy(getTitleHeight(ug.getStringBounder())));
final ULine vline = ULine.vline(getLineHeight(ug.getStringBounder()));
int i = 0;
double lastx = -Double.MAX_VALUE;
while (i < 1000) {
@ -127,13 +158,22 @@ public class PlayerClock extends Player {
i++;
if (x > lastx) {
final double dx = x - lastx;
final ULine hline1 = ULine.hline(dx * getPulseCoef());
final ULine hline2 = ULine.hline(dx * (1 - getPulseCoef()));
ug.apply(new UTranslate(lastx, ymargin)).draw(vline);
ug.apply(new UTranslate(lastx, ymargin)).draw(hline1);
final double x2 = lastx + dx * getPulseCoef();
final ULine hline1 = ULine.hline(dx * getOffsetCoef());
final ULine hline2 = ULine.hline(dx * getPulseCoef());
final ULine hline3 = ULine.hline(dx * (1 - getPulseCoef() - getOffsetCoef()));
final double x2 = lastx + dx * getOffsetCoef();
final double x3 = lastx + dx * (getOffsetCoef() + getPulseCoef());
if (offset > 0)
ug.apply(new UTranslate(lastx, ymargin + vline.getDY())).draw(hline1);
ug.apply(new UTranslate(x2, ymargin)).draw(hline2);
ug.apply(new UTranslate(x3, ymargin + vline.getDY())).draw(hline3);
ug.apply(new UTranslate(x2, ymargin)).draw(vline);
ug.apply(new UTranslate(x2, ymargin + vline.getDY())).draw(hline2);
ug.apply(new UTranslate(x3, ymargin)).draw(vline);
}
lastx = x;
}

View File

@ -286,8 +286,10 @@ public class TimingDiagram extends UmlDiagram implements Clocks {
return CommandExecutionResult.ok();
}
public CommandExecutionResult createClock(String code, String full, int period, int pulse, boolean compact) {
final PlayerClock player = new PlayerClock(getSkinParam(), ruler, period, pulse, compactByDefault);
public CommandExecutionResult createClock(String code, String full, int period, int pulse, int offset,
boolean compact) {
final PlayerClock player = new PlayerClock(full, getSkinParam(), ruler, period, pulse, offset,
compactByDefault);
players.put(code, player);
clocks.put(code, player);
final TimeTick tick = new TimeTick(new BigDecimal(period), TimingFormat.DECIMAL);

View File

@ -59,6 +59,11 @@ public class CommandClock extends SingleLineCommand2<TimingDiagram> {
RegexLeaf.spaceOneOrMore())), //
new RegexLeaf("TYPE", "clock"), //
RegexLeaf.spaceOneOrMore(), //
new RegexOptional(new RegexConcat( //
new RegexLeaf("FULL", "[%g]([^%g]+)[%g]"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("as"), //
RegexLeaf.spaceOneOrMore())), //
new RegexLeaf("CODE", "([%pLN_.@]+)"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("with"), //
@ -71,7 +76,14 @@ public class CommandClock extends SingleLineCommand2<TimingDiagram> {
new RegexLeaf("pulse"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("PULSE", "([0-9]+)") //
)), RegexLeaf.end());
)), //
new RegexOptional(new RegexConcat( //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("offset"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("OFFSET", "([0-9]+)") //
)), //
RegexLeaf.end());
}
@Override
@ -79,12 +91,18 @@ public class CommandClock extends SingleLineCommand2<TimingDiagram> {
final String compact = arg.get("COMPACT", 0);
final String code = arg.get("CODE", 0);
final int period = Integer.parseInt(arg.get("PERIOD", 0));
final String pulseString = arg.get("PULSE", 0);
int pulse = 0;
if (pulseString != null) {
pulse = Integer.parseInt(pulseString);
}
return diagram.createClock(code, code, period, pulse, compact != null);
final int pulse = getInt(arg.get("PULSE", 0));
final int offset = getInt(arg.get("OFFSET", 0));
String full = arg.get("FULL", 0);
if (full == null)
full = "";
return diagram.createClock(code, full, period, pulse, offset, compact != null);
}
private int getInt(String value) {
if (value == null)
return 0;
return Integer.parseInt(value);
}
}

View File

@ -44,7 +44,7 @@ public class Version {
private static final int MAJOR_SEPARATOR = 1000000;
public static int version() {
return 1202110;
return 1202111;
}
public static int versionPatched() {
@ -80,7 +80,7 @@ public class Version {
}
public static int beta() {
final int beta = 6;
final int beta = 0;
return beta;
}
@ -93,7 +93,7 @@ public class Version {
}
public static long compileTime() {
return 1630331028954L;
return 1633181171844L;
}
public static String compileTimeString() {