1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-12-22 19:09:03 +00:00

version 1.2017.12

This commit is contained in:
Arnaud Roques 2017-04-26 19:48:37 +02:00
parent 5c62d2c083
commit dc9d5327b7
53 changed files with 588 additions and 267 deletions

View File

@ -35,7 +35,7 @@
<groupId>net.sourceforge.plantuml</groupId>
<artifactId>plantuml</artifactId>
<version>2017.12-SNAPSHOT</version>
<version>1.2017.13-SNAPSHOT</version>
<packaging>jar</packaging>
<name>PlantUML</name>

View File

@ -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);

View File

@ -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<String> splitHiddenNewLine(String s) {
return Arrays.asList(s.split("" + hiddenNewLine()));
}
public static String manageNewLine(String string) {
return string.replace(hiddenNewLine(), '\n');
}
public static List<String> getWithNewlines(CharSequence s) {
if (s == null) {
return null;
}
final List<String> result = new ArrayList<String>();
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);
}
}

View File

@ -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),

View File

@ -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); //

View File

@ -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++);
}

View File

@ -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<String> getWithNewlines(CharSequence s) {
if (s == null) {
return null;
}
final List<String> result = new ArrayList<String>();
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<String> 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<String> 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
}

View File

@ -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) {

View File

@ -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;

View File

@ -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;
}
}

View File

@ -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);
}
}

View File

@ -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<Connection> getInnerConnections();
public List<WeldingPoint> getWeldingPoints();
public HorizontalAlignment arrowHorizontalAlignment();
}

View File

@ -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();
}
}

View File

@ -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<Line2D> 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));

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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));
}

View File

@ -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));
}

View File

@ -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());

View File

@ -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));
}

View File

@ -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();

View File

@ -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();
}
}

View File

@ -144,7 +144,7 @@ public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram>
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();
}

View File

@ -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<CharSequence> {
}
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<CharSequence> {
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));
}

View File

@ -173,11 +173,26 @@ public class Bodier {
return true;
}
private List<String> rawBodyWithoutHidden() {
if (hides == null || hides.size() == 0) {
return rawBody;
}
final List<String> result = new ArrayList<String>();
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;
}

View File

