diff --git a/pom.xml b/pom.xml index 7c057517d..8802adeb7 100644 --- a/pom.xml +++ b/pom.xml @@ -35,7 +35,7 @@ net.sourceforge.plantuml plantuml - 2017.12-SNAPSHOT + 1.2017.13-SNAPSHOT jar PlantUML diff --git a/src/net/sourceforge/plantuml/AlignParam.java b/src/net/sourceforge/plantuml/AlignParam.java index d666fbe66..493a48ee4 100644 --- a/src/net/sourceforge/plantuml/AlignParam.java +++ b/src/net/sourceforge/plantuml/AlignParam.java @@ -40,6 +40,7 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment; public enum AlignParam { + ARROW_MESSAGE_ALIGN(HorizontalAlignment.LEFT), SEQUENCE_MESSAGE_ALIGN(HorizontalAlignment.LEFT), SEQUENCE_MESSAGETEXT_ALIGN(HorizontalAlignment.LEFT), SEQUENCE_REFERENCE_ALIGN(HorizontalAlignment.CENTER); diff --git a/src/net/sourceforge/plantuml/BackSlash.java b/src/net/sourceforge/plantuml/BackSlash.java new file mode 100644 index 000000000..008a68645 --- /dev/null +++ b/src/net/sourceforge/plantuml/BackSlash.java @@ -0,0 +1,130 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2017, 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; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +public class BackSlash { + + private static final char PRIVATE_BLOCK = '\uE000'; + + public static char hiddenNewLine() { + return PRIVATE_BLOCK + '\n'; + } + + public static List splitHiddenNewLine(String s) { + return Arrays.asList(s.split("" + hiddenNewLine())); + } + + public static String manageNewLine(String string) { + return string.replace(hiddenNewLine(), '\n'); + } + + public static List getWithNewlines(CharSequence s) { + if (s == null) { + return null; + } + final List result = new ArrayList(); + final StringBuilder current = new StringBuilder(); + for (int i = 0; i < s.length(); i++) { + final char c = s.charAt(i); + if (c == '\\' && i < s.length() - 1) { + final char c2 = s.charAt(i + 1); + i++; + if (c2 == 'n') { + result.add(current.toString()); + current.setLength(0); + } else if (c2 == 't') { + current.append('\t'); + } else if (c2 == '\\') { + current.append(c2); + } + } else { + current.append(c); + } + } + result.add(current.toString()); + return Collections.unmodifiableList(result); + } + + public static String translateBackSlashes(CharSequence s) { + if (s == null) { + return null; + } + final StringBuilder result = new StringBuilder(); + for (int i = 0; i < s.length(); i++) { + final char c = s.charAt(i); + if (c == '\\' && i < s.length() - 1 && isEnglishLetter(s.charAt(i + 1))) { + result.append('\\'); + result.append(translateChar(s.charAt(i + 1))); + i++; + } else { + result.append(c); + } + } + return result.toString(); + } + + public static String untranslateBackSlashes(CharSequence s) { + if (s == null) { + return null; + } + final StringBuilder result = new StringBuilder(); + for (int i = 0; i < s.length(); i++) { + char c = s.charAt(i); + if (c > PRIVATE_BLOCK && c < '\uE07F') { + c = (char) (c - PRIVATE_BLOCK); + } + result.append(c); + } + return result.toString(); + } + + private static boolean isEnglishLetter(char c) { + return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); + } + + private static char translateChar(char c) { + if (c > 128) { + throw new IllegalArgumentException(); + } + return (char) (PRIVATE_BLOCK + c); + } + +} diff --git a/src/net/sourceforge/plantuml/ColorParam.java b/src/net/sourceforge/plantuml/ColorParam.java index c134344d1..26987cdca 100644 --- a/src/net/sourceforge/plantuml/ColorParam.java +++ b/src/net/sourceforge/plantuml/ColorParam.java @@ -126,6 +126,8 @@ public enum ColorParam { cloudBorder(HtmlColorUtils.BLACK, ColorType.LINE), queueBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), queueBorder(HtmlColorUtils.MY_RED, ColorType.LINE), + pipeBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), + pipeBorder(HtmlColorUtils.MY_RED, ColorType.LINE), databaseBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), databaseBorder(HtmlColorUtils.BLACK, ColorType.LINE), folderBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), diff --git a/src/net/sourceforge/plantuml/FontParam.java b/src/net/sourceforge/plantuml/FontParam.java index 7d608e63f..649604e68 100644 --- a/src/net/sourceforge/plantuml/FontParam.java +++ b/src/net/sourceforge/plantuml/FontParam.java @@ -79,6 +79,7 @@ public enum FontParam { NODE(14, Font.PLAIN), // DATABASE(14, Font.PLAIN), // QUEUE(14, Font.PLAIN), // + PIPE(14, Font.PLAIN), // // SEQUENCE_ARROW(13, Font.PLAIN), // SEQUENCE_BOX(13, Font.BOLD), // SEQUENCE_DIVIDER(13, Font.BOLD), // @@ -112,6 +113,7 @@ public enum FontParam { FRAME_STEREOTYPE(14, Font.ITALIC), // DATABASE_STEREOTYPE(14, Font.ITALIC), // QUEUE_STEREOTYPE(14, Font.ITALIC), // + PIPE_STEREOTYPE(14, Font.ITALIC), // ACTOR_STEREOTYPE(14, Font.ITALIC), // SEQUENCE_STEREOTYPE(14, Font.ITALIC), // PARTITION(14, Font.PLAIN); // diff --git a/src/net/sourceforge/plantuml/SourceFileReader.java b/src/net/sourceforge/plantuml/SourceFileReader.java index 42085cc89..724f6fa94 100644 --- a/src/net/sourceforge/plantuml/SourceFileReader.java +++ b/src/net/sourceforge/plantuml/SourceFileReader.java @@ -178,18 +178,15 @@ public class SourceFileReader implements ISourceFileReader { if (dir == null) { Log.info(newName + " is not taken as a directory"); suggested = SuggestedFile.fromOutputFile(new File(outputDirectory, newName), - fileFormatOption.getFileFormat(), cpt++); + fileFormatOption.getFileFormat(), 0); } else { Log.info("We are going to create files in directory " + dir); - // newName = fileFormatOption.getFileFormat().changeName(file.getName(), cpt++); - // suggested = new File(dir, newName); suggested = SuggestedFile.fromOutputFile(new File(dir, file.getName()), - fileFormatOption.getFileFormat(), cpt++); + fileFormatOption.getFileFormat(), 0); } Log.info("We are going to put data in " + suggested); } if (suggested == null) { - // newName = fileFormatOption.getFileFormat().changeName(file.getName(), cpt++); suggested = SuggestedFile.fromOutputFile(new File(outputDirectory, file.getName()), fileFormatOption.getFileFormat(), cpt++); } diff --git a/src/net/sourceforge/plantuml/StringUtils.java b/src/net/sourceforge/plantuml/StringUtils.java index 4f0aa92fa..511a6ca9b 100644 --- a/src/net/sourceforge/plantuml/StringUtils.java +++ b/src/net/sourceforge/plantuml/StringUtils.java @@ -38,7 +38,6 @@ package net.sourceforge.plantuml; import java.awt.Color; import java.io.File; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Locale; @@ -60,33 +59,6 @@ public class StringUtils { return file.getAbsolutePath(); } - public static List getWithNewlines(CharSequence s) { - if (s == null) { - return null; - } - final List result = new ArrayList(); - final StringBuilder current = new StringBuilder(); - for (int i = 0; i < s.length(); i++) { - final char c = s.charAt(i); - if (c == '\\' && i < s.length() - 1) { - final char c2 = s.charAt(i + 1); - i++; - if (c2 == 'n') { - result.add(current.toString()); - current.setLength(0); - } else if (c2 == 't') { - current.append('\t'); - } else if (c2 == '\\') { - current.append(c2); - } - } else { - current.append(c); - } - } - result.add(current.toString()); - return Collections.unmodifiableList(result); - } - final static public List getSplit(Pattern2 pattern, String line) { final Matcher2 m = pattern.matcher(line); if (m.find() == false) { @@ -300,10 +272,6 @@ public class StringUtils { return '\u0006'; } - public static char hiddenNewLine() { - return '\u0009'; - } - public static String hideComparatorCharacters(String s) { s = s.replace('<', hiddenLesserThan()); s = s.replace('>', hiddenBiggerThan()); @@ -518,13 +486,5 @@ public class StringUtils { return arg.subSequence(i, j + 1).toString(); } - public static List splitHiddenNewLine(String s) { - return Arrays.asList(s.split("" + hiddenNewLine())); - } - - public static String manageNewLine(String string) { - return string.replace(hiddenNewLine(), '\n'); - } - // http://docs.oracle.com/javase/tutorial/i18n/format/dateFormat.html } diff --git a/src/net/sourceforge/plantuml/SuggestedFile.java b/src/net/sourceforge/plantuml/SuggestedFile.java index a5bee9691..5db9a0c12 100644 --- a/src/net/sourceforge/plantuml/SuggestedFile.java +++ b/src/net/sourceforge/plantuml/SuggestedFile.java @@ -50,7 +50,11 @@ public class SuggestedFile { this.outputFile = outputFile; this.fileFormat = fileFormat; this.initialCpt = initialCpt; + } + @Override + public String toString() { + return outputFile.getAbsolutePath() + "[" + initialCpt + "]"; } public static SuggestedFile fromOutputFile(File outputFile, FileFormat fileFormat) { diff --git a/src/net/sourceforge/plantuml/Url.java b/src/net/sourceforge/plantuml/Url.java index dff9052d4..1b59d0a55 100644 --- a/src/net/sourceforge/plantuml/Url.java +++ b/src/net/sourceforge/plantuml/Url.java @@ -58,7 +58,7 @@ public class Url implements EnsureVisible { if (tooltip == null) { this.tooltip = url; } else { - this.tooltip = StringUtils.manageNewLine(tooltip); + this.tooltip = BackSlash.manageNewLine(tooltip); } if (label == null || label.length() == 0) { this.label = url; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/AbstractConnection.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/AbstractConnection.java index 91367c12e..e61b5d0af 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/AbstractConnection.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/AbstractConnection.java @@ -35,6 +35,8 @@ */ package net.sourceforge.plantuml.activitydiagram3.ftile; +import net.sourceforge.plantuml.graphic.HorizontalAlignment; + public abstract class AbstractConnection implements Connection { private final Ftile ftile1; @@ -58,4 +60,14 @@ public abstract class AbstractConnection implements Connection { return ftile2; } + final public HorizontalAlignment arrowHorizontalAlignment() { + if (ftile1 != null) { + return ftile1.arrowHorizontalAlignment(); + } + if (ftile2 != null) { + return ftile2.arrowHorizontalAlignment(); + } + return HorizontalAlignment.LEFT; + } + } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/AbstractFtile.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/AbstractFtile.java index 289efb0fd..c14c46312 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/AbstractFtile.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/AbstractFtile.java @@ -39,10 +39,12 @@ import java.util.Collection; import java.util.Collections; import java.util.List; +import net.sourceforge.plantuml.AlignParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.LineParam; import net.sourceforge.plantuml.activitydiagram3.LinkRendering; import net.sourceforge.plantuml.graphic.AbstractTextBlock; +import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; @@ -102,4 +104,7 @@ public abstract class AbstractFtile extends AbstractTextBlock implements Ftile { // return Collections.emptyList(); } + public HorizontalAlignment arrowHorizontalAlignment() { + return skinParam.getHorizontalAlignment(AlignParam.ARROW_MESSAGE_ALIGN, null); + } } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Ftile.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Ftile.java index f6c28f84d..c9f13910a 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Ftile.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Ftile.java @@ -40,6 +40,7 @@ import java.util.List; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.activitydiagram3.LinkRendering; +import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.ugraphic.UStroke; @@ -64,5 +65,7 @@ public interface Ftile extends Swimable, TextBlock { public Collection getInnerConnections(); public List getWeldingPoints(); + + public HorizontalAlignment arrowHorizontalAlignment(); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileAssemblySimple.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileAssemblySimple.java index d24882644..733e76e28 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileAssemblySimple.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileAssemblySimple.java @@ -47,6 +47,7 @@ import java.util.Set; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.activitydiagram3.LinkRendering; import net.sourceforge.plantuml.graphic.AbstractTextBlock; +import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; @@ -157,4 +158,8 @@ public class FtileAssemblySimple extends AbstractTextBlock implements Ftile { return Arrays.asList(tile1, tile2); } + public HorizontalAlignment arrowHorizontalAlignment() { + return tile1.arrowHorizontalAlignment(); + } + } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Snake.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Snake.java index adddd4070..5f7af2827 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Snake.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Snake.java @@ -42,6 +42,7 @@ import java.util.ArrayList; import java.util.List; import net.sourceforge.plantuml.Direction; +import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColorAndStyle; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.StringBounder; @@ -61,9 +62,10 @@ public class Snake implements UShape { private TextBlock textBlock; private MergeStrategy mergeable = MergeStrategy.FULL; private Direction emphasizeDirection; + private final HorizontalAlignment horizontalAlignment; public Snake transformX(CompressionTransform compressionTransform) { - final Snake result = new Snake(color, endDecoration); + final Snake result = new Snake(horizontalAlignment, color, endDecoration); result.textBlock = this.textBlock; result.mergeable = this.mergeable; result.emphasizeDirection = this.emphasizeDirection; @@ -79,7 +81,7 @@ public class Snake implements UShape { this.endDecoration = null; } - public Snake(Rainbow color, UPolygon endDecoration) { + public Snake(HorizontalAlignment horizontalAlignment, Rainbow color, UPolygon endDecoration) { if (color == null) { throw new IllegalArgumentException(); } @@ -88,10 +90,11 @@ public class Snake implements UShape { } this.endDecoration = endDecoration; this.color = color; + this.horizontalAlignment = horizontalAlignment; } - public Snake(Rainbow color) { - this(color, null); + public Snake(HorizontalAlignment horizontalAlignment, Rainbow color) { + this(horizontalAlignment, color, null); } public void setLabel(TextBlock label) { @@ -99,7 +102,7 @@ public class Snake implements UShape { } public Snake move(double dx, double dy) { - final Snake result = new Snake(color, endDecoration); + final Snake result = new Snake(horizontalAlignment, color, endDecoration); for (Point2D pt : worm) { result.addPoint(pt.getX() + dx, pt.getY() + dy); } @@ -182,12 +185,20 @@ public class Snake implements UShape { final Point2D pt1 = worm.get(0); final Point2D pt2 = worm.get(1); final Dimension2D dim = textBlock.calculateDimension(stringBounder); + double x = Math.max(pt1.getX(), pt2.getX()); + if (horizontalAlignment == HorizontalAlignment.CENTER + && (worm.getDirectionsCode().startsWith("DLD") || worm.getDirectionsCode().startsWith("DRD"))) { + final Point2D pt3 = worm.get(2); + x = (pt2.getX() + pt3.getX()) / 2 - dim.getWidth() / 2; + } else { + x += 4; + } // if (worm.getDirectionsCode().startsWith("LD")) { // final double y = pt1.getY() - dim.getHeight(); // return new Point2D.Double(Math.max(pt1.getX(), pt2.getX()) - dim.getWidth(), y); // } final double y = (pt1.getY() + pt2.getY()) / 2 - dim.getHeight() / 2; - return new Point2D.Double(Math.max(pt1.getX(), pt2.getX()) + 4, y); + return new Point2D.Double(x, y); } public List getHorizontalLines() { @@ -229,7 +240,7 @@ public class Snake implements UShape { } if (same(this.getLast(), other.getFirst())) { final UPolygon oneOf = other.endDecoration == null ? endDecoration : other.endDecoration; - final Snake result = new Snake(color, oneOf); + final Snake result = new Snake(horizontalAlignment, color, oneOf); // result.textBlock = oneOf(this.textBlock, other.textBlock, stringBounder); result.emphasizeDirection = emphasizeDirection == null ? other.emphasizeDirection : emphasizeDirection; result.worm.addAll(this.worm.merge(other.worm, strategy)); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ConnectionVerticalDown.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ConnectionVerticalDown.java index 17f3a785c..97b97022a 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ConnectionVerticalDown.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ConnectionVerticalDown.java @@ -75,7 +75,7 @@ public class ConnectionVerticalDown extends AbstractConnection implements Connec } private Snake getSimpleSnake() { - final Snake snake = new Snake(color, Arrows.asToDown()); + final Snake snake = new Snake(arrowHorizontalAlignment(), color, Arrows.asToDown()); snake.setLabel(textBlock); snake.addPoint(p1); snake.addPoint(p2); @@ -83,7 +83,7 @@ public class ConnectionVerticalDown extends AbstractConnection implements Connec } public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) { - final Snake snake = new Snake(color, Arrows.asToDown()); + final Snake snake = new Snake(arrowHorizontalAlignment(), color, Arrows.asToDown()); snake.setLabel(textBlock); final Point2D mp1a = translate1.getTranslated(p1); final Point2D mp2b = translate2.getTranslated(p2); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorRepeat.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorRepeat.java index 0743da5d3..84b438297 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorRepeat.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorRepeat.java @@ -110,7 +110,7 @@ public class FtileFactoryDelegatorRepeat extends FtileFactoryDelegator { final UTranslate tr2 = genealogy.getTranslate(diamondBreak, ug.getStringBounder()); final Dimension2D dimDiamond = diamondBreak.calculateDimension(ug.getStringBounder()); - final Snake snake = new Snake(arrowColor, Arrows.asToRight()); + final Snake snake = new Snake(getFtile1().arrowHorizontalAlignment(), arrowColor, Arrows.asToRight()); snake.addPoint(tr1.getDx(), tr1.getDy()); snake.addPoint(0, tr1.getDy()); snake.addPoint(0, tr2.getDy() + dimDiamond.getHeight() / 2); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfAndStop.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfAndStop.java index 0038684a0..638c292df 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfAndStop.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfAndStop.java @@ -225,7 +225,7 @@ class FtileIfAndStop extends AbstractFtile { final Point2D p1 = getP1(stringBounder); final Point2D p2 = getP2(stringBounder); - final Snake snake = new Snake(color, Arrows.asToRight()); + final Snake snake = new Snake(arrowHorizontalAlignment(), color, 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 aba88edec..da7006566 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfDown.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfDown.java @@ -144,7 +144,7 @@ public class FtileIfDown extends AbstractFtile { final Point2D p2 = getP2(stringBounder); // p2 = new Point2D.Double(p2.getX(), p1.getY()); - final Snake snake = new Snake(color, Arrows.asToRight()); + final Snake snake = new Snake(arrowHorizontalAlignment(), color, Arrows.asToRight()); snake.addPoint(p1); snake.addPoint(p2); ug.draw(snake); @@ -187,7 +187,7 @@ public class FtileIfDown extends AbstractFtile { public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); - final Snake snake = new Snake(arrowColor, Arrows.asToDown()); + final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); snake.addPoint(getP1(stringBounder)); snake.addPoint(getP2(stringBounder)); @@ -198,7 +198,7 @@ public class FtileIfDown extends AbstractFtile { final StringBounder stringBounder = ug.getStringBounder(); final Point2D p1 = getP1(stringBounder); final Point2D p2 = getP2(stringBounder); - final Snake snake = new Snake(arrowColor, Arrows.asToDown()); + final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); final Point2D mp1a = translate1.getTranslated(p1); final Point2D mp2b = translate2.getTranslated(p2); final double middle = (mp1a.getY() + mp2b.getY()) / 2.0; @@ -235,7 +235,7 @@ public class FtileIfDown extends AbstractFtile { return; } - final Snake snake = new Snake(arrowColor, Arrows.asToDown()); + final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); snake.addPoint(getP1(stringBounder)); snake.addPoint(getP2(stringBounder)); @@ -251,7 +251,7 @@ public class FtileIfDown extends AbstractFtile { final StringBounder stringBounder = ug.getStringBounder(); final Point2D p1 = getP1(stringBounder); final Point2D p2 = getP2(stringBounder); - final Snake snake = new Snake(arrowColor, Arrows.asToDown()); + final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); final Point2D mp1a = translate1.getTranslated(p1); final Point2D mp2b = translate2.getTranslated(p2); final double middle = (mp1a.getY() + mp2b.getY()) / 2.0; @@ -290,7 +290,7 @@ public class FtileIfDown extends AbstractFtile { public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); - final Snake snake = new Snake(endInlinkColor, Arrows.asToLeft()); + final Snake snake = new Snake(arrowHorizontalAlignment(), endInlinkColor, Arrows.asToLeft()); final Point2D p1 = getP1(stringBounder); final Point2D p2 = getP2(stringBounder); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongHorizontal.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongHorizontal.java index aa4d5c856..1011a66e2 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongHorizontal.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongHorizontal.java @@ -228,7 +228,7 @@ class FtileIfLongHorizontal extends AbstractFtile { final Point2D p1 = getP1(stringBounder); final Point2D p2 = getP2(stringBounder); - final Snake snake = new Snake(color, Arrows.asToRight()); + final Snake snake = new Snake(arrowHorizontalAlignment(), color, Arrows.asToRight()); snake.addPoint(p1); snake.addPoint(p2); ug.draw(snake); @@ -266,7 +266,7 @@ class FtileIfLongHorizontal extends AbstractFtile { public void drawU(UGraphic ug) { final UTranslate tr = getTranslateDiamond1(getFtile2(), ug.getStringBounder()); final Point2D p2 = tr.getTranslated(getFtile2().calculateDimension(ug.getStringBounder()).getPointIn()); - final Snake snake = new Snake(arrowColor, Arrows.asToDown()); + final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); final Point2D p1 = calculateDimensionInternal(ug.getStringBounder()).getPointIn(); snake.addPoint(p1); @@ -290,7 +290,7 @@ class FtileIfLongHorizontal extends AbstractFtile { final Point2D p1 = getP1(ug.getStringBounder()); final UTranslate tr2 = getTranslate2(ug.getStringBounder()); final Point2D p2 = tr2.getTranslated(getFtile2().calculateDimension(ug.getStringBounder()).getPointIn()); - final Snake snake = new Snake(arrowColor, Arrows.asToDown()); + final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); snake.addPoint(p1); snake.addPoint(p2.getX(), p1.getY()); snake.addPoint(p2); @@ -326,7 +326,7 @@ class FtileIfLongHorizontal extends AbstractFtile { final double totalHeight = calculateDimensionInternal(stringBounder).getHeight(); final Point2D p2 = new Point2D.Double(p1.getX(), totalHeight); - final Snake snake = new Snake(arrowColor, Arrows.asToDown()); + final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); snake.addPoint(p1); snake.addPoint(p2); ug.draw(snake); @@ -348,7 +348,7 @@ class FtileIfLongHorizontal extends AbstractFtile { final Point2D p1 = getP1(stringBounder); final Point2D p2 = getP2(stringBounder); - final Snake snake = new Snake(color, Arrows.asToDown()); + final Snake snake = new Snake(arrowHorizontalAlignment(), color, Arrows.asToDown()); snake.addPoint(p1); snake.addPoint(p2); ug.draw(snake); @@ -368,7 +368,7 @@ class FtileIfLongHorizontal extends AbstractFtile { final Point2D p1 = getP1(ug.getStringBounder()); final Point2D p2 = getP2(ug.getStringBounder()); - final Snake snake = new Snake(color, Arrows.asToDown()); + final Snake snake = new Snake(arrowHorizontalAlignment(), color, Arrows.asToDown()); final Point2D mp1a = translate1.getTranslated(p1); final Point2D mp2b = translate2.getTranslated(p2); @@ -400,7 +400,7 @@ class FtileIfLongHorizontal extends AbstractFtile { } final Point2D p2 = new Point2D.Double(p1.getX(), totalHeight); - final Snake snake = new Snake(color, Arrows.asToDown()); + final Snake snake = new Snake(arrowHorizontalAlignment(), color, Arrows.asToDown()); snake.addPoint(p1); snake.addPoint(p2); ug.draw(snake); @@ -462,7 +462,7 @@ class FtileIfLongHorizontal extends AbstractFtile { return; } - final Snake s = new Snake(arrowColor); + final Snake s = new Snake(arrowHorizontalAlignment(), arrowColor); s.goUnmergeable(MergeStrategy.NONE); final double height = totalDim.getHeight(); s.addPoint(minX, height); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongVertical.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongVertical.java index 9586647a4..8fef81746 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongVertical.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongVertical.java @@ -220,7 +220,7 @@ class FtileIfLongVertical extends AbstractFtile { public void drawU(UGraphic ug) { final UTranslate tr = getTranslateDiamond(getFtile2(), ug.getStringBounder()); final Point2D p2 = tr.getTranslated(getFtile2().calculateDimension(ug.getStringBounder()).getPointIn()); - final Snake snake = new Snake(arrowColor, Arrows.asToDown()); + final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); final Point2D p1 = calculateDimensionInternal(ug.getStringBounder()).getPointIn(); snake.addPoint(p1); @@ -246,7 +246,7 @@ class FtileIfLongVertical extends AbstractFtile { final Point2D p1 = getP1(stringBounder); final Point2D p2 = getP2(stringBounder); - final Snake snake = new Snake(color, Arrows.asToDown()); + final Snake snake = new Snake(arrowHorizontalAlignment(), color, Arrows.asToDown()); snake.addPoint(p1); snake.addPoint(p2.getX(), p1.getY()); snake.addPoint(p2); @@ -281,7 +281,7 @@ class FtileIfLongVertical extends AbstractFtile { final Point2D p1 = getP1(stringBounder); final Point2D p2 = getP2(stringBounder); - final Snake snake = new Snake(color, Arrows.asToDown()); + final Snake snake = new Snake(arrowHorizontalAlignment(), color, Arrows.asToDown()); snake.addPoint(p1); snake.addPoint(p2); ug.draw(snake); @@ -317,7 +317,7 @@ class FtileIfLongVertical extends AbstractFtile { final Point2D p2 = getTranslate2(stringBounder).getTranslated( getFtile2().calculateDimension(stringBounder).getPointIn()); - final Snake snake = new Snake(arrowColor, Arrows.asToDown()); + final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); snake.addPoint(p1); snake.addPoint(p1.getX(), p2.getY() - 15); snake.addPoint(p2.getX(), p2.getY() - 15); @@ -346,7 +346,7 @@ class FtileIfLongVertical extends AbstractFtile { final Point2D p2 = getTranslateLastDiamond(stringBounder).getTranslated( getFtile2().calculateDimension(stringBounder).getPointIn()); - final Snake snake = new Snake(arrowColor, Arrows.asToDown()); + final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); snake.addPoint(p1); snake.addPoint(p1.getX(), p2.getY() - 15); snake.addPoint(p2.getX(), p2.getY() - 15); @@ -380,7 +380,7 @@ class FtileIfLongVertical extends AbstractFtile { final Dimension2D dimTotal = calculateDimensionInternal(stringBounder); - final Snake snake = new Snake(arrowColor, Arrows.asToLeft()); + final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToLeft()); snake.addPoint(p1); snake.addPoint(p1.getX(), p1.getY() + 15); snake.addPoint(dimTotal.getWidth(), p1.getY() + 15); @@ -411,7 +411,7 @@ class FtileIfLongVertical extends AbstractFtile { final Point2D p2 = new Point2D.Double(dimTotal.getWidth(), p1.getY() + 15); - final Snake snake = new Snake(arrowColor, Arrows.asToRight()); + final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToRight()); snake.addPoint(p1); snake.addPoint(p1.getX(), p2.getY()); snake.addPoint(p2); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java index 8bed0718b..0aaca6377 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java @@ -198,7 +198,7 @@ class FtileRepeat extends AbstractFtile { public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); - final Snake snake = new Snake(arrowColor, Arrows.asToDown()); + final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); snake.setLabel(tbin); snake.addPoint(getP1(stringBounder)); snake.addPoint(getP2(stringBounder)); @@ -233,7 +233,7 @@ class FtileRepeat extends AbstractFtile { return; } - final Snake snake = new Snake(arrowColor, Arrows.asToDown()); + final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); snake.setLabel(tbout); snake.addPoint(getP1(stringBounder)); snake.addPoint(getP2(stringBounder)); @@ -246,7 +246,7 @@ class FtileRepeat extends AbstractFtile { if (getFtile1().calculateDimension(stringBounder).hasPointOut() == false) { return; } - final Snake snake = new Snake(arrowColor); + final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor); snake.setLabel(tbout); final Point2D mp1a = translate1.getTranslated(getP1(stringBounder)); final Point2D mp2b = translate2.getTranslated(getP2(stringBounder)); @@ -257,7 +257,7 @@ class FtileRepeat extends AbstractFtile { // snake.addPoint(mp2b); ug.draw(snake); - final Snake small = new Snake(arrowColor, Arrows.asToDown()); + final Snake small = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); small.addPoint(mp2b.getX(), middle); small.addPoint(mp2b); ug.draw(small); @@ -288,7 +288,7 @@ class FtileRepeat extends AbstractFtile { public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) { final StringBounder stringBounder = ug.getStringBounder(); - final Snake snake = new Snake(arrowColor, Arrows.asToLeft()); + final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToLeft()); snake.emphasizeDirection(Direction.UP); final Dimension2D dimRepeat = repeat.calculateDimension(stringBounder); @@ -330,7 +330,7 @@ class FtileRepeat extends AbstractFtile { public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); - final Snake snake = new Snake(arrowColor, null); + final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, null); snake.setLabel(tbback); final Dimension2D dimRepeat = repeat.calculateDimension(stringBounder); final Point2D p1 = getP1(stringBounder); @@ -369,7 +369,7 @@ class FtileRepeat extends AbstractFtile { public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); - final Snake snake = new Snake(arrowColor, Arrows.asToUp()); + final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToUp()); snake.setLabel(tbback); final Point2D p1 = getP1(stringBounder); final Point2D p2 = getP2(stringBounder); @@ -408,7 +408,7 @@ class FtileRepeat extends AbstractFtile { public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); - final Snake snake = new Snake(arrowColor, Arrows.asToLeft()); + final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToLeft()); snake.emphasizeDirection(Direction.UP); final Point2D p1 = getP1(stringBounder); final Point2D p2 = getP2(stringBounder); @@ -448,7 +448,7 @@ class FtileRepeat extends AbstractFtile { public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); - final Snake snake = new Snake(arrowColor, Arrows.asToLeft()); + final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToLeft()); snake.setLabel(tbback); snake.emphasizeDirection(Direction.UP); final Dimension2D dimTotal = calculateDimensionInternal(stringBounder); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java index 4025511ea..cdf8eedb8 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java @@ -174,7 +174,7 @@ class FtileWhile extends AbstractFtile { public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); - final Snake snake = new Snake(arrowColor, Arrows.asToDown()); + final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); snake.addPoint(getP1(stringBounder)); snake.addPoint(getP2(stringBounder)); @@ -185,7 +185,7 @@ class FtileWhile extends AbstractFtile { final StringBounder stringBounder = ug.getStringBounder(); final Point2D p1 = getP1(stringBounder); final Point2D p2 = getP2(stringBounder); - final Snake snake = new Snake(arrowColor, Arrows.asToDown()); + final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); final Point2D mp1a = translate1.getTranslated(p1); final Point2D mp2b = translate2.getTranslated(p2); final double middle = (mp1a.getY() + mp2b.getY()) / 2.0; @@ -228,7 +228,7 @@ class FtileWhile extends AbstractFtile { public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); - final Snake snake = new Snake(endInlinkColor, Arrows.asToLeft()); + final Snake snake = new Snake(arrowHorizontalAlignment(), endInlinkColor, Arrows.asToLeft()); final Dimension2D dimTotal = calculateDimension(stringBounder); final Point2D p1 = getP1(stringBounder); if (p1 == null) { @@ -264,7 +264,7 @@ class FtileWhile extends AbstractFtile { public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) { final StringBounder stringBounder = ug.getStringBounder(); - final Snake snake = new Snake(endInlinkColor, Arrows.asToLeft()); + final Snake snake = new Snake(arrowHorizontalAlignment(), endInlinkColor, Arrows.asToLeft()); final Dimension2D dimTotal = calculateDimension(stringBounder); final Point2D ap1 = getP1(stringBounder); final Point2D ap2 = getP2(stringBounder); @@ -323,7 +323,7 @@ class FtileWhile extends AbstractFtile { public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); - final Snake snake = new Snake(endInlinkColor, Arrows.asToLeft()); + final Snake snake = new Snake(arrowHorizontalAlignment(), endInlinkColor, Arrows.asToLeft()); final Dimension2D dimTotal = calculateDimension(stringBounder); final Point2D p1 = getP1(stringBounder); final Point2D p2 = getP2(stringBounder); @@ -373,7 +373,7 @@ class FtileWhile extends AbstractFtile { public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); - final Snake snake = new Snake(afterEndwhileColor); + final Snake snake = new Snake(arrowHorizontalAlignment(), afterEndwhileColor); final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder); final Point2D p1 = getP1(stringBounder); @@ -395,7 +395,7 @@ class FtileWhile extends AbstractFtile { // ug = ug.apply(new UChangeColor(afterEndwhileColor)).apply(new UChangeBackColor(afterEndwhileColor)); // ug.apply(new UTranslate(Diamond.diamondHalfSize, (y1 + y2) / 2)).draw(Arrows.asToDown()); - final Snake snake2 = new Snake(afterEndwhileColor); + final Snake snake2 = new Snake(arrowHorizontalAlignment(), afterEndwhileColor); snake2.addPoint(Diamond.diamondHalfSize, y2); snake2.addPoint(x2, y2); // snake2.goUnmergeable(MergeStrategy.LIMITED); @@ -424,7 +424,7 @@ class FtileWhile extends AbstractFtile { public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); - final Snake snake = new Snake(afterEndwhileColor, Arrows.asToDown()); + final Snake snake = new Snake(arrowHorizontalAlignment(), afterEndwhileColor, Arrows.asToDown()); final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder); final Point2D p1 = getP1(stringBounder); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderFork.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderFork.java index 2bd8c22ad..e20dd8681 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderFork.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderFork.java @@ -128,7 +128,7 @@ public class ParallelBuilderFork extends ParallelFtilesBuilder { public void drawU(UGraphic ug) { ug = ug.apply(new UTranslate(x, 0)); final FtileGeometry geo = getFtile2().calculateDimension(getStringBounder()); - final Snake snake = new Snake(arrowColor, Arrows.asToDown()); + final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); if (Display.isNull(label) == false) { snake.setLabel(getTextBlock(label)); } @@ -143,7 +143,7 @@ public class ParallelBuilderFork extends ParallelFtilesBuilder { final Point2D p1 = new Point2D.Double(geo.getLeft(), 0); final Point2D p2 = new Point2D.Double(geo.getLeft(), geo.getInY()); - final Snake snake = new Snake(arrowColor, Arrows.asToDown()); + final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); if (Display.isNull(label) == false) { snake.setLabel(getTextBlock(label)); } @@ -182,7 +182,7 @@ public class ParallelBuilderFork extends ParallelFtilesBuilder { if (geo.hasPointOut() == false) { return; } - final Snake snake = new Snake(arrowColor, Arrows.asToDown()); + final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); if (Display.isNull(label) == false) { snake.setLabel(getTextBlock(label)); } @@ -202,7 +202,7 @@ public class ParallelBuilderFork extends ParallelFtilesBuilder { final Point2D p1 = translate0.getTranslated(new Point2D.Double(geo.getLeft(), geo.getOutY())); final Point2D p2 = translate0.getTranslated(new Point2D.Double(geo.getLeft(), height)); - final Snake snake = new Snake(arrowColor, Arrows.asToDown()); + final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); if (Display.isNull(label) == false) { snake.setLabel(getTextBlock(label)); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderMerge.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderMerge.java index 94f2710d6..3cb2c549c 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderMerge.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderMerge.java @@ -143,7 +143,7 @@ public class ParallelBuilderMerge extends ParallelFtilesBuilder { } else if (counter == 1) { endDecoration = Arrows.asToLeft(); } - final Snake snake = new Snake(arrowColor, endDecoration); + final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, endDecoration); snake.addPoint(x1, y1); snake.addPoint(x1, y2); snake.addPoint(x2, y2); @@ -186,7 +186,7 @@ public class ParallelBuilderMerge extends ParallelFtilesBuilder { public void drawU(UGraphic ug) { ug = ug.apply(new UTranslate(x, 0)); final FtileGeometry geo = getFtile2().calculateDimension(getStringBounder()); - final Snake snake = new Snake(arrowColor, Arrows.asToDown()); + final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); if (Display.isNull(label) == false) { snake.setLabel(getTextBlock(label)); } @@ -201,7 +201,7 @@ public class ParallelBuilderMerge extends ParallelFtilesBuilder { final Point2D p1 = new Point2D.Double(geo.getLeft(), 0); final Point2D p2 = new Point2D.Double(geo.getLeft(), geo.getInY()); - final Snake snake = new Snake(arrowColor, Arrows.asToDown()); + final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); if (Display.isNull(label) == false) { snake.setLabel(getTextBlock(label)); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderSplit.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderSplit.java index fa882a28f..4be0c9d6f 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderSplit.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderSplit.java @@ -163,7 +163,7 @@ public class ParallelBuilderSplit extends ParallelFtilesBuilder { maxX = totalWidth / 2; } - final Snake s = new Snake(arrowColor); + final Snake s = new Snake(arrowHorizontalAlignment(), arrowColor); s.goUnmergeable(MergeStrategy.NONE); s.addPoint(minX, y); s.addPoint(maxX, y); @@ -209,7 +209,7 @@ public class ParallelBuilderSplit extends ParallelFtilesBuilder { } final Dimension2D dimInner = inner.calculateDimension(stringBounder); - final Snake s = new Snake(arrowColor); + final Snake s = new Snake(arrowHorizontalAlignment(), arrowColor); // final Snake s = new Snake(HtmlColorUtils.GREEN); s.goUnmergeable(MergeStrategy.LIMITED); s.addPoint(minX, y); @@ -235,7 +235,7 @@ public class ParallelBuilderSplit extends ParallelFtilesBuilder { ug = ug.apply(new UTranslate(x, 0)); final FtileGeometry geo = getFtile2().calculateDimension(ug.getStringBounder()); final double left = geo.getLeft(); - final Snake s = new Snake(arrowColor, Arrows.asToDown()); + final Snake s = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); s.setLabel(text); s.addPoint(left, 0); s.addPoint(left, geo.getInY()); @@ -265,7 +265,7 @@ public class ParallelBuilderSplit extends ParallelFtilesBuilder { assert false; return; } - final Snake s = new Snake(arrowColor, Arrows.asToDown()); + final Snake s = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); s.setLabel(text); s.goUnmergeable(MergeStrategy.NONE); s.addPoint(geo.getLeft(), geo.getOutY()); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderSplit2.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderSplit2.java index 432542d19..1bc10eb1d 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderSplit2.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderSplit2.java @@ -154,7 +154,7 @@ public class ParallelBuilderSplit2 extends ParallelFtilesBuilder { public void drawU(UGraphic ug) { ug = ug.apply(new UTranslate(x, 0)); final FtileGeometry geo = getFtile2().calculateDimension(getStringBounder()); - final Snake snake = new Snake(arrowColor, Arrows.asToDown()); + final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); if (Display.isNull(label) == false) { snake.setLabel(getTextBlock(label)); } @@ -169,7 +169,7 @@ public class ParallelBuilderSplit2 extends ParallelFtilesBuilder { final Point2D p1 = new Point2D.Double(geo.getLeft(), 0); final Point2D p2 = new Point2D.Double(geo.getLeft(), geo.getInY()); - final Snake snake = new Snake(arrowColor, Arrows.asToDown()); + final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); if (Display.isNull(label) == false) { snake.setLabel(getTextBlock(label)); } @@ -208,7 +208,7 @@ public class ParallelBuilderSplit2 extends ParallelFtilesBuilder { if (geo.hasPointOut() == false) { return; } - final Snake snake = new Snake(arrowColor, Arrows.asToDown()); + final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); if (Display.isNull(label) == false) { snake.setLabel(getTextBlock(label)); } @@ -228,7 +228,7 @@ public class ParallelBuilderSplit2 extends ParallelFtilesBuilder { final Point2D p1 = translate0.getTranslated(new Point2D.Double(geo.getLeft(), geo.getOutY())); final Point2D p2 = translate0.getTranslated(new Point2D.Double(geo.getLeft(), height)); - final Snake snake = new Snake(arrowColor, Arrows.asToDown()); + final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); if (Display.isNull(label) == false) { snake.setLabel(getTextBlock(label)); } 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 a63062338..882a7acd5 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileIfWithLinks.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileIfWithLinks.java @@ -109,7 +109,7 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds { final double x2 = p2.getX(); final double y2 = p2.getY(); - final Snake snake = new Snake(color, usingArrow); + final Snake snake = new Snake(arrowHorizontalAlignment(), color, usingArrow); snake.addPoint(x1, y1); snake.addPoint(x2, y1); snake.addPoint(x2, y2); @@ -158,14 +158,14 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds { if (originalDirection != newDirection) { final double delta = (originalDirection == Direction.RIGHT ? -1 : 1) * Diamond.diamondHalfSize; final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder); - final Snake small = new Snake(color); + final Snake small = new Snake(arrowHorizontalAlignment(), color); 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(); } - final Snake snake = new Snake(color, usingArrow); + final Snake snake = new Snake(arrowHorizontalAlignment(), color, usingArrow); snake.addPoint(p1); snake.addPoint(p2.getX(), p1.getY()); snake.addPoint(p2); @@ -202,7 +202,7 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds { final double y2 = p2.getY(); final UPolygon arrow = x2 > x1 ? Arrows.asToRight() : Arrows.asToLeft(); - final Snake snake = new Snake(myArrowColor, arrow); + final Snake snake = new Snake(arrowHorizontalAlignment(), myArrowColor, arrow); if (branchEmpty) { snake.emphasizeDirection(Direction.DOWN); } @@ -257,7 +257,7 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds { if (originalDirection == newDirection) { final double delta = (x2 > x1 ? -1 : 1) * 1.5 * Diamond.diamondHalfSize; final Point2D mp2bc = new Point2D.Double(mp2b.getX() + delta, mp2b.getY()); - final Snake snake = new Snake(myArrowColor); + final Snake snake = new Snake(arrowHorizontalAlignment(), myArrowColor); final double middle = (mp1a.getY() + mp2b.getY()) / 2.0; snake.addPoint(mp1a); snake.addPoint(mp1a.getX(), middle); @@ -265,7 +265,7 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds { snake.addPoint(mp2bc); snake.goUnmergeable(MergeStrategy.LIMITED); ug.draw(snake); - final Snake small = new Snake(myArrowColor, arrow); + final Snake small = new Snake(arrowHorizontalAlignment(), myArrowColor, arrow); small.addPoint(mp2bc); small.addPoint(mp2bc.getX(), mp2b.getY()); small.addPoint(mp2b); @@ -275,13 +275,13 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds { final double delta = (x2 > x1 ? -1 : 1) * 1.5 * Diamond.diamondHalfSize; final Point2D mp2bb = new Point2D.Double(mp2b.getX() + delta, mp2b.getY() - 1.5 * Diamond.diamondHalfSize); - final Snake snake = new Snake(myArrowColor); + final Snake snake = new Snake(arrowHorizontalAlignment(), myArrowColor); snake.addPoint(mp1a); snake.addPoint(mp1a.getX(), mp2bb.getY()); snake.addPoint(mp2bb); snake.goUnmergeable(MergeStrategy.LIMITED); ug.draw(snake); - final Snake small = new Snake(myArrowColor, arrow); + final Snake small = new Snake(arrowHorizontalAlignment(), myArrowColor, arrow); small.addPoint(mp2bb); small.addPoint(mp2bb.getX(), mp2b.getY()); small.addPoint(mp2b); @@ -320,7 +320,7 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds { final double x2 = p2.getX(); final double y2 = p2.getY(); - final Snake snake = new Snake(myArrowColor); + final Snake snake = new Snake(arrowHorizontalAlignment(), myArrowColor); if (branchEmpty) { snake.emphasizeDirection(Direction.DOWN); } @@ -346,7 +346,7 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds { final Point2D mp1a = translate1.getTranslated(p1); final Point2D mp2b = translate2.getTranslated(p2); - final Snake snake = new Snake(myArrowColor); + final Snake snake = new Snake(arrowHorizontalAlignment(), myArrowColor); // snake.emphasizeDirection(Direction.DOWN); final double x1 = mp1a.getX(); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecorate.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecorate.java index d22dc2027..7218e270a 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecorate.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecorate.java @@ -48,6 +48,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.activitydiagram3.ftile.WeldingPoint; import net.sourceforge.plantuml.graphic.AbstractTextBlock; +import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; @@ -127,5 +128,10 @@ public abstract class FtileDecorate extends AbstractTextBlock implements Ftile { } return Collections.singleton(ftile); } + + public HorizontalAlignment arrowHorizontalAlignment() { + return ftile.arrowHorizontalAlignment(); + } + } diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateElementFull2.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateElementFull2.java index 4d478f99b..6f0dbfc74 100644 --- a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateElementFull2.java +++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateElementFull2.java @@ -144,7 +144,7 @@ public class CommandCreateElementFull2 extends SingleLineCommand2 usymbol = null; } else { type = LeafType.DESCRIPTION; - usymbol = USymbol.getFoo1(symbol, diagram.getSkinParam().useUml2ForComponent()); + usymbol = USymbol.getFromString(symbol, diagram.getSkinParam().useUml2ForComponent()); if (usymbol == null) { throw new IllegalStateException(); } diff --git a/src/net/sourceforge/plantuml/command/BlocLines.java b/src/net/sourceforge/plantuml/command/BlocLines.java index 08c5b210b..c8bf2ecf4 100644 --- a/src/net/sourceforge/plantuml/command/BlocLines.java +++ b/src/net/sourceforge/plantuml/command/BlocLines.java @@ -41,6 +41,7 @@ import java.util.Collections; import java.util.Iterator; import java.util.List; +import net.sourceforge.plantuml.BackSlash; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.cucadiagram.Display; @@ -67,7 +68,7 @@ public class BlocLines implements Iterable { } public static BlocLines getWithNewlines(CharSequence s) { - return new BlocLines(StringUtils.getWithNewlines(s)); + return new BlocLines(BackSlash.getWithNewlines(s)); } public BlocLines() { @@ -174,7 +175,7 @@ public class BlocLines implements Iterable { final StringBuilder sb = new StringBuilder(); for (CharSequence line : lines) { sb.append(line); - sb.append(StringUtils.hiddenNewLine()); + sb.append(BackSlash.hiddenNewLine()); } return single(sb.substring(0, sb.length() - 1)); } diff --git a/src/net/sourceforge/plantuml/cucadiagram/Bodier.java b/src/net/sourceforge/plantuml/cucadiagram/Bodier.java index b3cce3590..274804576 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/Bodier.java +++ b/src/net/sourceforge/plantuml/cucadiagram/Bodier.java @@ -173,11 +173,26 @@ public class Bodier { return true; } + private List rawBodyWithoutHidden() { + if (hides == null || hides.size() == 0) { + return rawBody; + } + final List result = new ArrayList(); + for (String s : rawBody) { + final Member m = new MemberImpl(s, isMethod(s), manageModifier); + if (hides.contains(m.getVisibilityModifier()) == false) { + result.add(s); + } + + } + return result; + } + public TextBlock getBody(final FontParam fontParam, final ISkinParam skinParam, final boolean showMethods, final boolean showFields, Stereotype stereotype) { if (type.isLikeClass() && isBodyEnhanced()) { if (showMethods || showFields) { - return new BodyEnhanced(rawBody, fontParam, skinParam, manageModifier, stereotype, leaf); + return new BodyEnhanced(rawBodyWithoutHidden(), fontParam, skinParam, manageModifier, stereotype, leaf); } return null; } diff --git a/src/net/sourceforge/plantuml/cucadiagram/Display.java b/src/net/sourceforge/plantuml/cucadiagram/Display.java index ffbff27b5..d531c3bbf 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/Display.java +++ b/src/net/sourceforge/plantuml/cucadiagram/Display.java @@ -42,6 +42,7 @@ import java.util.Collections; import java.util.Iterator; import java.util.List; +import net.sourceforge.plantuml.BackSlash; import net.sourceforge.plantuml.CharSequence2; import net.sourceforge.plantuml.CharSequence2Impl; import net.sourceforge.plantuml.EmbededDiagram; @@ -138,7 +139,7 @@ public class Display implements Iterable { current.append(c); current.append(c2); } - } else if (c == StringUtils.hiddenNewLine()) { + } else if (c == BackSlash.hiddenNewLine()) { result.add(current.toString()); current.setLength(0); } else { @@ -220,16 +221,16 @@ public class Display implements Iterable { return new Display(this, mode); } - public String asStringWithHiddenNewLine() { - final StringBuilder sb = new StringBuilder(); - for (int i = 0; i < display.size(); i++) { - sb.append(display.get(i)); - if (i < display.size() - 1) { - sb.append(StringUtils.hiddenNewLine()); - } - } - return sb.toString(); - } + // private String asStringWithHiddenNewLine() { + // final StringBuilder sb = new StringBuilder(); + // for (int i = 0; i < display.size(); i++) { + // sb.append(display.get(i)); + // if (i < display.size() - 1) { + // sb.append(BackSlash.hiddenNewLine()); + // } + // } + // return sb.toString(); + // } @Override public String toString() { diff --git a/src/net/sourceforge/plantuml/cucadiagram/dot/CucaDiagramTxtMaker.java b/src/net/sourceforge/plantuml/cucadiagram/dot/CucaDiagramTxtMaker.java index 67eed9195..b4c41e293 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/dot/CucaDiagramTxtMaker.java +++ b/src/net/sourceforge/plantuml/cucadiagram/dot/CucaDiagramTxtMaker.java @@ -47,6 +47,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import net.sourceforge.plantuml.BackSlash; import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.cucadiagram.CucaDiagram; @@ -126,14 +127,14 @@ public final class CucaDiagramTxtMaker { ug.getCharArea().drawHLine('-', y, 1, w - 1); y++; for (Member att : ent.getBodier().getFieldsToDisplay()) { - final List disp = StringUtils.getWithNewlines(att.getDisplay(true)); + final List disp = BackSlash.getWithNewlines(att.getDisplay(true)); ug.getCharArea().drawStringsLR(disp, 1, y); y += StringUtils.getHeight(disp); } ug.getCharArea().drawHLine('-', y, 1, w - 1); y++; for (Member att : ent.getBodier().getMethodsToDisplay()) { - final List disp = StringUtils.getWithNewlines(att.getDisplay(true)); + final List disp = BackSlash.getWithNewlines(att.getDisplay(true)); ug.getCharArea().drawStringsLR(disp, 1, y); y += StringUtils.getHeight(disp); } diff --git a/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementFull.java b/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementFull.java index 0708c5556..0ba015991 100644 --- a/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementFull.java +++ b/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementFull.java @@ -61,7 +61,7 @@ import net.sourceforge.plantuml.graphic.color.Colors; public class CommandCreateElementFull extends SingleLineCommand2 { - public static final String ALL_TYPES = "artifact|actor|folder|card|file|package|rectangle|node|frame|cloud|database|queue|storage|agent|usecase|component|boundary|control|entity|interface"; + public static final String ALL_TYPES = "artifact|actor|folder|card|file|package|rectangle|node|frame|cloud|database|queue|pipe|storage|agent|usecase|component|boundary|control|entity|interface"; public CommandCreateElementFull() { super(getRegexConcat()); @@ -148,7 +148,7 @@ public class CommandCreateElementFull extends SingleLineCommand2 beziers = new ArrayList(); + private String comment; public DotPath() { this(new ArrayList()); @@ -406,7 +407,7 @@ public class DotPath implements UShape, Moveable { } public UPath toUPath() { - final UPath result = new UPath(); + final UPath result = new UPath(comment); boolean start = true; for (CubicCurve2D.Double bez : beziers) { if (start) { @@ -668,4 +669,8 @@ public class DotPath implements UShape, Moveable { return Collections.unmodifiableList(result); } + public void setComment(String comment) { + this.comment = comment; + } + } diff --git a/src/net/sourceforge/plantuml/preproc/Define.java b/src/net/sourceforge/plantuml/preproc/Define.java index 37b35b923..d23bd0599 100644 --- a/src/net/sourceforge/plantuml/preproc/Define.java +++ b/src/net/sourceforge/plantuml/preproc/Define.java @@ -39,6 +39,8 @@ import java.util.Iterator; import java.util.List; import java.util.regex.Matcher; +import net.sourceforge.plantuml.BackSlash; + public class Define { private final DefineSignature signature; @@ -78,7 +80,9 @@ public class Define { } } else { final String regex = "\\b" + signature.getKey() + "\\b"; + line = BackSlash.translateBackSlashes(line); line = line.replaceAll(regex, definitionQuoted); + line = BackSlash.untranslateBackSlashes(line); } return line; } diff --git a/src/net/sourceforge/plantuml/preproc/Defines.java b/src/net/sourceforge/plantuml/preproc/Defines.java index a3d0b4686..1bafeef86 100644 --- a/src/net/sourceforge/plantuml/preproc/Defines.java +++ b/src/net/sourceforge/plantuml/preproc/Defines.java @@ -84,6 +84,7 @@ public class Defines implements Truth { throw new IllegalArgumentException(); } final Defines result = createEmpty(); + result.environment.put("filedate", new Date(file.lastModified()).toString()); result.environment.put("filename", file.getName()); result.environment.put("dirpath", file.getAbsoluteFile().getParentFile().getAbsolutePath().replace('\\', '/')); return result; diff --git a/src/net/sourceforge/plantuml/svek/Line.java b/src/net/sourceforge/plantuml/svek/Line.java index 29b8f40b5..1e3e72723 100644 --- a/src/net/sourceforge/plantuml/svek/Line.java +++ b/src/net/sourceforge/plantuml/svek/Line.java @@ -84,6 +84,7 @@ import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryExtends; import net.sourceforge.plantuml.svek.image.EntityImageNoteLink; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; +import net.sourceforge.plantuml.ugraphic.UComment; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UShape; @@ -613,7 +614,8 @@ public class Line implements Moveable, Hideable { if (opale) { return; } - + ug.draw(new UComment("link " + link.getEntity1().getCode().getFullName() + " to " + + link.getEntity2().getCode().getFullName())); double x = 0; double y = 0; final Url url = link.getUrl(); @@ -671,6 +673,7 @@ public class Line implements Moveable, Hideable { } } + todraw.setComment(link.getEntity1().getCode().getFullName() + "-" + link.getEntity2().getCode().getFullName()); ug.apply(new UTranslate(x, y)).draw(todraw); ug = ug.apply(new UStroke()).apply(new UChangeColor(color)); diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageClass.java b/src/net/sourceforge/plantuml/svek/image/EntityImageClass.java index baf36739a..403b09e5e 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageClass.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageClass.java @@ -139,7 +139,7 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil, Wi final double widthTotal = dimTotal.getWidth(); final double heightTotal = dimTotal.getHeight(); - final Shadowable rect = new URectangle(widthTotal, heightTotal, roundCorner, roundCorner); + final Shadowable rect = new URectangle(widthTotal, heightTotal, roundCorner, roundCorner, getEntity().getCode().getFullName()); if (getSkinParam().shadowing()) { rect.setDeltaShadow(4); } diff --git a/src/net/sourceforge/plantuml/svg/SvgGraphics.java b/src/net/sourceforge/plantuml/svg/SvgGraphics.java index 7b0041c04..2f71fde4b 100644 --- a/src/net/sourceforge/plantuml/svg/SvgGraphics.java +++ b/src/net/sourceforge/plantuml/svg/SvgGraphics.java @@ -334,7 +334,8 @@ public class SvgGraphics { return pendingLink2.get(0); } - public void svgRectangle(double x, double y, double width, double height, double rx, double ry, double deltaShadow) { + public void svgRectangle(double x, double y, double width, double height, double rx, double ry, double deltaShadow, + String id) { if (height <= 0 || width <= 0) { throw new IllegalArgumentException(); } @@ -346,7 +347,9 @@ public class SvgGraphics { elt.setAttribute("rx", format(rx)); elt.setAttribute("ry", format(ry)); } - + if (id != null) { + elt.setAttribute("id", id); + } getG().appendChild(elt); } ensureVisible(x + width + 2 * deltaShadow, y + height + 2 * deltaShadow); @@ -619,6 +622,10 @@ public class SvgGraphics { elt.setAttribute("d", sb.toString()); elt.setAttribute("style", getStyle()); elt.setAttribute("fill", fill); + final String id = path.getComment(); + if (id != null) { + elt.setAttribute("id", id); + } addFilterShadowId(elt, deltaShadow); getG().appendChild(elt); } diff --git a/src/net/sourceforge/plantuml/syntax/LanguageDescriptor.java b/src/net/sourceforge/plantuml/syntax/LanguageDescriptor.java index a90cff258..60bb48167 100644 --- a/src/net/sourceforge/plantuml/syntax/LanguageDescriptor.java +++ b/src/net/sourceforge/plantuml/syntax/LanguageDescriptor.java @@ -70,6 +70,7 @@ public class LanguageDescriptor { type.add("database"); type.add("storage"); type.add("agent"); + type.add("pipe"); type.add("boundary"); type.add("control"); type.add("entity"); diff --git a/src/net/sourceforge/plantuml/ugraphic/UPath.java b/src/net/sourceforge/plantuml/ugraphic/UPath.java index 98f773036..791f125f2 100644 --- a/src/net/sourceforge/plantuml/ugraphic/UPath.java +++ b/src/net/sourceforge/plantuml/ugraphic/UPath.java @@ -42,11 +42,20 @@ import java.util.List; public class UPath extends AbstractShadowable implements Iterable { + private final String comment; private final List segments = new ArrayList(); private MinMax minmax = MinMax.getEmpty(false); private boolean isOpenIconic; + public UPath(String comment) { + this.comment = comment; + } + + public UPath() { + this(null); + } + public void add(double[] coord, USegmentType pathType) { addInternal(new USegment(coord, pathType)); } @@ -66,7 +75,7 @@ public class UPath extends AbstractShadowable implements Iterable { } public UPath translate(double dx, double dy) { - final UPath result = new UPath(); + final UPath result = new UPath(comment); for (USegment seg : segments) { result.addInternal(seg.translate(dx, dy)); } @@ -74,7 +83,7 @@ public class UPath extends AbstractShadowable implements Iterable { } public UPath rotate(double theta) { - final UPath result = new UPath(); + final UPath result = new UPath(comment); for (USegment seg : segments) { result.addInternal(seg.rotate(theta)); } @@ -158,6 +167,10 @@ public class UPath extends AbstractShadowable implements Iterable { this.isOpenIconic = isOpenIconic; } + public final String getComment() { + return comment; + } + // public boolean isEmpty() { // return segments.size() == 0; // } diff --git a/src/net/sourceforge/plantuml/ugraphic/URectangle.java b/src/net/sourceforge/plantuml/ugraphic/URectangle.java index 4584edd84..7c1ce100e 100644 --- a/src/net/sourceforge/plantuml/ugraphic/URectangle.java +++ b/src/net/sourceforge/plantuml/ugraphic/URectangle.java @@ -42,27 +42,33 @@ public class URectangle extends AbstractShadowable implements Scalable { private final double height; private final double rx; private final double ry; + private final String comment; public UShape getScaled(double scale) { if (scale == 1) { return this; } - final AbstractShadowable result = new URectangle(width * scale, height * scale, rx * scale, ry * scale); + final AbstractShadowable result = new URectangle(width * scale, height * scale, rx * scale, ry * scale, comment); result.setDeltaShadow(this.getDeltaShadow()); return result; } public URectangle(double width, double height) { - this(width, height, 0, 0); + this(width, height, 0, 0, null); } public URectangle(double width, double height, double rx, double ry) { + this(width, height, rx, ry, null); + } + + public URectangle(double width, double height, double rx, double ry, String comment) { // if (height == 0) { // throw new IllegalArgumentException(); // } if (width == 0) { throw new IllegalArgumentException(); } + this.comment = comment; this.width = width; this.height = height; this.rx = rx; @@ -102,4 +108,8 @@ public class URectangle extends AbstractShadowable implements Scalable { return MinMax.fromMax(width, height); } + public final String getComment() { + return comment; + } + } diff --git a/src/net/sourceforge/plantuml/ugraphic/svg/DriverRectangleSvg.java b/src/net/sourceforge/plantuml/ugraphic/svg/DriverRectangleSvg.java index 680e8df55..28fa2c167 100644 --- a/src/net/sourceforge/plantuml/ugraphic/svg/DriverRectangleSvg.java +++ b/src/net/sourceforge/plantuml/ugraphic/svg/DriverRectangleSvg.java @@ -91,6 +91,6 @@ public class DriverRectangleSvg implements UDriver { return; } } - svg.svgRectangle(x, y, width, height, rx / 2, ry / 2, rect.getDeltaShadow()); + svg.svgRectangle(x, y, width, height, rx / 2, ry / 2, rect.getDeltaShadow(), rect.getComment()); } } diff --git a/src/net/sourceforge/plantuml/ugraphic/svg/DriverTextSvg.java b/src/net/sourceforge/plantuml/ugraphic/svg/DriverTextSvg.java index dd2c75f01..8011f3695 100644 --- a/src/net/sourceforge/plantuml/ugraphic/svg/DriverTextSvg.java +++ b/src/net/sourceforge/plantuml/ugraphic/svg/DriverTextSvg.java @@ -111,7 +111,7 @@ public class DriverTextSvg implements UDriver { svg.setFillColor("url(#" + id + ")"); svg.setStrokeColor(null); final double deltaPatch = 2; - svg.svgRectangle(x, y - height + deltaPatch, width, height, 0, 0, 0); + svg.svgRectangle(x, y - height + deltaPatch, width, height, 0, 0, 0, null); } else { backColor = StringUtils.getAsHtml(mapper.getMappedColor(back)); diff --git a/src/net/sourceforge/plantuml/version/PSystemVersion.java b/src/net/sourceforge/plantuml/version/PSystemVersion.java index a768ae3da..fc35f568b 100644 --- a/src/net/sourceforge/plantuml/version/PSystemVersion.java +++ b/src/net/sourceforge/plantuml/version/PSystemVersion.java @@ -264,7 +264,7 @@ public class PSystemVersion extends AbstractPSystem { } try { - final URL url = new URL("http://plantuml.com/download.html"); + final URL url = new URL("http://plantuml.com/download"); final HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); urlConnection.setUseCaches(false); urlConnection.connect(); @@ -283,12 +283,14 @@ public class PSystemVersion extends AbstractPSystem { private static int extractVersion(BufferedReader in) throws IOException { String s; - final Pattern p = Pattern.compile(".*\\.(\\d{4,5})\\..*"); + final Pattern p = Pattern.compile(".*\\.([1-9]\\d?)\\.(20\\d\\d)\\.([1-9]?\\d)\\..*"); while ((s = in.readLine()) != null) { final Matcher m = p.matcher(s); if (m.matches()) { - final String v = m.group(1); - return Integer.parseInt(v); + final String a = m.group(1); + final String b = m.group(2); + final String c = m.group(3); + return Integer.parseInt(a) * 1000000 + Integer.parseInt(b) * 100 + Integer.parseInt(c); } } return 0; diff --git a/src/net/sourceforge/plantuml/version/Version.java b/src/net/sourceforge/plantuml/version/Version.java index 1f99e4818..2767df1d1 100644 --- a/src/net/sourceforge/plantuml/version/Version.java +++ b/src/net/sourceforge/plantuml/version/Version.java @@ -40,8 +40,10 @@ import java.util.Date; public class Version { + private static final int MAJOR_SEPARATOR = 1000000; + public static int version() { - return 201711; + return 1201712; } public static String versionString() { @@ -52,8 +54,9 @@ public class Version { } private static String dotted(int nb) { - final String s = "" + nb; - return s.substring(0, 4) + "." + s.substring(4); + final String minor = "" + nb % MAJOR_SEPARATOR; + final String major = "" + nb / MAJOR_SEPARATOR; + return major + "." + minor.substring(0, 4) + "." + minor.substring(4); } public static String versionString(int size) { @@ -70,7 +73,7 @@ public class Version { } public static String etag() { - return Integer.toString(version() - 201670, 36) + Integer.toString(beta(), 36); + return Integer.toString(version() % MAJOR_SEPARATOR - 201670, 36) + Integer.toString(beta(), 36); } public static String turningId() { @@ -78,12 +81,12 @@ public class Version { } public static long compileTime() { - return 1492618739962L; + return 1493222796077L; } public static String compileTimeString() { if (beta() != 0) { - return versionString(); + return "Unknown compile time"; } return new Date(Version.compileTime()).toString(); }