From 0d7f2eea2cdaa751927d26e06040b702ea021d43 Mon Sep 17 00:00:00 2001 From: Arnaud Roques Date: Wed, 30 Nov 2022 18:41:17 +0100 Subject: [PATCH] wip --- src/net/sourceforge/plantuml/ISkinParam.java | 3 + src/net/sourceforge/plantuml/SkinParam.java | 10 ++ .../plantuml/SkinParamDelegator.java | 6 + .../activitydiagram3/ftile/Arrows.java | 59 ++----- .../activitydiagram3/ftile/ArrowsRegular.java | 85 ++++++++++ .../ftile/ArrowsTriangle.java | 81 ++++++++++ .../activitydiagram3/ftile/Snake.java | 10 +- .../plantuml/activitydiagram3/ftile/Worm.java | 16 +- .../activitydiagram3/ftile/WormMutation.java | 2 +- .../activitydiagram3/ftile/WormTexted.java | 4 +- .../vcompact/ConnectionVerticalDown.java | 17 +- .../vcompact/FtileFactoryDelegatorRepeat.java | 8 +- .../vcompact/FtileFactoryDelegatorWhile.java | 7 +- .../ftile/vcompact/FtileIfAndStop.java | 8 +- .../ftile/vcompact/FtileIfDown.java | 42 ++--- .../ftile/vcompact/FtileIfLongHorizontal.java | 146 +++++++++--------- .../ftile/vcompact/FtileIfLongVertical.java | 89 +++++------ .../ftile/vcompact/FtileRepeat.java | 38 ++--- .../ftile/vcompact/FtileWhile.java | 80 +++++----- .../ftile/vcompact/ParallelBuilderFork.java | 9 +- .../ftile/vcompact/ParallelBuilderMerge.java | 11 +- .../ftile/vcompact/ParallelBuilderSplit.java | 21 +-- .../ftile/vcompact/cond/FtileIfWithLinks.java | 144 ++++++++--------- .../cond/FtileSwitchWithManyLinks.java | 19 ++- .../vcompact/cond/FtileSwitchWithOneLink.java | 7 +- ...GConnectionHorizontalThenVerticalDown.java | 10 +- .../GConnectionSideThenVerticalThenSide.java | 3 +- .../gtile/GConnectionVerticalDown.java | 9 +- .../GConnectionVerticalDownThenBack.java | 5 +- ...GConnectionVerticalDownThenHorizontal.java | 12 +- .../sourceforge/plantuml/ebnf/ETileBox.java | 4 +- .../project/{Arrows.java => GArrows.java} | 32 ++-- .../plantuml/project/GanttArrow.java | 6 +- .../plantuml/sequencediagram/LinkAnchor.java | 6 +- .../sequencediagram/teoz/GroupingTile.java | 2 +- .../sourceforge/plantuml/version/Version.java | 2 +- 36 files changed, 543 insertions(+), 470 deletions(-) create mode 100644 src/net/sourceforge/plantuml/activitydiagram3/ftile/ArrowsRegular.java create mode 100644 src/net/sourceforge/plantuml/activitydiagram3/ftile/ArrowsTriangle.java rename src/net/sourceforge/plantuml/project/{Arrows.java => GArrows.java} (79%) diff --git a/src/net/sourceforge/plantuml/ISkinParam.java b/src/net/sourceforge/plantuml/ISkinParam.java index 1ecbc9887..83b80dad4 100644 --- a/src/net/sourceforge/plantuml/ISkinParam.java +++ b/src/net/sourceforge/plantuml/ISkinParam.java @@ -37,6 +37,7 @@ package net.sourceforge.plantuml; import java.util.Collection; +import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; import net.sourceforge.plantuml.cucadiagram.Rankdir; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.dot.DotSplines; @@ -192,4 +193,6 @@ public interface ISkinParam extends ISkinSimple { public LengthAdjust getlengthAdjust(); public double getParamSameClassWidth(); + + public Arrows arrows(); } diff --git a/src/net/sourceforge/plantuml/SkinParam.java b/src/net/sourceforge/plantuml/SkinParam.java index 788f85f04..5deb0e664 100644 --- a/src/net/sourceforge/plantuml/SkinParam.java +++ b/src/net/sourceforge/plantuml/SkinParam.java @@ -53,6 +53,9 @@ import java.util.Set; import java.util.TreeSet; import java.util.regex.Pattern; +import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; +import net.sourceforge.plantuml.activitydiagram3.ftile.ArrowsRegular; +import net.sourceforge.plantuml.activitydiagram3.ftile.ArrowsTriangle; import net.sourceforge.plantuml.command.BlocLines; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; @@ -1221,4 +1224,11 @@ public class SkinParam implements ISkinParam { return result; } + @Override + public Arrows arrows() { + if (strictUmlStyle()) + return new ArrowsTriangle(); + return new ArrowsRegular(); + } + } diff --git a/src/net/sourceforge/plantuml/SkinParamDelegator.java b/src/net/sourceforge/plantuml/SkinParamDelegator.java index 4e9cb9e1a..c9ae054b6 100644 --- a/src/net/sourceforge/plantuml/SkinParamDelegator.java +++ b/src/net/sourceforge/plantuml/SkinParamDelegator.java @@ -38,6 +38,7 @@ package net.sourceforge.plantuml; import java.util.Collection; import java.util.Map; +import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; import net.sourceforge.plantuml.creole.CreoleMode; import net.sourceforge.plantuml.creole.SheetBuilder; import net.sourceforge.plantuml.cucadiagram.Rankdir; @@ -458,4 +459,9 @@ public class SkinParamDelegator implements ISkinParam { return skinParam.sheet(fontConfiguration, horizontalAlignment, creoleMode, stereo); } + @Override + public Arrows arrows() { + return skinParam.arrows(); + } + } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Arrows.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Arrows.java index bbb601750..215b60098 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Arrows.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Arrows.java @@ -38,60 +38,29 @@ package net.sourceforge.plantuml.activitydiagram3.ftile; import net.sourceforge.plantuml.Direction; import net.sourceforge.plantuml.ugraphic.UPolygon; -public class Arrows { +public abstract class Arrows { - final static private double delta1 = 10; - final static private double delta2 = 4; + public abstract UPolygon asToUp(); - public static UPolygon asToUp() { - final UPolygon polygon = new UPolygon("asToUp"); - polygon.addPoint(-delta2, delta1); - polygon.addPoint(0, 0); - polygon.addPoint(delta2, delta1); - polygon.addPoint(0, delta1 - 4); - return polygon; - } + public abstract UPolygon asToDown(); - public static UPolygon asToDown() { - final UPolygon polygon = new UPolygon("asToDown"); - polygon.addPoint(-delta2, -delta1); - polygon.addPoint(0, 0); - polygon.addPoint(delta2, -delta1); - polygon.addPoint(0, -delta1 + 4); - return polygon; - } + public abstract UPolygon asToRight(); - public static UPolygon asToRight() { - final UPolygon polygon = new UPolygon("asToRight"); - polygon.addPoint(-delta1, -delta2); - polygon.addPoint(0, 0); - polygon.addPoint(-delta1, delta2); - polygon.addPoint(-delta1 + 4, 0); - return polygon; - } + public abstract UPolygon asToLeft(); - public static UPolygon asToLeft() { - final UPolygon polygon = new UPolygon("asToLeft"); - polygon.addPoint(delta1, -delta2); - polygon.addPoint(0, 0); - polygon.addPoint(delta1, delta2); - polygon.addPoint(delta1 - 4, 0); - return polygon; - } - - public static UPolygon asTo(Direction direction) { - if (direction == Direction.UP) { + public final UPolygon asTo(Direction direction) { + if (direction == Direction.UP) return asToUp(); - } - if (direction == Direction.DOWN) { + + if (direction == Direction.DOWN) return asToDown(); - } - if (direction == Direction.LEFT) { + + if (direction == Direction.LEFT) return asToLeft(); - } - if (direction == Direction.RIGHT) { + + if (direction == Direction.RIGHT) return asToRight(); - } + throw new IllegalArgumentException(); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/ArrowsRegular.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/ArrowsRegular.java new file mode 100644 index 000000000..401ee9de5 --- /dev/null +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/ArrowsRegular.java @@ -0,0 +1,85 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2023, 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; + +import net.sourceforge.plantuml.ugraphic.UPolygon; + +public class ArrowsRegular extends Arrows { + + final static private double delta1 = 10; + final static private double delta2 = 4; + + @Override + public UPolygon asToUp() { + final UPolygon polygon = new UPolygon("asToUp"); + polygon.addPoint(-delta2, delta1); + polygon.addPoint(0, 0); + polygon.addPoint(delta2, delta1); + polygon.addPoint(0, delta1 - 4); + return polygon; + } + + @Override + public UPolygon asToDown() { + final UPolygon polygon = new UPolygon("asToDown"); + polygon.addPoint(-delta2, -delta1); + polygon.addPoint(0, 0); + polygon.addPoint(delta2, -delta1); + polygon.addPoint(0, -delta1 + 4); + return polygon; + } + + @Override + public UPolygon asToRight() { + final UPolygon polygon = new UPolygon("asToRight"); + polygon.addPoint(-delta1, -delta2); + polygon.addPoint(0, 0); + polygon.addPoint(-delta1, delta2); + polygon.addPoint(-delta1 + 4, 0); + return polygon; + } + + @Override + public UPolygon asToLeft() { + final UPolygon polygon = new UPolygon("asToLeft"); + polygon.addPoint(delta1, -delta2); + polygon.addPoint(0, 0); + polygon.addPoint(delta1, delta2); + polygon.addPoint(delta1 - 4, 0); + return polygon; + } + +} diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/ArrowsTriangle.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/ArrowsTriangle.java new file mode 100644 index 000000000..3306aa5db --- /dev/null +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/ArrowsTriangle.java @@ -0,0 +1,81 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2023, 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; + +import net.sourceforge.plantuml.ugraphic.UPolygon; + +public class ArrowsTriangle extends Arrows { + + final static private double delta1 = 10; + final static private double delta2 = 4; + + @Override + public UPolygon asToUp() { + final UPolygon polygon = new UPolygon("asToUp"); + polygon.addPoint(-delta2, delta1); + polygon.addPoint(0, 0); + polygon.addPoint(delta2, delta1); + return polygon; + } + + @Override + public UPolygon asToDown() { + final UPolygon polygon = new UPolygon("asToDown"); + polygon.addPoint(-delta2, -delta1); + polygon.addPoint(delta2, -delta1); + polygon.addPoint(0, 0); + return polygon; + } + + @Override + public UPolygon asToRight() { + final UPolygon polygon = new UPolygon("asToRight"); + polygon.addPoint(-delta1, -delta2); + polygon.addPoint(0, 0); + polygon.addPoint(-delta1, delta2); + return polygon; + } + + @Override + public UPolygon asToLeft() { + final UPolygon polygon = new UPolygon("asToLeft"); + polygon.addPoint(delta1, -delta2); + polygon.addPoint(0, 0); + polygon.addPoint(delta1, delta2); + return polygon; + } + +} diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Snake.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Snake.java index 70d5ea26a..3746ef3de 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Snake.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Snake.java @@ -149,20 +149,20 @@ public class Snake implements UShape { public static Snake create(ISkinParam skinParam, Rainbow color) { final Style style = StyleSignatureBasic.activityArrow().getMergedStyle(skinParam.getCurrentStyleBuilder()); - return new Snake(skinParam, null, color, null, new Worm(style), MergeStrategy.FULL, null, + return new Snake(skinParam, null, color, null, new Worm(style, skinParam.arrows()), MergeStrategy.FULL, null, new ArrayList()); } public static Snake create(ISkinParam skinParam, Rainbow color, UPolygon endDecoration) { final Style style = StyleSignatureBasic.activityArrow().getMergedStyle(skinParam.getCurrentStyleBuilder()); - return new Snake(skinParam, null, color, endDecoration, new Worm(style), MergeStrategy.FULL, null, - new ArrayList()); + return new Snake(skinParam, null, color, endDecoration, new Worm(style, skinParam.arrows()), MergeStrategy.FULL, + null, new ArrayList()); } public static Snake create(ISkinParam skinParam, UPolygon startDecoration, Rainbow color, UPolygon endDecoration) { final Style style = StyleSignatureBasic.activityArrow().getMergedStyle(skinParam.getCurrentStyleBuilder()); - return new Snake(skinParam, startDecoration, color, endDecoration, new Worm(style), MergeStrategy.FULL, null, - new ArrayList()); + return new Snake(skinParam, startDecoration, color, endDecoration, new Worm(style, skinParam.arrows()), + MergeStrategy.FULL, null, new ArrayList()); } private Snake(ISkinParam skinParam, UPolygon startDecoration, Rainbow color, UPolygon endDecoration, Worm worm, diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Worm.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Worm.java index 5a4df7dad..1b43bd1d0 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Worm.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Worm.java @@ -61,9 +61,11 @@ public class Worm implements Iterable { private final List points = new ArrayList<>(); private final Style style; + private final Arrows arrows; - public Worm(Style style) { + public Worm(Style style, Arrows arrows) { this.style = style; + this.arrows = arrows; } public boolean isPureHorizontal() { @@ -73,7 +75,7 @@ public class Worm implements Iterable { private boolean ignoreForCompression; public Worm cloneEmpty() { - final Worm result = new Worm(style); + final Worm result = new Worm(style, arrows); result.ignoreForCompression = this.ignoreForCompression; return result; } @@ -147,13 +149,13 @@ public class Worm implements Iterable { private void drawLine(UGraphic ug, double x1, double y1, double x2, double y2, Direction direction) { ug = ug.apply(new UTranslate(x1, y1)); if (direction != null) - ug.apply(new UTranslate((x2 - x1) / 2, (y2 - y1) / 2)).draw(Arrows.asTo(direction)); + ug.apply(new UTranslate((x2 - x1) / 2, (y2 - y1) / 2)).draw(arrows.asTo(direction)); ug.draw(new ULine(x2 - x1, y2 - y1)); } public Worm move(double dx, double dy) { - final Worm result = new Worm(style); + final Worm result = new Worm(style, arrows); for (XPoint2D pt : points) result.addPoint(pt.getX() + dx, pt.getY() + dy); @@ -166,7 +168,7 @@ public class Worm implements Iterable { if (dx != 0 && dy != 0) throw new IllegalArgumentException("move=" + move); - final Worm result = new Worm(style); + final Worm result = new Worm(style, arrows); double x0 = this.points.get(0).getX(); double y0 = this.points.get(0).getY(); double x1 = this.points.get(1).getX(); @@ -195,7 +197,7 @@ public class Worm implements Iterable { if (dx != 0 && dy != 0) throw new IllegalArgumentException("move=" + move); - final Worm result = new Worm(style); + final Worm result = new Worm(style, arrows); double x8 = this.points.get(this.points.size() - 2).getX(); double y8 = this.points.get(this.points.size() - 2).getY(); double x9 = this.points.get(this.points.size() - 1).getX(); @@ -334,7 +336,7 @@ public class Worm implements Iterable { if (Snake.same(this.getLast(), other.getFirst()) == false) throw new IllegalArgumentException(); - final Worm result = new Worm(style); + final Worm result = new Worm(style, arrows); result.points.addAll(this.points); result.points.addAll(other.points); result.mergeMe(merge); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/WormMutation.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/WormMutation.java index 9d38e56a0..b34c06f96 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/WormMutation.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/WormMutation.java @@ -188,7 +188,7 @@ public class WormMutation { } public Worm mute(Worm original) { - final Worm result = new Worm(original.getStyle()); + final Worm result = original.cloneEmpty(); for (int i = 0; i < original.size(); i++) { result.addPoint(translations.get(i).getTranslated(original.get(i))); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/WormTexted.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/WormTexted.java index 1713b5eb4..d3d37aae8 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/WormTexted.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/WormTexted.java @@ -54,8 +54,8 @@ public class WormTexted implements Iterable { private final Worm worm; private TextBlock textBlock; - private WormTexted(Style style) { - this(new Worm(style)); + private WormTexted(Style style, Arrows arrows) { + this(new Worm(style, arrows)); } private WormTexted(Worm worm) { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ConnectionVerticalDown.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ConnectionVerticalDown.java index eee83cef1..102ad34a3 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ConnectionVerticalDown.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ConnectionVerticalDown.java @@ -35,8 +35,8 @@ */ package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact; +import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection; -import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; import net.sourceforge.plantuml.activitydiagram3.ftile.ConnectionTranslatable; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.Snake; @@ -57,9 +57,9 @@ public class ConnectionVerticalDown extends AbstractConnection implements Connec public ConnectionVerticalDown(Ftile ftile1, Ftile ftile2, XPoint2D p1, XPoint2D p2, Rainbow color, TextBlock textBlock) { super(ftile1, ftile2); - if (color.size() == 0) { + if (color.size() == 0) throw new IllegalArgumentException(); - } + this.p1 = p1; this.p2 = p2; this.color = color; @@ -75,7 +75,8 @@ public class ConnectionVerticalDown extends AbstractConnection implements Connec } private Snake getSimpleSnake() { - final Snake snake = Snake.create(getFtile1().skinParam(), color, Arrows.asToDown()).withLabel(textBlock, + final ISkinParam skinParam = getFtile1().skinParam(); + final Snake snake = Snake.create(skinParam, color, skinParam.arrows().asToDown()).withLabel(textBlock, arrowHorizontalAlignment()); snake.addPoint(p1); snake.addPoint(p2); @@ -84,7 +85,8 @@ public class ConnectionVerticalDown extends AbstractConnection implements Connec @Override public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) { - final Snake snake = Snake.create(getFtile1().skinParam(), color, Arrows.asToDown()).withLabel(textBlock, + final ISkinParam skinParam = getFtile1().skinParam(); + final Snake snake = Snake.create(skinParam, color, skinParam.arrows().asToDown()).withLabel(textBlock, arrowHorizontalAlignment()); final XPoint2D mp1a = translate1.getTranslated(p1); final XPoint2D mp2b = translate2.getTranslated(p2); @@ -95,11 +97,6 @@ public class ConnectionVerticalDown extends AbstractConnection implements Connec snake.addPoint(mp2b); ug.draw(snake); - // final Snake small = Snake.create(color, Arrows.asToDown()); - // small.addPoint(mp2b.getX(), middle); - // small.addPoint(mp2b); - // ug.draw(small); - } } \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorRepeat.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorRepeat.java index 3ee674950..fe68cbb0f 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorRepeat.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorRepeat.java @@ -38,7 +38,6 @@ package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact; import java.util.List; import net.sourceforge.plantuml.activitydiagram3.LinkRendering; -import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle; import net.sourceforge.plantuml.activitydiagram3.ftile.Connection; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; @@ -110,7 +109,7 @@ public class FtileFactoryDelegatorRepeat extends FtileFactoryDelegator { final UTranslate tr2 = genealogy.getTranslate(diamondBreak, ug.getStringBounder()); final XDimension2D dimDiamond = diamondBreak.calculateDimension(ug.getStringBounder()); - final Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToRight()); + final Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToRight()); snake.addPoint(tr1.getDx(), tr1.getDy()); snake.addPoint(0, tr1.getDy()); snake.addPoint(0, tr2.getDy() + dimDiamond.getHeight() / 2); @@ -133,10 +132,9 @@ public class FtileFactoryDelegatorRepeat extends FtileFactoryDelegator { } private Ftile getEntry(Swimlane swimlane, Display startLabel, Colors colors, BoxStyle boxStyleIn) { - if (Display.isNull(startLabel)) { + if (Display.isNull(startLabel)) return null; - } - // final Colors colors = Colors.empty().add(ColorType.BACK, back); + return this.activity(startLabel, swimlane, boxStyleIn, colors, null); } } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorWhile.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorWhile.java index 20bfddbec..2a72576ea 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorWhile.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorWhile.java @@ -39,7 +39,6 @@ import java.util.List; import net.sourceforge.plantuml.activitydiagram3.Instruction; import net.sourceforge.plantuml.activitydiagram3.LinkRendering; -import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; import net.sourceforge.plantuml.activitydiagram3.ftile.Connection; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileBreak; @@ -101,7 +100,7 @@ public class FtileFactoryDelegatorWhile extends FtileFactoryDelegator { public void drawU(UGraphic ug) { final UTranslate tr1 = genealogy.getTranslate(ftileBreak, ug.getStringBounder()); - final Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToLeft()); + final Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToLeft()); snake.addPoint(tr1.getDx(), tr1.getDy()); snake.addPoint(Hexagon.hexagonHalfSize, tr1.getDy()); ug.draw(snake); @@ -123,9 +122,9 @@ public class FtileFactoryDelegatorWhile extends FtileFactoryDelegator { } private LinkRendering ensureColor(LinkRendering link, Rainbow color) { - if (link.getRainbow().size() == 0) { + if (link.getRainbow().size() == 0) return link.withRainbow(color); - } + return link; } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfAndStop.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfAndStop.java index 33c2cb03b..50bf0b94c 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfAndStop.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfAndStop.java @@ -98,9 +98,9 @@ class FtileIfAndStop extends AbstractFtile { public Set getSwimlanes() { final Set result = new HashSet<>(); - if (getSwimlaneIn() != null) { + if (getSwimlaneIn() != null) result.add(getSwimlaneIn()); - } + result.addAll(tile1.getSwimlanes()); return Collections.unmodifiableSet(result); } @@ -153,7 +153,6 @@ class FtileIfAndStop extends AbstractFtile { final FtileGeometry dim1 = tile1.calculateDimension(stringBounder); final double x1 = calculateDimension(stringBounder).getLeft() - dim1.getLeft(); - // final double y1 = (dimTotal.getHeight() - 2 * h - dim1.getHeight()) / 2 + h; final double y1 = dimDiamond1.getHeight() + getSuppHeight(); return new UTranslate(x1, y1); } @@ -165,7 +164,6 @@ class FtileIfAndStop extends AbstractFtile { private UTranslate getTranslateDiamond1(StringBounder stringBounder) { final double y1 = 0; final XDimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder); - // final double x1 = getLeft(stringBounder) - dimDiamond1.getWidth() / 2; final double x1 = calculateDimension(stringBounder).getLeft() - dimDiamond1.getWidth() / 2; return new UTranslate(x1, y1); } @@ -197,7 +195,7 @@ class FtileIfAndStop extends AbstractFtile { final XPoint2D p1 = getP1(stringBounder); final XPoint2D p2 = getP2(stringBounder); - final Snake snake = Snake.create(skinParam(), color, Arrows.asToRight()); + final Snake snake = Snake.create(skinParam(), color, skinParam().arrows().asToRight()); snake.addPoint(p1); snake.addPoint(p2); ug.draw(snake); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfDown.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfDown.java index 2efa89076..312c95b10 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfDown.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfDown.java @@ -45,7 +45,6 @@ import java.util.Set; import net.sourceforge.plantuml.Direction; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; -import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; import net.sourceforge.plantuml.activitydiagram3.ftile.Connection; import net.sourceforge.plantuml.activitydiagram3.ftile.ConnectionTranslatable; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; @@ -160,9 +159,8 @@ public class FtileIfDown extends AbstractFtile { final StringBounder stringBounder = ug.getStringBounder(); final XPoint2D p1 = getP1(stringBounder); final XPoint2D p2 = getP2(stringBounder); - // p2 = new XPoint2D(p2.getX(), p1.getY()); - final Snake snake = Snake.create(skinParam(), color, Arrows.asToRight()); + final Snake snake = Snake.create(skinParam(), color, skinParam().arrows().asToRight()); snake.addPoint(p1); snake.addPoint(p2); ug.draw(snake); @@ -204,7 +202,7 @@ public class FtileIfDown extends AbstractFtile { public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); - final Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToDown()); + final Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToDown()); snake.addPoint(getP1(stringBounder)); snake.addPoint(getP2(stringBounder)); @@ -216,7 +214,7 @@ public class FtileIfDown extends AbstractFtile { final StringBounder stringBounder = ug.getStringBounder(); final XPoint2D p1 = getP1(stringBounder); final XPoint2D p2 = getP2(stringBounder); - final Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToDown()); + final Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToDown()); final XPoint2D mp1a = translate1.getTranslated(p1); final XPoint2D mp2b = translate2.getTranslated(p2); final double middle = (mp1a.getY() + mp2b.getY()) / 2.0; @@ -256,11 +254,10 @@ public class FtileIfDown extends AbstractFtile { public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); - if (getFtile1().calculateDimension(ug.getStringBounder()).hasPointOut() == false) { + if (getFtile1().calculateDimension(ug.getStringBounder()).hasPointOut() == false) return; - } - final Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToDown()); + final Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToDown()); snake.addPoint(getP1(stringBounder)); if (conditionEndStyle == ConditionEndStyle.DIAMOND) @@ -280,7 +277,7 @@ public class FtileIfDown extends AbstractFtile { final StringBounder stringBounder = ug.getStringBounder(); final XPoint2D p1 = getP1(stringBounder); final XPoint2D p2 = getP2(stringBounder); - final Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToDown()); + final Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToDown()); final XPoint2D mp1a = translate1.getTranslated(p1); final XPoint2D mp2b = translate2.getTranslated(p2); final double middle = (mp1a.getY() + mp2b.getY()) / 2.0; @@ -331,7 +328,7 @@ public class FtileIfDown extends AbstractFtile { final double t11 = getTranslateForThen(stringBounder).getDx(); final double xmin = Math.min(x1 - Hexagon.hexagonHalfSize, getTranslateForThen(stringBounder).getDx()); - final Snake snake = Snake.create(skinParam(), endInlinkColor, Arrows.asToRight()) + final Snake snake = Snake.create(skinParam(), endInlinkColor, skinParam().arrows().asToRight()) .emphasizeDirection(Direction.DOWN); snake.addPoint(x1, y1); snake.addPoint(xmin, y1); @@ -384,7 +381,7 @@ public class FtileIfDown extends AbstractFtile { final double xmax = Math.max(x1 + Hexagon.hexagonHalfSize, getTranslateForThen(stringBounder).getDx() + thenGeom.getWidth()); - final Snake snake = Snake.create(skinParam(), endInlinkColor, Arrows.asToLeft()) + final Snake snake = Snake.create(skinParam(), endInlinkColor, skinParam().arrows().asToLeft()) .emphasizeDirection(Direction.DOWN); snake.addPoint(x1, y1); snake.addPoint(xmax, y1); @@ -410,9 +407,9 @@ public class FtileIfDown extends AbstractFtile { final StringBounder stringBounder = ug.getStringBounder(); final XPoint2D p1 = getP1(stringBounder); - if (calculateDimension(stringBounder).hasPointOut() == false) { + if (calculateDimension(stringBounder).hasPointOut() == false) return; - } + final XPoint2D p2 = getP2(stringBounder); final double x1 = p1.getX(); @@ -424,25 +421,12 @@ public class FtileIfDown extends AbstractFtile { final double xmax = Math.max(x1 + Hexagon.hexagonHalfSize, getTranslateForThen(stringBounder).getDx() + thenGeom.getWidth()); - /* - * if( conditionEndStyle == ConditionEndStyle.DIAMOND ) { final Snake snake = - * new Snake(arrowHorizontalAlignment(), endInlinkColor, Arrows.asToLeft()); - * snake.addPoint(x1, y1); snake.addPoint(xmax, y1); snake.addPoint(xmax, y2); - * snake.addPoint(x2, y2); snake.emphasizeDirection(Direction.DOWN); - * ug.apply(new UTranslate(x2, y2 - Diamond.diamondHalfSize)).draw(new UEmpty(5, - * Diamond.diamondHalfSize)); ug.draw(snake); } - */ - final Snake snake = Snake.create(skinParam(), endInlinkColor, Arrows.asToDown()); + final Snake snake = Snake.create(skinParam(), endInlinkColor, skinParam().arrows().asToDown()); snake.addPoint(x1, y1); snake.addPoint(xmax, y1); snake.addPoint(xmax, y2); ug.apply(new UTranslate(xmax, y2 - Hexagon.hexagonHalfSize)).draw(new UEmpty(5, Hexagon.hexagonHalfSize)); ug.draw(snake); - /* - * final Snake snake2 = Snake.create(arrowHorizontalAlignment(), - * endInlinkColor); snake2.addPoint(xmax, y2); snake2.addPoint(x2, y2); - * ug.draw(snake2); - */ } @@ -495,9 +479,9 @@ public class FtileIfDown extends AbstractFtile { final StringBounder stringBounder = ug.getStringBounder(); final XPoint2D p1 = getP1(stringBounder); - if (calculateDimension(stringBounder).hasPointOut() == false) { + if (calculateDimension(stringBounder).hasPointOut() == false) return; - } + final XPoint2D p2 = getP2(stringBounder); final XPoint2D p3 = getP3(stringBounder); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongHorizontal.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongHorizontal.java index 21f2fa8c4..816f274ea 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongHorizontal.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongHorizontal.java @@ -47,7 +47,6 @@ 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.AbstractFtile; -import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; import net.sourceforge.plantuml.activitydiagram3.ftile.Connection; import net.sourceforge.plantuml.activitydiagram3.ftile.ConnectionTranslatable; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; @@ -87,9 +86,9 @@ class FtileIfLongHorizontal extends AbstractFtile { private FtileIfLongHorizontal(List diamonds, List inlabelSizes, List tiles, Ftile tile2, Rainbow arrowColor) { super(tiles.get(0).skinParam()); - if (diamonds.size() != tiles.size()) { + if (diamonds.size() != tiles.size()) throw new IllegalArgumentException(); - } + for (int i = 0; i < diamonds.size(); i++) { final Ftile diamond = diamonds.get(i); final FtileAssemblySimple tmp = new FtileAssemblySimple(diamond, tiles.get(i)); @@ -105,9 +104,9 @@ class FtileIfLongHorizontal extends AbstractFtile { private static List alignDiamonds(List diamonds, StringBounder stringBounder) { double maxOutY = 0; - for (Ftile diamond : diamonds) { + for (Ftile diamond : diamonds) maxOutY = Math.max(maxOutY, diamond.calculateDimension(stringBounder).getOutY()); - } + final List result = new ArrayList<>(); for (int i = 0; i < diamonds.size(); i++) { Ftile diamond = diamonds.get(i); @@ -121,12 +120,12 @@ class FtileIfLongHorizontal extends AbstractFtile { public Set getSwimlanes() { final Set result = new HashSet<>(); - if (getSwimlaneIn() != null) { + if (getSwimlaneIn() != null) result.add(getSwimlaneIn()); - } - for (Ftile tile : couples) { + + for (Ftile tile : couples) result.addAll(tile.getSwimlanes()); - } + result.addAll(tile2.getSwimlanes()); return Collections.unmodifiableSet(result); } @@ -146,9 +145,8 @@ class FtileIfLongHorizontal extends AbstractFtile { Objects.requireNonNull(afterEndwhile); final List tiles = new ArrayList<>(); - for (Branch branch : thens) { + for (Branch branch : thens) tiles.add(new FtileMinWidthCentered(branch.getFtile(), 30)); - } final Ftile tile2 = new FtileMinWidthCentered(branch2.getFtile(), 30); @@ -162,8 +160,8 @@ class FtileIfLongHorizontal extends AbstractFtile { ftileFactory.skinParam()); final HColor diamondColor = branch.getColor() == null ? backColor : branch.getColor(); - FtileDiamondInside2 diamond = new FtileDiamondInside2(tbTest, branch.skinParam(), diamondColor, - borderColor, swimlane); + FtileDiamondInside2 diamond = new FtileDiamondInside2(tbTest, branch.skinParam(), diamondColor, borderColor, + swimlane); TextBlock tbInlabel = null; if (Display.isNull(branch.getInlabel())) { inlabelSizes.add(0.0); @@ -196,15 +194,15 @@ class FtileIfLongHorizontal extends AbstractFtile { final Rainbow rainbowIn = thens.get(i).getInColor(arrowColor); final Branch branch = thens.get(i); - if (branch.getFtile().calculateDimension(ftileFactory.getStringBounder()).hasPointOut()) { + if (branch.getFtile().calculateDimension(ftileFactory.getStringBounder()).hasPointOut()) nbOut++; - } + final Rainbow rainbowOut = branch.getOut(); TextBlock out2 = null; - if (branch.getSpecial() != null) { + if (branch.getSpecial() != null) out2 = branch.getSpecial().getDisplay().create(fcTest, HorizontalAlignment.LEFT, ftileFactory.skinParam()); - } + final Rainbow rainbow1 = rainbowIn.size() == 0 ? arrowColor : rainbowIn; final Rainbow rainbow2 = rainbowOut.size() == 0 ? arrowColor : rainbowOut; @@ -223,9 +221,8 @@ class FtileIfLongHorizontal extends AbstractFtile { } conns.add(result.new ConnectionIn(topInColor)); TextBlock out2 = null; - if (branch2.getSpecial() != null) { + if (branch2.getSpecial() != null) out2 = branch2.getSpecial().getDisplay().create(fcTest, HorizontalAlignment.LEFT, ftileFactory.skinParam()); - } final Rainbow rainbowOut = branch2.getOut(); final Rainbow rainbowIn = branch2.getInColor(arrowColor); @@ -257,7 +254,7 @@ class FtileIfLongHorizontal extends AbstractFtile { final XPoint2D p1 = getP1(stringBounder); final XPoint2D p2 = getP2(stringBounder); - final Snake snake = Snake.create(skinParam(), color, Arrows.asToRight()); + final Snake snake = Snake.create(skinParam(), color, skinParam().arrows().asToRight()); snake.addPoint(p1); snake.addPoint(p2); ug.draw(snake); @@ -295,7 +292,7 @@ class FtileIfLongHorizontal extends AbstractFtile { public void drawU(UGraphic ug) { final UTranslate tr = getTranslateDiamond1(getFtile2(), ug.getStringBounder()); final XPoint2D p2 = tr.getTranslated(getFtile2().calculateDimension(ug.getStringBounder()).getPointIn()); - final Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToDown()); + final Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToDown()); final XPoint2D p1 = calculateDimensionInternal(ug.getStringBounder()).getPointIn(); snake.addPoint(p1); @@ -319,7 +316,7 @@ class FtileIfLongHorizontal extends AbstractFtile { final XPoint2D p1 = getP1(ug.getStringBounder()); final UTranslate tr2 = getTranslate2(ug.getStringBounder()); final XPoint2D p2 = tr2.getTranslated(getFtile2().calculateDimension(ug.getStringBounder()).getPointIn()); - final Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToDown()); + final Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToDown()); snake.addPoint(p1); snake.addPoint(p2.getX(), p1.getY()); snake.addPoint(p2); @@ -352,20 +349,21 @@ class FtileIfLongHorizontal extends AbstractFtile { final StringBounder stringBounder = ug.getStringBounder(); final UTranslate tr1 = getTranslate2(stringBounder); final FtileGeometry dim = getFtile1().calculateDimension(stringBounder); - if (dim.hasPointOut() == false) { + if (dim.hasPointOut() == false) return; - } + final XPoint2D p1 = tr1.getTranslated(dim.getPointOut()); final FtileGeometry full = calculateDimensionInternal(stringBounder); final double totalHeight = full.getHeight(); final XPoint2D p2 = new XPoint2D(p1.getX(), totalHeight); - final Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToDown()).withLabel(out2, arrowHorizontalAlignment()); + final Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToDown()).withLabel(out2, + arrowHorizontalAlignment()); snake.addPoint(p1); snake.addPoint(p2); - if (nbOut == 0) { + if (nbOut == 0) snake.addPoint(new XPoint2D(full.getLeft(), totalHeight)); - } + ug.draw(snake); } @@ -385,7 +383,7 @@ class FtileIfLongHorizontal extends AbstractFtile { final XPoint2D p1 = getP1(stringBounder); final XPoint2D p2 = getP2(stringBounder); - final Snake snake = Snake.create(skinParam(), color, Arrows.asToDown()); + final Snake snake = Snake.create(skinParam(), color, skinParam().arrows().asToDown()); snake.addPoint(p1); snake.addPoint(p2); ug.draw(snake); @@ -406,7 +404,7 @@ class FtileIfLongHorizontal extends AbstractFtile { final XPoint2D p1 = getP1(ug.getStringBounder()); final XPoint2D p2 = getP2(ug.getStringBounder()); - final Snake snake = Snake.create(skinParam(), color, Arrows.asToDown()); + final Snake snake = Snake.create(skinParam(), color, skinParam().arrows().asToDown()); final XPoint2D mp1a = translate1.getTranslated(p1); final XPoint2D mp2b = translate2.getTranslated(p2); @@ -435,12 +433,13 @@ class FtileIfLongHorizontal extends AbstractFtile { final StringBounder stringBounder = ug.getStringBounder(); final double totalHeight = calculateDimensionInternal(stringBounder).getHeight(); final XPoint2D p1 = getP1(stringBounder); - if (p1 == null) { + if (p1 == null) return; - } + final XPoint2D p2 = new XPoint2D(p1.getX(), totalHeight); - final Snake snake = Snake.create(skinParam(), color, Arrows.asToDown()).withLabel(out2, arrowHorizontalAlignment()); + final Snake snake = Snake.create(skinParam(), color, skinParam().arrows().asToDown()).withLabel(out2, + arrowHorizontalAlignment()); snake.addPoint(p1); snake.addPoint(p2); ug.draw(snake); @@ -448,9 +447,9 @@ class FtileIfLongHorizontal extends AbstractFtile { private XPoint2D getP1(StringBounder stringBounder) { final FtileGeometry geo = getFtile1().calculateDimension(stringBounder); - if (geo.hasPointOut() == false) { + if (geo.hasPointOut() == false) return null; - } + final XPoint2D p = geo.getPointOut(); return getTranslate1(getFtile1(), stringBounder).getTranslated(p); } @@ -485,9 +484,8 @@ class FtileIfLongHorizontal extends AbstractFtile { final double minX = minmax[0]; final double maxX = minmax[1]; - if (Double.isNaN(minX) || Double.isNaN(maxX)) { + if (Double.isNaN(minX) || Double.isNaN(maxX)) return; - } final Snake s = Snake.create(skinParam(), arrowColor).withMerge(MergeStrategy.NONE); s.addPoint(minX, totalDim.getHeight()); @@ -497,9 +495,9 @@ class FtileIfLongHorizontal extends AbstractFtile { private Double getLeftOut(final StringBounder stringBounder) { final FtileGeometry dim = calculateDimension(stringBounder); - if (dim.hasPointOut()) { + if (dim.hasPointOut()) return dim.getLeft(); - } + return null; } @@ -510,9 +508,9 @@ class FtileIfLongHorizontal extends AbstractFtile { if (leftOut == null) return new double[] { Double.NaN, Double.NaN }; - if (current == -1) { + if (current == -1) throw new IllegalStateException(); - } + final int first = getFirstSwimlane(stringBounder, allTiles, allSwimlanes); final int last = getLastSwimlane(stringBounder, allTiles, allSwimlanes); if (current < first || current > last) @@ -522,12 +520,12 @@ class FtileIfLongHorizontal extends AbstractFtile { minX = Math.min(minX, leftOut); maxX = Math.max(maxX, leftOut); for (Ftile tmp : allTiles) { - if (tmp.calculateDimension(stringBounder).hasPointOut() == false) { + if (tmp.calculateDimension(stringBounder).hasPointOut() == false) continue; - } - if (ftileDoesOutcomeInThatSwimlane(tmp, intoSw) == false) { + + if (ftileDoesOutcomeInThatSwimlane(tmp, intoSw) == false) continue; - } + final UTranslate ut = getTranslateFor(tmp, stringBounder); final double out = tmp.calculateDimension(stringBounder).translate(ut).getLeft(); minX = Math.min(minX, out); @@ -545,9 +543,9 @@ class FtileIfLongHorizontal extends AbstractFtile { minX = Math.min(minX, leftOut); maxX = Math.max(maxX, leftOut); for (Ftile tmp : allTiles) { - if (tmp.calculateDimension(stringBounder).hasPointOut() == false) { + if (tmp.calculateDimension(stringBounder).hasPointOut() == false) continue; - } + final UTranslate ut = getTranslateFor(tmp, stringBounder); final double out = tmp.calculateDimension(stringBounder).translate(ut).getLeft(); minX = Math.min(minX, out); @@ -557,20 +555,18 @@ class FtileIfLongHorizontal extends AbstractFtile { } private int getFirstSwimlane(StringBounder stringBounder, List allTiles, List allSwimlanes) { - for (int i = 0; i < allSwimlanes.size(); i++) { - if (atLeastOne(stringBounder, allSwimlanes.get(i), allTiles)) { + for (int i = 0; i < allSwimlanes.size(); i++) + if (atLeastOne(stringBounder, allSwimlanes.get(i), allTiles)) return i; - } - } + throw new IllegalStateException(); } private int getLastSwimlane(StringBounder stringBounder, List allTiles, List allSwimlanes) { - for (int i = allSwimlanes.size() - 1; i >= 0; i--) { - if (atLeastOne(stringBounder, allSwimlanes.get(i), allTiles)) { + for (int i = allSwimlanes.size() - 1; i >= 0; i--) + if (atLeastOne(stringBounder, allSwimlanes.get(i), allTiles)) return i; - } - } + throw new IllegalStateException(); } @@ -596,15 +592,15 @@ class FtileIfLongHorizontal extends AbstractFtile { @Override public UTranslate getTranslateFor(Ftile child, StringBounder stringBounder) { - if (child == tile2) { + if (child == tile2) return getTranslate2(stringBounder); - } - if (couples.contains(child)) { + + if (couples.contains(child)) return getTranslateCouple1(child, stringBounder); - } - if (tiles.contains(child)) { + + if (tiles.contains(child)) return getTranslate1(child, stringBounder); - } + throw new UnsupportedOperationException(); } @@ -623,9 +619,9 @@ class FtileIfLongHorizontal extends AbstractFtile { private UTranslate getTranslateDiamond1(Ftile diamond, StringBounder stringBounder) { final int idx = diamonds.indexOf(diamond); - if (idx == -1) { + if (idx == -1) throw new IllegalArgumentException(); - } + final UTranslate trCouple = getTranslateCouple1(couples.get(idx), stringBounder); final UTranslate in = couples.get(idx).getTranslateFor(diamond, stringBounder); return trCouple.compose(in); @@ -633,9 +629,9 @@ class FtileIfLongHorizontal extends AbstractFtile { private UTranslate getTranslate1(Ftile tile, StringBounder stringBounder) { final int idx = tiles.indexOf(tile); - if (idx == -1) { + if (idx == -1) throw new IllegalArgumentException(); - } + final UTranslate trCouple = getTranslateCouple1(couples.get(idx), stringBounder); final UTranslate in = couples.get(idx).getTranslateFor(tile, stringBounder); return trCouple.compose(in); @@ -646,9 +642,9 @@ class FtileIfLongHorizontal extends AbstractFtile { for (Ftile couple : couples) { final FtileGeometry dim1 = couple.calculateDimension(stringBounder); - if (couple == candidat) { + if (couple == candidat) return new UTranslate(x1, 25); - } + x1 += dim1.getWidth() + xSeparation; } throw new IllegalArgumentException(); @@ -657,18 +653,17 @@ class FtileIfLongHorizontal extends AbstractFtile { public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); - for (Ftile couple : couples) { + for (Ftile couple : couples) ug.apply(getTranslateCouple1(couple, stringBounder)).draw(couple); - } ug.apply(getTranslate2(stringBounder)).draw(tile2); } private FtileGeometry calculateDimensionInternal(StringBounder stringBounder) { XDimension2D result = new XDimension2D(0, 0); - for (Ftile couple : couples) { + for (Ftile couple : couples) result = result.mergeLR(couple.calculateDimension(stringBounder)); - } + XDimension2D dimTile2 = tile2.calculateDimension(stringBounder); dimTile2 = dimTile2.delta(0, getDiamondsHeight(stringBounder) / 2); result = result.mergeLR(dimTile2); @@ -679,9 +674,9 @@ class FtileIfLongHorizontal extends AbstractFtile { private double getDiamondsHeight(StringBounder stringBounder) { double height = 0; - for (Ftile diamond : diamonds) { + for (Ftile diamond : diamonds) height = Math.max(height, diamond.calculateDimension(stringBounder).getHeight()); - } + return height; } @@ -691,11 +686,10 @@ class FtileIfLongHorizontal extends AbstractFtile { final List all = new ArrayList<>(tiles); all.add(tile2); - for (Ftile tmp : all) { - if (tmp.calculateDimension(stringBounder).hasPointOut()) { + for (Ftile tmp : all) + if (tmp.calculateDimension(stringBounder).hasPointOut()) return new FtileGeometry(dimTotal, dimTotal.getWidth() / 2, 0, dimTotal.getHeight()); - } - } + return new FtileGeometry(dimTotal, dimTotal.getWidth() / 2, 0); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongVertical.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongVertical.java index 018a2d34f..138310650 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongVertical.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongVertical.java @@ -46,7 +46,6 @@ 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.AbstractFtile; -import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; import net.sourceforge.plantuml.activitydiagram3.ftile.Connection; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; @@ -95,9 +94,9 @@ class FtileIfLongVertical extends AbstractFtile { private FtileIfLongVertical(List diamonds, List tiles, Ftile tile2, Rainbow arrowColor, Ftile lastDiamond) { super(tiles.get(0).skinParam()); - if (diamonds.size() != tiles.size()) { + if (diamonds.size() != tiles.size()) throw new IllegalArgumentException(); - } + this.lastDiamond = lastDiamond; this.tile2 = tile2; this.diamonds = new ArrayList<>(diamonds); @@ -109,12 +108,12 @@ class FtileIfLongVertical extends AbstractFtile { public Set getSwimlanes() { final Set result = new HashSet<>(); - if (getSwimlaneIn() != null) { + if (getSwimlaneIn() != null) result.add(getSwimlaneIn()); - } - for (Ftile tile : tiles) { + + for (Ftile tile : tiles) result.addAll(tile.getSwimlanes()); - } + result.addAll(tile2.getSwimlanes()); return Collections.unmodifiableSet(result); } @@ -184,9 +183,8 @@ class FtileIfLongVertical extends AbstractFtile { conns.add(result.new ConnectionVertical(diamonds.get(i), diamonds.get(i + 1), arrowColor, tbInlabel)); } 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++) conns.add(result.new ConnectionThenOutConnect(tiles.get(i), arrowColor)); - } final Rainbow topInColor = topInlinkRendering.getRainbow(arrowColor); conns.add(result.new ConnectionIn(topInColor)); @@ -211,7 +209,7 @@ class FtileIfLongVertical extends AbstractFtile { public void drawU(UGraphic ug) { final UTranslate tr = getTranslateDiamond(getFtile2(), ug.getStringBounder()); final XPoint2D p2 = tr.getTranslated(getFtile2().calculateDimension(ug.getStringBounder()).getPointIn()); - final Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToDown()); + final Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToDown()); final XPoint2D p1 = calculateDimensionInternal(ug.getStringBounder()).getPointIn(); snake.addPoint(p1); @@ -237,7 +235,7 @@ class FtileIfLongVertical extends AbstractFtile { final XPoint2D p1 = getP1(stringBounder); final XPoint2D p2 = getP2(stringBounder); - final Snake snake = Snake.create(skinParam(), color, Arrows.asToDown()); + final Snake snake = Snake.create(skinParam(), color, skinParam().arrows().asToDown()); snake.addPoint(p1); snake.addPoint(p2.getX(), p1.getY()); snake.addPoint(p2); @@ -274,7 +272,7 @@ class FtileIfLongVertical extends AbstractFtile { final XPoint2D p1 = getP1(stringBounder); final XPoint2D p2 = getP2(stringBounder); - final Snake snake = Snake.create(skinParam(), color, Arrows.asToDown()).withLabel(label, + final Snake snake = Snake.create(skinParam(), color, skinParam().arrows().asToDown()).withLabel(label, VerticalAlignment.CENTER); snake.addPoint(p1); snake.addPoint(p2); @@ -313,7 +311,7 @@ class FtileIfLongVertical extends AbstractFtile { final XPoint2D p2 = getTranslate2(stringBounder) .getTranslated(getFtile2().calculateDimension(stringBounder).getPointIn()); - final Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToDown()).withLabel(label, + final Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToDown()).withLabel(label, VerticalAlignment.CENTER); snake.addPoint(p1); snake.addPoint(p1.getX(), p2.getY() - 15); @@ -336,14 +334,14 @@ class FtileIfLongVertical extends AbstractFtile { public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); final FtileGeometry dim1 = getFtile1().calculateDimension(stringBounder); - if (dim1.hasPointOut() == false) { + if (dim1.hasPointOut() == false) return; - } + final XPoint2D p1 = getTranslate2(stringBounder).getTranslated(dim1.getPointOut()); final XPoint2D p2 = getTranslateLastDiamond(stringBounder) .getTranslated(getFtile2().calculateDimension(stringBounder).getPointIn()); - final Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToDown()); + final Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToDown()); snake.addPoint(p1); snake.addPoint(p1.getX(), p2.getY() - 15); snake.addPoint(p2.getX(), p2.getY() - 15); @@ -365,9 +363,9 @@ class FtileIfLongVertical extends AbstractFtile { public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); final FtileGeometry dim1 = getFtile1().calculateDimension(stringBounder); - if (dim1.hasPointOut() == false) { + if (dim1.hasPointOut() == false) return; - } + final XPoint2D p1 = getTranslate1(getFtile1(), stringBounder).getTranslated(dim1.getPointOut()); final FtileGeometry dimLastDiamond = getFtile2().calculateDimension(stringBounder); @@ -377,7 +375,7 @@ class FtileIfLongVertical extends AbstractFtile { final XDimension2D dimTotal = calculateDimensionInternal(stringBounder); - final Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToLeft()); + final Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToLeft()); snake.addPoint(p1); snake.addPoint(p1.getX(), p1.getY() + 15); snake.addPoint(dimTotal.getWidth(), p1.getY() + 15); @@ -399,16 +397,16 @@ class FtileIfLongVertical extends AbstractFtile { public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); final FtileGeometry dim1 = getFtile1().calculateDimension(stringBounder); - if (dim1.hasPointOut() == false) { + if (dim1.hasPointOut() == false) return; - } + final XPoint2D p1 = getTranslate1(getFtile1(), stringBounder).getTranslated(dim1.getPointOut()); final XDimension2D dimTotal = calculateDimensionInternal(stringBounder); final XPoint2D p2 = new XPoint2D(dimTotal.getWidth(), p1.getY() + 15); - final Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToRight()); + final Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToRight()); snake.addPoint(p1); snake.addPoint(p1.getX(), p2.getY()); snake.addPoint(p2); @@ -419,18 +417,18 @@ class FtileIfLongVertical extends AbstractFtile { @Override public UTranslate getTranslateFor(Ftile child, StringBounder stringBounder) { - if (child == tile2) { + if (child == tile2) return getTranslate2(stringBounder); - } - if (child == lastDiamond) { + + if (child == lastDiamond) return getTranslateLastDiamond(stringBounder); - } - if (tiles.contains(child)) { + + if (tiles.contains(child)) return getTranslate1(child, stringBounder); - } - if (diamonds.contains(child)) { + + if (diamonds.contains(child)) return getTranslateDiamond(child, stringBounder); - } + throw new UnsupportedOperationException(); } @@ -438,9 +436,9 @@ class FtileIfLongVertical extends AbstractFtile { final double allDiamondsWidth = allDiamondsWidth(stringBounder); final int idx = diamonds.indexOf(diamond); - if (idx == -1) { + if (idx == -1) throw new IllegalArgumentException(); - } + final double y1 = getTranslateDy(idx, stringBounder); return new UTranslate((allDiamondsWidth - diamond.calculateDimension(stringBounder).getWidth()) / 2, y1); } @@ -454,9 +452,9 @@ class FtileIfLongVertical extends AbstractFtile { private UTranslate getTranslate1(Ftile candidat, StringBounder stringBounder) { final int idx = tiles.indexOf(candidat); - if (idx == -1) { + if (idx == -1) throw new IllegalArgumentException(); - } + final double y1 = getTranslateDy(idx, stringBounder); final FtileGeometry diam = diamonds.get(idx).calculateDimension(stringBounder); final FtileGeometry dim1 = candidat.calculateDimension(stringBounder); @@ -487,12 +485,11 @@ class FtileIfLongVertical extends AbstractFtile { public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); - for (Ftile tile1 : tiles) { + for (Ftile tile1 : tiles) ug.apply(getTranslate1(tile1, stringBounder)).draw(tile1); - } - for (Ftile diam : diamonds) { + + for (Ftile diam : diamonds) ug.apply(getTranslateDiamond(diam, stringBounder)).draw(diam); - } ug.apply(getTranslate2(stringBounder)).draw(tile2); ug.apply(getTranslateLastDiamond(stringBounder)).draw(lastDiamond); @@ -500,21 +497,16 @@ class FtileIfLongVertical extends AbstractFtile { private FtileGeometry calculateDimensionInternal(StringBounder stringBounder) { double col1 = 0; - // double col1overpass = 0; double col2 = 0; double height = marginy1; for (int i = 0; i < tiles.size(); i++) { final FtileGeometry dim1 = tiles.get(i).calculateDimension(stringBounder); -// final FtileGeometry diamondOverpassing = ((FtileOverpassing) diamonds.get(i)) -// .getOverpassDimension(stringBounder); final FtileGeometry diamondDim = diamonds.get(i).calculateDimension(stringBounder); height += diamondDim.getHeight() + dim1.getHeight(); col1 = Math.max(col1, diamondDim.getWidth()); - // col1overpass = Math.max(col1overpass, diamondOverpassing.getWidth()); col2 = Math.max(col2, dim1.getWidth()); } - // final double width = Math.max(col1 + col2, col1overpass); final double width = col1 + col2; FtileGeometry result = new FtileGeometry(width, height, width / 2, 0); @@ -529,9 +521,9 @@ class FtileIfLongVertical extends AbstractFtile { private double allDiamondsWidth(StringBounder stringBounder) { double width = 0; - for (Ftile diam : diamonds) { + for (Ftile diam : diamonds) width = Math.max(width, diam.calculateDimension(stringBounder).getWidth()); - } + return width; } @@ -541,11 +533,10 @@ class FtileIfLongVertical extends AbstractFtile { final List all = new ArrayList<>(tiles); all.add(tile2); - for (Ftile tmp : all) { - if (tmp.calculateDimension(stringBounder).hasPointOut()) { + for (Ftile tmp : all) + if (tmp.calculateDimension(stringBounder).hasPointOut()) return new FtileGeometry(dimTotal, dimTotal.getWidth() / 2, 0, dimTotal.getHeight()); - } - } + return new FtileGeometry(dimTotal, dimTotal.getWidth() / 2, 0); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java index ee727c06c..32a057f17 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java @@ -48,7 +48,6 @@ import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.activitydiagram3.LinkRendering; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; -import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; import net.sourceforge.plantuml.activitydiagram3.ftile.Connection; import net.sourceforge.plantuml.activitydiagram3.ftile.ConnectionTranslatable; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; @@ -220,7 +219,7 @@ class FtileRepeat extends AbstractFtile { public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); - final Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToDown()).withLabel(tbin, + final Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToDown()).withLabel(tbin, arrowHorizontalAlignment()); final XPoint2D p1 = getP1(stringBounder); final XPoint2D p2 = getP2(stringBounder); @@ -261,7 +260,7 @@ class FtileRepeat extends AbstractFtile { if (getFtile1().calculateDimension(stringBounder).hasPointOut() == false) return; - final Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToDown()).withLabel(tbout, + final Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToDown()).withLabel(tbout, arrowHorizontalAlignment()); snake.addPoint(getP1(stringBounder)); snake.addPoint(getP2(stringBounder)); @@ -284,7 +283,7 @@ class FtileRepeat extends AbstractFtile { snake.addPoint(mp2b.getX(), middle); ug.draw(snake); - final Snake small = Snake.create(skinParam(), arrowColor, Arrows.asToDown()).withLabel(tbout, + final Snake small = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToDown()).withLabel(tbout, arrowHorizontalAlignment()); small.addPoint(mp2b.getX(), middle); small.addPoint(mp2b); @@ -335,7 +334,8 @@ class FtileRepeat extends AbstractFtile { final Snake snake; if (x2 < x1_a) { - snake = Snake.create(skinParam(), arrowColor, Arrows.asToLeft()).emphasizeDirection(Direction.UP); + snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToLeft()) + .emphasizeDirection(Direction.UP); snake.addPoint(x1_a, y1); if (x1_a < x1_b) { snake.addPoint(x1_b, y1); @@ -346,7 +346,8 @@ class FtileRepeat extends AbstractFtile { } } else { x2 = p2.getX(); - snake = Snake.create(skinParam(), arrowColor, Arrows.asToRight()).emphasizeDirection(Direction.UP); + snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToRight()) + .emphasizeDirection(Direction.UP); snake.addPoint(x1_a, y1); final double middle = x1_a / 4 + x2 * 3 / 4; snake.addPoint(middle, y1); @@ -388,7 +389,7 @@ class FtileRepeat extends AbstractFtile { final double x2 = p2.getX(); final double y2 = p2.getY(); - final Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToUp()).withLabel(tbback, + final Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToUp()).withLabel(tbback, arrowHorizontalAlignment()); snake.addPoint(x1, y1); @@ -413,7 +414,7 @@ class FtileRepeat extends AbstractFtile { final double x2 = p2.getX(); final double y2 = p2.getY(); - final Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToUp()).withLabel(tbback, + final Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToUp()).withLabel(tbback, arrowHorizontalAlignment()); snake.addPoint(x1, y1); @@ -462,10 +463,10 @@ class FtileRepeat extends AbstractFtile { x2 += dimDiamond1.getWidth(); final double y2 = p2.getY() + dimDiamond1.getHeight() / 2; - Snake snake = Snake.create(skinParam(), arrowColor, x2 < x1 ? Arrows.asToLeft() : Arrows.asToRight()); - if (label != null) { + Snake snake = Snake.create(skinParam(), arrowColor, + x2 < x1 ? skinParam().arrows().asToLeft() : skinParam().arrows().asToRight()); + if (label != null) snake = snake.withLabel(label, arrowHorizontalAlignment()); - } snake.addPoint(x1, y1); snake.addPoint(x1, y2); @@ -478,10 +479,10 @@ class FtileRepeat extends AbstractFtile { public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); - Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToLeft()); - if (label != null) { + Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToLeft()); + if (label != null) snake = snake.withLabel(label, arrowHorizontalAlignment()); - } + final XPoint2D p1 = getP1(stringBounder); final XPoint2D p2 = getP2(stringBounder); final XDimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder); @@ -520,9 +521,8 @@ class FtileRepeat extends AbstractFtile { public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); - final Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToRight()) + final Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToRight()) .emphasizeDirection(Direction.UP).withLabel(tbback, arrowHorizontalAlignment()); - // final XDimension2D dimTotal = calculateDimensionInternal(stringBounder); final XPoint2D p1 = getP1(stringBounder); final XPoint2D p2 = getP2(stringBounder); final XDimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder); @@ -544,7 +544,7 @@ class FtileRepeat extends AbstractFtile { @Override public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) { final StringBounder stringBounder = ug.getStringBounder(); - final Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToLeft()) + final Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToLeft()) .emphasizeDirection(Direction.UP).withLabel(tbback, arrowHorizontalAlignment()); final XDimension2D dimRepeat = repeat.calculateDimension(stringBounder); @@ -592,7 +592,7 @@ class FtileRepeat extends AbstractFtile { public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); - final Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToLeft()) + final Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToLeft()) .emphasizeDirection(Direction.UP).withLabel(tbback, arrowHorizontalAlignment()); final XDimension2D dimTotal = calculateDimensionInternal(stringBounder); final XPoint2D p1 = getP1(stringBounder); @@ -616,7 +616,7 @@ class FtileRepeat extends AbstractFtile { @Override public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) { final StringBounder stringBounder = ug.getStringBounder(); - final Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToLeft()) + final Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToLeft()) .emphasizeDirection(Direction.UP).withLabel(tbback, arrowHorizontalAlignment()); final XDimension2D dimRepeat = repeat.calculateDimension(stringBounder); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java index 268d13cd6..9099ec9df 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java @@ -47,7 +47,6 @@ import net.sourceforge.plantuml.activitydiagram3.Instruction; import net.sourceforge.plantuml.activitydiagram3.LinkRendering; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; -import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; import net.sourceforge.plantuml.activitydiagram3.ftile.Connection; import net.sourceforge.plantuml.activitydiagram3.ftile.ConnectionTranslatable; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; @@ -85,9 +84,9 @@ class FtileWhile extends AbstractFtile { @Override public Collection getMyChildren() { - if (specialOut == null) { + if (specialOut == null) return Arrays.asList(whileBlock, diamond1); - } + return Arrays.asList(whileBlock, diamond1, specialOut); } @@ -126,18 +125,17 @@ class FtileWhile extends AbstractFtile { ftileFactory.skinParam()); final Ftile diamond1; - if (conditionStyle == ConditionStyle.INSIDE_HEXAGON) { + if (conditionStyle == ConditionStyle.INSIDE_HEXAGON) diamond1 = new FtileDiamondInside(testTb, whileBlock.skinParam(), backColor, borderColor, swimlane) .withNorth(yesTb).withWest(outTb); - } else if (conditionStyle == ConditionStyle.INSIDE_DIAMOND) { + else if (conditionStyle == ConditionStyle.INSIDE_DIAMOND) diamond1 = new FtileDiamondSquare(testTb, whileBlock.skinParam(), backColor, borderColor, swimlane) .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) .withSouth(yesTb).withWest(outTb); - } else { + else throw new IllegalStateException(); - } final Ftile special = specialOut == null ? null : specialOut.createFtile(ftileFactory); final FtileWhile result = new FtileWhile(whileBlock, diamond1, special, backward); @@ -160,11 +158,11 @@ class FtileWhile extends AbstractFtile { conns.add(result.new ConnectionBackBackward2(incoming2.getRainbow(), back2)); } } - if (specialOut == null) { + if (specialOut == null) conns.add(result.new ConnectionOut(outColor.getRainbow())); - } else { + else conns.add(result.new ConnectionOutSpecial(outColor.getRainbow())); - } + return FtileUtils.addConnection(result, conns); } @@ -189,7 +187,7 @@ class FtileWhile extends AbstractFtile { public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); - final Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToDown()); + final Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToDown()); snake.addPoint(getP1(stringBounder)); snake.addPoint(getP2(stringBounder)); @@ -201,7 +199,7 @@ class FtileWhile extends AbstractFtile { final StringBounder stringBounder = ug.getStringBounder(); final XPoint2D p1 = getP1(stringBounder); final XPoint2D p2 = getP2(stringBounder); - final Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToDown()) + final Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToDown()) .withMerge(MergeStrategy.LIMITED); final XPoint2D mp1a = translate1.getTranslated(p1); final XPoint2D mp2b = translate2.getTranslated(p2); @@ -226,9 +224,9 @@ class FtileWhile extends AbstractFtile { private XPoint2D getP1(final StringBounder stringBounder) { final FtileGeometry geo = whileBlock.calculateDimension(stringBounder); - if (geo.hasPointOut() == false) { + if (geo.hasPointOut() == false) return null; - } + return getTranslateForWhile(stringBounder).getTranslated(geo.getPointOut()); } @@ -246,9 +244,9 @@ class FtileWhile extends AbstractFtile { final XDimension2D dimTotal = calculateDimension(stringBounder); final XPoint2D p1 = getP1(stringBounder); - if (p1 == null) { + if (p1 == null) return; - } + final XPoint2D p2 = getP2(stringBounder); final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder); @@ -258,7 +256,7 @@ class FtileWhile extends AbstractFtile { final double half = (dimDiamond1.getOutY() - dimDiamond1.getInY()) / 2; final double y2 = p2.getY() + dimDiamond1.getInY() + half; - final Snake snake = Snake.create(skinParam(), endInlinkColor, Arrows.asToLeft()) + final Snake snake = Snake.create(skinParam(), endInlinkColor, skinParam().arrows().asToLeft()) .emphasizeDirection(Direction.UP).withLabel(back, arrowHorizontalAlignment()); snake.addPoint(x1, y1); final double y1bis = Math.max(y1, getBottom(stringBounder)) + Hexagon.hexagonHalfSize; @@ -276,7 +274,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(skinParam(), endInlinkColor, Arrows.asToLeft()) + final Snake snake = Snake.create(skinParam(), endInlinkColor, skinParam().arrows().asToLeft()) .withMerge(MergeStrategy.LIMITED); final XDimension2D dimTotal = calculateDimension(stringBounder); final XPoint2D ap1 = getP1(stringBounder); @@ -304,7 +302,7 @@ class FtileWhile extends AbstractFtile { ug.apply(new UTranslate(x1, y1 + Hexagon.hexagonHalfSize)).draw(new UEmpty(5, Hexagon.hexagonHalfSize)); 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(skinParam().arrows().asToUp()); } @@ -322,9 +320,9 @@ class FtileWhile extends AbstractFtile { private XPoint2D getP1(final StringBounder stringBounder) { final FtileGeometry geo = whileBlock.calculateDimension(stringBounder); - if (geo.hasPointOut() == false) { + if (geo.hasPointOut() == false) return null; - } + return getTranslateForWhile(stringBounder).getTranslated(geo.getPointOut()); } @@ -342,16 +340,16 @@ class FtileWhile extends AbstractFtile { final StringBounder stringBounder = ug.getStringBounder(); final XPoint2D p1 = getP1(stringBounder); - if (p1 == null) { + if (p1 == null) return; - } + final XPoint2D p2 = getP2(stringBounder); final double x1 = p1.getX(); final double y1 = p1.getY(); final double x2 = p2.getX(); final double y2 = p2.getY(); - final Snake snake = Snake.create(skinParam(), endInlinkColor, Arrows.asToUp()).withLabel(back, + final Snake snake = Snake.create(skinParam(), endInlinkColor, skinParam().arrows().asToUp()).withLabel(back, arrowHorizontalAlignment()); snake.addPoint(x1, y1); final double y1bis = Math.max(y1, getBottom(stringBounder)) + Hexagon.hexagonHalfSize; @@ -386,8 +384,8 @@ class FtileWhile extends AbstractFtile { public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); - final Snake snake = Snake.create(skinParam(), endInlinkColor, Arrows.asToLeft()).withLabel(back, - arrowHorizontalAlignment()); + final Snake snake = Snake.create(skinParam(), endInlinkColor, skinParam().arrows().asToLeft()) + .withLabel(back, arrowHorizontalAlignment()); final XPoint2D p1 = getP1(stringBounder); final XPoint2D p2 = getP2(stringBounder); @@ -432,7 +430,7 @@ class FtileWhile extends AbstractFtile { public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); - final Snake snake = Snake.create(skinParam(), endInlinkColor, Arrows.asToLeft()) + final Snake snake = Snake.create(skinParam(), endInlinkColor, skinParam().arrows().asToLeft()) .emphasizeDirection(Direction.UP); final XDimension2D dimTotal = calculateDimension(stringBounder); final XPoint2D p1 = getP1(stringBounder); @@ -530,7 +528,7 @@ class FtileWhile extends AbstractFtile { public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); - final Snake snake = Snake.create(skinParam(), afterEndwhileColor, Arrows.asToDown()); + final Snake snake = Snake.create(skinParam(), afterEndwhileColor, skinParam().arrows().asToDown()); final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder); final XPoint2D p1 = getP1(stringBounder); @@ -555,12 +553,12 @@ class FtileWhile extends AbstractFtile { final StringBounder stringBounder = ug.getStringBounder(); ug.apply(getTranslateForWhile(stringBounder)).draw(whileBlock); ug.apply(getTranslateDiamond1(stringBounder)).draw(diamond1); - if (specialOut != null) { + if (specialOut != null) ug.apply(getTranslateForSpecial(stringBounder)).draw(specialOut); - } - if (backward != null) { + + if (backward != null) ug.apply(getTranslateBackward(stringBounder)).draw(backward); - } + } private UTranslate getTranslateBackward(StringBounder stringBounder) { @@ -585,9 +583,9 @@ class FtileWhile extends AbstractFtile { final double height = geo.getHeight() + 4 * Hexagon.hexagonHalfSize; final double dx = 2 * Hexagon.hexagonHalfSize; double backwardWidth = 0; - if (backward != null) { + if (backward != null) backwardWidth += backward.calculateDimension(stringBounder).getWidth(); - } + return new FtileGeometry( xDeltaBecauseSpecial(stringBounder) + geo.getWidth() + dx + Hexagon.hexagonHalfSize + backwardWidth, height, xDeltaBecauseSpecial(stringBounder) + geo.getLeft() + dx, geoDiamond1.getInY(), height); @@ -595,20 +593,20 @@ class FtileWhile extends AbstractFtile { } private double xDeltaBecauseSpecial(StringBounder stringBounder) { - if (specialOut == null) { + if (specialOut == null) return 0; - } + return specialOut.calculateDimension(stringBounder).getWidth(); } @Override public UTranslate getTranslateFor(Ftile child, StringBounder stringBounder) { - if (child == whileBlock) { + if (child == whileBlock) return getTranslateForWhile(stringBounder); - } - if (child == diamond1) { + + if (child == diamond1) return getTranslateDiamond1(stringBounder); - } + throw new UnsupportedOperationException(); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderFork.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderFork.java index eb5b0420a..bd6c38cee 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderFork.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderFork.java @@ -40,7 +40,6 @@ import java.util.List; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection; -import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; import net.sourceforge.plantuml.activitydiagram3.ftile.Connection; import net.sourceforge.plantuml.activitydiagram3.ftile.ConnectionTranslatable; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; @@ -223,7 +222,7 @@ public class ParallelBuilderFork extends AbstractParallelFtilesBuilder { public void drawU(UGraphic ug) { ug = ug.apply(UTranslate.dx(x)); final FtileGeometry geo2 = getFtile2().calculateDimension(getStringBounder()); - Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToDown()); + Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToDown()); if (Display.isNull(label) == false) snake = snake.withLabel(getTextBlock(label), arrowHorizontalAlignment()); @@ -241,7 +240,7 @@ public class ParallelBuilderFork extends AbstractParallelFtilesBuilder { final XPoint2D p1 = new XPoint2D(geo2.getLeft(), 0); final XPoint2D p2 = new XPoint2D(geo2.getLeft(), geo2.getInY()); - Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToDown()).ignoreForCompression(); + Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToDown()).ignoreForCompression(); if (Display.isNull(label) == false) snake = snake.withLabel(getTextBlock(label), arrowHorizontalAlignment()); @@ -277,7 +276,7 @@ public class ParallelBuilderFork extends AbstractParallelFtilesBuilder { if (geo1.hasPointOut() == false) return; - Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToDown()); + Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToDown()); if (Display.isNull(label) == false) snake = snake.withLabel(getTextBlock(label), arrowHorizontalAlignment()); @@ -298,7 +297,7 @@ public class ParallelBuilderFork extends AbstractParallelFtilesBuilder { final XPoint2D p1 = new XPoint2D(geo.getLeft(), barHeight + geo.getOutY()); final XPoint2D p2 = new XPoint2D(geo.getLeft(), justBeforeBar2); - Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToDown()).ignoreForCompression(); + Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToDown()).ignoreForCompression(); if (Display.isNull(label) == false) snake = snake.withLabel(getTextBlock(label), arrowHorizontalAlignment()); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderMerge.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderMerge.java index baa379d00..499991712 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderMerge.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderMerge.java @@ -40,7 +40,6 @@ import java.util.List; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection; -import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; import net.sourceforge.plantuml.activitydiagram3.ftile.Connection; import net.sourceforge.plantuml.activitydiagram3.ftile.ConnectionTranslatable; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; @@ -144,11 +143,11 @@ public class ParallelBuilderMerge extends AbstractParallelFtilesBuilder { final UTranslate arrival = arrivalOnDiamond(stringBounder, p1.getX()); final UPolygon endDecoration; if (arrival.getDx() < 0) - endDecoration = Arrows.asToRight(); + endDecoration = skinParam().arrows().asToRight(); else if (arrival.getDx() > 0) - endDecoration = Arrows.asToLeft(); + endDecoration = skinParam().arrows().asToLeft(); else - endDecoration = Arrows.asToDown(); + endDecoration = skinParam().arrows().asToDown(); final Snake snake = Snake.create(skinParam(), arrowColor, endDecoration); snake.addPoint(x1, y1); @@ -206,7 +205,7 @@ public class ParallelBuilderMerge extends AbstractParallelFtilesBuilder { public void drawU(UGraphic ug) { ug = ug.apply(UTranslate.dx(x)); final FtileGeometry geo = getFtile2().calculateDimension(getStringBounder()); - Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToDown()); + Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToDown()); if (Display.isNull(label) == false) snake = snake.withLabel(getTextBlock(label), arrowHorizontalAlignment()); @@ -222,7 +221,7 @@ public class ParallelBuilderMerge extends AbstractParallelFtilesBuilder { final XPoint2D p1 = new XPoint2D(geo.getLeft(), 0); final XPoint2D p2 = new XPoint2D(geo.getLeft(), geo.getInY()); - Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToDown()); + Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToDown()); if (Display.isNull(label) == false) snake = snake.withLabel(getTextBlock(label), arrowHorizontalAlignment()); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderSplit.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderSplit.java index 80d133fb2..aacab4dcd 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderSplit.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderSplit.java @@ -41,7 +41,6 @@ import java.util.List; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.activitydiagram3.LinkRendering; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection; -import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; import net.sourceforge.plantuml.activitydiagram3.ftile.Connection; import net.sourceforge.plantuml.activitydiagram3.ftile.ConnectionTranslatable; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; @@ -92,8 +91,7 @@ public class ParallelBuilderSplit extends AbstractParallelFtilesBuilder { last = x + dim.getLeft(); final LinkRendering inLinkRendering = tmp.getInLinkRendering(); - final Rainbow rainbow = inLinkRendering - .getRainbow(Rainbow.build(style, skinParam().getIHtmlColorSet())); + final Rainbow rainbow = inLinkRendering.getRainbow(Rainbow.build(style, skinParam().getIHtmlColorSet())); conns.add(new ConnectionIn(thin, tmp, x, rainbow)); x += dim.getWidth(); @@ -116,8 +114,7 @@ public class ParallelBuilderSplit extends AbstractParallelFtilesBuilder { final Style style = getStyleSignature().getMergedStyle(skinParam().getCurrentStyleBuilder()); for (Ftile tmp : list99) { final LinkRendering inLinkRendering = tmp.getInLinkRendering(); - final Rainbow rainbow = inLinkRendering - .getRainbow(Rainbow.build(style, skinParam().getIHtmlColorSet())); + final Rainbow rainbow = inLinkRendering.getRainbow(Rainbow.build(style, skinParam().getIHtmlColorSet())); if (rainbow.isInvisible() == false) return thinColor.getColor(); @@ -143,8 +140,7 @@ public class ParallelBuilderSplit extends AbstractParallelFtilesBuilder { final Style style = getStyleSignature().getMergedStyle(skinParam().getCurrentStyleBuilder()); final LinkRendering inLinkRendering = result.getInLinkRendering(); - final Rainbow thinColor = inLinkRendering - .getRainbow(Rainbow.build(style, skinParam().getIHtmlColorSet())); + final Rainbow thinColor = inLinkRendering.getRainbow(Rainbow.build(style, skinParam().getIHtmlColorSet())); final Ftile out = new FtileThinSplit(skinParam(), thinColor.getColor(), swimlaneOutForStep2()); result = new FtileAssemblySimple(result, out); @@ -163,8 +159,7 @@ public class ParallelBuilderSplit extends AbstractParallelFtilesBuilder { } final LinkRendering outLinkRendering = tmp.getOutLinkRendering(); - final Rainbow rainbow = outLinkRendering - .getRainbow(Rainbow.build(style, skinParam().getIHtmlColorSet())); + final Rainbow rainbow = outLinkRendering.getRainbow(Rainbow.build(style, skinParam().getIHtmlColorSet())); if (tmp.calculateDimension(getStringBounder()).hasPointOut()) conns.add(new ConnectionOut(translate0, tmp, out, x, rainbow, getHeightOfMiddle(inner))); @@ -198,7 +193,7 @@ public class ParallelBuilderSplit extends AbstractParallelFtilesBuilder { public void drawU(UGraphic ug) { ug = ug.apply(UTranslate.dx(x)); final FtileGeometry geo = getFtile2().calculateDimension(getStringBounder()); - Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToDown()); + Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToDown()); if (Display.isNull(label) == false) snake = snake.withLabel(getTextBlock(label), arrowHorizontalAlignment()); @@ -214,7 +209,7 @@ public class ParallelBuilderSplit extends AbstractParallelFtilesBuilder { final XPoint2D p1 = new XPoint2D(geo.getLeft(), 0); final XPoint2D p2 = new XPoint2D(geo.getLeft(), geo.getInY()); - Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToDown()); + Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToDown()); if (Display.isNull(label) == false) snake = snake.withLabel(getTextBlock(label), arrowHorizontalAlignment()); @@ -253,7 +248,7 @@ public class ParallelBuilderSplit extends AbstractParallelFtilesBuilder { if (geo.hasPointOut() == false) return; - Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToDown()); + Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToDown()); if (Display.isNull(label) == false) snake = snake.withLabel(getTextBlock(label), arrowHorizontalAlignment()); @@ -274,7 +269,7 @@ public class ParallelBuilderSplit extends AbstractParallelFtilesBuilder { final XPoint2D p1 = translate0.getTranslated(new XPoint2D(geo.getLeft(), geo.getOutY())); final XPoint2D p2 = translate0.getTranslated(new XPoint2D(geo.getLeft(), height)); - Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToDown()); + Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToDown()); if (Display.isNull(label) == false) snake = snake.withLabel(getTextBlock(label), arrowHorizontalAlignment()); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileIfWithLinks.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileIfWithLinks.java index 117fb2535..9263270ce 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileIfWithLinks.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileIfWithLinks.java @@ -41,7 +41,6 @@ import java.util.List; import net.sourceforge.plantuml.Direction; import net.sourceforge.plantuml.activitydiagram3.Branch; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection; -import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; import net.sourceforge.plantuml.activitydiagram3.ftile.Connection; import net.sourceforge.plantuml.activitydiagram3.ftile.ConnectionTranslatable; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; @@ -72,9 +71,9 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds { super(diamond1, tile1, tile2, diamond2, in, stringBounder); this.arrowColor = arrowColor; this.conditionEndStyle = conditionEndStyle; - if (arrowColor.size() == 0) { + if (arrowColor.size() == 0) throw new IllegalArgumentException(); - } + } class ConnectionHorizontalThenVertical extends AbstractConnection implements ConnectionTranslatable { @@ -85,10 +84,10 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds { public ConnectionHorizontalThenVertical(Ftile tile, Branch branch) { super(diamond1, tile); color = branch.getInColor(arrowColor); - if (color.size() == 0) { + if (color.size() == 0) throw new IllegalArgumentException(); - } - usingArrow = branch.isEmpty() ? null : Arrows.asToDown(); + + usingArrow = branch.isEmpty() ? null : skinParam().arrows().asToDown(); } public void drawU(UGraphic ug) { @@ -111,13 +110,13 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds { private XPoint2D getP1(StringBounder stringBounder) { final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder); final XPoint2D pt; - if (getFtile2() == tile1) { + if (getFtile2() == tile1) pt = dimDiamond1.getPointD(); - } else if (getFtile2() == tile2) { + else if (getFtile2() == tile2) pt = dimDiamond1.getPointB(); - } else { + else throw new IllegalStateException(); - } + return getTranslateDiamond1(stringBounder).getTranslated(pt); } @@ -126,12 +125,12 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds { } private UTranslate translate(StringBounder stringBounder) { - if (getFtile2() == tile1) { + if (getFtile2() == tile1) return getTranslate1(stringBounder); - } - if (getFtile2() == tile2) { + + if (getFtile2() == tile2) return getTranslate2(stringBounder); - } + throw new IllegalStateException(); } @@ -178,9 +177,9 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds { final StringBounder stringBounder = ug.getStringBounder(); final FtileGeometry geo = getFtile1().calculateDimension(stringBounder); - if (geo.hasPointOut() == false) { + if (geo.hasPointOut() == false) return; - } + final XPoint2D p1 = geo.translate(translate(stringBounder)).getPointOut(); final XPoint2D p2 = getP2(stringBounder); @@ -189,11 +188,11 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds { final double x2 = p2.getX(); final double y2 = p2.getY(); - final UPolygon arrow = x2 > x1 ? Arrows.asToRight() : Arrows.asToLeft(); + final UPolygon arrow = x2 > x1 ? skinParam().arrows().asToRight() : skinParam().arrows().asToLeft(); Snake snake = Snake.create(skinParam(), myArrowColor, arrow); - if (branchEmpty) { + if (branchEmpty) snake = snake.emphasizeDirection(Direction.DOWN); - } + snake.addPoint(x1, y1); snake.addPoint(x1, y2); snake.addPoint(x2, y2); @@ -204,23 +203,23 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds { private XPoint2D getP2(StringBounder stringBounder) { final FtileGeometry dimDiamond2 = diamond2.calculateDimension(stringBounder); final XPoint2D pt; - if (getFtile1() == tile1) { + if (getFtile1() == tile1) pt = dimDiamond2.getPointD(); - } else if (getFtile1() == tile2) { + else if (getFtile1() == tile2) pt = dimDiamond2.getPointB(); - } else { + else throw new IllegalStateException(); - } + return getTranslateDiamond2(stringBounder).getTranslated(pt); } private UTranslate translate(StringBounder stringBounder) { - if (getFtile1() == tile1) { + if (getFtile1() == tile1) return getTranslate1(stringBounder); - } - if (getFtile1() == tile2) { + + if (getFtile1() == tile2) return getTranslate2(stringBounder); - } + throw new IllegalStateException(); } @@ -228,9 +227,9 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds { public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) { final StringBounder stringBounder = ug.getStringBounder(); final FtileGeometry geo = getFtile1().calculateDimension(stringBounder); - if (geo.hasPointOut() == false) { + if (geo.hasPointOut() == false) return; - } + final XPoint2D p2 = getP2(stringBounder); final XPoint2D p1 = geo.translate(translate(stringBounder)).getPointOut(); final Direction originalDirection = Direction.leftOrRight(p1, p2); @@ -240,7 +239,7 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds { final XPoint2D mp1a = translate1.getTranslated(p1); final XPoint2D mp2b = translate2.getTranslated(p2); final Direction newDirection = Direction.leftOrRight(mp1a, mp2b); - final UPolygon arrow = x2 > x1 ? Arrows.asToRight() : Arrows.asToLeft(); + final UPolygon arrow = x2 > x1 ? skinParam().arrows().asToRight() : skinParam().arrows().asToLeft(); if (originalDirection == newDirection) { final double delta = (x2 > x1 ? -1 : 1) * 1.5 * Hexagon.hexagonHalfSize; final XPoint2D mp2bc = new XPoint2D(mp2b.getX() + delta, mp2b.getY()); @@ -258,8 +257,7 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds { ug.draw(small); } else { final double delta = (x2 > x1 ? -1 : 1) * 1.5 * Hexagon.hexagonHalfSize; - final XPoint2D mp2bb = new XPoint2D(mp2b.getX() + delta, - mp2b.getY() - 1.5 * Hexagon.hexagonHalfSize); + final XPoint2D mp2bb = new XPoint2D(mp2b.getX() + delta, mp2b.getY() - 1.5 * Hexagon.hexagonHalfSize); final Snake snake = Snake.create(skinParam(), myArrowColor).withMerge(MergeStrategy.LIMITED); snake.addPoint(mp1a); snake.addPoint(mp1a.getX(), mp2bb.getY()); @@ -292,9 +290,9 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds { final FtileGeometry dimTotal = calculateDimensionInternal(stringBounder); final FtileGeometry geo = getFtile1().calculateDimension(stringBounder); - if (geo.hasPointOut() == false) { + if (geo.hasPointOut() == false) return; - } + final XPoint2D p1 = geo.translate(translate(stringBounder)).getPointOut(); final XPoint2D p2 = new XPoint2D(dimTotal.getLeft(), dimTotal.getHeight()); @@ -304,9 +302,9 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds { final double y2 = p2.getY(); Snake snake = Snake.create(skinParam(), myArrowColor); - if (branchEmpty) { + if (branchEmpty) snake = snake.emphasizeDirection(Direction.DOWN); - } + snake.addPoint(x1, y1); snake.addPoint(x1, y2); snake.addPoint(x2, y2); @@ -321,9 +319,9 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds { final FtileGeometry dimTotal = calculateDimensionInternal(stringBounder); final FtileGeometry geo = getFtile1().calculateDimension(stringBounder); - if (geo.hasPointOut() == false) { + if (geo.hasPointOut() == false) return; - } + final XPoint2D p1 = geo.translate(translate(stringBounder)).getPointOut(); final XPoint2D p2 = new XPoint2D(dimTotal.getLeft(), dimTotal.getHeight() - Hexagon.hexagonHalfSize); @@ -331,7 +329,6 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds { final XPoint2D mp2b = translate2.getTranslated(p2); final Snake snake = Snake.create(skinParam(), myArrowColor).withMerge(MergeStrategy.LIMITED); - // snake.emphasizeDirection(Direction.DOWN); final double x1 = mp1a.getX(); final double x2 = mp2b.getX(); @@ -346,12 +343,12 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds { } private UTranslate translate(StringBounder stringBounder) { - if (getFtile1() == tile1) { + if (getFtile1() == tile1) return getTranslate1(stringBounder); - } - if (getFtile1() == tile2) { + + if (getFtile1() == tile2) return getTranslate2(stringBounder); - } + throw new IllegalStateException(); } @@ -373,20 +370,18 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds { final StringBounder stringBounder = ug.getStringBounder(); final FtileGeometry geo = getFtile1().calculateDimension(stringBounder); - if (geo.hasPointOut() == false) { + if (geo.hasPointOut() == false) return; - } final XPoint2D p1 = geo.translate(translate(stringBounder)).getPointOut(); final double totalHeight = calculateDimensionInternal(stringBounder).getHeight(); - // final XPoint2D p1 = getP1(stringBounder); - if (p1 == null) { + if (p1 == null) return; - } + final XPoint2D p2 = new XPoint2D(p1.getX(), totalHeight); - final Snake snake = Snake.create(skinParam(), color, Arrows.asToDown()).withLabel(out2, + final Snake snake = Snake.create(skinParam(), color, skinParam().arrows().asToDown()).withLabel(out2, arrowHorizontalAlignment()); snake.addPoint(p1); snake.addPoint(p2); @@ -394,12 +389,12 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds { } private UTranslate translate(StringBounder stringBounder) { - if (getFtile1() == tile1) { + if (getFtile1() == tile1) return getTranslate1(stringBounder); - } - if (getFtile1() == tile2) { + + if (getFtile1() == tile2) return getTranslate2(stringBounder); - } + throw new IllegalStateException(); } /* @@ -441,9 +436,8 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds { final double minX = minmax[0]; final double maxX = minmax[1]; - if (Double.isNaN(minX) || Double.isNaN(maxX)) { + if (Double.isNaN(minX) || Double.isNaN(maxX)) return; - } final Snake s = Snake.create(skinParam(), arrowColor).withMerge(MergeStrategy.NONE); s.addPoint(minX, totalDim.getHeight()); @@ -454,28 +448,23 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds { private double[] getMinmax(StringBounder stringBounder, double width, List allTiles, Swimlane intoSw, List allSwimlanes) { final int current = allSwimlanes.indexOf(intoSw); -// final Double leftOut = getLeftOut(stringBounder); -// if (leftOut == null) -// return new double[] { Double.NaN, Double.NaN }; - if (current == -1) { + if (current == -1) throw new IllegalStateException(); - } + final int first = getFirstSwimlane(stringBounder, allTiles, allSwimlanes); final int last = getLastSwimlane(stringBounder, allTiles, allSwimlanes); if (current < first || current > last) return new double[] { Double.NaN, Double.NaN }; double minX = current != first ? 0 : width; double maxX = current != last ? width : 0; -// minX = Math.min(minX, leftOut); -// maxX = Math.max(maxX, leftOut); for (Ftile tmp : allTiles) { - if (tmp.calculateDimension(stringBounder).hasPointOut() == false) { + if (tmp.calculateDimension(stringBounder).hasPointOut() == false) continue; - } - if (ftileDoesOutcomeInThatSwimlane(tmp, intoSw) == false) { + + if (ftileDoesOutcomeInThatSwimlane(tmp, intoSw) == false) continue; - } + final UTranslate ut = getTranslateFor(tmp, stringBounder); final double out = tmp.calculateDimension(stringBounder).translate(ut).getLeft(); minX = Math.min(minX, out); @@ -485,17 +474,12 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds { } private double[] getMinmaxSimple(StringBounder stringBounder, double width, List allTiles) { -// final Double leftOut = getLeftOut(stringBounder); -// if (leftOut == null) -// return new double[] { Double.NaN, Double.NaN }; double minX = width / 2; double maxX = width / 2; -// minX = Math.min(minX, leftOut); -// maxX = Math.max(maxX, leftOut); for (Ftile tmp : allTiles) { - if (tmp.calculateDimension(stringBounder).hasPointOut() == false) { + if (tmp.calculateDimension(stringBounder).hasPointOut() == false) continue; - } + final UTranslate ut = getTranslateFor(tmp, stringBounder); final double out = tmp.calculateDimension(stringBounder).translate(ut).getLeft(); minX = Math.min(minX, out); @@ -505,20 +489,18 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds { } private int getFirstSwimlane(StringBounder stringBounder, List allTiles, List allSwimlanes) { - for (int i = 0; i < allSwimlanes.size(); i++) { - if (atLeastOne(stringBounder, allSwimlanes.get(i), allTiles)) { + for (int i = 0; i < allSwimlanes.size(); i++) + if (atLeastOne(stringBounder, allSwimlanes.get(i), allTiles)) return i; - } - } + throw new IllegalStateException(); } private int getLastSwimlane(StringBounder stringBounder, List allTiles, List allSwimlanes) { - for (int i = allSwimlanes.size() - 1; i >= 0; i--) { - if (atLeastOne(stringBounder, allSwimlanes.get(i), allTiles)) { + for (int i = allSwimlanes.size() - 1; i >= 0; i--) + if (atLeastOne(stringBounder, allSwimlanes.get(i), allTiles)) return i; - } - } + throw new IllegalStateException(); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithManyLinks.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithManyLinks.java index c9d8bc22a..ac36a98af 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithManyLinks.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithManyLinks.java @@ -41,7 +41,6 @@ import java.util.List; import net.sourceforge.plantuml.Direction; import net.sourceforge.plantuml.activitydiagram3.Branch; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection; -import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; import net.sourceforge.plantuml.activitydiagram3.ftile.Connection; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; @@ -88,7 +87,7 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds { final double x2 = p2.getX(); final double y2 = p2.getY(); - final Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToDown()) + final Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToDown()) .withLabel(branch.getTextBlockPositive(), arrowHorizontalAlignment()); snake.addPoint(x1, y1); @@ -158,15 +157,15 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds { final Direction direction; if (x1 < ptD.getX()) { p2 = ptD; - arrow = Arrows.asToRight(); + arrow = skinParam().arrows().asToRight(); direction = Direction.RIGHT; } else if (x1 > ptB.getX()) { p2 = ptB; - arrow = Arrows.asToLeft(); + arrow = skinParam().arrows().asToLeft(); direction = Direction.LEFT; } else { p2 = ptA; - arrow = Arrows.asToDown(); + arrow = skinParam().arrows().asToDown(); direction = Direction.DOWN; } @@ -215,7 +214,7 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds { final double x2 = p2.getX(); final double y2 = p2.getY(); - final Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToDown()) + final Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToDown()) .withLabel(branch.getTextBlockPositive(), VerticalAlignment.CENTER); if (x2 < p1d.getX() - margin || x2 > p1b.getX() + margin) { snake.addPoint(x2, p1d.getY()); @@ -271,8 +270,8 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds { final double ym = (y1 + y2) / 2; - final Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToDown()).withLabel(outLabel, - VerticalAlignment.CENTER); + final Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToDown()) + .withLabel(outLabel, VerticalAlignment.CENTER); if (x1 < p1d.getX() - margin || x1 > p1b.getX() + margin) { snake.addPoint(x1, y1); @@ -297,9 +296,9 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds { @Override protected double getYdelta1a(StringBounder stringBounder) { double max = 10; - for (Branch branch : branches) { + for (Branch branch : branches) max = Math.max(max, branch.getTextBlockPositive().calculateDimension(stringBounder).getHeight()); - } + if (mode == Mode.BIG_DIAMOND) { final double diamondHeight = diamond1.calculateDimension(stringBounder).getHeight(); max += diamondHeight / 2; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithOneLink.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithOneLink.java index e0b1d985a..738c9519c 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithOneLink.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithOneLink.java @@ -40,7 +40,6 @@ import java.util.List; import net.sourceforge.plantuml.activitydiagram3.Branch; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection; -import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; import net.sourceforge.plantuml.activitydiagram3.ftile.Connection; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; @@ -80,9 +79,8 @@ public class FtileSwitchWithOneLink extends FtileSwitchWithDiamonds { final double x2 = p2.getX(); final double y2 = p2.getY(); - final Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToDown()) + final Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToDown()) .withLabel(branch.getTextBlockPositive(), arrowHorizontalAlignment()); - // snake.addPoint(x1, y1); snake.addPoint(x2, y1); snake.addPoint(x2, y2); @@ -115,8 +113,7 @@ public class FtileSwitchWithOneLink extends FtileSwitchWithDiamonds { final double x2 = p2.getX(); final double y2 = p2.getY(); - final Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToDown()); - // snake.addPoint(x1, y1); + final Snake snake = Snake.create(skinParam(), arrowColor, skinParam().arrows().asToDown()); snake.addPoint(x2, y1); snake.addPoint(x2, y2); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/gtile/GConnectionHorizontalThenVerticalDown.java b/src/net/sourceforge/plantuml/activitydiagram3/gtile/GConnectionHorizontalThenVerticalDown.java index 25d2b403a..78c8a2af9 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/gtile/GConnectionHorizontalThenVerticalDown.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/gtile/GConnectionHorizontalThenVerticalDown.java @@ -36,7 +36,6 @@ package net.sourceforge.plantuml.activitydiagram3.gtile; import net.sourceforge.plantuml.Direction; -import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; import net.sourceforge.plantuml.activitydiagram3.ftile.Hexagon; import net.sourceforge.plantuml.activitydiagram3.ftile.MergeStrategy; import net.sourceforge.plantuml.activitydiagram3.ftile.Snake; @@ -82,14 +81,15 @@ public class GConnectionHorizontalThenVerticalDown extends GAbstractConnection { // final Dimension2D dimDiamond1 = // diamond1.calculateDimension(ug.getStringBounder()); final XDimension2D dimDiamond1 = new XDimension2D(0, 0); - final Snake small = Snake.create(skinParam(), getInLinkRenderingColor()).withLabel(textBlock, HorizontalAlignment.LEFT); + final Snake small = Snake.create(skinParam(), getInLinkRenderingColor()).withLabel(textBlock, + HorizontalAlignment.LEFT); small.addPoint(p1); small.addPoint(p1.getX() + delta, p1.getY()); small.addPoint(p1.getX() + delta, p1.getY() + dimDiamond1.getHeight() * .75); ug.draw(small); p1 = small.getLast(); } - UPolygon usingArrow = /* branch.isEmpty() ? null : */ Arrows.asToDown(); + UPolygon usingArrow = /* branch.isEmpty() ? null : */ skinParam().arrows().asToDown(); final Snake snake = Snake.create(skinParam(), getInLinkRenderingColor(), usingArrow) .withLabel(textBlock, HorizontalAlignment.LEFT).withMerge(MergeStrategy.LIMITED); @@ -102,8 +102,8 @@ public class GConnectionHorizontalThenVerticalDown extends GAbstractConnection { @Override public void drawU(UGraphic ug) { - final Snake snake = Snake.create(skinParam(), getInLinkRenderingColor(), Arrows.asToDown()).withLabel(textBlock, - HorizontalAlignment.LEFT); + final Snake snake = Snake.create(skinParam(), getInLinkRenderingColor(), skinParam().arrows().asToDown()) + .withLabel(textBlock, HorizontalAlignment.LEFT); final XPoint2D p1 = pos1.getTranslated(gpoint1.getPoint2D()); final XPoint2D p2 = pos2.getTranslated(gpoint2.getPoint2D()); snake.addPoint(p1); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/gtile/GConnectionSideThenVerticalThenSide.java b/src/net/sourceforge/plantuml/activitydiagram3/gtile/GConnectionSideThenVerticalThenSide.java index 07481749b..df8f8e546 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/gtile/GConnectionSideThenVerticalThenSide.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/gtile/GConnectionSideThenVerticalThenSide.java @@ -36,7 +36,6 @@ package net.sourceforge.plantuml.activitydiagram3.gtile; import net.sourceforge.plantuml.Direction; -import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; import net.sourceforge.plantuml.activitydiagram3.ftile.Snake; import net.sourceforge.plantuml.awt.geom.XPoint2D; import net.sourceforge.plantuml.graphic.HorizontalAlignment; @@ -74,7 +73,7 @@ public class GConnectionSideThenVerticalThenSide extends GAbstractConnection { final XPoint2D p1 = pos1.getTranslated(gpoint1.getPoint2D()); final XPoint2D p2 = pos2.getTranslated(gpoint2.getPoint2D()); final Direction direction = p1.getY() < p2.getY() ? Direction.DOWN : Direction.UP; - final UPolygon tmp = p1.getX() < p2.getX() ? Arrows.asToRight() : Arrows.asToLeft(); + final UPolygon tmp = p1.getX() < p2.getX() ? skinParam().arrows().asToRight() : skinParam().arrows().asToLeft(); final Snake snake = Snake.create(skinParam(), getInLinkRenderingColor(), tmp).emphasizeDirection(direction) .withLabel(textBlock, HorizontalAlignment.LEFT); // final double maxX = Math.max(p1.getX(), p2.getX()); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/gtile/GConnectionVerticalDown.java b/src/net/sourceforge/plantuml/activitydiagram3/gtile/GConnectionVerticalDown.java index 3f18779d5..1ee49c948 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/gtile/GConnectionVerticalDown.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/gtile/GConnectionVerticalDown.java @@ -35,7 +35,6 @@ */ package net.sourceforge.plantuml.activitydiagram3.gtile; -import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; import net.sourceforge.plantuml.activitydiagram3.ftile.Snake; import net.sourceforge.plantuml.awt.geom.XPoint2D; import net.sourceforge.plantuml.graphic.HorizontalAlignment; @@ -60,8 +59,8 @@ public class GConnectionVerticalDown extends GAbstractConnection { @Override public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) { - final Snake snake = Snake.create(skinParam(), getInLinkRenderingColor(), Arrows.asToDown()).withLabel(textBlock, - HorizontalAlignment.LEFT); + final Snake snake = Snake.create(skinParam(), getInLinkRenderingColor(), skinParam().arrows().asToDown()) + .withLabel(textBlock, HorizontalAlignment.LEFT); final XPoint2D p1 = pos1.getTranslated(gpoint1.getPoint2D()); final XPoint2D p2 = pos2.getTranslated(gpoint2.getPoint2D()); final XPoint2D mp1a = translate1.getTranslated(p1); @@ -77,8 +76,8 @@ public class GConnectionVerticalDown extends GAbstractConnection { @Override public void drawU(UGraphic ug) { - final Snake snake = Snake.create(skinParam(), getInLinkRenderingColor(), Arrows.asToDown()).withLabel(textBlock, - HorizontalAlignment.LEFT); + final Snake snake = Snake.create(skinParam(), getInLinkRenderingColor(), skinParam().arrows().asToDown()) + .withLabel(textBlock, HorizontalAlignment.LEFT); final XPoint2D p1 = pos1.getTranslated(gpoint1.getPoint2D()); final XPoint2D p2 = pos2.getTranslated(gpoint2.getPoint2D()); snake.addPoint(p1); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/gtile/GConnectionVerticalDownThenBack.java b/src/net/sourceforge/plantuml/activitydiagram3/gtile/GConnectionVerticalDownThenBack.java index b969260fc..1fe4ec664 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/gtile/GConnectionVerticalDownThenBack.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/gtile/GConnectionVerticalDownThenBack.java @@ -36,7 +36,6 @@ package net.sourceforge.plantuml.activitydiagram3.gtile; import net.sourceforge.plantuml.Direction; -import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; import net.sourceforge.plantuml.activitydiagram3.ftile.Snake; import net.sourceforge.plantuml.awt.geom.XPoint2D; import net.sourceforge.plantuml.graphic.HorizontalAlignment; @@ -66,7 +65,7 @@ public class GConnectionVerticalDownThenBack extends GAbstractConnection { public void drawU(UGraphic ug) { final XPoint2D p1 = pos1.getTranslated(gpoint1.getPoint2D()); final XPoint2D p2 = pos2.getTranslated(gpoint2.getPoint2D()); - final UPolygon arrow = Arrows.asToLeft(); + final UPolygon arrow = skinParam().arrows().asToLeft(); final Snake snake = Snake.create(skinParam(), getInLinkRenderingColor(), arrow) .withLabel(textBlock, HorizontalAlignment.LEFT).emphasizeDirection(Direction.UP); @@ -92,7 +91,7 @@ public class GConnectionVerticalDownThenBack extends GAbstractConnection { p1 = translate1.getTranslated(p1); p2 = translate2.getTranslated(p2); - final UPolygon arrow = Arrows.asToLeft(); + final UPolygon arrow = skinParam().arrows().asToLeft(); final Snake snake = Snake.create(skinParam(), getInLinkRenderingColor(), arrow) .withLabel(textBlock, HorizontalAlignment.LEFT).emphasizeDirection(Direction.UP); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/gtile/GConnectionVerticalDownThenHorizontal.java b/src/net/sourceforge/plantuml/activitydiagram3/gtile/GConnectionVerticalDownThenHorizontal.java index c670d3f63..4779860d5 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/gtile/GConnectionVerticalDownThenHorizontal.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/gtile/GConnectionVerticalDownThenHorizontal.java @@ -36,7 +36,6 @@ package net.sourceforge.plantuml.activitydiagram3.gtile; import net.sourceforge.plantuml.Direction; -import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; import net.sourceforge.plantuml.activitydiagram3.ftile.Hexagon; import net.sourceforge.plantuml.activitydiagram3.ftile.MergeStrategy; import net.sourceforge.plantuml.activitydiagram3.ftile.Snake; @@ -77,7 +76,7 @@ public class GConnectionVerticalDownThenHorizontal extends GAbstractConnection { final XPoint2D mp1a = translate1.getTranslated(p1); final XPoint2D mp2b = translate2.getTranslated(p2); final Direction newDirection = Direction.leftOrRight(mp1a, mp2b); - final UPolygon arrow = x2 > x1 ? Arrows.asToRight() : Arrows.asToLeft(); + final UPolygon arrow = x2 > x1 ? skinParam().arrows().asToRight() : skinParam().arrows().asToLeft(); if (originalDirection == newDirection) { final double delta = (x2 > x1 ? -1 : 1) * 1.5 * Hexagon.hexagonHalfSize; final XPoint2D mp2bc = new XPoint2D(mp2b.getX() + delta, mp2b.getY()); @@ -88,7 +87,8 @@ public class GConnectionVerticalDownThenHorizontal extends GAbstractConnection { snake.addPoint(mp2bc.getX(), middle); snake.addPoint(mp2bc); ug.draw(snake); - final Snake small = Snake.create(skinParam(), getInLinkRenderingColor(), arrow).withMerge(MergeStrategy.LIMITED); + final Snake small = Snake.create(skinParam(), getInLinkRenderingColor(), arrow) + .withMerge(MergeStrategy.LIMITED); small.addPoint(mp2bc); small.addPoint(mp2bc.getX(), mp2b.getY()); small.addPoint(mp2b); @@ -101,7 +101,8 @@ public class GConnectionVerticalDownThenHorizontal extends GAbstractConnection { snake.addPoint(mp1a.getX(), mp2bb.getY()); snake.addPoint(mp2bb); ug.draw(snake); - final Snake small = Snake.create(skinParam(), getInLinkRenderingColor(), arrow).withMerge(MergeStrategy.LIMITED); + final Snake small = Snake.create(skinParam(), getInLinkRenderingColor(), arrow) + .withMerge(MergeStrategy.LIMITED); small.addPoint(mp2bb); small.addPoint(mp2bb.getX(), mp2b.getY()); small.addPoint(mp2b); @@ -115,7 +116,8 @@ public class GConnectionVerticalDownThenHorizontal extends GAbstractConnection { public void drawU(UGraphic ug) { final XPoint2D p1 = pos1.getTranslated(gpoint1.getPoint2D()); final XPoint2D p2 = pos2.getTranslated(gpoint2.getPoint2D()); - final UPolygon arrow = p1.getX() < p2.getX() ? Arrows.asToRight() : Arrows.asToLeft(); + final UPolygon arrow = p1.getX() < p2.getX() ? skinParam().arrows().asToRight() + : skinParam().arrows().asToLeft(); final Snake snake = Snake.create(skinParam(), getInLinkRenderingColor(), arrow).withLabel(textBlock, HorizontalAlignment.LEFT); snake.addPoint(p1); diff --git a/src/net/sourceforge/plantuml/ebnf/ETileBox.java b/src/net/sourceforge/plantuml/ebnf/ETileBox.java index 4d4405301..20c96031c 100644 --- a/src/net/sourceforge/plantuml/ebnf/ETileBox.java +++ b/src/net/sourceforge/plantuml/ebnf/ETileBox.java @@ -156,8 +156,8 @@ public class ETileBox extends ETile { } else if (symbol == Symbol.SPECIAL_SEQUENCE) { final URectangle rect1 = new URectangle(dimBox.delta(2)).rounded(12); final URectangle rect2 = new URectangle(dimBox.delta(-2)).rounded(8); - ug.apply(new UTranslate(posxBox - 1, posy - 1)).apply(lineColor).apply(new UStroke(1.0)).draw(rect1); - ug.apply(new UTranslate(posxBox + 1, posy + 1)).apply(lineColor).apply(new UStroke(1.0)).draw(rect2); + ug.apply(new UTranslate(posxBox - 1, posy - 1)).apply(lineColor).apply(new UStroke(1.0, 1.0, 1.0)).draw(rect1); + ug.apply(new UTranslate(posxBox + 1, posy + 1)).apply(lineColor).apply(new UStroke(0.5)).draw(rect2); } else { final URectangle rect = new URectangle(dimBox).rounded(10); ug.apply(new UTranslate(posxBox, posy)).apply(lineColor).apply(backgroundColor.bg()).apply(new UStroke(1.5)) diff --git a/src/net/sourceforge/plantuml/project/Arrows.java b/src/net/sourceforge/plantuml/project/GArrows.java similarity index 79% rename from src/net/sourceforge/plantuml/project/Arrows.java rename to src/net/sourceforge/plantuml/project/GArrows.java index ee862357a..14a8cbeb9 100644 --- a/src/net/sourceforge/plantuml/project/Arrows.java +++ b/src/net/sourceforge/plantuml/project/GArrows.java @@ -35,14 +35,15 @@ */ package net.sourceforge.plantuml.project; -import net.sourceforge.plantuml.Direction; +import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; import net.sourceforge.plantuml.ugraphic.UPolygon; -public class Arrows { +public class GArrows extends Arrows { final static private double delta2 = 4; - private static UPolygon asToUp() { + @Override + public UPolygon asToUp() { final UPolygon polygon = new UPolygon("asToUp"); polygon.addPoint(-delta2, 0); polygon.addPoint(0, 0); @@ -51,7 +52,8 @@ public class Arrows { return polygon; } - private static UPolygon asToDown() { + @Override + public UPolygon asToDown() { final UPolygon polygon = new UPolygon("asToDown"); polygon.addPoint(-delta2, 0); polygon.addPoint(0, 0); @@ -60,7 +62,8 @@ public class Arrows { return polygon; } - private static UPolygon asToRight() { + @Override + public UPolygon asToRight() { final UPolygon polygon = new UPolygon("asToRight"); polygon.addPoint(0, -delta2); polygon.addPoint(0, 0); @@ -69,7 +72,8 @@ public class Arrows { return polygon.translate(-4, 0); } - private static UPolygon asToLeft() { + @Override + public UPolygon asToLeft() { final UPolygon polygon = new UPolygon("asToLeft"); polygon.addPoint(0, -delta2); polygon.addPoint(0, 0); @@ -78,20 +82,4 @@ public class Arrows { return polygon.translate(4, 0); } - public static UPolygon asTo(Direction direction) { - if (direction == Direction.UP) { - return asToUp(); - } - if (direction == Direction.DOWN) { - return asToDown(); - } - if (direction == Direction.LEFT) { - return asToLeft(); - } - if (direction == Direction.RIGHT) { - return asToRight(); - } - throw new IllegalArgumentException(); - } - } diff --git a/src/net/sourceforge/plantuml/project/GanttArrow.java b/src/net/sourceforge/plantuml/project/GanttArrow.java index a6cf284b8..b7511d721 100644 --- a/src/net/sourceforge/plantuml/project/GanttArrow.java +++ b/src/net/sourceforge/plantuml/project/GanttArrow.java @@ -152,9 +152,9 @@ public class GanttArrow implements UDrawable { throw new IllegalArgumentException(); } - ug = ug.apply(new UStroke(1.5)).apply( - style.value(PName.LineColor).asColor(colorSet).bg()); - ug.apply(new UTranslate(x2, y2)).draw(Arrows.asTo(atEnd)); + ug = ug.apply(new UStroke(1.5)).apply(style.value(PName.LineColor).asColor(colorSet).bg()); + final GArrows arrows = new GArrows(); + ug.apply(new UTranslate(x2, y2)).draw(arrows.asTo(atEnd)); } diff --git a/src/net/sourceforge/plantuml/sequencediagram/LinkAnchor.java b/src/net/sourceforge/plantuml/sequencediagram/LinkAnchor.java index beb475922..4f8a4eb9d 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/LinkAnchor.java +++ b/src/net/sourceforge/plantuml/sequencediagram/LinkAnchor.java @@ -36,7 +36,6 @@ package net.sourceforge.plantuml.sequencediagram; import net.sourceforge.plantuml.ISkinParam; -import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; import net.sourceforge.plantuml.activitydiagram3.ftile.Snake; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; @@ -111,8 +110,9 @@ public class LinkAnchor { final Display display = Display.getWithNewlines(message); final TextBlock title = display.create(fontConfiguration, HorizontalAlignment.CENTER, skinParam); - final Snake snake = Snake.create(skinParam, Arrows.asToUp(), rainbow, Arrows.asToDown()).withLabel(title, - HorizontalAlignment.CENTER); + final Snake snake = Snake + .create(skinParam, skinParam.arrows().asToUp(), rainbow, skinParam.arrows().asToDown()) + .withLabel(title, HorizontalAlignment.CENTER); snake.addPoint(x, ymin + 2); snake.addPoint(x, ymax - 2); diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/GroupingTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/GroupingTile.java index 5ca8177e3..6da92a365 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/GroupingTile.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/GroupingTile.java @@ -210,7 +210,7 @@ public class GroupingTile extends AbstractTile { if (tile instanceof ElseTile) { final ElseTile elseTile = (ElseTile) tile; final double ypos = elseTile.getTimeHook().getValue() - getTimeHook().getValue() + MARGINY_MAGIC / 2; - blotter.addChange(ypos, elseTile.getBackColorGeneral()); + blotter.addChange(ypos + 1, elseTile.getBackColorGeneral()); } blotter.closeChanges(); diff --git a/src/net/sourceforge/plantuml/version/Version.java b/src/net/sourceforge/plantuml/version/Version.java index 0d1420e23..681e8cb47 100644 --- a/src/net/sourceforge/plantuml/version/Version.java +++ b/src/net/sourceforge/plantuml/version/Version.java @@ -81,7 +81,7 @@ public class Version { } public static int beta() { - final int beta = 5; + final int beta = 6; return beta; }