diff --git a/pom.xml b/pom.xml
index 93c8a1b1a..8edccf078 100644
--- a/pom.xml
+++ b/pom.xml
@@ -36,7 +36,7 @@
net.sourceforge.plantumlplantuml
- 8043-SNAPSHOT
+ 8046-SNAPSHOTjarPlantUML
diff --git a/src/net/sourceforge/plantuml/FileFormat.java b/src/net/sourceforge/plantuml/FileFormat.java
index 48f4f1667..6b15cbfe6 100644
--- a/src/net/sourceforge/plantuml/FileFormat.java
+++ b/src/net/sourceforge/plantuml/FileFormat.java
@@ -43,7 +43,7 @@ import java.io.File;
*/
public enum FileFormat {
PNG, SVG, EPS, EPS_TEXT, ATXT, UTXT, XMI_STANDARD, XMI_STAR, XMI_ARGO, SCXML,
- PDF, MJPEG, ANIMATED_GIF, HTML, HTML5, VDX, LATEX, LATEX_NO_PREAMBLE, BASE64;
+ PDF, MJPEG, ANIMATED_GIF, HTML, HTML5, VDX, LATEX, LATEX_NO_PREAMBLE, BASE64, BRAILLE_PNG;
/**
* Returns the file format to be used for that format.
@@ -63,6 +63,9 @@ public enum FileFormat {
if (this == ANIMATED_GIF) {
return ".gif";
}
+ if (this == BRAILLE_PNG) {
+ return ".braille.png";
+ }
if (this == EPS_TEXT) {
return EPS.getFileSuffix();
}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionFork.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionFork.java
index c67573888..b83a8b2df 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/InstructionFork.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionFork.java
@@ -122,7 +122,8 @@ public class InstructionFork extends WithNote implements Instruction {
}
public Swimlane getSwimlaneOut() {
- return getLastList().getSwimlaneOut();
+ return forks.get(0).getSwimlaneOut();
+ //return getLastList().getSwimlaneOut();
}
public void manageOutRendering(LinkRendering nextLinkRenderer, boolean endFork) {
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionWhile.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionWhile.java
index 06a86d648..5f65411dd 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/InstructionWhile.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionWhile.java
@@ -147,11 +147,11 @@ public class InstructionWhile extends WithNote implements Instruction, Instructi
}
public Swimlane getSwimlaneIn() {
- return parent.getSwimlaneOut();
+ return parent.getSwimlaneIn();
}
public Swimlane getSwimlaneOut() {
- return getSwimlaneIn();
+ return parent.getSwimlaneOut();
}
public Instruction getLast() {
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Arrows.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Arrows.java
index 88e06d536..05c7b169d 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Arrows.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Arrows.java
@@ -42,7 +42,7 @@ public class Arrows {
final static private double delta2 = 4;
public static UPolygon asToUp() {
- final UPolygon polygon = new UPolygon();
+ final UPolygon polygon = new UPolygon("asToUp");
polygon.addPoint(-delta2, delta1);
polygon.addPoint(0, 0);
polygon.addPoint(delta2, delta1);
@@ -51,7 +51,7 @@ public class Arrows {
}
public static UPolygon asToDown() {
- final UPolygon polygon = new UPolygon();
+ final UPolygon polygon = new UPolygon("asToDown");
polygon.addPoint(-delta2, -delta1);
polygon.addPoint(0, 0);
polygon.addPoint(delta2, -delta1);
@@ -60,7 +60,7 @@ public class Arrows {
}
public static UPolygon asToRight() {
- final UPolygon polygon = new UPolygon();
+ final UPolygon polygon = new UPolygon("asToRight");
polygon.addPoint(-delta1, -delta2);
polygon.addPoint(0, 0);
polygon.addPoint(-delta1, delta2);
@@ -69,7 +69,7 @@ public class Arrows {
}
public static UPolygon asToLeft() {
- final UPolygon polygon = new UPolygon();
+ final UPolygon polygon = new UPolygon("asToLeft");
polygon.addPoint(delta1, -delta2);
polygon.addPoint(0, 0);
polygon.addPoint(delta1, delta2);
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Snake.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Snake.java
index deaee0e23..dfaca2017 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Snake.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Snake.java
@@ -135,8 +135,11 @@ public class Snake implements UShape {
final int colorArrowSeparationSpace = color.getColorArrowSeparationSpace();
final double move = 2 + colorArrowSeparationSpace;
final WormMutation mutation = WormMutation.create(worm, move);
- ug = ug.apply(mutation.getGlobalTranslate(colors.size()));
- Worm current = worm;
+ final double globalMove = -1.0 * (colors.size() - 1) / 2.0;
+ Worm current = worm.moveFirstPoint(mutation.getFirst().multiplyBy(globalMove));
+ if (mutation.size() > 2) {
+ current = current.moveLastPoint(mutation.getLast().multiplyBy(globalMove));
+ }
for (int i = 0; i < colors.size(); i++) {
double stroke = 1.5;
if (colorArrowSeparationSpace == 0) {
@@ -149,34 +152,9 @@ public class Snake implements UShape {
drawInternalLabel(ug.apply(textTranslate));
}
- // private void drawRainbowOld(UGraphic ug) {
- // final HtmlColorRainbow rainbow = (HtmlColorRainbow) color;
- // final List colors = rainbow.getColors();
- // final int colorArrowSeparationSpace = rainbow.getColorArrowSeparationSpace();
- // final double move = 2 + colorArrowSeparationSpace;
- // ug = ug.apply(new UTranslate(-move * (colors.size() - 1) / 2.0, 0));
- // double dx = -move;
- // for (int i = 0; i < colors.size(); i++) {
- // dx += move;
- // double stroke = 1.5;
- // if (colorArrowSeparationSpace == 0) {
- // stroke = i == colors.size() - 1 ? 2.0 : 3.0;
- // }
- // worm.drawInternalOneColor(ug.apply(new UTranslate(dx, 0)), colors.get(i), stroke, emphasizeDirection,
- // endDecoration);
- // }
- // drawInternalLabel(ug.apply(new UTranslate(dx, 0)));
- // }
-
private void drawInternalLabel(UGraphic ug) {
if (textBlock != null) {
final Point2D position = getTextBlockPosition(ug.getStringBounder());
- // final double max = getMaxX(ug.getStringBounder());
- // ug.apply(new UChangeBackColor(HtmlColorUtils.LIGHT_GRAY))
- // .apply(new UTranslate(position.getX(), position.getY()))
- // .draw(new URectangle(textBlock.calculateDimension(ug.getStringBounder())));
- // ug.apply(new UChangeBackColor(HtmlColorUtils.RED)).apply(new UTranslate(0, position.getY() + 10))
- // .draw(new URectangle(max, 10));
textBlock.drawU(ug.apply(new UTranslate(position)));
}
}
@@ -240,7 +218,7 @@ public class Snake implements UShape {
// return null;
// }
if (same(this.getLast(), other.getFirst())) {
- final UPolygon oneOf = endDecoration == null ? other.endDecoration : endDecoration;
+ final UPolygon oneOf = other.endDecoration == null ? endDecoration : other.endDecoration;
final Snake result = new Snake(color, oneOf);
result.emphasizeDirection = emphasizeDirection == null ? other.emphasizeDirection : emphasizeDirection;
result.worm.addAll(this.worm.merge(other.worm));
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Worm.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Worm.java
index dacafb450..2cbf6f1bc 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Worm.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Worm.java
@@ -113,6 +113,64 @@ public class Worm implements Iterable {
return result;
}
+ public Worm moveFirstPoint(UTranslate move) {
+ final double dx = move.getDx();
+ final double dy = move.getDy();
+ if (dx != 0 && dy != 0) {
+ throw new IllegalArgumentException("move=" + move);
+ }
+ final Worm result = new Worm();
+ double x0 = this.points.get(0).getX();
+ double y0 = this.points.get(0).getY();
+ double x1 = this.points.get(1).getX();
+ double y1 = this.points.get(1).getY();
+
+ if (dx != 0 && x0 == x1) {
+ x1 += dx;
+ }
+ if (dy != 0 && y0 == y1) {
+ y1 += dy;
+ }
+ x0 += dx;
+ y0 += dy;
+
+ result.addPoint(x0, y0);
+ result.addPoint(x1, y1);
+ for (int i = 2; i < this.points.size(); i++) {
+ result.addPoint(this.points.get(i));
+ }
+ return result;
+ }
+
+ public Worm moveLastPoint(UTranslate move) {
+ final double dx = move.getDx();
+ final double dy = move.getDy();
+ if (dx != 0 && dy != 0) {
+ throw new IllegalArgumentException("move=" + move);
+ }
+ final Worm result = new Worm();
+ double x8 = this.points.get(this.points.size() - 2).getX();
+ double y8 = this.points.get(this.points.size() - 2).getY();
+ double x9 = this.points.get(this.points.size() - 1).getX();
+ double y9 = this.points.get(this.points.size() - 1).getY();
+
+ if (dx != 0 && x8 == x9) {
+ x8 += dx;
+ }
+ if (dy != 0 && y8 == y9) {
+ y8 += dy;
+ }
+ x9 += dx;
+ y9 += dy;
+
+ for (int i = 0; i < this.points.size() - 2; i++) {
+ result.addPoint(this.points.get(i));
+ }
+ result.addPoint(x8, y8);
+ result.addPoint(x9, y9);
+ return result;
+ }
+
@Override
public String toString() {
final StringBuilder result = new StringBuilder();
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/WormMutation.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/WormMutation.java
index b63665983..12ded0200 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/WormMutation.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/WormMutation.java
@@ -36,7 +36,6 @@ package net.sourceforge.plantuml.activitydiagram3.ftile;
import java.util.ArrayList;
import java.util.List;
-import net.sourceforge.plantuml.ugraphic.UChange;
import net.sourceforge.plantuml.ugraphic.UTranslate;
public class WormMutation {
@@ -83,12 +82,21 @@ public class WormMutation {
return result;
}
- private UTranslate getLast() {
+ public UTranslate getLast() {
return translations.get(translations.size() - 1);
}
+ public UTranslate getFirst() {
+ return translations.get(0);
+ }
+
+ public int size() {
+ return translations.size();
+ }
+
private static WormMutation createFromSimpleSignature(final String signature, final double delta) {
final WormMutation result = new WormMutation();
+ // System.err.println("signature=" + signature);
if (signature.equals("D") || signature.equals("U")) {
final UTranslate translate = new UTranslate(delta, 0);
result.translations.add(translate);
@@ -177,20 +185,6 @@ public class WormMutation {
return new UTranslate(result.getExtreme() * (size - 1), 0);
}
- public UChange getGlobalTranslate(int size) {
- final MinMax result = new MinMax();
- if (translations.get(0).getDy() == 0) {
- for (UTranslate tr : translations) {
- result.append(tr.getDx());
- }
- return new UTranslate(-result.getExtreme() * (size - 1) / 2.0, 0);
- }
- for (UTranslate tr : translations) {
- result.append(tr.getDy());
- }
- return new UTranslate(0, -result.getExtreme() * (size - 1) / 2.0);
- }
-
public Worm mute(Worm original) {
final Worm result = new Worm();
for (int i = 0; i < original.size(); i++) {
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FloatingNote.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FloatingNote.java
index a1574ed4f..fb05c8ec2 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FloatingNote.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FloatingNote.java
@@ -69,8 +69,8 @@ public class FloatingNote extends AbstractTextBlock implements Stencil, TextBloc
final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.NOTE, null);
- final Sheet sheet = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL)
- .createSheet(note);
+ final Sheet sheet = new CreoleParser(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT),
+ skinParam, CreoleMode.FULL).createSheet(note);
final SheetBlock2 sheetBlock2 = new SheetBlock2(new SheetBlock1(sheet, 0, skinParam.getPadding()), this,
new UStroke(1));
this.opale = new Opale(borderColor, noteBackgroundColor, sheetBlock2, skinParam.shadowing(), false);
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateFork.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateFork.java
index 725407c65..5f40cdf6c 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateFork.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateFork.java
@@ -94,8 +94,8 @@ public class FtileFactoryDelegatorCreateFork extends FtileFactoryDelegator {
double x = 0;
for (Ftile tmp : list) {
final Dimension2D dim = tmp.calculateDimension(getStringBounder());
- conns.add(new ConnectionIn(black, tmp, x, arrowColor));
- conns.add(new ConnectionOut(tmp, black, x, arrowColor, height1));
+ conns.add(new ConnectionIn(black, tmp, x, tmp.getInLinkRendering().getRainbow(arrowColor)));
+ conns.add(new ConnectionOut(tmp, black, x, tmp.getOutLinkRendering().getRainbow(arrowColor), height1));
x += dim.getWidth();
}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateSplit.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateSplit.java
index 263352368..7003e04aa 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateSplit.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateSplit.java
@@ -138,10 +138,12 @@ public class FtileFactoryDelegatorCreateSplit extends FtileFactoryDelegator {
boolean hasOut = false;
for (Ftile tmp : list) {
final Dimension2D dim = tmp.calculateDimension(getStringBounder());
- conns.add(new ConnectionIn(tmp, x, arrowColor, getTextBlock(tmp.getInLinkRendering())));
+ conns.add(new ConnectionIn(tmp, x, tmp.getInLinkRendering().getRainbow(arrowColor), getTextBlock(tmp
+ .getInLinkRendering())));
final boolean hasOutTmp = tmp.calculateDimension(getStringBounder()).hasPointOut();
if (hasOutTmp) {
- conns.add(new ConnectionOut(tmp, x, arrowColor, height1, getTextBlock(tmp.getOutLinkRendering())));
+ conns.add(new ConnectionOut(tmp, x, tmp.getOutLinkRendering().getRainbow(arrowColor), height1,
+ getTextBlock(tmp.getOutLinkRendering())));
hasOut = true;
}
x += dim.getWidth();
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfAndStop.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfAndStop.java
index 6e7d089e5..673328d0d 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfAndStop.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfAndStop.java
@@ -126,10 +126,11 @@ class FtileIfAndStop extends AbstractFtile {
// final TextBlock tb2 = Display.create(branch2.getLabelPositive(), fcArrow, HorizontalAlignment.LEFT,
// ftileFactory);
- final Sheet sheet = new CreoleParser(fcTest, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL)
- .createSheet(labelTest);
+ final Sheet sheet = new CreoleParser(fcTest, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT),
+ skinParam, CreoleMode.FULL).createSheet(labelTest);
final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, 0, skinParam.getPadding());
- final TextBlock tbTest = new SheetBlock2(sheetBlock1, Diamond.asStencil(sheetBlock1), tileNonStop.getThickness());
+ final TextBlock tbTest = new SheetBlock2(sheetBlock1, Diamond.asStencil(sheetBlock1),
+ tileNonStop.getThickness());
final Ftile diamond1;
if (conditionStyle == ConditionStyle.INSIDE) {
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileNoteAlone.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileNoteAlone.java
index 2ccc6d41e..a53798b0d 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileNoteAlone.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileNoteAlone.java
@@ -92,8 +92,8 @@ public class FtileNoteAlone extends AbstractFtile implements Stencil {
final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.NOTE, null);
- final Sheet sheet = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL)
- .createSheet(note);
+ final Sheet sheet = new CreoleParser(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT),
+ skinParam, CreoleMode.FULL).createSheet(note);
final TextBlock text = new SheetBlock2(new SheetBlock1(sheet, 0, skinParam.getPadding()), this, new UStroke(1));
opale = new Opale(borderColor, noteBackgroundColor, text, skinParam.shadowing(), false);
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java
index 9aa130d8a..0ece38233 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java
@@ -106,7 +106,8 @@ class FtileRepeat extends AbstractFtile {
final FontConfiguration fontConfiguration1 = conditionStyle == ConditionStyle.INSIDE ? fcDiamond : fcArrow;
final TextBlock tbTest = (Display.isNull(test) || test.isWhite()) ? TextBlockUtils.empty(0, 0) : test.create(
- fontConfiguration1, HorizontalAlignment.LEFT, spriteContainer);
+ fontConfiguration1, repeat.skinParam().getDefaultTextAlignment(HorizontalAlignment.LEFT),
+ spriteContainer);
final TextBlock yesTb = yes.create(fcArrow, HorizontalAlignment.LEFT, spriteContainer);
final TextBlock outTb = out.create(fcArrow, HorizontalAlignment.LEFT, spriteContainer);
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java
index 4d9cab883..85ca3f26f 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java
@@ -116,7 +116,8 @@ class FtileWhile extends AbstractFtile {
ConditionStyle conditionStyle, FontConfiguration fcTest) {
final TextBlock yesTb = yes.create(fontArrow, HorizontalAlignment.LEFT, ftileFactory.skinParam());
- final TextBlock testTb = test.create(fcTest, HorizontalAlignment.LEFT, ftileFactory.skinParam());
+ final TextBlock testTb = test.create(fcTest,
+ whileBlock.skinParam().getDefaultTextAlignment(HorizontalAlignment.LEFT), ftileFactory.skinParam());
final TextBlock out = out2.create(fontArrow, HorizontalAlignment.LEFT, ftileFactory.skinParam());
final Ftile diamond1;
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNoteOpale.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNoteOpale.java
index dc7e24dfb..cba9d0cf0 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNoteOpale.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNoteOpale.java
@@ -116,8 +116,8 @@ public class FtileWithNoteOpale extends AbstractFtile implements Stencil {
final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.NOTE, null);
- final Sheet sheet = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL).createSheet(note
- .getDisplay());
+ final Sheet sheet = new CreoleParser(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT),
+ skinParam, CreoleMode.FULL).createSheet(note.getDisplay());
final TextBlock text = new SheetBlock2(new SheetBlock1(sheet, 0, skinParam.getPadding()), this, new UStroke(1));
opale = new Opale(borderColor, noteBackgroundColor, text, skinParam.shadowing(), withLink);
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNotes.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNotes.java
index f440f8215..8f5c65883 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNotes.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNotes.java
@@ -99,8 +99,8 @@ public class FtileWithNotes extends AbstractFtile /* implements Stencil */{
final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.NOTE, null);
for (PositionedNote note : notes) {
- final Sheet sheet = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL)
- .createSheet(note.getDisplay());
+ final Sheet sheet = new CreoleParser(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT),
+ skinParam, CreoleMode.FULL).createSheet(note.getDisplay());
final SheetBlock1 sheet1 = new SheetBlock1(sheet, 0, skinParam.getPadding());
final TextBlock opale = TextBlockUtils.withMargin(new Opale(borderColor, noteBackgroundColor, sheet1,
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/ConditionalBuilder.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/ConditionalBuilder.java
index a970ba740..5c9b211ea 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/ConditionalBuilder.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/ConditionalBuilder.java
@@ -153,8 +153,8 @@ public class ConditionalBuilder {
final TextBlock tb1 = getLabelBranch1();
final TextBlock tb2 = getLabelBranch2();
- final Sheet sheet = new CreoleParser(fontTest, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL)
- .createSheet(labelTest);
+ final Sheet sheet = new CreoleParser(fontTest, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT),
+ skinParam, CreoleMode.FULL).createSheet(labelTest);
final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, 0, skinParam.getPadding());
final TextBlock tbTest = new SheetBlock2(sheetBlock1, Diamond.asStencil(sheetBlock1), tile1.getThickness());
@@ -172,14 +172,14 @@ public class ConditionalBuilder {
}
private TextBlock getLabelBranch2() {
- final TextBlock tb2 = branch2.getLabelPositive().create(fontArrow, HorizontalAlignment.LEFT, ftileFactory.skinParam(),
- CreoleMode.SIMPLE_LINE);
+ final TextBlock tb2 = branch2.getLabelPositive().create(fontArrow, HorizontalAlignment.LEFT,
+ ftileFactory.skinParam(), CreoleMode.SIMPLE_LINE);
return tb2;
}
private TextBlock getLabelBranch1() {
- final TextBlock tb1 = branch1.getLabelPositive().create(fontArrow, HorizontalAlignment.LEFT, ftileFactory.skinParam(),
- CreoleMode.SIMPLE_LINE);
+ final TextBlock tb1 = branch1.getLabelPositive().create(fontArrow, HorizontalAlignment.LEFT,
+ ftileFactory.skinParam(), CreoleMode.SIMPLE_LINE);
return tb1;
}
diff --git a/src/net/sourceforge/plantuml/braille/BrailleDrawer.java b/src/net/sourceforge/plantuml/braille/BrailleDrawer.java
new file mode 100644
index 000000000..ac1b126a4
--- /dev/null
+++ b/src/net/sourceforge/plantuml/braille/BrailleDrawer.java
@@ -0,0 +1,71 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2017, Arnaud Roques
+ *
+ * Project Info: http://plantuml.com
+ *
+ * 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.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * Original Author: Arnaud Roques
+ *
+ * Revision $Revision: 6170 $
+ *
+ */
+package net.sourceforge.plantuml.braille;
+
+import net.sourceforge.plantuml.graphic.HtmlColorUtils;
+import net.sourceforge.plantuml.graphic.UDrawable;
+import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
+import net.sourceforge.plantuml.ugraphic.UChangeColor;
+import net.sourceforge.plantuml.ugraphic.UEllipse;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class BrailleDrawer implements UDrawable {
+
+ private final BrailleGrid grid;
+ private final double step = 9;
+ private final double spotSize = 5;
+
+ public BrailleDrawer(BrailleGrid grid) {
+ this.grid = grid;
+ }
+
+ public void drawU(UGraphic ug) {
+ ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK)).apply(new UChangeBackColor(HtmlColorUtils.BLACK));
+ for (int x = grid.getMinX(); x <= grid.getMaxX(); x++) {
+ for (int y = grid.getMinY(); y <= grid.getMaxY(); y++) {
+ if (grid.getState(x, y)) {
+ drawCircle(ug, x, y);
+ }
+ }
+ }
+ }
+
+ private void drawCircle(UGraphic ug, int x, int y) {
+ final double cx = x * step;
+ final double cy = y * step;
+ ug.apply(new UTranslate(cx, cy)).draw(new UEllipse(spotSize, spotSize));
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/braille/BrailleGrid.java b/src/net/sourceforge/plantuml/braille/BrailleGrid.java
new file mode 100644
index 000000000..e2165a632
--- /dev/null
+++ b/src/net/sourceforge/plantuml/braille/BrailleGrid.java
@@ -0,0 +1,127 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2017, Arnaud Roques
+ *
+ * Project Info: http://plantuml.com
+ *
+ * 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.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * Original Author: Arnaud Roques
+ *
+ * Revision $Revision: 6170 $
+ *
+ */
+package net.sourceforge.plantuml.braille;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class BrailleGrid {
+
+ private int minX;
+ private int minY;
+ private int maxX;
+ private int maxY;
+
+ private final double quanta;
+ private final Set on = new HashSet();
+
+ public BrailleGrid(double quanta) {
+ this.quanta = quanta;
+ }
+
+ public boolean getState(int x, int y) {
+ final Coords coords = new Coords(x, y);
+ return on.contains(coords);
+ }
+
+ public void setState(int x, int y, boolean state) {
+ final Coords coords = new Coords(x, y);
+ if (state) {
+ on.add(coords);
+ } else {
+ on.remove(coords);
+ }
+ minX = Math.min(minX, x);
+ maxX = Math.max(maxX, x);
+ minY = Math.min(minY, y);
+ maxY = Math.max(maxY, y);
+ }
+
+ public int getMinX() {
+ return minX;
+ }
+
+ public int getMinY() {
+ return minY;
+ }
+
+ public int getMaxX() {
+ return maxX;
+ }
+
+ public int getMaxY() {
+ return maxY;
+ }
+
+ public void rectangle(double x, double y, double width, double height) {
+ hline(y, x, x + width);
+ hline(y + height, x, x + width);
+ vline(x, y, y + height);
+ vline(x + width, y, y + height);
+
+ }
+
+ private void vline(double x, double y1, double y2) {
+ final int i = toInt(x);
+ final int j1 = toInt(y1);
+ final int j2 = toInt(y2);
+ for (int j = j1; j <= j2; j++) {
+ setState(i, j, true);
+ }
+ }
+
+ private void hline(double y, double x1, double x2) {
+ final int j = toInt(y);
+ final int i1 = toInt(x1);
+ final int i2 = toInt(x2);
+ for (int i = i1; i <= i2; i++) {
+ setState(i, j, true);
+ }
+ }
+
+ private int toInt(double value) {
+ return (int) Math.round(value / quanta);
+ }
+
+ public void line(double x1, double y1, double x2, double y2) {
+ if (x1 == x2) {
+ vline(x1, y1, y2);
+ } else if (y1 == y2) {
+ hline(y1, x1, x2);
+ } else {
+ System.err.println("warning line");
+ }
+
+ }
+}
diff --git a/src/net/sourceforge/plantuml/braille/Coords.java b/src/net/sourceforge/plantuml/braille/Coords.java
new file mode 100644
index 000000000..02f0de60f
--- /dev/null
+++ b/src/net/sourceforge/plantuml/braille/Coords.java
@@ -0,0 +1,70 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2017, Arnaud Roques
+ *
+ * Project Info: http://plantuml.com
+ *
+ * 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.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * Original Author: Arnaud Roques
+ *
+ * Revision $Revision: 6170 $
+ *
+ */
+package net.sourceforge.plantuml.braille;
+
+public class Coords {
+
+ private final int x;
+ private final int y;
+
+ public Coords(int x, int y) {
+ this.x = x;
+ this.y = y;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ final Coords other = (Coords) obj;
+ return this.x == other.x && this.y == other.y;
+ }
+
+ @Override
+ public int hashCode() {
+ return x + y * 8192;
+ }
+
+ @Override
+ public String toString() {
+ return "( " + x + " ; " + y + " )";
+ }
+
+ public int getX() {
+ return x;
+ }
+
+ public int getY() {
+ return y;
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/braille/DriverLineBraille.java b/src/net/sourceforge/plantuml/braille/DriverLineBraille.java
new file mode 100644
index 000000000..ffae14aca
--- /dev/null
+++ b/src/net/sourceforge/plantuml/braille/DriverLineBraille.java
@@ -0,0 +1,72 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2017, Arnaud Roques
+ *
+ * Project Info: http://plantuml.com
+ *
+ * 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.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * Original Author: Arnaud Roques
+ *
+ */
+package net.sourceforge.plantuml.braille;
+
+import java.awt.geom.Line2D;
+
+import net.sourceforge.plantuml.ugraphic.ClipContainer;
+import net.sourceforge.plantuml.ugraphic.ColorMapper;
+import net.sourceforge.plantuml.ugraphic.UClip;
+import net.sourceforge.plantuml.ugraphic.UDriver;
+import net.sourceforge.plantuml.ugraphic.ULine;
+import net.sourceforge.plantuml.ugraphic.UParam;
+import net.sourceforge.plantuml.ugraphic.UShape;
+
+public class DriverLineBraille implements UDriver {
+
+ private final ClipContainer clipContainer;
+
+ public DriverLineBraille(ClipContainer clipContainer) {
+ this.clipContainer = clipContainer;
+ }
+
+ public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, BrailleGrid grid) {
+ final ULine shape = (ULine) ushape;
+
+ double x2 = x + shape.getDX();
+ double y2 = y + shape.getDY();
+
+ final UClip clip = clipContainer.getClip();
+ if (clip != null) {
+ final Line2D.Double line = clip.getClippedLine(new Line2D.Double(x, y, x2, y2));
+ if (line == null) {
+ return;
+ }
+ x = line.x1;
+ y = line.y1;
+ x2 = line.x2;
+ y2 = line.y2;
+ }
+
+ grid.line(x, y, x2, y2);
+ }
+}
diff --git a/src/net/sourceforge/plantuml/braille/DriverNoneBraille.java b/src/net/sourceforge/plantuml/braille/DriverNoneBraille.java
new file mode 100644
index 000000000..bfd48aff3
--- /dev/null
+++ b/src/net/sourceforge/plantuml/braille/DriverNoneBraille.java
@@ -0,0 +1,44 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2017, Arnaud Roques
+ *
+ * Project Info: http://plantuml.com
+ *
+ * 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.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * Original Author: Arnaud Roques
+ *
+ */
+package net.sourceforge.plantuml.braille;
+
+import net.sourceforge.plantuml.ugraphic.ColorMapper;
+import net.sourceforge.plantuml.ugraphic.UDriver;
+import net.sourceforge.plantuml.ugraphic.UParam;
+import net.sourceforge.plantuml.ugraphic.UShape;
+
+public class DriverNoneBraille implements UDriver {
+
+ public void draw(UShape shape, double x, double y, ColorMapper mapper, UParam param, BrailleGrid object) {
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/braille/DriverRectangleBraille.java b/src/net/sourceforge/plantuml/braille/DriverRectangleBraille.java
new file mode 100644
index 000000000..c7976e547
--- /dev/null
+++ b/src/net/sourceforge/plantuml/braille/DriverRectangleBraille.java
@@ -0,0 +1,89 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2017, Arnaud Roques
+ *
+ * Project Info: http://plantuml.com
+ *
+ * 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.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * Original Author: Arnaud Roques
+ *
+ */
+package net.sourceforge.plantuml.braille;
+
+import java.awt.geom.Rectangle2D;
+
+import net.sourceforge.plantuml.ugraphic.ClipContainer;
+import net.sourceforge.plantuml.ugraphic.ColorMapper;
+import net.sourceforge.plantuml.ugraphic.UClip;
+import net.sourceforge.plantuml.ugraphic.UDriver;
+import net.sourceforge.plantuml.ugraphic.UParam;
+import net.sourceforge.plantuml.ugraphic.URectangle;
+import net.sourceforge.plantuml.ugraphic.UShape;
+
+public class DriverRectangleBraille implements UDriver {
+
+ private final ClipContainer clipContainer;
+
+ public DriverRectangleBraille(ClipContainer clipContainer) {
+ this.clipContainer = clipContainer;
+ }
+
+ public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, BrailleGrid grid) {
+ final URectangle rect = (URectangle) ushape;
+
+ // final double rx = rect.getRx();
+ // final double ry = rect.getRy();
+ double width = rect.getWidth();
+ double height = rect.getHeight();
+
+ // final String color = StringUtils.getAsSvg(mapper, param.getColor());
+ // final HtmlColor back = param.getBackcolor();
+ // if (back instanceof HtmlColorGradient) {
+ // final HtmlColorGradient gr = (HtmlColorGradient) back;
+ // final String id = svg.createSvgGradient(StringUtils.getAsHtml(mapper.getMappedColor(gr.getColor1())),
+ // StringUtils.getAsHtml(mapper.getMappedColor(gr.getColor2())), gr.getPolicy());
+ // svg.setFillColor("url(#" + id + ")");
+ // svg.setStrokeColor(color);
+ // } else {
+ // final String backcolor = StringUtils.getAsSvg(mapper, back);
+ // svg.setFillColor(backcolor);
+ // svg.setStrokeColor(color);
+ // }
+ //
+ // svg.setStrokeWidth(param.getStroke().getThickness(), param.getStroke().getDasharraySvg());
+
+ final UClip clip = clipContainer.getClip();
+ if (clip != null) {
+ final Rectangle2D.Double r = clip.getClippedRectangle(new Rectangle2D.Double(x, y, width, height));
+ x = r.x;
+ y = r.y;
+ width = r.width;
+ height = r.height;
+ if (height <= 0) {
+ return;
+ }
+ }
+ grid.rectangle(x, y, width, height);
+ }
+}
diff --git a/src/net/sourceforge/plantuml/braille/UGraphicBraille.java b/src/net/sourceforge/plantuml/braille/UGraphicBraille.java
new file mode 100644
index 000000000..9912d60d0
--- /dev/null
+++ b/src/net/sourceforge/plantuml/braille/UGraphicBraille.java
@@ -0,0 +1,135 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2017, Arnaud Roques
+ *
+ * Project Info: http://plantuml.com
+ *
+ * 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.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * Original Author: Arnaud Roques
+ *
+ */
+package net.sourceforge.plantuml.braille;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import net.sourceforge.plantuml.FileFormat;
+import net.sourceforge.plantuml.FileFormatOption;
+import net.sourceforge.plantuml.Url;
+import net.sourceforge.plantuml.graphic.HtmlColorUtils;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.graphic.TextBlockUtils;
+import net.sourceforge.plantuml.posimo.DotPath;
+import net.sourceforge.plantuml.ugraphic.AbstractCommonUGraphic;
+import net.sourceforge.plantuml.ugraphic.AbstractUGraphic;
+import net.sourceforge.plantuml.ugraphic.ClipContainer;
+import net.sourceforge.plantuml.ugraphic.ColorMapper;
+import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity;
+import net.sourceforge.plantuml.ugraphic.ImageBuilder;
+import net.sourceforge.plantuml.ugraphic.UCenteredCharacter;
+import net.sourceforge.plantuml.ugraphic.UEllipse;
+import net.sourceforge.plantuml.ugraphic.UGraphic2;
+import net.sourceforge.plantuml.ugraphic.UImage;
+import net.sourceforge.plantuml.ugraphic.ULine;
+import net.sourceforge.plantuml.ugraphic.UPath;
+import net.sourceforge.plantuml.ugraphic.UPolygon;
+import net.sourceforge.plantuml.ugraphic.URectangle;
+import net.sourceforge.plantuml.ugraphic.UText;
+
+public class UGraphicBraille extends AbstractUGraphic implements ClipContainer, UGraphic2 {
+
+ private final StringBounder stringBounder;
+ private final BrailleGrid grid;
+
+ @Override
+ protected AbstractCommonUGraphic copyUGraphic() {
+ return new UGraphicBraille(this);
+ }
+
+ public UGraphicBraille(ColorMapper colorMapper, FileFormat fileFormat) {
+ this(colorMapper, new BrailleGrid(4));
+ }
+
+ private UGraphicBraille(UGraphicBraille other) {
+ super(other);
+ this.stringBounder = other.stringBounder;
+ this.grid = other.grid;
+ register();
+ }
+
+ // public UGraphicBraille(ColorMapper colorMapper, String backcolor, boolean textAsPath, double scale, String
+ // linkTarget) {
+ // this(colorMapper, new SvgGraphics(backcolor, scale), textAsPath, linkTarget);
+ // }
+ //
+ // public UGraphicBraille(ColorMapper colorMapper, boolean textAsPath, double scale, String linkTarget) {
+ // this(colorMapper, new SvgGraphics(scale), textAsPath, linkTarget);
+ // }
+ //
+ // public UGraphicBraille(ColorMapper mapper, HtmlColorGradient gr, boolean textAsPath, double scale, String
+ // linkTarget) {
+ // this(mapper, new SvgGraphics(scale), textAsPath, linkTarget);
+ //
+ // final SvgGraphics svg = getGraphicObject();
+ // svg.paintBackcolorGradient(mapper, gr);
+ // }
+
+ private UGraphicBraille(ColorMapper colorMapper, BrailleGrid grid) {
+ super(colorMapper, grid);
+ this.grid = grid;
+ this.stringBounder = TextBlockUtils.getDummyStringBounder();
+ register();
+ }
+
+ private void register() {
+ registerDriver(URectangle.class, new DriverRectangleBraille(this));
+ registerDriver(UText.class, new DriverNoneBraille());
+ registerDriver(ULine.class, new DriverLineBraille(this));
+ registerDriver(UPolygon.class, new DriverNoneBraille());
+ registerDriver(UEllipse.class, new DriverNoneBraille());
+ registerDriver(UImage.class, new DriverNoneBraille());
+ registerDriver(UPath.class, new DriverNoneBraille());
+ registerDriver(DotPath.class, new DriverNoneBraille());
+ registerDriver(UCenteredCharacter.class, new DriverNoneBraille());
+ }
+
+ public StringBounder getStringBounder() {
+ return stringBounder;
+ }
+
+ public void startUrl(Url url) {
+ }
+
+ public void closeAction() {
+ }
+
+ public void writeImageTOBEMOVED(OutputStream os, String metadata, int dpi) throws IOException {
+ final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HtmlColorUtils.WHITE,
+ metadata, null, 0, 0, null, false);
+ imageBuilder.setUDrawable(new BrailleDrawer(getGraphicObject()));
+
+ imageBuilder.writeImageTOBEMOVED(new FileFormatOption(FileFormat.PNG), os);
+
+ }
+}
diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java
index cba550749..469274f88 100644
--- a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java
+++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java
@@ -83,6 +83,7 @@ public class CommandCreateClassMultilines extends CommandMultilines2 extends PSy
return null;
}
+ private boolean isEmptyLine(CharSequence2 result) {
+ return result.trin().length() == 0;
+ }
final public Diagram createSystem(UmlSource source) {
final IteratorCounter2 it = source.iterator2();
final CharSequence2 startLine = it.next();
P system = init(startLine.toString2());
+ boolean first = true;
while (it.hasNext()) {
final CharSequence2 s = it.next();
+ if (first && s != null && isEmptyLine(s)) {
+ continue;
+ }
+ first = false;
if (StartUtils.isArobaseEndDiagram(s)) {
if (source.getTotalLineCount() == 2) {
return buildEmptyError(source, s.getLocation());
@@ -88,6 +96,4 @@ public abstract class PSystemBasicFactory
extends PSy
return system;
}
-
-
}
diff --git a/src/net/sourceforge/plantuml/cucadiagram/CucaDiagram.java b/src/net/sourceforge/plantuml/cucadiagram/CucaDiagram.java
index e54ef940d..d4ca25703 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/CucaDiagram.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/CucaDiagram.java
@@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
- * Revision $Revision: 20028 $
+ * Revision $Revision: 20149 $
*
*/
package net.sourceforge.plantuml.cucadiagram;
@@ -197,7 +197,7 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
}
public final boolean isGroup(Code code) {
- return entityFactory.getGroups().containsKey(code);
+ return leafExist(code) == false && entityFactory.getGroups().containsKey(code);
}
public final Collection getGroups(boolean withRootGroup) {
diff --git a/src/net/sourceforge/plantuml/cucadiagram/GroupRoot.java b/src/net/sourceforge/plantuml/cucadiagram/GroupRoot.java
index cb85f1cbc..dd80dfb61 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/GroupRoot.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/GroupRoot.java
@@ -254,5 +254,4 @@ public class GroupRoot implements IGroup {
public void setRemoved(boolean removed) {
throw new UnsupportedOperationException();
}
-
}
diff --git a/src/net/sourceforge/plantuml/cucadiagram/ILeaf.java b/src/net/sourceforge/plantuml/cucadiagram/ILeaf.java
index 4bd8ee7eb..dda2c7a30 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/ILeaf.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/ILeaf.java
@@ -35,6 +35,7 @@ package net.sourceforge.plantuml.cucadiagram;
import net.sourceforge.plantuml.cucadiagram.dot.Neighborhood;
import net.sourceforge.plantuml.graphic.USymbol;
+import net.sourceforge.plantuml.skin.VisibilityModifier;
import net.sourceforge.plantuml.svek.IEntityImage;
public interface ILeaf extends IEntity {
@@ -73,4 +74,8 @@ public interface ILeaf extends IEntity {
public void setHasPort(boolean hasPort);
+ public void setVisibilityModifier(VisibilityModifier visibility);
+
+ public VisibilityModifier getVisibilityModifier();
+
}
diff --git a/src/net/sourceforge/plantuml/cucadiagram/dot/AbstractGraphviz.java b/src/net/sourceforge/plantuml/cucadiagram/dot/AbstractGraphviz.java
index cbe6d74f8..f5d14e46e 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/dot/AbstractGraphviz.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/dot/AbstractGraphviz.java
@@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
- * Revision $Revision: 19398 $
+ * Revision $Revision: 20172 $
*
*/
package net.sourceforge.plantuml.cucadiagram.dot;
@@ -82,7 +82,7 @@ abstract class AbstractGraphviz implements Graphviz {
throw new IllegalArgumentException();
}
- if (illegalDotExe()) {
+ if (getExeState() != ExeState.OK) {
// createPngNoGraphviz(os, new FileFormatOption(FileFormat.valueOf(type[0].goUpperCase())));
throw new IllegalStateException();
}
@@ -123,8 +123,8 @@ abstract class AbstractGraphviz implements Graphviz {
return state;
}
- public boolean illegalDotExe() {
- return dotExe == null || dotExe.isFile() == false || dotExe.canRead() == false;
+ final public ExeState getExeState() {
+ return ExeState.checkFile(dotExe);
}
final public String dotVersion() {
diff --git a/src/net/sourceforge/plantuml/cucadiagram/dot/CucaDiagramSimplifierState.java b/src/net/sourceforge/plantuml/cucadiagram/dot/CucaDiagramSimplifierState.java
index 1f67ee300..e806f1ce9 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/dot/CucaDiagramSimplifierState.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/dot/CucaDiagramSimplifierState.java
@@ -36,9 +36,11 @@ package net.sourceforge.plantuml.cucadiagram.dot;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.LinkedHashSet;
import java.util.List;
import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
+import net.sourceforge.plantuml.cucadiagram.GroupRoot;
import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.IGroup;
import net.sourceforge.plantuml.cucadiagram.LeafType;
@@ -55,7 +57,7 @@ public final class CucaDiagramSimplifierState {
boolean changed;
do {
changed = false;
- final Collection groups = putConcurrentStateAtEnd(diagram.getGroups(false));
+ final Collection groups = getOrdered(diagram.getRootGroup());
for (IGroup g : groups) {
if (diagram.isAutarkic(g)) {
final IEntityImage img = computeImage(g);
@@ -68,17 +70,39 @@ public final class CucaDiagramSimplifierState {
} while (changed);
}
- private Collection putConcurrentStateAtEnd(Collection groups) {
- final List result = new ArrayList();
- final List end = new ArrayList();
- for (IGroup g : groups) {
- if (g.getGroupType() == GroupType.CONCURRENT_STATE) {
- end.add(g);
- } else {
- result.add(g);
+ private Collection getOrdered(IGroup root) {
+ final Collection ordered = new LinkedHashSet();
+ ordered.add(root);
+ int size = 1;
+ while (true) {
+ size = ordered.size();
+ addOneLevel(ordered);
+ if (size == ordered.size()) {
+ break;
}
}
- result.addAll(end);
+ final List result = new ArrayList();
+ for (IGroup g : ordered) {
+ if (g instanceof GroupRoot == false) {
+ result.add(0, g);
+ }
+ }
+ return result;
+ }
+
+ private void addOneLevel(Collection currents) {
+ for (IGroup g : new ArrayList(currents)) {
+ for (IGroup child : reverse(g.getChildren())) {
+ currents.add(child);
+ }
+ }
+ }
+
+ private List reverse(Collection source) {
+ final List result = new ArrayList();
+ for (IGroup g : source) {
+ result.add(0, g);
+ }
return result;
}
diff --git a/src/net/sourceforge/plantuml/cucadiagram/dot/ExeState.java b/src/net/sourceforge/plantuml/cucadiagram/dot/ExeState.java
new file mode 100644
index 000000000..c9e6c5472
--- /dev/null
+++ b/src/net/sourceforge/plantuml/cucadiagram/dot/ExeState.java
@@ -0,0 +1,93 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2017, Arnaud Roques
+ *
+ * Project Info: http://plantuml.com
+ *
+ * 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.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * Original Author: Arnaud Roques
+ *
+ * Revision $Revision: 20169 $
+ *
+ */
+package net.sourceforge.plantuml.cucadiagram.dot;
+
+import java.io.File;
+
+public enum ExeState {
+
+ NULL_UNDEFINED, OK, DOES_NOT_EXIST, IS_A_DIRECTORY, NOT_A_FILE, CANNOT_BE_READ;
+
+ public static ExeState checkFile(File dotExe) {
+ if (dotExe == null) {
+ return NULL_UNDEFINED;
+ } else if (dotExe.exists() == false) {
+ return DOES_NOT_EXIST;
+ } else if (dotExe.isDirectory()) {
+ return IS_A_DIRECTORY;
+ } else if (dotExe.isFile() == false) {
+ return NOT_A_FILE;
+ } else if (dotExe.canRead() == false) {
+ return CANNOT_BE_READ;
+ }
+ return OK;
+ }
+
+ public String getTextMessage() {
+ switch (this) {
+ case OK:
+ return "File OK";
+ case NULL_UNDEFINED:
+ return "No dot executable found";
+ case DOES_NOT_EXIST:
+ return "File does not exist";
+ case IS_A_DIRECTORY:
+ return "It should be an executable, not a directory";
+ case NOT_A_FILE:
+ return "Not a valid file";
+ case CANNOT_BE_READ:
+ return "File cannot be read";
+ }
+ throw new IllegalStateException();
+ }
+
+ public String getTextMessage(File exe) {
+ switch (this) {
+ case OK:
+ return "File " + exe.getAbsolutePath() + " OK";
+ case NULL_UNDEFINED:
+ return NULL_UNDEFINED.getTextMessage();
+ case DOES_NOT_EXIST:
+ return "File " + exe.getAbsolutePath() + " does not exist";
+ case IS_A_DIRECTORY:
+ return "File " + exe.getAbsolutePath() + " should be an executable, not a directory";
+ case NOT_A_FILE:
+ return "File " + exe.getAbsolutePath() + " is not a valid file";
+ case CANNOT_BE_READ:
+ return "File " + exe.getAbsolutePath() + " cannot be read";
+ }
+ throw new IllegalStateException();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/cucadiagram/dot/Graphviz.java b/src/net/sourceforge/plantuml/cucadiagram/dot/Graphviz.java
index e4eae3e8c..86e817b18 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/dot/Graphviz.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/dot/Graphviz.java
@@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
- * Revision $Revision: 19109 $
+ * Revision $Revision: 20172 $
*
*/
package net.sourceforge.plantuml.cucadiagram.dot;
@@ -43,6 +43,7 @@ public interface Graphviz {
File getDotExe();
String dotVersion();
-
- boolean illegalDotExe();
+
+ ExeState getExeState();
+
}
\ No newline at end of file
diff --git a/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizUtils.java b/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizUtils.java
index 2e0b8460e..0187d832f 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizUtils.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizUtils.java
@@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
- * Revision $Revision: 19931 $
+ * Revision $Revision: 20173 $
*
*/
package net.sourceforge.plantuml.cucadiagram.dot;
@@ -43,13 +43,14 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.sourceforge.plantuml.ISkinParam;
+import net.sourceforge.plantuml.Log;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.vizjs.GraphvizJs;
import net.sourceforge.plantuml.vizjs.VizJsEngine;
public class GraphvizUtils {
- // private static final String VIZJS = "vizjs";
+ private static final String VIZJS = "vizjs";
private static int DOT_VERSION_LIMIT = 226;
private static boolean isWindows() {
@@ -67,7 +68,8 @@ public class GraphvizUtils {
}
public static Graphviz create(ISkinParam skinParam, String dotString, String... type) {
- if (VizJsEngine.isOk()) {
+ if (useVizJs(skinParam)) {
+ Log.info("Using " + VIZJS);
return new GraphvizJs(dotString);
}
final AbstractGraphviz result;
@@ -76,12 +78,24 @@ public class GraphvizUtils {
} else {
result = new GraphvizLinux(skinParam, dotString, type);
}
- // if (OptionFlags.GRAPHVIZCACHE) {
- // return new GraphvizCached(result);
- // }
+ if (result.getExeState() != ExeState.OK && VizJsEngine.isOk()) {
+ Log.info("Error with file " + result.getDotExe() + ": " + result.getExeState().getTextMessage());
+ Log.info("Using " + VIZJS);
+ return new GraphvizJs(dotString);
+ }
return result;
}
+ private static boolean useVizJs(ISkinParam skinParam) {
+ if (skinParam != null && VIZJS.equalsIgnoreCase(skinParam.getDotExecutable()) && VizJsEngine.isOk()) {
+ return true;
+ }
+ if (VIZJS.equalsIgnoreCase(getenvGraphvizDot()) && VizJsEngine.isOk()) {
+ return true;
+ }
+ return false;
+ }
+
static public File getDotExe() {
return create(null, "png").getDotExe();
}
@@ -125,16 +139,12 @@ public class GraphvizUtils {
public static String dotVersion() throws IOException, InterruptedException {
if (dotVersion == null) {
- if (GraphvizUtils.getDotExe() == null) {
- dotVersion = "Error: Dot not installed";
- } else if (GraphvizUtils.getDotExe().exists() == false) {
- dotVersion = "Error: " + GraphvizUtils.getDotExe().getAbsolutePath() + " does not exist";
- } else if (GraphvizUtils.getDotExe().isFile() == false) {
- dotVersion = "Error: " + GraphvizUtils.getDotExe().getAbsolutePath() + " is not a file";
- } else if (GraphvizUtils.getDotExe().canRead() == false) {
- dotVersion = "Error: " + GraphvizUtils.getDotExe().getAbsolutePath() + " cannot be read";
- } else {
+ final File dotExe = GraphvizUtils.getDotExe();
+ final ExeState exeState = ExeState.checkFile(dotExe);
+ if (exeState == ExeState.OK) {
dotVersion = create(null, "png").dotVersion();
+ } else {
+ dotVersion = "Error:" + exeState.getTextMessage(dotExe);
}
}
return dotVersion;
@@ -165,7 +175,7 @@ public class GraphvizUtils {
}
final List result = new ArrayList();
- if (VizJsEngine.isOk()) {
+ if (useVizJs(null)) {
result.add("VizJs library is used!");
try {
final String err = getTestCreateSimpleFile();
@@ -190,22 +200,9 @@ public class GraphvizUtils {
final File dotExe = GraphvizUtils.getDotExe();
result.add("Dot executable is " + dotExe);
- boolean ok = true;
- if (dotExe == null) {
- result.add(red + "Error: No dot executable found");
- ok = false;
- } else if (dotExe.exists() == false) {
- result.add(red + "Error: file does not exist");
- ok = false;
- } else if (dotExe.isFile() == false) {
- result.add(red + "Error: not a valid file");
- ok = false;
- } else if (dotExe.canRead() == false) {
- result.add(red + "Error: cannot be read");
- ok = false;
- }
+ final ExeState exeState = ExeState.checkFile(dotExe);
- if (ok) {
+ if (exeState == ExeState.OK) {
try {
final String version = GraphvizUtils.dotVersion();
result.add("Dot version: " + version);
@@ -228,6 +225,7 @@ public class GraphvizUtils {
e.printStackTrace();
}
} else {
+ result.add(red + "Error: " + exeState.getTextMessage());
result.add("Error: only sequence diagrams will be generated");
}
diff --git a/src/net/sourceforge/plantuml/cucadiagram/entity/EntityImpl.java b/src/net/sourceforge/plantuml/cucadiagram/entity/EntityImpl.java
index 163ed72cd..6725f5778 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/entity/EntityImpl.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/entity/EntityImpl.java
@@ -64,6 +64,7 @@ import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors;
+import net.sourceforge.plantuml.skin.VisibilityModifier;
import net.sourceforge.plantuml.svek.IEntityImage;
import net.sourceforge.plantuml.svek.PackageStyle;
import net.sourceforge.plantuml.svek.SingleStrategy;
@@ -590,4 +591,14 @@ final class EntityImpl implements ILeaf, IGroup {
this.hasPort = hasPort;
}
+ private VisibilityModifier visibility;
+
+ public void setVisibilityModifier(VisibilityModifier visibility) {
+ this.visibility = visibility;
+
+ }
+
+ public VisibilityModifier getVisibilityModifier() {
+ return visibility;
+ }
}
diff --git a/src/net/sourceforge/plantuml/directdot/PSystemDot.java b/src/net/sourceforge/plantuml/directdot/PSystemDot.java
index 4167ebca6..9f9312ca6 100644
--- a/src/net/sourceforge/plantuml/directdot/PSystemDot.java
+++ b/src/net/sourceforge/plantuml/directdot/PSystemDot.java
@@ -43,6 +43,7 @@ import net.sourceforge.plantuml.api.ImageDataSimple;
import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.DiagramDescriptionImpl;
import net.sourceforge.plantuml.core.ImageData;
+import net.sourceforge.plantuml.cucadiagram.dot.ExeState;
import net.sourceforge.plantuml.cucadiagram.dot.Graphviz;
import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils;
import net.sourceforge.plantuml.cucadiagram.dot.ProcessState;
@@ -65,10 +66,11 @@ public class PSystemDot extends AbstractPSystem {
}
public ImageData exportDiagram(OutputStream os, int num, FileFormatOption fileFormat) throws IOException {
- final Graphviz graphviz = GraphvizUtils
- .create(null, data, StringUtils.goLowerCase(fileFormat.getFileFormat().name()));
- if (graphviz.illegalDotExe()) {
- final TextBlock result = GraphicStrings.createDefault(Arrays.asList("There is an issue with your Dot/Graphviz installation"), false);
+ final Graphviz graphviz = GraphvizUtils.create(null, data,
+ StringUtils.goLowerCase(fileFormat.getFileFormat().name()));
+ if (graphviz.getExeState() != ExeState.OK) {
+ final TextBlock result = GraphicStrings.createDefault(
+ Arrays.asList("There is an issue with your Dot/Graphviz installation"), false);
UGraphicUtils.writeImage(os, null, fileFormat, new ColorMapperIdentity(), HtmlColorUtils.WHITE, result);
return new ImageDataSimple();
}
diff --git a/src/net/sourceforge/plantuml/graphic/QuoteUtils.java b/src/net/sourceforge/plantuml/graphic/QuoteUtils.java
index 23caf2291..36b293730 100644
--- a/src/net/sourceforge/plantuml/graphic/QuoteUtils.java
+++ b/src/net/sourceforge/plantuml/graphic/QuoteUtils.java
@@ -179,11 +179,11 @@ public class QuoteUtils {
"Daylight, I must wait for the sunrise. I must think of a new life. And I mustn't give in.", //
"If I cannot bring you comfort then at least I bring you hope", //
"We all must learn from small misfortune, count the blessings that are real", //
- "Prepare Three Sealed Envelopes...",
- "You know that thing you just did? Don't do that"
- // Well I never, was there ever, A cat so clever, as magical Mr Mistoffelees
- // Do you like your morning tea weak or strong ?
- // It took me a long time to understand that if you want to do this job well you have to stay detached.
+ "Prepare Three Sealed Envelopes...", //
+ "You know that thing you just did? Don't do that", //
+ "It took me a long time to understand that if you want to do this job well you have to stay detached.", //
+ "Do you like your morning tea weak or strong ?", //
+ "Winter is coming" //
);
private QuoteUtils() {
diff --git a/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHector.java b/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHector.java
index b66ead2e2..eaafab899 100644
--- a/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHector.java
+++ b/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHector.java
@@ -47,7 +47,7 @@ import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.svek.CucaDiagramFileMaker;
-import net.sourceforge.plantuml.svek.CucaDiagramFileMakerSvek2;
+import net.sourceforge.plantuml.svek.DotDataImageBuilder;
import net.sourceforge.plantuml.svek.IEntityImage;
import net.sourceforge.plantuml.ugraphic.UGraphic2;
import net.sourceforge.plantuml.ugraphic.UTranslate;
@@ -97,7 +97,7 @@ public class CucaDiagramFileMakerHector implements CucaDiagramFileMaker {
}
private IEntityImage computeImage(final ILeaf leaf) {
- final IEntityImage image = CucaDiagramFileMakerSvek2.createEntityImageBlock(leaf, diagram.getSkinParam(),
+ final IEntityImage image = DotDataImageBuilder.createEntityImageBlock(leaf, diagram.getSkinParam(),
false, diagram, null, null, null);
return image;
}
diff --git a/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHector2.java b/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHector2.java
index d64b041c5..a059ee14e 100644
--- a/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHector2.java
+++ b/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHector2.java
@@ -51,7 +51,7 @@ import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.svek.CucaDiagramFileMaker;
-import net.sourceforge.plantuml.svek.CucaDiagramFileMakerSvek2;
+import net.sourceforge.plantuml.svek.DotDataImageBuilder;
import net.sourceforge.plantuml.svek.IEntityImage;
import net.sourceforge.plantuml.ugraphic.MinMax;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
@@ -172,7 +172,7 @@ public class CucaDiagramFileMakerHector2 implements CucaDiagramFileMaker {
}
private IEntityImage computeImage(final ILeaf leaf) {
- final IEntityImage image = CucaDiagramFileMakerSvek2.createEntityImageBlock(leaf, diagram.getSkinParam(),
+ final IEntityImage image = DotDataImageBuilder.createEntityImageBlock(leaf, diagram.getSkinParam(),
false, diagram, null, null, null);
return image;
}
diff --git a/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHector3.java b/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHector3.java
index 5acffd898..f69986961 100644
--- a/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHector3.java
+++ b/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHector3.java
@@ -51,7 +51,7 @@ import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.svek.CucaDiagramFileMaker;
-import net.sourceforge.plantuml.svek.CucaDiagramFileMakerSvek2;
+import net.sourceforge.plantuml.svek.DotDataImageBuilder;
import net.sourceforge.plantuml.svek.IEntityImage;
import net.sourceforge.plantuml.ugraphic.MinMax;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
@@ -173,7 +173,7 @@ public class CucaDiagramFileMakerHector3 implements CucaDiagramFileMaker {
}
private IEntityImage computeImage(final ILeaf leaf) {
- final IEntityImage image = CucaDiagramFileMakerSvek2.createEntityImageBlock(leaf, diagram.getSkinParam(),
+ final IEntityImage image = DotDataImageBuilder.createEntityImageBlock(leaf, diagram.getSkinParam(),
false, diagram, null, null, null);
return image;
}
diff --git a/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHector4.java b/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHector4.java
index 2bb5c29e8..1e71645b1 100644
--- a/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHector4.java
+++ b/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHector4.java
@@ -52,7 +52,7 @@ import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.svek.CucaDiagramFileMaker;
-import net.sourceforge.plantuml.svek.CucaDiagramFileMakerSvek2;
+import net.sourceforge.plantuml.svek.DotDataImageBuilder;
import net.sourceforge.plantuml.svek.IEntityImage;
import net.sourceforge.plantuml.ugraphic.MinMax;
import net.sourceforge.plantuml.ugraphic.UGraphic;
@@ -188,7 +188,7 @@ public class CucaDiagramFileMakerHector4 implements CucaDiagramFileMaker {
}
private IEntityImage computeImage(final ILeaf leaf) {
- final IEntityImage image = CucaDiagramFileMakerSvek2.createEntityImageBlock(leaf, diagram.getSkinParam(),
+ final IEntityImage image = DotDataImageBuilder.createEntityImageBlock(leaf, diagram.getSkinParam(),
false, diagram, null, null, null);
return image;
}
diff --git a/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHectorB1.java b/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHectorB1.java
index 815bfe2c4..6e424c3aa 100644
--- a/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHectorB1.java
+++ b/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHectorB1.java
@@ -52,7 +52,7 @@ import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.svek.CucaDiagramFileMaker;
-import net.sourceforge.plantuml.svek.CucaDiagramFileMakerSvek2;
+import net.sourceforge.plantuml.svek.DotDataImageBuilder;
import net.sourceforge.plantuml.svek.IEntityImage;
import net.sourceforge.plantuml.ugraphic.MinMax;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
@@ -160,7 +160,7 @@ public class CucaDiagramFileMakerHectorB1 implements CucaDiagramFileMaker {
}
private IEntityImage computeImage(final ILeaf leaf) {
- final IEntityImage image = CucaDiagramFileMakerSvek2.createEntityImageBlock(leaf, diagram.getSkinParam(),
+ final IEntityImage image = DotDataImageBuilder.createEntityImageBlock(leaf, diagram.getSkinParam(),
false, diagram, null, null, null);
return image;
}
diff --git a/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHectorB2.java b/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHectorB2.java
index 8e8dea343..b88dd4b63 100644
--- a/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHectorB2.java
+++ b/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHectorB2.java
@@ -53,7 +53,7 @@ import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.svek.CucaDiagramFileMaker;
-import net.sourceforge.plantuml.svek.CucaDiagramFileMakerSvek2;
+import net.sourceforge.plantuml.svek.DotDataImageBuilder;
import net.sourceforge.plantuml.svek.IEntityImage;
import net.sourceforge.plantuml.ugraphic.MinMax;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
@@ -194,7 +194,7 @@ public class CucaDiagramFileMakerHectorB2 implements CucaDiagramFileMaker {
}
private IEntityImage computeImage(final ILeaf leaf) {
- final IEntityImage image = CucaDiagramFileMakerSvek2.createEntityImageBlock(leaf, diagram.getSkinParam(),
+ final IEntityImage image = DotDataImageBuilder.createEntityImageBlock(leaf, diagram.getSkinParam(),
false, diagram, null, null, null);
return image;
}
diff --git a/src/net/sourceforge/plantuml/hector2/graphic/Foo1.java b/src/net/sourceforge/plantuml/hector2/graphic/Foo1.java
index d61a62fd2..5c5772d41 100644
--- a/src/net/sourceforge/plantuml/hector2/graphic/Foo1.java
+++ b/src/net/sourceforge/plantuml/hector2/graphic/Foo1.java
@@ -41,7 +41,7 @@ import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.hector2.layering.Layer;
-import net.sourceforge.plantuml.svek.CucaDiagramFileMakerSvek2;
+import net.sourceforge.plantuml.svek.DotDataImageBuilder;
import net.sourceforge.plantuml.svek.IEntityImage;
public class Foo1 {
@@ -57,7 +57,7 @@ public class Foo1 {
}
private static IEntityImage computeImage(final ILeaf leaf, CucaDiagram diagram) {
- final IEntityImage image = CucaDiagramFileMakerSvek2.createEntityImageBlock(leaf, diagram.getSkinParam(),
+ final IEntityImage image = DotDataImageBuilder.createEntityImageBlock(leaf, diagram.getSkinParam(),
false, diagram, null, null, null);
return image;
}
diff --git a/src/net/sourceforge/plantuml/hector2/graphic/Foo2.java b/src/net/sourceforge/plantuml/hector2/graphic/Foo2.java
index f186b55ef..d48ac78c1 100644
--- a/src/net/sourceforge/plantuml/hector2/graphic/Foo2.java
+++ b/src/net/sourceforge/plantuml/hector2/graphic/Foo2.java
@@ -45,7 +45,7 @@ import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.hector2.MinMax;
import net.sourceforge.plantuml.hector2.layering.Layer;
import net.sourceforge.plantuml.hector2.mpos.Distribution;
-import net.sourceforge.plantuml.svek.CucaDiagramFileMakerSvek2;
+import net.sourceforge.plantuml.svek.DotDataImageBuilder;
import net.sourceforge.plantuml.svek.IEntityImage;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
@@ -98,7 +98,7 @@ public class Foo2 extends AbstractTextBlock implements TextBlock {
}
private IEntityImage computeImage(final ILeaf leaf) {
- final IEntityImage image = CucaDiagramFileMakerSvek2.createEntityImageBlock(leaf, diagram.getSkinParam(),
+ final IEntityImage image = DotDataImageBuilder.createEntityImageBlock(leaf, diagram.getSkinParam(),
false, diagram, null, null, null);
return image;
}
diff --git a/src/net/sourceforge/plantuml/jdot/CucaDiagramFileMakerJDot.java b/src/net/sourceforge/plantuml/jdot/CucaDiagramFileMakerJDot.java
index d324de283..aa0c62032 100644
--- a/src/net/sourceforge/plantuml/jdot/CucaDiagramFileMakerJDot.java
+++ b/src/net/sourceforge/plantuml/jdot/CucaDiagramFileMakerJDot.java
@@ -94,9 +94,8 @@ import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.svek.Bibliotekon;
import net.sourceforge.plantuml.svek.Cluster;
-import net.sourceforge.plantuml.svek.ColorSequence;
import net.sourceforge.plantuml.svek.CucaDiagramFileMaker;
-import net.sourceforge.plantuml.svek.CucaDiagramFileMakerSvek2;
+import net.sourceforge.plantuml.svek.DotDataImageBuilder;
import net.sourceforge.plantuml.svek.DotStringFactory;
import net.sourceforge.plantuml.svek.GraphvizCrash;
import net.sourceforge.plantuml.svek.IEntityImage;
@@ -173,7 +172,7 @@ public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker {
public CucaDiagramFileMakerJDot(CucaDiagram diagram) {
this.diagram = diagram;
- this.dotStringFactory = new DotStringFactory(new ColorSequence(), stringBounder, diagram);
+ this.dotStringFactory = new DotStringFactory(stringBounder, diagram);
printGroups(diagram.getRootGroup());
printEntities(getUnpackagedEntities());
@@ -586,9 +585,8 @@ public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker {
// skinParam = new SkinParamSameClassWidth(dotData.getSkinParam(), width);
}
- return CucaDiagramFileMakerSvek2.createEntityImageBlock(ent, skinParam,
- diagram.isHideEmptyDescriptionForState(), diagram, getBibliotekon(), null,
- diagram.getUmlDiagramType());
+ return DotDataImageBuilder.createEntityImageBlock(ent, skinParam, diagram.isHideEmptyDescriptionForState(),
+ diagram, getBibliotekon(), null, diagram.getUmlDiagramType());
}
return ent.getSvekImage();
}
diff --git a/src/net/sourceforge/plantuml/skin/VisibilityModifier.java b/src/net/sourceforge/plantuml/skin/VisibilityModifier.java
index dcd20505a..f1ec8f23e 100644
--- a/src/net/sourceforge/plantuml/skin/VisibilityModifier.java
+++ b/src/net/sourceforge/plantuml/skin/VisibilityModifier.java
@@ -63,6 +63,10 @@ public enum VisibilityModifier {
private final ColorParam foregroundParam;
private final ColorParam backgroundParam;
+ public static String regexForVisibilityCharacter() {
+ return "[-#+~]";
+ }
+
private VisibilityModifier(ColorParam foreground, ColorParam background) {
this.foregroundParam = foreground;
this.backgroundParam = background;
@@ -83,7 +87,7 @@ public enum VisibilityModifier {
public Dimension2D calculateDimension(StringBounder stringBounder) {
return new Dimension2DDouble(size + 1, size + 1);
}
-
+
@Override
public Rectangle2D getInnerPosition(String member, StringBounder stringBounder) {
return null;
diff --git a/src/net/sourceforge/plantuml/statediagram/StateDiagram.java b/src/net/sourceforge/plantuml/statediagram/StateDiagram.java
index 5e54af309..aa7608feb 100644
--- a/src/net/sourceforge/plantuml/statediagram/StateDiagram.java
+++ b/src/net/sourceforge/plantuml/statediagram/StateDiagram.java
@@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
- * Revision $Revision: 19886 $
+ * Revision $Revision: 20161 $
*
*/
package net.sourceforge.plantuml.statediagram;
@@ -165,7 +165,7 @@ public class StateDiagram extends AbstractEntityDiagram {
public final boolean isHideEmptyDescriptionForState() {
return hideEmptyDescription;
}
-
+
@Override
public String checkFinalError() {
for (Link link : this.getLinks()) {
@@ -179,7 +179,7 @@ public class StateDiagram extends AbstractEntityDiagram {
}
return super.checkFinalError();
}
-
+
private static boolean isCompatible(IGroup parent1, IGroup parent2) {
if (parent1 == null && parent2 == null) {
return true;
@@ -203,7 +203,4 @@ public class StateDiagram extends AbstractEntityDiagram {
}
-
-
-
}
diff --git a/src/net/sourceforge/plantuml/svek/Bibliotekon.java b/src/net/sourceforge/plantuml/svek/Bibliotekon.java
index 850346968..86d05cf6c 100644
--- a/src/net/sourceforge/plantuml/svek/Bibliotekon.java
+++ b/src/net/sourceforge/plantuml/svek/Bibliotekon.java
@@ -36,10 +36,12 @@ package net.sourceforge.plantuml.svek;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.IGroup;
import net.sourceforge.plantuml.cucadiagram.ILeaf;
@@ -141,6 +143,17 @@ public class Bibliotekon {
return sb.length() == 0 ? "" : sb.toString();
}
+ public Map getMaxX() {
+ final Map result = new HashMap();
+ for (Map.Entry ent : shapeMap.entrySet()) {
+ final Shape sh = ent.getValue();
+ final double maxX = sh.getMinX() + sh.getWidth();
+ final IEntity entity = ent.getKey();
+ result.put(entity.getCode(), maxX);
+ }
+ return Collections.unmodifiableMap(result);
+ }
+
public List allLines() {
return Collections.unmodifiableList(allLines);
}
diff --git a/src/net/sourceforge/plantuml/svek/Cluster.java b/src/net/sourceforge/plantuml/svek/Cluster.java
index 863763533..b102c8917 100644
--- a/src/net/sourceforge/plantuml/svek/Cluster.java
+++ b/src/net/sourceforge/plantuml/svek/Cluster.java
@@ -76,6 +76,7 @@ import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.svek.image.EntityImageState;
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.ULine;
import net.sourceforge.plantuml.ugraphic.URectangle;
@@ -297,7 +298,7 @@ public class Cluster implements Moveable {
}
public void drawU(UGraphic ug, UStroke stroke, final UmlDiagramType umlDiagramType, final ISkinParam skinParam2) {
-
+ ug.draw(new UComment("cluster " + group.getCode().getFullName()));
final Stereotype stereotype = group.getStereotype();
HtmlColor borderColor;
if (umlDiagramType == UmlDiagramType.STATE) {
diff --git a/src/net/sourceforge/plantuml/svek/ConcurrentStateImage.java b/src/net/sourceforge/plantuml/svek/ConcurrentStateImage.java
new file mode 100644
index 000000000..8b7e86fd7
--- /dev/null
+++ b/src/net/sourceforge/plantuml/svek/ConcurrentStateImage.java
@@ -0,0 +1,157 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2017, Arnaud Roques
+ *
+ * Project Info: http://plantuml.com
+ *
+ * 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.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * Original Author: Arnaud Roques
+ *
+ * Revision $Revision: 6711 $
+ *
+ */
+package net.sourceforge.plantuml.svek;
+
+import java.awt.geom.Dimension2D;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import net.sourceforge.plantuml.ColorParam;
+import net.sourceforge.plantuml.Dimension2DDouble;
+import net.sourceforge.plantuml.ISkinParam;
+import net.sourceforge.plantuml.graphic.AbstractTextBlock;
+import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.skin.rose.Rose;
+import net.sourceforge.plantuml.ugraphic.UChangeColor;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.ULine;
+import net.sourceforge.plantuml.ugraphic.UStroke;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public final class ConcurrentStateImage extends AbstractTextBlock implements IEntityImage {
+
+ private final List inners = new ArrayList();
+ private final Separator separator;
+ private final ISkinParam skinParam;
+ private final HtmlColor backColor;
+
+ static enum Separator {
+ VERTICAL, HORIZONTAL;
+
+ static Separator fromChar(char sep) {
+ if (sep == '|') {
+ return VERTICAL;
+ }
+ if (sep == '-') {
+ return HORIZONTAL;
+ }
+ throw new IllegalArgumentException();
+ }
+
+ UTranslate move(Dimension2D dim) {
+ if (this == VERTICAL) {
+ return new UTranslate(dim.getWidth(), 0);
+ }
+ return new UTranslate(0, dim.getHeight());
+ }
+
+ Dimension2D add(Dimension2D orig, Dimension2D other) {
+ if (this == VERTICAL) {
+ return new Dimension2DDouble(orig.getWidth() + other.getWidth(), Math.max(orig.getHeight(),
+ other.getHeight()));
+ }
+ return new Dimension2DDouble(Math.max(orig.getWidth(), other.getWidth()), orig.getHeight()
+ + other.getHeight());
+ }
+
+ void drawSeparator(UGraphic ug, Dimension2D dimTotal) {
+ final double THICKNESS_BORDER = 1.5;
+ final int DASH = 8;
+ ug = ug.apply(new UStroke(DASH, 10, THICKNESS_BORDER));
+ if (this == VERTICAL) {
+ ug.draw(new ULine(0, dimTotal.getHeight() + DASH));
+ } else {
+ ug.draw(new ULine(dimTotal.getWidth() + DASH, 0));
+ }
+
+ }
+ }
+
+ private HtmlColor getColor(ColorParam colorParam) {
+ return new Rose().getHtmlColor(skinParam, colorParam);
+ }
+
+ public ConcurrentStateImage(Collection images, char concurrentSeparator, ISkinParam skinParam,
+ HtmlColor backColor) {
+ this.separator = Separator.fromChar(concurrentSeparator);
+ this.skinParam = skinParam;
+ this.backColor = skinParam.getBackgroundColor();
+ this.inners.addAll(images);
+ }
+
+ public void drawU(UGraphic ug) {
+ System.err.println("drawing " + inners.size());
+ final HtmlColor dotColor = getColor(ColorParam.stateBorder);
+ final StringBounder stringBounder = ug.getStringBounder();
+ final Dimension2D dimTotal = calculateDimension(stringBounder);
+
+ for (int i = 0; i < inners.size(); i++) {
+ final IEntityImage inner = inners.get(i);
+ inner.drawU(ug);
+ final Dimension2D dim = inner.calculateDimension(stringBounder);
+ ug = ug.apply(separator.move(dim));
+ if (i < inners.size() - 1) {
+ separator.drawSeparator(ug.apply(new UChangeColor(dotColor)), dimTotal);
+ }
+ }
+
+ }
+
+ public Dimension2D calculateDimension(StringBounder stringBounder) {
+ Dimension2D result = new Dimension2DDouble(0, 0);
+ for (IEntityImage inner : inners) {
+ final Dimension2D dim = inner.calculateDimension(stringBounder);
+ result = separator.add(result, dim);
+ }
+ return result;
+ }
+
+ public HtmlColor getBackcolor() {
+ return backColor;
+ }
+
+ public boolean isHidden() {
+ return false;
+ }
+
+ public int getShield() {
+ return 0;
+ }
+
+ public ShapeType getShapeType() {
+ return ShapeType.RECTANGLE;
+ }
+}
diff --git a/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek.java b/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek.java
index 5e07a8835..ae875ae49 100644
--- a/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek.java
+++ b/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek.java
@@ -42,34 +42,22 @@ import java.util.List;
import net.sourceforge.plantuml.AnnotatedWorker;
import net.sourceforge.plantuml.BaseFile;
import net.sourceforge.plantuml.FileFormatOption;
-import net.sourceforge.plantuml.FontParam;
-import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.NamedOutputStream;
import net.sourceforge.plantuml.Scale;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
import net.sourceforge.plantuml.cucadiagram.Link;
-import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.cucadiagram.dot.CucaDiagramSimplifierActivity;
import net.sourceforge.plantuml.cucadiagram.dot.CucaDiagramSimplifierState;
import net.sourceforge.plantuml.cucadiagram.dot.DotData;
-import net.sourceforge.plantuml.graphic.HtmlColor;
-import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.StringBounderUtils;
import net.sourceforge.plantuml.ugraphic.ImageBuilder;
-import net.sourceforge.plantuml.ugraphic.UFont;
public final class CucaDiagramFileMakerSvek implements CucaDiagramFileMaker {
private final CucaDiagram diagram;
- static private final StringBounder stringBounder;
-
- static {
- stringBounder = StringBounderUtils.asStringBounder();
- }
-
public CucaDiagramFileMakerSvek(CucaDiagram diagram) throws IOException {
this.diagram = diagram;
}
@@ -84,14 +72,12 @@ public final class CucaDiagramFileMakerSvek implements CucaDiagramFileMaker {
}
}
- private CucaDiagramFileMakerSvek2 buildCucaDiagramFileMakerSvek2(DotMode dotMode) {
+ private DotDataImageBuilder createDotDataImageBuilder(DotMode dotMode) {
final DotData dotData = new DotData(diagram.getEntityFactory().getRootGroup(), getOrderedLinks(),
diagram.getLeafsvalues(), diagram.getUmlDiagramType(), diagram.getSkinParam(), diagram, diagram,
diagram.getColorMapper(), diagram.getEntityFactory(), diagram.isHideEmptyDescriptionForState(),
dotMode, diagram.getNamespaceSeparator(), diagram.getPragma());
- final CucaDiagramFileMakerSvek2 svek2 = new CucaDiagramFileMakerSvek2(dotData, diagram.getEntityFactory(),
- diagram.getSource(), diagram.getPragma());
- return svek2;
+ return new DotDataImageBuilder(dotData, diagram.getEntityFactory(), diagram.getSource(), diagram.getPragma());
}
@@ -104,27 +90,26 @@ public final class CucaDiagramFileMakerSvek implements CucaDiagramFileMaker {
}
// System.err.println("FOO11 type=" + os.getClass());
- CucaDiagramFileMakerSvek2 svek2 = buildCucaDiagramFileMakerSvek2(DotMode.NORMAL);
+ DotDataImageBuilder svek2 = createDotDataImageBuilder(DotMode.NORMAL);
BaseFile basefile = null;
if (fileFormatOption.isDebugSvek() && os instanceof NamedOutputStream) {
basefile = ((NamedOutputStream) os).getBasefile();
}
// System.err.println("FOO11 basefile=" + basefile);
- TextBlockBackcolored result = svek2.createFile(basefile, diagram.getDotStringSkek());
+ TextBlockBackcolored result = svek2.buildImage(basefile, diagram.getDotStringSkek());
if (result instanceof GraphvizCrash) {
- svek2 = buildCucaDiagramFileMakerSvek2(DotMode.NO_LEFT_RIGHT);
- result = svek2.createFile(basefile, diagram.getDotStringSkek());
+ svek2 = createDotDataImageBuilder(DotMode.NO_LEFT_RIGHT);
+ result = svek2.buildImage(basefile, diagram.getDotStringSkek());
}
result = new AnnotatedWorker(diagram, diagram.getSkinParam()).addAdd(result);
final String widthwarning = diagram.getSkinParam().getValue("widthwarning");
+ String warningOrError = null;
if (widthwarning != null && widthwarning.matches("\\d+")) {
- this.warningOrError = svek2.getBibliotekon().getWarningOrError(Integer.parseInt(widthwarning));
- } else {
- this.warningOrError = null;
+ warningOrError = svek2.getWarningOrError(Integer.parseInt(widthwarning));
}
- final Dimension2D dim = result.calculateDimension(stringBounder);
+ final Dimension2D dim = result.calculateDimension(StringBounderUtils.asStringBounder());
final double scale = getScale(fileFormatOption, dim);
final ImageBuilder imageBuilder = new ImageBuilder(diagram.getSkinParam().getColorMapper(), scale,
@@ -161,22 +146,6 @@ public final class CucaDiagramFileMakerSvek implements CucaDiagramFileMaker {
result.add(link);
}
- private String warningOrError;
-
- private String getWarningOrError() {
- return warningOrError;
- }
-
- private final UFont getFont(FontParam fontParam) {
- final ISkinParam skinParam = diagram.getSkinParam();
- return skinParam.getFont(null, false, fontParam);
- }
-
- private final HtmlColor getFontColor(FontParam fontParam, Stereotype stereo) {
- final ISkinParam skinParam = diagram.getSkinParam();
- return skinParam.getFontHtmlColor(stereo, fontParam);
- }
-
private double getScale(FileFormatOption fileFormatOption, final Dimension2D dim) {
final double scale;
final Scale diagScale = diagram.getScale();
diff --git a/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek2InternalImage.java b/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek2InternalImage.java
index d7a3f1210..539513e75 100644
--- a/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek2InternalImage.java
+++ b/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek2InternalImage.java
@@ -34,14 +34,11 @@
package net.sourceforge.plantuml.svek;
import java.awt.geom.Dimension2D;
-import java.util.ArrayList;
-import java.util.Collection;
import java.util.List;
import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.ISkinParam;
-import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.StringBounder;
@@ -54,10 +51,9 @@ import net.sourceforge.plantuml.ugraphic.UTranslate;
public final class CucaDiagramFileMakerSvek2InternalImage extends AbstractTextBlock implements IEntityImage {
- private final List inners = new ArrayList();
+ private final List inners;
private final Separator separator;
private final ISkinParam skinParam;
- private final HtmlColor backColor;
static enum Separator {
VERTICAL, HORIZONTAL;
@@ -105,14 +101,11 @@ public final class CucaDiagramFileMakerSvek2InternalImage extends AbstractTextBl
return new Rose().getHtmlColor(skinParam, colorParam);
}
- public CucaDiagramFileMakerSvek2InternalImage(Collection leafs, char concurrentSeparator,
- ISkinParam skinParam, HtmlColor backColor) {
+ public CucaDiagramFileMakerSvek2InternalImage(List inners, char concurrentSeparator,
+ ISkinParam skinParam) {
this.separator = Separator.fromChar(concurrentSeparator);
this.skinParam = skinParam;
- this.backColor = backColor;
- for (ILeaf inner : leafs) {
- inners.add(inner.getSvekImage());
- }
+ this.inners = inners;
}
public void drawU(UGraphic ug) {
@@ -142,7 +135,7 @@ public final class CucaDiagramFileMakerSvek2InternalImage extends AbstractTextBl
}
public HtmlColor getBackcolor() {
- return backColor;
+ return skinParam.getBackgroundColor();
}
public boolean isHidden() {
diff --git a/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek2.java b/src/net/sourceforge/plantuml/svek/DotDataImageBuilder.java
similarity index 87%
rename from src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek2.java
rename to src/net/sourceforge/plantuml/svek/DotDataImageBuilder.java
index f06de11de..6efa56b29 100644
--- a/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek2.java
+++ b/src/net/sourceforge/plantuml/svek/DotDataImageBuilder.java
@@ -39,6 +39,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -54,6 +55,7 @@ import net.sourceforge.plantuml.SkinParamSameClassWidth;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.core.UmlSource;
+import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.EntityPortion;
import net.sourceforge.plantuml.cucadiagram.EntityPosition;
@@ -69,6 +71,7 @@ import net.sourceforge.plantuml.cucadiagram.PortionShower;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.cucadiagram.UnparsableGraphvizException;
import net.sourceforge.plantuml.cucadiagram.dot.DotData;
+import net.sourceforge.plantuml.cucadiagram.dot.ExeState;
import net.sourceforge.plantuml.cucadiagram.dot.GraphvizVersion;
import net.sourceforge.plantuml.cucadiagram.dot.Neighborhood;
import net.sourceforge.plantuml.cucadiagram.entity.EntityFactory;
@@ -112,14 +115,13 @@ import net.sourceforge.plantuml.svek.image.EntityImageTips;
import net.sourceforge.plantuml.svek.image.EntityImageUseCase;
import net.sourceforge.plantuml.ugraphic.sprite.Sprite;
-public final class CucaDiagramFileMakerSvek2 {
-
- private final ColorSequence colorSequence = new ColorSequence();
+public final class DotDataImageBuilder {
private final DotData dotData;
private final EntityFactory entityFactory;
private final UmlSource source;
private final Pragma pragma;
+ private Map maxX;
static private final StringBounder stringBounder;
@@ -127,32 +129,19 @@ public final class CucaDiagramFileMakerSvek2 {
stringBounder = StringBounderUtils.asStringBounder();
}
- public CucaDiagramFileMakerSvek2(DotData dotData, EntityFactory entityFactory, UmlSource source, Pragma pragma) {
+ public DotDataImageBuilder(DotData dotData, EntityFactory entityFactory, UmlSource source, Pragma pragma) {
this.dotData = dotData;
this.entityFactory = entityFactory;
this.source = source;
this.pragma = pragma;
}
- private DotStringFactory dotStringFactory;
-
- public Bibliotekon getBibliotekon() {
- return dotStringFactory.getBibliotekon();
- }
-
- public IEntityImage createFileForConcurrentState() {
- return new CucaDiagramFileMakerSvek2InternalImage(dotData.getLeafs(), dotData.getTopParent()
- .getConcurrentSeparator(), dotData.getSkinParam(), dotData.getSkinParam().getBackgroundColor());
-
- }
-
- public IEntityImage createFile(BaseFile basefile, String dotStrings[]) {
-
+ public IEntityImage buildImage(BaseFile basefile, String dotStrings[]) {
dotData.removeIrrelevantSametail();
- dotStringFactory = new DotStringFactory(colorSequence, stringBounder, dotData);
+ final DotStringFactory dotStringFactory = new DotStringFactory(stringBounder, dotData);
- printGroups(dotData.getRootGroup());
- printEntities(getUnpackagedEntities());
+ printGroups(dotStringFactory, dotData.getRootGroup());
+ printEntities(dotStringFactory, getUnpackagedEntities());
for (Link link : dotData.getLinks()) {
if (link.isRemoved()) {
@@ -162,23 +151,23 @@ public final class CucaDiagramFileMakerSvek2 {
final ISkinParam skinParam = dotData.getSkinParam();
final FontConfiguration labelFont = new FontConfiguration(skinParam, FontParam.GENERIC_ARROW, null);
- final Line line = new Line(link, colorSequence, skinParam, stringBounder, labelFont, getBibliotekon(),
- dotData.getPragma());
+ final Line line = new Line(link, dotStringFactory.getColorSequence(), skinParam, stringBounder,
+ labelFont, dotStringFactory.getBibliotekon(), dotData.getPragma());
- getBibliotekon().addLine(line);
+ dotStringFactory.getBibliotekon().addLine(line);
if (link.getEntity1().isGroup() == false && link.getEntity1().getEntityType() == LeafType.NOTE
&& onlyOneLink(link.getEntity1())) {
- final Shape shape = getBibliotekon().getShape(link.getEntity1());
- final Shape other = getBibliotekon().getShape(link.getEntity2());
+ final Shape shape = dotStringFactory.getBibliotekon().getShape(link.getEntity1());
+ final Shape other = dotStringFactory.getBibliotekon().getShape(link.getEntity2());
if (other != null) {
((EntityImageNote) shape.getImage()).setOpaleLine(line, shape, other);
line.setOpale(true);
}
} else if (link.getEntity2().isGroup() == false && link.getEntity2().getEntityType() == LeafType.NOTE
&& onlyOneLink(link.getEntity2())) {
- final Shape shape = getBibliotekon().getShape(link.getEntity2());
- final Shape other = getBibliotekon().getShape(link.getEntity1());
+ final Shape shape = dotStringFactory.getBibliotekon().getShape(link.getEntity2());
+ final Shape other = dotStringFactory.getBibliotekon().getShape(link.getEntity1());
if (other != null) {
((EntityImageNote) shape.getImage()).setOpaleLine(line, shape, other);
line.setOpale(true);
@@ -219,6 +208,7 @@ public final class CucaDiagramFileMakerSvek2 {
}
final SvekResult result = new SvekResult(position, dotData, dotStringFactory);
result.moveSvek(6 - minX, -minY);
+ this.maxX = dotStringFactory.getBibliotekon().getMaxX();
return result;
} catch (Exception e) {
Log.error("Exception " + e);
@@ -261,17 +251,8 @@ public final class CucaDiagramFileMakerSvek2 {
final List msg = new ArrayList();
msg.add("Dot Executable: " + dotExe);
- if (dotExe != null) {
- if (dotExe.exists() == false) {
- msg.add("File does not exist");
- } else if (dotExe.isDirectory()) {
- msg.add("It should be an executable, not a directory");
- } else if (dotExe.isFile() == false) {
- msg.add("Not a valid file");
- } else if (dotExe.canRead() == false) {
- msg.add("File cannot be read");
- }
- }
+ final ExeState exeState = ExeState.checkFile(dotExe);
+ msg.add(exeState.getTextMessage());
msg.add("Cannot find Graphviz. You should try");
msg.add(" ");
msg.add("@startuml");
@@ -285,45 +266,46 @@ public final class CucaDiagramFileMakerSvek2 {
return GraphicStrings.createDefault(msg, false);
}
- private void printEntities(Collection entities2) {
+ private void printEntities(DotStringFactory dotStringFactory, Collection entities2) {
for (ILeaf ent : entities2) {
if (ent.isRemoved()) {
continue;
}
- printEntity(ent);
+ printEntity(dotStringFactory, ent);
}
}
- private void printEntity(ILeaf ent) {
+ private void printEntity(DotStringFactory dotStringFactory, ILeaf ent) {
if (ent.isRemoved()) {
throw new IllegalStateException();
}
- final IEntityImage image = printEntityInternal(ent);
+ final IEntityImage image = printEntityInternal(dotStringFactory, ent);
final Dimension2D dim = image.calculateDimension(stringBounder);
- final Shape shape = new Shape(image, image.getShapeType(), dim.getWidth(), dim.getHeight(), colorSequence,
- ent.isTop(), image.getShield(), ent.getEntityPosition());
+ final Shape shape = new Shape(image, image.getShapeType(), dim.getWidth(), dim.getHeight(),
+ dotStringFactory.getColorSequence(), ent.isTop(), image.getShield(), ent.getEntityPosition());
dotStringFactory.addShape(shape);
- getBibliotekon().putShape(ent, shape);
+ dotStringFactory.getBibliotekon().putShape(ent, shape);
}
- private IEntityImage printEntityInternal(ILeaf ent) {
+ private IEntityImage printEntityInternal(DotStringFactory dotStringFactory, ILeaf ent) {
if (ent.isRemoved()) {
throw new IllegalStateException();
}
if (ent.getSvekImage() == null) {
ISkinParam skinParam = dotData.getSkinParam();
if (skinParam.sameClassWidth()) {
- final double width = getMaxWidth();
+ final double width = getMaxWidth(dotStringFactory);
skinParam = new SkinParamSameClassWidth(skinParam, width);
}
return createEntityImageBlock(ent, skinParam, dotData.isHideEmptyDescriptionForState(), dotData,
- getBibliotekon(), dotStringFactory.getGraphvizVersion(), dotData.getUmlDiagramType());
+ dotStringFactory.getBibliotekon(), dotStringFactory.getGraphvizVersion(),
+ dotData.getUmlDiagramType());
}
return ent.getSvekImage();
}
- private double getMaxWidth() {
+ private double getMaxWidth(DotStringFactory dotStringFactory) {
double result = 0;
for (ILeaf ent : dotData.getLeafs()) {
if (ent.getEntityType().isLikeClass() == false) {
@@ -453,7 +435,7 @@ public final class CucaDiagramFileMakerSvek2 {
return result;
}
- private void printGroups(IGroup parent) {
+ private void printGroups(DotStringFactory dotStringFactory, IGroup parent) {
for (IGroup g : dotData.getGroupHierarchy().getChildrenGroups(parent)) {
if (g.isRemoved()) {
continue;
@@ -473,14 +455,14 @@ public final class CucaDiagramFileMakerSvek2 {
folder.setSpecificColorTOBEREMOVED(ColorType.BACK,
g.getColors(dotData.getSkinParam()).getColor(ColorType.BACK));
}
- printEntity(folder);
+ printEntity(dotStringFactory, folder);
} else {
- printGroup(g);
+ printGroup(dotStringFactory, g);
}
}
}
- private void printGroup(IGroup g) {
+ private void printGroup(DotStringFactory dotStringFactory, IGroup g) {
if (g.getGroupType() == GroupType.CONCURRENT_STATE) {
return;
}
@@ -513,9 +495,9 @@ public final class CucaDiagramFileMakerSvek2 {
}
dotStringFactory.openCluster(g, titleAndAttributeWidth, titleAndAttributeHeight, title, stereo);
- this.printEntities(g.getLeafsDirect());
+ this.printEntities(dotStringFactory, g.getLeafsDirect());
- printGroups(g);
+ printGroups(dotStringFactory, g);
dotStringFactory.closeCluster();
}
@@ -555,4 +537,18 @@ public final class CucaDiagramFileMakerSvek2 {
return Display.create(stereos).create(new FontConfiguration(dotData.getSkinParam(), fontParam, stereotype),
HorizontalAlignment.CENTER, dotData.getSkinParam());
}
+
+ public String getWarningOrError(int warningOrError) {
+ if (maxX == null) {
+ return "";
+ }
+ final StringBuilder sb = new StringBuilder();
+ for (Map.Entry ent : maxX.entrySet()) {
+ if (ent.getValue() > warningOrError) {
+ sb.append(ent.getKey() + " is overpassing the width limit.");
+ sb.append("\n");
+ }
+ }
+ return sb.length() == 0 ? "" : sb.toString();
+ }
}
diff --git a/src/net/sourceforge/plantuml/svek/DotStringFactory.java b/src/net/sourceforge/plantuml/svek/DotStringFactory.java
index e168fdf96..43aca3ca2 100644
--- a/src/net/sourceforge/plantuml/svek/DotStringFactory.java
+++ b/src/net/sourceforge/plantuml/svek/DotStringFactory.java
@@ -80,23 +80,23 @@ public class DotStringFactory implements Moveable {
private final StringBounder stringBounder;
- public DotStringFactory(ColorSequence colorSequence, StringBounder stringBounder, DotData dotData) {
+ public DotStringFactory(StringBounder stringBounder, DotData dotData) {
this.skinParam = dotData.getSkinParam();
this.umlDiagramType = dotData.getUmlDiagramType();
this.dotMode = dotData.getDotMode();
- this.colorSequence = colorSequence;
+ this.colorSequence = new ColorSequence();
this.stringBounder = stringBounder;
this.root = new Cluster(colorSequence, skinParam, dotData.getRootGroup());
this.current = root;
}
- public DotStringFactory(ColorSequence colorSequence, StringBounder stringBounder, CucaDiagram diagram) {
+ public DotStringFactory(StringBounder stringBounder, CucaDiagram diagram) {
this.skinParam = diagram.getSkinParam();
this.umlDiagramType = diagram.getUmlDiagramType();
this.dotMode = DotMode.NORMAL;
- this.colorSequence = colorSequence;
+ this.colorSequence = new ColorSequence();
this.stringBounder = stringBounder;
this.root = new Cluster(colorSequence, skinParam, diagram.getEntityFactory().getRootGroup());
this.current = root;
diff --git a/src/net/sourceforge/plantuml/svek/GroupPngMakerActivity.java b/src/net/sourceforge/plantuml/svek/GroupPngMakerActivity.java
index c72033437..7dd0366d1 100644
--- a/src/net/sourceforge/plantuml/svek/GroupPngMakerActivity.java
+++ b/src/net/sourceforge/plantuml/svek/GroupPngMakerActivity.java
@@ -111,7 +111,7 @@ public final class GroupPngMakerActivity {
skinParam, new InnerGroupHierarchy(), diagram.getColorMapper(), diagram.getEntityFactory(), false,
DotMode.NORMAL, diagram.getNamespaceSeparator(), diagram.getPragma());
- final CucaDiagramFileMakerSvek2 svek2 = new CucaDiagramFileMakerSvek2(dotData, diagram.getEntityFactory(),
+ final DotDataImageBuilder svek2 = new DotDataImageBuilder(dotData, diagram.getEntityFactory(),
diagram.getSource(), diagram.getPragma());
if (group.getGroupType() == GroupType.INNER_ACTIVITY) {
@@ -119,7 +119,7 @@ public final class GroupPngMakerActivity {
final HtmlColor borderColor = getColor(ColorParam.activityBorder, stereo);
final HtmlColor backColor = group.getColors(skinParam).getColor(ColorType.BACK) == null ? getColor(
ColorParam.background, stereo) : group.getColors(skinParam).getColor(ColorType.BACK);
- return new InnerActivity(svek2.createFile(null, new String[0]), borderColor, backColor, skinParam.shadowing());
+ return new InnerActivity(svek2.buildImage(null, new String[0]), borderColor, backColor, skinParam.shadowing());
}
throw new UnsupportedOperationException(group.getGroupType().toString());
diff --git a/src/net/sourceforge/plantuml/svek/GroupPngMakerState.java b/src/net/sourceforge/plantuml/svek/GroupPngMakerState.java
index 0acb25111..f11e49e1d 100644
--- a/src/net/sourceforge/plantuml/svek/GroupPngMakerState.java
+++ b/src/net/sourceforge/plantuml/svek/GroupPngMakerState.java
@@ -63,7 +63,6 @@ import net.sourceforge.plantuml.graphic.TextBlockWidth;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.svek.image.EntityImageState;
-import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UStroke;
public final class GroupPngMakerState {
@@ -116,55 +115,61 @@ public final class GroupPngMakerState {
}
final List links = getPureInnerLinks();
- // boolean hasVerticalLine = false;
- // for (ILeaf leaf : group.getLeafsDirect()) {
- // if (leaf.getEntityType() == LeafType.STATE_CONCURRENT) {
- // hasVerticalLine = true;
- // }
- // }
-
final DotData dotData = new DotData(group, links, group.getLeafsDirect(), diagram.getUmlDiagramType(),
skinParam, new InnerGroupHierarchy(), diagram.getColorMapper(), diagram.getEntityFactory(),
diagram.isHideEmptyDescriptionForState(), DotMode.NORMAL, diagram.getNamespaceSeparator(),
diagram.getPragma());
- final CucaDiagramFileMakerSvek2 svek2 = new CucaDiagramFileMakerSvek2(dotData, diagram.getEntityFactory(),
+ final DotDataImageBuilder svek2 = new DotDataImageBuilder(dotData, diagram.getEntityFactory(),
diagram.getSource(), diagram.getPragma());
+
+ if (group.getGroupType() == GroupType.CONCURRENT_STATE) {
+ // return new InnerStateConcurrent(svek2.createFile());
+ return svek2.buildImage(null, new String[0]);
+ }
+
+ if (group.getGroupType() != GroupType.STATE) {
+ throw new UnsupportedOperationException(group.getGroupType().toString());
+ }
+
+ HtmlColor borderColor = group.getColors(skinParam).getColor(ColorType.LINE);
+ if (borderColor == null) {
+ borderColor = getColor(ColorParam.stateBorder, group.getStereotype());
+ }
+ final Stereotype stereo = group.getStereotype();
+ final HtmlColor backColor = group.getColors(skinParam).getColor(ColorType.BACK) == null ? getColor(
+ ColorParam.stateBackground, stereo) : group.getColors(skinParam).getColor(ColorType.BACK);
+ final List members = ((IEntity) group).getBodier().getFieldsToDisplay();
+ final TextBlockWidth attribute;
+ if (members.size() == 0) {
+ attribute = new TextBlockEmpty();
+ } else {
+ attribute = new MethodsOrFieldsArea(members, FontParam.STATE_ATTRIBUTE, diagram.getSkinParam(),
+ group.getStereotype());
+ }
+
+ final Stereotype stereotype = group.getStereotype();
+ final boolean withSymbol = stereotype != null && stereotype.isWithOOSymbol();
+
+ final boolean containsOnlyConcurrentStates = containsOnlyConcurrentStates(dotData);
+ final IEntityImage image = containsOnlyConcurrentStates ? buildImageForConcurrentState(dotData) : svek2
+ .buildImage(null, new String[0]);
UStroke stroke = group.getColors(skinParam).getSpecificLineStroke();
if (stroke == null) {
stroke = new UStroke(1.5);
}
+ return new InnerStateAutonom(image, title, attribute, borderColor, backColor, skinParam.shadowing(),
+ group.getUrl99(), withSymbol, stroke);
- if (group.getGroupType() == GroupType.CONCURRENT_STATE) {
- // return new InnerStateConcurrent(svek2.createFile());
- return svek2.createFile(null, new String[0]);
- } else if (group.getGroupType() == GroupType.STATE) {
- HtmlColor borderColor = group.getColors(skinParam).getColor(ColorType.LINE);
- if (borderColor == null) {
- borderColor = getColor(ColorParam.stateBorder, group.getStereotype());
- }
- final Stereotype stereo = group.getStereotype();
- final HtmlColor backColor = group.getColors(skinParam).getColor(ColorType.BACK) == null ? getColor(
- ColorParam.stateBackground, stereo) : group.getColors(skinParam).getColor(ColorType.BACK);
- final List members = ((IEntity) group).getBodier().getFieldsToDisplay();
- final TextBlockWidth attribute;
- if (members.size() == 0) {
- attribute = new TextBlockEmpty();
- } else {
- attribute = new MethodsOrFieldsArea(members, FontParam.STATE_ATTRIBUTE, diagram.getSkinParam(), group.getStereotype());
- }
+ }
- final Stereotype stereotype = group.getStereotype();
- final boolean withSymbol = stereotype != null && stereotype.isWithOOSymbol();
-
- final boolean containsOnlyConcurrentStates = containsOnlyConcurrentStates(dotData);
- final IEntityImage image = containsOnlyConcurrentStates ? svek2.createFileForConcurrentState() : svek2
- .createFile(null, new String[0]);
- return new InnerStateAutonom(image, title, attribute, borderColor, backColor, skinParam.shadowing(),
- group.getUrl99(), withSymbol, stroke);
+ private IEntityImage buildImageForConcurrentState(DotData dotData) {
+ final List inners = new ArrayList();
+ for (ILeaf inner : dotData.getLeafs()) {
+ inners.add(inner.getSvekImage());
}
-
- throw new UnsupportedOperationException(group.getGroupType().toString());
+ return new CucaDiagramFileMakerSvek2InternalImage(inners, dotData.getTopParent().getConcurrentSeparator(),
+ dotData.getSkinParam());
}
@@ -180,14 +185,9 @@ public final class GroupPngMakerState {
return true;
}
- private UFont getFont(FontParam fontParam) {
- final ISkinParam skinParam = diagram.getSkinParam();
- return skinParam.getFont(null, false, fontParam);
- }
-
private final Rose rose = new Rose();
- protected final HtmlColor getColor(ColorParam colorParam, Stereotype stereo) {
+ private HtmlColor getColor(ColorParam colorParam, Stereotype stereo) {
final ISkinParam skinParam = diagram.getSkinParam();
return rose.getHtmlColor(skinParam, colorParam, stereo);
}
diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageClass.java b/src/net/sourceforge/plantuml/svek/image/EntityImageClass.java
index faa4d9dcf..4a989b7e4 100644
--- a/src/net/sourceforge/plantuml/svek/image/EntityImageClass.java
+++ b/src/net/sourceforge/plantuml/svek/image/EntityImageClass.java
@@ -60,6 +60,7 @@ import net.sourceforge.plantuml.svek.WithPorts;
import net.sourceforge.plantuml.ugraphic.Shadowable;
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.UGraphicStencil;
import net.sourceforge.plantuml.ugraphic.URectangle;
@@ -115,6 +116,7 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil, Wi
}
final public void drawU(UGraphic ug) {
+ ug.draw(new UComment("class " + getEntity().getCode().getFullName()));
if (url != null) {
ug.startUrl(url);
}
diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageClassHeader2.java b/src/net/sourceforge/plantuml/svek/image/EntityImageClassHeader2.java
index bf8310219..d2cbb1b3e 100644
--- a/src/net/sourceforge/plantuml/svek/image/EntityImageClassHeader2.java
+++ b/src/net/sourceforge/plantuml/svek/image/EntityImageClassHeader2.java
@@ -53,6 +53,9 @@ import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockGeneric;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
+import net.sourceforge.plantuml.graphic.VerticalAlignment;
+import net.sourceforge.plantuml.skin.VisibilityModifier;
+import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.svek.AbstractEntityImage;
import net.sourceforge.plantuml.svek.HeaderLayout;
import net.sourceforge.plantuml.svek.ShapeType;
@@ -76,9 +79,20 @@ public class EntityImageClassHeader2 extends AbstractEntityImage {
if (italic) {
fontConfigurationName = fontConfigurationName.italic();
}
- final TextBlock name = TextBlockUtils.withMargin(
- entity.getDisplay().createWithNiceCreoleMode(fontConfigurationName, HorizontalAlignment.CENTER,
- skinParam), 3, 3, 0, 0);
+ TextBlock name = entity.getDisplay().createWithNiceCreoleMode(fontConfigurationName,
+ HorizontalAlignment.CENTER, skinParam);
+ final VisibilityModifier modifier = entity.getVisibilityModifier();
+ if (modifier == null) {
+ name = TextBlockUtils.withMargin(name, 3, 3, 0, 0);
+ } else {
+ final Rose rose = new Rose();
+ final HtmlColor back = rose.getHtmlColor(skinParam, modifier.getBackground());
+ final HtmlColor fore = rose.getHtmlColor(skinParam, modifier.getForeground());
+
+ final TextBlock uBlock = modifier.getUBlock(skinParam.classAttributeIconSize(), fore, back);
+ name = TextBlockUtils.mergeLR(uBlock, name, VerticalAlignment.CENTER);
+ name = TextBlockUtils.withMargin(name, 3, 3, 0, 0);
+ }
final TextBlock stereo;
if (stereotype == null || stereotype.getLabel(false) == null
diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java b/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java
index aa145f1bc..a1ffa1831 100644
--- a/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java
+++ b/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java
@@ -57,6 +57,7 @@ import net.sourceforge.plantuml.graphic.USymbolFolder;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.svek.AbstractEntityImage;
import net.sourceforge.plantuml.svek.ShapeType;
+import net.sourceforge.plantuml.ugraphic.UComment;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UStroke;
@@ -125,6 +126,7 @@ public class EntityImageDescription extends AbstractEntityImage {
}
final public void drawU(UGraphic ug) {
+ ug.draw(new UComment("entity " + getEntity().getCode().getFullName()));
if (url != null) {
ug.startUrl(url);
}
diff --git a/src/net/sourceforge/plantuml/svg/SvgGraphics.java b/src/net/sourceforge/plantuml/svg/SvgGraphics.java
index ca538c108..ddcc6cd5b 100644
--- a/src/net/sourceforge/plantuml/svg/SvgGraphics.java
+++ b/src/net/sourceforge/plantuml/svg/SvgGraphics.java
@@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
- * Revision $Revision: 20096 $
+ * Revision $Revision: 20128 $
*
*/
package net.sourceforge.plantuml.svg;
@@ -65,6 +65,7 @@ import net.sourceforge.plantuml.ugraphic.UPath;
import net.sourceforge.plantuml.ugraphic.USegment;
import net.sourceforge.plantuml.ugraphic.USegmentType;
+import org.w3c.dom.Comment;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -128,14 +129,26 @@ public class SvgGraphics {
gRoot = simpleElement("g");
strokeWidth = "" + scale;
final Random rnd = new Random();
- this.filterUid = "b" + Integer.toString(Math.abs(rnd.nextInt()), 36);
- this.shadowId = "f" + Integer.toString(Math.abs(rnd.nextInt()), 36);
+ this.filterUid = "b" + getRandomString(rnd);
+ this.shadowId = "f" + getRandomString(rnd);
} catch (ParserConfigurationException e) {
e.printStackTrace();
throw new IllegalStateException(e);
}
}
+ private static String getRandomString(final Random rnd) {
+ String result = Integer.toString(Math.abs(rnd.nextInt()), 36);
+ while (result.length() < 6) {
+ result = "0" + result;
+ }
+ return result;
+ }
+
+ public static void main(String[] args) {
+ System.err.println(getRandomString(new Random()));
+ }
+
private Element pendingBackground;
public void paintBackcolorGradient(ColorMapper mapper, HtmlColorGradient gr) {
@@ -735,4 +748,9 @@ public class SvgGraphics {
this.hidden = hidden;
}
+ public void addComment(String comment) {
+ final Comment commentElement = document.createComment(comment);
+ getG().appendChild(commentElement);
+ }
+
}
diff --git a/src/net/sourceforge/plantuml/ugraphic/AbstractUGraphic.java b/src/net/sourceforge/plantuml/ugraphic/AbstractUGraphic.java
index 1e048da03..c067b1b5d 100644
--- a/src/net/sourceforge/plantuml/ugraphic/AbstractUGraphic.java
+++ b/src/net/sourceforge/plantuml/ugraphic/AbstractUGraphic.java
@@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
- * Revision $Revision: 19109 $
+ * Revision $Revision: 20127 $
*
*/
package net.sourceforge.plantuml.ugraphic;
@@ -69,6 +69,10 @@ public abstract class AbstractUGraphic extends AbstractCommonUGraphic {
if (shape instanceof UEmpty) {
return;
}
+ if (shape instanceof UComment) {
+ drawComment((UComment) shape);
+ return;
+ }
final UDriver driver = drivers.get(shape.getClass());
if (driver == null) {
throw new UnsupportedOperationException(shape.getClass().toString() + " " + this.getClass());
@@ -87,6 +91,9 @@ public abstract class AbstractUGraphic extends AbstractCommonUGraphic {
afterDraw();
}
+ protected void drawComment(UComment shape) {
+ }
+
protected void beforeDraw() {
}
diff --git a/src/net/sourceforge/plantuml/ugraphic/ImageBuilder.java b/src/net/sourceforge/plantuml/ugraphic/ImageBuilder.java
index a61ace881..33d71c375 100644
--- a/src/net/sourceforge/plantuml/ugraphic/ImageBuilder.java
+++ b/src/net/sourceforge/plantuml/ugraphic/ImageBuilder.java
@@ -63,6 +63,7 @@ import net.sourceforge.plantuml.anim.AffineTransformation;
import net.sourceforge.plantuml.anim.Animation;
import net.sourceforge.plantuml.api.ImageDataComplex;
import net.sourceforge.plantuml.api.ImageDataSimple;
+import net.sourceforge.plantuml.braille.UGraphicBraille;
import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.eps.EpsStrategy;
import net.sourceforge.plantuml.graphic.HtmlColor;
@@ -96,8 +97,7 @@ public class ImageBuilder {
private UDrawable udrawable;
public ImageBuilder(ColorMapper colorMapper, double dpiFactor, HtmlColor mybackcolor, String metadata,
- String warningOrError, double margin1, double margin2, Animation animation,
- boolean useHandwritten) {
+ String warningOrError, double margin1, double margin2, Animation animation, boolean useHandwritten) {
this.colorMapper = colorMapper;
this.dpiFactor = dpiFactor;
this.mybackcolor = mybackcolor;
@@ -242,8 +242,8 @@ public class ImageBuilder {
return im;
}
- private UGraphic2 createUGraphic(FileFormatOption fileFormatOption, final Dimension2D dim,
- Animation animationArg, double dx, double dy) {
+ private UGraphic2 createUGraphic(FileFormatOption fileFormatOption, final Dimension2D dim, Animation animationArg,
+ double dx, double dy) {
final FileFormat fileFormat = fileFormatOption.getFileFormat();
switch (fileFormat) {
case PNG:
@@ -262,6 +262,8 @@ public class ImageBuilder {
return new UGraphicTikz(colorMapper, true);
case LATEX_NO_PREAMBLE:
return new UGraphicTikz(colorMapper, false);
+ case BRAILLE_PNG:
+ return new UGraphicBraille(colorMapper, fileFormat);
default:
throw new UnsupportedOperationException(fileFormat.toString());
}
diff --git a/src/net/sourceforge/plantuml/ugraphic/LimitFinder.java b/src/net/sourceforge/plantuml/ugraphic/LimitFinder.java
index 18c89eac3..123f34adc 100644
--- a/src/net/sourceforge/plantuml/ugraphic/LimitFinder.java
+++ b/src/net/sourceforge/plantuml/ugraphic/LimitFinder.java
@@ -121,6 +121,7 @@ public class LimitFinder implements UGraphic {
drawDotPath(x, y, (DotPath) shape);
} else if (shape instanceof UImage) {
drawImage(x, y, (UImage) shape);
+ } else if (shape instanceof UComment) {
} else if (shape instanceof UEmpty) {
drawEmpty(x, y, (UEmpty) shape);
} else if (shape instanceof TextBlock) {
diff --git a/src/net/sourceforge/plantuml/ugraphic/UComment.java b/src/net/sourceforge/plantuml/ugraphic/UComment.java
new file mode 100644
index 000000000..89416af8d
--- /dev/null
+++ b/src/net/sourceforge/plantuml/ugraphic/UComment.java
@@ -0,0 +1,47 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2017, Arnaud Roques
+ *
+ * Project Info: http://plantuml.com
+ *
+ * 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.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * Original Author: Arnaud Roques
+ *
+ * Revision $Revision: 19109 $
+ *
+ */
+package net.sourceforge.plantuml.ugraphic;
+
+public class UComment implements UShape {
+
+ private final String comment;
+
+ public UComment(String comment) {
+ this.comment = comment;
+ }
+
+ public String getComment() {
+ return comment;
+ }
+}
diff --git a/src/net/sourceforge/plantuml/ugraphic/UPolygon.java b/src/net/sourceforge/plantuml/ugraphic/UPolygon.java
index 6b96dc503..c1b76f38e 100644
--- a/src/net/sourceforge/plantuml/ugraphic/UPolygon.java
+++ b/src/net/sourceforge/plantuml/ugraphic/UPolygon.java
@@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
- * Revision $Revision: 19109 $
+ * Revision $Revision: 20186 $
*
*/
package net.sourceforge.plantuml.ugraphic;
@@ -41,19 +41,26 @@ import java.util.List;
public class UPolygon extends AbstractShadowable {
private final List all = new ArrayList();
+ private final String name;
private MinMax minmax = MinMax.getEmpty(false);
public UPolygon() {
+ this((String) null);
}
public UPolygon(List points) {
+ this((String) null);
all.addAll(points);
for (Point2D.Double pt : all) {
manageMinMax(pt.getX(), pt.getY());
}
}
+ public UPolygon(String name) {
+ this.name = name;
+ }
+
public void addPoint(double x, double y) {
all.add(new Point2D.Double(x, y));
manageMinMax(x, y);
@@ -84,6 +91,9 @@ public class UPolygon extends AbstractShadowable {
@Override
public String toString() {
+ if (name != null) {
+ return name;
+ }
return super.toString() + " " + all;
}
diff --git a/src/net/sourceforge/plantuml/ugraphic/UTranslate.java b/src/net/sourceforge/plantuml/ugraphic/UTranslate.java
index 290f5a8b5..2f13c5269 100644
--- a/src/net/sourceforge/plantuml/ugraphic/UTranslate.java
+++ b/src/net/sourceforge/plantuml/ugraphic/UTranslate.java
@@ -94,4 +94,8 @@ public class UTranslate implements UChange {
return new Rectangle2D.Double(rect.getX() + dx, rect.getY() + dy, rect.getWidth(), rect.getHeight());
}
+ public UTranslate multiplyBy(double v) {
+ return new UTranslate(dx * v, dy * v);
+ }
+
}
diff --git a/src/net/sourceforge/plantuml/ugraphic/svg/UGraphicSvg.java b/src/net/sourceforge/plantuml/ugraphic/svg/UGraphicSvg.java
index 7da058353..75d972576 100644
--- a/src/net/sourceforge/plantuml/ugraphic/svg/UGraphicSvg.java
+++ b/src/net/sourceforge/plantuml/ugraphic/svg/UGraphicSvg.java
@@ -47,6 +47,7 @@ import net.sourceforge.plantuml.ugraphic.AbstractUGraphic;
import net.sourceforge.plantuml.ugraphic.ClipContainer;
import net.sourceforge.plantuml.ugraphic.ColorMapper;
import net.sourceforge.plantuml.ugraphic.UCenteredCharacter;
+import net.sourceforge.plantuml.ugraphic.UComment;
import net.sourceforge.plantuml.ugraphic.UEllipse;
import net.sourceforge.plantuml.ugraphic.UGraphic2;
import net.sourceforge.plantuml.ugraphic.UImage;
@@ -159,6 +160,11 @@ public class UGraphicSvg extends AbstractUGraphic implements ClipCo
createXml(os);
}
+ @Override
+ protected void drawComment(UComment comment) {
+ getGraphicObject().addComment(comment.getComment());
+ }
+
// @Override
// public String startHiddenGroup() {
// getGraphicObject().startHiddenGroup();
diff --git a/src/net/sourceforge/plantuml/version/Version.java b/src/net/sourceforge/plantuml/version/Version.java
index e0b48e479..6b719e9df 100644
--- a/src/net/sourceforge/plantuml/version/Version.java
+++ b/src/net/sourceforge/plantuml/version/Version.java
@@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
- * Revision $Revision: 20097 $
+ * Revision $Revision: 20196 $
*
*/
package net.sourceforge.plantuml.version;
@@ -39,7 +39,7 @@ import java.util.Date;
public class Version {
public static int version() {
- return 8045;
+ return 8046;
}
public static String versionString() {
@@ -71,7 +71,7 @@ public class Version {
}
public static long compileTime() {
- return 1467650874144L;
+ return 1469468610162L;
}
public static String compileTimeString() {
diff --git a/src/net/sourceforge/plantuml/vizjs/GraphvizJs.java b/src/net/sourceforge/plantuml/vizjs/GraphvizJs.java
index aba6c78de..5c9b6013d 100644
--- a/src/net/sourceforge/plantuml/vizjs/GraphvizJs.java
+++ b/src/net/sourceforge/plantuml/vizjs/GraphvizJs.java
@@ -41,6 +41,7 @@ import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.ThreadFactory;
+import net.sourceforge.plantuml.cucadiagram.dot.ExeState;
import net.sourceforge.plantuml.cucadiagram.dot.Graphviz;
import net.sourceforge.plantuml.cucadiagram.dot.GraphvizVersion;
import net.sourceforge.plantuml.cucadiagram.dot.ProcessState;
@@ -111,8 +112,8 @@ public class GraphvizJs implements Graphviz {
return "VizJs";
}
- public boolean illegalDotExe() {
- return false;
+ public ExeState getExeState() {
+ return ExeState.OK;
}
public static GraphvizVersion getGraphvizVersion(final boolean modeSafe) {