mirror of
https://github.com/octoleo/plantuml.git
synced 2024-12-22 10:59:01 +00:00
Import version 1.2020.19
This commit is contained in:
parent
58936dc235
commit
c670872511
2
pom.xml
2
pom.xml
@ -35,7 +35,7 @@
|
||||
|
||||
<groupId>net.sourceforge.plantuml</groupId>
|
||||
<artifactId>plantuml</artifactId>
|
||||
<version>1.2020.19-SNAPSHOT</version>
|
||||
<version>1.2020.20-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>PlantUML</name>
|
||||
|
@ -79,6 +79,7 @@ public class Option {
|
||||
private boolean textProgressBar = false;
|
||||
private int nbThreads = 0;
|
||||
private int ftpPort = -1;
|
||||
private int picowebPort = -1;
|
||||
private boolean hideMetadata = false;
|
||||
private boolean checkMetadata = false;
|
||||
private int stdrpt = 0;
|
||||
@ -368,6 +369,13 @@ public class Option {
|
||||
} else {
|
||||
this.ftpPort = Integer.parseInt(s.substring(x + 1));
|
||||
}
|
||||
} else if (StringUtils.goLowerCase(s).startsWith("-picoweb")) {
|
||||
final int x = s.indexOf(':');
|
||||
if (x == -1) {
|
||||
this.picowebPort = 8080;
|
||||
} else {
|
||||
this.picowebPort = Integer.parseInt(s.substring(x + 1));
|
||||
}
|
||||
} else if (s.startsWith("-c")) {
|
||||
s = s.substring(2);
|
||||
config.add(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(s));
|
||||
@ -395,6 +403,10 @@ public class Option {
|
||||
return ftpPort;
|
||||
}
|
||||
|
||||
public int getPicowebPort() {
|
||||
return picowebPort;
|
||||
}
|
||||
|
||||
private void addInConfig(BufferedReader br) throws IOException {
|
||||
if (br == null) {
|
||||
return;
|
||||
|
@ -156,6 +156,7 @@ public class OptionPrint {
|
||||
System.out.println(" -filename \"example.puml\"\tTo override %filename% variable");
|
||||
System.out.println(" -preproc\t\tTo output preprocessor text of diagrams");
|
||||
System.out.println(" -cypher\t\tTo cypher texts of diagrams so that you can share them");
|
||||
System.out.println(" -picoweb\t\tTo start internal HTTP Server. See https://plantuml.com/picoweb");
|
||||
System.out.println();
|
||||
System.out.println("If needed, you can setup the environment variable GRAPHVIZ_DOT.");
|
||||
exit(0);
|
||||
|
@ -62,6 +62,7 @@ import net.sourceforge.plantuml.code.TranscoderUtil;
|
||||
import net.sourceforge.plantuml.command.PSystemCommandFactory;
|
||||
import net.sourceforge.plantuml.descdiagram.DescriptionDiagramFactory;
|
||||
import net.sourceforge.plantuml.ftp.FtpServer;
|
||||
import net.sourceforge.plantuml.picoweb.PicoWebServer;
|
||||
import net.sourceforge.plantuml.png.MetadataTag;
|
||||
import net.sourceforge.plantuml.preproc.Stdlib;
|
||||
import net.sourceforge.plantuml.security.ImageIO;
|
||||
@ -144,6 +145,11 @@ public class Run {
|
||||
return;
|
||||
}
|
||||
|
||||
if (option.getPicowebPort() != -1) {
|
||||
goPicoweb(option);
|
||||
return;
|
||||
}
|
||||
|
||||
forceOpenJdkResourceLoad();
|
||||
if (option.getPreprocessorOutputMode() == OptionPreprocOutputMode.CYPHER) {
|
||||
cypher = new LanguageDescriptor().getCypher();
|
||||
@ -327,6 +333,12 @@ public class Run {
|
||||
ftpServer.go();
|
||||
}
|
||||
|
||||
private static void goPicoweb(Option option) throws IOException {
|
||||
final int picoWebport = option.getPicowebPort();
|
||||
System.err.println("webPort=" + picoWebport);
|
||||
PicoWebServer.startServer(picoWebport);
|
||||
}
|
||||
|
||||
public static void printFonts() {
|
||||
final Font fonts[] = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
|
||||
for (Font f : fonts) {
|
||||
|
@ -68,12 +68,37 @@ public class SvgString {
|
||||
final int idx = result.indexOf(">");
|
||||
result = "<svg>" + result.substring(idx + 1);
|
||||
}
|
||||
final String style = extractSvgStyle();
|
||||
if (style != null) {
|
||||
final String background = extractBackground(style);
|
||||
if (background != null) {
|
||||
result = result.replaceFirst("<g>", "<g><rect fill=\"" + background + "\" style=\"" + style + "\" /> ");
|
||||
}
|
||||
}
|
||||
if (result.startsWith("<svg>") == false) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private String extractBackground(String style) {
|
||||
final Pattern p = Pattern.compile("background:([^;]+)");
|
||||
final Matcher m = p.matcher(style);
|
||||
if (m.find()) {
|
||||
return m.group(1);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String extractSvgStyle() {
|
||||
final Pattern p = Pattern.compile("(?i)\\<svg[^>]+style=\"([^\">]+)\"");
|
||||
final Matcher m = p.matcher(svg);
|
||||
if (m.find()) {
|
||||
return m.group(1);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getData(String name) {
|
||||
final Pattern p = Pattern.compile("(?i)" + name + "\\W+(\\d+)");
|
||||
final Matcher m = p.matcher(svg);
|
||||
|
@ -406,16 +406,16 @@ public class ActivityDiagram3 extends UmlDiagram {
|
||||
|
||||
}
|
||||
|
||||
public CommandExecutionResult backwardWhile(Display label, BoxStyle boxStyle) {
|
||||
public CommandExecutionResult backwardWhile(Display label, BoxStyle boxStyle, String incoming, String outcoming) {
|
||||
manageSwimlaneStrategy();
|
||||
if (current() instanceof InstructionRepeat) {
|
||||
final InstructionRepeat instructionRepeat = (InstructionRepeat) current();
|
||||
instructionRepeat.setBackward(label, swinlanes.getCurrentSwimlane(), boxStyle);
|
||||
instructionRepeat.setBackward(label, swinlanes.getCurrentSwimlane(), boxStyle, incoming, outcoming);
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
if (current() instanceof InstructionWhile) {
|
||||
final InstructionWhile instructionWhile = (InstructionWhile) current();
|
||||
instructionWhile.setBackward(label, swinlanes.getCurrentSwimlane(), boxStyle);
|
||||
instructionWhile.setBackward(label, swinlanes.getCurrentSwimlane(), boxStyle, incoming, outcoming);
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
return CommandExecutionResult.error("Cannot find repeat");
|
||||
@ -489,6 +489,11 @@ public class ActivityDiagram3 extends UmlDiagram {
|
||||
}
|
||||
|
||||
public void setLabelNextArrow(Display label) {
|
||||
if (current() instanceof InstructionRepeat && ((InstructionRepeat) current()).hasBackward()) {
|
||||
final InstructionRepeat instructionRepeat = (InstructionRepeat) current();
|
||||
instructionRepeat.setBackwardArrowLabel(label);
|
||||
return;
|
||||
}
|
||||
if (current() instanceof InstructionWhile && ((InstructionWhile) current()).getLast() == null) {
|
||||
((InstructionWhile) current()).overwriteYes(label);
|
||||
return;
|
||||
|
@ -62,6 +62,9 @@ public class InstructionRepeat implements Instruction {
|
||||
private final BoxStyle boxStyleIn;
|
||||
|
||||
private Display backward = Display.NULL;
|
||||
private Display backwardArrowLabel = Display.NULL;
|
||||
private String incoming;
|
||||
private String outcoming;
|
||||
private List<PositionedNote> backwardNotes = new ArrayList<PositionedNote>();
|
||||
private Display test = Display.NULL;
|
||||
private Display yes = Display.NULL;
|
||||
@ -97,10 +100,21 @@ public class InstructionRepeat implements Instruction {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setBackward(Display label, Swimlane swimlaneOut, BoxStyle boxStyle) {
|
||||
public void setBackward(Display label, Swimlane swimlaneOut, BoxStyle boxStyle, String incoming, String outcoming) {
|
||||
this.backward = label;
|
||||
this.swimlaneOut = swimlaneOut;
|
||||
this.boxStyle = boxStyle;
|
||||
this.incoming = incoming;
|
||||
this.outcoming = outcoming;
|
||||
this.backwardArrowLabel = Display.getWithNewlines(outcoming);
|
||||
}
|
||||
|
||||
public void setBackwardArrowLabel(Display label) {
|
||||
// this.backwardArrowLabel = label;
|
||||
}
|
||||
|
||||
public boolean hasBackward() {
|
||||
return this.backward != Display.NULL;
|
||||
}
|
||||
|
||||
public void add(Instruction ins) {
|
||||
@ -110,8 +124,10 @@ public class InstructionRepeat implements Instruction {
|
||||
public Ftile createFtile(FtileFactory factory) {
|
||||
final Ftile back = getBackward(factory);
|
||||
final Ftile decorateOut = factory.decorateOut(repeatList.createFtile(factory), endRepeatLinkRendering);
|
||||
final LinkRendering tmp = incoming == null ? backRepeatLinkRendering
|
||||
: backRepeatLinkRendering.withDisplay(Display.create(incoming));
|
||||
final Ftile result = factory.repeat(boxStyleIn, swimlane, swimlaneOut, startLabel, decorateOut, test, yes, out,
|
||||
colors, backRepeatLinkRendering, back, isLastOfTheParent());
|
||||
colors, tmp, back, isLastOfTheParent(), backwardArrowLabel);
|
||||
if (killed) {
|
||||
return new FtileKilled(result);
|
||||
}
|
||||
|
@ -101,7 +101,8 @@ public class InstructionWhile extends WithNote implements Instruction, Instructi
|
||||
final Ftile back = Display.isNull(backward) ? null
|
||||
: factory.activity(backward, swimlane, boxStyle, Colors.empty());
|
||||
Ftile tmp = factory.decorateOut(repeatList.createFtile(factory), endInlinkRendering);
|
||||
tmp = factory.createWhile(swimlane, tmp, test, yes, out, afterEndwhile, color, specialOut, back);
|
||||
tmp = factory.createWhile(swimlane, tmp, test, yes, out, afterEndwhile, color, specialOut, back, incoming,
|
||||
outcoming);
|
||||
if (getPositionedNotes().size() > 0) {
|
||||
tmp = FtileWithNoteOpale.create(tmp, getPositionedNotes(), skinParam, false);
|
||||
}
|
||||
@ -176,11 +177,15 @@ public class InstructionWhile extends WithNote implements Instruction, Instructi
|
||||
private BoxStyle boxStyle;
|
||||
private Swimlane swimlaneOut;
|
||||
private Display backward = Display.NULL;
|
||||
private String incoming;
|
||||
private String outcoming;
|
||||
|
||||
public void setBackward(Display label, Swimlane swimlaneOut, BoxStyle boxStyle) {
|
||||
public void setBackward(Display label, Swimlane swimlaneOut, BoxStyle boxStyle, String incoming, String outcoming) {
|
||||
this.backward = label;
|
||||
this.swimlaneOut = swimlaneOut;
|
||||
this.boxStyle = boxStyle;
|
||||
this.incoming = incoming;
|
||||
this.outcoming = outcoming;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ import net.sourceforge.plantuml.command.SingleLineCommand2;
|
||||
import net.sourceforge.plantuml.command.regex.IRegex;
|
||||
import net.sourceforge.plantuml.command.regex.RegexConcat;
|
||||
import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||
import net.sourceforge.plantuml.command.regex.RegexOptional;
|
||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
|
||||
@ -54,11 +55,19 @@ public class CommandBackward3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
|
||||
static IRegex getRegexConcat() {
|
||||
return RegexConcat.build(CommandBackward3.class.getName(), RegexLeaf.start(), //
|
||||
new RegexOptional( //
|
||||
new RegexLeaf("INCOMING", "\\(-\\>(.*?)\\)")), //
|
||||
RegexLeaf.spaceZeroOrMore(), //
|
||||
new RegexLeaf("backward"), //
|
||||
RegexLeaf.spaceZeroOrMore(), //
|
||||
new RegexLeaf(":"), //
|
||||
new RegexLeaf("LABEL", "(.*)"), //
|
||||
new RegexLeaf("LABEL", "(.*?)"), //
|
||||
new RegexLeaf("STYLE", CommandActivity3.endingGroup()), //
|
||||
RegexLeaf.spaceZeroOrMore(), //
|
||||
new RegexOptional( //
|
||||
new RegexLeaf("OUTCOMING", "\\(-\\>(.*?)\\)") //
|
||||
), //
|
||||
RegexLeaf.spaceZeroOrMore(), //
|
||||
RegexLeaf.end());
|
||||
}
|
||||
|
||||
@ -66,6 +75,8 @@ public class CommandBackward3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) {
|
||||
final BoxStyle boxStyle;
|
||||
final String styleString = arg.get("STYLE", 0);
|
||||
final String incoming = arg.get("INCOMING", 0);
|
||||
final String outcoming = arg.get("OUTCOMING", 0);
|
||||
if (styleString == null) {
|
||||
boxStyle = BoxStyle.PLAIN;
|
||||
} else {
|
||||
@ -73,7 +84,7 @@ public class CommandBackward3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
}
|
||||
|
||||
final Display label = Display.getWithNewlines(arg.get("LABEL", 0));
|
||||
return diagram.backwardWhile(label, boxStyle);
|
||||
return diagram.backwardWhile(label, boxStyle, incoming, outcoming);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ public class CommandRepeatWhile3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
new RegexOr(//
|
||||
new RegexLeaf("LABEL", "(.*)"), //
|
||||
new RegexLeaf("")) //
|
||||
)), //
|
||||
)), //
|
||||
new RegexLeaf(";?"), //
|
||||
RegexLeaf.end());
|
||||
}
|
||||
@ -110,8 +110,8 @@ public class CommandRepeatWhile3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
if (colorString == null) {
|
||||
rainbow = Rainbow.none();
|
||||
} else {
|
||||
rainbow = Rainbow.build(diagram.getSkinParam(), colorString, diagram.getSkinParam()
|
||||
.colorArrowSeparationSpace());
|
||||
rainbow = Rainbow.build(diagram.getSkinParam(), colorString,
|
||||
diagram.getSkinParam().colorArrowSeparationSpace());
|
||||
}
|
||||
|
||||
final Display linkLabel = Display.getWithNewlines(arg.get("LABEL", 0));
|
||||
|
@ -79,10 +79,11 @@ public interface FtileFactory {
|
||||
|
||||
public Ftile repeat(BoxStyle boxStyleIn, Swimlane swimlane, Swimlane swimlaneOut, Display startLabel, Ftile repeat,
|
||||
Display test, Display yes, Display out, Colors colors, LinkRendering backRepeatLinkRendering,
|
||||
Ftile backward, boolean noOut);
|
||||
Ftile backward, boolean noOut, Display labelBackward);
|
||||
|
||||
public Ftile createWhile(Swimlane swimlane, Ftile whileBlock, Display test, Display yes, Display out,
|
||||
LinkRendering afterEndwhile, HColor color, Instruction specialOut, Ftile backward);
|
||||
LinkRendering afterEndwhile, HColor color, Instruction specialOut, Ftile backward, String incoming,
|
||||
String outcoming);
|
||||
|
||||
public Ftile createIf(Swimlane swimlane, List<Branch> thens, Branch elseBranch, LinkRendering afterEndwhile,
|
||||
LinkRendering topInlinkRendering, Url url);
|
||||
|
@ -181,14 +181,14 @@ public class FtileFactoryDelegator implements FtileFactory {
|
||||
|
||||
public Ftile repeat(BoxStyle boxStyleIn, Swimlane swimlane, Swimlane swimlaneOut, Display startLabel, Ftile repeat,
|
||||
Display test, Display yes, Display out, Colors colors, LinkRendering backRepeatLinkRendering,
|
||||
Ftile backward, boolean noOut) {
|
||||
Ftile backward, boolean noOut, Display labelBackward) {
|
||||
return factory.repeat(boxStyleIn, swimlane, swimlaneOut, startLabel, repeat, test, yes, out, colors,
|
||||
backRepeatLinkRendering, backward, noOut);
|
||||
backRepeatLinkRendering, backward, noOut, labelBackward);
|
||||
}
|
||||
|
||||
public Ftile createWhile(Swimlane swimlane, Ftile whileBlock, Display test, Display yes, Display out,
|
||||
LinkRendering afterEndwhile, HColor color, Instruction specialOut, Ftile back) {
|
||||
return factory.createWhile(swimlane, whileBlock, test, yes, out, afterEndwhile, color, specialOut, back);
|
||||
LinkRendering afterEndwhile, HColor color, Instruction specialOut, Ftile back, String incoming, String outcoming) {
|
||||
return factory.createWhile(swimlane, whileBlock, test, yes, out, afterEndwhile, color, specialOut, back, incoming, outcoming);
|
||||
}
|
||||
|
||||
public Ftile createIf(Swimlane swimlane, List<Branch> thens, Branch elseBranch, LinkRendering afterEndwhile,
|
||||
|
@ -49,6 +49,7 @@ import net.sourceforge.plantuml.graphic.Rainbow;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
import net.sourceforge.plantuml.graphic.VerticalAlignment;
|
||||
import net.sourceforge.plantuml.ugraphic.MinMax;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UPolygon;
|
||||
@ -58,25 +59,37 @@ import net.sourceforge.plantuml.ugraphic.comp.PiecewiseAffineTransform;
|
||||
|
||||
public class Snake implements UShape {
|
||||
|
||||
private final Worm worm = new Worm();
|
||||
private UPolygon startDecoration;
|
||||
private UPolygon endDecoration;
|
||||
private final Rainbow color;
|
||||
private TextBlock textBlock;
|
||||
private String textBlockPosition;
|
||||
private MergeStrategy mergeable = MergeStrategy.FULL;
|
||||
private Direction emphasizeDirection;
|
||||
private final HorizontalAlignment horizontalAlignment;
|
||||
static class Text {
|
||||
private final TextBlock textBlock;
|
||||
private final VerticalAlignment verticalAlignment;
|
||||
private final HorizontalAlignment horizontalAlignment;
|
||||
|
||||
Text(TextBlock textBlock, VerticalAlignment verticalAlignment, HorizontalAlignment horizontalAlignment) {
|
||||
if (textBlock == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
this.textBlock = textBlock;
|
||||
this.verticalAlignment = verticalAlignment;
|
||||
this.horizontalAlignment = horizontalAlignment;
|
||||
}
|
||||
|
||||
private boolean hasText(StringBounder stringBounder) {
|
||||
return TextBlockUtils.isEmpty(this.textBlock, stringBounder) == false;
|
||||
}
|
||||
|
||||
public final void setIgnoreForCompression() {
|
||||
this.worm.setIgnoreForCompression();
|
||||
}
|
||||
|
||||
private final Worm worm;
|
||||
private final UPolygon startDecoration;
|
||||
private final UPolygon endDecoration;
|
||||
private final Rainbow color;
|
||||
|
||||
private final List<Text> texts;
|
||||
private final MergeStrategy mergeable;
|
||||
private final Direction emphasizeDirection;
|
||||
|
||||
public Snake transformX(PiecewiseAffineTransform compressionTransform) {
|
||||
final Snake result = new Snake(startDecoration, horizontalAlignment, color, endDecoration);
|
||||
result.textBlock = this.textBlock;
|
||||
result.mergeable = this.mergeable;
|
||||
result.emphasizeDirection = this.emphasizeDirection;
|
||||
final Snake result = cloneEmpty();
|
||||
for (Point2D.Double pt : worm) {
|
||||
final double x = compressionTransform.transform(pt.x);
|
||||
final double y = pt.y;
|
||||
@ -85,50 +98,85 @@ public class Snake implements UShape {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void removeEndDecoration() {
|
||||
this.endDecoration = null;
|
||||
public Snake move(double dx, double dy) {
|
||||
final Snake result = cloneEmpty();
|
||||
for (Point2D pt : worm) {
|
||||
result.addPoint(pt.getX() + dx, pt.getY() + dy);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public Snake(HorizontalAlignment horizontalAlignment, Rainbow color, UPolygon endDecoration) {
|
||||
this(null, horizontalAlignment, color, endDecoration);
|
||||
private Snake cloneEmpty() {
|
||||
return new Snake(startDecoration, color, endDecoration, worm.cloneEmpty(), mergeable, emphasizeDirection,
|
||||
texts);
|
||||
}
|
||||
|
||||
public Snake(UPolygon startDecoration, HorizontalAlignment horizontalAlignment, Rainbow color,
|
||||
UPolygon endDecoration) {
|
||||
public final Snake ignoreForCompression() {
|
||||
this.worm.setIgnoreForCompression();
|
||||
return this;
|
||||
}
|
||||
|
||||
public Snake emphasizeDirection(Direction emphasizeDirection) {
|
||||
return new Snake(startDecoration, color, endDecoration, worm, mergeable, emphasizeDirection, texts);
|
||||
}
|
||||
|
||||
public Snake withoutEndDecoration() {
|
||||
return new Snake(startDecoration, color, null, worm, mergeable, emphasizeDirection, texts);
|
||||
}
|
||||
|
||||
public Snake withMerge(MergeStrategy mergeable) {
|
||||
return new Snake(startDecoration, color, endDecoration, worm, mergeable, emphasizeDirection, texts);
|
||||
}
|
||||
|
||||
public Snake withLabel(TextBlock textBlock, HorizontalAlignment horizontalAlignment) {
|
||||
if (textBlock != null) {
|
||||
this.texts.add(new Text(textBlock, null, horizontalAlignment));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public Snake withLabel(TextBlock textBlock, VerticalAlignment verticalAlignment) {
|
||||
if (textBlock != null) {
|
||||
this.texts.add(new Text(textBlock, verticalAlignment, null));
|
||||
}
|
||||
if (verticalAlignment != VerticalAlignment.BOTTOM) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public static Snake create(Rainbow color) {
|
||||
return new Snake(null, color, null, new Worm(), MergeStrategy.FULL, null, new ArrayList<Text>());
|
||||
}
|
||||
|
||||
public static Snake create(Rainbow color, UPolygon endDecoration) {
|
||||
return new Snake(null, color, endDecoration, new Worm(), MergeStrategy.FULL, null, new ArrayList<Text>());
|
||||
}
|
||||
|
||||
public static Snake create(UPolygon startDecoration, Rainbow color, UPolygon endDecoration) {
|
||||
return new Snake(startDecoration, color, endDecoration, new Worm(), MergeStrategy.FULL, null,
|
||||
new ArrayList<Text>());
|
||||
}
|
||||
|
||||
private Snake(UPolygon startDecoration, Rainbow color, UPolygon endDecoration, Worm worm, MergeStrategy mergeable,
|
||||
Direction emphasizeDirection, List<Text> texts) {
|
||||
|
||||
if (color == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
if (color.size() == 0) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
if (texts == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
this.worm = worm;
|
||||
this.texts = texts;
|
||||
this.emphasizeDirection = emphasizeDirection;
|
||||
this.startDecoration = startDecoration;
|
||||
this.endDecoration = endDecoration;
|
||||
this.color = color;
|
||||
this.horizontalAlignment = horizontalAlignment;
|
||||
}
|
||||
|
||||
public Snake(HorizontalAlignment horizontalAlignment, Rainbow color) {
|
||||
this(null, horizontalAlignment, color, null);
|
||||
}
|
||||
|
||||
public void setLabel(TextBlock label, String position) {
|
||||
this.textBlock = label;
|
||||
this.textBlockPosition = position;
|
||||
}
|
||||
|
||||
public void setLabel(TextBlock label) {
|
||||
this.textBlock = label;
|
||||
}
|
||||
|
||||
public Snake move(double dx, double dy) {
|
||||
final Snake result = new Snake(startDecoration, horizontalAlignment, color, endDecoration);
|
||||
for (Point2D pt : worm) {
|
||||
result.addPoint(pt.getX() + dx, pt.getY() + dy);
|
||||
}
|
||||
result.textBlock = this.textBlock;
|
||||
result.mergeable = this.mergeable;
|
||||
result.emphasizeDirection = this.emphasizeDirection;
|
||||
return result;
|
||||
this.mergeable = mergeable;
|
||||
}
|
||||
|
||||
public Snake translate(UTranslate translate) {
|
||||
@ -186,9 +234,9 @@ public class Snake implements UShape {
|
||||
}
|
||||
|
||||
private void drawInternalLabel(UGraphic ug) {
|
||||
if (textBlock != null) {
|
||||
final Point2D position = getTextBlockPosition(ug.getStringBounder());
|
||||
textBlock.drawU(ug.apply(new UTranslate(position)));
|
||||
for (Text text : texts) {
|
||||
final Point2D position = getTextBlockPosition(ug.getStringBounder(), text);
|
||||
text.textBlock.drawU(ug.apply(new UTranslate(position)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -197,27 +245,27 @@ public class Snake implements UShape {
|
||||
for (Point2D pt : worm) {
|
||||
result = Math.max(result, pt.getX());
|
||||
}
|
||||
if (textBlock != null) {
|
||||
final Point2D position = getTextBlockPosition(stringBounder);
|
||||
final Dimension2D dim = textBlock.calculateDimension(stringBounder);
|
||||
for (Text text : texts) {
|
||||
final Point2D position = getTextBlockPosition(stringBounder, text);
|
||||
final Dimension2D dim = text.textBlock.calculateDimension(stringBounder);
|
||||
result = Math.max(result, position.getX() + dim.getWidth());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private Point2D getTextBlockPosition(StringBounder stringBounder) {
|
||||
private Point2D getTextBlockPosition(StringBounder stringBounder, Text text) {
|
||||
final Point2D pt1 = worm.get(0);
|
||||
final Point2D pt2 = worm.get(1);
|
||||
final Dimension2D dim = textBlock.calculateDimension(stringBounder);
|
||||
final Dimension2D dim = text.textBlock.calculateDimension(stringBounder);
|
||||
double x = Math.max(pt1.getX(), pt2.getX()) + 4;
|
||||
final boolean zigzag = worm.getDirectionsCode().startsWith("DLD") || worm.getDirectionsCode().startsWith("DRD");
|
||||
double y = (pt1.getY() + pt2.getY()) / 2 - dim.getHeight() / 2;
|
||||
if ("bottom".equalsIgnoreCase(textBlockPosition)) {
|
||||
if (text.verticalAlignment == VerticalAlignment.BOTTOM) {
|
||||
x = worm.getLast().getX();
|
||||
} else if (horizontalAlignment == HorizontalAlignment.CENTER && zigzag) {
|
||||
} else if (text.horizontalAlignment == HorizontalAlignment.CENTER && zigzag) {
|
||||
final Point2D pt3 = worm.get(2);
|
||||
x = (pt2.getX() + pt3.getX()) / 2 - dim.getWidth() / 2;
|
||||
} else if (horizontalAlignment == HorizontalAlignment.RIGHT && zigzag) {
|
||||
} else if (text.horizontalAlignment == HorizontalAlignment.RIGHT && zigzag) {
|
||||
x = Math.max(pt1.getX(), pt2.getX()) - dim.getWidth() - 4;
|
||||
} else if (worm.getDirectionsCode().equals("RD")) {
|
||||
x = Math.max(pt1.getX(), pt2.getX());
|
||||
@ -260,22 +308,19 @@ public class Snake implements UShape {
|
||||
if (strategy == MergeStrategy.NONE) {
|
||||
return null;
|
||||
}
|
||||
final boolean emptyOther = TextBlockUtils.isEmpty(other.textBlock, stringBounder);
|
||||
// final boolean emptyThis = TextBlockUtils.isEmpty(this.textBlock, stringBounder);
|
||||
if (emptyOther == false /* || emptyThis == false */) {
|
||||
// System.err.println("merge other.textBlock="+other.textBlock+" "+other.textBlock.calculateDimension(TextBlockUtils.getDummyStringBounder()));
|
||||
return null;
|
||||
for (Text text : other.texts) {
|
||||
if (text.hasText(stringBounder)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
if (same(this.getLast(), other.getFirst())) {
|
||||
final UPolygon oneOf = other.endDecoration == null ? endDecoration : other.endDecoration;
|
||||
if (this.startDecoration != null || other.startDecoration != null) {
|
||||
throw new UnsupportedOperationException("Not yet coded: to be done");
|
||||
}
|
||||
final Snake result = new Snake(null, horizontalAlignment, color, oneOf);
|
||||
final Snake result = new Snake(null, color, oneOf, this.worm.merge(other.worm, strategy), strategy,
|
||||
emphasizeDirection == null ? other.emphasizeDirection : emphasizeDirection, new ArrayList<Text>());
|
||||
// result.textBlock = oneOf(this.textBlock, other.textBlock, stringBounder);
|
||||
result.emphasizeDirection = emphasizeDirection == null ? other.emphasizeDirection : emphasizeDirection;
|
||||
result.worm.addAll(this.worm.merge(other.worm, strategy));
|
||||
result.mergeable = strategy;
|
||||
return result;
|
||||
}
|
||||
if (same(this.getFirst(), other.getLast())) {
|
||||
@ -294,14 +339,6 @@ public class Snake implements UShape {
|
||||
return same(this.getLast(), other.getFirst());
|
||||
}
|
||||
|
||||
public void goUnmergeable(MergeStrategy strategy) {
|
||||
this.mergeable = strategy;
|
||||
}
|
||||
|
||||
public void emphasizeDirection(Direction direction) {
|
||||
this.emphasizeDirection = direction;
|
||||
}
|
||||
|
||||
public boolean doesHorizontalCross(MinMax minMax) {
|
||||
return worm.doesHorizontalCross(minMax);
|
||||
}
|
||||
|
@ -65,7 +65,16 @@ public class Worm implements Iterable<Point2D.Double> {
|
||||
|
||||
private boolean ignoreForCompression;
|
||||
|
||||
public Worm cloneEmpty() {
|
||||
final Worm result = new Worm();
|
||||
result.ignoreForCompression = this.ignoreForCompression;
|
||||
return result;
|
||||
}
|
||||
|
||||
public final void setIgnoreForCompression() {
|
||||
if (points.size() > 0) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
this.ignoreForCompression = true;
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,8 @@ public class ConnectionVerticalDown extends AbstractConnection implements Connec
|
||||
private final Rainbow color;
|
||||
private final TextBlock textBlock;
|
||||
|
||||
public ConnectionVerticalDown(Ftile ftile1, Ftile ftile2, Point2D p1, Point2D p2, Rainbow color, TextBlock textBlock) {
|
||||
public ConnectionVerticalDown(Ftile ftile1, Ftile ftile2, Point2D p1, Point2D p2, Rainbow color,
|
||||
TextBlock textBlock) {
|
||||
super(ftile1, ftile2);
|
||||
if (color.size() == 0) {
|
||||
throw new IllegalArgumentException();
|
||||
@ -75,16 +76,16 @@ public class ConnectionVerticalDown extends AbstractConnection implements Connec
|
||||
}
|
||||
|
||||
private Snake getSimpleSnake() {
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), color, Arrows.asToDown());
|
||||
snake.setLabel(textBlock);
|
||||
final Snake snake = Snake.create(color, Arrows.asToDown()).withLabel(textBlock,
|
||||
arrowHorizontalAlignment());
|
||||
snake.addPoint(p1);
|
||||
snake.addPoint(p2);
|
||||
return snake;
|
||||
}
|
||||
|
||||
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), color, Arrows.asToDown());
|
||||
snake.setLabel(textBlock);
|
||||
final Snake snake = Snake.create(color, Arrows.asToDown()).withLabel(textBlock,
|
||||
arrowHorizontalAlignment());
|
||||
final Point2D mp1a = translate1.getTranslated(p1);
|
||||
final Point2D mp2b = translate2.getTranslated(p2);
|
||||
final double middle = (mp1a.getY() + mp2b.getY()) / 2.0;
|
||||
@ -94,7 +95,7 @@ public class ConnectionVerticalDown extends AbstractConnection implements Connec
|
||||
snake.addPoint(mp2b);
|
||||
ug.draw(snake);
|
||||
|
||||
// final Snake small = new Snake(color, Arrows.asToDown());
|
||||
// final Snake small = Snake.create(color, Arrows.asToDown());
|
||||
// small.addPoint(mp2b.getX(), middle);
|
||||
// small.addPoint(mp2b);
|
||||
// ug.draw(small);
|
||||
|
@ -76,7 +76,7 @@ public class FtileFactoryDelegatorRepeat extends FtileFactoryDelegator {
|
||||
@Override
|
||||
public Ftile repeat(BoxStyle boxStyleIn, Swimlane swimlane, Swimlane swimlaneOut, Display startLabel,
|
||||
final Ftile repeat, Display test, Display yes, Display out, Colors colors,
|
||||
LinkRendering backRepeatLinkRendering, Ftile backward, boolean noOut) {
|
||||
LinkRendering backRepeatLinkRendering, Ftile backward, boolean noOut, Display labelBackward) {
|
||||
|
||||
final ConditionStyle conditionStyle = skinParam().getConditionStyle();
|
||||
|
||||
@ -116,7 +116,7 @@ public class FtileFactoryDelegatorRepeat extends FtileFactoryDelegator {
|
||||
|
||||
Ftile result = FtileRepeat.create(backRepeatLinkRendering, swimlane, swimlaneOut, entry, repeat, test, yes, out,
|
||||
borderColor, diamondColor, arrowColor, endRepeatLinkColor, conditionStyle, this.skinParam(), fcDiamond,
|
||||
fcArrow, backward, noOut);
|
||||
fcArrow, backward, noOut, labelBackward);
|
||||
|
||||
final List<WeldingPoint> weldingPoints = repeat.getWeldingPoints();
|
||||
if (weldingPoints.size() > 0) {
|
||||
@ -134,8 +134,7 @@ public class FtileFactoryDelegatorRepeat extends FtileFactoryDelegator {
|
||||
final UTranslate tr2 = genealogy.getTranslate(diamondBreak, ug.getStringBounder());
|
||||
final Dimension2D dimDiamond = diamondBreak.calculateDimension(ug.getStringBounder());
|
||||
|
||||
final Snake snake = new Snake(getFtile1().arrowHorizontalAlignment(), arrowColor,
|
||||
Arrows.asToRight());
|
||||
final Snake snake = Snake.create(arrowColor, Arrows.asToRight());
|
||||
snake.addPoint(tr1.getDx(), tr1.getDy());
|
||||
snake.addPoint(0, tr1.getDy());
|
||||
snake.addPoint(0, tr2.getDy() + dimDiamond.getHeight() / 2);
|
||||
|
@ -72,7 +72,8 @@ public class FtileFactoryDelegatorWhile extends FtileFactoryDelegator {
|
||||
|
||||
@Override
|
||||
public Ftile createWhile(Swimlane swimlane, Ftile whileBlock, Display test, Display yes, Display out,
|
||||
LinkRendering afterEndwhile, HColor color, Instruction specialOut, Ftile backward) {
|
||||
LinkRendering afterEndwhile, HColor color, Instruction specialOut, Ftile backward, String incoming,
|
||||
String outcoming) {
|
||||
|
||||
final HColor borderColor;
|
||||
final HColor backColor;
|
||||
@ -107,7 +108,8 @@ public class FtileFactoryDelegatorWhile extends FtileFactoryDelegator {
|
||||
: endInlinkRendering.getRainbow();
|
||||
|
||||
Ftile result = FtileWhile.create(swimlane, whileBlock, test, borderColor, backColor, arrowColor, yes, out,
|
||||
endInlinkColor, afterEndwhile, fontArrow, getFactory(), conditionStyle, fcTest, specialOut, backward);
|
||||
endInlinkColor, afterEndwhile, fontArrow, getFactory(), conditionStyle, fcTest, specialOut, backward,
|
||||
incoming, outcoming);
|
||||
|
||||
final List<WeldingPoint> weldingPoints = whileBlock.getWeldingPoints();
|
||||
if (weldingPoints.size() > 0) {
|
||||
@ -121,8 +123,7 @@ public class FtileFactoryDelegatorWhile extends FtileFactoryDelegator {
|
||||
public void drawU(UGraphic ug) {
|
||||
final UTranslate tr1 = genealogy.getTranslate(ftileBreak, ug.getStringBounder());
|
||||
|
||||
final Snake snake = new Snake(getFtile1().arrowHorizontalAlignment(), arrowColor,
|
||||
Arrows.asToLeft());
|
||||
final Snake snake = Snake.create(arrowColor, Arrows.asToLeft());
|
||||
snake.addPoint(tr1.getDx(), tr1.getDy());
|
||||
snake.addPoint(Diamond.diamondHalfSize, tr1.getDy());
|
||||
ug.draw(snake);
|
||||
|
@ -233,7 +233,7 @@ class FtileIfAndStop extends AbstractFtile {
|
||||
final Point2D p1 = getP1(stringBounder);
|
||||
final Point2D p2 = getP2(stringBounder);
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), color, Arrows.asToRight());
|
||||
final Snake snake = Snake.create(color, Arrows.asToRight());
|
||||
snake.addPoint(p1);
|
||||
snake.addPoint(p2);
|
||||
ug.draw(snake);
|
||||
|
@ -115,8 +115,9 @@ public class FtileIfDown extends AbstractFtile {
|
||||
ConditionEndStyle conditionEndStyle, FtileFactory ftileFactory, Ftile optionalStop, Rainbow elseColor) {
|
||||
|
||||
elseColor = elseColor.withDefault(arrowColor);
|
||||
final FtileIfDown result = new FtileIfDown(thenBlock, diamond1, optionalStop == null ? diamond2
|
||||
: new FtileEmpty(ftileFactory.skinParam()), optionalStop, conditionEndStyle);
|
||||
final FtileIfDown result = new FtileIfDown(thenBlock, diamond1,
|
||||
optionalStop == null ? diamond2 : new FtileEmpty(ftileFactory.skinParam()), optionalStop,
|
||||
conditionEndStyle);
|
||||
|
||||
final List<Connection> conns = new ArrayList<Connection>();
|
||||
conns.add(result.new ConnectionIn(thenBlock.getInLinkRendering().getRainbow(arrowColor)));
|
||||
@ -154,7 +155,7 @@ public class FtileIfDown extends AbstractFtile {
|
||||
final Point2D p2 = getP2(stringBounder);
|
||||
// p2 = new Point2D.Double(p2.getX(), p1.getY());
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), color, Arrows.asToRight());
|
||||
final Snake snake = Snake.create(color, Arrows.asToRight());
|
||||
snake.addPoint(p1);
|
||||
snake.addPoint(p2);
|
||||
ug.draw(snake);
|
||||
@ -185,19 +186,19 @@ public class FtileIfDown extends AbstractFtile {
|
||||
}
|
||||
|
||||
private Point2D getP1(final StringBounder stringBounder) {
|
||||
return getTranslateDiamond1(stringBounder).getTranslated(
|
||||
getFtile1().calculateDimension(stringBounder).getPointOut());
|
||||
return getTranslateDiamond1(stringBounder)
|
||||
.getTranslated(getFtile1().calculateDimension(stringBounder).getPointOut());
|
||||
}
|
||||
|
||||
private Point2D getP2(final StringBounder stringBounder) {
|
||||
return getTranslateForThen(stringBounder).getTranslated(
|
||||
getFtile2().calculateDimension(stringBounder).getPointIn());
|
||||
return getTranslateForThen(stringBounder)
|
||||
.getTranslated(getFtile2().calculateDimension(stringBounder).getPointIn());
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
|
||||
final Snake snake = Snake.create(arrowColor, Arrows.asToDown());
|
||||
snake.addPoint(getP1(stringBounder));
|
||||
snake.addPoint(getP2(stringBounder));
|
||||
|
||||
@ -208,7 +209,7 @@ public class FtileIfDown extends AbstractFtile {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final Point2D p1 = getP1(stringBounder);
|
||||
final Point2D p2 = getP2(stringBounder);
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
|
||||
final Snake snake = Snake.create(arrowColor, Arrows.asToDown());
|
||||
final Point2D mp1a = translate1.getTranslated(p1);
|
||||
final Point2D mp2b = translate2.getTranslated(p2);
|
||||
final double middle = (mp1a.getY() + mp2b.getY()) / 2.0;
|
||||
@ -229,13 +230,13 @@ public class FtileIfDown extends AbstractFtile {
|
||||
}
|
||||
|
||||
private Point2D getP1(final StringBounder stringBounder) {
|
||||
return getTranslateForThen(stringBounder).getTranslated(
|
||||
getFtile1().calculateDimension(stringBounder).getPointOut());
|
||||
return getTranslateForThen(stringBounder)
|
||||
.getTranslated(getFtile1().calculateDimension(stringBounder).getPointOut());
|
||||
}
|
||||
|
||||
private Point2D getP2(final StringBounder stringBounder) {
|
||||
return getTranslateDiamond2(stringBounder).getTranslated(
|
||||
getFtile2().calculateDimension(stringBounder).getPointIn());
|
||||
return getTranslateDiamond2(stringBounder)
|
||||
.getTranslated(getFtile2().calculateDimension(stringBounder).getPointIn());
|
||||
}
|
||||
|
||||
private Point2D getP2hline(final StringBounder stringBounder) {
|
||||
@ -253,7 +254,7 @@ public class FtileIfDown extends AbstractFtile {
|
||||
return;
|
||||
}
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
|
||||
final Snake snake = Snake.create(arrowColor, Arrows.asToDown());
|
||||
snake.addPoint(getP1(stringBounder));
|
||||
|
||||
if (conditionEndStyle == ConditionEndStyle.DIAMOND) {
|
||||
@ -274,7 +275,7 @@ public class FtileIfDown extends AbstractFtile {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final Point2D p1 = getP1(stringBounder);
|
||||
final Point2D p2 = getP2(stringBounder);
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
|
||||
final Snake snake = Snake.create(arrowColor, Arrows.asToDown());
|
||||
final Point2D mp1a = translate1.getTranslated(p1);
|
||||
final Point2D mp2b = translate2.getTranslated(p2);
|
||||
final double middle = (mp1a.getY() + mp2b.getY()) / 2.0;
|
||||
@ -325,15 +326,15 @@ public class FtileIfDown extends AbstractFtile {
|
||||
final double y2 = p2.getY();
|
||||
|
||||
final FtileGeometry thenGeom = thenBlock.calculateDimension(stringBounder);
|
||||
final double xmax = Math.max(x1 + Diamond.diamondHalfSize, getTranslateForThen(stringBounder).getDx()
|
||||
+ thenGeom.getWidth());
|
||||
final double xmax = Math.max(x1 + Diamond.diamondHalfSize,
|
||||
getTranslateForThen(stringBounder).getDx() + thenGeom.getWidth());
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), endInlinkColor, Arrows.asToLeft());
|
||||
final Snake snake = Snake.create(endInlinkColor, Arrows.asToLeft())
|
||||
.emphasizeDirection(Direction.DOWN);
|
||||
snake.addPoint(x1, y1);
|
||||
snake.addPoint(xmax, y1);
|
||||
snake.addPoint(xmax, y2);
|
||||
snake.addPoint(x2, y2);
|
||||
snake.emphasizeDirection(Direction.DOWN);
|
||||
ug.apply(new UTranslate(x2, y2 - Diamond.diamondHalfSize)).draw(new UEmpty(5, Diamond.diamondHalfSize));
|
||||
ug.draw(snake);
|
||||
|
||||
@ -365,25 +366,27 @@ public class FtileIfDown extends AbstractFtile {
|
||||
final double y2 = p2.getY();
|
||||
|
||||
final FtileGeometry thenGeom = thenBlock.calculateDimension(stringBounder);
|
||||
final double xmax = Math.max(x1 + Diamond.diamondHalfSize, getTranslateForThen(stringBounder).getDx()
|
||||
+ thenGeom.getWidth());
|
||||
final double xmax = Math.max(x1 + Diamond.diamondHalfSize,
|
||||
getTranslateForThen(stringBounder).getDx() + thenGeom.getWidth());
|
||||
|
||||
/*
|
||||
* if( conditionEndStyle == ConditionEndStyle.DIAMOND ) { final Snake snake = new
|
||||
* Snake(arrowHorizontalAlignment(), endInlinkColor, Arrows.asToLeft()); snake.addPoint(x1, y1);
|
||||
* snake.addPoint(xmax, y1); snake.addPoint(xmax, y2); snake.addPoint(x2, y2);
|
||||
* snake.emphasizeDirection(Direction.DOWN); ug.apply(new UTranslate(x2, y2 -
|
||||
* Diamond.diamondHalfSize)).draw(new UEmpty(5, Diamond.diamondHalfSize)); ug.draw(snake); }
|
||||
* if( conditionEndStyle == ConditionEndStyle.DIAMOND ) { final Snake snake =
|
||||
* new Snake(arrowHorizontalAlignment(), endInlinkColor, Arrows.asToLeft());
|
||||
* snake.addPoint(x1, y1); snake.addPoint(xmax, y1); snake.addPoint(xmax, y2);
|
||||
* snake.addPoint(x2, y2); snake.emphasizeDirection(Direction.DOWN);
|
||||
* ug.apply(new UTranslate(x2, y2 - Diamond.diamondHalfSize)).draw(new UEmpty(5,
|
||||
* Diamond.diamondHalfSize)); ug.draw(snake); }
|
||||
*/
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), endInlinkColor, Arrows.asToDown());
|
||||
final Snake snake = Snake.create(endInlinkColor, Arrows.asToDown());
|
||||
snake.addPoint(x1, y1);
|
||||
snake.addPoint(xmax, y1);
|
||||
snake.addPoint(xmax, y2);
|
||||
ug.apply(new UTranslate(xmax, y2 - Diamond.diamondHalfSize)).draw(new UEmpty(5, Diamond.diamondHalfSize));
|
||||
ug.draw(snake);
|
||||
/*
|
||||
* final Snake snake2 = new Snake(arrowHorizontalAlignment(), endInlinkColor); snake2.addPoint(xmax, y2);
|
||||
* snake2.addPoint(x2, y2); ug.draw(snake2);
|
||||
* final Snake snake2 = Snake.create(arrowHorizontalAlignment(),
|
||||
* endInlinkColor); snake2.addPoint(xmax, y2); snake2.addPoint(x2, y2);
|
||||
* ug.draw(snake2);
|
||||
*/
|
||||
|
||||
}
|
||||
@ -454,16 +457,16 @@ public class FtileIfDown extends AbstractFtile {
|
||||
final double y3 = p3.getY();
|
||||
|
||||
final FtileGeometry thenGeom = thenBlock.calculateDimension(stringBounder);
|
||||
final double xmax = Math.max(x1 + Diamond.diamondHalfSize, getTranslateForThen(stringBounder).getDx()
|
||||
+ thenGeom.getWidth());
|
||||
final double xmax = Math.max(x1 + Diamond.diamondHalfSize,
|
||||
getTranslateForThen(stringBounder).getDx() + thenGeom.getWidth());
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), endInlinkColor);
|
||||
final Snake snake = Snake.create(endInlinkColor).withMerge(MergeStrategy.NONE);
|
||||
snake.addPoint(xmax, y2);
|
||||
// ug.apply(new UTranslate(xmax, y2 - Diamond.diamondHalfSize)).draw(new UEmpty(5,
|
||||
// ug.apply(new UTranslate(xmax, y2 - Diamond.diamondHalfSize)).draw(new
|
||||
// UEmpty(5,
|
||||
// Diamond.diamondHalfSize));
|
||||
snake.addPoint(x2, y2);
|
||||
snake.addPoint(x3, y3);
|
||||
snake.goUnmergeable(MergeStrategy.NONE);
|
||||
ug.draw(snake);
|
||||
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ class FtileIfLongHorizontal extends AbstractFtile {
|
||||
final Point2D p1 = getP1(stringBounder);
|
||||
final Point2D p2 = getP2(stringBounder);
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), color, Arrows.asToRight());
|
||||
final Snake snake = Snake.create(color, Arrows.asToRight());
|
||||
snake.addPoint(p1);
|
||||
snake.addPoint(p2);
|
||||
ug.draw(snake);
|
||||
@ -287,7 +287,7 @@ class FtileIfLongHorizontal extends AbstractFtile {
|
||||
public void drawU(UGraphic ug) {
|
||||
final UTranslate tr = getTranslateDiamond1(getFtile2(), ug.getStringBounder());
|
||||
final Point2D p2 = tr.getTranslated(getFtile2().calculateDimension(ug.getStringBounder()).getPointIn());
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
|
||||
final Snake snake = Snake.create(arrowColor, Arrows.asToDown());
|
||||
final Point2D p1 = calculateDimensionInternal(ug.getStringBounder()).getPointIn();
|
||||
|
||||
snake.addPoint(p1);
|
||||
@ -311,7 +311,7 @@ class FtileIfLongHorizontal extends AbstractFtile {
|
||||
final Point2D p1 = getP1(ug.getStringBounder());
|
||||
final UTranslate tr2 = getTranslate2(ug.getStringBounder());
|
||||
final Point2D p2 = tr2.getTranslated(getFtile2().calculateDimension(ug.getStringBounder()).getPointIn());
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
|
||||
final Snake snake = Snake.create(arrowColor, Arrows.asToDown());
|
||||
snake.addPoint(p1);
|
||||
snake.addPoint(p2.getX(), p1.getY());
|
||||
snake.addPoint(p2);
|
||||
@ -352,8 +352,7 @@ class FtileIfLongHorizontal extends AbstractFtile {
|
||||
final double totalHeight = full.getHeight();
|
||||
final Point2D p2 = new Point2D.Double(p1.getX(), totalHeight);
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
|
||||
snake.setLabel(out2);
|
||||
final Snake snake = Snake.create(arrowColor, Arrows.asToDown()).withLabel(out2, arrowHorizontalAlignment());
|
||||
snake.addPoint(p1);
|
||||
snake.addPoint(p2);
|
||||
if (nbOut == 0) {
|
||||
@ -378,7 +377,7 @@ class FtileIfLongHorizontal extends AbstractFtile {
|
||||
final Point2D p1 = getP1(stringBounder);
|
||||
final Point2D p2 = getP2(stringBounder);
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), color, Arrows.asToDown());
|
||||
final Snake snake = Snake.create(color, Arrows.asToDown());
|
||||
snake.addPoint(p1);
|
||||
snake.addPoint(p2);
|
||||
ug.draw(snake);
|
||||
@ -398,7 +397,7 @@ class FtileIfLongHorizontal extends AbstractFtile {
|
||||
final Point2D p1 = getP1(ug.getStringBounder());
|
||||
final Point2D p2 = getP2(ug.getStringBounder());
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), color, Arrows.asToDown());
|
||||
final Snake snake = Snake.create(color, Arrows.asToDown());
|
||||
|
||||
final Point2D mp1a = translate1.getTranslated(p1);
|
||||
final Point2D mp2b = translate2.getTranslated(p2);
|
||||
@ -432,8 +431,7 @@ class FtileIfLongHorizontal extends AbstractFtile {
|
||||
}
|
||||
final Point2D p2 = new Point2D.Double(p1.getX(), totalHeight);
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), color, Arrows.asToDown());
|
||||
snake.setLabel(out2);
|
||||
final Snake snake = Snake.create(color, Arrows.asToDown()).withLabel(out2, arrowHorizontalAlignment());
|
||||
snake.addPoint(p1);
|
||||
snake.addPoint(p2);
|
||||
ug.draw(snake);
|
||||
@ -482,8 +480,7 @@ class FtileIfLongHorizontal extends AbstractFtile {
|
||||
return;
|
||||
}
|
||||
|
||||
final Snake s = new Snake(arrowHorizontalAlignment(), arrowColor);
|
||||
s.goUnmergeable(MergeStrategy.NONE);
|
||||
final Snake s = Snake.create(arrowColor).withMerge(MergeStrategy.NONE);
|
||||
s.addPoint(minX, totalDim.getHeight());
|
||||
s.addPoint(maxX, totalDim.getHeight());
|
||||
ug.draw(s);
|
||||
|
@ -199,7 +199,7 @@ class FtileIfLongVertical extends AbstractFtile {
|
||||
public void drawU(UGraphic ug) {
|
||||
final UTranslate tr = getTranslateDiamond(getFtile2(), ug.getStringBounder());
|
||||
final Point2D p2 = tr.getTranslated(getFtile2().calculateDimension(ug.getStringBounder()).getPointIn());
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
|
||||
final Snake snake = Snake.create(arrowColor, Arrows.asToDown());
|
||||
final Point2D p1 = calculateDimensionInternal(ug.getStringBounder()).getPointIn();
|
||||
|
||||
snake.addPoint(p1);
|
||||
@ -225,7 +225,7 @@ class FtileIfLongVertical extends AbstractFtile {
|
||||
final Point2D p1 = getP1(stringBounder);
|
||||
final Point2D p2 = getP2(stringBounder);
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), color, Arrows.asToDown());
|
||||
final Snake snake = Snake.create(color, Arrows.asToDown());
|
||||
snake.addPoint(p1);
|
||||
snake.addPoint(p2.getX(), p1.getY());
|
||||
snake.addPoint(p2);
|
||||
@ -260,7 +260,7 @@ class FtileIfLongVertical extends AbstractFtile {
|
||||
final Point2D p1 = getP1(stringBounder);
|
||||
final Point2D p2 = getP2(stringBounder);
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), color, Arrows.asToDown());
|
||||
final Snake snake = Snake.create(color, Arrows.asToDown());
|
||||
snake.addPoint(p1);
|
||||
snake.addPoint(p2);
|
||||
ug.draw(snake);
|
||||
@ -296,7 +296,7 @@ class FtileIfLongVertical extends AbstractFtile {
|
||||
final Point2D p2 = getTranslate2(stringBounder).getTranslated(
|
||||
getFtile2().calculateDimension(stringBounder).getPointIn());
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
|
||||
final Snake snake = Snake.create(arrowColor, Arrows.asToDown());
|
||||
snake.addPoint(p1);
|
||||
snake.addPoint(p1.getX(), p2.getY() - 15);
|
||||
snake.addPoint(p2.getX(), p2.getY() - 15);
|
||||
@ -325,7 +325,7 @@ class FtileIfLongVertical extends AbstractFtile {
|
||||
final Point2D p2 = getTranslateLastDiamond(stringBounder).getTranslated(
|
||||
getFtile2().calculateDimension(stringBounder).getPointIn());
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
|
||||
final Snake snake = Snake.create(arrowColor, Arrows.asToDown());
|
||||
snake.addPoint(p1);
|
||||
snake.addPoint(p1.getX(), p2.getY() - 15);
|
||||
snake.addPoint(p2.getX(), p2.getY() - 15);
|
||||
@ -359,7 +359,7 @@ class FtileIfLongVertical extends AbstractFtile {
|
||||
|
||||
final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToLeft());
|
||||
final Snake snake = Snake.create(arrowColor, Arrows.asToLeft());
|
||||
snake.addPoint(p1);
|
||||
snake.addPoint(p1.getX(), p1.getY() + 15);
|
||||
snake.addPoint(dimTotal.getWidth(), p1.getY() + 15);
|
||||
@ -390,7 +390,7 @@ class FtileIfLongVertical extends AbstractFtile {
|
||||
|
||||
final Point2D p2 = new Point2D.Double(dimTotal.getWidth(), p1.getY() + 15);
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToRight());
|
||||
final Snake snake = Snake.create(arrowColor, Arrows.asToRight());
|
||||
snake.addPoint(p1);
|
||||
snake.addPoint(p1.getX(), p2.getY());
|
||||
snake.addPoint(p2);
|
||||
|
@ -113,7 +113,8 @@ class FtileRepeat extends AbstractFtile {
|
||||
public static Ftile create(LinkRendering backRepeatLinkRendering, Swimlane swimlane, Swimlane swimlaneOut,
|
||||
Ftile entry, Ftile repeat, Display test, Display yes, Display out, HColor borderColor, HColor diamondColor,
|
||||
Rainbow arrowColor, Rainbow endRepeatLinkColor, ConditionStyle conditionStyle, ISkinSimple spriteContainer,
|
||||
FontConfiguration fcDiamond, FontConfiguration fcArrow, Ftile backward, boolean noOut) {
|
||||
FontConfiguration fcDiamond, FontConfiguration fcArrow, Ftile backward, boolean noOut,
|
||||
Display labelBackward) {
|
||||
|
||||
final FontConfiguration fontConfiguration1 = conditionStyle == ConditionStyle.INSIDE ? fcDiamond : fcArrow;
|
||||
|
||||
@ -167,7 +168,10 @@ class FtileRepeat extends AbstractFtile {
|
||||
} else {
|
||||
conns.add(result.new ConnectionBackBackward1(backRepeatLinkRendering.getRainbow(arrowColor),
|
||||
tbbackLink1));
|
||||
conns.add(result.new ConnectionBackBackward2(backRepeatLinkRendering.getRainbow(arrowColor)));
|
||||
final TextBlock backArrowLabel = labelBackward == Display.NULL ? null
|
||||
: labelBackward.create(fcArrow, HorizontalAlignment.LEFT, spriteContainer);
|
||||
conns.add(result.new ConnectionBackBackward2(backRepeatLinkRendering.getRainbow(arrowColor),
|
||||
backArrowLabel));
|
||||
}
|
||||
} else {
|
||||
conns.add(result.new ConnectionBackComplex1(backRepeatLinkRendering.getRainbow(arrowColor)));
|
||||
@ -207,8 +211,8 @@ class FtileRepeat extends AbstractFtile {
|
||||
public void drawU(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
|
||||
snake.setLabel(tbin);
|
||||
final Snake snake = Snake.create(arrowColor, Arrows.asToDown()).withLabel(tbin,
|
||||
arrowHorizontalAlignment());
|
||||
snake.addPoint(getP1(stringBounder));
|
||||
snake.addPoint(getP2(stringBounder));
|
||||
|
||||
@ -242,8 +246,8 @@ class FtileRepeat extends AbstractFtile {
|
||||
return;
|
||||
}
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
|
||||
snake.setLabel(tbout);
|
||||
final Snake snake = Snake.create(arrowColor, Arrows.asToDown()).withLabel(tbout,
|
||||
arrowHorizontalAlignment());
|
||||
snake.addPoint(getP1(stringBounder));
|
||||
snake.addPoint(getP2(stringBounder));
|
||||
|
||||
@ -255,8 +259,8 @@ class FtileRepeat extends AbstractFtile {
|
||||
if (getFtile1().calculateDimension(stringBounder).hasPointOut() == false) {
|
||||
return;
|
||||
}
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor);
|
||||
snake.setLabel(tbout);
|
||||
final Snake snake = Snake.create(arrowColor).withLabel(tbout,
|
||||
arrowHorizontalAlignment());
|
||||
final Point2D mp1a = translate1.getTranslated(getP1(stringBounder));
|
||||
final Point2D mp2b = translate2.getTranslated(getP2(stringBounder));
|
||||
final double middle = (mp1a.getY() + mp2b.getY()) / 2.0;
|
||||
@ -266,7 +270,7 @@ class FtileRepeat extends AbstractFtile {
|
||||
// snake.addPoint(mp2b);
|
||||
ug.draw(snake);
|
||||
|
||||
final Snake small = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
|
||||
final Snake small = Snake.create(arrowColor, Arrows.asToDown());
|
||||
small.addPoint(mp2b.getX(), middle);
|
||||
small.addPoint(mp2b);
|
||||
ug.draw(small);
|
||||
@ -317,8 +321,8 @@ class FtileRepeat extends AbstractFtile {
|
||||
arrow = Arrows.asToRight();
|
||||
x2 = p2.getX();
|
||||
}
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, arrow);
|
||||
snake.emphasizeDirection(Direction.UP);
|
||||
final Snake snake = Snake.create(arrowColor, arrow)
|
||||
.emphasizeDirection(Direction.UP);
|
||||
|
||||
snake.addPoint(xmax, y1);
|
||||
snake.addPoint(xmax, y2);
|
||||
@ -346,8 +350,8 @@ class FtileRepeat extends AbstractFtile {
|
||||
public void drawU(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, null);
|
||||
snake.setLabel(tbback);
|
||||
final Snake snake = Snake.create(arrowColor, null).withLabel(tbback,
|
||||
arrowHorizontalAlignment());
|
||||
final Dimension2D dimRepeat = repeat.calculateDimension(stringBounder);
|
||||
final Point2D p1 = getP1(stringBounder);
|
||||
final Dimension2D dimDiamond2 = diamond2.calculateDimension(stringBounder);
|
||||
@ -385,8 +389,8 @@ class FtileRepeat extends AbstractFtile {
|
||||
public void drawU(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToUp());
|
||||
snake.setLabel(tbback);
|
||||
final Snake snake = Snake.create(arrowColor, Arrows.asToUp()).withLabel(tbback,
|
||||
arrowHorizontalAlignment());
|
||||
final Point2D p1 = getP1(stringBounder);
|
||||
final Point2D p2 = getP2(stringBounder);
|
||||
final Dimension2D dimDiamond2 = diamond2.calculateDimension(stringBounder);
|
||||
@ -406,9 +410,11 @@ class FtileRepeat extends AbstractFtile {
|
||||
|
||||
class ConnectionBackBackward2 extends AbstractConnection {
|
||||
private final Rainbow arrowColor;
|
||||
private final TextBlock label;
|
||||
|
||||
public ConnectionBackBackward2(Rainbow arrowColor) {
|
||||
public ConnectionBackBackward2(Rainbow arrowColor, TextBlock label) {
|
||||
super(backward, diamond1);
|
||||
this.label = label;
|
||||
this.arrowColor = arrowColor;
|
||||
}
|
||||
|
||||
@ -424,8 +430,11 @@ class FtileRepeat extends AbstractFtile {
|
||||
public void drawU(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToLeft());
|
||||
snake.emphasizeDirection(Direction.UP);
|
||||
Snake snake = Snake.create(arrowColor, Arrows.asToLeft())
|
||||
.emphasizeDirection(Direction.UP);
|
||||
if (label != null) {
|
||||
snake = snake.withLabel(label, arrowHorizontalAlignment());
|
||||
}
|
||||
final Point2D p1 = getP1(stringBounder);
|
||||
final Point2D p2 = getP2(stringBounder);
|
||||
final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
||||
@ -464,9 +473,8 @@ class FtileRepeat extends AbstractFtile {
|
||||
public void drawU(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToLeft());
|
||||
snake.setLabel(tbback);
|
||||
snake.emphasizeDirection(Direction.UP);
|
||||
final Snake snake = Snake.create(arrowColor, Arrows.asToLeft())
|
||||
.emphasizeDirection(Direction.UP).withLabel(tbback, arrowHorizontalAlignment());
|
||||
final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
|
||||
final Point2D p1 = getP1(stringBounder);
|
||||
final Point2D p2 = getP2(stringBounder);
|
||||
@ -488,9 +496,8 @@ class FtileRepeat extends AbstractFtile {
|
||||
|
||||
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToLeft());
|
||||
snake.setLabel(tbback);
|
||||
snake.emphasizeDirection(Direction.UP);
|
||||
final Snake snake = Snake.create(arrowColor, Arrows.asToLeft())
|
||||
.emphasizeDirection(Direction.UP).withLabel(tbback, arrowHorizontalAlignment());
|
||||
final Dimension2D dimRepeat = repeat.calculateDimension(stringBounder);
|
||||
|
||||
Point2D p1 = getP1(stringBounder);
|
||||
|
@ -116,7 +116,7 @@ class FtileWhile extends AbstractFtile {
|
||||
public static Ftile create(Swimlane swimlane, Ftile whileBlock, Display test, HColor borderColor, HColor backColor,
|
||||
Rainbow arrowColor, Display yes, Display out2, Rainbow endInlinkColor, LinkRendering afterEndwhile,
|
||||
FontConfiguration fontArrow, FtileFactory ftileFactory, ConditionStyle conditionStyle,
|
||||
FontConfiguration fcTest, Instruction specialOut, Ftile backward) {
|
||||
FontConfiguration fcTest, Instruction specialOut, Ftile backward, String incoming, String outcoming) {
|
||||
|
||||
final TextBlock yesTb = yes.create(fontArrow, HorizontalAlignment.LEFT, ftileFactory.skinParam());
|
||||
final TextBlock testTb = test.isWhite() ? TextBlockUtils.empty(0, 0)
|
||||
@ -147,8 +147,8 @@ class FtileWhile extends AbstractFtile {
|
||||
}
|
||||
|
||||
final Dimension2D dim = whileBlock.calculateDimension(ftileFactory.getStringBounder());
|
||||
final Display backDisplay = whileBlock.getOutLinkRendering().getDisplay();
|
||||
final TextBlock back = backDisplay.create(fontArrow, HorizontalAlignment.LEFT, ftileFactory.skinParam());
|
||||
final TextBlock back = whileBlock.getOutLinkRendering().getDisplay().create(fontArrow, HorizontalAlignment.LEFT,
|
||||
ftileFactory.skinParam());
|
||||
|
||||
final List<Connection> conns = new ArrayList<Connection>();
|
||||
if (dim.getWidth() == 0 || dim.getHeight() == 0) {
|
||||
@ -158,8 +158,12 @@ class FtileWhile extends AbstractFtile {
|
||||
if (backward == null) {
|
||||
conns.add(result.new ConnectionBackSimple(endInlinkColor, back));
|
||||
} else {
|
||||
conns.add(result.new ConnectionBackBackward1(endInlinkColor, back));
|
||||
conns.add(result.new ConnectionBackBackward2(endInlinkColor));
|
||||
final TextBlock back1 = Display.getWithNewlines(incoming).create(fontArrow, HorizontalAlignment.LEFT,
|
||||
ftileFactory.skinParam());
|
||||
final TextBlock back2 = Display.getWithNewlines(outcoming).create(fontArrow, HorizontalAlignment.LEFT,
|
||||
ftileFactory.skinParam());
|
||||
conns.add(result.new ConnectionBackBackward1(endInlinkColor, back1));
|
||||
conns.add(result.new ConnectionBackBackward2(endInlinkColor, back2));
|
||||
}
|
||||
}
|
||||
if (specialOut == null) {
|
||||
@ -191,7 +195,7 @@ class FtileWhile extends AbstractFtile {
|
||||
public void drawU(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
|
||||
final Snake snake = Snake.create(arrowColor, Arrows.asToDown());
|
||||
snake.addPoint(getP1(stringBounder));
|
||||
snake.addPoint(getP2(stringBounder));
|
||||
|
||||
@ -202,7 +206,7 @@ class FtileWhile extends AbstractFtile {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final Point2D p1 = getP1(stringBounder);
|
||||
final Point2D p2 = getP2(stringBounder);
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
|
||||
final Snake snake = Snake.create(arrowColor, Arrows.asToDown()).withMerge(MergeStrategy.LIMITED);
|
||||
final Point2D mp1a = translate1.getTranslated(p1);
|
||||
final Point2D mp2b = translate2.getTranslated(p2);
|
||||
final double middle = (mp1a.getY() + mp2b.getY()) / 2.0;
|
||||
@ -210,7 +214,6 @@ class FtileWhile extends AbstractFtile {
|
||||
snake.addPoint(mp1a.getX(), middle);
|
||||
snake.addPoint(mp2b.getX(), middle);
|
||||
snake.addPoint(mp2b);
|
||||
snake.goUnmergeable(MergeStrategy.LIMITED);
|
||||
ug.draw(snake);
|
||||
}
|
||||
}
|
||||
@ -245,7 +248,6 @@ class FtileWhile extends AbstractFtile {
|
||||
public void drawU(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), endInlinkColor, Arrows.asToLeft());
|
||||
final Dimension2D dimTotal = calculateDimension(stringBounder);
|
||||
final Point2D p1 = getP1(stringBounder);
|
||||
if (p1 == null) {
|
||||
@ -260,7 +262,8 @@ class FtileWhile extends AbstractFtile {
|
||||
final double half = (dimDiamond1.getOutY() - dimDiamond1.getInY()) / 2;
|
||||
final double y2 = p2.getY() + dimDiamond1.getInY() + half;
|
||||
|
||||
snake.setLabel(back);
|
||||
final Snake snake = Snake.create(endInlinkColor, Arrows.asToLeft()).emphasizeDirection(Direction.UP)
|
||||
.withLabel(back, arrowHorizontalAlignment());
|
||||
snake.addPoint(x1, y1);
|
||||
final double y1bis = Math.max(y1, getBottom(stringBounder)) + Diamond.diamondHalfSize;
|
||||
snake.addPoint(x1, y1bis);
|
||||
@ -268,7 +271,6 @@ class FtileWhile extends AbstractFtile {
|
||||
snake.addPoint(xx, y1bis);
|
||||
snake.addPoint(xx, y2);
|
||||
snake.addPoint(x2, y2);
|
||||
snake.emphasizeDirection(Direction.UP);
|
||||
|
||||
ug.draw(snake);
|
||||
ug.apply(new UTranslate(x1, y1bis)).draw(new UEmpty(5, Diamond.diamondHalfSize));
|
||||
@ -277,7 +279,7 @@ class FtileWhile extends AbstractFtile {
|
||||
|
||||
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), endInlinkColor, Arrows.asToLeft());
|
||||
final Snake snake = Snake.create(endInlinkColor, Arrows.asToLeft()).withMerge(MergeStrategy.LIMITED);
|
||||
final Dimension2D dimTotal = calculateDimension(stringBounder);
|
||||
final Point2D ap1 = getP1(stringBounder);
|
||||
final Point2D ap2 = getP2(stringBounder);
|
||||
@ -298,7 +300,6 @@ class FtileWhile extends AbstractFtile {
|
||||
snake.addPoint(xx, y1 + Diamond.diamondHalfSize);
|
||||
snake.addPoint(xx, y2);
|
||||
snake.addPoint(x2, y2);
|
||||
snake.goUnmergeable(MergeStrategy.LIMITED);
|
||||
|
||||
ug.draw(snake);
|
||||
|
||||
@ -342,7 +343,6 @@ class FtileWhile extends AbstractFtile {
|
||||
public void drawU(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), endInlinkColor, Arrows.asToUp());
|
||||
final Point2D p1 = getP1(stringBounder);
|
||||
if (p1 == null) {
|
||||
return;
|
||||
@ -353,7 +353,8 @@ class FtileWhile extends AbstractFtile {
|
||||
final double x2 = p2.getX();
|
||||
final double y2 = p2.getY();
|
||||
|
||||
snake.setLabel(back);
|
||||
final Snake snake = Snake.create(endInlinkColor, Arrows.asToUp()).withLabel(back,
|
||||
arrowHorizontalAlignment());
|
||||
snake.addPoint(x1, y1);
|
||||
final double y1bis = Math.max(y1, getBottom(stringBounder)) + Diamond.diamondHalfSize;
|
||||
snake.addPoint(x1, y1bis);
|
||||
@ -367,10 +368,12 @@ class FtileWhile extends AbstractFtile {
|
||||
|
||||
class ConnectionBackBackward2 extends AbstractConnection {
|
||||
private final Rainbow endInlinkColor;
|
||||
private final TextBlock back;
|
||||
|
||||
public ConnectionBackBackward2(Rainbow endInlinkColor) {
|
||||
public ConnectionBackBackward2(Rainbow endInlinkColor, TextBlock back) {
|
||||
super(backward, diamond1);
|
||||
this.endInlinkColor = endInlinkColor;
|
||||
this.back = back;
|
||||
}
|
||||
|
||||
private Point2D getP1(final StringBounder stringBounder) {
|
||||
@ -385,7 +388,9 @@ class FtileWhile extends AbstractFtile {
|
||||
public void drawU(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), endInlinkColor, Arrows.asToLeft());
|
||||
final Snake snake = Snake.create(endInlinkColor, Arrows.asToLeft()).withLabel(back,
|
||||
arrowHorizontalAlignment());
|
||||
|
||||
final Point2D p1 = getP1(stringBounder);
|
||||
final Point2D p2 = getP2(stringBounder);
|
||||
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
||||
@ -429,7 +434,7 @@ class FtileWhile extends AbstractFtile {
|
||||
public void drawU(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), endInlinkColor, Arrows.asToLeft());
|
||||
final Snake snake = Snake.create(endInlinkColor, Arrows.asToLeft()).emphasizeDirection(Direction.UP);
|
||||
final Dimension2D dimTotal = calculateDimension(stringBounder);
|
||||
final Point2D p1 = getP1(stringBounder);
|
||||
final Point2D p2 = getP2(stringBounder);
|
||||
@ -449,7 +454,6 @@ class FtileWhile extends AbstractFtile {
|
||||
snake.addPoint(xx, y1bis);
|
||||
snake.addPoint(xx, y2);
|
||||
snake.addPoint(x2, y2);
|
||||
snake.emphasizeDirection(Direction.UP);
|
||||
|
||||
ug.draw(snake);
|
||||
|
||||
@ -479,7 +483,8 @@ class FtileWhile extends AbstractFtile {
|
||||
public void drawU(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), afterEndwhileColor);
|
||||
final Snake snake = Snake.create(afterEndwhileColor).withMerge(MergeStrategy.LIMITED)
|
||||
.emphasizeDirection(Direction.DOWN);
|
||||
|
||||
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
||||
final Point2D p1 = getP1(stringBounder);
|
||||
@ -494,12 +499,10 @@ class FtileWhile extends AbstractFtile {
|
||||
snake.addPoint(x1, y1);
|
||||
snake.addPoint(Diamond.diamondHalfSize, y1);
|
||||
snake.addPoint(Diamond.diamondHalfSize, y2);
|
||||
snake.emphasizeDirection(Direction.DOWN);
|
||||
snake.goUnmergeable(MergeStrategy.LIMITED);
|
||||
|
||||
ug.draw(snake);
|
||||
|
||||
final Snake snake2 = new Snake(arrowHorizontalAlignment(), afterEndwhileColor);
|
||||
final Snake snake2 = Snake.create(afterEndwhileColor);
|
||||
snake2.addPoint(Diamond.diamondHalfSize, y2);
|
||||
snake2.addPoint(x2, y2);
|
||||
// snake2.goUnmergeable(MergeStrategy.LIMITED);
|
||||
@ -528,7 +531,7 @@ class FtileWhile extends AbstractFtile {
|
||||
public void drawU(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), afterEndwhileColor, Arrows.asToDown());
|
||||
final Snake snake = Snake.create(afterEndwhileColor, Arrows.asToDown());
|
||||
|
||||
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
||||
final Point2D p1 = getP1(stringBounder);
|
||||
|
@ -231,9 +231,9 @@ public class ParallelBuilderFork extends AbstractParallelFtilesBuilder {
|
||||
public void drawU(UGraphic ug) {
|
||||
ug = ug.apply(UTranslate.dx(x));
|
||||
final FtileGeometry geo2 = getFtile2().calculateDimension(getStringBounder());
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
|
||||
Snake snake = Snake.create(arrowColor, Arrows.asToDown());
|
||||
if (Display.isNull(label) == false) {
|
||||
snake.setLabel(getTextBlock(label));
|
||||
snake = snake.withLabel(getTextBlock(label), arrowHorizontalAlignment());
|
||||
}
|
||||
final Point2D p1 = new Point2D.Double(geo2.getLeft(), 0);
|
||||
final Point2D p2 = new Point2D.Double(geo2.getLeft(), geo2.getInY());
|
||||
@ -248,9 +248,10 @@ public class ParallelBuilderFork extends AbstractParallelFtilesBuilder {
|
||||
final Point2D p1 = new Point2D.Double(geo2.getLeft(), 0);
|
||||
final Point2D p2 = new Point2D.Double(geo2.getLeft(), geo2.getInY());
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
|
||||
Snake snake = Snake.create(arrowColor, Arrows.asToDown())
|
||||
.ignoreForCompression();
|
||||
if (Display.isNull(label) == false) {
|
||||
snake.setLabel(getTextBlock(label));
|
||||
snake = snake.withLabel(getTextBlock(label), arrowHorizontalAlignment());
|
||||
}
|
||||
final Point2D mp1a = translate1.getTranslated(p1);
|
||||
final Point2D mp2b = translate2.getTranslated(p2);
|
||||
@ -259,7 +260,6 @@ public class ParallelBuilderFork extends AbstractParallelFtilesBuilder {
|
||||
snake.addPoint(mp1a.getX(), middle);
|
||||
snake.addPoint(mp2b.getX(), middle);
|
||||
snake.addPoint(mp2b);
|
||||
snake.setIgnoreForCompression();
|
||||
ug.draw(snake);
|
||||
}
|
||||
}
|
||||
@ -285,9 +285,9 @@ public class ParallelBuilderFork extends AbstractParallelFtilesBuilder {
|
||||
if (geo1.hasPointOut() == false) {
|
||||
return;
|
||||
}
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
|
||||
Snake snake = Snake.create(arrowColor, Arrows.asToDown());
|
||||
if (Display.isNull(label) == false) {
|
||||
snake.setLabel(getTextBlock(label));
|
||||
snake = snake.withLabel(getTextBlock(label), arrowHorizontalAlignment());
|
||||
}
|
||||
final Point2D p1 = new Point2D.Double(geo1.getLeft(), barHeight + geo1.getOutY());
|
||||
final Point2D p2 = new Point2D.Double(geo1.getLeft(), justBeforeBar2);
|
||||
@ -305,9 +305,10 @@ public class ParallelBuilderFork extends AbstractParallelFtilesBuilder {
|
||||
final Point2D p1 = new Point2D.Double(geo.getLeft(), barHeight + geo.getOutY());
|
||||
final Point2D p2 = new Point2D.Double(geo.getLeft(), justBeforeBar2);
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
|
||||
Snake snake = Snake.create(arrowColor, Arrows.asToDown())
|
||||
.ignoreForCompression();
|
||||
if (Display.isNull(label) == false) {
|
||||
snake.setLabel(getTextBlock(label));
|
||||
snake = snake.withLabel(getTextBlock(label), arrowHorizontalAlignment());
|
||||
}
|
||||
final Point2D mp1a = translate1.getTranslated(p1);
|
||||
final Point2D mp2b = translate2.getTranslated(p2);
|
||||
@ -316,7 +317,6 @@ public class ParallelBuilderFork extends AbstractParallelFtilesBuilder {
|
||||
snake.addPoint(mp1a.getX(), middle);
|
||||
snake.addPoint(mp2b.getX(), middle);
|
||||
snake.addPoint(mp2b);
|
||||
snake.setIgnoreForCompression();
|
||||
ug.draw(snake);
|
||||
}
|
||||
|
||||
|
@ -157,7 +157,7 @@ public class ParallelBuilderMerge extends AbstractParallelFtilesBuilder {
|
||||
} else if (counter == 1) {
|
||||
endDecoration = Arrows.asToLeft();
|
||||
}
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, endDecoration);
|
||||
final Snake snake = Snake.create(arrowColor, endDecoration);
|
||||
snake.addPoint(x1, y1);
|
||||
snake.addPoint(x1, y2);
|
||||
snake.addPoint(x2, y2);
|
||||
@ -200,9 +200,9 @@ public class ParallelBuilderMerge extends AbstractParallelFtilesBuilder {
|
||||
public void drawU(UGraphic ug) {
|
||||
ug = ug.apply(UTranslate.dx(x));
|
||||
final FtileGeometry geo = getFtile2().calculateDimension(getStringBounder());
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
|
||||
Snake snake = Snake.create(arrowColor, Arrows.asToDown());
|
||||
if (Display.isNull(label) == false) {
|
||||
snake.setLabel(getTextBlock(label));
|
||||
snake = snake.withLabel(getTextBlock(label), arrowHorizontalAlignment());
|
||||
}
|
||||
snake.addPoint(geo.getLeft(), 0);
|
||||
snake.addPoint(geo.getLeft(), geo.getInY());
|
||||
@ -215,9 +215,9 @@ public class ParallelBuilderMerge extends AbstractParallelFtilesBuilder {
|
||||
final Point2D p1 = new Point2D.Double(geo.getLeft(), 0);
|
||||
final Point2D p2 = new Point2D.Double(geo.getLeft(), geo.getInY());
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
|
||||
Snake snake = Snake.create(arrowColor, Arrows.asToDown());
|
||||
if (Display.isNull(label) == false) {
|
||||
snake.setLabel(getTextBlock(label));
|
||||
snake = snake.withLabel(getTextBlock(label), arrowHorizontalAlignment());
|
||||
}
|
||||
final Point2D mp1a = translate1.getTranslated(p1);
|
||||
final Point2D mp2b = translate2.getTranslated(p2);
|
||||
|
@ -221,9 +221,9 @@ public class ParallelBuilderSplit extends AbstractParallelFtilesBuilder {
|
||||
public void drawU(UGraphic ug) {
|
||||
ug = ug.apply(UTranslate.dx(x));
|
||||
final FtileGeometry geo = getFtile2().calculateDimension(getStringBounder());
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
|
||||
Snake snake = Snake.create(arrowColor, Arrows.asToDown());
|
||||
if (Display.isNull(label) == false) {
|
||||
snake.setLabel(getTextBlock(label));
|
||||
snake = snake.withLabel(getTextBlock(label), arrowHorizontalAlignment());
|
||||
}
|
||||
snake.addPoint(geo.getLeft(), 0);
|
||||
snake.addPoint(geo.getLeft(), geo.getInY());
|
||||
@ -236,9 +236,9 @@ public class ParallelBuilderSplit extends AbstractParallelFtilesBuilder {
|
||||
final Point2D p1 = new Point2D.Double(geo.getLeft(), 0);
|
||||
final Point2D p2 = new Point2D.Double(geo.getLeft(), geo.getInY());
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
|
||||
Snake snake = Snake.create(arrowColor, Arrows.asToDown());
|
||||
if (Display.isNull(label) == false) {
|
||||
snake.setLabel(getTextBlock(label));
|
||||
snake = snake.withLabel(getTextBlock(label), arrowHorizontalAlignment());
|
||||
}
|
||||
final Point2D mp1a = translate1.getTranslated(p1);
|
||||
final Point2D mp2b = translate2.getTranslated(p2);
|
||||
@ -275,9 +275,9 @@ public class ParallelBuilderSplit extends AbstractParallelFtilesBuilder {
|
||||
if (geo.hasPointOut() == false) {
|
||||
return;
|
||||
}
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
|
||||
Snake snake = Snake.create(arrowColor, Arrows.asToDown());
|
||||
if (Display.isNull(label) == false) {
|
||||
snake.setLabel(getTextBlock(label));
|
||||
snake = snake.withLabel(getTextBlock(label), arrowHorizontalAlignment());
|
||||
}
|
||||
final Point2D p1 = translate0.getTranslated(new Point2D.Double(geo.getLeft(), geo.getOutY()));
|
||||
final Point2D p2 = translate0.getTranslated(new Point2D.Double(geo.getLeft(), height));
|
||||
@ -295,9 +295,9 @@ public class ParallelBuilderSplit extends AbstractParallelFtilesBuilder {
|
||||
final Point2D p1 = translate0.getTranslated(new Point2D.Double(geo.getLeft(), geo.getOutY()));
|
||||
final Point2D p2 = translate0.getTranslated(new Point2D.Double(geo.getLeft(), height));
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
|
||||
Snake snake = Snake.create(arrowColor, Arrows.asToDown());
|
||||
if (Display.isNull(label) == false) {
|
||||
snake.setLabel(getTextBlock(label));
|
||||
snake = snake.withLabel(getTextBlock(label), arrowHorizontalAlignment());
|
||||
}
|
||||
final Point2D mp1a = translate1.getTranslated(p1);
|
||||
final Point2D mp2b = translate2.getTranslated(p2);
|
||||
|
@ -164,12 +164,13 @@ public class VCompactFactory implements FtileFactory {
|
||||
|
||||
public Ftile repeat(BoxStyle boxStyleIn, Swimlane swimlane, Swimlane swimlaneOut, Display startLabel, Ftile repeat,
|
||||
Display test, Display yes, Display out, Colors colors, LinkRendering backRepeatLinkRendering,
|
||||
Ftile backward, boolean noOut) {
|
||||
Ftile backward, boolean noOut, Display labelBackward) {
|
||||
return repeat;
|
||||
}
|
||||
|
||||
public Ftile createWhile(Swimlane swimlane, Ftile whileBlock, Display test, Display yes, Display out,
|
||||
LinkRendering afterEndwhile, HColor color, Instruction specialOut, Ftile back) {
|
||||
LinkRendering afterEndwhile, HColor color, Instruction specialOut, Ftile back, String incoming,
|
||||
String outcoming) {
|
||||
return whileBlock;
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
|
||||
final double x2 = p2.getX();
|
||||
final double y2 = p2.getY();
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), color, usingArrow);
|
||||
final Snake snake = Snake.create(color, usingArrow);
|
||||
snake.addPoint(x1, y1);
|
||||
snake.addPoint(x2, y1);
|
||||
snake.addPoint(x2, y2);
|
||||
@ -160,18 +160,18 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
|
||||
if (originalDirection != newDirection) {
|
||||
final double delta = (originalDirection == Direction.RIGHT ? -1 : 1) * Diamond.diamondHalfSize;
|
||||
final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
||||
final Snake small = new Snake(arrowHorizontalAlignment(), color);
|
||||
final Snake small = Snake.create(color);
|
||||
small.addPoint(p1);
|
||||
small.addPoint(p1.getX() + delta, p1.getY());
|
||||
small.addPoint(p1.getX() + delta, p1.getY() + dimDiamond1.getHeight() * .75);
|
||||
ug.draw(small);
|
||||
p1 = small.getLast();
|
||||
}
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), color, usingArrow);
|
||||
final Snake snake = Snake.create(color, usingArrow)
|
||||
.withMerge(MergeStrategy.LIMITED);
|
||||
snake.addPoint(p1);
|
||||
snake.addPoint(p2.getX(), p1.getY());
|
||||
snake.addPoint(p2);
|
||||
snake.goUnmergeable(MergeStrategy.LIMITED);
|
||||
ug.draw(snake);
|
||||
|
||||
}
|
||||
@ -204,9 +204,9 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
|
||||
final double y2 = p2.getY();
|
||||
|
||||
final UPolygon arrow = x2 > x1 ? Arrows.asToRight() : Arrows.asToLeft();
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), myArrowColor, arrow);
|
||||
Snake snake = Snake.create(myArrowColor, arrow);
|
||||
if (branchEmpty) {
|
||||
snake.emphasizeDirection(Direction.DOWN);
|
||||
snake = snake.emphasizeDirection(Direction.DOWN);
|
||||
}
|
||||
snake.addPoint(x1, y1);
|
||||
snake.addPoint(x1, y2);
|
||||
@ -257,35 +257,35 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
|
||||
if (originalDirection == newDirection) {
|
||||
final double delta = (x2 > x1 ? -1 : 1) * 1.5 * Diamond.diamondHalfSize;
|
||||
final Point2D mp2bc = new Point2D.Double(mp2b.getX() + delta, mp2b.getY());
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), myArrowColor);
|
||||
final Snake snake = Snake.create(myArrowColor)
|
||||
.withMerge(MergeStrategy.LIMITED);
|
||||
final double middle = (mp1a.getY() + mp2b.getY()) / 2.0;
|
||||
snake.addPoint(mp1a);
|
||||
snake.addPoint(mp1a.getX(), middle);
|
||||
snake.addPoint(mp2bc.getX(), middle);
|
||||
snake.addPoint(mp2bc);
|
||||
snake.goUnmergeable(MergeStrategy.LIMITED);
|
||||
ug.draw(snake);
|
||||
final Snake small = new Snake(arrowHorizontalAlignment(), myArrowColor, arrow);
|
||||
final Snake small = Snake.create(myArrowColor, arrow)
|
||||
.withMerge(MergeStrategy.LIMITED);
|
||||
small.addPoint(mp2bc);
|
||||
small.addPoint(mp2bc.getX(), mp2b.getY());
|
||||
small.addPoint(mp2b);
|
||||
small.goUnmergeable(MergeStrategy.LIMITED);
|
||||
ug.draw(small);
|
||||
} else {
|
||||
final double delta = (x2 > x1 ? -1 : 1) * 1.5 * Diamond.diamondHalfSize;
|
||||
final Point2D mp2bb = new Point2D.Double(mp2b.getX() + delta, mp2b.getY() - 1.5
|
||||
* Diamond.diamondHalfSize);
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), myArrowColor);
|
||||
final Point2D mp2bb = new Point2D.Double(mp2b.getX() + delta,
|
||||
mp2b.getY() - 1.5 * Diamond.diamondHalfSize);
|
||||
final Snake snake = Snake.create(myArrowColor)
|
||||
.withMerge(MergeStrategy.LIMITED);
|
||||
snake.addPoint(mp1a);
|
||||
snake.addPoint(mp1a.getX(), mp2bb.getY());
|
||||
snake.addPoint(mp2bb);
|
||||
snake.goUnmergeable(MergeStrategy.LIMITED);
|
||||
ug.draw(snake);
|
||||
final Snake small = new Snake(arrowHorizontalAlignment(), myArrowColor, arrow);
|
||||
final Snake small = Snake.create(myArrowColor, arrow)
|
||||
.withMerge(MergeStrategy.LIMITED);
|
||||
small.addPoint(mp2bb);
|
||||
small.addPoint(mp2bb.getX(), mp2b.getY());
|
||||
small.addPoint(mp2b);
|
||||
small.goUnmergeable(MergeStrategy.LIMITED);
|
||||
ug.draw(small);
|
||||
|
||||
}
|
||||
@ -320,9 +320,9 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
|
||||
final double x2 = p2.getX();
|
||||
final double y2 = p2.getY();
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), myArrowColor);
|
||||
Snake snake = Snake.create(myArrowColor);
|
||||
if (branchEmpty) {
|
||||
snake.emphasizeDirection(Direction.DOWN);
|
||||
snake = snake.emphasizeDirection(Direction.DOWN);
|
||||
}
|
||||
snake.addPoint(x1, y1);
|
||||
snake.addPoint(x1, y2);
|
||||
@ -346,7 +346,7 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
|
||||
final Point2D mp1a = translate1.getTranslated(p1);
|
||||
final Point2D mp2b = translate2.getTranslated(p2);
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), myArrowColor);
|
||||
final Snake snake = Snake.create(myArrowColor).withMerge(MergeStrategy.LIMITED);
|
||||
// snake.emphasizeDirection(Direction.DOWN);
|
||||
|
||||
final double x1 = mp1a.getX();
|
||||
@ -357,7 +357,6 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
|
||||
snake.addPoint(x1, y2);
|
||||
snake.addPoint(mp2b);
|
||||
snake.addPoint(x2, dimTotal.getHeight());
|
||||
snake.goUnmergeable(MergeStrategy.LIMITED);
|
||||
|
||||
ug.draw(snake);
|
||||
}
|
||||
@ -403,8 +402,7 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
|
||||
}
|
||||
final Point2D p2 = new Point2D.Double(p1.getX(), totalHeight);
|
||||
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), color, Arrows.asToDown());
|
||||
snake.setLabel(out2);
|
||||
final Snake snake = Snake.create(color, Arrows.asToDown()).withLabel(out2, arrowHorizontalAlignment());
|
||||
snake.addPoint(p1);
|
||||
snake.addPoint(p2);
|
||||
ug.draw(snake);
|
||||
@ -422,8 +420,9 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
|
||||
/*
|
||||
* private Point2D getP1(StringBounder stringBounder) {
|
||||
*
|
||||
* final FtileGeometry geo = getFtile1().calculateDimension(stringBounder); if (geo.hasPointOut() == false) {
|
||||
* return null; } final Point2D p = geo.getPointOut(); return getTranslate1(stringBounder).getTranslated(p); }
|
||||
* final FtileGeometry geo = getFtile1().calculateDimension(stringBounder); if
|
||||
* (geo.hasPointOut() == false) { return null; } final Point2D p =
|
||||
* geo.getPointOut(); return getTranslate1(stringBounder).getTranslated(p); }
|
||||
*/
|
||||
}
|
||||
|
||||
@ -474,8 +473,7 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
|
||||
return;
|
||||
}
|
||||
|
||||
final Snake s = new Snake(arrowHorizontalAlignment(), arrowColor);
|
||||
s.goUnmergeable(MergeStrategy.NONE);
|
||||
final Snake s = Snake.create(arrowColor).withMerge(MergeStrategy.NONE);
|
||||
final double height = totalDim.getHeight();
|
||||
s.addPoint(minX, height);
|
||||
s.addPoint(maxX, height);
|
||||
|
@ -50,6 +50,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.graphic.Rainbow;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.VerticalAlignment;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UPolygon;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
@ -83,8 +84,8 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
|
||||
final double x2 = p2.getX();
|
||||
final double y2 = p2.getY();
|
||||
|
||||
final Snake snake = new Snake(null, arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
|
||||
snake.setLabel(getLabelPositive(branch));
|
||||
final Snake snake = Snake.create(null, arrowColor, Arrows.asToDown()).withLabel(getLabelPositive(branch),
|
||||
arrowHorizontalAlignment());
|
||||
snake.addPoint(x1, y1);
|
||||
snake.addPoint(x2, y1);
|
||||
snake.addPoint(x2, y2);
|
||||
@ -106,8 +107,8 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
|
||||
}
|
||||
|
||||
private Point2D getP2(final StringBounder stringBounder) {
|
||||
return getTranslateOf(getFtile2(), stringBounder).getTranslated(
|
||||
getFtile2().calculateDimension(stringBounder).getPointIn());
|
||||
return getTranslateOf(getFtile2(), stringBounder)
|
||||
.getTranslated(getFtile2().calculateDimension(stringBounder).getPointIn());
|
||||
}
|
||||
|
||||
}
|
||||
@ -133,7 +134,7 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
|
||||
final double y2 = p2.getY();
|
||||
|
||||
final UPolygon arrow = x2 > x1 ? Arrows.asToRight() : Arrows.asToLeft();
|
||||
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, arrow);
|
||||
final Snake snake = Snake.create(arrowColor, arrow);
|
||||
snake.addPoint(x1, y1);
|
||||
snake.addPoint(x1, y2);
|
||||
snake.addPoint(x2, y2);
|
||||
@ -142,8 +143,8 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
|
||||
}
|
||||
|
||||
private Point2D getP1(StringBounder stringBounder) {
|
||||
return getTranslateOf(getFtile1(), stringBounder).getTranslated(
|
||||
getFtile1().calculateDimension(stringBounder).getPointOut());
|
||||
return getTranslateOf(getFtile1(), stringBounder)
|
||||
.getTranslated(getFtile1().calculateDimension(stringBounder).getPointOut());
|
||||
}
|
||||
|
||||
private Point2D getP2(StringBounder stringBounder) {
|
||||
@ -162,8 +163,10 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
|
||||
|
||||
}
|
||||
|
||||
// protected UTranslate getTranslateOf(Ftile tile, StringBounder stringBounder) {
|
||||
// return getTranslateNude(tile, stringBounder).compose(getTranslateMain(stringBounder));
|
||||
// protected UTranslate getTranslateOf(Ftile tile, StringBounder stringBounder)
|
||||
// {
|
||||
// return getTranslateNude(tile,
|
||||
// stringBounder).compose(getTranslateMain(stringBounder));
|
||||
//
|
||||
// }
|
||||
|
||||
@ -188,8 +191,8 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
|
||||
final double x2 = p2.getX();
|
||||
final double y2 = p2.getY();
|
||||
|
||||
final Snake snake = new Snake(null, arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
|
||||
snake.setLabel(getLabelPositive(branch), "BOTTOM");
|
||||
final Snake snake = Snake.create(null, arrowColor, Arrows.asToDown())
|
||||
.withLabel(getLabelPositive(branch), VerticalAlignment.BOTTOM);
|
||||
if (x2 < p1d.getX() - margin || x2 > p1b.getX() + margin) {
|
||||
snake.addPoint(x2, p1d.getY());
|
||||
snake.addPoint(x2, y2);
|
||||
@ -207,8 +210,8 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
|
||||
}
|
||||
|
||||
private Point2D getP2(final StringBounder stringBounder) {
|
||||
return getTranslateOf(getFtile2(), stringBounder).getTranslated(
|
||||
getFtile2().calculateDimension(stringBounder).getPointIn());
|
||||
return getTranslateOf(getFtile2(), stringBounder)
|
||||
.getTranslated(getFtile2().calculateDimension(stringBounder).getPointIn());
|
||||
}
|
||||
|
||||
}
|
||||
@ -241,7 +244,7 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
|
||||
|
||||
final double ym = (y1 + y2) / 2;
|
||||
|
||||
final Snake snake = new Snake(null, arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
|
||||
final Snake snake = Snake.create(null, arrowColor, Arrows.asToDown());
|
||||
|
||||
if (x1 < p1d.getX() - margin || x1 > p1b.getX() + margin) {
|
||||
snake.addPoint(x1, y1);
|
||||
@ -257,8 +260,8 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
|
||||
}
|
||||
|
||||
private Point2D getP1(StringBounder stringBounder) {
|
||||
return getTranslateOf(getFtile1(), stringBounder).getTranslated(
|
||||
getFtile1().calculateDimension(stringBounder).getPointOut());
|
||||
return getTranslateOf(getFtile1(), stringBounder)
|
||||
.getTranslated(getFtile1().calculateDimension(stringBounder).getPointOut());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -56,8 +56,8 @@ public class FtileSwitchWithOneLink extends FtileSwitchWithDiamonds {
|
||||
|
||||
private final Rainbow arrowColor;
|
||||
|
||||
public FtileSwitchWithOneLink(List<Ftile> tiles, List<Branch> branches, Swimlane in, Ftile diamond1,
|
||||
Ftile diamond2, StringBounder stringBounder, Rainbow arrowColor) {
|
||||
public FtileSwitchWithOneLink(List<Ftile> tiles, List<Branch> branches, Swimlane in, Ftile diamond1, Ftile diamond2,
|
||||
StringBounder stringBounder, Rainbow arrowColor) {
|
||||
super(tiles, branches, in, diamond1, diamond2, stringBounder);
|
||||
this.arrowColor = arrowColor;
|
||||
}
|
||||
@ -80,8 +80,8 @@ public class FtileSwitchWithOneLink extends FtileSwitchWithDiamonds {
|
||||
final double x2 = p2.getX();
|
||||
final double y2 = p2.getY();
|
||||
|
||||
final Snake snake = new Snake(null, arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
|
||||
snake.setLabel(getLabelPositive(branch));
|
||||
final Snake snake = Snake.create(null, arrowColor, Arrows.asToDown())
|
||||
.withLabel(getLabelPositive(branch), arrowHorizontalAlignment());
|
||||
// snake.addPoint(x1, y1);
|
||||
snake.addPoint(x2, y1);
|
||||
snake.addPoint(x2, y2);
|
||||
@ -95,8 +95,8 @@ public class FtileSwitchWithOneLink extends FtileSwitchWithDiamonds {
|
||||
}
|
||||
|
||||
private Point2D getP2(final StringBounder stringBounder) {
|
||||
return getTranslateOf(getFtile2(), stringBounder).getTranslated(
|
||||
getFtile2().calculateDimension(stringBounder).getPointIn());
|
||||
return getTranslateOf(getFtile2(), stringBounder)
|
||||
.getTranslated(getFtile2().calculateDimension(stringBounder).getPointIn());
|
||||
}
|
||||
}
|
||||
|
||||
@ -115,7 +115,7 @@ public class FtileSwitchWithOneLink extends FtileSwitchWithDiamonds {
|
||||
final double x2 = p2.getX();
|
||||
final double y2 = p2.getY();
|
||||
|
||||
final Snake snake = new Snake(null, arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
|
||||
final Snake snake = Snake.create(null, arrowColor, Arrows.asToDown());
|
||||
// snake.addPoint(x1, y1);
|
||||
snake.addPoint(x2, y1);
|
||||
snake.addPoint(x2, y2);
|
||||
@ -124,8 +124,8 @@ public class FtileSwitchWithOneLink extends FtileSwitchWithDiamonds {
|
||||
}
|
||||
|
||||
private Point2D getP1(StringBounder stringBounder) {
|
||||
return getTranslateOf(getFtile1(), stringBounder).getTranslated(
|
||||
getFtile1().calculateDimension(stringBounder).getPointOut());
|
||||
return getTranslateOf(getFtile1(), stringBounder)
|
||||
.getTranslated(getFtile1().calculateDimension(stringBounder).getPointOut());
|
||||
}
|
||||
|
||||
private Point2D getP2(StringBounder stringBounder) {
|
||||
|
@ -66,7 +66,9 @@ import net.sourceforge.plantuml.objectdiagram.AbstractClassOrObjectDiagram;
|
||||
final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrObjectDiagram> {
|
||||
|
||||
private static final String SINGLE = "[.\\\\]{0,2}[\\p{L}0-9_]+(?:[.\\\\]{1,2}[\\p{L}0-9_]+)*";
|
||||
private static final String COUPLE = "\\([%s]*(" + SINGLE + ")[%s]*,[%s]*(" + SINGLE + ")[%s]*\\)";
|
||||
private static final String SINGLE_GUILLEMENT = "[%g][.\\\\]{0,2}[\\p{L}0-9_]+(?:[.\\\\]{1,2}[\\p{L}0-9_]+)*[%g]";
|
||||
private static final String SINGLE2 = "(?:" + SINGLE + "|" + SINGLE_GUILLEMENT + ")";
|
||||
private static final String COUPLE = "\\([%s]*(" + SINGLE2 + ")[%s]*,[%s]*(" + SINGLE2 + ")[%s]*\\)";
|
||||
|
||||
public CommandLinkClass(UmlDiagramType umlDiagramType) {
|
||||
super(getRegexConcat(umlDiagramType));
|
||||
@ -364,8 +366,8 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
|
||||
private CommandExecutionResult executeArgSpecial1(AbstractClassOrObjectDiagram diagram, RegexResult arg) {
|
||||
if (diagram.V1972())
|
||||
return executeArgSpecial1972Ident1(diagram, arg);
|
||||
final String name1A = arg.get("COUPLE1", 0);
|
||||
final String name1B = arg.get("COUPLE1", 1);
|
||||
final String name1A = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("COUPLE1", 0));
|
||||
final String name1B = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("COUPLE1", 1));
|
||||
final Code clName1A = diagram.buildCode(name1A);
|
||||
final Code clName1B = diagram.buildCode(name1B);
|
||||
if (diagram.leafExist(clName1A) == false) {
|
||||
|
@ -58,17 +58,15 @@ public abstract class PSystemAbstractFactory implements PSystemFactory {
|
||||
|
||||
final protected PSystemError buildEmptyError(UmlSource source, LineLocation lineLocation,
|
||||
List<StringLocated> trace) {
|
||||
final ErrorUml err = new ErrorUml(ErrorUmlType.SYNTAX_ERROR, EMPTY_DESCRIPTION, /* 1, */lineLocation);
|
||||
// final AbstractPSystemError result = PSystemErrorUtils.buildV1(source, err, null);
|
||||
final ErrorUml err = new ErrorUml(ErrorUmlType.SYNTAX_ERROR, EMPTY_DESCRIPTION, lineLocation);
|
||||
final PSystemError result = PSystemErrorUtils.buildV2(source, err, null, trace);
|
||||
result.setSource(source);
|
||||
return result;
|
||||
}
|
||||
|
||||
final protected PSystemError buildExecutionError(UmlSource source, String stringError,
|
||||
LineLocation lineLocation, List<StringLocated> trace) {
|
||||
final ErrorUml err = new ErrorUml(ErrorUmlType.EXECUTION_ERROR, stringError, /* 1, */
|
||||
lineLocation);
|
||||
final protected PSystemError buildExecutionError(UmlSource source, String stringError, LineLocation lineLocation,
|
||||
List<StringLocated> trace) {
|
||||
final ErrorUml err = new ErrorUml(ErrorUmlType.EXECUTION_ERROR, stringError, lineLocation);
|
||||
final PSystemError result = PSystemErrorUtils.buildV2(source, err, null, trace);
|
||||
result.setSource(source);
|
||||
return result;
|
||||
|
@ -201,6 +201,10 @@ final public class UmlSource {
|
||||
return source.size();
|
||||
}
|
||||
|
||||
public boolean getTotalLineCountLessThan5() {
|
||||
return getTotalLineCount() < 5;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a source diagram description is empty. Does not take comment line
|
||||
* into account.
|
||||
|
@ -44,7 +44,7 @@ public enum LeafType {
|
||||
|
||||
ABSTRACT_CLASS, CLASS, INTERFACE, ANNOTATION, LOLLIPOP_FULL, LOLLIPOP_HALF, NOTE, TIPS, OBJECT, MAP, ASSOCIATION, ENUM, CIRCLE,
|
||||
|
||||
USECASE,
|
||||
USECASE, USECASE_BUSINESS,
|
||||
|
||||
DESCRIPTION,
|
||||
|
||||
|
@ -101,6 +101,13 @@ public enum LinkDecor {
|
||||
return this == EXTENDS || this == REDEFINES || this == DEFINEDBY;
|
||||
}
|
||||
|
||||
public ExtremityFactory getExtremityFactoryComplete(HColor backgroundColor) {
|
||||
if (this == EXTENDS) {
|
||||
return new ExtremityFactoryTriangle(backgroundColor, 16, 6);
|
||||
}
|
||||
return getExtremityFactory(backgroundColor);
|
||||
}
|
||||
|
||||
public ExtremityFactory getExtremityFactory(HColor backgroundColor) {
|
||||
switch (this) {
|
||||
case PLUS:
|
||||
@ -112,7 +119,7 @@ public enum LinkDecor {
|
||||
case HALF_ARROW:
|
||||
return new ExtremityFactoryHalfArrow();
|
||||
case ARROW_TRIANGLE:
|
||||
return new ExtremityFactoryTriangle();
|
||||
return new ExtremityFactoryTriangle(null, 8, 3);
|
||||
case CROWFOOT:
|
||||
return new ExtremityFactoryCrowfoot();
|
||||
case CIRCLE_CROWFOOT:
|
||||
|
@ -61,4 +61,13 @@ public enum LinkMiddleDecor {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public LinkMiddleDecor getInversed() {
|
||||
if (this == CIRCLE_CIRCLED1) {
|
||||
return CIRCLE_CIRCLED2;
|
||||
} else if (this == CIRCLE_CIRCLED2) {
|
||||
return CIRCLE_CIRCLED1;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ public class LinkType {
|
||||
}
|
||||
|
||||
public LinkType getInversed() {
|
||||
return new LinkType(hat2, decor2, style, middleDecor, decor1, hat1);
|
||||
return new LinkType(hat2, decor2, style, middleDecor.getInversed(), decor1, hat1);
|
||||
}
|
||||
|
||||
public LinkType withMiddleCircle() {
|
||||
|
@ -69,7 +69,7 @@ import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
|
||||
public class CommandCreateElementFull extends SingleLineCommand2<DescriptionDiagram> {
|
||||
|
||||
public static final String ALL_TYPES = "artifact|actor|folder|card|file|package|rectangle|label|node|frame|cloud|database|queue|stack|storage|agent|usecase|component|boundary|control|entity|interface|circle|collections|port|portin|portout";
|
||||
public static final String ALL_TYPES = "artifact|actor/|actor|folder|card|file|package|rectangle|label|node|frame|cloud|database|queue|stack|storage|agent|usecase/|usecase|component|boundary|control|entity|interface|circle|collections|port|portin|portout";
|
||||
|
||||
public CommandCreateElementFull() {
|
||||
super(getRegexConcat());
|
||||
@ -137,11 +137,11 @@ public class CommandCreateElementFull extends SingleLineCommand2<DescriptionDiag
|
||||
return ColorParser.simpleColor(ColorType.BACK, "COLOR2");
|
||||
}
|
||||
|
||||
private static final String CODE_CORE = "[\\p{L}0-9_.]+|\\(\\)[%s]*[\\p{L}0-9_.]+|\\(\\)[%s]*[%g][^%g]+[%g]|:[^:]+:|\\([^()]+\\)|\\[[^\\[\\]]+\\]";
|
||||
private static final String CODE_CORE = "[\\p{L}0-9_.]+|\\(\\)[%s]*[\\p{L}0-9_.]+|\\(\\)[%s]*[%g][^%g]+[%g]|:[^:]+:/?|\\([^()]+\\)/?|\\[[^\\[\\]]+\\]";
|
||||
public static final String CODE = "(" + CODE_CORE + ")";
|
||||
public static final String CODE_WITH_QUOTE = "(" + CODE_CORE + "|[%g].+?[%g])";
|
||||
|
||||
private static final String DISPLAY_CORE = "[%g].+?[%g]|:[^:]+:|\\([^()]+\\)|\\[[^\\[\\]]+\\]";
|
||||
private static final String DISPLAY_CORE = "[%g].+?[%g]|:[^:]+:/?|\\([^()]+\\)/?|\\[[^\\[\\]]+\\]";
|
||||
public static final String DISPLAY = "(" + DISPLAY_CORE + ")";
|
||||
public static final String DISPLAY_WITHOUT_QUOTE = "(" + DISPLAY_CORE + "|[\\p{L}0-9_.]+)";
|
||||
|
||||
@ -156,7 +156,7 @@ public class CommandCreateElementFull extends SingleLineCommand2<DescriptionDiag
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(DescriptionDiagram diagram, LineLocation location, RegexResult arg) {
|
||||
String codeRaw = arg.getLazzy("CODE", 0);
|
||||
final String displayRaw = arg.getLazzy("DISPLAY", 0);
|
||||
String displayRaw = arg.getLazzy("DISPLAY", 0);
|
||||
final char codeChar = getCharEncoding(codeRaw);
|
||||
final char codeDisplay = getCharEncoding(displayRaw);
|
||||
final String symbol;
|
||||
@ -164,9 +164,29 @@ public class CommandCreateElementFull extends SingleLineCommand2<DescriptionDiag
|
||||
symbol = "interface";
|
||||
codeRaw = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(StringUtils.trin(codeRaw.substring(2)));
|
||||
} else if (codeChar == '(' || codeDisplay == '(') {
|
||||
symbol = "usecase";
|
||||
if (arg.get("SYMBOL", 0) != null && arg.get("SYMBOL", 0).endsWith("/")) {
|
||||
symbol = "usecase/";
|
||||
} else if (displayRaw != null && displayRaw.endsWith(")/")) {
|
||||
displayRaw = displayRaw.substring(0, displayRaw.length() - 1);
|
||||
symbol = "usecase/";
|
||||
} else if (codeRaw.endsWith(")/")) {
|
||||
codeRaw = codeRaw.substring(0, codeRaw.length() - 1);
|
||||
symbol = "usecase/";
|
||||
} else {
|
||||
symbol = "usecase";
|
||||
}
|
||||
} else if (codeChar == ':' || codeDisplay == ':') {
|
||||
symbol = "actor";
|
||||
if (arg.get("SYMBOL", 0) != null && arg.get("SYMBOL", 0).endsWith("/")) {
|
||||
symbol = "actor/";
|
||||
} else if (displayRaw != null && displayRaw.endsWith(":/")) {
|
||||
displayRaw = displayRaw.substring(0, displayRaw.length() - 1);
|
||||
symbol = "actor/";
|
||||
} else if (codeRaw.endsWith(":/")) {
|
||||
codeRaw = codeRaw.substring(0, codeRaw.length() - 1);
|
||||
symbol = "actor/";
|
||||
} else {
|
||||
symbol = "actor";
|
||||
}
|
||||
} else if (codeChar == '[' || codeDisplay == '[') {
|
||||
symbol = "component";
|
||||
} else {
|
||||
@ -191,6 +211,9 @@ public class CommandCreateElementFull extends SingleLineCommand2<DescriptionDiag
|
||||
} else if (symbol.equalsIgnoreCase("usecase")) {
|
||||
type = LeafType.USECASE;
|
||||
usymbol = null;
|
||||
} else if (symbol.equalsIgnoreCase("usecase/")) {
|
||||
type = LeafType.USECASE_BUSINESS;
|
||||
usymbol = null;
|
||||
} else if (symbol.equalsIgnoreCase("circle")) {
|
||||
type = LeafType.CIRCLE;
|
||||
usymbol = null;
|
||||
@ -284,4 +307,3 @@ public class CommandCreateElementFull extends SingleLineCommand2<DescriptionDiag
|
||||
return codeRaw != null && codeRaw.length() > 2 ? codeRaw.charAt(0) : 0;
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public class PSystemDotFactory extends PSystemBasicFactory<PSystemDot> {
|
||||
|
||||
@Override
|
||||
public PSystemDot executeLine(PSystemDot system, String line) {
|
||||
if (system == null && line.matches("(strict\\s+)?(di)?graph\\s+\\w+\\s*\\{")) {
|
||||
if (system == null && line.matches("(strict\\s+)?(di)?graph\\s+\"?[-\\w]+\"?\\s*\\{")) {
|
||||
data = new StringBuilder(line);
|
||||
data.append("\n");
|
||||
return new PSystemDot(data.toString());
|
||||
|
@ -175,7 +175,7 @@ public abstract class PSystemError extends AbstractPSystem {
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<String> getTextFullBody() {
|
||||
protected List<String> getTextFullBody() {
|
||||
final List<String> result = new ArrayList<String>();
|
||||
result.add(" ");
|
||||
final int traceSize = trace.size();
|
||||
@ -227,7 +227,7 @@ public abstract class PSystemError extends AbstractPSystem {
|
||||
final ImageBuilder imageBuilder = ImageBuilder.buildA(new ColorMapperIdentity(), false, null, getMetadata(),
|
||||
null, 1.0, result.getBackcolor());
|
||||
imageBuilder.setRandomPixel(true);
|
||||
if (getSource().getTotalLineCount() < 5) {
|
||||
if (getSource().getTotalLineCountLessThan5()) {
|
||||
udrawable = addWelcome(result);
|
||||
} else {
|
||||
udrawable = result;
|
||||
|
52
src/net/sourceforge/plantuml/error/PSystemErrorEmpty.java
Normal file
52
src/net/sourceforge/plantuml/error/PSystemErrorEmpty.java
Normal file
@ -0,0 +1,52 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2020, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* If you like this project or if you find it useful, you can support us at:
|
||||
*
|
||||
* http://plantuml.com/patreon (only 1$ per month!)
|
||||
* http://plantuml.com/paypal
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.error;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.ErrorUml;
|
||||
import net.sourceforge.plantuml.StringLocated;
|
||||
import net.sourceforge.plantuml.core.UmlSource;
|
||||
|
||||
public class PSystemErrorEmpty extends PSystemError {
|
||||
|
||||
public PSystemErrorEmpty(UmlSource source, List<StringLocated> trace, ErrorUml singleError) {
|
||||
this.setSource(source);
|
||||
this.trace = trace;
|
||||
this.singleError = singleError;
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -45,13 +45,11 @@ import net.sourceforge.plantuml.core.UmlSource;
|
||||
|
||||
public class PSystemErrorUtils {
|
||||
|
||||
// public static AbstractPSystemError buildV1(UmlSource source, ErrorUml singleError, List<String> debugLines) {
|
||||
// return new PSystemErrorV1(source, singleError, debugLines);
|
||||
// }
|
||||
|
||||
public static PSystemError buildV2(UmlSource source, ErrorUml singleError, List<String> debugLines,
|
||||
List<StringLocated> list) {
|
||||
// return new PSystemErrorV1(source, singleError, debugLines);
|
||||
// if (source.isEmpty()) {
|
||||
// return new PSystemErrorEmpty(source, list, singleError);
|
||||
// }
|
||||
return new PSystemErrorV2(source, list, singleError);
|
||||
}
|
||||
|
||||
@ -68,12 +66,6 @@ public class PSystemErrorUtils {
|
||||
source = system.getSource();
|
||||
}
|
||||
errors.addAll(system.getErrorsUml());
|
||||
// if (system instanceof PSystemErrorV1) {
|
||||
// debugs.addAll(((PSystemErrorV1) system).debugLines);
|
||||
// if (((PSystemErrorV1) system).debugLines.size() > 0) {
|
||||
// debugs.add("-");
|
||||
// }
|
||||
// }
|
||||
if (system instanceof PSystemErrorV2) {
|
||||
errorsV2.add((PSystemErrorV2) system);
|
||||
}
|
||||
@ -85,7 +77,6 @@ public class PSystemErrorUtils {
|
||||
return mergeV2(errorsV2);
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
// return new PSystemErrorV1(source, errors, debugs);
|
||||
}
|
||||
|
||||
private static PSystemErrorV2 mergeV2(List<PSystemErrorV2> errorsV2) {
|
||||
@ -100,7 +91,6 @@ public class PSystemErrorUtils {
|
||||
|
||||
public static boolean isDiagramError(Class<? extends Diagram> type) {
|
||||
return PSystemError.class.isAssignableFrom(type);
|
||||
// return type == PSystemErrorV1.class;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ public class QuoteUtils {
|
||||
"Lbh xabj jung fhecevfrq zr gur zbfg? Vg jnfa'g zrrgvat gurz. Vg jnf zrrgvat lbh.",
|
||||
"Va jne gurer ner ab jvaaref, bayl jvqbjf",
|
||||
"Vs lbh guvax guvf Havirefr vf onq, lbh fubhyq frr fbzr bs gur bguref", "Cnp-Zna'f n onq thl?",
|
||||
"Zl ernyvgl vf whfg qvssrerag guna lbhef", "L'ra n dh'bag rffnlr, vyf bag rh qrf ceboyrzrf",
|
||||
"L'ra n dh'bag rffnlr, vyf bag rh qrf ceboyrzrf",
|
||||
"Gb ree vf uhzna, ohg gb ernyyl sbhy guvatf hc erdhverf n pbzchgre.",
|
||||
"Vs lbh oryvrir rirelguvat lbh ernq, lbh orggre abg ernq",
|
||||
"Gurer vf ab ceboyrz fb onq lbh pna'g znxr vg jbefr", "Pn p'rfg qh ybheq... Ha gehp qr znynqr.",
|
||||
@ -276,7 +276,8 @@ public class QuoteUtils {
|
||||
"Vs lbh ner abg rzoneenffrq ol gur svefg irefvba bs lbhe cebqhpg, lbh'ir ynhapurq gbb yngr",
|
||||
"Zvfgnxrf znqr zl fhpprff: V znxr ehoore renfre", "Ovt Oebgure vf Jngpuvat Lbh.",
|
||||
"Ab bar'f gnyxvat nobhg yrnivat gur fvatyr znexrg", "...rnfvrfg oht gb svk va uhzna uvfgbel",
|
||||
"Arire nggevohgr gb znyvpr jung pna or rkcynvarq ol fghcvqvgl", "Guvf oht nssrpgf iveghnyyl abobql");
|
||||
"Arire nggevohgr gb znyvpr jung pna or rkcynvarq ol fghcvqvgl", "Guvf oht nssrpgf iveghnyyl abobql",
|
||||
"Qba'g rire hfr gur jbeq fzneg jvgu zr", "Gur Ertrareba vf ernyyl xvpxvat va guvf zbeavat");
|
||||
|
||||
private QuoteUtils() {
|
||||
}
|
||||
|
@ -141,6 +141,10 @@ public class Splitter {
|
||||
return splitted;
|
||||
}
|
||||
|
||||
public static String purgeAllTag(String s) {
|
||||
return s.replaceAll(htmlTag, "");
|
||||
}
|
||||
|
||||
public List<HtmlCommand> getHtmlCommands(boolean newLineAlone) {
|
||||
final HtmlCommandFactory factory = new HtmlCommandFactory();
|
||||
final List<HtmlCommand> result = new ArrayList<HtmlCommand>();
|
||||
|
@ -76,6 +76,8 @@ public abstract class USymbol {
|
||||
public final static USymbol AGENT = record("AGENT", SkinParameter.AGENT, new USymbolRect(SkinParameter.AGENT));
|
||||
public final static USymbol ACTOR_STICKMAN = record("ACTOR_STICKMAN", SkinParameter.ACTOR,
|
||||
new USymbolActor(ActorStyle.STICKMAN));
|
||||
public final static USymbol ACTOR_STICKMAN_BUSINESS = record("ACTOR_STICKMAN_BUSINESS", SkinParameter.ACTOR,
|
||||
new USymbolActor(ActorStyle.STICKMAN_BUSINESS));
|
||||
public final static USymbol ACTOR_AWESOME = record("ACTOR_AWESOME", SkinParameter.ACTOR,
|
||||
new USymbolActor(ActorStyle.AWESOME));
|
||||
public final static USymbol USECASE = null;
|
||||
@ -170,17 +172,17 @@ public abstract class USymbol {
|
||||
return 0;
|
||||
}
|
||||
|
||||
final Stencil getRectangleStencil(final Dimension2D dim) {
|
||||
return new Stencil() {
|
||||
public double getStartingX(StringBounder stringBounder, double y) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public double getEndingX(StringBounder stringBounder, double y) {
|
||||
return dim.getWidth();
|
||||
}
|
||||
};
|
||||
}
|
||||
// final Stencil getRectangleStencil(final Dimension2D dim) {
|
||||
// return new Stencil() {
|
||||
// public double getStartingX(StringBounder stringBounder, double y) {
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// public double getEndingX(StringBounder stringBounder, double y) {
|
||||
// return dim.getWidth();
|
||||
// }
|
||||
// };
|
||||
// }
|
||||
|
||||
public static USymbol fromString(String s, ActorStyle actorStyle, ComponentStyle componentStyle,
|
||||
PackageStyle packageStyle) {
|
||||
@ -235,6 +237,8 @@ public abstract class USymbol {
|
||||
usymbol = USymbol.STORAGE;
|
||||
} else if (symbol.equalsIgnoreCase("agent")) {
|
||||
usymbol = USymbol.AGENT;
|
||||
} else if (symbol.equalsIgnoreCase("actor/")) {
|
||||
usymbol = USymbol.ACTOR_STICKMAN_BUSINESS;
|
||||
} else if (symbol.equalsIgnoreCase("actor")) {
|
||||
usymbol = skinParam.actorStyle().toUSymbol();
|
||||
} else if (symbol.equalsIgnoreCase("component")) {
|
||||
|
@ -43,7 +43,6 @@ import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
|
||||
import net.sourceforge.plantuml.ugraphic.ULine;
|
||||
import net.sourceforge.plantuml.ugraphic.UPolygon;
|
||||
import net.sourceforge.plantuml.ugraphic.URectangle;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
class USymbolArtifact extends USymbol {
|
||||
@ -53,7 +52,8 @@ class USymbolArtifact extends USymbol {
|
||||
return SkinParameter.ARTIFACT;
|
||||
}
|
||||
|
||||
private void drawArtifact(UGraphic ug, double widthTotal, double heightTotal, boolean shadowing, double roundCorner) {
|
||||
private void drawArtifact(UGraphic ug, double widthTotal, double heightTotal, boolean shadowing,
|
||||
double roundCorner) {
|
||||
|
||||
final URectangle form = new URectangle(widthTotal, heightTotal).rounded(roundCorner);
|
||||
if (shadowing) {
|
||||
@ -100,7 +100,7 @@ class USymbolArtifact extends USymbol {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
final Dimension2D dim = calculateDimension(ug.getStringBounder());
|
||||
ug = UGraphicStencil.create(ug, getRectangleStencil(dim), new UStroke());
|
||||
ug = UGraphicStencil.create(ug, dim);
|
||||
ug = symbolContext.apply(ug);
|
||||
drawArtifact(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(),
|
||||
symbolContext.getRoundCorner());
|
||||
@ -119,7 +119,8 @@ class USymbolArtifact extends USymbol {
|
||||
|
||||
@Override
|
||||
public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, final TextBlock stereotype,
|
||||
final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
|
||||
final double width, final double height, final SymbolContext symbolContext,
|
||||
final HorizontalAlignment stereoAlignment) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
|
@ -42,7 +42,6 @@ import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
|
||||
import net.sourceforge.plantuml.ugraphic.ULine;
|
||||
import net.sourceforge.plantuml.ugraphic.URectangle;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
class USymbolCard extends USymbol {
|
||||
@ -80,7 +79,7 @@ class USymbolCard extends USymbol {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
final Dimension2D dim = calculateDimension(ug.getStringBounder());
|
||||
ug = UGraphicStencil.create(ug, getRectangleStencil(dim), new UStroke());
|
||||
ug = UGraphicStencil.create(ug, dim);
|
||||
ug = symbolContext.apply(ug);
|
||||
drawCard(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(), 0,
|
||||
symbolContext.getRoundCorner());
|
||||
|
@ -45,7 +45,6 @@ import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
|
||||
import net.sourceforge.plantuml.ugraphic.UPath;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
// https://stackoverflow.com/questions/39552127/algorithm-for-drawing-random-comic-style-clouds
|
||||
// http://martin-oehm.de/data/cloud.html
|
||||
@ -225,7 +224,7 @@ class USymbolCloud extends USymbol {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
final Dimension2D dim = calculateDimension(ug.getStringBounder());
|
||||
ug = UGraphicStencil.create(ug, getRectangleStencil(dim), new UStroke());
|
||||
ug = UGraphicStencil.create(ug, dim);
|
||||
ug = symbolContext.apply(ug);
|
||||
drawCloud(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing());
|
||||
final Margin margin = getMargin();
|
||||
|
@ -41,7 +41,6 @@ import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
|
||||
import net.sourceforge.plantuml.ugraphic.URectangle;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
class USymbolCollections extends USymbol {
|
||||
@ -90,7 +89,7 @@ class USymbolCollections extends USymbol {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
final Dimension2D dim = calculateDimension(ug.getStringBounder());
|
||||
ug = UGraphicStencil.create(ug, getRectangleStencil(dim), new UStroke());
|
||||
ug = UGraphicStencil.create(ug, dim);
|
||||
ug = symbolContext.apply(ug);
|
||||
drawCollections(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(),
|
||||
symbolContext.getRoundCorner());
|
||||
|
@ -42,7 +42,6 @@ import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
|
||||
import net.sourceforge.plantuml.ugraphic.URectangle;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
class USymbolComponent1 extends USymbol {
|
||||
@ -81,7 +80,7 @@ class USymbolComponent1 extends USymbol {
|
||||
public void drawU(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final Dimension2D dimTotal = calculateDimension(stringBounder);
|
||||
ug = UGraphicStencil.create(ug, getRectangleStencil(dimTotal), new UStroke());
|
||||
ug = UGraphicStencil.create(ug, dimTotal);
|
||||
ug = symbolContext.apply(ug);
|
||||
drawComponent1(ug, dimTotal.getWidth(), dimTotal.getHeight(), symbolContext.isShadowing(),
|
||||
symbolContext.getRoundCorner());
|
||||
|
@ -42,7 +42,6 @@ import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
|
||||
import net.sourceforge.plantuml.ugraphic.URectangle;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
class USymbolComponent2 extends USymbol {
|
||||
@ -83,7 +82,7 @@ class USymbolComponent2 extends USymbol {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
final Dimension2D dim = calculateDimension(ug.getStringBounder());
|
||||
ug = UGraphicStencil.create(ug, getRectangleStencil(dim), new UStroke());
|
||||
ug = UGraphicStencil.create(ug, dim);
|
||||
ug = symbolContext.apply(ug);
|
||||
drawComponent2(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(),
|
||||
symbolContext.getRoundCorner());
|
||||
@ -104,7 +103,8 @@ class USymbolComponent2 extends USymbol {
|
||||
|
||||
@Override
|
||||
public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, final TextBlock stereotype,
|
||||
final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
|
||||
final double width, final double height, final SymbolContext symbolContext,
|
||||
final HorizontalAlignment stereoAlignment) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
|
@ -44,7 +44,6 @@ import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
|
||||
import net.sourceforge.plantuml.ugraphic.UPath;
|
||||
import net.sourceforge.plantuml.ugraphic.UPolygon;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
class USymbolFile extends USymbol {
|
||||
@ -110,7 +109,7 @@ class USymbolFile extends USymbol {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
final Dimension2D dim = calculateDimension(ug.getStringBounder());
|
||||
ug = UGraphicStencil.create(ug, getRectangleStencil(dim), new UStroke());
|
||||
ug = UGraphicStencil.create(ug, dim);
|
||||
ug = symbolContext.apply(ug);
|
||||
drawFile(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(),
|
||||
symbolContext.getRoundCorner());
|
||||
@ -129,7 +128,8 @@ class USymbolFile extends USymbol {
|
||||
|
||||
@Override
|
||||
public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, final TextBlock stereotype,
|
||||
final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
|
||||
final double width, final double height, final SymbolContext symbolContext,
|
||||
final HorizontalAlignment stereoAlignment) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
|
@ -45,7 +45,6 @@ import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
|
||||
import net.sourceforge.plantuml.ugraphic.ULine;
|
||||
import net.sourceforge.plantuml.ugraphic.UPath;
|
||||
import net.sourceforge.plantuml.ugraphic.UPolygon;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class USymbolFolder extends USymbol {
|
||||
@ -147,7 +146,7 @@ public class USymbolFolder extends USymbol {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
final Dimension2D dim = calculateDimension(ug.getStringBounder());
|
||||
ug = UGraphicStencil.create(ug, getRectangleStencil(dim), new UStroke());
|
||||
ug = UGraphicStencil.create(ug, dim);
|
||||
ug = symbolContext.apply(ug);
|
||||
final Dimension2D dimName = showTitle ? name.calculateDimension(ug.getStringBounder())
|
||||
: new Dimension2DDouble(40, 15);
|
||||
|
@ -43,7 +43,6 @@ import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
|
||||
import net.sourceforge.plantuml.ugraphic.UPath;
|
||||
import net.sourceforge.plantuml.ugraphic.URectangle;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorNone;
|
||||
|
||||
@ -105,7 +104,7 @@ class USymbolFrame extends USymbol {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
final Dimension2D dim = calculateDimension(ug.getStringBounder());
|
||||
ug = UGraphicStencil.create(ug, getRectangleStencil(dim), new UStroke());
|
||||
ug = UGraphicStencil.create(ug, dim);
|
||||
ug = symbolContext.apply(ug);
|
||||
drawFrame(ug, dim.getWidth(), dim.getHeight(), new Dimension2DDouble(0, 0), symbolContext.isShadowing(),
|
||||
symbolContext.getRoundCorner());
|
||||
|
@ -40,7 +40,6 @@ import java.awt.geom.Dimension2D;
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
class USymbolLabel extends USymbol {
|
||||
@ -67,7 +66,7 @@ class USymbolLabel extends USymbol {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
final Dimension2D dim = calculateDimension(ug.getStringBounder());
|
||||
ug = UGraphicStencil.create(ug, getRectangleStencil(dim), new UStroke());
|
||||
ug = UGraphicStencil.create(ug, dim);
|
||||
ug = symbolContext.apply(ug);
|
||||
final Margin margin = getMargin();
|
||||
final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, stereoAlignment);
|
||||
|
@ -42,7 +42,6 @@ import net.sourceforge.plantuml.ugraphic.Shadowable;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
|
||||
import net.sourceforge.plantuml.ugraphic.URectangle;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
class USymbolRect extends USymbol {
|
||||
@ -61,8 +60,7 @@ class USymbolRect extends USymbol {
|
||||
private void drawRect(UGraphic ug, double width, double height, boolean shadowing, double roundCorner,
|
||||
double diagonalCorner) {
|
||||
final URectangle rect = new URectangle(width, height);
|
||||
final Shadowable shape = diagonalCorner > 0 ? rect.diagonalCorner(diagonalCorner)
|
||||
: rect.rounded(roundCorner);
|
||||
final Shadowable shape = diagonalCorner > 0 ? rect.diagonalCorner(diagonalCorner) : rect.rounded(roundCorner);
|
||||
if (shadowing) {
|
||||
shape.setDeltaShadow(3.0);
|
||||
}
|
||||
@ -80,7 +78,7 @@ class USymbolRect extends USymbol {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
final Dimension2D dim = calculateDimension(ug.getStringBounder());
|
||||
ug = UGraphicStencil.create(ug, getRectangleStencil(dim), new UStroke());
|
||||
ug = UGraphicStencil.create(ug, dim);
|
||||
ug = symbolContext.apply(ug);
|
||||
drawRect(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(),
|
||||
symbolContext.getRoundCorner(), symbolContext.getDiagonalCorner());
|
||||
|
@ -40,7 +40,6 @@ import java.awt.geom.Dimension2D;
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
abstract class USymbolSimpleAbstract extends USymbol {
|
||||
@ -68,7 +67,7 @@ abstract class USymbolSimpleAbstract extends USymbol {
|
||||
final double labelY = dimStickMan.getHeight() + dimStereo.getHeight();
|
||||
|
||||
// Actor bug?
|
||||
final UGraphic ug2 = UGraphicStencil.create(ug, getRectangleStencil(dimLabel), new UStroke());
|
||||
final UGraphic ug2 = UGraphicStencil.create(ug, dimLabel);
|
||||
label.drawU(ug2.apply(new UTranslate(labelX, labelY)));
|
||||
// label.drawU(ug.apply(new UTranslate(labelX, labelY)));
|
||||
|
||||
|
@ -43,7 +43,6 @@ import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
|
||||
import net.sourceforge.plantuml.ugraphic.UPath;
|
||||
import net.sourceforge.plantuml.ugraphic.URectangle;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorNone;
|
||||
|
||||
@ -97,7 +96,7 @@ class USymbolStack extends USymbol {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
final Dimension2D dim = calculateDimension(ug.getStringBounder());
|
||||
ug = UGraphicStencil.create(ug, getRectangleStencil(dim), new UStroke());
|
||||
ug = UGraphicStencil.create(ug, dim);
|
||||
ug = symbolContext.apply(ug);
|
||||
drawQueue(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(),
|
||||
symbolContext.getRoundCorner());
|
||||
|
@ -41,7 +41,6 @@ import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
|
||||
import net.sourceforge.plantuml.ugraphic.URectangle;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
class USymbolStorage extends USymbol {
|
||||
@ -70,7 +69,7 @@ class USymbolStorage extends USymbol {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
final Dimension2D dim = calculateDimension(ug.getStringBounder());
|
||||
ug = UGraphicStencil.create(ug, getRectangleStencil(dim), new UStroke());
|
||||
ug = UGraphicStencil.create(ug, dim);
|
||||
ug = symbolContext.apply(ug);
|
||||
drawStorage(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing());
|
||||
final Margin margin = getMargin();
|
||||
|
@ -62,6 +62,7 @@ import h.ST_Agraph_s;
|
||||
import h.ST_Agraphinfo_t;
|
||||
import h.ST_GVC_s;
|
||||
import h.ST_boxf;
|
||||
import net.sourceforge.plantuml.AnnotatedWorker;
|
||||
import net.sourceforge.plantuml.FileFormatOption;
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
@ -82,6 +83,7 @@ import net.sourceforge.plantuml.cucadiagram.Member;
|
||||
import net.sourceforge.plantuml.cucadiagram.MethodsOrFieldsArea;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.cucadiagram.entity.EntityFactory;
|
||||
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.QuoteUtils;
|
||||
@ -90,10 +92,11 @@ import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockEmpty;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockWidth;
|
||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||
import net.sourceforge.plantuml.graphic.USymbol;
|
||||
import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft;
|
||||
import net.sourceforge.plantuml.style.SName;
|
||||
import net.sourceforge.plantuml.style.Style;
|
||||
import net.sourceforge.plantuml.style.StyleSignature;
|
||||
import net.sourceforge.plantuml.svek.Bibliotekon;
|
||||
import net.sourceforge.plantuml.svek.Cluster;
|
||||
import net.sourceforge.plantuml.svek.CucaDiagramFileMaker;
|
||||
@ -102,10 +105,12 @@ import net.sourceforge.plantuml.svek.GeneralImageBuilder;
|
||||
import net.sourceforge.plantuml.svek.GraphvizCrash;
|
||||
import net.sourceforge.plantuml.svek.IEntityImage;
|
||||
import net.sourceforge.plantuml.svek.Node;
|
||||
import net.sourceforge.plantuml.svek.TextBlockBackcolored;
|
||||
import net.sourceforge.plantuml.ugraphic.ImageBuilder;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
import smetana.core.CString;
|
||||
import smetana.core.JUtils;
|
||||
import smetana.core.JUtilsDebug;
|
||||
@ -123,12 +128,14 @@ public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker {
|
||||
|
||||
private final DotStringFactory dotStringFactory;
|
||||
|
||||
class Drawing implements UDrawable {
|
||||
class Drawing extends AbstractTextBlock implements TextBlockBackcolored {
|
||||
|
||||
private final YMirror ymirror;
|
||||
private final Dimension2D dim;
|
||||
|
||||
public Drawing(YMirror ymirror) {
|
||||
public Drawing(YMirror ymirror, Dimension2D dim) {
|
||||
this.ymirror = ymirror;
|
||||
this.dim = dim;
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
@ -149,12 +156,22 @@ public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker {
|
||||
|
||||
for (Map.Entry<Link, ST_Agedge_s> ent : edges.entrySet()) {
|
||||
final Link link = ent.getKey();
|
||||
if (link.isInvis()) {
|
||||
continue;
|
||||
}
|
||||
final ST_Agedge_s edge = ent.getValue();
|
||||
new JDotPath(link, edge, ymirror, diagram, getLabel(link), getQualifier(link, 1), getQualifier(link, 2))
|
||||
.drawU(ug);
|
||||
}
|
||||
}
|
||||
|
||||
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
||||
if (dim == null) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
return dim;
|
||||
}
|
||||
|
||||
private Point2D getCorner(ST_Agnode_s n) {
|
||||
final ST_Agnodeinfo_t data = (ST_Agnodeinfo_t) Macro.AGDATA(n).castTo(ST_Agnodeinfo_t.class);
|
||||
final double width = data.width * 72;
|
||||
@ -168,6 +185,10 @@ public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker {
|
||||
return ymirror.getMirrored(new Point2D.Double(x - width / 2, y + height / 2));
|
||||
}
|
||||
|
||||
public HColor getBackcolor() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public CucaDiagramFileMakerJDot(CucaDiagram diagram, StringBounder stringBounder) {
|
||||
@ -419,23 +440,27 @@ public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker {
|
||||
|
||||
final double scale = 1;
|
||||
|
||||
final int margin1;
|
||||
final int margin2;
|
||||
final ClockwiseTopRightBottomLeft margins;
|
||||
if (SkinParam.USE_STYLES()) {
|
||||
margin1 = SkinParam.zeroMargin(0);
|
||||
margin2 = SkinParam.zeroMargin(0);
|
||||
final Style style = StyleSignature.of(SName.root, SName.document)
|
||||
.getMergedStyle(diagram.getSkinParam().getCurrentStyleBuilder());
|
||||
margins = style.getMargin();
|
||||
} else {
|
||||
margin1 = 0;
|
||||
margin2 = 0;
|
||||
margins = ClockwiseTopRightBottomLeft.topRightBottomLeft(0, 5, 5, 0);
|
||||
}
|
||||
final ImageBuilder imageBuilder = ImageBuilder.buildD(diagram.getSkinParam(),
|
||||
ClockwiseTopRightBottomLeft.margin1margin2(margin1, margin2), diagram.getAnimation(),
|
||||
fileFormatOption.isWithMetadata() ? diagram.getMetadata() : null, null, scale);
|
||||
|
||||
imageBuilder.setUDrawable(new Drawing(null));
|
||||
final ImageBuilder imageBuilder = ImageBuilder.buildD(diagram.getSkinParam(), margins,
|
||||
diagram.getAnimation(), fileFormatOption.isWithMetadata() ? diagram.getMetadata() : null, null,
|
||||
scale);
|
||||
|
||||
imageBuilder.setUDrawable(new Drawing(null, null));
|
||||
final Dimension2D dim = imageBuilder.getFinalDimension(stringBounder);
|
||||
|
||||
imageBuilder.setUDrawable(new Drawing(new YMirror(dim.getHeight())));
|
||||
final AnnotatedWorker annotatedWorker = new AnnotatedWorker(diagram, diagram.getSkinParam(),
|
||||
fileFormatOption.getDefaultStringBounder());
|
||||
|
||||
// imageBuilder.setUDrawable(new Drawing(new YMirror(dim.getHeight())));
|
||||
imageBuilder.setUDrawable(annotatedWorker.addAdd(new Drawing(new YMirror(dim.getHeight()), dim)));
|
||||
|
||||
return imageBuilder.writeImageTOBEMOVED(fileFormatOption, diagram.seed(), os);
|
||||
} catch (Throwable e) {
|
||||
@ -466,6 +491,10 @@ public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker {
|
||||
|
||||
private void exportGroup(ST_Agraph_s graph, IGroup group) {
|
||||
final Cluster cluster = getBibliotekon().getCluster(group);
|
||||
if (cluster == null) {
|
||||
System.err.println("CucaDiagramFileMakerJDot::exportGroup issue");
|
||||
return;
|
||||
}
|
||||
JUtils.LOG2("cluster = " + cluster.getClusterId());
|
||||
final ST_Agraph_s cluster1 = agsubg(graph, new CString(cluster.getClusterId()), true);
|
||||
if (cluster.isLabel()) {
|
||||
|
@ -44,17 +44,21 @@ import h.ST_pointf;
|
||||
import h.ST_splines;
|
||||
import h.ST_textlabel_t;
|
||||
import net.sourceforge.plantuml.ColorParam;
|
||||
import net.sourceforge.plantuml.LineParam;
|
||||
import net.sourceforge.plantuml.UmlDiagramType;
|
||||
import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
|
||||
import net.sourceforge.plantuml.cucadiagram.Link;
|
||||
import net.sourceforge.plantuml.cucadiagram.LinkType;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorType;
|
||||
import net.sourceforge.plantuml.posimo.DotPath;
|
||||
import net.sourceforge.plantuml.skin.rose.Rose;
|
||||
import net.sourceforge.plantuml.svek.extremity.ExtremityFactory;
|
||||
import net.sourceforge.plantuml.ugraphic.UEllipse;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.URectangle;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorNone;
|
||||
@ -118,7 +122,15 @@ public class JDotPath implements UDrawable {
|
||||
}
|
||||
|
||||
if (dotPath != null) {
|
||||
ug.apply(color).draw(dotPath);
|
||||
final LinkType linkType = link.getType();
|
||||
UStroke stroke = linkType.getStroke3(diagram.getSkinParam().getThickness(LineParam.arrow, null));
|
||||
if (link.getColors() != null && link.getColors().getSpecificLineStroke() != null) {
|
||||
stroke = link.getColors().getSpecificLineStroke();
|
||||
}
|
||||
|
||||
ug.apply(stroke).apply(color).draw(dotPath);
|
||||
printExtremityAtStart(ug.apply(color));
|
||||
printExtremityAtEnd(ug.apply(color));
|
||||
}
|
||||
if (getLabelRectangleTranslate("label") != null) {
|
||||
label.drawU(ug.apply(getLabelRectangleTranslate("label")));
|
||||
@ -133,6 +145,46 @@ public class JDotPath implements UDrawable {
|
||||
|
||||
}
|
||||
|
||||
private void printExtremityAtStart(UGraphic ug) {
|
||||
final ExtremityFactory extremityFactory2 = link.getType().getDecor2()
|
||||
.getExtremityFactoryComplete(HColorUtils.WHITE);
|
||||
if (extremityFactory2 == null) {
|
||||
return;
|
||||
}
|
||||
final ST_splines splines = getSplines(edge);
|
||||
DotPath s = getDotPath(splines);
|
||||
Point2D p0 = s.getStartPoint();
|
||||
double startAngle = s.getStartAngle();
|
||||
if (ymirror != null) {
|
||||
p0 = ymirror.getMirrored(p0);
|
||||
startAngle = -startAngle + Math.PI;
|
||||
}
|
||||
final UDrawable extremity2 = extremityFactory2.createUDrawable(p0, startAngle, null);
|
||||
if (extremity2 != null) {
|
||||
extremity2.drawU(ug);
|
||||
}
|
||||
}
|
||||
|
||||
private void printExtremityAtEnd(UGraphic ug) {
|
||||
final ExtremityFactory extremityFactory1 = link.getType().getDecor1()
|
||||
.getExtremityFactoryComplete(HColorUtils.WHITE);
|
||||
if (extremityFactory1 == null) {
|
||||
return;
|
||||
}
|
||||
final ST_splines splines = getSplines(edge);
|
||||
DotPath s = getDotPath(splines);
|
||||
Point2D p0 = s.getEndPoint();
|
||||
double endAngle = s.getEndAngle();
|
||||
if (ymirror != null) {
|
||||
p0 = ymirror.getMirrored(p0);
|
||||
endAngle = -endAngle;
|
||||
}
|
||||
final UDrawable extremity1 = extremityFactory1.createUDrawable(p0, endAngle, null);
|
||||
if (extremity1 != null) {
|
||||
extremity1.drawU(ug);
|
||||
}
|
||||
}
|
||||
|
||||
private void printDebug(UGraphic ug) {
|
||||
ug = ug.apply(HColorUtils.BLUE).apply(HColorUtils.BLUE.bg());
|
||||
final ST_splines splines = getSplines(edge);
|
||||
|
155
src/net/sourceforge/plantuml/picoweb/PicoWebServer.java
Normal file
155
src/net/sourceforge/plantuml/picoweb/PicoWebServer.java
Normal file
@ -0,0 +1,155 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2020, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* If you like this project or if you find it useful, you can support us at:
|
||||
*
|
||||
* http://plantuml.com/patreon (only 1$ per month!)
|
||||
* http://plantuml.com/paypal
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Highly inspired from https://www.ssaurel.com/blog/create-a-simple-http-web-server-in-java
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.picoweb;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.util.Date;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import net.sourceforge.plantuml.FileFormat;
|
||||
import net.sourceforge.plantuml.FileFormatOption;
|
||||
import net.sourceforge.plantuml.SourceStringReader;
|
||||
import net.sourceforge.plantuml.code.NoPlantumlCompressionException;
|
||||
import net.sourceforge.plantuml.code.Transcoder;
|
||||
import net.sourceforge.plantuml.code.TranscoderUtil;
|
||||
|
||||
public class PicoWebServer implements Runnable {
|
||||
|
||||
private final Socket connect;
|
||||
|
||||
public PicoWebServer(Socket c) {
|
||||
this.connect = c;
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
startServer(8080);
|
||||
}
|
||||
|
||||
public static void startServer(final int port) throws IOException {
|
||||
final ServerSocket serverConnect = new ServerSocket(port);
|
||||
while (true) {
|
||||
final PicoWebServer myServer = new PicoWebServer(serverConnect.accept());
|
||||
final Thread thread = new Thread(myServer);
|
||||
thread.start();
|
||||
}
|
||||
}
|
||||
|
||||
public void run() {
|
||||
BufferedReader in = null;
|
||||
BufferedOutputStream out = null;
|
||||
|
||||
try {
|
||||
in = new BufferedReader(new InputStreamReader(connect.getInputStream(), "UTF-8"));
|
||||
out = new BufferedOutputStream(connect.getOutputStream());
|
||||
|
||||
final String first = in.readLine();
|
||||
if (first == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final StringTokenizer parse = new StringTokenizer(first);
|
||||
final String method = parse.nextToken().toUpperCase();
|
||||
|
||||
if (method.equals("GET")) {
|
||||
final String path = parse.nextToken();
|
||||
if (path.startsWith("/plantuml/png/")) {
|
||||
sendDiagram(out, path, "image/png", FileFormat.PNG);
|
||||
return;
|
||||
}
|
||||
if (path.startsWith("/plantuml/svg/")) {
|
||||
sendDiagram(out, path, "image/svg+xml", FileFormat.SVG);
|
||||
return;
|
||||
}
|
||||
}
|
||||
write(out, "HTTP/1.1 302 Found");
|
||||
write(out, "Location: /plantuml/png/oqbDJyrBuGh8ISmh2VNrKGZ8JCuFJqqAJYqgIotY0aefG5G00000");
|
||||
write(out, "");
|
||||
out.flush();
|
||||
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
in.close();
|
||||
out.close();
|
||||
connect.close();
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void sendDiagram(BufferedOutputStream out, String path, final String mime, final FileFormat format)
|
||||
throws NoPlantumlCompressionException, IOException {
|
||||
final int x = path.lastIndexOf('/');
|
||||
final String compressed = path.substring(x + 1);
|
||||
final Transcoder transcoder = TranscoderUtil.getDefaultTranscoderProtected();
|
||||
final String source = transcoder.decode(compressed);
|
||||
final byte[] fileData = getData(source, format);
|
||||
write(out, "HTTP/1.1 200 OK");
|
||||
write(out, "Cache-Control: no-cache");
|
||||
write(out, "Server: PlantUML PicoWebServer");
|
||||
write(out, "Date: " + new Date());
|
||||
write(out, "Content-type: " + mime);
|
||||
write(out, "Content-length: " + fileData.length);
|
||||
write(out, "");
|
||||
out.flush();
|
||||
out.write(fileData);
|
||||
out.flush();
|
||||
}
|
||||
|
||||
private byte[] getData(String source, FileFormat format) throws IOException {
|
||||
final SourceStringReader ssr = new SourceStringReader(source);
|
||||
final ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
ssr.outputImage(os, new FileFormatOption(format));
|
||||
os.close();
|
||||
return os.toByteArray();
|
||||
}
|
||||
|
||||
private void write(OutputStream os, String s) throws IOException {
|
||||
s = s + "\r\n";
|
||||
os.write(s.getBytes("UTF-8"));
|
||||
}
|
||||
|
||||
}
|
@ -188,9 +188,9 @@ public class TaskDrawRegular extends AbstractTaskDraw {
|
||||
final double startPos = timeScale.getStartingPosition(start);
|
||||
final double endPos = timeScale.getEndingPosition(end);
|
||||
|
||||
final double fullLength = endPos - startPos - 2 * margin;
|
||||
if (fullLength < 10) {
|
||||
return;
|
||||
double fullLength = endPos - startPos - 2 * margin;
|
||||
if (fullLength < 3) {
|
||||
fullLength = 3;
|
||||
}
|
||||
if (url != null) {
|
||||
ug.startUrl(url);
|
||||
|
@ -43,6 +43,7 @@ import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.Splitter;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
@ -68,6 +69,7 @@ abstract class AbstractElementText extends AbstractElement {
|
||||
|
||||
private int getCharNumber(String text) {
|
||||
text = text.replaceAll("<&[-\\w]+>", "00");
|
||||
text = Splitter.purgeAllTag(text);
|
||||
return text.length();
|
||||
}
|
||||
|
||||
@ -96,7 +98,8 @@ abstract class AbstractElementText extends AbstractElement {
|
||||
// double max = 0;
|
||||
// for (int i = 32; i < 127; i++) {
|
||||
// final char c = (char) i;
|
||||
// final double w = Display.create(Arrays.asList("" + c), config, HorizontalAlignment.LEFT)
|
||||
// final double w = Display.create(Arrays.asList("" + c), config,
|
||||
// HorizontalAlignment.LEFT)
|
||||
// .calculateDimension(stringBounder).getWidth();
|
||||
// if (w > max) {
|
||||
// Log.println("c="+c+" "+max);
|
||||
|
@ -93,12 +93,12 @@ public class LinkAnchor {
|
||||
|
||||
final HColor color = new Rose().getHtmlColor(param, ColorParam.arrow);
|
||||
final Rainbow rainbow = Rainbow.fromColor(color, null);
|
||||
final Snake snake = new Snake(Arrows.asToUp(), HorizontalAlignment.CENTER, rainbow, Arrows.asToDown());
|
||||
|
||||
final Display display = Display.getWithNewlines(message);
|
||||
final TextBlock title = display.create(new FontConfiguration(param, FontParam.ARROW, null),
|
||||
HorizontalAlignment.CENTER, param);
|
||||
snake.setLabel(title);
|
||||
final Snake snake = Snake.create(Arrows.asToUp(), rainbow, Arrows.asToDown())
|
||||
.withLabel(title, HorizontalAlignment.CENTER);
|
||||
|
||||
snake.addPoint(x, ymin + 2);
|
||||
snake.addPoint(x, ymax - 2);
|
||||
|
@ -36,6 +36,7 @@
|
||||
package net.sourceforge.plantuml.skin;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
|
||||
@ -44,6 +45,7 @@ import net.sourceforge.plantuml.graphic.SymbolContext;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.ugraphic.UEllipse;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.ULine;
|
||||
import net.sourceforge.plantuml.ugraphic.UPath;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorNone;
|
||||
@ -58,9 +60,11 @@ public class ActorStickMan extends AbstractTextBlock implements TextBlock {
|
||||
private final double headDiam = 16;
|
||||
|
||||
private final SymbolContext symbolContext;
|
||||
private final boolean actorBusiness;
|
||||
|
||||
ActorStickMan(SymbolContext symbolContext) {
|
||||
ActorStickMan(SymbolContext symbolContext, boolean actorBusiness) {
|
||||
this.symbolContext = symbolContext;
|
||||
this.actorBusiness = actorBusiness;
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
@ -86,9 +90,26 @@ public class ActorStickMan extends AbstractTextBlock implements TextBlock {
|
||||
|
||||
ug = symbolContext.apply(ug);
|
||||
ug.apply(new UTranslate(startX, thickness())).draw(head);
|
||||
if (actorBusiness) {
|
||||
specialBusiness(ug.apply(new UTranslate(startX + headDiam / 2, thickness() + headDiam / 2)));
|
||||
}
|
||||
ug.apply(new UTranslate(centerX, headDiam + thickness())).apply(new HColorNone().bg()).draw(path);
|
||||
}
|
||||
|
||||
private void specialBusiness(UGraphic ug) {
|
||||
final double alpha = 21 * Math.PI / 64;
|
||||
final Point2D p1 = getOnCircle(Math.PI / 4 + alpha);
|
||||
final Point2D p2 = getOnCircle(Math.PI / 4 - alpha);
|
||||
ug = ug.apply(new UTranslate(p1));
|
||||
ug.draw(new ULine(p2.getX() - p1.getX(), p2.getY() - p1.getY()));
|
||||
}
|
||||
|
||||
private Point2D getOnCircle(double alpha) {
|
||||
final double x = headDiam / 2 * Math.cos(alpha);
|
||||
final double y = headDiam / 2 * Math.sin(alpha);
|
||||
return new Point2D.Double(x, y);
|
||||
}
|
||||
|
||||
private double thickness() {
|
||||
return symbolContext.getStroke().getThickness();
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ import net.sourceforge.plantuml.graphic.USymbol;
|
||||
|
||||
public enum ActorStyle {
|
||||
|
||||
STICKMAN, AWESOME;
|
||||
STICKMAN, STICKMAN_BUSINESS, AWESOME;
|
||||
|
||||
public USymbol toUSymbol() {
|
||||
if (this == STICKMAN) {
|
||||
@ -54,7 +54,9 @@ public enum ActorStyle {
|
||||
|
||||
public TextBlock getTextBlock(SymbolContext symbolContext) {
|
||||
if (this == STICKMAN) {
|
||||
return new ActorStickMan(symbolContext);
|
||||
return new ActorStickMan(symbolContext, false);
|
||||
} else if (this == STICKMAN_BUSINESS) {
|
||||
return new ActorStickMan(symbolContext, true);
|
||||
} else if (this == AWESOME) {
|
||||
return new ActorAwesome(symbolContext);
|
||||
}
|
||||
|
@ -483,6 +483,10 @@ public class Cluster implements Moveable {
|
||||
final HColor background = getColor(skinParam2, ColorParam.background, null);
|
||||
final TextBlockWidth attribute = getTextBlockAttribute(skinParam2);
|
||||
final double attributeHeight = attribute.calculateDimension(ug.getStringBounder()).getHeight();
|
||||
if (total.getWidth() == 0) {
|
||||
System.err.println("Cluster::drawUState issue");
|
||||
return;
|
||||
}
|
||||
final RoundedContainer r = new RoundedContainer(total, suppY,
|
||||
attributeHeight + (attributeHeight > 0 ? IEntityImage.MARGIN : 0), borderColor, stateBack, background,
|
||||
stroke);
|
||||
|
@ -223,6 +223,9 @@ public final class GeneralImageBuilder {
|
||||
if (leaf.getLeafType() == LeafType.USECASE) {
|
||||
return new EntityImageUseCase(leaf, skinParam, portionShower);
|
||||
}
|
||||
if (leaf.getLeafType() == LeafType.USECASE_BUSINESS) {
|
||||
return new EntityImageUseCase(leaf, skinParam, portionShower);
|
||||
}
|
||||
// if (leaf.getEntityType() == LeafType.CIRCLE_INTERFACE) {
|
||||
// return new EntityImageCircleInterface(leaf, skinParam);
|
||||
// }
|
||||
|
@ -61,7 +61,7 @@ public class UGraphicForSnake extends UGraphicDelegator {
|
||||
}
|
||||
|
||||
static class PendingSnake {
|
||||
private final Snake snake;
|
||||
private Snake snake;
|
||||
private final UGraphic ug;
|
||||
private final double dx;
|
||||
private final double dy;
|
||||
@ -80,7 +80,7 @@ public class UGraphicForSnake extends UGraphicDelegator {
|
||||
void removeEndDecorationIfTouches(List<PendingSnake> snakes) {
|
||||
for (PendingSnake other : snakes) {
|
||||
if (moved().touches(other.moved())) {
|
||||
this.snake.removeEndDecoration();
|
||||
this.snake = this.snake.withoutEndDecoration();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -40,17 +40,28 @@ import java.awt.geom.Point2D;
|
||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||
import net.sourceforge.plantuml.svek.AbstractExtremityFactory;
|
||||
import net.sourceforge.plantuml.svek.Side;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
|
||||
public class ExtremityFactoryTriangle extends AbstractExtremityFactory implements ExtremityFactory {
|
||||
|
||||
private final HColor backgroundColor;
|
||||
private final int xWing;
|
||||
private final int yAperture;
|
||||
|
||||
public ExtremityFactoryTriangle(HColor backgroundColor, int xWing, int yAperture) {
|
||||
this.backgroundColor = backgroundColor;
|
||||
this.xWing = xWing;
|
||||
this.yAperture = yAperture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UDrawable createUDrawable(Point2D p0, double angle, Side side) {
|
||||
return new ExtremityTriangle(p0, angle - Math.PI / 2, false);
|
||||
return new ExtremityTriangle(p0, angle - Math.PI / 2, false, backgroundColor, xWing, yAperture);
|
||||
}
|
||||
|
||||
public UDrawable createUDrawable(Point2D p0, Point2D p1, Point2D p2, Side side) {
|
||||
final double ortho = atan2(p0, p2);
|
||||
return new ExtremityTriangle(p1, ortho, true);
|
||||
return new ExtremityTriangle(p1, ortho, true, backgroundColor, xWing, yAperture);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -39,12 +39,14 @@ import java.awt.geom.Point2D;
|
||||
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UPolygon;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
|
||||
|
||||
class ExtremityTriangle extends Extremity {
|
||||
|
||||
private UPolygon polygon = new UPolygon();
|
||||
private final boolean fill;
|
||||
private final HColor backgroundColor;
|
||||
private final Point2D contact;
|
||||
|
||||
@Override
|
||||
@ -52,13 +54,13 @@ class ExtremityTriangle extends Extremity {
|
||||
return contact;
|
||||
}
|
||||
|
||||
public ExtremityTriangle(Point2D p1, double angle, boolean fill) {
|
||||
public ExtremityTriangle(Point2D p1, double angle, boolean fill, HColor backgroundColor, int xWing, int yAperture) {
|
||||
this.backgroundColor = backgroundColor;
|
||||
this.fill = fill;
|
||||
this.contact = new Point2D.Double(p1.getX(), p1.getY());
|
||||
angle = manageround(angle);
|
||||
polygon.addPoint(0, 0);
|
||||
final int xWing = 8;
|
||||
final int yAperture = 3;
|
||||
|
||||
polygon.addPoint(-xWing, -yAperture);
|
||||
polygon.addPoint(-xWing, yAperture);
|
||||
polygon.addPoint(0, 0);
|
||||
@ -67,7 +69,9 @@ class ExtremityTriangle extends Extremity {
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
if (fill) {
|
||||
if (backgroundColor != null) {
|
||||
ug = ug.apply(backgroundColor.bg());
|
||||
} else if (fill) {
|
||||
ug = ug.apply(HColorUtils.changeBack(ug));
|
||||
}
|
||||
ug.draw(polygon);
|
||||
|
@ -75,6 +75,7 @@ import net.sourceforge.plantuml.svek.Margins;
|
||||
import net.sourceforge.plantuml.svek.ShapeType;
|
||||
import net.sourceforge.plantuml.ugraphic.UComment;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
@ -154,7 +155,7 @@ public class EntityImageDescription extends AbstractEntityImage {
|
||||
}
|
||||
|
||||
assert getStereo() == stereotype;
|
||||
|
||||
|
||||
final SymbolContext ctx = new SymbolContext(backcolor, forecolor).withStroke(stroke).withShadow(deltaShadow)
|
||||
.withCorner(roundCorner, diagonalCorner);
|
||||
|
||||
@ -289,7 +290,11 @@ public class EntityImageDescription extends AbstractEntityImage {
|
||||
final Dimension2D dimSmall = asSmall.calculateDimension(ug.getStringBounder());
|
||||
final Dimension2D dimDesc = desc.calculateDimension(ug.getStringBounder());
|
||||
final double posx1 = (dimSmall.getWidth() - dimDesc.getWidth()) / 2;
|
||||
desc.drawU(ug.apply(new UTranslate(posx1, space + dimSmall.getHeight())));
|
||||
|
||||
UGraphic ugDesc = ug.apply(new UTranslate(posx1, space + dimSmall.getHeight()));
|
||||
ugDesc = UGraphicStencil.create(ugDesc, dimDesc);
|
||||
desc.drawU(ugDesc);
|
||||
|
||||
final Dimension2D dimStereo = stereo.calculateDimension(ug.getStringBounder());
|
||||
final double posx2 = (dimSmall.getWidth() - dimStereo.getWidth()) / 2;
|
||||
stereo.drawU(ug.apply(new UTranslate(posx2, -space - dimStereo.getHeight())));
|
||||
|
@ -36,6 +36,7 @@
|
||||
package net.sourceforge.plantuml.svek.image;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
import net.sourceforge.plantuml.ColorParam;
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
@ -50,6 +51,7 @@ import net.sourceforge.plantuml.cucadiagram.BodyEnhanced;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.EntityPortion;
|
||||
import net.sourceforge.plantuml.cucadiagram.ILeaf;
|
||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||
import net.sourceforge.plantuml.cucadiagram.PortionShower;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
@ -70,6 +72,7 @@ import net.sourceforge.plantuml.ugraphic.TextBlockInEllipse;
|
||||
import net.sourceforge.plantuml.ugraphic.UEllipse;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UHorizontalLine;
|
||||
import net.sourceforge.plantuml.ugraphic.ULine;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
@ -141,12 +144,44 @@ public class EntityImageUseCase extends AbstractEntityImage {
|
||||
final UGraphic ug2 = new MyUGraphicEllipse(ug, 0, 0, ellipse.getUEllipse());
|
||||
|
||||
ellipse.drawU(ug2);
|
||||
if (getEntity().getLeafType() == LeafType.USECASE_BUSINESS) {
|
||||
specialBusiness(ug, ellipse.getUEllipse());
|
||||
}
|
||||
|
||||
if (url != null) {
|
||||
ug.closeUrl();
|
||||
}
|
||||
}
|
||||
|
||||
private void specialBusiness(UGraphic ug, UEllipse frontier) {
|
||||
final RotatedEllipse rotatedEllipse = new RotatedEllipse(frontier, Math.PI / 4);
|
||||
|
||||
final double theta1 = 20.0 * Math.PI / 180;
|
||||
final double theta2 = rotatedEllipse.getOtherTheta(theta1);
|
||||
|
||||
final UEllipse frontier2 = frontier.scale(0.99);
|
||||
final Point2D p1 = frontier2.getPointAtAngle(-theta1);
|
||||
final Point2D p2 = frontier2.getPointAtAngle(-theta2);
|
||||
drawLine(ug, p1, p2);
|
||||
}
|
||||
|
||||
private void specialBusiness0(UGraphic ug, UEllipse frontier) {
|
||||
final double c = frontier.getWidth() / frontier.getHeight();
|
||||
final double ouverture = Math.PI / 2;
|
||||
final Point2D p1 = frontier.getPointAtAngle(getTrueAngle(c, Math.PI / 4 - ouverture));
|
||||
final Point2D p2 = frontier.getPointAtAngle(getTrueAngle(c, Math.PI / 4 + ouverture));
|
||||
drawLine(ug, p1, p2);
|
||||
}
|
||||
|
||||
private void drawLine(UGraphic ug, final Point2D p1, final Point2D p2) {
|
||||
ug = ug.apply(new UTranslate(p1));
|
||||
ug.draw(new ULine(p2.getX() - p1.getX(), p2.getY() - p1.getY()));
|
||||
}
|
||||
|
||||
private double getTrueAngle(final double c, final double gamma) {
|
||||
return Math.atan2(Math.sin(gamma), Math.cos(gamma) / c);
|
||||
}
|
||||
|
||||
private HColor getBackColor() {
|
||||
HColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK);
|
||||
if (backcolor == null) {
|
||||
|
@ -0,0 +1,61 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2020, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* If you like this project or if you find it useful, you can support us at:
|
||||
*
|
||||
* http://plantuml.com/patreon (only 1$ per month!)
|
||||
* http://plantuml.com/paypal
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.svek.image;
|
||||
|
||||
public class QuadraticEquation {
|
||||
|
||||
private final double a;
|
||||
private final double b;
|
||||
private final double c;
|
||||
|
||||
public QuadraticEquation(double a, double b, double c) {
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
this.c = c;
|
||||
}
|
||||
|
||||
public double[] solve() {
|
||||
final double delta = b * b - 4 * a * c;
|
||||
final double x0 = (-b - Math.sqrt(delta)) / 2 / a;
|
||||
final double x1 = (-b + Math.sqrt(delta)) / 2 / a;
|
||||
return new double[] { x0, x1 };
|
||||
}
|
||||
|
||||
public double getV(double x) {
|
||||
return a * x * x + b * x + c;
|
||||
}
|
||||
|
||||
}
|
93
src/net/sourceforge/plantuml/svek/image/RotatedEllipse.java
Normal file
93
src/net/sourceforge/plantuml/svek/image/RotatedEllipse.java
Normal file
@ -0,0 +1,93 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2020, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* If you like this project or if you find it useful, you can support us at:
|
||||
*
|
||||
* http://plantuml.com/patreon (only 1$ per month!)
|
||||
* http://plantuml.com/paypal
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.svek.image;
|
||||
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
import net.sourceforge.plantuml.ugraphic.UEllipse;
|
||||
|
||||
public class RotatedEllipse {
|
||||
|
||||
private final UEllipse ellipse;
|
||||
private final double beta;
|
||||
|
||||
public RotatedEllipse(UEllipse ellipse, double beta) {
|
||||
this.ellipse = ellipse;
|
||||
this.beta = beta;
|
||||
}
|
||||
|
||||
public double getA() {
|
||||
return ellipse.getWidth() / 2;
|
||||
}
|
||||
|
||||
public double getB() {
|
||||
return ellipse.getHeight() / 2;
|
||||
}
|
||||
|
||||
public double getBeta() {
|
||||
return beta;
|
||||
}
|
||||
|
||||
public Point2D getPoint(double theta) {
|
||||
final double x = getA() * Math.cos(theta);
|
||||
final double y = getB() * Math.sin(theta);
|
||||
|
||||
final double xp = x * Math.cos(beta) - y * Math.sin(beta);
|
||||
final double yp = x * Math.sin(beta) + y * Math.cos(beta);
|
||||
|
||||
return new Point2D.Double(xp, yp);
|
||||
}
|
||||
|
||||
public double getOtherTheta(double theta1) {
|
||||
final double z = getPoint(theta1).getX();
|
||||
final double a = getA() * Math.cos(beta);
|
||||
final double b = getB() * Math.sin(beta);
|
||||
final double sum = 2 * a * z / (a * a + b * b);
|
||||
final double other = sum - Math.cos(theta1);
|
||||
return -Math.acos(other);
|
||||
}
|
||||
|
||||
private double other(double[] all, double some) {
|
||||
final double diff0 = Math.abs(some - all[0]);
|
||||
final double diff1 = Math.abs(some - all[1]);
|
||||
|
||||
if (diff0 > diff1) {
|
||||
return all[0];
|
||||
}
|
||||
return all[1];
|
||||
}
|
||||
|
||||
}
|
@ -36,6 +36,7 @@
|
||||
package net.sourceforge.plantuml.ugraphic;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
|
||||
@ -92,6 +93,12 @@ public class UEllipse extends AbstractShadowable implements Scalable, UShapeSize
|
||||
return result;
|
||||
}
|
||||
|
||||
public UEllipse scale(double factor) {
|
||||
final UEllipse result = new UEllipse(width * factor, height * factor);
|
||||
result.setDeltaShadow(getDeltaShadow());
|
||||
return result;
|
||||
}
|
||||
|
||||
public double getStartingX(double y) {
|
||||
y = y / height * 2;
|
||||
final double x = 1 - Math.sqrt(1 - (y - 1) * (y - 1));
|
||||
@ -104,4 +111,10 @@ public class UEllipse extends AbstractShadowable implements Scalable, UShapeSize
|
||||
return x * width / 2;
|
||||
}
|
||||
|
||||
public Point2D getPointAtAngle(double alpha) {
|
||||
final double x = width / 2 + width / 2 * Math.cos(alpha);
|
||||
final double y = height / 2 + height / 2 * Math.sin(alpha);
|
||||
return new Point2D.Double(x, y);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -35,7 +35,10 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.ugraphic;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
|
||||
import net.sourceforge.plantuml.creole.Stencil;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
|
||||
public class UGraphicStencil extends AbstractUGraphicHorizontalLine {
|
||||
|
||||
@ -45,8 +48,23 @@ public class UGraphicStencil extends AbstractUGraphicHorizontalLine {
|
||||
public static UGraphic create(UGraphic ug, Stencil stencil, UStroke defaultStroke) {
|
||||
return new UGraphicStencil(ug, stencil, defaultStroke);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static UGraphic create(UGraphic ug, Dimension2D dim) {
|
||||
return new UGraphicStencil(ug, getRectangleStencil(dim), new UStroke());
|
||||
}
|
||||
|
||||
private static Stencil getRectangleStencil(final Dimension2D dim) {
|
||||
return new Stencil() {
|
||||
public double getStartingX(StringBounder stringBounder, double y) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public double getEndingX(StringBounder stringBounder, double y) {
|
||||
return dim.getWidth();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private UGraphicStencil(UGraphic ug, Stencil stencil, UStroke defaultStroke) {
|
||||
super(ug);
|
||||
this.stencil = stencil;
|
||||
|
@ -44,7 +44,7 @@ public class Version {
|
||||
private static final int MAJOR_SEPARATOR = 1000000;
|
||||
|
||||
public static int version() {
|
||||
return 1202018;
|
||||
return 1202019;
|
||||
}
|
||||
|
||||
public static int versionPatched() {
|
||||
@ -93,7 +93,7 @@ public class Version {
|
||||
}
|
||||
|
||||
public static long compileTime() {
|
||||
return 1601494844773L;
|
||||
return 1602515401258L;
|
||||
}
|
||||
|
||||
public static String compileTimeString() {
|
||||
|
Loading…
Reference in New Issue
Block a user