@ -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<CharSequence> {
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<CharSequence> {
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() {

View File

@ -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<String> disp = StringUtils.getWithNewlines(att.getDisplay(true));
final List<String> 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<String> disp = StringUtils.getWithNewlines(att.getDisplay(true));
final List<String> disp = BackSlash.getWithNewlines(att.getDisplay(true));
ug.getCharArea().drawStringsLR(disp, 1, y);
y += StringUtils.getHeight(disp);
}

View File

@ -61,7 +61,7 @@ import net.sourceforge.plantuml.graphic.color.Colors;
public class CommandCreateElementFull extends SingleLineCommand2<DescriptionDiagram> {
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<DescriptionDiag
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();
}

View File

@ -65,17 +65,17 @@ import net.sourceforge.plantuml.version.PSystemVersion;
public class PSystemDonors extends AbstractPSystem {
public static final String DONORS = "UDfbL4jksp0GtSyfk1RIGoXsxDI_17QQ0jcDfR75c29TKd8ghOAUeK3NlKABB8eMsVG2oeqwSYkJIWaO"
+ "CCNXp7ipxp5MqRz55gwf82jYNHWjCO4RYlmoESoCtre7SNSLrp2s_eWgMD4QNI5HYuN9DCGwDLQC3HKr"
+ "CCNXp7lptZ1MqRz55gwf82jYNHWjCO4RYlmoESoCtre7SNSLrp2s_eWgMD4QNI5HYuN9DCGwDLQC3HKr"
+ "jNyt6uxemb7338D2ke2Xx3PIGUnJcmEiIW-XWh6C-aiRc7GeImUhWlOPQJ4mPi_yXbqTSZ3DNrqr5WP6"
+ "IIsMfdG4a_BLUNHlc4YtsKkO1wWn3xTSAbRq4NNAxHnaahDkqLRCT7cYhRUm2D4NDLmfUU0BGvdi6Fdf"
+ "H6guSAVKEW0HqG66TIuBMuaPPYP5cBHDlykGqmTn4Ia_BbwxYjkaiU0uniUu9d_1qwx7IgUyjGdtP8Hh"
+ "M-tCWzj9JgJusfKjP0sNFZerC9T9HagSerHLo43L8HZdO4Aetqmm-L2I4yDoRP5dgJpVMtDVK9A9gKM7"
+ "7jAMMAB1n1vQPN68c9g338LobCexJrWYB0FnjYL2dj4ztzu7iZAxjZFdng96jJyJTrIWsJjOCa6qgPZA"
+ "ThGmKiQs_Px__gNKSUXU42eG9yjfTfAJnQxRxTIpFYC7rzZ9OobxW6CbnGenPUlOBOdtfBTapyGyldcx"
+ "Yhsq8wDXJ3tBXCnrmXB9nIsZ7h9efpxIKZjPDikC22uEeV8F20kVXF8EP1JG69UITL7c94QcfCBtDt4m"
+ "2YTpvEBLeEkmRGnt8RUiePNClGKP43jvqtOQsTK1w4WfQ3utJq7wvgdv0OEiP-sAZLUkZm-1rUo5IzE3"
+ "CoQpsLYgn4BcFBW9_l-gB763IimhfzWZpTVcwUMn-TwM4isNvhdvsJo_VEBV8t_w1XUMQZ55bREpBiDP"
+ "jt8brkivgVPG1sFZAZ9u5QE87ya-2nRO7yKAYtS0";
+ "H6guSAVKEW0HqG66TIuBMuaPPYP5cBHDlykGqmTn4Ial5wzTnMtIM70SusDSax_WQTTZfLFUseHxCiAr"
+ "hNRcmUqa9r9yxSeMiePB7vqQcCia8oNEKQegPA3g48npC27KRoQOV2Z9YM6vjiXQAi_trjmNb6HYQj6X"
+ "XxGbjcYWs4FhB0uHKtEGeL6ELddd2Kk4PM3UjaJ8Cxhds_l0LcRNTkRSMDIezcVYZWeqUmTB9eWs5LFP"
+ "IWiZPMpRx_dlNqeTHVU6K84vsKwpavqiTjrkLS_wZ1nSOsUFfUm1ZfKKAyIKHyTkIRmdlILx9kRnpTjL"
+ "xAqT6GrZwerCo5mdR95St3Bg8PjswYCjjShoiCo8uE8GEl-0iF19AEz0HW6DSIdP5sLEOcHAAdn_4mUZ"
+ "K9aZ5-y6NOTjOxWBkMKFhMJkHv01yIHlsauZJtK0Eb8Aci_DKv2-UMf-m23hZNR5WrUkZm-1rJmBbwO7"
+ "Pqncix5KYONCMRW9_l-gB763IimhftX6cg_DqyjZyxqj9PelpNFpitb--SI_H_xq3IuirMAAAkV9kWor"
+ "RkrAxDTpKksX3cJZAZ9u5QE87ya-2pROBRr-bA9ImH_rNe_d";
@Override
final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed)

View File

@ -231,9 +231,8 @@ public class QuoteUtils {
"Vtabenapr oevatf punbf, abg xabjyrqtr.", "Yrneavat vf nyjnlf n cnvashy cebprff.",
"V'z fbeel, ner lbh sebz gur cnfg ?", "Unir lbh gevrq gheavat vg bss naq ba ntnva ?",
"Vs lbh qba'g xabj jurer lbh ner tbvat nal ebnq pna gnxr lbh gurer",
"Ortva ng gur ortvaavat, naq tb ba gvyy lbh pbzr gb gur raq: gura fgbc"
);
"Ortva ng gur ortvaavat, naq tb ba gvyy lbh pbzr gb gur raq: gura fgbc",
"Xrrc pnyz naq cerff Pgey-Nyg-Qry");
private QuoteUtils() {
}

View File

@ -62,6 +62,9 @@ public class SkinParameter {
public static final SkinParameter QUEUE = new SkinParameter("QUEUE", ColorParam.queueBackground,
ColorParam.queueBorder, FontParam.QUEUE, FontParam.QUEUE_STEREOTYPE);
public static final SkinParameter PIPE = new SkinParameter("PIPE", ColorParam.pipeBackground,
ColorParam.pipeBorder, FontParam.PIPE, FontParam.PIPE_STEREOTYPE);
public static final SkinParameter CLOUD = new SkinParameter("CLOUD", ColorParam.cloudBackground,
ColorParam.cloudBorder, FontParam.CLOUD, FontParam.CLOUD_STEREOTYPE);

View File

@ -74,6 +74,7 @@ public abstract class USymbol {
public final static USymbol CONTROL = record("CONTROL", SkinParameter.CONTROL, new USymbolControl(2));
public final static USymbol INTERFACE = record("INTERFACE", SkinParameter.INTERFACE, new USymbolInterface());
public final static USymbol QUEUE = record("QUEUE", SkinParameter.QUEUE, new USymbolQueue());
public final static USymbol PIPE = record("PIPE", SkinParameter.PIPE, new USymbolPipe());
public final static USymbol TOGETHER = record("TOGETHER", SkinParameter.QUEUE, new USymbolTogether());
abstract public SkinParameter getSkinParameter();
@ -181,7 +182,7 @@ public abstract class USymbol {
};
}
public static USymbol getFoo1(String symbol, boolean useUml2ForComponent) {
public static USymbol getFromString(String symbol, boolean useUml2ForComponent) {
USymbol usymbol = null;
if (symbol.equalsIgnoreCase("artifact")) {
usymbol = USymbol.ARTIFACT;
@ -203,6 +204,8 @@ public abstract class USymbol {
usymbol = USymbol.DATABASE;
} else if (symbol.equalsIgnoreCase("queue")) {
usymbol = USymbol.QUEUE;
} else if (symbol.equalsIgnoreCase("pipe")) {
usymbol = USymbol.PIPE;
} else if (symbol.equalsIgnoreCase("storage")) {
usymbol = USymbol.STORAGE;
} else if (symbol.equalsIgnoreCase("agent")) {

View File

@ -0,0 +1,181 @@
/* ========================================================================
* 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.graphic;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.creole.Stencil;
import net.sourceforge.plantuml.ugraphic.AbstractUGraphicHorizontalLine;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UHorizontalLine;
import net.sourceforge.plantuml.ugraphic.UPath;
import net.sourceforge.plantuml.ugraphic.UTranslate;
class USymbolPipe extends USymbol {
@Override
public SkinParameter getSkinParameter() {
return SkinParameter.PIPE;
}
private final double dx = 5;
private void drawQueue(UGraphic ug, double width, double height, boolean shadowing) {
final UPath shape = new UPath();
if (shadowing) {
shape.setDeltaShadow(3.0);
}
shape.moveTo(dx, 0);
shape.lineTo(width - dx, 0);
shape.cubicTo(width, 0, width, height / 2, width, height / 2);
shape.cubicTo(width, height / 2, width, height, width - dx, height);
shape.lineTo(dx, height);
shape.cubicTo(0, height, 0, height / 2, 0, height / 2);
shape.cubicTo(0, height / 2, 0, 0, dx, 0);
ug.draw(shape);
final UPath closing = getClosingPath(width, height);
ug.apply(new UChangeBackColor(null)).draw(closing);
}
private UPath getClosingPath(double width, double height) {
final UPath closing = new UPath();
closing.moveTo(width - dx, 0);
closing.cubicTo(width - dx * 2, 0, width - dx * 2, height / 2, width - dx * 2, height / 2);
closing.cubicTo(width - dx * 2, height, width - dx, height, width - dx, height);
return closing;
}
class MyUGraphicQueue extends AbstractUGraphicHorizontalLine implements Stencil {
private final double x1;
private final double x2;
private final double fullHeight;
@Override
protected AbstractUGraphicHorizontalLine copy(UGraphic ug) {
return new MyUGraphicQueue(ug, x1, x2, fullHeight);
}
public MyUGraphicQueue(UGraphic ug, double x1, double x2, double fullHeight) {
super(ug);
this.x1 = x1;
this.x2 = x2;
this.fullHeight = fullHeight;
}
@Override
protected void drawHline(UGraphic ug, UHorizontalLine line, UTranslate translate) {
line.drawLineInternal(ug, this, translate.getDy(), line.getStroke());
}
public double getStartingX(StringBounder stringBounder, double y) {
return 0;
}
public double getEndingX(StringBounder stringBounder, double y) {
final double factor2;
final double halfHeight = fullHeight / 2;
if (y <= halfHeight) {
factor2 = 1 - (y / halfHeight);
} else {
factor2 = (y - halfHeight) / halfHeight;
}
return (x2 - x1) * factor2 + x1;
}
}
private Margin getMargin() {
return new Margin(5, 15, 5, 5);
}
public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype,
final SymbolContext symbolContext) {
return new AbstractTextBlock() {
public void drawU(UGraphic ug) {
final Dimension2D dim = calculateDimension(ug.getStringBounder());
ug = symbolContext.apply(ug);
drawQueue(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing());
final Margin margin = getMargin();
final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, HorizontalAlignment.CENTER);
final UGraphic ug2 = new MyUGraphicQueue(ug, dim.getWidth() - 2 * dx, dim.getWidth() - dx,
dim.getHeight());
tb.drawU(ug2.apply(new UTranslate(margin.getX1(), margin.getY1())));
}
public Dimension2D calculateDimension(StringBounder stringBounder) {
final Dimension2D dimLabel = label.calculateDimension(stringBounder);
final Dimension2D dimStereo = stereotype.calculateDimension(stringBounder);
return getMargin().addDimension(Dimension2DDouble.mergeTB(dimStereo, dimLabel));
}
};
}
public TextBlock asBig(final TextBlock title, final TextBlock stereotype, final double width, final double height,
final SymbolContext symbolContext) {
throw new UnsupportedOperationException();
// return new TextBlock() {
//
// public void drawU(UGraphic ug) {
// final Dimension2D dim = calculateDimension(ug.getStringBounder());
// ug = symbolContext.apply(ug);
// drawDatabase(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing());
// final Dimension2D dimStereo = stereotype.calculateDimension(ug.getStringBounder());
// final double posStereo = (width - dimStereo.getWidth()) / 2;
// stereotype.drawU(ug.apply(new UTranslate(posStereo, 0)));
//
// final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder());
// final double posTitle = (width - dimTitle.getWidth()) / 2;
// title.drawU(ug.apply(new UTranslate(posTitle, 21)));
// }
//
// public Dimension2D calculateDimension(StringBounder stringBounder) {
// return new Dimension2DDouble(width, height);
// }
// };
}
public boolean manageHorizontalLine() {
return true;
}
}

View File

@ -38,12 +38,13 @@ package net.sourceforge.plantuml.graphic;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.creole.Stencil;
import net.sourceforge.plantuml.ugraphic.AbstractUGraphicHorizontalLine;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UHorizontalLine;
import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
import net.sourceforge.plantuml.ugraphic.UPath;
import net.sourceforge.plantuml.ugraphic.URectangle;
import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.UTranslate;
class USymbolQueue extends USymbol {
@ -53,78 +54,25 @@ class USymbolQueue extends USymbol {
return SkinParameter.QUEUE;
}
private final double dx = 5;
private void drawQueue(UGraphic ug, double width, double height, boolean shadowing) {
final UPath shape = new UPath();
private void drawQueue(UGraphic ug, double width, double height, boolean shadowing, double roundCorner) {
final double border = 15;
final URectangle rect = new URectangle(width - 2 * border, height, roundCorner, roundCorner);
if (shadowing) {
shape.setDeltaShadow(3.0);
}
shape.moveTo(dx, 0);
shape.lineTo(width - dx, 0);
shape.cubicTo(width, 0, width, height / 2, width, height / 2);
shape.cubicTo(width, height / 2, width, height, width - dx, height);
shape.lineTo(dx, height);
shape.cubicTo(0, height, 0, height / 2, 0, height / 2);
shape.cubicTo(0, height / 2, 0, 0, dx, 0);
ug.draw(shape);
final UPath closing = getClosingPath(width, height);
ug.apply(new UChangeBackColor(null)).draw(closing);
}
private UPath getClosingPath(double width, double height) {
final UPath closing = new UPath();
closing.moveTo(width - dx, 0);
closing.cubicTo(width - dx * 2, 0, width - dx * 2, height / 2, width - dx * 2, height / 2);
closing.cubicTo(width - dx * 2, height, width - dx, height, width - dx, height);
return closing;
}
class MyUGraphicQueue extends AbstractUGraphicHorizontalLine implements Stencil {
private final double x1;
private final double x2;
private final double fullHeight;
@Override
protected AbstractUGraphicHorizontalLine copy(UGraphic ug) {
return new MyUGraphicQueue(ug, x1, x2, fullHeight);
}
public MyUGraphicQueue(UGraphic ug, double x1, double x2, double fullHeight) {
super(ug);
this.x1 = x1;
this.x2 = x2;
this.fullHeight = fullHeight;
}
@Override
protected void drawHline(UGraphic ug, UHorizontalLine line, UTranslate translate) {
line.drawLineInternal(ug, this, translate.getDy(), line.getStroke());
}
public double getStartingX(StringBounder stringBounder, double y) {
return 0;
}
public double getEndingX(StringBounder stringBounder, double y) {
final double factor2;
final double halfHeight = fullHeight / 2;
if (y <= halfHeight) {
factor2 = 1 - (y / halfHeight);
} else {
factor2 = (y - halfHeight) / halfHeight;
}
return (x2 - x1) * factor2 + x1;
rect.setDeltaShadow(3.0);
}
ug.apply(new UChangeColor(null)).apply(new UTranslate(border, 0)).draw(rect);
final UPath path = new UPath();
path.moveTo(0, 0);
path.lineTo(border, 0);
path.lineTo(border, height);
path.lineTo(width - border, height);
path.lineTo(width - border, 0);
path.lineTo(width, 0);
ug.apply(new UChangeBackColor(null)).draw(path);
}
private Margin getMargin() {
return new Margin(5, 15, 5, 5);
return new Margin(25, 25, 10, 10);
}
public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype,
@ -133,13 +81,13 @@ class USymbolQueue extends USymbol {
public void drawU(UGraphic ug) {
final Dimension2D dim = calculateDimension(ug.getStringBounder());
ug = UGraphicStencil.create(ug, getRectangleStencil(dim), new UStroke());
ug = symbolContext.apply(ug);
drawQueue(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing());
drawQueue(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(),
symbolContext.getRoundCorner());
final Margin margin = getMargin();
final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, HorizontalAlignment.CENTER);
final UGraphic ug2 = new MyUGraphicQueue(ug, dim.getWidth() - 2 * dx, dim.getWidth() - dx,
dim.getHeight());
tb.drawU(ug2.apply(new UTranslate(margin.getX1(), margin.getY1())));
tb.drawU(ug.apply(new UTranslate(margin.getX1(), margin.getY1())));
}
public Dimension2D calculateDimension(StringBounder stringBounder) {
@ -153,27 +101,9 @@ class USymbolQueue extends USymbol {
public TextBlock asBig(final TextBlock title, final TextBlock stereotype, final double width, final double height,
final SymbolContext symbolContext) {
throw new UnsupportedOperationException();
// return new TextBlock() {
//
// public void drawU(UGraphic ug) {
// final Dimension2D dim = calculateDimension(ug.getStringBounder());
// ug = symbolContext.apply(ug);
// drawDatabase(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing());
// final Dimension2D dimStereo = stereotype.calculateDimension(ug.getStringBounder());
// final double posStereo = (width - dimStereo.getWidth()) / 2;
// stereotype.drawU(ug.apply(new UTranslate(posStereo, 0)));
//
// final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder());
// final double posTitle = (width - dimTitle.getWidth()) / 2;
// title.drawU(ug.apply(new UTranslate(posTitle, 21)));
// }
//
// public Dimension2D calculateDimension(StringBounder stringBounder) {
// return new Dimension2DDouble(width, height);
// }
// };
}
@Override
public boolean manageHorizontalLine() {
return true;
}

View File

@ -93,6 +93,7 @@ public class DotPath implements UShape, Moveable {
}
private final List<CubicCurve2D.Double> beziers = new ArrayList<CubicCurve2D.Double>();
private String comment;
public DotPath() {
this(new ArrayList<CubicCurve2D.Double>());
@ -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;
}
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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));

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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");

View File

@ -42,11 +42,20 @@ import java.util.List;
public class UPath extends AbstractShadowable implements Iterable<USegment> {
private final String comment;
private final List<USegment> segments = new ArrayList<USegment>();
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<USegment> {
}
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<USegment> {
}
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<USegment> {
this.isOpenIconic = isOpenIconic;
}
public final String getComment() {
return comment;
}
// public boolean isEmpty() {
// return segments.size() == 0;
// }

View File

@ -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;
}
}

View File

@ -91,6 +91,6 @@ public class DriverRectangleSvg implements UDriver<SvgGraphics> {
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());
}
}

View File

@ -111,7 +111,7 @@ public class DriverTextSvg implements UDriver<SvgGraphics> {
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));

View File

@ -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;

View File

@ -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();
}