mirror of
https://github.com/octoleo/plantuml.git
synced 2024-11-21 20:45:10 +00:00
Add interactive functionality for Usecase diagrams exported to SVG
This commit is contained in:
parent
74ff89f4ba
commit
66520f0a35
@ -76,6 +76,12 @@
|
||||
<include name="**/*.skin" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy todir="build/svg">
|
||||
<fileset dir="svg">
|
||||
<include name="**/*.js" />
|
||||
<include name="**/*.css" />
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="dist" depends="compile">
|
||||
|
7
pom.xml
7
pom.xml
@ -30,12 +30,13 @@
|
||||
Script Author: Julien Eluard
|
||||
|
||||
-->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>net.sourceforge.plantuml</groupId>
|
||||
<artifactId>plantuml</artifactId>
|
||||
<version>1.2021.2-SNAPSHOT</version>
|
||||
<version>1.2021.1-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>PlantUML</name>
|
||||
@ -114,6 +115,8 @@
|
||||
<includes>
|
||||
<include>stdlib/**/*.repx</include>
|
||||
<include>skin/**/*.skin</include>
|
||||
<include>svg/**/*.css</include>
|
||||
<include>svg/**/*.js</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
|
@ -278,3 +278,40 @@ ganttDiagram {
|
||||
Shadowing 0.0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
usecase {
|
||||
HorizontalAlignment center
|
||||
}
|
||||
|
||||
yamlDiagram {
|
||||
arrow {
|
||||
LineThickness 1
|
||||
LineStyle 3;3
|
||||
}
|
||||
node {
|
||||
LineThickness 1.5
|
||||
RoundCorner 10
|
||||
separator {
|
||||
LineThickness 1
|
||||
LineColor #A80036
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
jsonDiagram {
|
||||
arrow {
|
||||
LineThickness 1
|
||||
LineStyle 3;3
|
||||
}
|
||||
node {
|
||||
LineThickness 1.5
|
||||
RoundCorner 10
|
||||
separator {
|
||||
LineThickness 1
|
||||
LineColor #A80036
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -160,6 +160,11 @@ public class FileUtils {
|
||||
return readSvg(br, false, false);
|
||||
}
|
||||
|
||||
static public String readText(InputStream is) throws IOException {
|
||||
final BufferedReader br = new BufferedReader(new InputStreamReader(is));
|
||||
return readSvg(br, true, true);
|
||||
}
|
||||
|
||||
static public String readFile(SFile svgFile) throws IOException {
|
||||
final BufferedReader br = svgFile.openBufferedReader();
|
||||
if (br == null) {
|
||||
|
@ -71,18 +71,18 @@ public class ComponentTextActor extends AbstractComponentText {
|
||||
final int xman = width / 2 - 1;
|
||||
if (type == ComponentType.ACTOR_HEAD) {
|
||||
if (fileFormat == FileFormat.UTXT) {
|
||||
charArea.drawStringsLRUnicode(stringsToDisplay.as(), 1, getHeight());
|
||||
charArea.drawStringsLRUnicode(stringsToDisplay.asList(), 1, getHeight());
|
||||
charArea.drawShape(AsciiShape.STICKMAN_UNICODE, xman, 0);
|
||||
} else {
|
||||
charArea.drawStringsLRSimple(stringsToDisplay.as(), 1, getHeight());
|
||||
charArea.drawStringsLRSimple(stringsToDisplay.asList(), 1, getHeight());
|
||||
charArea.drawShape(AsciiShape.STICKMAN, xman, 0);
|
||||
}
|
||||
} else if (type == ComponentType.ACTOR_TAIL) {
|
||||
if (fileFormat == FileFormat.UTXT) {
|
||||
charArea.drawStringsLRUnicode(stringsToDisplay.as(), 1, 0);
|
||||
charArea.drawStringsLRUnicode(stringsToDisplay.asList(), 1, 0);
|
||||
charArea.drawShape(AsciiShape.STICKMAN_UNICODE, xman, 1);
|
||||
} else {
|
||||
charArea.drawStringsLRSimple(stringsToDisplay.as(), 1, 0);
|
||||
charArea.drawStringsLRSimple(stringsToDisplay.asList(), 1, 0);
|
||||
charArea.drawShape(AsciiShape.STICKMAN, xman, 1);
|
||||
}
|
||||
} else {
|
||||
|
@ -135,9 +135,9 @@ public class ComponentTextArrow extends AbstractComponentText implements ArrowCo
|
||||
// final int position = Math.max(0, (width - textWidth) / 2);
|
||||
|
||||
if (fileFormat == FileFormat.UTXT) {
|
||||
charArea.drawStringsLRUnicode(stringsToDisplay.as(), (width - textWidth) / 2, 0);
|
||||
charArea.drawStringsLRUnicode(stringsToDisplay.asList(), (width - textWidth) / 2, 0);
|
||||
} else {
|
||||
charArea.drawStringsLRSimple(stringsToDisplay.as(), (width - textWidth) / 2, 0);
|
||||
charArea.drawStringsLRSimple(stringsToDisplay.asList(), (width - textWidth) / 2, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -169,4 +169,8 @@ public class ComponentTextArrow extends AbstractComponentText implements ArrowCo
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public double getPosArrow(StringBounder stringBounder) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -79,9 +79,9 @@ public class ComponentTextNote extends AbstractComponentText {
|
||||
}
|
||||
}
|
||||
if (fileFormat == FileFormat.UTXT) {
|
||||
charArea.drawStringsLRUnicode(stringsToDisplay.as(), 3, 1);
|
||||
charArea.drawStringsLRUnicode(stringsToDisplay.asList(), 3, 1);
|
||||
} else {
|
||||
charArea.drawStringsLRSimple(stringsToDisplay.as(), 3, 1);
|
||||
charArea.drawStringsLRSimple(stringsToDisplay.asList(), 3, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,9 +83,9 @@ public class ComponentTextParticipant extends AbstractComponentText {
|
||||
}
|
||||
}
|
||||
if (fileFormat == FileFormat.UTXT) {
|
||||
charArea.drawStringsLRUnicode(stringsToDisplay.as(), 1, 1);
|
||||
charArea.drawStringsLRUnicode(stringsToDisplay.asList(), 1, 1);
|
||||
} else {
|
||||
charArea.drawStringsLRSimple(stringsToDisplay.as(), 1, 1);
|
||||
charArea.drawStringsLRSimple(stringsToDisplay.asList(), 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,9 +97,9 @@ public class ComponentTextSelfArrow extends AbstractComponentText implements Arr
|
||||
}
|
||||
|
||||
if (fileFormat == FileFormat.UTXT) {
|
||||
charArea.drawStringsLRUnicode(stringsToDisplay.as(), 6, 1);
|
||||
charArea.drawStringsLRUnicode(stringsToDisplay.asList(), 6, 1);
|
||||
} else {
|
||||
charArea.drawStringsLRSimple(stringsToDisplay.as(), 6, 1);
|
||||
charArea.drawStringsLRSimple(stringsToDisplay.asList(), 6, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -126,5 +126,10 @@ public class ComponentTextSelfArrow extends AbstractComponentText implements Arr
|
||||
public double getYPoint(StringBounder stringBounder) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public double getPosArrow(StringBounder stringBounder) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -67,10 +67,10 @@ public class ComponentTextShape extends AbstractComponentText {
|
||||
|
||||
final int xman = width / 2 - shape.getWidth() / 2 + 1;
|
||||
if (type.name().endsWith("_HEAD")) {
|
||||
charArea.drawStringsLRSimple(stringsToDisplay.as(), 1, getHeight());
|
||||
charArea.drawStringsLRSimple(stringsToDisplay.asList(), 1, getHeight());
|
||||
charArea.drawShape(shape, xman, 0);
|
||||
} else {
|
||||
charArea.drawStringsLRSimple(stringsToDisplay.as(), 1, 0);
|
||||
charArea.drawStringsLRSimple(stringsToDisplay.asList(), 1, 0);
|
||||
charArea.drawShape(shape, xman, 1);
|
||||
}
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ import net.sourceforge.plantuml.cucadiagram.Code;
|
||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||
import net.sourceforge.plantuml.cucadiagram.Ident;
|
||||
import net.sourceforge.plantuml.skin.VisibilityModifier;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandAddMethod extends SingleLineCommand2<ClassDiagram> {
|
||||
|
||||
@ -65,7 +66,7 @@ public class CommandAddMethod extends SingleLineCommand2<ClassDiagram> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) {
|
||||
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
|
||||
final String idShort = arg.get("NAME", 0);
|
||||
final Ident ident = diagram.buildLeafIdent(idShort);
|
||||
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
|
||||
|
@ -92,7 +92,7 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
||||
private static IRegex getRegexConcat() {
|
||||
return RegexConcat.build(CommandCreateClassMultilines.class.getName(), RegexLeaf.start(), //
|
||||
new RegexLeaf("VISIBILITY", "(" + VisibilityModifier.regexForVisibilityCharacterInClassName() + ")?"), //
|
||||
new RegexLeaf("TYPE", "(interface|enum|abstract[%s]+class|abstract|class|entity)"), //
|
||||
new RegexLeaf("TYPE", "(interface|enum|annotation|abstract[%s]+class|abstract|class|entity)"), //
|
||||
RegexLeaf.spaceOneOrMore(), //
|
||||
new RegexOr(//
|
||||
new RegexConcat(//
|
||||
|
@ -79,13 +79,20 @@ public class BlocLines implements Iterable<StringLocated> {
|
||||
return loadInternal(br, location);
|
||||
}
|
||||
|
||||
public static BlocLines from(List<StringLocated> lines) {
|
||||
return new BlocLines(lines);
|
||||
}
|
||||
|
||||
private static BlocLines loadInternal(final BufferedReader br, LineLocation location) throws IOException {
|
||||
final List<StringLocated> result = new ArrayList<StringLocated>();
|
||||
String s;
|
||||
while ((s = br.readLine()) != null) {
|
||||
result.add(new StringLocated(s, location));
|
||||
try {
|
||||
while ((s = br.readLine()) != null) {
|
||||
result.add(new StringLocated(s, location));
|
||||
}
|
||||
} finally {
|
||||
br.close();
|
||||
}
|
||||
br.close();
|
||||
return new BlocLines(result);
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ public class AtomTextUtils {
|
||||
final Display display = Display.getWithNewlines(url.getLabel());
|
||||
if (display.size() > 1) {
|
||||
final List<Atom> all = new ArrayList<Atom>();
|
||||
for (CharSequence s : display.as()) {
|
||||
for (CharSequence s : display.asList()) {
|
||||
all.add(createAtomText(s.toString(), url, fontConfiguration, skinSimple));
|
||||
}
|
||||
return new AtomVerticalTexts(all);
|
||||
|
@ -41,6 +41,7 @@ import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.style.Style;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public interface Bodier {
|
||||
|
||||
@ -50,7 +51,7 @@ public interface Bodier {
|
||||
|
||||
public Display getMethodsToDisplay();
|
||||
|
||||
public void addFieldOrMethod(String s);
|
||||
public void addFieldOrMethod(String s) throws NoSuchColorException;
|
||||
|
||||
public TextBlock getBody(FontParam fontParam, ISkinParam skinParam, boolean showMethods, boolean showFields,
|
||||
Stereotype stereotype, Style style);
|
||||
|
@ -211,7 +211,8 @@ public class BodierLikeClassOrObject implements Bodier {
|
||||
|
||||
if (type.isLikeClass() && isBodyEnhanced()) {
|
||||
if (showMethods || showFields) {
|
||||
return BodyFactory.create1(rawBodyWithoutHidden(), fontParam, skinParam, stereotype, leaf, style);
|
||||
return BodyFactory.create1(skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT),
|
||||
rawBodyWithoutHidden(), fontParam, skinParam, stereotype, leaf, style);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -222,7 +223,8 @@ public class BodierLikeClassOrObject implements Bodier {
|
||||
if (showFields == false) {
|
||||
return new TextBlockLineBefore(TextBlockUtils.empty(0, 0));
|
||||
}
|
||||
return BodyFactory.create1(rawBodyWithoutHidden(), fontParam, skinParam, stereotype, leaf, style);
|
||||
return BodyFactory.create1(skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT),
|
||||
rawBodyWithoutHidden(), fontParam, skinParam, stereotype, leaf, style);
|
||||
}
|
||||
assert type.isLikeClass();
|
||||
|
||||
|
@ -41,8 +41,10 @@ import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.style.Style;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class BodierSimple implements Bodier {
|
||||
|
||||
@ -63,8 +65,9 @@ public class BodierSimple implements Bodier {
|
||||
this.leaf = leaf;
|
||||
}
|
||||
|
||||
public void addFieldOrMethod(String s) {
|
||||
rawBody.add(s);
|
||||
public void addFieldOrMethod(String s) throws NoSuchColorException {
|
||||
final Display display = Display.getWithNewlines2(s);
|
||||
rawBody.addAll(display.asList());
|
||||
}
|
||||
|
||||
public Display getMethodsToDisplay() {
|
||||
@ -85,7 +88,8 @@ public class BodierSimple implements Bodier {
|
||||
|
||||
public TextBlock getBody(FontParam fontParam, ISkinParam skinParam, boolean showMethods, boolean showFields,
|
||||
Stereotype stereotype, Style style) {
|
||||
return BodyFactory.create1(rawBody, fontParam, skinParam, stereotype, leaf, style);
|
||||
return BodyFactory.create1(skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), rawBody, fontParam,
|
||||
skinParam, stereotype, leaf, style);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -74,10 +74,9 @@ public class BodyEnhanced1 extends BodyEnhancedAbstract implements TextBlock, Wi
|
||||
private final boolean inEllipse;
|
||||
private final Style style;
|
||||
|
||||
BodyEnhanced1(List<CharSequence> rawBody, FontParam fontParam, ISkinParam skinParam, Stereotype stereotype,
|
||||
ILeaf entity, Style style) {
|
||||
super(skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT),
|
||||
new FontConfiguration(skinParam, fontParam, stereotype));
|
||||
BodyEnhanced1(HorizontalAlignment align, List<CharSequence> rawBody, FontParam fontParam, ISkinParam skinParam,
|
||||
Stereotype stereotype, ILeaf entity, Style style) {
|
||||
super(align, new FontConfiguration(skinParam, fontParam, stereotype));
|
||||
this.style = style;
|
||||
this.rawBody2 = Display.create(rawBody);
|
||||
this.stereotype = stereotype;
|
||||
@ -90,11 +89,10 @@ public class BodyEnhanced1 extends BodyEnhancedAbstract implements TextBlock, Wi
|
||||
this.inEllipse = false;
|
||||
}
|
||||
|
||||
BodyEnhanced1(Display display, FontParam fontParam, ISkinParam skinParam, HorizontalAlignment align,
|
||||
BodyEnhanced1(HorizontalAlignment align, Display display, FontParam fontParam, ISkinParam skinParam,
|
||||
Stereotype stereotype, ILeaf entity, Style style) {
|
||||
super(skinParam.getDefaultTextAlignment(align),
|
||||
style == null ? new FontConfiguration(skinParam, fontParam, stereotype)
|
||||
: style.getFontConfiguration(skinParam.getIHtmlColorSet()));
|
||||
super(align, style == null ? new FontConfiguration(skinParam, fontParam, stereotype)
|
||||
: style.getFontConfiguration(skinParam.getIHtmlColorSet()));
|
||||
|
||||
this.style = style;
|
||||
this.entity = entity;
|
||||
|
@ -63,14 +63,14 @@ public class BodyFactory {
|
||||
return new BodierSimple();
|
||||
}
|
||||
|
||||
public static TextBlock create1(List<CharSequence> rawBody, FontParam fontParam, ISkinParam skinParam,
|
||||
Stereotype stereotype, ILeaf entity, Style style) {
|
||||
return new BodyEnhanced1(rawBody, fontParam, skinParam, stereotype, entity, style);
|
||||
public static TextBlock create1(HorizontalAlignment align, List<CharSequence> rawBody, FontParam fontParam,
|
||||
ISkinParam skinParam, Stereotype stereotype, ILeaf entity, Style style) {
|
||||
return new BodyEnhanced1(align, rawBody, fontParam, skinParam, stereotype, entity, style);
|
||||
}
|
||||
|
||||
public static TextBlock create2(Display display, FontParam fontParam, ISkinParam skinParam,
|
||||
HorizontalAlignment align, Stereotype stereotype, ILeaf entity, Style style) {
|
||||
return new BodyEnhanced1(display, fontParam, skinParam, align, stereotype, entity, style);
|
||||
public static TextBlock create2(HorizontalAlignment align, Display display, FontParam fontParam,
|
||||
ISkinParam skinParam, Stereotype stereotype, ILeaf entity, Style style) {
|
||||
return new BodyEnhanced1(align, display, fontParam, skinParam, stereotype, entity, style);
|
||||
}
|
||||
|
||||
public static TextBlock create3(Display rawBody, FontParam fontParam, ISkinSimple skinParam,
|
||||
|
@ -418,7 +418,7 @@ public class Display implements Iterable<CharSequence> {
|
||||
this.defaultCreoleMode);
|
||||
}
|
||||
|
||||
public List<? extends CharSequence> as() {
|
||||
public List<? extends CharSequence> asList() {
|
||||
return Collections.unmodifiableList(displayData);
|
||||
}
|
||||
|
||||
|
@ -62,6 +62,7 @@ import net.sourceforge.plantuml.ugraphic.PlacementStrategy;
|
||||
import net.sourceforge.plantuml.ugraphic.PlacementStrategyVisibility;
|
||||
import net.sourceforge.plantuml.ugraphic.PlacementStrategyY1Y2Center;
|
||||
import net.sourceforge.plantuml.ugraphic.PlacementStrategyY1Y2Left;
|
||||
import net.sourceforge.plantuml.ugraphic.PlacementStrategyY1Y2Right;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.ULayoutGroup;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
@ -284,7 +285,7 @@ public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlock,
|
||||
} else if (align == HorizontalAlignment.CENTER) {
|
||||
placementStrategy = new PlacementStrategyY1Y2Center(stringBounder);
|
||||
} else {
|
||||
placementStrategy = new PlacementStrategyY1Y2Left(stringBounder);
|
||||
placementStrategy = new PlacementStrategyY1Y2Right(stringBounder);
|
||||
}
|
||||
group = new ULayoutGroup(placementStrategy);
|
||||
for (CharSequence cs : members) {
|
||||
|
@ -131,7 +131,7 @@ public final class CucaDiagramTxtMaker {
|
||||
final int w = getWidth(ent);
|
||||
final int h = getHeight(ent);
|
||||
ug.getCharArea().drawBoxSimple(0, 0, w, h);
|
||||
ug.getCharArea().drawStringsLRSimple(ent.getDisplay().as(), 1, 1);
|
||||
ug.getCharArea().drawStringsLRSimple(ent.getDisplay().asList(), 1, 1);
|
||||
if (showMember(ent)) {
|
||||
int y = 2;
|
||||
ug.getCharArea().drawHLine('-', y, 1, w - 1);
|
||||
|
@ -77,8 +77,8 @@ public class EntityImageRequirement extends AbstractEntityImage {
|
||||
super(entity, skinParam);
|
||||
final Stereotype stereotype = entity.getStereotype();
|
||||
|
||||
final TextBlock tmp = BodyFactory.create2(entity.getDisplay(), FontParam.REQUIREMENT, skinParam,
|
||||
HorizontalAlignment.CENTER, stereotype, entity, null);
|
||||
final TextBlock tmp = BodyFactory.create2(skinParam.getDefaultTextAlignment(HorizontalAlignment.CENTER),
|
||||
entity.getDisplay(), FontParam.REQUIREMENT, skinParam, stereotype, entity, null);
|
||||
|
||||
if (stereotype == null || stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR) == null) {
|
||||
this.desc = tmp;
|
||||
|
@ -77,29 +77,28 @@ public class PSystemDonors extends AbstractPSystem {
|
||||
private static final int COLS = 6;
|
||||
private static final int FREE_LINES = 6;
|
||||
|
||||
public static final String DONORS =
|
||||
"6-KC0AmFkBap0wp4H6CjU-RENbb-8cPf4i7oFA4uiOZJNK3y0UwT7lSRwI-YAxltJJEYrckJSWPHVH3q"+
|
||||
"W7UtXVQXzBy-27EYV0Z-tGWU80D4ITH6ZIpt9Djjcof3Il3lEr_v9UWTth51ehbAgiMHwq-_8GFlEsFp"+
|
||||
"x3GsNZsQe2y2FmRsrV-REbkNLuKmItShC0AZeX4owzXZ_1_Lei8fs7Seq6EhCPrAK1qELLHYiytVvB1A"+
|
||||
"6l12LJil5PfCYb5JfFXQ8GsVtfXGavF6HyX67vn_g1_2cyqLbZBE1E9eGnrTN_-tPTk8zkTAl0XoXrXG"+
|
||||
"M60Ef1m9YoX-Rdhmmos0eMeMWx45XJLFOY6H0YtapH_gIS4ZvSpfSF73um4G-3o32YIjg4OJpfPN0ygF"+
|
||||
"P8iMIrnrSTnOwiTXUIfz90sF9nOU5jG2QWZoF-Y2JeirFfewszNWIEffadkzfQXV1M_csape6roQ9Aot"+
|
||||
"jPTczhYYb2LIJTlu7EqrZm3SBRLon9VHH2W7QFQRLw6iVhH0VWIwgYPioPzbNrd8XAYsOHzwrxdyy1X4"+
|
||||
"s2T3fecr_swslPR-GjUCOLF22h1epvYlYqrmi8MkJ1u1dj3AvxBE1v2qj7g_wF6mTfzmJRx4lI7HUXzX"+
|
||||
"AVttgpxC3CK1sbDc5dJZ1KjdDAsQYos8O8_GqG4tXUHAE7VNvTXzNAIF_0J0cqiFkiD6e1RY-MOgJKSX"+
|
||||
"KaFghaWp0PWzhTJ53wyb38gr2ReQLOBfPRNQutGrfYyRC_T96rpN6enH7DEPwWlBtQiYBGppLQCvVRDs"+
|
||||
"WEOKF9MN_RpgNQLS1RYqy1xmmJt_o82VwPM1I97fxjis_2DBimgBMQovRbQbkweV73nq_O4xMZI96MNo"+
|
||||
"aAL1SIWHDVKhaP-M37zBa4tpUpdQQrYThZD2X1bfS7jfSavDZldXDftbEDWWHA9QlEAK99nViDjb9Td2"+
|
||||
"faXvnkfUICXldqyYKYKib1hiQky2FADv5EJXl6jMBQlN9amke99i9WXA2rQr53hIrm8P6AlNCz4QiVrf"+
|
||||
"WGLZQOzHCt4elcAYjSeD15DWfeJpXK4aaaAzb5xc9161__bpbthQK0SxlZE6JyP1ieSa0geWzHadgeRQ"+
|
||||
"wz5j6Eib_dwzb9kFuC-_zcYJKwtTyrE2Q1t41Q275t0fzmizU1huQsoO13Z42YvwaN3begMdWOG5w_7E"+
|
||||
"8khIEADn4vFbXkIYLUI7ol_zkHOkvaDio77n73fQBAdIoyrgK6csht_NuIY7Zh-BAdqYkVmtFPEHq4aO"+
|
||||
"nBauzjM6eQbA2bXG7RK9hDtrsscMkyQSTo3L3oT0ljoGKwaMeOKrDItk2u7bOYplRTfFEIt-au5-ajRf"+
|
||||
"nruzr1navxfs4mtVjX3Q4Js9uI9nGuJ-bI4d6dZune-yg1PAmzAw6NQkO8NyUbx62mcxxE03arfUfQno"+
|
||||
"Guw-XUmjrS2F0A9AQ203YoMwUh5Gol50YgHWpi4odY7beBKukIS0foZOt-zh42uzqNo7Pktj6OLaBjlS"+
|
||||
"J0OGwN1-MebD-cpLo85zDNFPwXMvBRL8X-txTdp7-Vf7rDM324WWgadm6btarOszPcdO9CERMHp7PMOU"+
|
||||
"J7uEkwATfGniDPCjo5ms0mLF0X0x42eaT-5NyH5ppZdox_r6NnXemlF0QNJZkH9iGBRSY9GqeEOeYppt"+
|
||||
"lNsJ4m00";
|
||||
public static final String DONORS = "6neD0AmFkBap0wp4H6CjU-RENbb-8cPf4i7oFA4uiOZJNK3y0UwT7lSRwI-YAxltJJEYrckJSaPHV13q"
|
||||
+ "W7UtXVQXzBy-27EYV0Z-tGWU80D4ITH6ZIpt9Djjcof3Il3lEr_v9UWTth51ehbAgiMHwq-_8GFlEsFp"
|
||||
+ "x3GsNZsQe2y2FmRsrPzVStLjuA5OdYSeWP8k4zg9ecxlNzf8nq_W_vEaQXTjwOuqQQIX0ZigyDXNVjMr"
|
||||
+ "yr6ZoQeOCKMAhnNIyEcD2GqvwNs2RD2Wy4Fz4Dvihh2KSIOGHniYT7szjcFRYE4NIdpOvGwnm93074Wv"
|
||||
+ "qXTHzDnGK70BOAYRnMniIUN8anHGP4CBUVE7UbBnI3bpEbmKF1u0WSypg42aDMhGXBFvmu2A8zcYmn9N"
|
||||
+ "dHatbkPnM9xIHjBmD6BXOK4he8OW_uCkyBHOuwEfirqDZgIU9hbtMudwiztRkJOh-aRN9WdhQ-kbMMnS"
|
||||
+ "KSeIgQvjV8xscaS0xfPQEUBBw2EK0pJxpQkAh7wqGFm8T5zDs98_otwma0bXRSC-KDUv-l2OHJWcGwQ9"
|
||||
+ "TVnkjhsclT35TZOWOGLOfFVahpDDS50BNOay0ZoXLSnbdGyKqjBg_QB7mzfzmZN54lU6HEzzXANqtw_w"
|
||||
+ "C3CK1-X0cLdGJHCidT6qQY-s889wX8uEk2aaLyAvkox7xkCYVUGd0DvKUa0E6pkD4CylKsaw2g4QqdLD"
|
||||
+ "cXN0v6cbBGfUInYKQnDqCwe4GsMrskDqTQOl6nFtIHyyRpKO8t5CPwelB7UlYhGmB5QDPcspTe3c55pX"
|
||||
+ "upYlUizShWAqjl0UyS4z_yY0dkcLWKYH8VTj6_wHfLc5nIpMN3UhqbtL3suUkld0NIoQnOmoUSXKQ1nA"
|
||||
+ "H4lzIkId9SFV76HLVwqkzWusf-kC46567DnUcbnJasCARjDPZeCDGcIenIjESSBv1NjOLf8jR0gLPwmU"
|
||||
+ "XOJyZlaa8bNwGcd0hk6km3EIHq4UpdjWrR9wRIh91LIHpGH1QS6gbYgEzBL01iQQzCoqHcn_Mc31MDfZ"
|
||||
+ "T2mx5BrYegtA3JAcm4mJwXS6aIWrr4lfPKuI4VYVFtUf9yrraECxO_Xa74Jsa4I0AkJkZ1DLJztjw3QC"
|
||||
+ "zH9_lrxApKVmvrzxjCcfqUxvQOBGEeWAG0ylu5Bk5thmDF3Ns30JS8WLLFGYuSfLIuy32GisuvrTrBbb"
|
||||
+ "HkCc9ikDoKMlo0zL_5lS2XVJ8JRek0YcE5eigTBBpMfGSRPlVjVX8eUEVuagGoAvhDKo6GaUXLcScsDV"
|
||||
+ "RHYQjd834bH7RG9hT_rsckMkCUSha9g6oq2-tP1JgHQXXMfgMjuN0gl5sD_Rj9zoMlmd0_quhRNZgXuQ"
|
||||
+ "3d9qVRk9XczRsDiPFOdX8cP3XFwLEISSUFZ6Zxoe5ah3qhOPTgvWXVm6NiOB2OViu0EJMbwbh793Zhw5"
|
||||
+ "x1tLA3y1H3N1WGmiLkYQn48fnmCfae8vPyjeXfI3Fk2idW2Sec1_Vsz1E2tH_8ncxUqPXMGksznDPX3n"
|
||||
+ "S7u6YPfCsUgH0_jYvhBDAt8xQf4EE_Rj-8xpxO-ecmSHo84e9i5hTQ4FD_QQfM5JVAxJu3ukS_DcyWku"
|
||||
+ "5EqyPM1hc6n1bh8Pg7WIWDX1faBvrVwh-OWjvnJvztvZAWmquNdYDBhnN0is8rjjH4eQq7AHXT_wViTD"
|
||||
+ "JWvCd1BPydFDONPw64xHwHK0";
|
||||
|
||||
/*
|
||||
* Special thanks to our sponsors and donors:
|
||||
|
@ -5,12 +5,12 @@
|
||||
* (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
|
||||
@ -30,7 +30,7 @@
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.eggs;
|
||||
@ -73,8 +73,9 @@ public class PSystemWelcome extends AbstractPSystem {
|
||||
strings.add(" ");
|
||||
strings.add("You will find more information about PlantUML syntax on <u>https://plantuml.com</u>");
|
||||
strings.add(" ");
|
||||
strings.add("If you use this software, you accept its license.");
|
||||
strings.add("(If you use this software, you accept its license.)");
|
||||
strings.add("(details by typing \"\"license\"\" keyword)");
|
||||
strings.add(" ");
|
||||
if (position == GraphicPosition.BACKGROUND_CORNER_BOTTOM_RIGHT) {
|
||||
strings.add(" ");
|
||||
strings.add(" ");
|
||||
|
@ -77,15 +77,15 @@ public enum HorizontalAlignment {
|
||||
return toString().substring(0, 1).toLowerCase();
|
||||
}
|
||||
|
||||
public void draw(UGraphic ug, TextBlock tb, double padding, Dimension2D dimTotal) {
|
||||
public void draw(UGraphic ug, TextBlock tb, double padding, double width) {
|
||||
if (this == HorizontalAlignment.LEFT) {
|
||||
tb.drawU(ug.apply(new UTranslate(padding, padding)));
|
||||
} else if (this == HorizontalAlignment.RIGHT) {
|
||||
final Dimension2D dimTb = tb.calculateDimension(ug.getStringBounder());
|
||||
tb.drawU(ug.apply(new UTranslate(dimTotal.getWidth() - dimTb.getWidth() - padding, padding)));
|
||||
tb.drawU(ug.apply(new UTranslate(width - dimTb.getWidth() - padding, padding)));
|
||||
} else if (this == HorizontalAlignment.CENTER) {
|
||||
final Dimension2D dimTb = tb.calculateDimension(ug.getStringBounder());
|
||||
tb.drawU(ug.apply(new UTranslate((dimTotal.getWidth() - dimTb.getWidth()) / 2, padding)));
|
||||
tb.drawU(ug.apply(new UTranslate((width - dimTb.getWidth()) / 2, padding)));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -135,6 +135,11 @@ public class TextBlockUtils {
|
||||
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
||||
return new Dimension2DDouble(width, height);
|
||||
}
|
||||
|
||||
public Rectangle2D getInnerPosition(String member, StringBounder stringBounder, InnerStrategy strategy) {
|
||||
return null;
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@ -227,6 +232,8 @@ public class TextBlockUtils {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ import java.io.IOException;
|
||||
|
||||
|
||||
@SuppressWarnings("serial") // use default serial UID
|
||||
class JsonString extends JsonValue {
|
||||
public class JsonString extends JsonValue {
|
||||
|
||||
private final String string;
|
||||
|
||||
|
@ -45,7 +45,7 @@ import net.sourceforge.plantuml.FileFormatOption;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.Scale;
|
||||
import net.sourceforge.plantuml.SkinParam;
|
||||
import net.sourceforge.plantuml.UmlDiagram;
|
||||
import net.sourceforge.plantuml.TitledDiagram;
|
||||
import net.sourceforge.plantuml.UmlDiagramType;
|
||||
import net.sourceforge.plantuml.UseStyle;
|
||||
import net.sourceforge.plantuml.core.DiagramDescription;
|
||||
@ -69,7 +69,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
|
||||
public class JsonDiagram extends UmlDiagram {
|
||||
public class JsonDiagram extends TitledDiagram {
|
||||
|
||||
private final JsonValue root;
|
||||
private final List<String> highlighted;
|
||||
@ -93,7 +93,7 @@ public class JsonDiagram extends UmlDiagram {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption)
|
||||
protected ImageData exportDiagramNow(OutputStream os, int index, FileFormatOption fileFormatOption, long seed)
|
||||
throws IOException {
|
||||
final Scale scale = getScale();
|
||||
|
||||
|
@ -40,7 +40,6 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.BackSlash;
|
||||
import net.sourceforge.plantuml.StringLocated;
|
||||
import net.sourceforge.plantuml.UmlDiagramType;
|
||||
import net.sourceforge.plantuml.command.PSystemAbstractFactory;
|
||||
import net.sourceforge.plantuml.core.Diagram;
|
||||
@ -58,13 +57,15 @@ public class JsonDiagramFactory extends PSystemAbstractFactory {
|
||||
|
||||
public Diagram createSystem(UmlSource source) {
|
||||
final List<String> highlighted = new ArrayList<String>();
|
||||
StyleExtractor styleExtractor = null;
|
||||
JsonValue json;
|
||||
try {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
final Iterator<StringLocated> it = source.iterator2();
|
||||
styleExtractor = new StyleExtractor(source.iterator2());
|
||||
final Iterator<String> it = styleExtractor.getIterator();
|
||||
it.next();
|
||||
while (true) {
|
||||
final String line = it.next().getString();
|
||||
final String line = it.next();
|
||||
if (it.hasNext() == false) {
|
||||
break;
|
||||
}
|
||||
@ -83,6 +84,9 @@ public class JsonDiagramFactory extends PSystemAbstractFactory {
|
||||
json = null;
|
||||
}
|
||||
final JsonDiagram result = new JsonDiagram(UmlDiagramType.JSON, json, highlighted);
|
||||
if (styleExtractor != null) {
|
||||
styleExtractor.applyStyles(result.getSkinParam());
|
||||
}
|
||||
result.setSource(source);
|
||||
return result;
|
||||
}
|
||||
|
@ -53,6 +53,7 @@ import h.ST_Agnodeinfo_t;
|
||||
import h.ST_Agraph_s;
|
||||
import h.ST_GVC_s;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.UmlDiagramType;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.json.JsonValue;
|
||||
import net.sourceforge.plantuml.style.PName;
|
||||
@ -60,7 +61,6 @@ import net.sourceforge.plantuml.style.SName;
|
||||
import net.sourceforge.plantuml.style.Style;
|
||||
import net.sourceforge.plantuml.style.StyleSignature;
|
||||
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;
|
||||
@ -106,16 +106,21 @@ public class SmetanaForJson {
|
||||
public SmetanaForJson(UGraphic ug, ISkinParam skinParam) {
|
||||
this.stringBounder = ug.getStringBounder();
|
||||
this.skinParam = skinParam;
|
||||
this.ug = getStyle().applyStrokeAndLineColor(ug, skinParam.getIHtmlColorSet());
|
||||
this.ug = ug;
|
||||
}
|
||||
|
||||
private Style getStyle() {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.jsonDiagram)
|
||||
private UGraphic getUgFor(SName name) {
|
||||
return getStyle(name).applyStrokeAndLineColor(ug, skinParam.getIHtmlColorSet());
|
||||
}
|
||||
|
||||
private Style getStyle(SName name) {
|
||||
return StyleSignature.of(SName.root, SName.element,
|
||||
skinParam.getUmlDiagramType() == UmlDiagramType.YAML ? SName.yamlDiagram : SName.jsonDiagram, name)
|
||||
.getMergedStyle(skinParam.getCurrentStyleBuilder());
|
||||
}
|
||||
|
||||
private ST_Agnode_s manageOneNode(JsonValue current, List<String> highlighted) {
|
||||
final TextBlockJson block = new TextBlockJson(skinParam, current, highlighted);
|
||||
final TextBlockJson block = new TextBlockJson(skinParam, current, highlighted, getStyle(SName.node));
|
||||
final ST_Agnode_s node1 = createNode(block.calculateDimension(stringBounder), block.size(), current.isArray(),
|
||||
(int) block.getWidthColA(stringBounder), (int) block.getWidthColB(stringBounder));
|
||||
nodes.add(new InternalNode(block, node1));
|
||||
@ -157,14 +162,15 @@ public class SmetanaForJson {
|
||||
xMirror = new Mirror(max);
|
||||
|
||||
for (InternalNode node : nodes) {
|
||||
node.block.drawU(ug.apply(getPosition(node.node)));
|
||||
node.block.drawU(getUgFor(SName.node).apply(getPosition(node.node)));
|
||||
}
|
||||
final HColor color = getStyle().value(PName.LineColor).asColor(skinParam.getIHtmlColorSet());
|
||||
final HColor color = getStyle(SName.arrow).value(PName.LineColor).asColor(skinParam.getIHtmlColorSet());
|
||||
|
||||
for (ST_Agedge_s edge : edges) {
|
||||
final JsonCurve curve = getCurve(edge, 13);
|
||||
curve.drawCurve(color, ug.apply(new UStroke(3, 3, 1)));
|
||||
curve.drawSpot(ug.apply(color.bg()));
|
||||
// curve.drawCurve(color, getUgFor(SName.arrow).apply(new UStroke(3, 3, 1)));
|
||||
curve.drawCurve(color, getUgFor(SName.arrow));
|
||||
curve.drawSpot(getUgFor(SName.arrow).apply(color.bg()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -235,7 +241,8 @@ public class SmetanaForJson {
|
||||
agsafeset(node, new CString("height"), new CString("" + width), new CString(""));
|
||||
agsafeset(node, new CString("width"), new CString("" + height), new CString(""));
|
||||
|
||||
final String dotLabel = getDotLabel(size, isArray, colAwidth - 8, colBwidth - 8);
|
||||
final int lineHeight = 0;
|
||||
final String dotLabel = getDotLabel(size, isArray, colAwidth - 8, colBwidth - 8, lineHeight);
|
||||
if (size > 0) {
|
||||
agsafeset(node, new CString("label"), new CString(dotLabel), new CString(""));
|
||||
}
|
||||
@ -250,14 +257,15 @@ public class SmetanaForJson {
|
||||
return node;
|
||||
}
|
||||
|
||||
private String getDotLabel(int size, boolean isArray, int widthA, int widthB) {
|
||||
private String getDotLabel(int size, boolean isArray, int widthA, int widthB, int height) {
|
||||
final StringBuilder sb = new StringBuilder("");
|
||||
if (isArray == false) {
|
||||
sb.append("{_dim_0_" + widthA + "_|{");
|
||||
// "+height+"
|
||||
sb.append("{_dim_" + height + "_" + widthA + "_|{");
|
||||
}
|
||||
for (int i = 0; i < size; i++) {
|
||||
sb.append("<P" + i + ">");
|
||||
sb.append("_dim_0_" + widthB + "_");
|
||||
sb.append("_dim_" + height + "_" + widthB + "_");
|
||||
if (i < size - 1)
|
||||
sb.append("|");
|
||||
}
|
||||
|
85
src/net/sourceforge/plantuml/jsondiagram/StyleExtractor.java
Normal file
85
src/net/sourceforge/plantuml/jsondiagram/StyleExtractor.java
Normal file
@ -0,0 +1,85 @@
|
||||
/* ========================================================================
|
||||
* 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.jsondiagram;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.StringLocated;
|
||||
import net.sourceforge.plantuml.command.BlocLines;
|
||||
import net.sourceforge.plantuml.style.Style;
|
||||
import net.sourceforge.plantuml.style.StyleBuilder;
|
||||
import net.sourceforge.plantuml.style.StyleLoader;
|
||||
|
||||
public class StyleExtractor {
|
||||
|
||||
private final List<String> list = new ArrayList<String>();
|
||||
private final List<StringLocated> style = new ArrayList<StringLocated>();
|
||||
|
||||
public StyleExtractor(Iterator<StringLocated> data) {
|
||||
while (data.hasNext()) {
|
||||
StringLocated line = data.next();
|
||||
if (line.getString().trim().equals("<style>")) {
|
||||
while (data.hasNext()) {
|
||||
style.add(line);
|
||||
if (line.getString().trim().equals("</style>")) {
|
||||
break;
|
||||
}
|
||||
line = data.next();
|
||||
}
|
||||
} else {
|
||||
list.add(line.getString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void applyStyles(ISkinParam skinParam) {
|
||||
if (style.size() > 0) {
|
||||
final StyleBuilder styleBuilder = skinParam.getCurrentStyleBuilder();
|
||||
final BlocLines blocLines = BlocLines.from(style);
|
||||
for (Style modifiedStyle : StyleLoader.getDeclaredStyles(blocLines.subExtract(1, 1), styleBuilder)) {
|
||||
skinParam.muteStyle(modifiedStyle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Iterator<String> getIterator() {
|
||||
return list.iterator();
|
||||
}
|
||||
|
||||
}
|
@ -42,6 +42,7 @@ import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.LineBreakStrategy;
|
||||
import net.sourceforge.plantuml.creole.CreoleMode;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
|
||||
@ -54,14 +55,13 @@ import net.sourceforge.plantuml.json.JsonArray;
|
||||
import net.sourceforge.plantuml.json.JsonObject;
|
||||
import net.sourceforge.plantuml.json.JsonObject.Member;
|
||||
import net.sourceforge.plantuml.json.JsonValue;
|
||||
import net.sourceforge.plantuml.style.PName;
|
||||
import net.sourceforge.plantuml.style.SName;
|
||||
import net.sourceforge.plantuml.style.Style;
|
||||
import net.sourceforge.plantuml.style.StyleSignature;
|
||||
import net.sourceforge.plantuml.svek.TextBlockBackcolored;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.ULine;
|
||||
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;
|
||||
|
||||
@ -70,6 +70,7 @@ public class TextBlockJson extends AbstractTextBlock implements TextBlockBackcol
|
||||
|
||||
private final List<Line> lines = new ArrayList<Line>();
|
||||
|
||||
private final Style style;
|
||||
private final ISkinParam skinParam;
|
||||
private double totalWidth;
|
||||
private final JsonValue root;
|
||||
@ -99,8 +100,9 @@ public class TextBlockJson extends AbstractTextBlock implements TextBlockBackcol
|
||||
|
||||
}
|
||||
|
||||
public TextBlockJson(ISkinParam skinParam, JsonValue root, List<String> highlighted) {
|
||||
public TextBlockJson(ISkinParam skinParam, JsonValue root, List<String> highlighted, Style style) {
|
||||
this.skinParam = skinParam;
|
||||
this.style = style;
|
||||
this.root = root;
|
||||
if (root instanceof JsonObject)
|
||||
for (Member member : (JsonObject) root) {
|
||||
@ -230,17 +232,37 @@ public class TextBlockJson extends AbstractTextBlock implements TextBlockBackcol
|
||||
return width;
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
public void drawU(final UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
|
||||
final Dimension2D fullDim = calculateDimension(stringBounder);
|
||||
double trueWidth = Math.max(fullDim.getWidth(), totalWidth);
|
||||
final double widthColA = getWidthColA(stringBounder);
|
||||
final double widthColB = getWidthColB(stringBounder);
|
||||
|
||||
double y = 0;
|
||||
ug = getStyle().applyStrokeAndLineColor(ug, skinParam.getIHtmlColorSet());
|
||||
final UGraphic ugNode = style.applyStrokeAndLineColor(ug, skinParam.getIHtmlColorSet());
|
||||
for (Line line : lines) {
|
||||
final UGraphic ugline = ug.apply(UTranslate.dy(y));
|
||||
final double heightOfRow = line.getHeightOfRow(stringBounder);
|
||||
y += heightOfRow;
|
||||
}
|
||||
if (y == 0)
|
||||
y = 15;
|
||||
if (trueWidth == 0)
|
||||
trueWidth = 30;
|
||||
|
||||
final double round = style.value(PName.RoundCorner).asDouble();
|
||||
final URectangle fullNodeRectangle = new URectangle(trueWidth, y).rounded(round);
|
||||
final HColor backColor = style.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet());
|
||||
ugNode.apply(backColor.bg()).apply(backColor).draw(fullNodeRectangle);
|
||||
|
||||
final Style styleSeparator = style.getSignature().add(SName.separator)
|
||||
.getMergedStyle(skinParam.getCurrentStyleBuilder());
|
||||
final UGraphic ugSeparator = styleSeparator.applyStrokeAndLineColor(ug, skinParam.getIHtmlColorSet());
|
||||
|
||||
y = 0;
|
||||
for (Line line : lines) {
|
||||
final UGraphic ugline = ugSeparator.apply(UTranslate.dy(y));
|
||||
final double heightOfRow = line.getHeightOfRow(stringBounder);
|
||||
if (line.highlighted) {
|
||||
final URectangle back = new URectangle(trueWidth - 2, heightOfRow).rounded(4);
|
||||
@ -251,24 +273,19 @@ public class TextBlockJson extends AbstractTextBlock implements TextBlockBackcol
|
||||
if (y > 0)
|
||||
ugline.draw(ULine.hline(trueWidth));
|
||||
|
||||
final double posColA = (widthColA - line.b1.calculateDimension(stringBounder).getWidth()) / 2;
|
||||
line.b1.drawU(ugline.apply(UTranslate.dx(posColA)));
|
||||
final HorizontalAlignment horizontalAlignment = style.getHorizontalAlignment();
|
||||
horizontalAlignment.draw(ugline, line.b1, 0, widthColA);
|
||||
|
||||
if (line.b2 != null) {
|
||||
line.b2.drawU(ugline.apply(UTranslate.dx(widthColA)));
|
||||
ugline.apply(UTranslate.dx(widthColA)).draw(ULine.vline(heightOfRow));
|
||||
final UGraphic uglineColB = ugline.apply(UTranslate.dx(widthColA));
|
||||
horizontalAlignment.draw(uglineColB, line.b2, 0, widthColB);
|
||||
uglineColB.draw(ULine.vline(heightOfRow));
|
||||
}
|
||||
|
||||
y += heightOfRow;
|
||||
}
|
||||
ugNode.draw(fullNodeRectangle);
|
||||
|
||||
if (y == 0)
|
||||
y = 15;
|
||||
if (trueWidth == 0)
|
||||
trueWidth = 30;
|
||||
|
||||
final URectangle full = new URectangle(trueWidth, y).rounded(10);
|
||||
ug.apply(new UStroke(1.5)).draw(full);
|
||||
}
|
||||
|
||||
private double getTotalHeight(StringBounder stringBounder) {
|
||||
@ -281,18 +298,15 @@ public class TextBlockJson extends AbstractTextBlock implements TextBlockBackcol
|
||||
|
||||
private TextBlock getTextBlock(String key) {
|
||||
final Display display = Display.getWithNewlines(key);
|
||||
final FontConfiguration fontConfiguration = getStyle().getFontConfiguration(skinParam.getIHtmlColorSet());
|
||||
TextBlock result = display.create7(fontConfiguration, HorizontalAlignment.LEFT, skinParam,
|
||||
CreoleMode.NO_CREOLE);
|
||||
final FontConfiguration fontConfiguration = style.getFontConfiguration(skinParam.getIHtmlColorSet());
|
||||
final LineBreakStrategy wrap = style.wrapWidth();
|
||||
final HorizontalAlignment horizontalAlignment = style.getHorizontalAlignment();
|
||||
TextBlock result = display.create0(fontConfiguration, horizontalAlignment, skinParam, wrap,
|
||||
CreoleMode.NO_CREOLE, null, null);
|
||||
result = TextBlockUtils.withMargin(result, 5, 2);
|
||||
return result;
|
||||
}
|
||||
|
||||
private Style getStyle() {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.jsonDiagram)
|
||||
.getMergedStyle(skinParam.getCurrentStyleBuilder());
|
||||
}
|
||||
|
||||
public void setTotalWidth(double totalWidth) {
|
||||
this.totalWidth = totalWidth;
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||
import net.sourceforge.plantuml.objectdiagram.AbstractClassOrObjectDiagram;
|
||||
import net.sourceforge.plantuml.skin.VisibilityModifier;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandAddData extends SingleLineCommand2<AbstractClassOrObjectDiagram> {
|
||||
|
||||
@ -63,7 +64,7 @@ public class CommandAddData extends SingleLineCommand2<AbstractClassOrObjectDiag
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram, LineLocation location,
|
||||
RegexResult arg) {
|
||||
RegexResult arg) throws NoSuchColorException {
|
||||
final String name = arg.get("NAME", 0);
|
||||
final IEntity entity = diagram.getOrCreateLeaf(diagram.buildLeafIdent(name),
|
||||
diagram.buildCode(name), null, null);
|
||||
|
@ -36,6 +36,9 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.picoweb;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static net.sourceforge.plantuml.ErrorUmlType.SYNTAX_ERROR;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@ -67,9 +70,6 @@ import net.sourceforge.plantuml.error.PSystemErrorUtils;
|
||||
import net.sourceforge.plantuml.graphic.QuoteUtils;
|
||||
import net.sourceforge.plantuml.version.Version;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static net.sourceforge.plantuml.ErrorUmlType.SYNTAX_ERROR;
|
||||
|
||||
public class PicoWebServer implements Runnable {
|
||||
|
||||
private final Socket connect;
|
||||
@ -127,8 +127,7 @@ public class PicoWebServer implements Runnable {
|
||||
} catch (Throwable e) {
|
||||
try {
|
||||
sendError(e, out);
|
||||
}
|
||||
catch (Throwable e1) {
|
||||
} catch (Throwable e1) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} finally {
|
||||
@ -142,7 +141,8 @@ public class PicoWebServer implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean handleGET(ReceivedHTTPRequest request, BufferedOutputStream out, final FileFormat format) throws IOException {
|
||||
private boolean handleGET(ReceivedHTTPRequest request, BufferedOutputStream out, final FileFormat format)
|
||||
throws IOException {
|
||||
final int x = request.getPath().lastIndexOf('/');
|
||||
final String compressed = request.getPath().substring(x + 1);
|
||||
final Transcoder transcoder = TranscoderUtil.getDefaultTranscoderProtected();
|
||||
@ -156,7 +156,8 @@ public class PicoWebServer implements Runnable {
|
||||
final ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
final ImageData imageData = system.exportDiagram(os, 0, fileFormatOption);
|
||||
os.close();
|
||||
sendDiagram(out, system, fileFormatOption, httpReturnCode(imageData.getStatus()), imageData, os.toByteArray());
|
||||
sendDiagram(out, system, fileFormatOption, httpReturnCode(imageData.getStatus()), imageData,
|
||||
os.toByteArray());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -176,8 +177,7 @@ public class PicoWebServer implements Runnable {
|
||||
|
||||
final Option option = new Option(renderRequest.getOptions());
|
||||
|
||||
final String source = renderRequest.getSource().startsWith("@start")
|
||||
? renderRequest.getSource()
|
||||
final String source = renderRequest.getSource().startsWith("@start") ? renderRequest.getSource()
|
||||
: "@startuml\n" + renderRequest.getSource() + "\n@enduml";
|
||||
|
||||
final SourceStringReader ssr = new SourceStringReader(option.getDefaultDefines(), source, option.getConfig());
|
||||
@ -186,13 +186,10 @@ public class PicoWebServer implements Runnable {
|
||||
final ImageData imageData;
|
||||
|
||||
if (ssr.getBlocks().size() == 0) {
|
||||
system = PSystemErrorUtils.buildV2(
|
||||
null,
|
||||
new ErrorUml(SYNTAX_ERROR, "No @startuml/@enduml found", 0, new LineLocationImpl("", null)),
|
||||
null,
|
||||
Collections.<StringLocated>emptyList()
|
||||
);
|
||||
imageData = ssr.noStartumlFound(os, option.getFileFormatOption(),42);
|
||||
system = PSystemErrorUtils.buildV2(null,
|
||||
new ErrorUml(SYNTAX_ERROR, "No @startuml/@enduml found", 0, new LineLocationImpl("", null)), null,
|
||||
Collections.<StringLocated>emptyList());
|
||||
imageData = ssr.noStartumlFound(os, option.getFileFormatOption(), 42);
|
||||
} else {
|
||||
system = ssr.getBlocks().get(0).getDiagram();
|
||||
imageData = system.exportDiagram(os, 0, option.getFileFormatOption());
|
||||
@ -201,9 +198,9 @@ public class PicoWebServer implements Runnable {
|
||||
sendDiagram(out, system, option.getFileFormatOption(), "200", imageData, os.toByteArray());
|
||||
}
|
||||
|
||||
private void sendDiagram(final BufferedOutputStream out, final Diagram system, final FileFormatOption fileFormatOption,
|
||||
final String returnCode, final ImageData imageData, final byte[] fileData)
|
||||
throws IOException {
|
||||
private void sendDiagram(final BufferedOutputStream out, final Diagram system,
|
||||
final FileFormatOption fileFormatOption, final String returnCode, final ImageData imageData,
|
||||
final byte[] fileData) throws IOException {
|
||||
|
||||
write(out, "HTTP/1.1 " + returnCode);
|
||||
write(out, "Cache-Control: no-cache");
|
||||
|
@ -248,11 +248,16 @@ public class PicoWebServerTest {
|
||||
}
|
||||
|
||||
private static String httpRaw(String request) throws Exception {
|
||||
try (Socket socket = socketConnection()) {
|
||||
Socket socket = null;
|
||||
try {
|
||||
socket = socketConnection();
|
||||
socket.getOutputStream().write(request.getBytes(UTF_8));
|
||||
socket.shutdownOutput();
|
||||
return readStreamAsString(socket.getInputStream())
|
||||
.replaceAll("\r\n", "\n");
|
||||
return readStreamAsString(socket.getInputStream()).replaceAll("\r\n", "\n");
|
||||
} finally {
|
||||
if (socket != null) {
|
||||
socket.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,6 @@ public class Sub {
|
||||
result.add(s);
|
||||
}
|
||||
}
|
||||
reader.close();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -82,11 +82,10 @@ public class LinkAnchor {
|
||||
|
||||
public void drawAnchor(UGraphic ug, YPositionedTile tile1, YPositionedTile tile2, ISkinParam param) {
|
||||
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final double y1 = tile1.getY(stringBounder);
|
||||
final double y2 = tile2.getY(stringBounder);
|
||||
final double xx1 = tile1.getMiddleX(stringBounder);
|
||||
final double xx2 = tile2.getMiddleX(stringBounder);
|
||||
final double y1 = tile1.getY();
|
||||
final double y2 = tile2.getY();
|
||||
final double xx1 = tile1.getMiddleX();
|
||||
final double xx2 = tile2.getMiddleX();
|
||||
final double x = (xx1 + xx2) / 2;
|
||||
final double ymin = Math.min(y1, y2);
|
||||
final double ymax = Math.max(y1, y2);
|
||||
|
@ -35,6 +35,9 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.skin.ArrowConfiguration;
|
||||
import net.sourceforge.plantuml.style.StyleBuilder;
|
||||
@ -79,4 +82,14 @@ public final class Message extends AbstractMessage {
|
||||
return p1 == p2;
|
||||
}
|
||||
|
||||
private List<Participant> multicast = Collections.emptyList();
|
||||
|
||||
public void setMulticast(List<Participant> multicast) {
|
||||
this.multicast = multicast;
|
||||
}
|
||||
|
||||
public List<Participant> getMulticast() {
|
||||
return multicast;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -35,6 +35,9 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.command;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import net.sourceforge.plantuml.LineLocation;
|
||||
@ -48,6 +51,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.RegexOr;
|
||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
@ -106,9 +110,10 @@ public class CommandArrow extends SingleLineCommand2<SequenceDiagram> {
|
||||
new RegexLeaf("PART2LONG", "[%g]([^%g]+)[%g]"), //
|
||||
new RegexLeaf("PART2LONGCODE", "[%g]([^%g]+)[%g][%s]*as[%s]+([\\p{L}0-9_.@]+)"), //
|
||||
new RegexLeaf("PART2CODELONG", "([\\p{L}0-9_.@]+)[%s]+as[%s]*[%g]([^%g]+)[%g]")), //
|
||||
new RegexLeaf("MULTICAST", "((?:\\s&\\s[\\p{L}0-9_.@]+)*)"), //
|
||||
new RegexLeaf("PART2ANCHOR", ANCHOR), //
|
||||
RegexLeaf.spaceZeroOrMore(), //
|
||||
new RegexLeaf("ACTIVATION", "(?:([+*!-]+)?)"), //
|
||||
new RegexLeaf("ACTIVATION", "(?:(\\+\\+|\\*\\*|!!|--|--\\+\\+|\\+\\+--)?)"), //
|
||||
RegexLeaf.spaceZeroOrMore(), //
|
||||
new RegexLeaf("LIFECOLOR", "(?:(#\\w+)?)"), //
|
||||
RegexLeaf.spaceZeroOrMore(), //
|
||||
@ -118,6 +123,25 @@ public class CommandArrow extends SingleLineCommand2<SequenceDiagram> {
|
||||
RegexLeaf.end());
|
||||
}
|
||||
|
||||
private List<Participant> getMulticasts(SequenceDiagram system, RegexResult arg2) {
|
||||
final String multicast = arg2.get("MULTICAST", 0);
|
||||
if (multicast != null) {
|
||||
final List<Participant> result = new ArrayList<Participant>();
|
||||
for (String s : multicast.split("&")) {
|
||||
s = s.trim();
|
||||
if (s.length() == 0) {
|
||||
continue;
|
||||
}
|
||||
final Participant participant = system.getOrCreateParticipant(s);
|
||||
if (participant != null) {
|
||||
result.add(participant);
|
||||
}
|
||||
}
|
||||
return Collections.unmodifiableList(result);
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
private Participant getOrCreateParticipant(SequenceDiagram system, RegexResult arg2, String n) {
|
||||
final String code;
|
||||
final Display display;
|
||||
@ -157,7 +181,8 @@ public class CommandArrow extends SingleLineCommand2<SequenceDiagram> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
|
||||
protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocation location, RegexResult arg)
|
||||
throws NoSuchColorException {
|
||||
|
||||
Participant p1;
|
||||
Participant p2;
|
||||
@ -251,6 +276,7 @@ public class CommandArrow extends SingleLineCommand2<SequenceDiagram> {
|
||||
final String messageNumber = diagram.getNextMessageNumber();
|
||||
final Message msg = new Message(diagram.getSkinParam().getCurrentStyleBuilder(), p1, p2,
|
||||
diagram.manageVariable(labels), config, messageNumber);
|
||||
msg.setMulticast(getMulticasts(diagram, arg));
|
||||
final String url = arg.get("URL", 0);
|
||||
if (url != null) {
|
||||
final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT);
|
||||
@ -272,31 +298,44 @@ public class CommandArrow extends SingleLineCommand2<SequenceDiagram> {
|
||||
}
|
||||
final String s = arg.get("LIFECOLOR", 0);
|
||||
|
||||
final HColor activationColor = s == null ? null
|
||||
: diagram.getSkinParam().getIHtmlColorSet().getColor(s);
|
||||
final HColor activationColor = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
|
||||
|
||||
if (activationSpec != null) {
|
||||
switch (activationSpec.charAt(0)) {
|
||||
return manageActivations(activationSpec, diagram, p1, p2, activationColor);
|
||||
}
|
||||
|
||||
if (diagram.isAutoactivate() && (config.getHead() == ArrowHead.NORMAL || config.getHead() == ArrowHead.ASYNC)) {
|
||||
if (config.isDotted()) {
|
||||
diagram.activate(p1, LifeEventType.DEACTIVATE, null);
|
||||
} else {
|
||||
diagram.activate(p2, LifeEventType.ACTIVATE, activationColor);
|
||||
}
|
||||
}
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
||||
private CommandExecutionResult manageActivations(String spec, SequenceDiagram diagram, Participant p1,
|
||||
Participant p2, HColor activationColor) {
|
||||
switch (spec.charAt(0)) {
|
||||
case '+':
|
||||
diagram.activate(p2, LifeEventType.ACTIVATE, activationColor);
|
||||
break;
|
||||
case '-':
|
||||
diagram.activate(p1, LifeEventType.DEACTIVATE, null);
|
||||
break;
|
||||
case '!':
|
||||
diagram.activate(p2, LifeEventType.DESTROY, null);
|
||||
break;
|
||||
}
|
||||
if (spec.length() == 4) {
|
||||
switch (spec.charAt(2)) {
|
||||
case '+':
|
||||
diagram.activate(p2, LifeEventType.ACTIVATE, activationColor);
|
||||
break;
|
||||
case '-':
|
||||
diagram.activate(p1, LifeEventType.DEACTIVATE, null);
|
||||
break;
|
||||
case '!':
|
||||
diagram.activate(p2, LifeEventType.DESTROY, null);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else if (diagram.isAutoactivate()
|
||||
&& (config.getHead() == ArrowHead.NORMAL || config.getHead() == ArrowHead.ASYNC)) {
|
||||
if (config.isDotted()) {
|
||||
diagram.activate(p1, LifeEventType.DEACTIVATE, null);
|
||||
} else {
|
||||
diagram.activate(p2, LifeEventType.ACTIVATE, activationColor);
|
||||
}
|
||||
|
||||
}
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
@ -313,7 +352,8 @@ public class CommandArrow extends SingleLineCommand2<SequenceDiagram> {
|
||||
return sa.length() + sb.length();
|
||||
}
|
||||
|
||||
public static ArrowConfiguration applyStyle(String arrowStyle, ArrowConfiguration config) throws NoSuchColorException {
|
||||
public static ArrowConfiguration applyStyle(String arrowStyle, ArrowConfiguration config)
|
||||
throws NoSuchColorException {
|
||||
if (arrowStyle == null) {
|
||||
return config;
|
||||
}
|
||||
|
@ -113,13 +113,13 @@ public class SequenceDiagramTxtMaker implements FileMaker {
|
||||
if (title.isWhite()) {
|
||||
ug2 = ug;
|
||||
} else {
|
||||
ug2 = (UGraphicTxt) ug.apply(UTranslate.dy(title.as().size() + 1));
|
||||
ug2 = (UGraphicTxt) ug.apply(UTranslate.dy(title.asList().size() + 1));
|
||||
}
|
||||
drawableSet.drawU22(ug2, 0, fullDimension.getWidth(), page, diagram.isShowFootbox());
|
||||
if (title.isWhite() == false) {
|
||||
final int widthTitle = StringUtils.getWcWidth(title);
|
||||
final UmlCharArea charArea = ug.getCharArea();
|
||||
charArea.drawStringsLRSimple(title.as(), (int) ((fullDimension.getWidth() - widthTitle) / 2), 0);
|
||||
charArea.drawStringsLRSimple(title.asList(), (int) ((fullDimension.getWidth() - widthTitle) / 2), 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -39,18 +39,22 @@ import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.sequencediagram.AbstractMessage;
|
||||
import net.sourceforge.plantuml.sequencediagram.Event;
|
||||
|
||||
public abstract class AbstractTile implements Tile {
|
||||
public abstract class AbstractTile extends CommonTile implements Tile {
|
||||
|
||||
public double getYPoint(StringBounder stringBounder) {
|
||||
throw new UnsupportedOperationException(getClass().toString());
|
||||
public AbstractTile(StringBounder stringBounder) {
|
||||
super(stringBounder);
|
||||
}
|
||||
|
||||
final public double getZ(StringBounder stringBounder) {
|
||||
final double result = getPreferredHeight(stringBounder) - getYPoint(stringBounder);
|
||||
public double getContactPointRelative() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
final public double getZZZ() {
|
||||
final double result = getPreferredHeight() - getContactPointRelative();
|
||||
assert result >= 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public boolean matchAnchorV1(String anchor) {
|
||||
final Event event = this.getEvent();
|
||||
if (event instanceof AbstractMessage) {
|
||||
@ -62,5 +66,4 @@ public abstract class AbstractTile implements Tile {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -35,7 +35,6 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.teoz;
|
||||
|
||||
|
||||
public interface Bordered {
|
||||
|
||||
public double getBorder1();
|
||||
|
@ -37,10 +37,23 @@ package net.sourceforge.plantuml.sequencediagram.teoz;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
|
||||
public interface TileWithUpdateStairs extends Tile {
|
||||
public abstract class CommonTile implements Tile {
|
||||
|
||||
public void updateStairs(StringBounder stringBounder, double y);
|
||||
private final StringBounder stringBounder;
|
||||
|
||||
public double getYPoint(StringBounder stringBounder);
|
||||
public CommonTile(StringBounder stringBounder) {
|
||||
this.stringBounder = stringBounder;
|
||||
}
|
||||
|
||||
final public void callbackY(double y) {
|
||||
callbackY_internal(y);
|
||||
}
|
||||
|
||||
public void callbackY_internal(double y) {
|
||||
}
|
||||
|
||||
protected final StringBounder getStringBounder() {
|
||||
return stringBounder;
|
||||
}
|
||||
|
||||
}
|
@ -54,7 +54,7 @@ import net.sourceforge.plantuml.skin.rose.Rose;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class CommunicationExoTile extends AbstractTile implements TileWithUpdateStairs {
|
||||
public class CommunicationExoTile extends AbstractTile {
|
||||
|
||||
private final LivingSpace livingSpace;
|
||||
private final MessageExo message;
|
||||
@ -68,6 +68,7 @@ public class CommunicationExoTile extends AbstractTile implements TileWithUpdate
|
||||
|
||||
public CommunicationExoTile(LivingSpace livingSpace, MessageExo message, Rose skin, ISkinParam skinParam,
|
||||
TileArguments tileArguments) {
|
||||
super(tileArguments.getStringBounder());
|
||||
this.tileArguments = tileArguments;
|
||||
this.livingSpace = livingSpace;
|
||||
this.message = message;
|
||||
@ -76,8 +77,8 @@ public class CommunicationExoTile extends AbstractTile implements TileWithUpdate
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getYPoint(StringBounder stringBounder) {
|
||||
return getComponent(stringBounder).getYPoint(stringBounder);
|
||||
public double getContactPointRelative() {
|
||||
return getComponent(getStringBounder()).getYPoint(getStringBounder());
|
||||
}
|
||||
|
||||
private ArrowComponent getComponent(StringBounder stringBounder) {
|
||||
@ -129,9 +130,9 @@ public class CommunicationExoTile extends AbstractTile implements TileWithUpdate
|
||||
return message.isShortArrow();
|
||||
}
|
||||
|
||||
public double getPreferredHeight(StringBounder stringBounder) {
|
||||
final Component comp = getComponent(stringBounder);
|
||||
final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
||||
public double getPreferredHeight() {
|
||||
final Component comp = getComponent(getStringBounder());
|
||||
final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
|
||||
return dim.getHeight();
|
||||
}
|
||||
|
||||
@ -141,15 +142,15 @@ public class CommunicationExoTile extends AbstractTile implements TileWithUpdate
|
||||
return dim.getWidth();
|
||||
}
|
||||
|
||||
public void addConstraints(StringBounder stringBounder) {
|
||||
final Component comp = getComponent(stringBounder);
|
||||
final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
||||
public void addConstraints() {
|
||||
final Component comp = getComponent(getStringBounder());
|
||||
final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
|
||||
final double width = dim.getWidth();
|
||||
|
||||
if (message.getType().isRightBorder()) {
|
||||
|
||||
} else {
|
||||
livingSpace.getPosC(stringBounder).ensureBiggerThan(tileArguments.getOrigin().addFixed(width));
|
||||
livingSpace.getPosC(getStringBounder()).ensureBiggerThan(tileArguments.getOrigin().addFixed(width));
|
||||
}
|
||||
|
||||
// final Real point1 = getPoint1(stringBounder);
|
||||
@ -165,10 +166,11 @@ public class CommunicationExoTile extends AbstractTile implements TileWithUpdate
|
||||
// }
|
||||
}
|
||||
|
||||
public void updateStairs(StringBounder stringBounder, double y) {
|
||||
final ArrowComponent comp = getComponent(stringBounder);
|
||||
final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
||||
final double arrowY = comp.getStartPoint(stringBounder, dim).getY();
|
||||
@Override
|
||||
public void callbackY_internal(double y) {
|
||||
final ArrowComponent comp = getComponent(getStringBounder());
|
||||
final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
|
||||
final double arrowY = comp.getStartPoint(getStringBounder(), dim).getY();
|
||||
|
||||
livingSpace.addStepForLivebox(getEvent(), y + arrowY);
|
||||
|
||||
@ -201,15 +203,15 @@ public class CommunicationExoTile extends AbstractTile implements TileWithUpdate
|
||||
return livingSpace.getPosC(stringBounder).getCurrentValue();
|
||||
}
|
||||
|
||||
public Real getMinX(StringBounder stringBounder) {
|
||||
return getPoint1(stringBounder);
|
||||
public Real getMinX() {
|
||||
return getPoint1(getStringBounder());
|
||||
}
|
||||
|
||||
public Real getMaxX(StringBounder stringBounder) {
|
||||
final Component comp = getComponent(stringBounder);
|
||||
final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
||||
public Real getMaxX() {
|
||||
final Component comp = getComponent(getStringBounder());
|
||||
final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
|
||||
final double width = dim.getWidth();
|
||||
return getPoint1(stringBounder).addFixed(width);
|
||||
return getPoint1(getStringBounder()).addFixed(width);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -39,12 +39,14 @@ import java.awt.geom.Dimension2D;
|
||||
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.LineParam;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.VerticalAlignment;
|
||||
import net.sourceforge.plantuml.real.Real;
|
||||
import net.sourceforge.plantuml.sequencediagram.Event;
|
||||
import net.sourceforge.plantuml.sequencediagram.Message;
|
||||
import net.sourceforge.plantuml.sequencediagram.Participant;
|
||||
import net.sourceforge.plantuml.skin.Area;
|
||||
import net.sourceforge.plantuml.skin.ArrowComponent;
|
||||
import net.sourceforge.plantuml.skin.ArrowConfiguration;
|
||||
@ -56,10 +58,11 @@ import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class CommunicationTile extends AbstractTile implements TileWithUpdateStairs, TileWithCallbackY {
|
||||
public class CommunicationTile extends AbstractTile {
|
||||
|
||||
private final LivingSpace livingSpace1;
|
||||
private final LivingSpace livingSpace2;
|
||||
private final LivingSpaces livingSpaces;
|
||||
private final Message message;
|
||||
private final Rose skin;
|
||||
private final ISkinParam skinParam;
|
||||
@ -73,13 +76,12 @@ public class CommunicationTile extends AbstractTile implements TileWithUpdateSta
|
||||
return super.toString() + " " + message;
|
||||
}
|
||||
|
||||
public CommunicationTile(LivingSpace livingSpace1, LivingSpace livingSpace2, Message message, Rose skin,
|
||||
public CommunicationTile(StringBounder stringBounder, LivingSpaces livingSpaces, Message message, Rose skin,
|
||||
ISkinParam skinParam) {
|
||||
if (livingSpace1 == livingSpace2) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
this.livingSpace1 = livingSpace1;
|
||||
this.livingSpace2 = livingSpace2;
|
||||
super(stringBounder);
|
||||
this.livingSpace1 = livingSpaces.get(message.getParticipant1());
|
||||
this.livingSpace2 = livingSpaces.get(message.getParticipant2());
|
||||
this.livingSpaces = livingSpaces;
|
||||
this.message = message;
|
||||
this.skin = skin;
|
||||
this.skinParam = skinParam;
|
||||
@ -87,11 +89,6 @@ public class CommunicationTile extends AbstractTile implements TileWithUpdateSta
|
||||
if (message.isCreate()) {
|
||||
livingSpace2.goCreate();
|
||||
}
|
||||
// for (LifeEvent lifeEvent : message.getLiveEvents()) {
|
||||
// System.err.println("lifeEvent = " + lifeEvent);
|
||||
// // livingSpace1.addLifeEvent(this, lifeEvent);
|
||||
// // livingSpace2.addLifeEvent(this, lifeEvent);
|
||||
// }
|
||||
}
|
||||
|
||||
public boolean isReverse(StringBounder stringBounder) {
|
||||
@ -117,37 +114,45 @@ public class CommunicationTile extends AbstractTile implements TileWithUpdateSta
|
||||
|
||||
private ArrowComponent getComponent(StringBounder stringBounder) {
|
||||
ArrowConfiguration arrowConfiguration = message.getArrowConfiguration();
|
||||
/*
|
||||
* if (isSelf()) { arrowConfiguration = arrowConfiguration.self(); } else
|
||||
*/
|
||||
if (isReverse(stringBounder)) {
|
||||
arrowConfiguration = arrowConfiguration.reverse();
|
||||
}
|
||||
arrowConfiguration = arrowConfiguration.withThickness(getArrowThickness());
|
||||
|
||||
final ArrowComponent comp = skin.createComponentArrow(message.getUsedStyles(), arrowConfiguration, skinParam,
|
||||
return skin.createComponentArrow(message.getUsedStyles(), arrowConfiguration, skinParam,
|
||||
message.getLabelNumbered());
|
||||
return comp;
|
||||
}
|
||||
|
||||
private ArrowComponent getComponentMulticast(StringBounder stringBounder, boolean reverse) {
|
||||
ArrowConfiguration arrowConfiguration = message.getArrowConfiguration();
|
||||
if (reverse) {
|
||||
arrowConfiguration = arrowConfiguration.reverse();
|
||||
}
|
||||
arrowConfiguration = arrowConfiguration.withThickness(getArrowThickness());
|
||||
|
||||
return skin.createComponentArrow(message.getUsedStyles(), arrowConfiguration, skinParam, Display.NULL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getYPoint(StringBounder stringBounder) {
|
||||
return getComponent(stringBounder).getYPoint(stringBounder);
|
||||
public double getContactPointRelative() {
|
||||
return getComponent(getStringBounder()).getYPoint(getStringBounder());
|
||||
}
|
||||
|
||||
public static final double LIVE_DELTA_SIZE = 5;
|
||||
|
||||
public void updateStairs(StringBounder stringBounder, double y) {
|
||||
final AbstractComponentRoseArrow comp = (AbstractComponentRoseArrow) getComponent(stringBounder);
|
||||
final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
||||
// final Point2D p2 = comp.getEndPoint(stringBounder, dim);
|
||||
// System.err.println("CommunicationTile::updateStairs y=" + y + " p1=" + p1 + " p2=" + p2 + " dim=" + dim);
|
||||
final double arrowY = comp.getStartPoint(stringBounder, dim).getY();
|
||||
@Override
|
||||
public void callbackY_internal(double y) {
|
||||
if (message.isCreate()) {
|
||||
livingSpace2.goCreate(y);
|
||||
}
|
||||
|
||||
final AbstractComponentRoseArrow comp = (AbstractComponentRoseArrow) getComponent(getStringBounder());
|
||||
final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
|
||||
|
||||
final double arrowY = comp.getStartPoint(getStringBounder(), dim).getY();
|
||||
|
||||
livingSpace1.addStepForLivebox(getEvent(), y + arrowY);
|
||||
livingSpace2.addStepForLivebox(getEvent(), y + arrowY);
|
||||
|
||||
// System.err.println("CommunicationTile::updateStairs msg=" + message + " y=" + y + " arrowY=" + arrowY);
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
@ -161,6 +166,7 @@ public class CommunicationTile extends AbstractTile implements TileWithUpdateSta
|
||||
final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
||||
double x1 = getPoint1(stringBounder).getCurrentValue();
|
||||
double x2 = getPoint2(stringBounder).getCurrentValue();
|
||||
drawMulticast(ug.apply(UTranslate.dy(comp.getPosArrow(stringBounder))));
|
||||
|
||||
final Area area;
|
||||
if (isReverse(stringBounder)) {
|
||||
@ -193,24 +199,45 @@ public class CommunicationTile extends AbstractTile implements TileWithUpdateSta
|
||||
comp.drawU(ug, area, (Context2D) ug);
|
||||
}
|
||||
|
||||
public double getPreferredHeight(StringBounder stringBounder) {
|
||||
final Component comp = getComponent(stringBounder);
|
||||
final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
||||
private void drawMulticast(final UGraphic ug) {
|
||||
if (message.getMulticast().size() == 0) {
|
||||
return;
|
||||
}
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
|
||||
final double x1 = getPoint1(stringBounder).getCurrentValue();
|
||||
double dy = 2;
|
||||
for (Participant participant : message.getMulticast()) {
|
||||
final double x2 = livingSpaces.get(participant).getPosC(stringBounder).getCurrentValue();
|
||||
final boolean reverse = x2 < x1;
|
||||
final ArrowComponent comp = getComponentMulticast(stringBounder, reverse);
|
||||
final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
||||
final Area area = new Area(Math.abs(x2 - x1), dim.getHeight());
|
||||
final UGraphic ug2 = ug.apply(UTranslate.dx(Math.min(x1, x2))).apply(UTranslate.dy(dy));
|
||||
dy += 2;
|
||||
comp.drawU(ug2, area, (Context2D) ug2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public double getPreferredHeight() {
|
||||
final Component comp = getComponent(getStringBounder());
|
||||
final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
|
||||
double height = dim.getHeight();
|
||||
if (isCreate()) {
|
||||
height = Math.max(height, livingSpace2.getHeadPreferredDimension(stringBounder).getHeight());
|
||||
height = Math.max(height, livingSpace2.getHeadPreferredDimension(getStringBounder()).getHeight());
|
||||
}
|
||||
return height;
|
||||
}
|
||||
|
||||
public void addConstraints(StringBounder stringBounder) {
|
||||
final Component comp = getComponent(stringBounder);
|
||||
final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
||||
public void addConstraints() {
|
||||
final Component comp = getComponent(getStringBounder());
|
||||
final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
|
||||
final double width = dim.getWidth();
|
||||
|
||||
Real point1 = getPoint1(stringBounder);
|
||||
Real point2 = getPoint2(stringBounder);
|
||||
if (isReverse(stringBounder)) {
|
||||
Real point1 = getPoint1(getStringBounder());
|
||||
Real point2 = getPoint2(getStringBounder());
|
||||
if (isReverse(getStringBounder())) {
|
||||
final int level1 = livingSpace1.getLevelAt(this, EventsHistoryMode.IGNORE_FUTURE_DEACTIVATE);
|
||||
final int level2 = livingSpace2.getLevelAt(this, EventsHistoryMode.IGNORE_FUTURE_DEACTIVATE);
|
||||
if (level1 > 0) {
|
||||
@ -241,24 +268,18 @@ public class CommunicationTile extends AbstractTile implements TileWithUpdateSta
|
||||
return livingSpace2.getPosC(stringBounder);
|
||||
}
|
||||
|
||||
public Real getMinX(StringBounder stringBounder) {
|
||||
if (isReverse(stringBounder)) {
|
||||
return getPoint2(stringBounder);
|
||||
public Real getMinX() {
|
||||
if (isReverse(getStringBounder())) {
|
||||
return getPoint2(getStringBounder());
|
||||
}
|
||||
return getPoint1(stringBounder);
|
||||
return getPoint1(getStringBounder());
|
||||
}
|
||||
|
||||
public Real getMaxX(StringBounder stringBounder) {
|
||||
if (isReverse(stringBounder)) {
|
||||
return getPoint1(stringBounder);
|
||||
}
|
||||
return getPoint2(stringBounder);
|
||||
}
|
||||
|
||||
public void callbackY(double y) {
|
||||
if (message.isCreate()) {
|
||||
livingSpace2.goCreate(y);
|
||||
public Real getMaxX() {
|
||||
if (isReverse(getStringBounder())) {
|
||||
return getPoint1(getStringBounder());
|
||||
}
|
||||
return getPoint2(getStringBounder());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -55,9 +55,9 @@ import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
|
||||
public class CommunicationTileNoteBottom extends AbstractTile implements TileWithUpdateStairs, TileWithCallbackY {
|
||||
public class CommunicationTileNoteBottom extends AbstractTile {
|
||||
|
||||
private final TileWithUpdateStairs tile;
|
||||
private final Tile tile;
|
||||
private final AbstractMessage message;
|
||||
private final Rose skin;
|
||||
private final ISkinParam skinParam;
|
||||
@ -68,12 +68,13 @@ public class CommunicationTileNoteBottom extends AbstractTile implements TileWit
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getYPoint(StringBounder stringBounder) {
|
||||
return tile.getYPoint(stringBounder);
|
||||
public double getContactPointRelative() {
|
||||
return tile.getContactPointRelative();
|
||||
}
|
||||
|
||||
public CommunicationTileNoteBottom(TileWithUpdateStairs tile, AbstractMessage message, Rose skin,
|
||||
ISkinParam skinParam, Note noteOnMessage) {
|
||||
public CommunicationTileNoteBottom(Tile tile, AbstractMessage message, Rose skin, ISkinParam skinParam,
|
||||
Note noteOnMessage) {
|
||||
super(((AbstractTile) tile).getStringBounder());
|
||||
this.tile = tile;
|
||||
this.message = message;
|
||||
this.skin = skin;
|
||||
@ -81,8 +82,9 @@ public class CommunicationTileNoteBottom extends AbstractTile implements TileWit
|
||||
this.noteOnMessage = noteOnMessage;
|
||||
}
|
||||
|
||||
public void updateStairs(StringBounder stringBounder, double y) {
|
||||
tile.updateStairs(stringBounder, y);
|
||||
@Override
|
||||
public void callbackY_internal(double y) {
|
||||
tile.callbackY(y);
|
||||
}
|
||||
|
||||
private Component getComponent(StringBounder stringBounder) {
|
||||
@ -92,7 +94,7 @@ public class CommunicationTileNoteBottom extends AbstractTile implements TileWit
|
||||
}
|
||||
|
||||
private Real getNotePosition(StringBounder stringBounder) {
|
||||
final Real minX = tile.getMinX(stringBounder);
|
||||
final Real minX = tile.getMinX();
|
||||
return minX;
|
||||
}
|
||||
|
||||
@ -103,15 +105,15 @@ public class CommunicationTileNoteBottom extends AbstractTile implements TileWit
|
||||
final Area area = new Area(dim.getWidth(), dim.getHeight());
|
||||
tile.drawU(ug);
|
||||
|
||||
final double middleMsg = (tile.getMinX(stringBounder).getCurrentValue() + tile.getMaxX(stringBounder).getCurrentValue()) / 2;
|
||||
final double middleMsg = (tile.getMinX().getCurrentValue() + tile.getMaxX().getCurrentValue()) / 2;
|
||||
|
||||
final double xNote = getNotePosition(stringBounder).getCurrentValue();
|
||||
final double yNote = tile.getPreferredHeight(stringBounder);
|
||||
final double yNote = tile.getPreferredHeight();
|
||||
|
||||
comp.drawU(ug.apply(new UTranslate(xNote, yNote + spacey)), area, (Context2D) ug);
|
||||
|
||||
drawLine(ug, middleMsg, tile.getYPoint(stringBounder), xNote + dim.getWidth() / 2, yNote + spacey
|
||||
+ Rose.paddingY);
|
||||
drawLine(ug, middleMsg, tile.getContactPointRelative(), xNote + dim.getWidth() / 2,
|
||||
yNote + spacey + Rose.paddingY);
|
||||
|
||||
}
|
||||
|
||||
@ -123,33 +125,26 @@ public class CommunicationTileNoteBottom extends AbstractTile implements TileWit
|
||||
final double dx = x2 - x1;
|
||||
final double dy = y2 - y1;
|
||||
|
||||
ug.apply(new UTranslate(x1, y1)).apply(color).apply(new UStroke(2, 2, 1))
|
||||
.draw(new ULine(dx, dy));
|
||||
ug.apply(new UTranslate(x1, y1)).apply(color).apply(new UStroke(2, 2, 1)).draw(new ULine(dx, dy));
|
||||
|
||||
}
|
||||
|
||||
public double getPreferredHeight(StringBounder stringBounder) {
|
||||
final Component comp = getComponent(stringBounder);
|
||||
final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
||||
return tile.getPreferredHeight(stringBounder) + dim.getHeight() + spacey;
|
||||
public double getPreferredHeight() {
|
||||
final Component comp = getComponent(getStringBounder());
|
||||
final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
|
||||
return tile.getPreferredHeight() + dim.getHeight() + spacey;
|
||||
}
|
||||
|
||||
public void addConstraints(StringBounder stringBounder) {
|
||||
tile.addConstraints(stringBounder);
|
||||
public void addConstraints() {
|
||||
tile.addConstraints();
|
||||
}
|
||||
|
||||
public Real getMinX(StringBounder stringBounder) {
|
||||
return tile.getMinX(stringBounder);
|
||||
public Real getMinX() {
|
||||
return tile.getMinX();
|
||||
}
|
||||
|
||||
public Real getMaxX(StringBounder stringBounder) {
|
||||
return tile.getMaxX(stringBounder);
|
||||
}
|
||||
|
||||
public void callbackY(double y) {
|
||||
if (tile instanceof TileWithCallbackY) {
|
||||
((TileWithCallbackY) tile).callbackY(y);
|
||||
}
|
||||
public Real getMaxX() {
|
||||
return tile.getMaxX();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -51,9 +51,9 @@ import net.sourceforge.plantuml.skin.rose.Rose;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class CommunicationTileNoteLeft extends AbstractTile implements TileWithUpdateStairs, TileWithCallbackY {
|
||||
public class CommunicationTileNoteLeft extends AbstractTile {
|
||||
|
||||
private final TileWithUpdateStairs tile;
|
||||
private final Tile tile;
|
||||
private final AbstractMessage message;
|
||||
private final Rose skin;
|
||||
private final ISkinParam skinParam;
|
||||
@ -65,12 +65,13 @@ public class CommunicationTileNoteLeft extends AbstractTile implements TileWithU
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getYPoint(StringBounder stringBounder) {
|
||||
return tile.getYPoint(stringBounder);
|
||||
public double getContactPointRelative() {
|
||||
return tile.getContactPointRelative();
|
||||
}
|
||||
|
||||
public CommunicationTileNoteLeft(TileWithUpdateStairs tile, AbstractMessage message, Rose skin,
|
||||
ISkinParam skinParam, LivingSpace livingSpace, Note noteOnMessage) {
|
||||
public CommunicationTileNoteLeft(Tile tile, AbstractMessage message, Rose skin, ISkinParam skinParam,
|
||||
LivingSpace livingSpace, Note noteOnMessage) {
|
||||
super(((AbstractTile) tile).getStringBounder());
|
||||
this.tile = tile;
|
||||
this.message = message;
|
||||
this.skin = skin;
|
||||
@ -79,8 +80,9 @@ public class CommunicationTileNoteLeft extends AbstractTile implements TileWithU
|
||||
this.livingSpace = livingSpace;
|
||||
}
|
||||
|
||||
public void updateStairs(StringBounder stringBounder, double y) {
|
||||
tile.updateStairs(stringBounder, y);
|
||||
@Override
|
||||
public void callbackY_internal(double y) {
|
||||
tile.callbackY(y);
|
||||
}
|
||||
|
||||
private Component getComponent(StringBounder stringBounder) {
|
||||
@ -106,28 +108,22 @@ public class CommunicationTileNoteLeft extends AbstractTile implements TileWithU
|
||||
comp.drawU(ug.apply(UTranslate.dx(p.getCurrentValue())), area, (Context2D) ug);
|
||||
}
|
||||
|
||||
public double getPreferredHeight(StringBounder stringBounder) {
|
||||
final Component comp = getComponent(stringBounder);
|
||||
final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
||||
return Math.max(tile.getPreferredHeight(stringBounder), dim.getHeight());
|
||||
public double getPreferredHeight() {
|
||||
final Component comp = getComponent(getStringBounder());
|
||||
final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
|
||||
return Math.max(tile.getPreferredHeight(), dim.getHeight());
|
||||
}
|
||||
|
||||
public void addConstraints(StringBounder stringBounder) {
|
||||
tile.addConstraints(stringBounder);
|
||||
public void addConstraints() {
|
||||
tile.addConstraints();
|
||||
}
|
||||
|
||||
public Real getMinX(StringBounder stringBounder) {
|
||||
return getNotePosition(stringBounder);
|
||||
public Real getMinX() {
|
||||
return getNotePosition(getStringBounder());
|
||||
}
|
||||
|
||||
public Real getMaxX(StringBounder stringBounder) {
|
||||
return tile.getMaxX(stringBounder);
|
||||
}
|
||||
|
||||
public void callbackY(double y) {
|
||||
if (tile instanceof TileWithCallbackY) {
|
||||
((TileWithCallbackY) tile).callbackY(y);
|
||||
}
|
||||
public Real getMaxX() {
|
||||
return tile.getMaxX();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -51,9 +51,9 @@ import net.sourceforge.plantuml.skin.rose.Rose;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class CommunicationTileNoteRight extends AbstractTile implements TileWithUpdateStairs, TileWithCallbackY {
|
||||
public class CommunicationTileNoteRight extends AbstractTile {
|
||||
|
||||
private final TileWithUpdateStairs tile;
|
||||
private final Tile tile;
|
||||
private final AbstractMessage message;
|
||||
private final Rose skin;
|
||||
private final ISkinParam skinParam;
|
||||
@ -69,12 +69,13 @@ public class CommunicationTileNoteRight extends AbstractTile implements TileWith
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getYPoint(StringBounder stringBounder) {
|
||||
return tile.getYPoint(stringBounder);
|
||||
public double getContactPointRelative() {
|
||||
return tile.getContactPointRelative();
|
||||
}
|
||||
|
||||
public CommunicationTileNoteRight(TileWithUpdateStairs tile, AbstractMessage message, Rose skin,
|
||||
ISkinParam skinParam, LivingSpace livingSpace, Note noteOnMessage) {
|
||||
public CommunicationTileNoteRight(Tile tile, AbstractMessage message, Rose skin, ISkinParam skinParam,
|
||||
LivingSpace livingSpace, Note noteOnMessage) {
|
||||
super(((AbstractTile) tile).getStringBounder());
|
||||
this.tile = tile;
|
||||
this.message = message;
|
||||
this.skin = skin;
|
||||
@ -83,8 +84,9 @@ public class CommunicationTileNoteRight extends AbstractTile implements TileWith
|
||||
this.livingSpace = livingSpace;
|
||||
}
|
||||
|
||||
public void updateStairs(StringBounder stringBounder, double y) {
|
||||
tile.updateStairs(stringBounder, y);
|
||||
@Override
|
||||
public void callbackY_internal(double y) {
|
||||
tile.callbackY(y);
|
||||
}
|
||||
|
||||
private Component getComponent(StringBounder stringBounder) {
|
||||
@ -114,30 +116,24 @@ public class CommunicationTileNoteRight extends AbstractTile implements TileWith
|
||||
comp.drawU(ug.apply(UTranslate.dx(p.getCurrentValue())), area, (Context2D) ug);
|
||||
}
|
||||
|
||||
public double getPreferredHeight(StringBounder stringBounder) {
|
||||
final Component comp = getComponent(stringBounder);
|
||||
final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
||||
return Math.max(tile.getPreferredHeight(stringBounder), dim.getHeight());
|
||||
public double getPreferredHeight() {
|
||||
final Component comp = getComponent(getStringBounder());
|
||||
final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
|
||||
return Math.max(tile.getPreferredHeight(), dim.getHeight());
|
||||
}
|
||||
|
||||
public void addConstraints(StringBounder stringBounder) {
|
||||
tile.addConstraints(stringBounder);
|
||||
public void addConstraints() {
|
||||
tile.addConstraints();
|
||||
}
|
||||
|
||||
public Real getMinX(StringBounder stringBounder) {
|
||||
return tile.getMinX(stringBounder);
|
||||
public Real getMinX() {
|
||||
return tile.getMinX();
|
||||
}
|
||||
|
||||
public Real getMaxX(StringBounder stringBounder) {
|
||||
final Component comp = getComponent(stringBounder);
|
||||
final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
||||
return getNotePosition(stringBounder).addFixed(dim.getWidth());
|
||||
}
|
||||
|
||||
public void callbackY(double y) {
|
||||
if (tile instanceof TileWithCallbackY) {
|
||||
((TileWithCallbackY) tile).callbackY(y);
|
||||
}
|
||||
public Real getMaxX() {
|
||||
final Component comp = getComponent(getStringBounder());
|
||||
final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
|
||||
return getNotePosition(getStringBounder()).addFixed(dim.getWidth());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -55,9 +55,9 @@ import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
|
||||
public class CommunicationTileNoteTop extends AbstractTile implements TileWithUpdateStairs, TileWithCallbackY {
|
||||
public class CommunicationTileNoteTop extends AbstractTile {
|
||||
|
||||
private final TileWithUpdateStairs tile;
|
||||
private final Tile tile;
|
||||
private final AbstractMessage message;
|
||||
private final Rose skin;
|
||||
private final ISkinParam skinParam;
|
||||
@ -68,12 +68,13 @@ public class CommunicationTileNoteTop extends AbstractTile implements TileWithUp
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getYPoint(StringBounder stringBounder) {
|
||||
return tile.getYPoint(stringBounder);
|
||||
public double getContactPointRelative() {
|
||||
return tile.getContactPointRelative();
|
||||
}
|
||||
|
||||
public CommunicationTileNoteTop(TileWithUpdateStairs tile, AbstractMessage message, Rose skin,
|
||||
ISkinParam skinParam, Note noteOnMessage) {
|
||||
public CommunicationTileNoteTop(Tile tile, AbstractMessage message, Rose skin, ISkinParam skinParam,
|
||||
Note noteOnMessage) {
|
||||
super(((AbstractTile) tile).getStringBounder());
|
||||
this.tile = tile;
|
||||
this.message = message;
|
||||
this.skin = skin;
|
||||
@ -81,8 +82,9 @@ public class CommunicationTileNoteTop extends AbstractTile implements TileWithUp
|
||||
this.noteOnMessage = noteOnMessage;
|
||||
}
|
||||
|
||||
public void updateStairs(StringBounder stringBounder, double y) {
|
||||
tile.updateStairs(stringBounder, y);
|
||||
@Override
|
||||
public void callbackY_internal(double y) {
|
||||
tile.callbackY(y);
|
||||
}
|
||||
|
||||
private Component getComponent(StringBounder stringBounder) {
|
||||
@ -92,7 +94,7 @@ public class CommunicationTileNoteTop extends AbstractTile implements TileWithUp
|
||||
}
|
||||
|
||||
private Real getNotePosition(StringBounder stringBounder) {
|
||||
final Real minX = tile.getMinX(stringBounder);
|
||||
final Real minX = tile.getMinX();
|
||||
return minX;
|
||||
}
|
||||
|
||||
@ -104,14 +106,13 @@ public class CommunicationTileNoteTop extends AbstractTile implements TileWithUp
|
||||
|
||||
tile.drawU(ug.apply(UTranslate.dy(dim.getHeight() + spacey)));
|
||||
|
||||
final double middleMsg = (tile.getMinX(stringBounder).getCurrentValue() + tile.getMaxX(stringBounder)
|
||||
.getCurrentValue()) / 2;
|
||||
final double middleMsg = (tile.getMinX().getCurrentValue() + tile.getMaxX().getCurrentValue()) / 2;
|
||||
|
||||
final double xNote = getNotePosition(stringBounder).getCurrentValue();
|
||||
|
||||
comp.drawU(ug.apply(UTranslate.dx(xNote)), area, (Context2D) ug);
|
||||
|
||||
drawLine(ug, middleMsg, tile.getYPoint(stringBounder) + dim.getHeight() + spacey, xNote + dim.getWidth() / 2,
|
||||
drawLine(ug, middleMsg, tile.getContactPointRelative() + dim.getHeight() + spacey, xNote + dim.getWidth() / 2,
|
||||
dim.getHeight() - 2 * Rose.paddingY);
|
||||
|
||||
}
|
||||
@ -124,33 +125,26 @@ public class CommunicationTileNoteTop extends AbstractTile implements TileWithUp
|
||||
final double dx = x2 - x1;
|
||||
final double dy = y2 - y1;
|
||||
|
||||
ug.apply(new UTranslate(x1, y1)).apply(color).apply(new UStroke(2, 2, 1))
|
||||
.draw(new ULine(dx, dy));
|
||||
ug.apply(new UTranslate(x1, y1)).apply(color).apply(new UStroke(2, 2, 1)).draw(new ULine(dx, dy));
|
||||
|
||||
}
|
||||
|
||||
public double getPreferredHeight(StringBounder stringBounder) {
|
||||
final Component comp = getComponent(stringBounder);
|
||||
final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
||||
return tile.getPreferredHeight(stringBounder) + dim.getHeight() + spacey;
|
||||
public double getPreferredHeight() {
|
||||
final Component comp = getComponent(getStringBounder());
|
||||
final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
|
||||
return tile.getPreferredHeight() + dim.getHeight() + spacey;
|
||||
}
|
||||
|
||||
public void addConstraints(StringBounder stringBounder) {
|
||||
tile.addConstraints(stringBounder);
|
||||
public void addConstraints() {
|
||||
tile.addConstraints();
|
||||
}
|
||||
|
||||
public Real getMinX(StringBounder stringBounder) {
|
||||
return tile.getMinX(stringBounder);
|
||||
public Real getMinX() {
|
||||
return tile.getMinX();
|
||||
}
|
||||
|
||||
public Real getMaxX(StringBounder stringBounder) {
|
||||
return tile.getMaxX(stringBounder);
|
||||
}
|
||||
|
||||
public void callbackY(double y) {
|
||||
if (tile instanceof TileWithCallbackY) {
|
||||
((TileWithCallbackY) tile).callbackY(y);
|
||||
}
|
||||
public Real getMaxX() {
|
||||
return tile.getMaxX();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ import net.sourceforge.plantuml.skin.rose.Rose;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class CommunicationTileSelf extends AbstractTile implements TileWithUpdateStairs {
|
||||
public class CommunicationTileSelf extends AbstractTile {
|
||||
|
||||
private final LivingSpace livingSpace1;
|
||||
private final Message message;
|
||||
@ -67,12 +67,13 @@ public class CommunicationTileSelf extends AbstractTile implements TileWithUpdat
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getYPoint(StringBounder stringBounder) {
|
||||
return getComponent(stringBounder).getYPoint(stringBounder);
|
||||
public double getContactPointRelative() {
|
||||
return getComponent(getStringBounder()).getYPoint(getStringBounder());
|
||||
}
|
||||
|
||||
public CommunicationTileSelf(LivingSpace livingSpace1, Message message, Rose skin, ISkinParam skinParam,
|
||||
LivingSpaces livingSpaces) {
|
||||
public CommunicationTileSelf(StringBounder stringBounder, LivingSpace livingSpace1, Message message, Rose skin,
|
||||
ISkinParam skinParam, LivingSpaces livingSpaces) {
|
||||
super(stringBounder);
|
||||
this.livingSpace1 = livingSpace1;
|
||||
this.livingSpaces = livingSpaces;
|
||||
this.message = message;
|
||||
@ -98,11 +99,12 @@ public class CommunicationTileSelf extends AbstractTile implements TileWithUpdat
|
||||
return comp;
|
||||
}
|
||||
|
||||
public void updateStairs(StringBounder stringBounder, double y) {
|
||||
final ArrowComponent comp = getComponent(stringBounder);
|
||||
final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
||||
final Point2D p1 = comp.getStartPoint(stringBounder, dim);
|
||||
final Point2D p2 = comp.getEndPoint(stringBounder, dim);
|
||||
@Override
|
||||
public void callbackY_internal(double y) {
|
||||
final ArrowComponent comp = getComponent(getStringBounder());
|
||||
final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
|
||||
final Point2D p1 = comp.getStartPoint(getStringBounder(), dim);
|
||||
final Point2D p2 = comp.getEndPoint(getStringBounder(), dim);
|
||||
|
||||
if (message.isActivate()) {
|
||||
livingSpace1.addStepForLivebox(getEvent(), y + p2.getY());
|
||||
@ -139,20 +141,20 @@ public class CommunicationTileSelf extends AbstractTile implements TileWithUpdat
|
||||
comp.drawU(ug, area, (Context2D) ug);
|
||||
}
|
||||
|
||||
public double getPreferredHeight(StringBounder stringBounder) {
|
||||
final Component comp = getComponent(stringBounder);
|
||||
final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
||||
public double getPreferredHeight() {
|
||||
final Component comp = getComponent(getStringBounder());
|
||||
final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
|
||||
return dim.getHeight();
|
||||
}
|
||||
|
||||
public void addConstraints(StringBounder stringBounder) {
|
||||
public void addConstraints() {
|
||||
// final Component comp = getComponent(stringBounder);
|
||||
// final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
||||
// final double width = dim.getWidth();
|
||||
|
||||
final LivingSpace next = getNext();
|
||||
if (next != null) {
|
||||
next.getPosC(stringBounder).ensureBiggerThan(getMaxX(stringBounder));
|
||||
next.getPosC(getStringBounder()).ensureBiggerThan(getMaxX());
|
||||
}
|
||||
}
|
||||
|
||||
@ -174,15 +176,15 @@ public class CommunicationTileSelf extends AbstractTile implements TileWithUpdat
|
||||
return livingSpace1.getPosC(stringBounder);
|
||||
}
|
||||
|
||||
public Real getMinX(StringBounder stringBounder) {
|
||||
return getPoint1(stringBounder);
|
||||
public Real getMinX() {
|
||||
return getPoint1(getStringBounder());
|
||||
}
|
||||
|
||||
public Real getMaxX(StringBounder stringBounder) {
|
||||
final Component comp = getComponent(stringBounder);
|
||||
final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
||||
public Real getMaxX() {
|
||||
final Component comp = getComponent(getStringBounder());
|
||||
final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
|
||||
final double width = dim.getWidth();
|
||||
return livingSpace1.getPosC2(stringBounder).addFixed(width);
|
||||
return livingSpace1.getPosC2(getStringBounder()).addFixed(width);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ import net.sourceforge.plantuml.skin.rose.Rose;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class CommunicationTileSelfNoteRight extends AbstractTile implements TileWithUpdateStairs {
|
||||
public class CommunicationTileSelfNoteRight extends AbstractTile {
|
||||
|
||||
private final CommunicationTileSelf tile;
|
||||
private final Message message;
|
||||
@ -62,14 +62,15 @@ public class CommunicationTileSelfNoteRight extends AbstractTile implements Tile
|
||||
public Event getEvent() {
|
||||
return message;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public double getYPoint(StringBounder stringBounder) {
|
||||
return tile.getYPoint(stringBounder);
|
||||
public double getContactPointRelative() {
|
||||
return tile.getContactPointRelative();
|
||||
}
|
||||
|
||||
public CommunicationTileSelfNoteRight(CommunicationTileSelf tile, Message message, Rose skin, ISkinParam skinParam,
|
||||
Note noteOnMessage) {
|
||||
super(((AbstractTile) tile).getStringBounder());
|
||||
this.tile = tile;
|
||||
this.message = message;
|
||||
this.skin = skin;
|
||||
@ -77,18 +78,19 @@ public class CommunicationTileSelfNoteRight extends AbstractTile implements Tile
|
||||
this.noteOnMessage = noteOnMessage;
|
||||
}
|
||||
|
||||
public void updateStairs(StringBounder stringBounder, double y) {
|
||||
tile.updateStairs(stringBounder, y);
|
||||
@Override
|
||||
public void callbackY_internal(double y) {
|
||||
tile.callbackY(y);
|
||||
}
|
||||
|
||||
private Component getComponent(StringBounder stringBounder) {
|
||||
final Component comp = skin.createComponent(null, ComponentType.NOTE,
|
||||
null, noteOnMessage.getSkinParamBackcolored(skinParam), noteOnMessage.getStrings());
|
||||
final Component comp = skin.createComponent(null, ComponentType.NOTE, null,
|
||||
noteOnMessage.getSkinParamBackcolored(skinParam), noteOnMessage.getStrings());
|
||||
return comp;
|
||||
}
|
||||
|
||||
private Real getNotePosition(StringBounder stringBounder) {
|
||||
return tile.getMaxX(stringBounder);
|
||||
return tile.getMaxX();
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
@ -102,24 +104,24 @@ public class CommunicationTileSelfNoteRight extends AbstractTile implements Tile
|
||||
comp.drawU(ug.apply(UTranslate.dx(p.getCurrentValue())), area, (Context2D) ug);
|
||||
}
|
||||
|
||||
public double getPreferredHeight(StringBounder stringBounder) {
|
||||
final Component comp = getComponent(stringBounder);
|
||||
final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
||||
return Math.max(tile.getPreferredHeight(stringBounder), dim.getHeight());
|
||||
public double getPreferredHeight() {
|
||||
final Component comp = getComponent(getStringBounder());
|
||||
final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
|
||||
return Math.max(tile.getPreferredHeight(), dim.getHeight());
|
||||
}
|
||||
|
||||
public void addConstraints(StringBounder stringBounder) {
|
||||
tile.addConstraints(stringBounder);
|
||||
public void addConstraints() {
|
||||
tile.addConstraints();
|
||||
}
|
||||
|
||||
public Real getMinX(StringBounder stringBounder) {
|
||||
return tile.getMinX(stringBounder);
|
||||
public Real getMinX() {
|
||||
return tile.getMinX();
|
||||
}
|
||||
|
||||
public Real getMaxX(StringBounder stringBounder) {
|
||||
final Component comp = getComponent(stringBounder);
|
||||
final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
||||
return getNotePosition(stringBounder).addFixed(dim.getWidth());
|
||||
public Real getMaxX() {
|
||||
final Component comp = getComponent(getStringBounder());
|
||||
final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
|
||||
return getNotePosition(getStringBounder()).addFixed(dim.getWidth());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ import net.sourceforge.plantuml.skin.Context2D;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class DelayTile extends AbstractTile implements Tile, TileWithCallbackY {
|
||||
public class DelayTile extends AbstractTile implements Tile {
|
||||
|
||||
private final Delay delay;
|
||||
private final TileArguments tileArguments;
|
||||
@ -62,11 +62,13 @@ public class DelayTile extends AbstractTile implements Tile, TileWithCallbackY {
|
||||
return delay;
|
||||
}
|
||||
|
||||
public void callbackY(double y) {
|
||||
@Override
|
||||
public void callbackY_internal(double y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public DelayTile(Delay delay, TileArguments tileArguments) {
|
||||
super(tileArguments.getStringBounder());
|
||||
this.delay = delay;
|
||||
this.tileArguments = tileArguments;
|
||||
}
|
||||
@ -102,27 +104,27 @@ public class DelayTile extends AbstractTile implements Tile, TileWithCallbackY {
|
||||
final Area area = new Area(getPreferredWidth(stringBounder), dim.getHeight());
|
||||
tileArguments.getLivingSpaces().delayOn(y, dim.getHeight());
|
||||
|
||||
ug = ug.apply(UTranslate.dx(getMinX(stringBounder).getCurrentValue()));
|
||||
ug = ug.apply(UTranslate.dx(getMinX().getCurrentValue()));
|
||||
comp.drawU(ug, area, (Context2D) ug);
|
||||
}
|
||||
|
||||
public double getPreferredHeight(StringBounder stringBounder) {
|
||||
final Component comp = getComponent(stringBounder);
|
||||
final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
||||
public double getPreferredHeight() {
|
||||
final Component comp = getComponent(getStringBounder());
|
||||
final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
|
||||
return dim.getHeight();
|
||||
}
|
||||
|
||||
public void addConstraints(StringBounder stringBounder) {
|
||||
public void addConstraints() {
|
||||
}
|
||||
|
||||
public Real getMinX(StringBounder stringBounder) {
|
||||
init(stringBounder);
|
||||
return this.middle.addFixed(-getPreferredWidth(stringBounder) / 2);
|
||||
public Real getMinX() {
|
||||
init(getStringBounder());
|
||||
return this.middle.addFixed(-getPreferredWidth(getStringBounder()) / 2);
|
||||
}
|
||||
|
||||
public Real getMaxX(StringBounder stringBounder) {
|
||||
init(stringBounder);
|
||||
return this.middle.addFixed(getPreferredWidth(stringBounder) / 2);
|
||||
public Real getMaxX() {
|
||||
init(getStringBounder());
|
||||
return this.middle.addFixed(getPreferredWidth(getStringBounder()) / 2);
|
||||
}
|
||||
|
||||
// private double startingY;
|
||||
|
@ -63,6 +63,7 @@ public class DividerTile extends AbstractTile implements Tile {
|
||||
}
|
||||
|
||||
public DividerTile(Divider divider, TileArguments tileArguments) {
|
||||
super(tileArguments.getStringBounder());
|
||||
this.tileArguments = tileArguments;
|
||||
this.divider = divider;
|
||||
this.skin = tileArguments.getSkin();
|
||||
@ -87,25 +88,25 @@ public class DividerTile extends AbstractTile implements Tile {
|
||||
comp.drawU(ug, area, (Context2D) ug);
|
||||
}
|
||||
|
||||
public double getPreferredHeight(StringBounder stringBounder) {
|
||||
final Component comp = getComponent(stringBounder);
|
||||
final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
||||
public double getPreferredHeight() {
|
||||
final Component comp = getComponent(getStringBounder());
|
||||
final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
|
||||
return dim.getHeight();
|
||||
}
|
||||
|
||||
public void addConstraints(StringBounder stringBounder) {
|
||||
public void addConstraints() {
|
||||
// final Component comp = getComponent(stringBounder);
|
||||
// final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
||||
// final double width = dim.getWidth();
|
||||
}
|
||||
|
||||
public Real getMinX(StringBounder stringBounder) {
|
||||
public Real getMinX() {
|
||||
return origin;
|
||||
}
|
||||
|
||||
public Real getMaxX(StringBounder stringBounder) {
|
||||
final Component comp = getComponent(stringBounder);
|
||||
final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
||||
public Real getMaxX() {
|
||||
final Component comp = getComponent(getStringBounder());
|
||||
final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
|
||||
return origin.addFixed(dim.getWidth());
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ import net.sourceforge.plantuml.skin.ComponentType;
|
||||
import net.sourceforge.plantuml.skin.rose.Rose;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
|
||||
public class ElseTile extends AbstractTile implements TileWithCallbackY {
|
||||
public class ElseTile extends AbstractTile {
|
||||
|
||||
private final Rose skin;
|
||||
private final ISkinParam skinParam;
|
||||
@ -61,11 +61,12 @@ public class ElseTile extends AbstractTile implements TileWithCallbackY {
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getYPoint(StringBounder stringBounder) {
|
||||
public double getContactPointRelative() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public ElseTile(GroupingLeaf anElse, Rose skin, ISkinParam skinParam, Tile parent) {
|
||||
super(((AbstractTile) parent).getStringBounder());
|
||||
this.anElse = anElse;
|
||||
this.skin = skin;
|
||||
this.skinParam = skinParam;
|
||||
@ -96,14 +97,15 @@ public class ElseTile extends AbstractTile implements TileWithCallbackY {
|
||||
// // final double totalParentHeight = parent.getPreferredHeight(stringBounder);
|
||||
// // height = totalParentHeight - (startingY - y);
|
||||
// // }
|
||||
// final Area area = new Area(max.getCurrentValue() - min.getCurrentValue(), height);
|
||||
// final Area area = new Area(max.getCurrentValue() - min.getCurrentValue(),
|
||||
// height);
|
||||
// ug = ug.apply(new UTranslate(min.getCurrentValue(), 0));
|
||||
// comp.drawU(ug, area, context);
|
||||
}
|
||||
|
||||
public double getPreferredHeight(StringBounder stringBounder) {
|
||||
final Component comp = getComponent(stringBounder);
|
||||
final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
||||
public double getPreferredHeight() {
|
||||
final Component comp = getComponent(getStringBounder());
|
||||
final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
|
||||
|
||||
double height = dim.getHeight();
|
||||
if (anElse.getComment() != null) {
|
||||
@ -112,25 +114,26 @@ public class ElseTile extends AbstractTile implements TileWithCallbackY {
|
||||
return height;
|
||||
}
|
||||
|
||||
public void addConstraints(StringBounder stringBounder) {
|
||||
public void addConstraints() {
|
||||
// final Component comp = getComponent(stringBounder);
|
||||
// final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
||||
// final double width = dim.getWidth();
|
||||
}
|
||||
|
||||
public Real getMinX(StringBounder stringBounder) {
|
||||
return parent.getMinX(stringBounder);
|
||||
public Real getMinX() {
|
||||
return parent.getMinX();
|
||||
}
|
||||
|
||||
public Real getMaxX(StringBounder stringBounder) {
|
||||
final Component comp = getComponent(stringBounder);
|
||||
final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
||||
return getMinX(stringBounder).addFixed(dim.getWidth());
|
||||
public Real getMaxX() {
|
||||
final Component comp = getComponent(getStringBounder());
|
||||
final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
|
||||
return getMinX().addFixed(dim.getWidth());
|
||||
}
|
||||
|
||||
private double y;
|
||||
|
||||
public void callbackY(double y) {
|
||||
@Override
|
||||
public void callbackY_internal(double y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,6 @@
|
||||
package net.sourceforge.plantuml.sequencediagram.teoz;
|
||||
|
||||
import net.sourceforge.plantuml.Url;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.real.Real;
|
||||
import net.sourceforge.plantuml.sequencediagram.Event;
|
||||
import net.sourceforge.plantuml.sequencediagram.Participant;
|
||||
@ -48,6 +47,7 @@ public class EmptyTile extends AbstractTile implements Tile {
|
||||
private final Tile position;
|
||||
|
||||
public EmptyTile(double height, Tile position) {
|
||||
super(((AbstractTile) position).getStringBounder());
|
||||
this.height = height;
|
||||
this.position = position;
|
||||
}
|
||||
@ -55,19 +55,19 @@ public class EmptyTile extends AbstractTile implements Tile {
|
||||
public void drawU(UGraphic ug) {
|
||||
}
|
||||
|
||||
public double getPreferredHeight(StringBounder stringBounder) {
|
||||
public double getPreferredHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public void addConstraints(StringBounder stringBounder) {
|
||||
public void addConstraints() {
|
||||
}
|
||||
|
||||
public Real getMinX(StringBounder stringBounder) {
|
||||
return position.getMinX(stringBounder);
|
||||
public Real getMinX() {
|
||||
return position.getMinX();
|
||||
}
|
||||
|
||||
public Real getMaxX(StringBounder stringBounder) {
|
||||
return position.getMaxX(stringBounder);
|
||||
public Real getMaxX() {
|
||||
return position.getMaxX();
|
||||
}
|
||||
|
||||
public Event getEvent() {
|
||||
|
@ -64,8 +64,8 @@ public class Englobers {
|
||||
pending.add(p);
|
||||
continue;
|
||||
}
|
||||
pending = Englober.createTeoz(englober, p, tileArguments, tileArguments.getSkinParam()
|
||||
.getCurrentStyleBuilder());
|
||||
pending = Englober.createTeoz(englober, p, tileArguments,
|
||||
tileArguments.getSkinParam().getCurrentStyleBuilder());
|
||||
englobers.add(pending);
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,8 @@ public class EventsHistory {
|
||||
|
||||
public int getLevelAt(Event event, EventsHistoryMode mode) {
|
||||
final int result = getLevelAtInternal(event, mode);
|
||||
// System.err.println("EventsHistory::getLevelAt " + mode + " " + result + " " + event);
|
||||
// System.err.println("EventsHistory::getLevelAt " + mode + " " + result + " " +
|
||||
// event);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -181,7 +182,8 @@ public class EventsHistory {
|
||||
int value = 0;
|
||||
for (Event event : events) {
|
||||
final Double position = ys3.get(event);
|
||||
// System.err.println("EventsHistory::getStairs event=" + event + " position=" + position);
|
||||
// System.err.println("EventsHistory::getStairs event=" + event + " position=" +
|
||||
// position);
|
||||
if (position != null) {
|
||||
assert position <= totalHeight : "position=" + position + " totalHeight=" + totalHeight;
|
||||
value = getLevelAt(event, EventsHistoryMode.CONSIDERE_FUTURE_DEACTIVATE);
|
||||
@ -190,7 +192,8 @@ public class EventsHistory {
|
||||
activateColor);
|
||||
}
|
||||
}
|
||||
// System.err.println("EventsHistory::getStairs finishing totalHeight=" + totalHeight);
|
||||
// System.err.println("EventsHistory::getStairs finishing totalHeight=" +
|
||||
// totalHeight);
|
||||
result.addStep(new StairsPosition(totalHeight, false), value, null);
|
||||
// System.err.println("EventsHistory::getStairs " + p + " result=" + result);
|
||||
return result;
|
||||
|
@ -59,12 +59,13 @@ import net.sourceforge.plantuml.skin.rose.Rose;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class GroupingTile extends AbstractTile implements TileWithCallbackY {
|
||||
public class GroupingTile extends AbstractTile {
|
||||
|
||||
private static final int EXTERNAL_MARGINX1 = 3;
|
||||
private static final int EXTERNAL_MARGINX2 = 9;
|
||||
private static final int MARGINX = 16;
|
||||
private static final int MARGINY = 10;
|
||||
// private static final int MARGINY = 10;
|
||||
private static final int MARGINY_MAGIC = 20;
|
||||
private List<Tile> tiles = new ArrayList<Tile>();
|
||||
private final Real min;
|
||||
private final Real max;
|
||||
@ -83,24 +84,27 @@ public class GroupingTile extends AbstractTile implements TileWithCallbackY {
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getYPoint(StringBounder stringBounder) {
|
||||
public double getContactPointRelative() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public GroupingTile(Iterator<Event> it, GroupingStart start, TileArguments tileArgumentsBachColorChanged,
|
||||
public GroupingTile(Iterator<Event> it, GroupingStart start, TileArguments tileArgumentsBackColorChanged,
|
||||
TileArguments tileArgumentsOriginal) {
|
||||
super(tileArgumentsBackColorChanged.getStringBounder());
|
||||
final StringBounder stringBounder = tileArgumentsOriginal.getStringBounder();
|
||||
this.start = start;
|
||||
this.display = start.getTitle().equals("group") ? Display.create(start.getComment())
|
||||
: Display.create(start.getTitle(), start.getComment());
|
||||
this.skin = tileArgumentsOriginal.getSkin();
|
||||
// this.skinParam = tileArgumentsOriginal.getSkinParam();
|
||||
this.skinParam = tileArgumentsBachColorChanged.getSkinParam();
|
||||
this.skinParam = tileArgumentsBackColorChanged.getSkinParam();
|
||||
|
||||
final List<Real> min2 = new ArrayList<Real>();
|
||||
final List<Real> max2 = new ArrayList<Real>();
|
||||
|
||||
final List<Tile> allElses = new ArrayList<Tile>();
|
||||
final Dimension2D dim1 = getPreferredDimensionIfEmpty(stringBounder);
|
||||
|
||||
while (it.hasNext()) {
|
||||
final Event ev = it.next();
|
||||
if (ev instanceof GroupingLeaf && ((Grouping) ev).getType() == GroupingType.END) {
|
||||
@ -110,31 +114,31 @@ public class GroupingTile extends AbstractTile implements TileWithCallbackY {
|
||||
tiles.add(tile);
|
||||
}
|
||||
}
|
||||
tiles = mergeParallel(tiles);
|
||||
|
||||
tiles = mergeParallel(getStringBounder(), tiles);
|
||||
|
||||
for (Tile tile : tiles) {
|
||||
bodyHeight += tile.getPreferredHeight(stringBounder);
|
||||
bodyHeight += tile.getPreferredHeight();
|
||||
final Event ev = tile.getEvent();
|
||||
if (ev instanceof GroupingLeaf && ((Grouping) ev).getType() == GroupingType.ELSE) {
|
||||
allElses.add(tile);
|
||||
continue;
|
||||
}
|
||||
min2.add(tile.getMinX(stringBounder).addFixed(-MARGINX));
|
||||
final Real m = tile.getMaxX(stringBounder);
|
||||
min2.add(tile.getMinX().addFixed(-MARGINX));
|
||||
final Real m = tile.getMaxX();
|
||||
// max2.add(m == tileArgumentsOriginal.getOmega() ? m : m.addFixed(MARGINX));
|
||||
max2.add(m.addFixed(MARGINX));
|
||||
}
|
||||
final Dimension2D dim1 = getPreferredDimensionIfEmpty(stringBounder);
|
||||
final double width = dim1.getWidth();
|
||||
if (min2.size() == 0) {
|
||||
min2.add(tileArgumentsOriginal.getOrigin());
|
||||
}
|
||||
this.min = RealUtils.min(min2);
|
||||
for (Tile anElse : allElses) {
|
||||
max2.add(anElse.getMaxX(stringBounder));
|
||||
max2.add(anElse.getMaxX());
|
||||
}
|
||||
max2.add(this.min.addFixed(width + 16));
|
||||
this.max = RealUtils.max(max2);
|
||||
|
||||
}
|
||||
|
||||
private Component getComponent(StringBounder stringBounder) {
|
||||
@ -154,36 +158,31 @@ public class GroupingTile extends AbstractTile implements TileWithCallbackY {
|
||||
final Dimension2D dim1 = getPreferredDimensionIfEmpty(stringBounder);
|
||||
final Area area = new Area(max.getCurrentValue() - min.getCurrentValue(), getTotalHeight(stringBounder));
|
||||
|
||||
if (ug instanceof LiveBoxFinder == false) {
|
||||
comp.drawU(ug.apply(UTranslate.dx(min.getCurrentValue())), area, (Context2D) ug);
|
||||
drawAllElses(ug);
|
||||
}
|
||||
// ug.apply(UChangeBackColor.nnn(HtmlColorUtils.LIGHT_GRAY)).draw(new
|
||||
// URectangle(area.getDimensionToUse()));
|
||||
comp.drawU(ug.apply(UTranslate.dx(min.getCurrentValue())), area, (Context2D) ug);
|
||||
drawAllElses(ug);
|
||||
|
||||
double h = dim1.getHeight() + MARGINY / 2;
|
||||
double h = dim1.getHeight() + MARGINY_MAGIC / 2;
|
||||
for (Tile tile : tiles) {
|
||||
ug.apply(UTranslate.dy(h)).draw(tile);
|
||||
final double preferredHeight = tile.getPreferredHeight(stringBounder);
|
||||
tile.drawU(ug.apply(UTranslate.dy(h)));
|
||||
final double preferredHeight = tile.getPreferredHeight();
|
||||
h += preferredHeight;
|
||||
}
|
||||
}
|
||||
|
||||
private double getTotalHeight(StringBounder stringBounder) {
|
||||
final Dimension2D dimIfEmpty = getPreferredDimensionIfEmpty(stringBounder);
|
||||
return bodyHeight + dimIfEmpty.getHeight() + MARGINY / 2;
|
||||
return bodyHeight + dimIfEmpty.getHeight() + MARGINY_MAGIC / 2;
|
||||
}
|
||||
|
||||
private void drawAllElses(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final double totalHeight = getTotalHeight(stringBounder);
|
||||
// final double suppHeight =
|
||||
// getPreferredDimensionIfEmpty(stringBounder).getHeight() + MARGINY / 2;
|
||||
|
||||
final List<Double> ys = new ArrayList<Double>();
|
||||
for (Tile tile : tiles) {
|
||||
if (tile instanceof ElseTile) {
|
||||
final ElseTile elseTile = (ElseTile) tile;
|
||||
ys.add(elseTile.getCallbackY() - y + MARGINY / 2/* suppHeight */);
|
||||
ys.add(elseTile.getCallbackY() - y + MARGINY_MAGIC / 2);
|
||||
}
|
||||
}
|
||||
ys.add(totalHeight);
|
||||
@ -199,34 +198,35 @@ public class GroupingTile extends AbstractTile implements TileWithCallbackY {
|
||||
}
|
||||
}
|
||||
|
||||
public double getPreferredHeight(StringBounder stringBounder) {
|
||||
final Dimension2D dim1 = getPreferredDimensionIfEmpty(stringBounder);
|
||||
return dim1.getHeight() + bodyHeight + MARGINY;
|
||||
public double getPreferredHeight() {
|
||||
final Dimension2D dim1 = getPreferredDimensionIfEmpty(getStringBounder());
|
||||
return dim1.getHeight() + bodyHeight + MARGINY_MAGIC;
|
||||
}
|
||||
|
||||
public void addConstraints(StringBounder stringBounder) {
|
||||
public void addConstraints() {
|
||||
for (Tile tile : tiles) {
|
||||
tile.addConstraints(stringBounder);
|
||||
tile.addConstraints();
|
||||
}
|
||||
}
|
||||
|
||||
public Real getMinX(StringBounder stringBounder) {
|
||||
public Real getMinX() {
|
||||
return min.addFixed(-EXTERNAL_MARGINX1);
|
||||
}
|
||||
|
||||
public Real getMaxX(StringBounder stringBounder) {
|
||||
public Real getMaxX() {
|
||||
return max.addFixed(EXTERNAL_MARGINX2);
|
||||
}
|
||||
|
||||
private double y;
|
||||
|
||||
public void callbackY(double y) {
|
||||
@Override
|
||||
public void callbackY_internal(double y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public static double fillPositionelTiles(StringBounder stringBounder, double y, List<Tile> tiles,
|
||||
final List<YPositionedTile> local, List<YPositionedTile> full) {
|
||||
for (Tile tile : mergeParallel(tiles)) {
|
||||
for (Tile tile : mergeParallel(stringBounder, tiles)) {
|
||||
final YPositionedTile ytile = new YPositionedTile(tile, y);
|
||||
local.add(ytile);
|
||||
full.add(ytile);
|
||||
@ -236,7 +236,7 @@ public class GroupingTile extends AbstractTile implements TileWithCallbackY {
|
||||
final ArrayList<YPositionedTile> local2 = new ArrayList<YPositionedTile>();
|
||||
fillPositionelTiles(stringBounder, y + headerHeight, groupingTile.tiles, local2, full);
|
||||
}
|
||||
y += tile.getPreferredHeight(stringBounder);
|
||||
y += tile.getPreferredHeight();
|
||||
}
|
||||
return y;
|
||||
|
||||
@ -246,14 +246,14 @@ public class GroupingTile extends AbstractTile implements TileWithCallbackY {
|
||||
return getPreferredDimensionIfEmpty(stringBounder).getHeight() + 10;
|
||||
}
|
||||
|
||||
private static List<Tile> mergeParallel(List<Tile> tiles) {
|
||||
private static List<Tile> mergeParallel(StringBounder stringBounder, List<Tile> tiles) {
|
||||
TileParallel pending = null;
|
||||
tiles = removeEmptyCloseToParallel(tiles);
|
||||
final List<Tile> result = new ArrayList<Tile>();
|
||||
for (Tile tile : tiles) {
|
||||
if (isParallel(tile)) {
|
||||
if (pending == null) {
|
||||
pending = new TileParallel();
|
||||
pending = new TileParallel(stringBounder);
|
||||
final Tile tmp = result.get(result.size() - 1);
|
||||
if (tmp instanceof LifeEventTile) {
|
||||
pending.add(result.get(result.size() - 2));
|
||||
@ -293,7 +293,7 @@ public class GroupingTile extends AbstractTile implements TileWithCallbackY {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isParallel(Tile tile) {
|
||||
public static boolean isParallel(Tile tile) {
|
||||
return tile instanceof TileParallel == false && tile.getEvent().isParallel();
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,6 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.teoz;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.real.Real;
|
||||
import net.sourceforge.plantuml.sequencediagram.Event;
|
||||
import net.sourceforge.plantuml.sequencediagram.HSpace;
|
||||
@ -51,6 +50,7 @@ public class HSpaceTile extends AbstractTile implements Tile {
|
||||
}
|
||||
|
||||
public HSpaceTile(HSpace hspace, TileArguments tileArguments) {
|
||||
super(tileArguments.getStringBounder());
|
||||
this.hspace = hspace;
|
||||
this.origin = tileArguments.getOrigin();
|
||||
}
|
||||
@ -58,18 +58,18 @@ public class HSpaceTile extends AbstractTile implements Tile {
|
||||
public void drawU(UGraphic ug) {
|
||||
}
|
||||
|
||||
public double getPreferredHeight(StringBounder stringBounder) {
|
||||
public double getPreferredHeight() {
|
||||
return hspace.getPixel();
|
||||
}
|
||||
|
||||
public void addConstraints(StringBounder stringBounder) {
|
||||
public void addConstraints() {
|
||||
}
|
||||
|
||||
public Real getMinX(StringBounder stringBounder) {
|
||||
public Real getMinX() {
|
||||
return origin;
|
||||
}
|
||||
|
||||
public Real getMaxX(StringBounder stringBounder) {
|
||||
public Real getMaxX() {
|
||||
return origin.addFixed(10);
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,6 @@ package net.sourceforge.plantuml.sequencediagram.teoz;
|
||||
import java.awt.geom.Dimension2D;
|
||||
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.real.Real;
|
||||
import net.sourceforge.plantuml.real.RealUtils;
|
||||
import net.sourceforge.plantuml.sequencediagram.Event;
|
||||
@ -51,7 +50,7 @@ import net.sourceforge.plantuml.skin.rose.Rose;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class LifeEventTile extends AbstractTile implements TileWithUpdateStairs {
|
||||
public class LifeEventTile extends AbstractTile {
|
||||
|
||||
private final LifeEvent lifeEvent;
|
||||
private final TileArguments tileArguments;
|
||||
@ -59,22 +58,25 @@ public class LifeEventTile extends AbstractTile implements TileWithUpdateStairs
|
||||
private final Rose skin;
|
||||
private final ISkinParam skinParam;
|
||||
|
||||
public void updateStairs(StringBounder stringBounder, double y) {
|
||||
// System.err.println("LifeEventTile::updateStairs " + lifeEvent + " " + livingSpace.getParticipant() + " y=" + y);
|
||||
@Override
|
||||
public void callbackY_internal(double y) {
|
||||
// System.err.println("LifeEventTile::updateStairs " + lifeEvent + " " +
|
||||
// livingSpace.getParticipant() + " y=" + y);
|
||||
livingSpace.addStepForLivebox(getEvent(), y);
|
||||
}
|
||||
|
||||
public Event getEvent() {
|
||||
return lifeEvent;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public double getYPoint(StringBounder stringBounder) {
|
||||
public double getContactPointRelative() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public LifeEventTile(LifeEvent lifeEvent, TileArguments tileArguments, LivingSpace livingSpace, Rose skin,
|
||||
ISkinParam skinParam) {
|
||||
super(tileArguments.getStringBounder());
|
||||
this.lifeEvent = lifeEvent;
|
||||
this.tileArguments = tileArguments;
|
||||
this.livingSpace = livingSpace;
|
||||
@ -95,29 +97,30 @@ public class LifeEventTile extends AbstractTile implements TileWithUpdateStairs
|
||||
return lifeEvent.getMessage() == null && lifeEvent.getType() == LifeEventType.DESTROY;
|
||||
}
|
||||
|
||||
public double getPreferredHeight(StringBounder stringBounder) {
|
||||
public double getPreferredHeight() {
|
||||
// if (lifeEvent.isActivate()) {
|
||||
// return 20;
|
||||
// }
|
||||
if (isDestroyWithoutMessage()) {
|
||||
final Component cross = skin.createComponent(null, ComponentType.DESTROY, null, skinParam, null);
|
||||
final Dimension2D dimCross = cross.getPreferredDimension(stringBounder);
|
||||
final Dimension2D dimCross = cross.getPreferredDimension(getStringBounder());
|
||||
return dimCross.getHeight();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void addConstraints(StringBounder stringBounder) {
|
||||
public void addConstraints() {
|
||||
}
|
||||
|
||||
public Real getMinX(StringBounder stringBounder) {
|
||||
public Real getMinX() {
|
||||
// return tileArguments.getLivingSpace(lifeEvent.getParticipant()).getPosB();
|
||||
return livingSpace.getPosB();
|
||||
}
|
||||
|
||||
public Real getMaxX(StringBounder stringBounder) {
|
||||
// final LivingSpace livingSpace2 = tileArguments.getLivingSpace(lifeEvent.getParticipant());
|
||||
return RealUtils.max(livingSpace.getPosD(stringBounder), livingSpace.getPosC2(stringBounder));
|
||||
public Real getMaxX() {
|
||||
// final LivingSpace livingSpace2 =
|
||||
// tileArguments.getLivingSpace(lifeEvent.getParticipant());
|
||||
return RealUtils.max(livingSpace.getPosD(getStringBounder()), livingSpace.getPosC2(getStringBounder()));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,127 +0,0 @@
|
||||
/* ========================================================================
|
||||
* 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.sequencediagram.teoz;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.ugraphic.UBackground;
|
||||
import net.sourceforge.plantuml.ugraphic.UChange;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphicNo;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.UParamNull;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
|
||||
public class LiveBoxFinder extends UGraphicNo implements UGraphic {
|
||||
|
||||
public boolean matchesProperty(String propertyName) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public double dpiFactor() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public UGraphic apply(UChange change) {
|
||||
if (change instanceof UTranslate) {
|
||||
return new LiveBoxFinder(stringBounder, translate.compose((UTranslate) change));
|
||||
} else if (change instanceof UStroke) {
|
||||
return new LiveBoxFinder(this);
|
||||
} else if (change instanceof UBackground) {
|
||||
return new LiveBoxFinder(this);
|
||||
} else if (change instanceof HColor) {
|
||||
return new LiveBoxFinder(this);
|
||||
}
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
private final StringBounder stringBounder;
|
||||
private final UTranslate translate;
|
||||
|
||||
public LiveBoxFinder(StringBounder stringBounder) {
|
||||
this(stringBounder, new UTranslate());
|
||||
}
|
||||
|
||||
private LiveBoxFinder(StringBounder stringBounder, UTranslate translate) {
|
||||
this.stringBounder = stringBounder;
|
||||
this.translate = translate;
|
||||
}
|
||||
|
||||
private LiveBoxFinder(LiveBoxFinder other) {
|
||||
this(other.stringBounder, other.translate);
|
||||
}
|
||||
|
||||
public StringBounder getStringBounder() {
|
||||
return stringBounder;
|
||||
}
|
||||
|
||||
public UParam getParam() {
|
||||
return new UParamNull();
|
||||
}
|
||||
|
||||
public void draw(UShape shape) {
|
||||
final double x = translate.getDx();
|
||||
final double y = translate.getDy();
|
||||
if (shape instanceof GroupingTile) {
|
||||
((GroupingTile) shape).drawU(this);
|
||||
} else if (shape instanceof TileWithUpdateStairs) {
|
||||
((TileWithUpdateStairs) shape).updateStairs(stringBounder, y);
|
||||
// } else if (shape instanceof EmptyTile) {
|
||||
// // Nothing ?
|
||||
// } else if (shape instanceof TileParallel) {
|
||||
// // Nothing ?
|
||||
// } else if (shape instanceof NotesTile) {
|
||||
// // Nothing ?
|
||||
// } else if (shape instanceof Tile) {
|
||||
// Log.info("OtherTile " + shape);
|
||||
} else {
|
||||
// Nothing ?
|
||||
// throw new UnsupportedOperationException(shape.getClass().getName());
|
||||
}
|
||||
}
|
||||
|
||||
public ColorMapper getColorMapper() {
|
||||
return new ColorMapperIdentity();
|
||||
}
|
||||
|
||||
public void flushUg() {
|
||||
}
|
||||
|
||||
}
|
@ -68,10 +68,13 @@ public class LiveBoxesDrawer {
|
||||
private final Collection<Segment> delays;
|
||||
|
||||
public LiveBoxesDrawer(Context2D context, Rose skin, ISkinParam skinParam, Map<Double, Double> delays) {
|
||||
this.cross = skin.createComponent(new Style[] { ComponentType.DESTROY.getDefaultStyleDefinition()
|
||||
.getMergedStyle(skinParam.getCurrentStyleBuilder()) }, ComponentType.DESTROY, null, skinParam, null);
|
||||
this.compForWidth = skin.createComponent(new Style[] { ComponentType.ALIVE_BOX_CLOSE_CLOSE
|
||||
.getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder()) },
|
||||
this.cross = skin.createComponent(
|
||||
new Style[] { ComponentType.DESTROY.getDefaultStyleDefinition()
|
||||
.getMergedStyle(skinParam.getCurrentStyleBuilder()) },
|
||||
ComponentType.DESTROY, null, skinParam, null);
|
||||
this.compForWidth = skin.createComponent(
|
||||
new Style[] { ComponentType.ALIVE_BOX_CLOSE_CLOSE.getDefaultStyleDefinition()
|
||||
.getMergedStyle(skinParam.getCurrentStyleBuilder()) },
|
||||
ComponentType.ALIVE_BOX_CLOSE_CLOSE, null, skinParam, null);
|
||||
this.context = context;
|
||||
this.skin = skin;
|
||||
@ -121,8 +124,8 @@ public class LiveBoxesDrawer {
|
||||
private void drawInternal(UGraphic ug, StairsPosition yposition, double ya, double yb, ComponentType type) {
|
||||
final double width = getWidth(ug.getStringBounder());
|
||||
final Area area = new Area(width, yb - ya);
|
||||
ISkinParam skinParam2 = new SkinParamBackcolored(skinParam, symbolContext == null ? null
|
||||
: symbolContext.getBackColor());
|
||||
ISkinParam skinParam2 = new SkinParamBackcolored(skinParam,
|
||||
symbolContext == null ? null : symbolContext.getBackColor());
|
||||
Style style = type.getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder());
|
||||
if (style != null) {
|
||||
style = style.eventuallyOverride(symbolContext);
|
||||
|
@ -35,23 +35,23 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.teoz;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.real.Real;
|
||||
import net.sourceforge.plantuml.sequencediagram.Event;
|
||||
import net.sourceforge.plantuml.sequencediagram.Newpage;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
|
||||
public class NewpageTile extends AbstractTile implements TileWithCallbackY {
|
||||
public class NewpageTile extends AbstractTile {
|
||||
|
||||
private final Newpage newpage;
|
||||
private final TileArguments tileArguments;
|
||||
|
||||
@Override
|
||||
public double getYPoint(StringBounder stringBounder) {
|
||||
public double getContactPointRelative() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public NewpageTile(Newpage newpage, TileArguments tileArguments) {
|
||||
super(tileArguments.getStringBounder());
|
||||
this.newpage = newpage;
|
||||
this.tileArguments = tileArguments;
|
||||
}
|
||||
@ -59,24 +59,25 @@ public class NewpageTile extends AbstractTile implements TileWithCallbackY {
|
||||
public void drawU(UGraphic ug) {
|
||||
}
|
||||
|
||||
public double getPreferredHeight(StringBounder stringBounder) {
|
||||
public double getPreferredHeight() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void addConstraints(StringBounder stringBounder) {
|
||||
public void addConstraints() {
|
||||
}
|
||||
|
||||
public Real getMinX(StringBounder stringBounder) {
|
||||
public Real getMinX() {
|
||||
return tileArguments.getOrigin();
|
||||
}
|
||||
|
||||
public Real getMaxX(StringBounder stringBounder) {
|
||||
public Real getMaxX() {
|
||||
return tileArguments.getOrigin();
|
||||
}
|
||||
|
||||
private double y;
|
||||
|
||||
public void callbackY(double y) {
|
||||
@Override
|
||||
public void callbackY_internal(double y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
|
@ -66,11 +66,13 @@ public class NoteTile extends AbstractTile implements Tile {
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getYPoint(StringBounder stringBounder) {
|
||||
return getComponent(stringBounder).getPreferredHeight(stringBounder) / 2;
|
||||
public double getContactPointRelative() {
|
||||
return getComponent(getStringBounder()).getPreferredHeight(getStringBounder()) / 2;
|
||||
}
|
||||
|
||||
public NoteTile(LivingSpace livingSpace1, LivingSpace livingSpace2, Note note, Rose skin, ISkinParam skinParam) {
|
||||
public NoteTile(StringBounder stringBounder, LivingSpace livingSpace1, LivingSpace livingSpace2, Note note,
|
||||
Rose skin, ISkinParam skinParam) {
|
||||
super(stringBounder);
|
||||
this.livingSpace1 = livingSpace1;
|
||||
this.livingSpace2 = livingSpace2;
|
||||
this.note = note;
|
||||
@ -140,20 +142,20 @@ public class NoteTile extends AbstractTile implements Tile {
|
||||
}
|
||||
}
|
||||
|
||||
public double getPreferredHeight(StringBounder stringBounder) {
|
||||
final Component comp = getComponent(stringBounder);
|
||||
final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
||||
public double getPreferredHeight() {
|
||||
final Component comp = getComponent(getStringBounder());
|
||||
final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
|
||||
return dim.getHeight();
|
||||
}
|
||||
|
||||
public void addConstraints(StringBounder stringBounder) {
|
||||
public void addConstraints() {
|
||||
// final Component comp = getComponent(stringBounder);
|
||||
// final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
||||
// final double width = dim.getWidth();
|
||||
}
|
||||
|
||||
public Real getMinX(StringBounder stringBounder) {
|
||||
final Real result = getX(stringBounder);
|
||||
public Real getMinX() {
|
||||
final Real result = getX(getStringBounder());
|
||||
if (note.getPosition() == NotePosition.OVER_SEVERAL) {
|
||||
final Real x1 = livingSpace1.getPosB();
|
||||
return RealUtils.min(result, x1);
|
||||
@ -161,10 +163,10 @@ public class NoteTile extends AbstractTile implements Tile {
|
||||
return result;
|
||||
}
|
||||
|
||||
public Real getMaxX(StringBounder stringBounder) {
|
||||
final Real result = getX(stringBounder).addFixed(getUsedWidth(stringBounder));
|
||||
public Real getMaxX() {
|
||||
final Real result = getX(getStringBounder()).addFixed(getUsedWidth(getStringBounder()));
|
||||
if (note.getPosition() == NotePosition.OVER_SEVERAL) {
|
||||
final Real x2 = livingSpace2.getPosD(stringBounder);
|
||||
final Real x2 = livingSpace2.getPosD(getStringBounder());
|
||||
return RealUtils.max(result, x2);
|
||||
}
|
||||
return result;
|
||||
|
@ -67,7 +67,9 @@ public class NotesTile extends AbstractTile implements Tile {
|
||||
return notes;
|
||||
}
|
||||
|
||||
public NotesTile(LivingSpaces livingSpaces, Notes notes, Rose skin, ISkinParam skinParam) {
|
||||
public NotesTile(StringBounder stringBounder, LivingSpaces livingSpaces, Notes notes, Rose skin,
|
||||
ISkinParam skinParam) {
|
||||
super(stringBounder);
|
||||
this.livingSpaces = livingSpaces;
|
||||
this.notes = notes;
|
||||
this.skin = skin;
|
||||
@ -138,39 +140,39 @@ public class NotesTile extends AbstractTile implements Tile {
|
||||
}
|
||||
}
|
||||
|
||||
public double getPreferredHeight(StringBounder stringBounder) {
|
||||
public double getPreferredHeight() {
|
||||
double result = 0;
|
||||
for (Note note : notes) {
|
||||
final Component comp = getComponent(stringBounder, note);
|
||||
final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
||||
final Component comp = getComponent(getStringBounder(), note);
|
||||
final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
|
||||
result = Math.max(result, dim.getHeight());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public void addConstraints(StringBounder stringBounder) {
|
||||
public void addConstraints() {
|
||||
final List<Note> all = notes.asList();
|
||||
for (int i = 0; i < all.size() - 1; i++) {
|
||||
for (int j = i + 1; j < all.size(); j++) {
|
||||
final double center1 = getXcenter(stringBounder, all.get(i)).getCurrentValue();
|
||||
final double center2 = getXcenter(stringBounder, all.get(j)).getCurrentValue();
|
||||
final double center1 = getXcenter(getStringBounder(), all.get(i)).getCurrentValue();
|
||||
final double center2 = getXcenter(getStringBounder(), all.get(j)).getCurrentValue();
|
||||
if (center2 > center1) {
|
||||
final Real point1b = getX2(stringBounder, all.get(i));
|
||||
final Real point2 = getX(stringBounder, all.get(j));
|
||||
final Real point1b = getX2(getStringBounder(), all.get(i));
|
||||
final Real point2 = getX(getStringBounder(), all.get(j));
|
||||
point2.ensureBiggerThan(point1b);
|
||||
} else {
|
||||
final Real point1 = getX(stringBounder, all.get(i));
|
||||
final Real point2b = getX2(stringBounder, all.get(j));
|
||||
final Real point1 = getX(getStringBounder(), all.get(i));
|
||||
final Real point2b = getX2(getStringBounder(), all.get(j));
|
||||
point1.ensureBiggerThan(point2b);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Real getMinX(StringBounder stringBounder) {
|
||||
public Real getMinX() {
|
||||
final List<Real> reals = new ArrayList<Real>();
|
||||
for (Note note : notes) {
|
||||
reals.add(getX(stringBounder, note));
|
||||
reals.add(getX(getStringBounder(), note));
|
||||
}
|
||||
return RealUtils.min(reals);
|
||||
}
|
||||
@ -179,10 +181,10 @@ public class NotesTile extends AbstractTile implements Tile {
|
||||
return getX(stringBounder, note).addFixed(getUsedWidth(stringBounder, note));
|
||||
}
|
||||
|
||||
public Real getMaxX(StringBounder stringBounder) {
|
||||
public Real getMaxX() {
|
||||
final List<Real> reals = new ArrayList<Real>();
|
||||
for (Note note : notes) {
|
||||
reals.add(getX2(stringBounder, note));
|
||||
reals.add(getX2(getStringBounder(), note));
|
||||
}
|
||||
return RealUtils.max(reals);
|
||||
}
|
||||
|
@ -79,8 +79,8 @@ public class PlayingSpace implements Bordered {
|
||||
tiles.addAll(TileBuilder.buildSeveral(diagram.events().iterator(), tileArguments, null));
|
||||
|
||||
for (Tile tile : tiles) {
|
||||
min2.add(tile.getMinX(tileArguments.getStringBounder()));
|
||||
max2.add(tile.getMaxX(tileArguments.getStringBounder()));
|
||||
min2.add(tile.getMinX());
|
||||
max2.add(tile.getMaxX());
|
||||
}
|
||||
|
||||
for (LivingSpace livingSpace : livingSpaces.values()) {
|
||||
@ -95,10 +95,6 @@ public class PlayingSpace implements Bordered {
|
||||
}
|
||||
|
||||
public void drawBackground(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final LiveBoxFinder liveBoxFinder = new LiveBoxFinder(stringBounder);
|
||||
|
||||
drawUInternal(liveBoxFinder, false);
|
||||
final UGraphicInterceptorTile interceptor = new UGraphicInterceptorTile(ug, true);
|
||||
drawUInternal(interceptor, false);
|
||||
}
|
||||
@ -146,9 +142,9 @@ public class PlayingSpace implements Bordered {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void addConstraints(StringBounder stringBounder) {
|
||||
public void addConstraints() {
|
||||
for (Tile tile : tiles) {
|
||||
tile.addConstraints(stringBounder);
|
||||
tile.addConstraints();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,8 +72,8 @@ public class PlayingSpaceWithParticipants extends AbstractTextBlock implements T
|
||||
- playingSpace.getMinX(stringBounder).getCurrentValue();
|
||||
|
||||
final int factor = playingSpace.isShowFootbox() ? 2 : 1;
|
||||
final double height = playingSpace.getPreferredHeight(stringBounder) + factor
|
||||
* playingSpace.getLivingSpaces().getHeadHeight(stringBounder);
|
||||
final double height = playingSpace.getPreferredHeight(stringBounder)
|
||||
+ factor * playingSpace.getLivingSpaces().getHeadHeight(stringBounder);
|
||||
|
||||
cacheDimension = new Dimension2DDouble(width, height);
|
||||
}
|
||||
@ -106,7 +106,8 @@ public class PlayingSpaceWithParticipants extends AbstractTextBlock implements T
|
||||
playingSpace.drawForeground(ug.apply(UTranslate.dy(headHeight)));
|
||||
} else {
|
||||
final UClip clip = new UClip(-1000, ymin, Double.MAX_VALUE, ymax - ymin + 1);
|
||||
// playingSpace.drawForeground(new UGraphicNewpages(ug.apply(UTranslate.dy(headHeight)), ymin, ymax));
|
||||
// playingSpace.drawForeground(new
|
||||
// UGraphicNewpages(ug.apply(UTranslate.dy(headHeight)), ymin, ymax));
|
||||
playingSpace.drawForeground(ug.apply(UTranslate.dy(headHeight)).apply(clip));
|
||||
}
|
||||
// drawNewPages(ug.apply(UTranslate.dy(headHeight)));
|
||||
|
@ -62,6 +62,7 @@ public class ReferenceTile extends AbstractTile implements Tile {
|
||||
}
|
||||
|
||||
public ReferenceTile(Reference reference, TileArguments tileArguments) {
|
||||
super(tileArguments.getStringBounder());
|
||||
this.reference = reference;
|
||||
this.tileArguments = tileArguments;
|
||||
}
|
||||
@ -94,8 +95,8 @@ public class ReferenceTile extends AbstractTile implements Tile {
|
||||
strings = strings.add("ref");
|
||||
strings = strings.addAll(reference.getStrings());
|
||||
|
||||
final Component comp = tileArguments.getSkin().createComponent(null, ComponentType.REFERENCE,
|
||||
null, tileArguments.getSkinParam(), strings);
|
||||
final Component comp = tileArguments.getSkin().createComponent(null, ComponentType.REFERENCE, null,
|
||||
tileArguments.getSkinParam(), strings);
|
||||
return comp;
|
||||
}
|
||||
|
||||
@ -110,22 +111,22 @@ public class ReferenceTile extends AbstractTile implements Tile {
|
||||
comp.drawU(ug, area, (Context2D) ug);
|
||||
}
|
||||
|
||||
public double getPreferredHeight(StringBounder stringBounder) {
|
||||
final Component comp = getComponent(stringBounder);
|
||||
final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
||||
public double getPreferredHeight() {
|
||||
final Component comp = getComponent(getStringBounder());
|
||||
final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
|
||||
return dim.getHeight();
|
||||
}
|
||||
|
||||
public void addConstraints(StringBounder stringBounder) {
|
||||
public void addConstraints() {
|
||||
}
|
||||
|
||||
public Real getMinX(StringBounder stringBounder) {
|
||||
init(stringBounder);
|
||||
public Real getMinX() {
|
||||
init(getStringBounder());
|
||||
return this.first;
|
||||
}
|
||||
|
||||
public Real getMaxX(StringBounder stringBounder) {
|
||||
init(stringBounder);
|
||||
public Real getMaxX() {
|
||||
init(getStringBounder());
|
||||
return this.last;
|
||||
}
|
||||
|
||||
|
@ -227,7 +227,7 @@ public class SequenceDiagramFileMakerTeoz implements FileMaker {
|
||||
this.englobers = new Englobers(tileArguments);
|
||||
final PlayingSpace mainTile = new PlayingSpace(diagram, englobers, tileArguments);
|
||||
this.livingSpaces.addConstraints(stringBounder);
|
||||
mainTile.addConstraints(stringBounder);
|
||||
mainTile.addConstraints();
|
||||
this.englobers.addConstraints(stringBounder);
|
||||
origin.compileNow();
|
||||
tileArguments.setBordered(mainTile);
|
||||
|
@ -58,7 +58,8 @@ public class Stairs2 {
|
||||
if (value < 0) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
// System.err.println("Stairs2::addStep " + position + " " + value + " color=" + color);
|
||||
// System.err.println("Stairs2::addStep " + position + " " + value + " color=" +
|
||||
// color);
|
||||
assert ys.size() == values.size();
|
||||
if (ys.size() > 0) {
|
||||
final double lastY = ys.get(ys.size() - 1).getValue();
|
||||
|
@ -35,29 +35,27 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.teoz;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||
import net.sourceforge.plantuml.real.Real;
|
||||
import net.sourceforge.plantuml.sequencediagram.Event;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
|
||||
public interface Tile extends UDrawable, UShape {
|
||||
public interface Tile extends Tile2 {
|
||||
|
||||
public double getPreferredHeight(StringBounder stringBounder);
|
||||
public double getPreferredHeight();
|
||||
|
||||
public void addConstraints(StringBounder stringBounder);
|
||||
public void callbackY(double y);
|
||||
|
||||
public Real getMinX(StringBounder stringBounder);
|
||||
public void addConstraints();
|
||||
|
||||
public Real getMaxX(StringBounder stringBounder);
|
||||
public Real getMinX();
|
||||
|
||||
public Real getMaxX();
|
||||
|
||||
public Event getEvent();
|
||||
|
||||
public double getYPoint(StringBounder stringBounder);
|
||||
public double getContactPointRelative();
|
||||
|
||||
public double getZZZ();
|
||||
|
||||
public double getZ(StringBounder stringBounder);
|
||||
|
||||
public boolean matchAnchorV1(String anchor);
|
||||
|
||||
|
||||
}
|
||||
|
@ -35,8 +35,8 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.teoz;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||
|
||||
public interface TileWithCallbackY extends Tile {
|
||||
public interface Tile2 extends UDrawable {
|
||||
|
||||
public void callbackY(double y);
|
||||
}
|
@ -62,8 +62,8 @@ public class TileArguments implements Bordered {
|
||||
}
|
||||
|
||||
public TileArguments withBackColorGeneral(HColor backColorElement, HColor backColorGeneral) {
|
||||
return new TileArguments(stringBounder, livingSpaces, skin, new SkinParamBackcolored(skinParam,
|
||||
backColorElement, backColorGeneral), origin);
|
||||
return new TileArguments(stringBounder, livingSpaces, skin,
|
||||
new SkinParamBackcolored(skinParam, backColorElement, backColorGeneral), origin);
|
||||
}
|
||||
|
||||
public TileArguments withBackColor(Reference reference) {
|
||||
|
@ -68,7 +68,7 @@ public class TileBuilder {
|
||||
final Event ev = it.next();
|
||||
for (Tile tile : TileBuilder.buildOne(it, tileArguments, ev, parent)) {
|
||||
tiles.add(tile);
|
||||
final Real tmpMax = tile.getMaxX(tileArguments.getStringBounder());
|
||||
final Real tmpMax = tile.getMaxX();
|
||||
}
|
||||
}
|
||||
return Collections.unmodifiableList(tiles);
|
||||
@ -90,29 +90,27 @@ public class TileBuilder {
|
||||
boolean reverse = false;
|
||||
Tile result = null;
|
||||
if (msg.isSelfMessage()) {
|
||||
result = new CommunicationTileSelf(livingSpace1, msg, skin, skinParam, livingSpaces);
|
||||
result = new CommunicationTileSelf(tileArguments.getStringBounder(), livingSpace1, msg, skin, skinParam,
|
||||
livingSpaces);
|
||||
} else {
|
||||
// System.err.println("msg=" + msg);
|
||||
result = new CommunicationTile(livingSpace1, livingSpace2, msg, skin, skinParam);
|
||||
result = new CommunicationTile(tileArguments.getStringBounder(), livingSpaces, msg, skin, skinParam);
|
||||
reverse = ((CommunicationTile) result).isReverse(stringBounder);
|
||||
}
|
||||
for (Note noteOnMessage : msg.getNoteOnMessages()) {
|
||||
final NotePosition notePosition = noteOnMessage.getPosition();
|
||||
if (notePosition == NotePosition.LEFT) {
|
||||
result = new CommunicationTileNoteLeft((TileWithUpdateStairs) result, msg, skin, skinParam,
|
||||
result = new CommunicationTileNoteLeft(result, msg, skin, skinParam,
|
||||
reverse ? livingSpace2 : livingSpace1, noteOnMessage);
|
||||
} else if (notePosition == NotePosition.RIGHT && msg.isSelfMessage()) {
|
||||
result = new CommunicationTileSelfNoteRight((CommunicationTileSelf) result, msg, skin, skinParam,
|
||||
noteOnMessage);
|
||||
} else if (notePosition == NotePosition.RIGHT) {
|
||||
result = new CommunicationTileNoteRight((TileWithUpdateStairs) result, msg, skin, skinParam,
|
||||
result = new CommunicationTileNoteRight(result, msg, skin, skinParam,
|
||||
reverse ? livingSpace1 : livingSpace2, noteOnMessage);
|
||||
} else if (notePosition == NotePosition.BOTTOM) {
|
||||
result = new CommunicationTileNoteBottom((TileWithUpdateStairs) result, msg, skin, skinParam,
|
||||
noteOnMessage);
|
||||
result = new CommunicationTileNoteBottom(result, msg, skin, skinParam, noteOnMessage);
|
||||
} else if (notePosition == NotePosition.TOP) {
|
||||
result = new CommunicationTileNoteTop((TileWithUpdateStairs) result, msg, skin, skinParam,
|
||||
noteOnMessage);
|
||||
result = new CommunicationTileNoteTop(result, msg, skin, skinParam, noteOnMessage);
|
||||
}
|
||||
}
|
||||
tiles.add(result);
|
||||
@ -124,11 +122,9 @@ public class TileBuilder {
|
||||
for (Note noteOnMessage : exo.getNoteOnMessages()) {
|
||||
final NotePosition notePosition = exo.getNoteOnMessages().get(0).getPosition();
|
||||
if (notePosition == NotePosition.LEFT) {
|
||||
result = new CommunicationTileNoteLeft((TileWithUpdateStairs) result, exo, skin, skinParam,
|
||||
livingSpace1, noteOnMessage);
|
||||
result = new CommunicationTileNoteLeft(result, exo, skin, skinParam, livingSpace1, noteOnMessage);
|
||||
} else if (notePosition == NotePosition.RIGHT) {
|
||||
result = new CommunicationTileNoteRight((TileWithUpdateStairs) result, exo, skin, skinParam,
|
||||
livingSpace1, noteOnMessage);
|
||||
result = new CommunicationTileNoteRight(result, exo, skin, skinParam, livingSpace1, noteOnMessage);
|
||||
}
|
||||
}
|
||||
tiles.add(result);
|
||||
@ -140,17 +136,19 @@ public class TileBuilder {
|
||||
livingSpace1 = tileArguments.getFirstLivingSpace();
|
||||
livingSpace2 = tileArguments.getLastLivingSpace();
|
||||
}
|
||||
tiles.add(new NoteTile(livingSpace1, livingSpace2, note, skin, skinParam));
|
||||
tiles.add(
|
||||
new NoteTile(tileArguments.getStringBounder(), livingSpace1, livingSpace2, note, skin, skinParam));
|
||||
} else if (ev instanceof Notes) {
|
||||
final Notes notes = (Notes) ev;
|
||||
tiles.add(new NotesTile(livingSpaces, notes, skin, skinParam));
|
||||
tiles.add(new NotesTile(tileArguments.getStringBounder(), livingSpaces, notes, skin, skinParam));
|
||||
} else if (ev instanceof Divider) {
|
||||
final Divider divider = (Divider) ev;
|
||||
tiles.add(new DividerTile(divider, tileArguments));
|
||||
} else if (ev instanceof GroupingStart) {
|
||||
final GroupingStart start = (GroupingStart) ev;
|
||||
final GroupingTile groupingTile = new GroupingTile(it, start, tileArguments.withBackColorGeneral(
|
||||
start.getBackColorElement(), start.getBackColorGeneral()), tileArguments);
|
||||
final GroupingTile groupingTile = new GroupingTile(it, start,
|
||||
tileArguments.withBackColorGeneral(start.getBackColorElement(), start.getBackColorGeneral()),
|
||||
tileArguments);
|
||||
tiles.add(new EmptyTile(4, groupingTile));
|
||||
tiles.add(groupingTile);
|
||||
tiles.add(new EmptyTile(4, groupingTile));
|
||||
|
@ -35,7 +35,6 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.teoz;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.real.Real;
|
||||
import net.sourceforge.plantuml.sequencediagram.Event;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
@ -50,6 +49,7 @@ public class TileMarged extends AbstractTile implements Tile {
|
||||
private final double y2;
|
||||
|
||||
public TileMarged(Tile tile, double x1, double x2, double y1, double y2) {
|
||||
super(((AbstractTile) tile).getStringBounder());
|
||||
this.tile = tile;
|
||||
this.x1 = x1;
|
||||
this.x2 = x2;
|
||||
@ -62,20 +62,20 @@ public class TileMarged extends AbstractTile implements Tile {
|
||||
|
||||
}
|
||||
|
||||
public double getPreferredHeight(StringBounder stringBounder) {
|
||||
return tile.getPreferredHeight(stringBounder) + y1 + y2;
|
||||
public double getPreferredHeight() {
|
||||
return tile.getPreferredHeight() + y1 + y2;
|
||||
}
|
||||
|
||||
public void addConstraints(StringBounder stringBounder) {
|
||||
tile.addConstraints(stringBounder);
|
||||
public void addConstraints() {
|
||||
tile.addConstraints();
|
||||
}
|
||||
|
||||
public Real getMinX(StringBounder stringBounder) {
|
||||
return tile.getMinX(stringBounder);
|
||||
public Real getMinX() {
|
||||
return tile.getMinX();
|
||||
}
|
||||
|
||||
public Real getMaxX(StringBounder stringBounder) {
|
||||
return tile.getMaxX(stringBounder).addFixed(x1 + x2);
|
||||
public Real getMaxX() {
|
||||
return tile.getMaxX().addFixed(x1 + x2);
|
||||
}
|
||||
|
||||
public Event getEvent() {
|
||||
|
@ -47,23 +47,18 @@ import net.sourceforge.plantuml.sequencediagram.Event;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class TileParallel implements Tile, TileWithUpdateStairs, TileWithCallbackY {
|
||||
public class TileParallel extends CommonTile {
|
||||
|
||||
public TileParallel(StringBounder stringBounder) {
|
||||
super(stringBounder);
|
||||
}
|
||||
|
||||
private final List<Tile> tiles = new ArrayList<Tile>();
|
||||
|
||||
public void callbackY(double y) {
|
||||
@Override
|
||||
public void callbackY_internal(double y) {
|
||||
for (Tile tile : tiles) {
|
||||
if (tile instanceof TileWithCallbackY) {
|
||||
((TileWithCallbackY) tile).callbackY(y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateStairs(StringBounder stringBounder, double y) {
|
||||
for (Tile tile : tiles) {
|
||||
if (tile instanceof TileWithUpdateStairs) {
|
||||
((TileWithUpdateStairs) tile).updateStairs(stringBounder, y);
|
||||
}
|
||||
tile.callbackY(y);
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,44 +67,40 @@ public class TileParallel implements Tile, TileWithUpdateStairs, TileWithCallbac
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
// final double totalHeight = getPreferredHeight(stringBounder);
|
||||
final double yPointAll = getYPoint(stringBounder);
|
||||
final double yPointAll = getContactPointRelative();
|
||||
for (Tile tile : tiles) {
|
||||
final double yPoint = tile.getYPoint(stringBounder);
|
||||
// tile.drawU(ug.apply(UTranslate.dy(totalHeight -
|
||||
// tile.getPreferredHeight(stringBounder))));
|
||||
final double yPoint = tile.getContactPointRelative();
|
||||
tile.drawU(ug.apply(UTranslate.dy(yPointAll - yPoint)));
|
||||
}
|
||||
}
|
||||
|
||||
public double getYPoint(StringBounder stringBounder) {
|
||||
public double getContactPointRelative() {
|
||||
double result = 0;
|
||||
for (Tile tile : tiles) {
|
||||
result = Math.max(result, tile.getYPoint(stringBounder));
|
||||
result = Math.max(result, tile.getContactPointRelative());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public double getZ(StringBounder stringBounder) {
|
||||
public double getZZZ() {
|
||||
double result = 0;
|
||||
for (Tile tile : tiles) {
|
||||
result = Math.max(result, tile.getZ(stringBounder));
|
||||
result = Math.max(result, tile.getZZZ());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public double getPreferredHeight(StringBounder stringBounder) {
|
||||
return getYPoint(stringBounder) + getZ(stringBounder);
|
||||
public double getPreferredHeight() {
|
||||
return getContactPointRelative() + getZZZ();
|
||||
}
|
||||
|
||||
public void addConstraints(StringBounder stringBounder) {
|
||||
public void addConstraints() {
|
||||
for (Tile tile : tiles) {
|
||||
tile.addConstraints(stringBounder);
|
||||
tile.addConstraints();
|
||||
}
|
||||
}
|
||||
|
||||
public Real getMinX(final StringBounder stringBounder) {
|
||||
public Real getMinX() {
|
||||
return RealUtils.min(new AbstractCollection<Real>() {
|
||||
public Iterator<Real> iterator() {
|
||||
return new Iterator<Real>() {
|
||||
@ -120,7 +111,7 @@ public class TileParallel implements Tile, TileWithUpdateStairs, TileWithCallbac
|
||||
}
|
||||
|
||||
public Real next() {
|
||||
return source.next().getMinX(stringBounder);
|
||||
return source.next().getMinX();
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
@ -135,7 +126,7 @@ public class TileParallel implements Tile, TileWithUpdateStairs, TileWithCallbac
|
||||
});
|
||||
}
|
||||
|
||||
public Real getMaxX(final StringBounder stringBounder) {
|
||||
public Real getMaxX() {
|
||||
return RealUtils.max(new AbstractCollection<Real>() {
|
||||
public Iterator<Real> iterator() {
|
||||
return new Iterator<Real>() {
|
||||
@ -146,7 +137,7 @@ public class TileParallel implements Tile, TileWithUpdateStairs, TileWithCallbac
|
||||
}
|
||||
|
||||
public Real next() {
|
||||
return source.next().getMaxX(stringBounder);
|
||||
return source.next().getMaxX();
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
|
@ -42,7 +42,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
|
||||
public class UGraphicInterceptorTile extends UGraphicDelegator implements Context2D {
|
||||
|
||||
|
||||
private final boolean isBackground;
|
||||
|
||||
public UGraphicInterceptorTile(UGraphic ug, boolean isBackground) {
|
||||
|
@ -35,7 +35,6 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.teoz;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
@ -44,16 +43,10 @@ public class YPositionedTile {
|
||||
private final Tile tile;
|
||||
private final double y;
|
||||
|
||||
public boolean inArea(double ymin, double ymax) {
|
||||
return y >= ymin && y < ymax;
|
||||
}
|
||||
|
||||
public YPositionedTile(Tile tile, double y) {
|
||||
this.tile = tile;
|
||||
this.y = y;
|
||||
if (tile instanceof TileWithCallbackY) {
|
||||
((TileWithCallbackY) tile).callbackY(y);
|
||||
}
|
||||
tile.callbackY(y);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -63,7 +56,7 @@ public class YPositionedTile {
|
||||
|
||||
public void drawInArea(UGraphic ug) {
|
||||
// System.err.println("YPositionedTile::drawU y=" + y + " " + tile);
|
||||
ug.apply(UTranslate.dy(y)).draw(tile);
|
||||
tile.drawU(ug.apply(UTranslate.dy(y)));
|
||||
}
|
||||
|
||||
public boolean matchAnchorV2(String anchor) {
|
||||
@ -71,14 +64,13 @@ public class YPositionedTile {
|
||||
return result;
|
||||
}
|
||||
|
||||
public final double getY(StringBounder stringBounder) {
|
||||
final TileWithUpdateStairs communicationTile = (TileWithUpdateStairs) tile;
|
||||
return y + communicationTile.getYPoint(stringBounder);
|
||||
public final double getY() {
|
||||
return y + tile.getContactPointRelative();
|
||||
}
|
||||
|
||||
public double getMiddleX(StringBounder stringBounder) {
|
||||
final double max = tile.getMaxX(stringBounder).getCurrentValue();
|
||||
final double min = tile.getMinX(stringBounder).getCurrentValue();
|
||||
public double getMiddleX() {
|
||||
final double max = tile.getMaxX().getCurrentValue();
|
||||
final double min = tile.getMinX().getCurrentValue();
|
||||
return (min + max) / 2;
|
||||
}
|
||||
|
||||
|
@ -49,6 +49,8 @@ public interface ArrowComponent extends Component {
|
||||
double getPaddingY();
|
||||
|
||||
public double getYPoint(StringBounder stringBounder);
|
||||
|
||||
public double getPosArrow(StringBounder stringBounder);
|
||||
|
||||
|
||||
}
|
||||
|
@ -103,14 +103,17 @@ public class ComponentRoseArrow extends AbstractComponentRoseArrow {
|
||||
final double pos1 = start + 1;
|
||||
final double pos2 = len - 1;
|
||||
|
||||
if (getArrowConfiguration().getDecoration2() == ArrowDecoration.CIRCLE && dressing2.getHead() == ArrowHead.NONE) {
|
||||
if (getArrowConfiguration().getDecoration2() == ArrowDecoration.CIRCLE
|
||||
&& dressing2.getHead() == ArrowHead.NONE) {
|
||||
len -= diamCircle / 2;
|
||||
}
|
||||
if (getArrowConfiguration().getDecoration2() == ArrowDecoration.CIRCLE && dressing2.getHead() != ArrowHead.NONE) {
|
||||
if (getArrowConfiguration().getDecoration2() == ArrowDecoration.CIRCLE
|
||||
&& dressing2.getHead() != ArrowHead.NONE) {
|
||||
len -= diamCircle / 2 + thinCircle;
|
||||
}
|
||||
|
||||
if (getArrowConfiguration().getDecoration1() == ArrowDecoration.CIRCLE && dressing1.getHead() == ArrowHead.NONE) {
|
||||
if (getArrowConfiguration().getDecoration1() == ArrowDecoration.CIRCLE
|
||||
&& dressing1.getHead() == ArrowHead.NONE) {
|
||||
start += diamCircle / 2;
|
||||
len -= diamCircle / 2;
|
||||
}
|
||||
@ -161,12 +164,20 @@ public class ComponentRoseArrow extends AbstractComponentRoseArrow {
|
||||
- (direction2 == ArrowDirection.LEFT_TO_RIGHT_NORMAL ? getArrowDeltaX() : 0);
|
||||
} else {
|
||||
textPos = getMarginX1()
|
||||
+ (direction2 == ArrowDirection.RIGHT_TO_LEFT_REVERSE
|
||||
|| direction2 == ArrowDirection.BOTH_DIRECTION ? getArrowDeltaX() : 0);
|
||||
+ (direction2 == ArrowDirection.RIGHT_TO_LEFT_REVERSE || direction2 == ArrowDirection.BOTH_DIRECTION
|
||||
? getArrowDeltaX()
|
||||
: 0);
|
||||
}
|
||||
getTextBlock().drawU(ug.apply(new UTranslate(textPos, yText)));
|
||||
}
|
||||
|
||||
public double getPosArrow(StringBounder stringBounder) {
|
||||
if (isBelowForResponse()) {
|
||||
return 0;
|
||||
}
|
||||
return getTextHeight(stringBounder) - 2 * getMarginY();
|
||||
}
|
||||
|
||||
private boolean isBelowForResponse() {
|
||||
return belowForResponse && getDirection2() == ArrowDirection.RIGHT_TO_LEFT_REVERSE;
|
||||
}
|
||||
@ -192,10 +203,10 @@ public class ComponentRoseArrow extends AbstractComponentRoseArrow {
|
||||
}
|
||||
} else if (dressing.getHead() == ArrowHead.CROSSX) {
|
||||
ug = ug.apply(new UStroke(2));
|
||||
ug.apply(new UTranslate(spaceCrossX, -getArrowDeltaX() / 2)).draw(
|
||||
new ULine(getArrowDeltaX(), getArrowDeltaX()));
|
||||
ug.apply(new UTranslate(spaceCrossX, getArrowDeltaX() / 2)).draw(
|
||||
new ULine(getArrowDeltaX(), -getArrowDeltaX()));
|
||||
ug.apply(new UTranslate(spaceCrossX, -getArrowDeltaX() / 2))
|
||||
.draw(new ULine(getArrowDeltaX(), getArrowDeltaX()));
|
||||
ug.apply(new UTranslate(spaceCrossX, getArrowDeltaX() / 2))
|
||||
.draw(new ULine(getArrowDeltaX(), -getArrowDeltaX()));
|
||||
} else if (dressing.getHead() == ArrowHead.NORMAL) {
|
||||
final UPolygon polygon = getPolygonReverse(dressing.getPart());
|
||||
ug.apply(getForegroundColor().bg()).apply(UTranslate.dx(x)).draw(polygon);
|
||||
@ -224,10 +235,10 @@ public class ComponentRoseArrow extends AbstractComponentRoseArrow {
|
||||
}
|
||||
} else if (dressing.getHead() == ArrowHead.CROSSX) {
|
||||
ug = ug.apply(new UStroke(2));
|
||||
ug.apply(new UTranslate(x - spaceCrossX - getArrowDeltaX(), -getArrowDeltaX() / 2)).draw(
|
||||
new ULine(getArrowDeltaX(), getArrowDeltaX()));
|
||||
ug.apply(new UTranslate(x - spaceCrossX - getArrowDeltaX(), getArrowDeltaX() / 2)).draw(
|
||||
new ULine(getArrowDeltaX(), -getArrowDeltaX()));
|
||||
ug.apply(new UTranslate(x - spaceCrossX - getArrowDeltaX(), -getArrowDeltaX() / 2))
|
||||
.draw(new ULine(getArrowDeltaX(), getArrowDeltaX()));
|
||||
ug.apply(new UTranslate(x - spaceCrossX - getArrowDeltaX(), getArrowDeltaX() / 2))
|
||||
.draw(new ULine(getArrowDeltaX(), -getArrowDeltaX()));
|
||||
ug = ug.apply(new UStroke());
|
||||
} else if (dressing.getHead() == ArrowHead.NORMAL) {
|
||||
final UPolygon polygon = getPolygonNormal(dressing.getPart(), x);
|
||||
|
@ -194,5 +194,10 @@ public class ComponentRoseSelfArrow extends AbstractComponentRoseArrow {
|
||||
public double getPreferredWidth(StringBounder stringBounder) {
|
||||
return Math.max(getTextWidth(stringBounder), arrowWidth);
|
||||
}
|
||||
|
||||
public double getPosArrow(StringBounder stringBounder) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ import net.sourceforge.plantuml.cucadiagram.Code;
|
||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||
import net.sourceforge.plantuml.cucadiagram.Ident;
|
||||
import net.sourceforge.plantuml.statediagram.StateDiagram;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandAddField extends SingleLineCommand2<StateDiagram> {
|
||||
|
||||
@ -66,7 +67,7 @@ public class CommandAddField extends SingleLineCommand2<StateDiagram> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(StateDiagram diagram, LineLocation location, RegexResult arg) {
|
||||
protected CommandExecutionResult executeArg(StateDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
|
||||
final String codeString = arg.getLazzy("CODE", 0);
|
||||
final String field = arg.get("FIELD", 0);
|
||||
|
||||
|
@ -105,7 +105,8 @@ public enum SName {
|
||||
task, //
|
||||
title, //
|
||||
usecase, //
|
||||
wbsDiagram; //
|
||||
wbsDiagram, //
|
||||
yamlDiagram; //
|
||||
|
||||
public static String depth(int level) {
|
||||
return "depth(" + level + ")";
|
||||
|
@ -90,6 +90,10 @@ public class StyleSignature {
|
||||
return new StyleSignature(result);
|
||||
}
|
||||
|
||||
public StyleSignature add(SName name) {
|
||||
return add(name.name().toLowerCase().replace("_", ""));
|
||||
}
|
||||
|
||||
public StyleSignature addStar() {
|
||||
final Set<String> result = new HashSet<String>(names);
|
||||
result.add("*");
|
||||
|
@ -42,7 +42,7 @@ 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 net.sourceforge.plantuml.ugraphic.color.HColorUtils;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorNone;
|
||||
|
||||
class MiddleCircleCircled extends Extremity {
|
||||
|
||||
@ -80,11 +80,11 @@ class MiddleCircleCircled extends Extremity {
|
||||
final double d = 0;
|
||||
if (mode == MiddleCircleCircledMode.MODE1 || mode == MiddleCircleCircledMode.BOTH) {
|
||||
final UEllipse arc1 = new UEllipse(2 * radius2, 2 * radius2, angle, 90);
|
||||
ug.apply(new UTranslate(-radius2 + d, -radius2 + d)).draw(arc1);
|
||||
ug.apply(new HColorNone().bg()).apply(new UTranslate(-radius2 + d, -radius2 + d)).draw(arc1);
|
||||
}
|
||||
if (mode == MiddleCircleCircledMode.MODE2 || mode == MiddleCircleCircledMode.BOTH) {
|
||||
final UEllipse arc2 = new UEllipse(2 * radius2, 2 * radius2, angle + 180, 90);
|
||||
ug.apply(new UTranslate(-radius2 + d, -radius2 + d)).draw(arc2);
|
||||
ug.apply(new HColorNone().bg()).apply(new UTranslate(-radius2 + d, -radius2 + d)).draw(arc2);
|
||||
}
|
||||
ug.apply(new UTranslate(-radius1, -radius1)).draw(circle);
|
||||
}
|
||||
|
@ -200,8 +200,8 @@ public class EntityImageDescription extends AbstractEntityImage {
|
||||
HorizontalAlignment.CENTER, getSkinParam());
|
||||
}
|
||||
|
||||
name = BodyFactory.create2(codeDisplay, symbol.getFontParam(), getSkinParam(), HorizontalAlignment.CENTER,
|
||||
stereotype, entity, style);
|
||||
name = BodyFactory.create2(skinParam.getDefaultTextAlignment(HorizontalAlignment.CENTER), codeDisplay,
|
||||
symbol.getFontParam(), getSkinParam(), stereotype, entity, style);
|
||||
|
||||
if (hideText) {
|
||||
asSmall = symbol.asSmall(TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0),
|
||||
|
@ -85,8 +85,9 @@ public class EntityImageLollipopInterfaceEye2 extends AbstractEntityImage {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
this.desc = BodyFactory.create2(entity.getDisplay(), symbol.getFontParam(), skinParam,
|
||||
HorizontalAlignment.CENTER, stereotype, entity, getStyle(symbol.getFontParam()));
|
||||
this.desc = BodyFactory.create2(skinParam.getDefaultTextAlignment(HorizontalAlignment.CENTER),
|
||||
entity.getDisplay(), symbol.getFontParam(), skinParam, stereotype, entity,
|
||||
getStyle(symbol.getFontParam()));
|
||||
|
||||
this.url = entity.getUrl99();
|
||||
|
||||
|
@ -94,8 +94,9 @@ public class EntityImageState2 extends AbstractEntityImage {
|
||||
this.url = entity.getUrl99();
|
||||
TextBlock stereo = TextBlockUtils.empty(0, 0);
|
||||
|
||||
final TextBlock desc = BodyFactory.create2(entity.getDisplay(), symbol.getFontParam(), skinParam,
|
||||
HorizontalAlignment.CENTER, stereotype, entity, getStyle(symbol.getFontParam()));
|
||||
final TextBlock desc = BodyFactory.create2(skinParam.getDefaultTextAlignment(HorizontalAlignment.CENTER),
|
||||
entity.getDisplay(), symbol.getFontParam(), skinParam, stereotype, entity,
|
||||
getStyle(symbol.getFontParam()));
|
||||
|
||||
asSmall = symbol.asSmall(null, desc, stereo, ctx, skinParam.getStereotypeAlignment());
|
||||
|
||||
|
@ -5,12 +5,12 @@
|
||||
* (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
|
||||
@ -30,7 +30,7 @@
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.svek.image;
|
||||
@ -87,8 +87,15 @@ public class EntityImageUseCase extends AbstractEntityImage {
|
||||
super(entity, skinParam);
|
||||
final Stereotype stereotype = entity.getStereotype();
|
||||
|
||||
final TextBlock tmp = BodyFactory.create2(entity.getDisplay(), FontParam.USECASE, skinParam,
|
||||
HorizontalAlignment.CENTER, stereotype, entity, getStyle());
|
||||
final HorizontalAlignment align;
|
||||
if (UseStyle.useBetaStyle()) {
|
||||
final Style style = getStyle();
|
||||
align = style.getHorizontalAlignment();
|
||||
} else {
|
||||
align = HorizontalAlignment.CENTER;
|
||||
}
|
||||
final TextBlock tmp = BodyFactory.create2(skinParam.getDefaultTextAlignment(align), entity.getDisplay(),
|
||||
FontParam.USECASE, skinParam, stereotype, entity, getStyle());
|
||||
|
||||
if (stereotype == null || stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR) == null
|
||||
|| portionShower.showPortion(EntityPortion.STEREOTYPE, entity) == false) {
|
||||
|
@ -5,12 +5,12 @@
|
||||
* (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
|
||||
@ -30,7 +30,7 @@
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.svg;
|
||||
@ -40,6 +40,7 @@ import java.awt.geom.PathIterator;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@ -64,6 +65,7 @@ import org.w3c.dom.Comment;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import net.sourceforge.plantuml.FileUtils;
|
||||
import net.sourceforge.plantuml.Log;
|
||||
import net.sourceforge.plantuml.SignatureUtils;
|
||||
import net.sourceforge.plantuml.code.Base64Coder;
|
||||
@ -159,9 +161,15 @@ public class SvgGraphics {
|
||||
defs.appendChild(getPathHover(hover));
|
||||
}
|
||||
|
||||
// Add styles and script for interactive SVG
|
||||
defs.appendChild(getStylesForInteractiveMode());
|
||||
defs.appendChild(getScriptForInteractiveMode());
|
||||
final Element styles = getStylesForInteractiveMode();
|
||||
if (styles != null) {
|
||||
defs.appendChild(styles);
|
||||
}
|
||||
|
||||
final Element script = getScriptForInteractiveMode();
|
||||
if (script != null) {
|
||||
defs.appendChild(script);
|
||||
}
|
||||
} catch (ParserConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
throw new IllegalStateException(e);
|
||||
@ -170,11 +178,11 @@ public class SvgGraphics {
|
||||
|
||||
private Element getStylesForInteractiveMode() {
|
||||
final Element style = simpleElement("style");
|
||||
final CDATASection cdata = document.createCDATASection(
|
||||
".elem {cursor: pointer;} " + "\n" +
|
||||
".elem, .link {opacity: 0.3;}" + "\n" +
|
||||
".elem.selected, .link.selected {opacity: 1;}"
|
||||
);
|
||||
final String text = getData("default.css");
|
||||
if (text == null) {
|
||||
return null;
|
||||
}
|
||||
final CDATASection cdata = document.createCDATASection(text);
|
||||
style.setAttribute("type", "text/css");
|
||||
style.appendChild(cdata);
|
||||
return style;
|
||||
@ -182,121 +190,24 @@ public class SvgGraphics {
|
||||
|
||||
private Element getScriptForInteractiveMode() {
|
||||
final Element script = document.createElement("script");
|
||||
script.setTextContent(
|
||||
"function addItemToMapOfLists(mapOfLists, name, item) {" + "\n" +
|
||||
" // mapOfLists = {" + "\n" +
|
||||
" // 'key1': [item1, item2, ...]," + "\n" +
|
||||
" // 'key2': [item3, item4, ...]," + "\n" +
|
||||
" // }" + "\n" +
|
||||
" if (mapOfLists[name].length > 0) {" + "\n" +
|
||||
" if (!mapOfLists[name].includes(item)) {" + "\n" +
|
||||
" mapOfLists[name].push(item);" + "\n" +
|
||||
" }" + "\n" +
|
||||
" } else {" + "\n" +
|
||||
" mapOfLists[name] = [item];" + "\n" +
|
||||
" }" + "\n" +
|
||||
"}" + "\n" +
|
||||
"" + "\n" +
|
||||
"function main() {" + "\n" +
|
||||
" let elems = Array.from(document.getElementsByClassName('elem'));" + "\n" +
|
||||
" let links = Array.from(document.getElementsByClassName('link'));" + "\n" +
|
||||
"" + "\n" +
|
||||
" let elemsMap = {};" + "\n" +
|
||||
" let linkedElems = {};" + "\n" +
|
||||
" let linkedLinks = {};" + "\n" +
|
||||
"" + "\n" +
|
||||
" elems.forEach(elem => {" + "\n" +
|
||||
" let name = elem.classList[1];" + "\n" +
|
||||
" elemsMap[name] = elem;" + "\n" +
|
||||
" linkedElems[name] = [];" + "\n" +
|
||||
" linkedLinks[name] = [];" + "\n" +
|
||||
" });" + "\n" +
|
||||
"" + "\n" +
|
||||
" links.forEach(link => {" + "\n" +
|
||||
" if (elemsMap[name1]) {" + "\n" +
|
||||
" if (elemsMap[name2]) {" + "\n" +
|
||||
" let name1 = link.classList[1];" + "\n" +
|
||||
" let name2 = link.classList[2];" + "\n" +
|
||||
"" + "\n" +
|
||||
" let elem1 = elemsMap[name1];" + "\n" +
|
||||
" let elem2 = elemsMap[name2];" + "\n" +
|
||||
"" + "\n" +
|
||||
" addItemToMapOfLists(linkedElems, name1, elem2);" + "\n" +
|
||||
" addItemToMapOfLists(linkedElems, name2, elem1);" + "\n" +
|
||||
"" + "\n" +
|
||||
" addItemToMapOfLists(linkedLinks, name1, link);" + "\n" +
|
||||
" addItemToMapOfLists(linkedLinks, name2, link);" + "\n" +
|
||||
" }" + "\n" +
|
||||
" }" + "\n" +
|
||||
" });" + "\n" +
|
||||
"" + "\n" +
|
||||
" let selectedElems = [];" + "\n" +
|
||||
" let selectedLinks = [];" + "\n" +
|
||||
" let selectedElemName = null;" + "\n" +
|
||||
"" + "\n" +
|
||||
" function clearSelected() {" + "\n" +
|
||||
" selectedElems.forEach(item => {" + "\n" +
|
||||
" item.classList.remove('selected');" + "\n" +
|
||||
" });" + "\n" +
|
||||
" selectedElems = [];" + "\n" +
|
||||
"" + "\n" +
|
||||
" selectedLinks.forEach(item => {" + "\n" +
|
||||
" item.classList.remove('selected');" + "\n" +
|
||||
" });" + "\n" +
|
||||
" selectedLinks = [];" + "\n" +
|
||||
" }" + "\n" +
|
||||
"" + "\n" +
|
||||
" function selectAll() {" + "\n" +
|
||||
" selectedElemName = null;" + "\n" +
|
||||
"" + "\n" +
|
||||
" selectedElems = Array.from(elems);" + "\n" +
|
||||
" selectedElems.forEach(item => {" + "\n" +
|
||||
" item.classList.add('selected');" + "\n" +
|
||||
" });" + "\n" +
|
||||
"" + "\n" +
|
||||
" selectedLinks = Array.from(links);" + "\n" +
|
||||
" selectedLinks.forEach(item => {" + "\n" +
|
||||
" item.classList.add('selected');" + "\n" +
|
||||
" });" + "\n" +
|
||||
" }" + "\n" +
|
||||
"" + "\n" +
|
||||
" function selectElem(elemName) {" + "\n" +
|
||||
" if (elemName === selectedElemName) {" + "\n" +
|
||||
" selectAll();" + "\n" +
|
||||
"" + "\n" +
|
||||
" } else {" + "\n" +
|
||||
" clearSelected();" + "\n" +
|
||||
" selectedElemName = elemName;" + "\n" +
|
||||
"" + "\n" +
|
||||
" elemsMap[elemName].classList.add('selected');" + "\n" +
|
||||
" selectedElems.push(elemsMap[elemName]);" + "\n" +
|
||||
"" + "\n" +
|
||||
" linkedElems[elemName].forEach(linkedElem => {" + "\n" +
|
||||
" selectedElems.push(linkedElem);" + "\n" +
|
||||
" linkedElem.classList.add('selected');" + "\n" +
|
||||
" });" + "\n" +
|
||||
"" + "\n" +
|
||||
" linkedLinks[elemName].forEach(linkedLink => {" + "\n" +
|
||||
" selectedLinks.push(linkedLink);" + "\n" +
|
||||
" linkedLink.classList.add('selected');" + "\n" +
|
||||
" });" + "\n" +
|
||||
" }" + "\n" +
|
||||
" }" + "\n" +
|
||||
"" + "\n" +
|
||||
" Object.keys(elemsMap).forEach(name => {" + "\n" +
|
||||
" elemsMap[name].onclick = () => { selectElem(name); };" + "\n" +
|
||||
" });" + "\n" +
|
||||
"" + "\n" +
|
||||
" selectAll();" + "\n" +
|
||||
"}" + "\n" +
|
||||
"" + "\n" +
|
||||
"document.addEventListener('DOMContentLoaded', (event) => {" + "\n" +
|
||||
" main();" + "\n" +
|
||||
"});"
|
||||
);
|
||||
final String text = getData("default.js");
|
||||
if (text == null) {
|
||||
return null;
|
||||
}
|
||||
script.setTextContent(text);
|
||||
return script;
|
||||
}
|
||||
|
||||
private static String getData(final String name) {
|
||||
try {
|
||||
final InputStream is = SvgGraphics.class.getResourceAsStream("/svg/" + name);
|
||||
return FileUtils.readText(is);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private Element getPathHover(String hover) {
|
||||
final Element style = simpleElement("style");
|
||||
final CDATASection cdata = document.createCDATASection("path:hover { stroke: " + hover + " !important;}");
|
||||
@ -1066,6 +977,7 @@ public class SvgGraphics {
|
||||
}
|
||||
|
||||
public void startGroupWithClass(String groupClasses) {
|
||||
|
||||
pendingAction.add(0, (Element) document.createElement("g"));
|
||||
pendingAction.get(0).setAttribute("class", groupClasses);
|
||||
}
|
||||
|
@ -50,7 +50,6 @@ import net.sourceforge.plantuml.LineLocation;
|
||||
import net.sourceforge.plantuml.StringLocated;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
import net.sourceforge.plantuml.json.Json;
|
||||
import net.sourceforge.plantuml.json.JsonObject;
|
||||
import net.sourceforge.plantuml.json.JsonValue;
|
||||
import net.sourceforge.plantuml.preproc.Defines;
|
||||
import net.sourceforge.plantuml.preproc.FileWithSuffix;
|
||||
@ -197,17 +196,6 @@ public class TContext {
|
||||
}
|
||||
}
|
||||
|
||||
private TValue fromJsonOld(TMemory memory, String name) {
|
||||
final int x = name.indexOf('.');
|
||||
final TValue data = memory.getVariable(name.substring(0, x));
|
||||
if (data == null) {
|
||||
return null;
|
||||
}
|
||||
final JsonObject json = (JsonObject) data.toJson();
|
||||
final JsonValue result = json.get(name.substring(x + 1));
|
||||
return TValue.fromJson(result);
|
||||
}
|
||||
|
||||
private CodeIterator buildCodeIterator(TMemory memory, List<StringLocated> body) {
|
||||
final CodeIterator it10 = new CodeIteratorImpl(body);
|
||||
final CodeIterator it20 = new CodeIteratorLongComment(it10, debug);
|
||||
@ -498,9 +486,13 @@ public class TContext {
|
||||
if (reader == null) {
|
||||
throw EaterException.located("cannot include " + location);
|
||||
}
|
||||
ReadLine readerline = ReadLineReader.create(reader, location, s.getLocation());
|
||||
readerline = new UncommentReadLine(readerline);
|
||||
sub = Sub.fromFile(readerline, blocname, this, memory);
|
||||
try {
|
||||
ReadLine readerline = ReadLineReader.create(reader, location, s.getLocation());
|
||||
readerline = new UncommentReadLine(readerline);
|
||||
sub = Sub.fromFile(readerline, blocname, this, memory);
|
||||
} finally {
|
||||
reader.close();
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
@ -526,7 +518,7 @@ public class TContext {
|
||||
include.analyze(this, memory);
|
||||
final String definitionName = include.getLocation();
|
||||
final List<String> definition = definitionsContainer.getDefinition(definitionName);
|
||||
ReadLine reader2 = new ReadLineList(definition, s.getLocation());
|
||||
final ReadLine reader2 = new ReadLineList(definition, s.getLocation());
|
||||
|
||||
try {
|
||||
final List<StringLocated> body = new ArrayList<StringLocated>();
|
||||
@ -541,6 +533,12 @@ public class TContext {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
throw EaterException.located("" + e);
|
||||
} finally {
|
||||
try {
|
||||
reader2.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -565,9 +563,7 @@ public class TContext {
|
||||
throw EaterException.located("Cannot open URL");
|
||||
}
|
||||
reader2 = PreprocessorUtils.getReaderIncludeUrl2(url, s, suf, charset);
|
||||
|
||||
}
|
||||
if (location.startsWith("<") && location.endsWith(">")) {
|
||||
} else if (location.startsWith("<") && location.endsWith(">")) {
|
||||
reader2 = PreprocessorUtils.getReaderStdlibInclude(s, location.substring(1, location.length() - 1));
|
||||
} else {
|
||||
final FileWithSuffix f2 = importedFiles.getFile(location, suf);
|
||||
@ -614,6 +610,14 @@ public class TContext {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
throw EaterException.located("cannot include " + e);
|
||||
} finally {
|
||||
if (reader2 != null) {
|
||||
try {
|
||||
reader2.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw EaterException.located("cannot include " + location);
|
||||
|
@ -37,6 +37,8 @@ package net.sourceforge.plantuml.timingdiagram;
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
@ -76,6 +78,9 @@ public class TimingRuler {
|
||||
if (times.size() == 0) {
|
||||
this.times.add(new TimeTick(BigDecimal.ZERO, TimingFormat.DECIMAL));
|
||||
}
|
||||
if (getMax().getTime().signum() > 0 && getMin().getTime().signum() < 0) {
|
||||
this.times.add(new TimeTick(BigDecimal.ZERO, TimingFormat.DECIMAL));
|
||||
}
|
||||
}
|
||||
|
||||
public TimingRuler(ISkinParam skinParam) {
|
||||
@ -99,22 +104,39 @@ public class TimingRuler {
|
||||
|
||||
private long highestCommonFactor() {
|
||||
if (highestCommonFactorInternal == -1) {
|
||||
for (TimeTick time : times) {
|
||||
long tick = time.getTime().longValue();
|
||||
if (tick > 0) {
|
||||
if (highestCommonFactorInternal == -1) {
|
||||
highestCommonFactorInternal = time.getTime().longValue();
|
||||
} else {
|
||||
highestCommonFactorInternal = computeHighestCommonFactor(highestCommonFactorInternal,
|
||||
Math.abs(time.getTime().longValue()));
|
||||
for (long tick : getAbsolutesTicks()) {
|
||||
if (highestCommonFactorInternal == -1) {
|
||||
highestCommonFactorInternal = tick;
|
||||
} else {
|
||||
final long candidate = computeHighestCommonFactor(highestCommonFactorInternal, tick);
|
||||
final double size = (getMax().getTime().doubleValue() - getMin().getTime().doubleValue())
|
||||
/ candidate;
|
||||
if (size > 200) {
|
||||
return highestCommonFactorInternal;
|
||||
}
|
||||
highestCommonFactorInternal = candidate;
|
||||
}
|
||||
}
|
||||
}
|
||||
return highestCommonFactorInternal;
|
||||
}
|
||||
|
||||
private int getNbTick(boolean capped) {
|
||||
private Set<Long> getAbsolutesTicks() {
|
||||
final Set<Long> result = new TreeSet<Long>(new Comparator<Long>() {
|
||||
public int compare(Long o1, Long o2) {
|
||||
return o2.compareTo(o1);
|
||||
}
|
||||
});
|
||||
for (TimeTick time : times) {
|
||||
final long value = Math.abs(time.getTime().longValue());
|
||||
if (value > 0) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private int getNbTick() {
|
||||
if (times.size() == 0) {
|
||||
return 1;
|
||||
}
|
||||
@ -123,7 +145,9 @@ public class TimingRuler {
|
||||
}
|
||||
|
||||
public double getWidth() {
|
||||
return getNbTick(false) * tickIntervalInPixels;
|
||||
final double delta = getMax().getTime().doubleValue() - getMin().getTime().doubleValue();
|
||||
|
||||
return (delta / tickUnitary() + 1) * tickIntervalInPixels;
|
||||
}
|
||||
|
||||
public final double getPosInPixel(TimeTick when) {
|
||||
@ -160,11 +184,13 @@ public class TimingRuler {
|
||||
ug = ug.apply(new UStroke(2.0)).apply(HColorUtils.BLACK);
|
||||
final double tickHeight = 5;
|
||||
final ULine line = ULine.vline(tickHeight);
|
||||
final int nb = getNbTick(true);
|
||||
for (int i = 0; i <= nb; i++) {
|
||||
ug.apply(UTranslate.dx(tickIntervalInPixels * i)).draw(line);
|
||||
final double firstTickPosition = getPosInPixelInternal(getFirstPositiveOrZeroValue().doubleValue());
|
||||
int nb = 0;
|
||||
while (firstTickPosition + nb * tickIntervalInPixels <= getWidth()) {
|
||||
ug.apply(UTranslate.dx(firstTickPosition + nb * tickIntervalInPixels)).draw(line);
|
||||
nb++;
|
||||
}
|
||||
ug.draw(ULine.hline(nb * tickIntervalInPixels));
|
||||
ug.apply(UTranslate.dx(firstTickPosition)).draw(ULine.hline((nb - 1) * tickIntervalInPixels));
|
||||
|
||||
for (long round : roundValues()) {
|
||||
final TextBlock text = getTimeTextBlock(round);
|
||||
@ -173,6 +199,15 @@ public class TimingRuler {
|
||||
}
|
||||
}
|
||||
|
||||
private BigDecimal getFirstPositiveOrZeroValue() {
|
||||
for (TimeTick time : times) {
|
||||
if (time.getTime().signum() >= 0) {
|
||||
return time.getTime();
|
||||
}
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
private Collection<Long> roundValues() {
|
||||
final SortedSet<Long> result = new TreeSet<Long>();
|
||||
if (tickUnitary == 0) {
|
||||
@ -181,7 +216,7 @@ public class TimingRuler {
|
||||
result.add(round);
|
||||
}
|
||||
} else {
|
||||
final int nb = getNbTick(true);
|
||||
final int nb = getNbTick();
|
||||
for (int i = 0; i <= nb; i++) {
|
||||
final long round = tickToTime(i);
|
||||
result.add(round);
|
||||
@ -196,7 +231,7 @@ public class TimingRuler {
|
||||
public void drawVlines(UGraphic ug, double height) {
|
||||
ug = applyForVLines(ug);
|
||||
final ULine line = ULine.vline(height);
|
||||
final int nb = getNbTick(true);
|
||||
final int nb = getNbTick();
|
||||
for (int i = 0; i <= nb; i++) {
|
||||
ug.apply(UTranslate.dx(tickIntervalInPixels * i)).draw(line);
|
||||
}
|
||||
|
@ -172,10 +172,11 @@ public abstract class AbstractCommonUGraphic implements UGraphic {
|
||||
|
||||
public void startGroup(String groupId) {
|
||||
}
|
||||
|
||||
|
||||
public void startGroupWithClass(String groupClasses) {
|
||||
}
|
||||
|
||||
|
||||
public void closeGroup() {
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,66 @@
|
||||
/* ========================================================================
|
||||
* 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.ugraphic;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
|
||||
public class PlacementStrategyY1Y2Right extends AbstractPlacementStrategy {
|
||||
|
||||
public PlacementStrategyY1Y2Right(StringBounder stringBounder) {
|
||||
super(stringBounder);
|
||||
}
|
||||
|
||||
public Map<TextBlock, Point2D> getPositions(double width, double height) {
|
||||
final double usedHeight = getSumHeight();
|
||||
|
||||
final double space = (height - usedHeight) / (getDimensions().size() + 1);
|
||||
final Map<TextBlock, Point2D> result = new LinkedHashMap<TextBlock, Point2D>();
|
||||
double y = space;
|
||||
for (Map.Entry<TextBlock, Dimension2D> ent : getDimensions().entrySet()) {
|
||||
final double x = width - ent.getValue().getWidth();
|
||||
result.put(ent.getKey(), new Point2D.Double(x, y));
|
||||
y += ent.getValue().getHeight() + space;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
@ -76,7 +76,7 @@ public class DriverEllipseSvg implements UDriver<SvgGraphics> {
|
||||
gr.getPolicy());
|
||||
svg.setFillColor("url(#" + id + ")");
|
||||
} else if (back == null || back instanceof HColorBackground) {
|
||||
svg.setFillColor("none");
|
||||
svg.setFillColor("#00000000");
|
||||
} else {
|
||||
final String backcolor = mapper.toSvg(back);
|
||||
svg.setFillColor(backcolor);
|
||||
|
@ -87,7 +87,8 @@ public class DriverTextSvg implements UDriver<SvgGraphics> {
|
||||
} else if (fontConfiguration.containsStyle(FontStyle.STRIKE)) {
|
||||
textDecoration = "line-through";
|
||||
} else if (fontConfiguration.containsStyle(FontStyle.WAVE)) {
|
||||
// Beware that some current SVG implementations do not render the wave properly (e.g. Chrome just draws a straight line)
|
||||
// Beware that some current SVG implementations do not render the wave properly
|
||||
// (e.g. Chrome just draws a straight line)
|
||||
// Works ok on Firefox 85.
|
||||
textDecoration = "wavy underline";
|
||||
}
|
||||
|
@ -179,12 +179,13 @@ public class UGraphicSvg extends AbstractUGraphic<SvgGraphics> implements ClipCo
|
||||
public void startGroup(String groupId) {
|
||||
getGraphicObject().startGroup(groupId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void startGroupWithClass(String groupClasses) {
|
||||
getGraphicObject().startGroupWithClass(groupClasses);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void closeGroup() {
|
||||
getGraphicObject().closeGroup();
|
||||
|
@ -217,13 +217,16 @@ public class LicenseInfo {
|
||||
if (br == null) {
|
||||
return null;
|
||||
}
|
||||
final String s = br.readLine();
|
||||
br.close();
|
||||
final LicenseInfo result = retrieveNamed(s);
|
||||
if (result != null) {
|
||||
Log.info("Reading license from " + f.getAbsolutePath());
|
||||
try {
|
||||
final String s = br.readLine();
|
||||
final LicenseInfo result = retrieveNamed(s);
|
||||
if (result != null) {
|
||||
Log.info("Reading license from " + f.getAbsolutePath());
|
||||
}
|
||||
return result;
|
||||
} finally {
|
||||
br.close();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
@ -68,7 +68,7 @@ public class Version {
|
||||
private static String dotted(int nb) {
|
||||
final String minor = "" + nb % MAJOR_SEPARATOR;
|
||||
final String major = "" + nb / MAJOR_SEPARATOR;
|
||||
return major + "." + minor.substring(0, 4) + "." + minor.substring(4);
|
||||
return major + "." + minor.substring(0, 4) + "." + Integer.parseInt(minor.substring(4));
|
||||
}
|
||||
|
||||
public static String versionString(int size) {
|
||||
@ -80,7 +80,7 @@ public class Version {
|
||||
}
|
||||
|
||||
public static int beta() {
|
||||
final int beta = 0;
|
||||
final int beta = 11;
|
||||
return beta;
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user