mirror of
https://github.com/octoleo/plantuml.git
synced 2024-11-29 16:23:55 +00:00
Merge branch 'plantuml:master' into master
This commit is contained in:
commit
5ebddab866
59
.github/workflows/ci.yml
vendored
59
.github/workflows/ci.yml
vendored
@ -9,11 +9,18 @@ on:
|
||||
- master
|
||||
workflow_dispatch:
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
jobs:
|
||||
CI:
|
||||
workflow_config:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
do_release: ${{ steps.config.outputs.do_release }}
|
||||
pom_version: ${{ steps.config.outputs.pom_version }}
|
||||
steps:
|
||||
- name: Configure job
|
||||
- name: Configure workflow
|
||||
id: config
|
||||
env:
|
||||
ACTOR: ${{ github.actor }}
|
||||
@ -47,13 +54,28 @@ jobs:
|
||||
echo "This run will NOT make a release"
|
||||
fi
|
||||
|
||||
# We run the tests on many OS / Java combinations but also the Compile step because some users build
|
||||
# their own jars from source, so it is good for CI to check that is working on all combinations.
|
||||
build:
|
||||
needs: workflow_config
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
java_version: [ 8, 11, 17 ]
|
||||
os: [ macos-10.15, macos-11, ubuntu-18.04, ubuntu-20.04, windows-2016, windows-2019, windows-2022 ]
|
||||
include:
|
||||
- release_from_this_build: true
|
||||
os: ubuntu-20.04
|
||||
java_version: 8
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout the repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up java
|
||||
uses: actions/setup-java@v2.3.0
|
||||
uses: actions/setup-java@v2.3.1
|
||||
with:
|
||||
java-version: 8
|
||||
java-version: ${{ matrix.java_version }}
|
||||
distribution: temurin
|
||||
cache: maven
|
||||
|
||||
@ -63,9 +85,9 @@ jobs:
|
||||
|
||||
# POM version is usually a -SNAPSHOT at this point, if this is a release then we use the version derived from the tag
|
||||
- name: Set POM version
|
||||
if: steps.config.outputs.do_release == 'true'
|
||||
if: needs.workflow_config.outputs.do_release == 'true'
|
||||
env:
|
||||
POM_VERSION: ${{ steps.config.outputs.pom_version }}
|
||||
POM_VERSION: ${{ needs.workflow_config.outputs.pom_version }}
|
||||
run: |
|
||||
mvn --batch-mode versions:set "-DnewVersion=${POM_VERSION}"
|
||||
|
||||
@ -77,24 +99,37 @@ jobs:
|
||||
run: mvn --batch-mode test
|
||||
|
||||
- name: Package
|
||||
if: ${{ matrix.release_from_this_build }}
|
||||
run: mvn --batch-mode -Dmaven.test.skip=true package
|
||||
|
||||
- name: Upload jar artifacts
|
||||
if: ${{ always() }}
|
||||
if: ${{ matrix.release_from_this_build }}
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
# Using github.run_number here to reduce confusion when downloading & comparing artifacts from several builds
|
||||
name: ${{ github.run_number }}-jars
|
||||
path: target/*.jar
|
||||
|
||||
release:
|
||||
needs: [ workflow_config, build ]
|
||||
if: needs.workflow_config.outputs.do_release == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout the repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Download jar artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: ${{ github.run_number }}-jars
|
||||
|
||||
- name: Create release in GitHub
|
||||
if: steps.config.outputs.do_release == 'true'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
POM_VERSION: ${{ steps.config.outputs.pom_version }}
|
||||
POM_VERSION: ${{ needs.workflow_config.outputs.pom_version }}
|
||||
TAG: ${{ github.event.ref }}
|
||||
run: |
|
||||
gh release create "${TAG}" \
|
||||
"target/plantuml-${POM_VERSION}.jar" \
|
||||
"target/plantuml-${POM_VERSION}-javadoc.jar" \
|
||||
"target/plantuml-${POM_VERSION}-sources.jar"
|
||||
"plantuml-${POM_VERSION}.jar" \
|
||||
"plantuml-${POM_VERSION}-javadoc.jar" \
|
||||
"plantuml-${POM_VERSION}-sources.jar"
|
||||
|
37
pom.xml
37
pom.xml
@ -35,7 +35,7 @@
|
||||
|
||||
<groupId>net.sourceforge.plantuml</groupId>
|
||||
<artifactId>plantuml</artifactId>
|
||||
<version>1.2021.11-SNAPSHOT</version>
|
||||
<version>1.2021.13-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>PlantUML</name>
|
||||
@ -57,12 +57,19 @@
|
||||
<version>7</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>1.7</maven.compiler.source>
|
||||
<maven.compiler.target>1.7</maven.compiler.target>
|
||||
<maven.compiler.testSource>1.8</maven.compiler.testSource>
|
||||
<maven.compiler.testTarget>1.8</maven.compiler.testTarget>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.junit</groupId>
|
||||
<artifactId>junit-bom</artifactId>
|
||||
<version>5.8.0</version>
|
||||
<version>5.8.1</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
@ -74,7 +81,7 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.ant</groupId>
|
||||
<artifactId>ant</artifactId>
|
||||
<version>1.10.11</version>
|
||||
<version>1.10.12</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@ -156,8 +163,6 @@
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
<debug>true</debug>
|
||||
</configuration>
|
||||
</plugin>
|
||||
@ -179,7 +184,7 @@
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.3.1</version>
|
||||
<version>3.2.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
@ -234,4 +239,24 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<!--
|
||||
Kludge to make 1.8 tests with 1.7 source work nicer in IntelliJ
|
||||
See https://youtrack.jetbrains.com/issue/IDEA-85478
|
||||
-->
|
||||
<id>intellij</id>
|
||||
<activation>
|
||||
<activeByDefault>false</activeByDefault>
|
||||
<property>
|
||||
<name>idea.maven.embedder.version</name>
|
||||
</property>
|
||||
</activation>
|
||||
<properties>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
|
@ -64,6 +64,9 @@ stereotype {
|
||||
|
||||
element {
|
||||
Shadowing 4.0
|
||||
title {
|
||||
FontStyle bold
|
||||
}
|
||||
}
|
||||
|
||||
group {
|
||||
@ -95,6 +98,18 @@ classDiagram {
|
||||
}
|
||||
|
||||
|
||||
stateDiagram {
|
||||
state {
|
||||
RoundCorner 25
|
||||
}
|
||||
element {
|
||||
title {
|
||||
FontStyle plain
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
destroy {
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import ext.plantuml.com.ctreber.acearth.renderer.RenderTarget;
|
||||
import net.sourceforge.plantuml.security.ImageIO;
|
||||
import net.sourceforge.plantuml.security.SImageIO;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -58,7 +58,7 @@ public class PixelCanvas implements RenderTarget {
|
||||
}
|
||||
|
||||
public void saveToImage(OutputStream os) throws IOException {
|
||||
ImageIO.write(fEarthImage2, "png", os);
|
||||
SImageIO.write(fEarthImage2, "png", os);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.sourceforge.plantuml.core.DiagramDescription;
|
||||
import net.sourceforge.plantuml.security.ImageIO;
|
||||
import net.sourceforge.plantuml.security.SImageIO;
|
||||
|
||||
public class ClipboardLoop {
|
||||
|
||||
@ -88,7 +88,7 @@ public class ClipboardLoop {
|
||||
} else {
|
||||
Log.info("Image ok " + desc.getDescription());
|
||||
baos.close();
|
||||
final BufferedImage image = ImageIO.read(baos.toByteArray());
|
||||
final BufferedImage image = SImageIO.read(baos.toByteArray());
|
||||
setClipboardImage(image);
|
||||
Log.info("Image copied in clipboard");
|
||||
}
|
||||
|
@ -36,6 +36,7 @@
|
||||
package net.sourceforge.plantuml;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
import net.sourceforge.plantuml.utils.MathUtils;
|
||||
|
||||
@ -52,6 +53,10 @@ public class Dimension2DDouble extends Dimension2D {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public Dimension2DDouble(Point2D point) {
|
||||
this(point.getX(), point.getY());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[" + width + "," + height + "]";
|
||||
|
@ -50,7 +50,7 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.Line;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.preproc.Defines;
|
||||
import net.sourceforge.plantuml.security.ImageIO;
|
||||
import net.sourceforge.plantuml.security.SImageIO;
|
||||
import net.sourceforge.plantuml.ugraphic.AffineTransformType;
|
||||
import net.sourceforge.plantuml.ugraphic.PixelImage;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
@ -186,7 +186,7 @@ public class EmbeddedDiagram implements CharSequence {
|
||||
final ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
system.exportDiagram(os, 0, new FileFormatOption(FileFormat.PNG));
|
||||
os.close();
|
||||
return ImageIO.read(os.toByteArray());
|
||||
return SImageIO.read(os.toByteArray());
|
||||
}
|
||||
|
||||
public HorizontalAlignment getHorizontalAlignment() {
|
||||
|
@ -46,6 +46,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.ugraphic.UAntiAliasing;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
@ -57,12 +58,13 @@ public class EmptyImageBuilder {
|
||||
private final BufferedImage im;
|
||||
private final Graphics2D g2d;
|
||||
private final Color background;
|
||||
private final StringBounder stringBounder;
|
||||
|
||||
public EmptyImageBuilder(String watermark, double width, double height, Color background) {
|
||||
this(watermark, (int) width, (int) height, background);
|
||||
public EmptyImageBuilder(String watermark, double width, double height, Color background, StringBounder stringBounder) {
|
||||
this(watermark, (int) width, (int) height, background, stringBounder);
|
||||
}
|
||||
|
||||
public EmptyImageBuilder(String watermark, int width, int height, Color background) {
|
||||
public EmptyImageBuilder(String watermark, int width, int height, Color background, StringBounder stringBounder) {
|
||||
if (width > GraphvizUtils.getenvImageLimit()) {
|
||||
Log.info("Width too large " + width + ". You should set PLANTUML_LIMIT_SIZE");
|
||||
width = GraphvizUtils.getenvImageLimit();
|
||||
@ -72,6 +74,7 @@ public class EmptyImageBuilder {
|
||||
height = GraphvizUtils.getenvImageLimit();
|
||||
}
|
||||
this.background = background;
|
||||
this.stringBounder = stringBounder;
|
||||
Log.info("Creating image " + width + "x" + height);
|
||||
im = new BufferedImage(width, height, getType(background));
|
||||
g2d = im.createGraphics();
|
||||
@ -149,8 +152,8 @@ public class EmptyImageBuilder {
|
||||
return result;
|
||||
}
|
||||
|
||||
public EmptyImageBuilder(String watermark, int width, int height, Color background, double dpiFactor) {
|
||||
this(watermark, width * dpiFactor, height * dpiFactor, background);
|
||||
public EmptyImageBuilder(String watermark, int width, int height, Color background, StringBounder stringBounder, double dpiFactor) {
|
||||
this(watermark, width * dpiFactor, height * dpiFactor, background, stringBounder);
|
||||
if (dpiFactor != 1.0) {
|
||||
g2d.setTransform(AffineTransform.getScaleInstance(dpiFactor, dpiFactor));
|
||||
}
|
||||
@ -166,7 +169,7 @@ public class EmptyImageBuilder {
|
||||
|
||||
public UGraphicG2d getUGraphicG2d() {
|
||||
final HColor back = new HColorSimple(background, false);
|
||||
final UGraphicG2d result = new UGraphicG2d(back, new ColorMapperIdentity(), g2d, 1.0);
|
||||
final UGraphicG2d result = new UGraphicG2d(back, new ColorMapperIdentity(), stringBounder, g2d, 1.0);
|
||||
result.setBufferedImage(im);
|
||||
return result;
|
||||
}
|
||||
|
@ -132,10 +132,6 @@ public enum FileFormat {
|
||||
return getDefaultStringBounder(TikzFontDistortion.getDefault(), SvgCharSizeHack.NO_HACK);
|
||||
}
|
||||
|
||||
public StringBounder getDefaultStringBounder(TikzFontDistortion tikzFontDistortion) {
|
||||
return getDefaultStringBounder(tikzFontDistortion, SvgCharSizeHack.NO_HACK);
|
||||
}
|
||||
|
||||
public StringBounder getDefaultStringBounder(TikzFontDistortion tikzFontDistortion, SvgCharSizeHack charSizeHack) {
|
||||
if (this == LATEX || this == LATEX_NO_PREAMBLE) {
|
||||
return getTikzStringBounder(tikzFontDistortion);
|
||||
@ -201,6 +197,11 @@ public enum FileFormat {
|
||||
final double width = 3 * nb * quanta + 1;
|
||||
return new Dimension2DDouble(width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDescent(UFont font, String text) {
|
||||
return UGraphicBraille.QUANTA;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ import net.sourceforge.plantuml.ftp.FtpServer;
|
||||
import net.sourceforge.plantuml.picoweb.PicoWebServer;
|
||||
import net.sourceforge.plantuml.png.MetadataTag;
|
||||
import net.sourceforge.plantuml.preproc.Stdlib;
|
||||
import net.sourceforge.plantuml.security.ImageIO;
|
||||
import net.sourceforge.plantuml.security.SImageIO;
|
||||
import net.sourceforge.plantuml.security.SFile;
|
||||
import net.sourceforge.plantuml.security.SecurityUtils;
|
||||
import net.sourceforge.plantuml.sprite.SpriteGrayLevel;
|
||||
@ -299,7 +299,7 @@ public class Run {
|
||||
|
||||
final BufferedImage im;
|
||||
try (InputStream stream = source.openStream()) {
|
||||
im = ImageIO.read(stream);
|
||||
im = SImageIO.read(stream);
|
||||
}
|
||||
final String name = getSpriteName(fileName);
|
||||
final String s = compressed ? SpriteUtils.encodeCompressed(im, name, level)
|
||||
|
@ -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
|
||||
@ -119,16 +119,22 @@ public class StringUtils {
|
||||
return result;
|
||||
}
|
||||
|
||||
public static boolean isNotEmpty(String input) {
|
||||
return input != null && trin(input).length() > 0;
|
||||
public static boolean isNotEmpty(CharSequence s) {
|
||||
return !isEmpty(s);
|
||||
}
|
||||
|
||||
public static boolean isNotEmpty(List<? extends CharSequence> input) {
|
||||
return input != null && input.size() > 0;
|
||||
}
|
||||
|
||||
public static boolean isEmpty(String input) {
|
||||
return input == null || trin(input).length() == 0;
|
||||
public static boolean isEmpty(CharSequence s) {
|
||||
if (s == null) return true;
|
||||
final int length = s.length();
|
||||
if (length == 0) return true;
|
||||
for (int i = 0; i < length; i++) {
|
||||
if (!isSpaceOrTabOrNull(s.charAt(i))) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static String manageHtml(String s) {
|
||||
|
@ -66,7 +66,7 @@ import net.sourceforge.plantuml.graphic.GraphicStrings;
|
||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||
import net.sourceforge.plantuml.mjpeg.MJPEGGenerator;
|
||||
import net.sourceforge.plantuml.pdf.PdfConverter;
|
||||
import net.sourceforge.plantuml.security.ImageIO;
|
||||
import net.sourceforge.plantuml.security.SImageIO;
|
||||
import net.sourceforge.plantuml.security.SFile;
|
||||
import net.sourceforge.plantuml.security.SecurityUtils;
|
||||
import net.sourceforge.plantuml.style.NoStyleAvailableException;
|
||||
@ -269,7 +269,7 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot
|
||||
// exportDiagramTOxxBEREMOVED(baos, null, 0, new
|
||||
// FileFormatOption(FileFormat.PNG, at));
|
||||
baos.close();
|
||||
final BufferedImage im = ImageIO.read(baos.toByteArray());
|
||||
final BufferedImage im = SImageIO.read(baos.toByteArray());
|
||||
m.addImage(im);
|
||||
}
|
||||
m.finishAVI();
|
||||
|
@ -129,7 +129,7 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
|
||||
return CommandExecutionResult.error("No such activity");
|
||||
}
|
||||
if (arg.get("STEREOTYPE", 0) != null) {
|
||||
entity1.setStereotype(new Stereotype(arg.get("STEREOTYPE", 0)));
|
||||
entity1.setStereotype(Stereotype.build(arg.get("STEREOTYPE", 0)));
|
||||
}
|
||||
if (arg.get("BACKCOLOR", 0) != null) {
|
||||
String s = arg.get("BACKCOLOR", 0);
|
||||
@ -147,7 +147,7 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
|
||||
diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), s));
|
||||
}
|
||||
if (arg.get("STEREOTYPE2", 0) != null) {
|
||||
entity2.setStereotype(new Stereotype(arg.get("STEREOTYPE2", 0)));
|
||||
entity2.setStereotype(Stereotype.build(arg.get("STEREOTYPE2", 0)));
|
||||
}
|
||||
|
||||
final Display linkLabel = Display.getWithNewlines(arg.get("BRACKET", 0));
|
||||
|
@ -126,7 +126,7 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
|
||||
}
|
||||
|
||||
if (line0.get("STEREOTYPE", 0) != null) {
|
||||
entity1.setStereotype(new Stereotype(line0.get("STEREOTYPE", 0)));
|
||||
entity1.setStereotype(Stereotype.build(line0.get("STEREOTYPE", 0)));
|
||||
}
|
||||
final String stringColor = line0.get("BACKCOLOR", 0);
|
||||
if (stringColor != null) {
|
||||
@ -196,7 +196,7 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
|
||||
}
|
||||
|
||||
if (lineLast.get(2) != null) {
|
||||
entity2.setStereotype(new Stereotype(lineLast.get(2)));
|
||||
entity2.setStereotype(Stereotype.build(lineLast.get(2)));
|
||||
}
|
||||
if (lineLast.get(4) != null) {
|
||||
String s = lineLast.get(4);
|
||||
|
@ -101,7 +101,7 @@ public class CommandPartition extends SingleLineCommand2<ActivityDiagram> {
|
||||
p.setColors(colors);
|
||||
}
|
||||
if (arg.get("STEREOTYPE", 0) != null) {
|
||||
p.setStereotype(new Stereotype(arg.get("STEREOTYPE", 0)));
|
||||
p.setStereotype(Stereotype.build(arg.get("STEREOTYPE", 0)));
|
||||
}
|
||||
|
||||
return CommandExecutionResult.ok();
|
||||
|
@ -31,16 +31,18 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.ugraphic.html5;
|
||||
package net.sourceforge.plantuml.activitydiagram3;
|
||||
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.Gtile;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
|
||||
public class DriverNopHtml5 implements UDriver<Html5Drawer> {
|
||||
abstract class AbstractInstruction {
|
||||
|
||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, Html5Drawer html) {
|
||||
public Gtile createGtile(ISkinParam skinParam, StringBounder stringBounder) {
|
||||
throw new UnsupportedOperationException("" + getClass());
|
||||
}
|
||||
|
||||
}
|
@ -351,8 +351,8 @@ public class ActivityDiagram3 extends UmlDiagram {
|
||||
|
||||
public void startRepeat(HColor color, Display label, BoxStyle boxStyleIn, Colors colors) {
|
||||
manageSwimlaneStrategy();
|
||||
final InstructionRepeat instructionRepeat = new InstructionRepeat(swinlanes.getCurrentSwimlane(), current(),
|
||||
nextLinkRenderer(), color, label, boxStyleIn, colors);
|
||||
final InstructionRepeat instructionRepeat = new InstructionRepeat(swinlanes, current(), nextLinkRenderer(),
|
||||
color, label, boxStyleIn, colors);
|
||||
current().add(instructionRepeat);
|
||||
setCurrent(instructionRepeat);
|
||||
setNextLinkRendererInternal(LinkRendering.none());
|
||||
|
@ -38,15 +38,24 @@ package net.sourceforge.plantuml.activitydiagram3;
|
||||
import java.util.Collection;
|
||||
import java.util.Objects;
|
||||
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.LineBreakStrategy;
|
||||
import net.sourceforge.plantuml.UseStyle;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.WeldingPoint;
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.Gtile;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
import net.sourceforge.plantuml.creole.CreoleMode;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.Rainbow;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||
@ -71,6 +80,7 @@ public class Branch {
|
||||
private final HColor color;
|
||||
|
||||
private Ftile ftile;
|
||||
private Gtile gtile;
|
||||
|
||||
public StyleSignature getDefaultStyleDefinitionArrow() {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.arrow);
|
||||
@ -127,16 +137,12 @@ public class Branch {
|
||||
this.ftile = factory.decorateOut(list.createFtile(factory), inlinkRendering);
|
||||
}
|
||||
|
||||
public Collection<? extends Swimlane> getSwimlanes() {
|
||||
return list.getSwimlanes();
|
||||
public void updateGtile(ISkinParam skinParam, StringBounder stringBounder) {
|
||||
this.gtile = list.createGtile(skinParam, stringBounder);
|
||||
}
|
||||
|
||||
public final Display getLabelPositive() {
|
||||
final LinkRendering in = ftile.getInLinkRendering();
|
||||
if (in != null && Display.isNull(in.getDisplay()) == false) {
|
||||
return in.getDisplay();
|
||||
}
|
||||
return labelPositive.getDisplay();
|
||||
public Collection<? extends Swimlane> getSwimlanes() {
|
||||
return list.getSwimlanes();
|
||||
}
|
||||
|
||||
public final Display getLabelTest() {
|
||||
@ -187,6 +193,10 @@ public class Branch {
|
||||
return ftile;
|
||||
}
|
||||
|
||||
public Gtile getGtile() {
|
||||
return gtile;
|
||||
}
|
||||
|
||||
public ISkinParam skinParam() {
|
||||
return ftile.skinParam();
|
||||
}
|
||||
@ -215,4 +225,45 @@ public class Branch {
|
||||
return special;
|
||||
}
|
||||
|
||||
public final Display getDisplayPositive() {
|
||||
final LinkRendering in = ftile.getInLinkRendering();
|
||||
if (in != null && Display.isNull(in.getDisplay()) == false) {
|
||||
return in.getDisplay();
|
||||
}
|
||||
return labelPositive.getDisplay();
|
||||
}
|
||||
|
||||
public Display getSpecialDisplay() {
|
||||
if (special != null && Display.isNull(special.getDisplay()) == false) {
|
||||
return special.getDisplay();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private TextBlock getTextBlock(Display display) {
|
||||
if (display == null)
|
||||
return TextBlockUtils.EMPTY_TEXT_BLOCK;
|
||||
|
||||
LineBreakStrategy lineBreak = LineBreakStrategy.NONE;
|
||||
final FontConfiguration fcArrow;
|
||||
if (UseStyle.useBetaStyle()) {
|
||||
final Style style = getDefaultStyleDefinitionArrow().getMergedStyle(skinParam().getCurrentStyleBuilder());
|
||||
lineBreak = style.wrapWidth();
|
||||
fcArrow = style.getFontConfiguration(skinParam().getThemeStyle(), skinParam().getIHtmlColorSet());
|
||||
} else {
|
||||
fcArrow = new FontConfiguration(skinParam(), FontParam.ARROW, null);
|
||||
}
|
||||
|
||||
return display.create0(fcArrow, HorizontalAlignment.LEFT, skinParam(), lineBreak, CreoleMode.SIMPLE_LINE, null,
|
||||
null);
|
||||
}
|
||||
|
||||
public final TextBlock getTextBlockPositive() {
|
||||
return getTextBlock(getDisplayPositive());
|
||||
}
|
||||
|
||||
public final TextBlock getTextBlockSpecial() {
|
||||
return getTextBlock(getSpecialDisplay());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -35,12 +35,15 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram3;
|
||||
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimable;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.Gtile;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||
@ -49,6 +52,8 @@ public interface Instruction extends Swimable {
|
||||
|
||||
public Ftile createFtile(FtileFactory factory);
|
||||
|
||||
public Gtile createGtile(ISkinParam skinParam, StringBounder stringBounder);
|
||||
|
||||
public CommandExecutionResult add(Instruction other);
|
||||
|
||||
public boolean kill();
|
||||
@ -56,7 +61,7 @@ public interface Instruction extends Swimable {
|
||||
public LinkRendering getInLinkRendering();
|
||||
|
||||
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors, Swimlane swimlaneNote);
|
||||
|
||||
|
||||
public boolean containsBreak();
|
||||
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
|
||||
public class InstructionGroup implements Instruction, InstructionCollection {
|
||||
public class InstructionGroup extends AbstractInstruction implements Instruction, InstructionCollection {
|
||||
|
||||
private final InstructionList list;
|
||||
private final Instruction parent;
|
||||
@ -68,8 +68,8 @@ public class InstructionGroup implements Instruction, InstructionCollection {
|
||||
return list.containsBreak();
|
||||
}
|
||||
|
||||
public InstructionGroup(Instruction parent, Display test, HColor backColor, HColor titleColor,
|
||||
Swimlane swimlane, HColor borderColor, LinkRendering linkRendering, USymbol type, double roundCorner) {
|
||||
public InstructionGroup(Instruction parent, Display test, HColor backColor, HColor titleColor, Swimlane swimlane,
|
||||
HColor borderColor, LinkRendering linkRendering, USymbol type, double roundCorner) {
|
||||
this.list = new InstructionList(swimlane);
|
||||
this.type = type;
|
||||
this.linkRendering = linkRendering;
|
||||
|
@ -50,8 +50,11 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.WeldingPoint;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileWithNoteOpale;
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.Gtile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.GtileIfHexagon;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||
@ -73,6 +76,7 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
|
||||
|
||||
private final Swimlane swimlane;
|
||||
|
||||
@Override
|
||||
public boolean containsBreak() {
|
||||
for (Branch branch : thens) {
|
||||
if (branch.containsBreak()) {
|
||||
@ -97,18 +101,40 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
|
||||
this.current = this.thens.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandExecutionResult add(Instruction ins) {
|
||||
return current.add(ins);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Gtile createGtile(ISkinParam skinParam, StringBounder stringBounder) {
|
||||
for (Branch branch : thens)
|
||||
branch.updateGtile(skinParam, stringBounder);
|
||||
|
||||
final List<Gtile> gtiles = new ArrayList<>();
|
||||
final List<Branch> branches = new ArrayList<>();
|
||||
for (Branch branch : thens) {
|
||||
gtiles.add(branch.getGtile());
|
||||
branches.add(branch);
|
||||
}
|
||||
if (elseBranch != null && elseBranch.isEmpty() == false) {
|
||||
elseBranch.updateGtile(skinParam, stringBounder);
|
||||
gtiles.add(elseBranch.getGtile());
|
||||
branches.add(elseBranch);
|
||||
}
|
||||
|
||||
return new GtileIfHexagon(swimlane, gtiles, branches);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ftile createFtile(FtileFactory factory) {
|
||||
for (Branch branch : thens) {
|
||||
branch.updateFtile(factory);
|
||||
}
|
||||
if (elseBranch == null) {
|
||||
if (elseBranch == null)
|
||||
this.elseBranch = new Branch(skinParam.getCurrentStyleBuilder(), swimlane, LinkRendering.none(),
|
||||
Display.NULL, null, LinkRendering.none());
|
||||
}
|
||||
|
||||
elseBranch.updateFtile(factory);
|
||||
Ftile result = factory.createIf(swimlane, thens, elseBranch, outColor, topInlinkRendering, url);
|
||||
if (getPositionedNotes().size() > 0) {
|
||||
@ -163,6 +189,7 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
|
||||
this.current.setInlinkRendering(nextLinkRenderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
final public boolean kill() {
|
||||
if (endifCalled) {
|
||||
for (Branch branch : thens) {
|
||||
@ -178,6 +205,7 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
|
||||
return current.kill();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinkRendering getInLinkRendering() {
|
||||
return topInlinkRendering;
|
||||
}
|
||||
@ -191,6 +219,7 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Swimlane> getSwimlanes() {
|
||||
final Set<Swimlane> result = new HashSet<>();
|
||||
if (swimlane != null) {
|
||||
@ -205,14 +234,17 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
|
||||
return Collections.unmodifiableSet(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Swimlane getSwimlaneIn() {
|
||||
return swimlane;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Swimlane getSwimlaneOut() {
|
||||
return swimlane;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Instruction getLast() {
|
||||
if (elseBranch == null) {
|
||||
return thens.get(thens.size() - 1).getLast();
|
||||
|
@ -41,14 +41,19 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileDecorateWelding;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileEmpty;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.WeldingPoint;
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.Gtile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.GtileAssembly;
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.GtileEmpty;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||
@ -58,6 +63,7 @@ public class InstructionList extends WithNote implements Instruction, Instructio
|
||||
private final List<Instruction> all = new ArrayList<>();
|
||||
private final Swimlane defaultSwimlane;
|
||||
|
||||
@Override
|
||||
public boolean containsBreak() {
|
||||
for (Instruction ins : all) {
|
||||
if (ins.containsBreak()) {
|
||||
@ -89,11 +95,31 @@ public class InstructionList extends WithNote implements Instruction, Instructio
|
||||
this.defaultSwimlane = defaultSwimlane;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandExecutionResult add(Instruction ins) {
|
||||
all.add(ins);
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Gtile createGtile(ISkinParam skinParam, StringBounder stringBounder) {
|
||||
if (all.size() == 0) {
|
||||
return new GtileEmpty(stringBounder, skinParam, defaultSwimlane);
|
||||
}
|
||||
Gtile result = null;
|
||||
for (Instruction ins : all) {
|
||||
final Gtile cur = ins.createGtile(skinParam, stringBounder);
|
||||
|
||||
if (result == null) {
|
||||
result = cur;
|
||||
} else {
|
||||
result = new GtileAssembly(result, cur, ins.getInLinkRendering());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ftile createFtile(FtileFactory factory) {
|
||||
if (all.size() == 0) {
|
||||
return new FtileEmpty(factory.skinParam(), defaultSwimlane);
|
||||
@ -126,6 +152,7 @@ public class InstructionList extends WithNote implements Instruction, Instructio
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
final public boolean kill() {
|
||||
if (all.size() == 0) {
|
||||
return false;
|
||||
@ -133,10 +160,12 @@ public class InstructionList extends WithNote implements Instruction, Instructio
|
||||
return getLast().kill();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinkRendering getInLinkRendering() {
|
||||
return all.iterator().next().getInLinkRendering();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Instruction getLast() {
|
||||
if (all.size() == 0) {
|
||||
return null;
|
||||
@ -144,6 +173,7 @@ public class InstructionList extends WithNote implements Instruction, Instructio
|
||||
return all.get(all.size() - 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors, Swimlane swimlaneNote) {
|
||||
if (getLast() == null) {
|
||||
return super.addNote(note, position, type, colors, swimlaneNote);
|
||||
@ -151,14 +181,17 @@ public class InstructionList extends WithNote implements Instruction, Instructio
|
||||
return getLast().addNote(note, position, type, colors, swimlaneNote);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Swimlane> getSwimlanes() {
|
||||
return getSwimlanes2(all);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Swimlane getSwimlaneIn() {
|
||||
return defaultSwimlane;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Swimlane getSwimlaneOut() {
|
||||
final Set<Swimlane> swimlanes = getSwimlanes();
|
||||
if (swimlanes.size() == 0) {
|
||||
|
@ -46,7 +46,7 @@ import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||
|
||||
public class InstructionPartition implements Instruction {
|
||||
public class InstructionPartition extends AbstractInstruction implements Instruction {
|
||||
|
||||
private final InstructionList list = new InstructionList();
|
||||
private final Instruction parent;
|
||||
@ -54,7 +54,7 @@ public class InstructionPartition implements Instruction {
|
||||
public InstructionPartition(Instruction parent, String partitionTitle) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
|
||||
public Instruction getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileKilled;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlanes;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
@ -52,12 +53,13 @@ import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
|
||||
public class InstructionRepeat implements Instruction {
|
||||
public class InstructionRepeat extends AbstractInstruction implements Instruction {
|
||||
|
||||
private final InstructionList repeatList;
|
||||
private final Instruction parent;
|
||||
private final LinkRendering nextLinkRenderer;
|
||||
private final Swimlane swimlane;
|
||||
private final Swimlanes swimlanes;
|
||||
private Swimlane swimlaneOut;
|
||||
private BoxStyle boxStyle;
|
||||
private boolean killed = false;
|
||||
@ -81,13 +83,14 @@ public class InstructionRepeat implements Instruction {
|
||||
return repeatList.containsBreak();
|
||||
}
|
||||
|
||||
public InstructionRepeat(Swimlane swimlane, Instruction parent, LinkRendering nextLinkRenderer, HColor color,
|
||||
public InstructionRepeat(Swimlanes swimlanes, Instruction parent, LinkRendering nextLinkRenderer, HColor color,
|
||||
Display startLabel, BoxStyle boxStyleIn, Colors colors) {
|
||||
this.repeatList = new InstructionList(swimlane);
|
||||
this.swimlanes = swimlanes;
|
||||
this.swimlane = swimlanes.getCurrentSwimlane();
|
||||
this.repeatList = new InstructionList(this.swimlane);
|
||||
this.boxStyleIn = boxStyleIn;
|
||||
this.startLabel = startLabel;
|
||||
this.parent = parent;
|
||||
this.swimlane = swimlane;
|
||||
this.nextLinkRenderer = Objects.requireNonNull(nextLinkRenderer);
|
||||
this.colors = colors;
|
||||
}
|
||||
@ -119,6 +122,8 @@ public class InstructionRepeat implements Instruction {
|
||||
public Ftile createFtile(FtileFactory factory) {
|
||||
final Ftile back = getBackward(factory);
|
||||
final Ftile decorateOut = factory.decorateOut(repeatList.createFtile(factory), endRepeatLinkRendering);
|
||||
if (this.testCalled == false && incoming1.isNone())
|
||||
incoming1 = swimlanes.nextLinkRenderer();
|
||||
final Ftile result = factory.repeat(boxStyleIn, swimlane, swimlaneOut, startLabel, decorateOut, test, yes, out,
|
||||
colors, back, isLastOfTheParent(), incoming1, incoming2);
|
||||
if (killed) {
|
||||
@ -131,9 +136,9 @@ public class InstructionRepeat implements Instruction {
|
||||
if (Display.isNull(backward)) {
|
||||
return null;
|
||||
}
|
||||
Ftile result = factory.activity(backward, swimlane, boxStyle, Colors.empty(), null);
|
||||
Ftile result = factory.activity(backward, swimlaneOut, boxStyle, Colors.empty(), null);
|
||||
if (backwardNotes.size() > 0) {
|
||||
result = factory.addNote(result, swimlane, backwardNotes);
|
||||
result = factory.addNote(result, swimlaneOut, backwardNotes);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -35,17 +35,23 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram3;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Objects;
|
||||
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.Url;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileKilled;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.Gtile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.GtileBox;
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.GtileWithNoteOpale;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
|
||||
public class InstructionSimple extends MonoSwimable implements Instruction {
|
||||
@ -58,6 +64,7 @@ public class InstructionSimple extends MonoSwimable implements Instruction {
|
||||
private final Url url;
|
||||
private final Stereotype stereotype;
|
||||
|
||||
@Override
|
||||
public boolean containsBreak() {
|
||||
return false;
|
||||
}
|
||||
@ -73,6 +80,21 @@ public class InstructionSimple extends MonoSwimable implements Instruction {
|
||||
this.colors = Objects.requireNonNull(colors);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Gtile createGtile(ISkinParam skinParam, StringBounder stringBounder) {
|
||||
GtileBox result = GtileBox.create(stringBounder, colors.mute(skinParam), label, getSwimlaneIn(), style,
|
||||
stereotype);
|
||||
if (hasNotes()) {
|
||||
final Collection<PositionedNote> notes = getPositionedNotes();
|
||||
if (notes.size() != 1)
|
||||
throw new UnsupportedOperationException("wip");
|
||||
return new GtileWithNoteOpale(result, notes.iterator().next(), skinParam, false);
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ftile createFtile(FtileFactory factory) {
|
||||
Ftile result = factory.activity(label, getSwimlaneIn(), style, colors, stereotype);
|
||||
if (url != null) {
|
||||
@ -85,15 +107,18 @@ public class InstructionSimple extends MonoSwimable implements Instruction {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandExecutionResult add(Instruction other) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
final public boolean kill() {
|
||||
this.killed = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinkRendering getInLinkRendering() {
|
||||
return inlinkRendering;
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||
|
||||
public class InstructionSplit implements Instruction {
|
||||
public class InstructionSplit extends AbstractInstruction implements Instruction {
|
||||
|
||||
private final List<InstructionList> splits = new ArrayList<>();
|
||||
private final Instruction parent;
|
||||
|
@ -37,10 +37,15 @@ package net.sourceforge.plantuml.activitydiagram3;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.Gtile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.GtileCircleStart;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
|
||||
|
||||
public class InstructionStart extends MonoSwimable implements Instruction {
|
||||
|
||||
@ -50,26 +55,35 @@ public class InstructionStart extends MonoSwimable implements Instruction {
|
||||
super(swimlane);
|
||||
this.inlinkRendering = Objects.requireNonNull(inlinkRendering);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean containsBreak() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Gtile createGtile(ISkinParam skinParam, StringBounder stringBounder) {
|
||||
return new GtileCircleStart(stringBounder, skinParam, HColorUtils.BLACK, getSwimlaneIn(), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ftile createFtile(FtileFactory factory) {
|
||||
Ftile result = factory.start(getSwimlaneIn());
|
||||
result = eventuallyAddNote(factory, result, result.getSwimlaneIn());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandExecutionResult add(Instruction other) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
final public boolean kill() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinkRendering getInLinkRendering() {
|
||||
return inlinkRendering;
|
||||
}
|
||||
|
@ -37,10 +37,15 @@ package net.sourceforge.plantuml.activitydiagram3;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.Gtile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.GtileCircleStart;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
|
||||
|
||||
public class InstructionStop extends MonoSwimable implements Instruction {
|
||||
|
||||
@ -50,26 +55,35 @@ public class InstructionStop extends MonoSwimable implements Instruction {
|
||||
super(swimlane);
|
||||
this.inlinkRendering = Objects.requireNonNull(inlinkRendering);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean containsBreak() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Gtile createGtile(ISkinParam skinParam, StringBounder stringBounder) {
|
||||
return new GtileCircleStart(stringBounder, skinParam, HColorUtils.BLACK, getSwimlaneIn(), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ftile createFtile(FtileFactory factory) {
|
||||
Ftile result = factory.stop(getSwimlaneIn());
|
||||
result = eventuallyAddNote(factory, result, result.getSwimlaneIn());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandExecutionResult add(Instruction other) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
final public boolean kill() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinkRendering getInLinkRendering() {
|
||||
return inlinkRendering;
|
||||
}
|
||||
|
@ -131,6 +131,8 @@ public class InstructionSwitch extends WithNote implements Instruction, Instruct
|
||||
}
|
||||
|
||||
public boolean switchCase(Display labelCase, LinkRendering nextLinkRenderer) {
|
||||
if (this.current != null)
|
||||
this.current.setSpecial(nextLinkRenderer);
|
||||
this.current = new Branch(skinParam.getCurrentStyleBuilder(), swimlane,
|
||||
LinkRendering.none().withDisplay(labelCase), labelCase, null,
|
||||
LinkRendering.none().withDisplay(labelCase));
|
||||
|
@ -41,7 +41,7 @@ import java.util.Set;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimable;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
|
||||
public class MonoSwimable extends WithNote implements Swimable {
|
||||
abstract class MonoSwimable extends WithNote implements Swimable {
|
||||
|
||||
private final Swimlane swimlane;
|
||||
|
||||
@ -50,7 +50,7 @@ public class MonoSwimable extends WithNote implements Swimable {
|
||||
}
|
||||
|
||||
final public Set<Swimlane> getSwimlanes() {
|
||||
return swimlane == null ? Collections.<Swimlane> emptySet() : Collections.<Swimlane> singleton(swimlane);
|
||||
return swimlane == null ? Collections.<Swimlane>emptySet() : Collections.<Swimlane>singleton(swimlane);
|
||||
}
|
||||
|
||||
final public Swimlane getSwimlaneIn() {
|
||||
|
@ -47,7 +47,7 @@ import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||
|
||||
public class WithNote {
|
||||
abstract class WithNote extends AbstractInstruction {
|
||||
|
||||
private final Collection<PositionedNote> notes = new ArrayList<>();
|
||||
|
||||
|
@ -118,7 +118,7 @@ public class CommandActivity3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
final String stereo = arg.get("STEREO", 0);
|
||||
Stereotype stereotype = null;
|
||||
if (stereo != null) {
|
||||
stereotype = new Stereotype(stereo);
|
||||
stereotype = Stereotype.build(stereo);
|
||||
colors = colors.applyStereotype(stereotype, diagram.getSkinParam(), ColorParam.activityBackground);
|
||||
}
|
||||
final BoxStyle style = BoxStyle.fromChar(arg.get("STYLE", 0).charAt(0));
|
||||
|
@ -129,7 +129,7 @@ public class CommandPartition3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
|
||||
final USymbol symbol = getUSymbol(arg.get("TYPE", 0));
|
||||
final String stereo = arg.get("STEREO", 0);
|
||||
final Stereotype stereotype = stereo == null ? null : new Stereotype(stereo);
|
||||
final Stereotype stereotype = stereo == null ? null : Stereotype.build(stereo);
|
||||
|
||||
final HColor backColorInSkinparam = diagram.getSkinParam().getHtmlColor(getColorParamBack(symbol), stereotype,
|
||||
false);
|
||||
|
@ -94,7 +94,7 @@ public class CommandRepeat3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
diagram.getSkinParam().getIHtmlColorSet());
|
||||
final String stereo = arg.get("STEREO", 0);
|
||||
if (stereo != null) {
|
||||
final Stereotype stereotype = new Stereotype(stereo);
|
||||
final Stereotype stereotype = Stereotype.build(stereo);
|
||||
colors = colors.applyStereotype(stereotype, diagram.getSkinParam(), ColorParam.activityBackground);
|
||||
}
|
||||
|
||||
|
@ -48,8 +48,7 @@ public class FtileEmpty extends AbstractFtile {
|
||||
|
||||
private final double width;
|
||||
private final double height;
|
||||
private final Swimlane swimlaneIn;
|
||||
private final Swimlane swimlaneOut;
|
||||
private final Swimlane swimlane;
|
||||
|
||||
@Override
|
||||
public Collection<Ftile> getMyChildren() {
|
||||
@ -57,24 +56,23 @@ public class FtileEmpty extends AbstractFtile {
|
||||
}
|
||||
|
||||
public FtileEmpty(ISkinParam skinParam, double width, double height) {
|
||||
this(skinParam, width, height, null, null);
|
||||
this(skinParam, width, height, null);
|
||||
}
|
||||
|
||||
public FtileEmpty(ISkinParam skinParam, double width, double height, Swimlane swimlaneIn, Swimlane swimlaneOut) {
|
||||
public FtileEmpty(ISkinParam skinParam, double width, double height, Swimlane swimlane) {
|
||||
super(skinParam);
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.swimlaneIn = swimlaneIn;
|
||||
this.swimlaneOut = swimlaneOut;
|
||||
this.swimlane = swimlane;
|
||||
|
||||
}
|
||||
|
||||
public FtileEmpty(ISkinParam skinParam) {
|
||||
this(skinParam, 0, 0, null, null);
|
||||
this(skinParam, 0, 0, null);
|
||||
}
|
||||
|
||||
public FtileEmpty(ISkinParam skinParam, Swimlane swimlane) {
|
||||
this(skinParam, 0, 0, swimlane, swimlane);
|
||||
this(skinParam, 0, 0, swimlane);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -95,20 +93,17 @@ public class FtileEmpty extends AbstractFtile {
|
||||
}
|
||||
|
||||
public Swimlane getSwimlaneIn() {
|
||||
return swimlaneIn;
|
||||
return swimlane;
|
||||
}
|
||||
|
||||
public Swimlane getSwimlaneOut() {
|
||||
return swimlaneOut;
|
||||
return swimlane;
|
||||
}
|
||||
|
||||
public Set<Swimlane> getSwimlanes() {
|
||||
final Set<Swimlane> result = new HashSet<>();
|
||||
if (swimlaneIn != null) {
|
||||
result.add(swimlaneIn);
|
||||
}
|
||||
if (swimlaneOut != null) {
|
||||
result.add(swimlaneOut);
|
||||
if (swimlane != null) {
|
||||
result.add(swimlane);
|
||||
}
|
||||
return Collections.unmodifiableSet(result);
|
||||
}
|
||||
|
@ -114,9 +114,30 @@ public class FtileGeometry extends Dimension2D {
|
||||
return new FtileGeometry(width, height + northHeight, left, inY, outY);
|
||||
}
|
||||
|
||||
// public FtileGeometry incInnerHeight(double northHeight) {
|
||||
// return new FtileGeometry(width, height + northHeight, left, inY, outY + northHeight);
|
||||
// }
|
||||
public FtileGeometry addTop(double northHeight) {
|
||||
if (hasPointOut())
|
||||
return new FtileGeometry(width, height + northHeight, left, inY + northHeight, outY + northHeight);
|
||||
return new FtileGeometry(width, height + northHeight, left, inY + northHeight, Double.MIN_NORMAL);
|
||||
}
|
||||
|
||||
public FtileGeometry addBottom(double southHeight) {
|
||||
if (hasPointOut())
|
||||
return new FtileGeometry(width, height + southHeight, left, inY, outY);
|
||||
return new FtileGeometry(width, height + southHeight, left, inY, Double.MIN_NORMAL);
|
||||
}
|
||||
|
||||
public FtileGeometry incRight(double missing) {
|
||||
return new FtileGeometry(width + missing, height, left, inY, outY);
|
||||
}
|
||||
|
||||
public FtileGeometry incLeft(double missing) {
|
||||
return new FtileGeometry(width + missing, height, left + missing, inY, outY);
|
||||
}
|
||||
|
||||
public FtileGeometry incVertically(double missing1, double missing2) {
|
||||
return new FtileGeometry(width, height + missing1 + missing2, left, inY + missing1,
|
||||
hasPointOut() ? outY + missing1 : outY);
|
||||
}
|
||||
|
||||
public FtileGeometry(Dimension2D dim, double left, double inY, double outY) {
|
||||
this(dim.getWidth(), dim.getHeight(), left, inY, outY);
|
||||
|
@ -68,9 +68,7 @@ public class FtileMargedVertically extends FtileDecorate {
|
||||
}
|
||||
|
||||
private FtileGeometry calculateDimensionSlow(StringBounder stringBounder) {
|
||||
final FtileGeometry orig = getFtileDelegated().calculateDimension(stringBounder);
|
||||
return new FtileGeometry(orig.getWidth(), orig.getHeight() + margin1 + margin2, orig.getLeft(), orig.getInY()
|
||||
+ margin1, orig.hasPointOut() ? orig.getOutY() + margin1 : orig.getOutY());
|
||||
return super.calculateDimension(stringBounder).incVertically(margin1, margin2);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,63 @@
|
||||
/* ========================================================================
|
||||
* 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.activitydiagram3.ftile;
|
||||
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDecorate;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class FtileMargedWest extends FtileDecorate {
|
||||
|
||||
private final double margin;
|
||||
|
||||
public FtileMargedWest(Ftile tile, double margin) {
|
||||
super(tile);
|
||||
this.margin = margin;
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
super.drawU(ug.apply(UTranslate.dx(margin)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public FtileGeometry calculateDimension(StringBounder stringBounder) {
|
||||
FtileGeometry result = super.calculateDimension(stringBounder);
|
||||
result = result.incLeft(margin);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
@ -42,18 +42,18 @@ import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.ugraphic.UPolygon;
|
||||
|
||||
public class Diamond {
|
||||
public class Hexagon {
|
||||
|
||||
final static public double diamondHalfSize = 12;
|
||||
final static public double hexagonHalfSize = 12;
|
||||
|
||||
public static UPolygon asPolygon(double shadowing) {
|
||||
final UPolygon diams = new UPolygon();
|
||||
|
||||
diams.addPoint(diamondHalfSize, 0);
|
||||
diams.addPoint(diamondHalfSize * 2, diamondHalfSize);
|
||||
diams.addPoint(diamondHalfSize, diamondHalfSize * 2);
|
||||
diams.addPoint(0, diamondHalfSize);
|
||||
diams.addPoint(diamondHalfSize, 0);
|
||||
diams.addPoint(hexagonHalfSize, 0);
|
||||
diams.addPoint(hexagonHalfSize * 2, hexagonHalfSize);
|
||||
diams.addPoint(hexagonHalfSize, hexagonHalfSize * 2);
|
||||
diams.addPoint(0, hexagonHalfSize);
|
||||
diams.addPoint(hexagonHalfSize, 0);
|
||||
|
||||
// if (shadowing) {
|
||||
// diams.setDeltaShadow(3);
|
||||
@ -66,13 +66,13 @@ public class Diamond {
|
||||
public static UPolygon asPolygon(double shadowing, double width, double height) {
|
||||
final UPolygon diams = new UPolygon();
|
||||
|
||||
diams.addPoint(diamondHalfSize, 0);
|
||||
diams.addPoint(width - diamondHalfSize, 0);
|
||||
diams.addPoint(hexagonHalfSize, 0);
|
||||
diams.addPoint(width - hexagonHalfSize, 0);
|
||||
diams.addPoint(width, height / 2);
|
||||
diams.addPoint(width - diamondHalfSize, height);
|
||||
diams.addPoint(diamondHalfSize, height);
|
||||
diams.addPoint(width - hexagonHalfSize, height);
|
||||
diams.addPoint(hexagonHalfSize, height);
|
||||
diams.addPoint(0, height / 2);
|
||||
diams.addPoint(diamondHalfSize, 0);
|
||||
diams.addPoint(hexagonHalfSize, 0);
|
||||
|
||||
// if (shadowing) {
|
||||
// diams.setDeltaShadow(3);
|
||||
@ -88,9 +88,9 @@ public class Diamond {
|
||||
private final double getDeltaX(double height, double y) {
|
||||
final double p = y / height * 2;
|
||||
if (p <= 1) {
|
||||
return diamondHalfSize * p;
|
||||
return hexagonHalfSize * p;
|
||||
}
|
||||
return diamondHalfSize * (2 - p);
|
||||
return hexagonHalfSize * (2 - p);
|
||||
}
|
||||
|
||||
public double getStartingX(StringBounder stringBounder, double y) {
|
@ -134,10 +134,10 @@ public class Snake implements UShape {
|
||||
}
|
||||
|
||||
public Snake withLabel(TextBlock textBlock, VerticalAlignment verticalAlignment) {
|
||||
if (textBlock != null) {
|
||||
if (textBlock != null && textBlock != TextBlockUtils.EMPTY_TEXT_BLOCK) {
|
||||
this.texts.add(new Text(textBlock, verticalAlignment, null));
|
||||
}
|
||||
if (verticalAlignment != VerticalAlignment.BOTTOM) {
|
||||
if (verticalAlignment != VerticalAlignment.CENTER) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
return this;
|
||||
@ -254,6 +254,10 @@ public class Snake implements UShape {
|
||||
double y = (pt1.getY() + pt2.getY()) / 2 - dim.getHeight() / 2;
|
||||
if (text.verticalAlignment == VerticalAlignment.BOTTOM) {
|
||||
x = worm.getLast().getX();
|
||||
throw new AssertionError();
|
||||
} else if (text.verticalAlignment == VerticalAlignment.CENTER) {
|
||||
x = worm.getMinX();
|
||||
y = (worm.getFirst().getY() + worm.getLast().getY() - 10) / 2 - dim.getHeight() / 2;
|
||||
} else if (text.horizontalAlignment == HorizontalAlignment.CENTER && zigzag) {
|
||||
final Point2D pt3 = worm.get(2);
|
||||
x = (pt2.getX() + pt3.getX()) / 2 - dim.getWidth() / 2;
|
||||
@ -310,9 +314,10 @@ public class Snake implements UShape {
|
||||
if (this.startDecoration != null || other.startDecoration != null) {
|
||||
throw new UnsupportedOperationException("Not yet coded: to be done");
|
||||
}
|
||||
final ArrayList<Text> mergeTexts = new ArrayList<Text>(this.texts);
|
||||
mergeTexts.addAll(other.texts);
|
||||
final Snake result = new Snake(null, color, oneOf, this.worm.merge(other.worm, strategy), strategy,
|
||||
emphasizeDirection == null ? other.emphasizeDirection : emphasizeDirection, new ArrayList<Text>());
|
||||
// result.textBlock = oneOf(this.textBlock, other.textBlock, stringBounder);
|
||||
emphasizeDirection == null ? other.emphasizeDirection : emphasizeDirection, mergeTexts);
|
||||
return result;
|
||||
}
|
||||
if (same(this.getFirst(), other.getLast())) {
|
||||
|
@ -61,6 +61,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileFactoryDele
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileFactoryDelegatorWhile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.UGraphicInterceptorOneSwimlane;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.VCompactFactory;
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.Gtile;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
@ -213,6 +214,11 @@ public class Swimlanes extends AbstractTextBlock implements TextBlock, Styleable
|
||||
}
|
||||
|
||||
public final void drawU(UGraphic ug) {
|
||||
if (Gtile.USE_GTILE) {
|
||||
drawGtile(ug);
|
||||
return;
|
||||
}
|
||||
|
||||
TextBlock full = root.createFtile(getFtileFactory(ug.getStringBounder()));
|
||||
|
||||
ug = new UGraphicForSnake(ug);
|
||||
@ -226,6 +232,16 @@ public class Swimlanes extends AbstractTextBlock implements TextBlock, Styleable
|
||||
}
|
||||
}
|
||||
|
||||
private void drawGtile(UGraphic ug) {
|
||||
TextBlock full = root.createGtile(skinParam, ug.getStringBounder());
|
||||
|
||||
ug = new UGraphicForSnake(ug);
|
||||
full = new TextBlockInterceptorUDrawable(full);
|
||||
full.drawU(ug);
|
||||
ug.flushUg();
|
||||
|
||||
}
|
||||
|
||||
private TextBlock getTitle(Swimlane swimlane) {
|
||||
final HorizontalAlignment horizontalAlignment = HorizontalAlignment.LEFT;
|
||||
FontConfiguration fontConfiguration = new FontConfiguration(skinParam, FontParam.SWIMLANE_TITLE, null);
|
||||
|
@ -53,12 +53,11 @@ public class TextBlockInterceptorUDrawable extends AbstractTextBlock implements
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
textBlock.drawU(new UGraphicInterceptorUDrawable2(ug, new HashMap<String, UTranslate>()));
|
||||
new UGraphicInterceptorUDrawable2(ug, new HashMap<String, UTranslate>()).draw(textBlock);
|
||||
ug.flushUg();
|
||||
}
|
||||
|
||||
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
||||
// return TextBlockUtils.getMinMax(this, stringBounder).getDimension();
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,8 @@ package net.sourceforge.plantuml.activitydiagram3.ftile;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.GConnection;
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.Gtile;
|
||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||
import net.sourceforge.plantuml.graphic.UGraphicDelegator;
|
||||
import net.sourceforge.plantuml.svek.UGraphicForSnake;
|
||||
@ -60,7 +62,15 @@ public class UGraphicInterceptorUDrawable2 extends UGraphicDelegator {
|
||||
}
|
||||
|
||||
public void draw(UShape shape) {
|
||||
if (shape instanceof Ftile) {
|
||||
if (shape instanceof Gtile) {
|
||||
final Gtile gtile = (Gtile) shape;
|
||||
// System.err.println("gtile=" + gtile);
|
||||
gtile.drawU(this);
|
||||
// FtileWithConnection
|
||||
for (GConnection c : gtile.getInnerConnections()) {
|
||||
this.draw(c);
|
||||
}
|
||||
} else if (shape instanceof Ftile) {
|
||||
final Ftile ftile = (Ftile) shape;
|
||||
// System.err.println("ftile=" + ftile);
|
||||
ftile.drawU(this);
|
||||
|
@ -309,7 +309,7 @@ public class Worm implements Iterable<Point2D.Double> {
|
||||
this.points.add(i, pt);
|
||||
}
|
||||
|
||||
private Point2D getFirst() {
|
||||
public Point2D getFirst() {
|
||||
return points.get(0);
|
||||
}
|
||||
|
||||
@ -317,6 +317,13 @@ public class Worm implements Iterable<Point2D.Double> {
|
||||
return points.get(points.size() - 1);
|
||||
}
|
||||
|
||||
public double getMinX() {
|
||||
double result = points.get(0).getX();
|
||||
for (Point2D.Double pt : points)
|
||||
result = Math.min(result, pt.getX());
|
||||
return result;
|
||||
}
|
||||
|
||||
public Worm merge(Worm other, MergeStrategy merge) {
|
||||
if (Snake.same(this.getLast(), other.getFirst()) == false) {
|
||||
throw new IllegalArgumentException();
|
||||
|
@ -36,6 +36,7 @@
|
||||
package net.sourceforge.plantuml.activitydiagram3.ftile;
|
||||
|
||||
import static net.sourceforge.plantuml.utils.ObjectUtils.instanceOfAny;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.ugraphic.MinMax;
|
||||
import net.sourceforge.plantuml.ugraphic.UBackground;
|
||||
|
@ -76,16 +76,15 @@ public class ConnectionVerticalDown extends AbstractConnection implements Connec
|
||||
}
|
||||
|
||||
private Snake getSimpleSnake() {
|
||||
final Snake snake = Snake.create(color, Arrows.asToDown()).withLabel(textBlock,
|
||||
arrowHorizontalAlignment());
|
||||
final Snake snake = Snake.create(color, Arrows.asToDown()).withLabel(textBlock, arrowHorizontalAlignment());
|
||||
snake.addPoint(p1);
|
||||
snake.addPoint(p2);
|
||||
return snake;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
final Snake snake = Snake.create(color, Arrows.asToDown()).withLabel(textBlock,
|
||||
arrowHorizontalAlignment());
|
||||
final Snake snake = Snake.create(color, Arrows.asToDown()).withLabel(textBlock, arrowHorizontalAlignment());
|
||||
final Point2D mp1a = translate1.getTranslated(p1);
|
||||
final Point2D mp2b = translate2.getTranslated(p2);
|
||||
final double middle = (mp1a.getY() + mp2b.getY()) / 2.0;
|
||||
|
@ -114,7 +114,7 @@ public class FtileFactoryDelegatorRepeat extends FtileFactoryDelegator {
|
||||
final LinkRendering endRepeatLinkRendering = repeat.getOutLinkRendering();
|
||||
final Rainbow endRepeatLinkColor = endRepeatLinkRendering == null ? null : endRepeatLinkRendering.getRainbow();
|
||||
|
||||
final Ftile entry = getEntry(swimlane, startLabel, colors, boxStyleIn);
|
||||
final Ftile entry = getEntry(repeat.getSwimlaneIn(), startLabel, colors, boxStyleIn);
|
||||
|
||||
Ftile result = FtileRepeat.create(swimlane, swimlaneOut, entry, repeat, test, yes, out, borderColor,
|
||||
diamondColor, arrowColor, endRepeatLinkColor, conditionStyle, this.skinParam(), fcDiamond, fcArrow,
|
||||
|
@ -35,11 +35,13 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.ColorParam;
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.LineBreakStrategy;
|
||||
import net.sourceforge.plantuml.UseStyle;
|
||||
import net.sourceforge.plantuml.activitydiagram3.Branch;
|
||||
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
|
||||
@ -52,13 +54,17 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.FtileSwitch
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.FtileSwitchWithDiamonds;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.FtileSwitchWithManyLinks;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.FtileSwitchWithOneLink;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDecorateInLabel;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDecorateOutLabel;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside;
|
||||
import net.sourceforge.plantuml.creole.CreoleMode;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.Rainbow;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
import net.sourceforge.plantuml.style.PName;
|
||||
import net.sourceforge.plantuml.style.Style;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
|
||||
@ -99,9 +105,13 @@ public class FtileFactoryDelegatorSwitch extends FtileFactoryDelegator {
|
||||
final List<Ftile> ftiles = new ArrayList<>();
|
||||
final Ftile diamond1 = getDiamond1(swimlane, branches.get(0), labelTest);
|
||||
final Ftile diamond2 = getDiamond2(swimlane, branches.get(0));
|
||||
|
||||
for (Branch branch : branches) {
|
||||
ftiles.add(new FtileMinWidthCentered(branch.getFtile(), 30));
|
||||
final Dimension2D dimLabelIn = branch.getTextBlockPositive().calculateDimension(getStringBounder());
|
||||
final Dimension2D dimLabelOut = branch.getTextBlockSpecial().calculateDimension(getStringBounder());
|
||||
ftiles.add(new FtileDecorateOutLabel(new FtileDecorateInLabel(branch.getFtile(), dimLabelIn), dimLabelOut));
|
||||
}
|
||||
|
||||
final Rainbow arrowColor;
|
||||
if (UseStyle.useBetaStyle()) {
|
||||
final Style style = getDefaultStyleDefinitionArrow().getMergedStyle(skinParam().getCurrentStyleBuilder());
|
||||
@ -121,18 +131,35 @@ public class FtileFactoryDelegatorSwitch extends FtileFactoryDelegator {
|
||||
}
|
||||
|
||||
private Ftile getDiamond1(Swimlane swimlane, Branch branch0, Display test) {
|
||||
final HColor borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder);
|
||||
final HColor backColor = branch0.getColor() == null
|
||||
? getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBackground)
|
||||
: branch0.getColor();
|
||||
|
||||
final FontConfiguration fcDiamond = new FontConfiguration(skinParam(), FontParam.ACTIVITY_DIAMOND, null);
|
||||
LineBreakStrategy lineBreak = LineBreakStrategy.NONE;
|
||||
final FontConfiguration fcDiamond;
|
||||
final HColor borderColor;
|
||||
final HColor backColor;
|
||||
if (UseStyle.useBetaStyle()) {
|
||||
final Style style = getDefaultStyleDefinitionDiamond().getMergedStyle(skinParam().getCurrentStyleBuilder());
|
||||
lineBreak = style.wrapWidth();
|
||||
fcDiamond = style.getFontConfiguration(skinParam().getThemeStyle(), skinParam().getIHtmlColorSet());
|
||||
borderColor = style.value(PName.LineColor).asColor(skinParam().getThemeStyle(),
|
||||
skinParam().getIHtmlColorSet());
|
||||
backColor = branch0.getColor() == null ? style.value(PName.BackGroundColor)
|
||||
.asColor(skinParam().getThemeStyle(), skinParam().getIHtmlColorSet()) : branch0.getColor();
|
||||
} else {
|
||||
fcDiamond = new FontConfiguration(skinParam(), FontParam.ACTIVITY_DIAMOND, null);
|
||||
borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder);
|
||||
backColor = branch0.getColor() == null
|
||||
? getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBackground)
|
||||
: branch0.getColor();
|
||||
}
|
||||
|
||||
final TextBlock tbTest = (Display.isNull(test) || test.isWhite()) ? TextBlockUtils.empty(0, 0)
|
||||
: test.create(fcDiamond, branch0.skinParam().getDefaultTextAlignment(HorizontalAlignment.LEFT),
|
||||
branch0.skinParam());
|
||||
final TextBlock tbTest;
|
||||
if (Display.isNull(test) || test.isWhite())
|
||||
tbTest = TextBlockUtils.empty(0, 0);
|
||||
else
|
||||
tbTest = test.create0(fcDiamond, branch0.skinParam().getDefaultTextAlignment(HorizontalAlignment.LEFT),
|
||||
branch0.skinParam(), lineBreak, CreoleMode.FULL, null, null);
|
||||
|
||||
return new FtileDiamondInside(branch0.skinParam(), backColor, borderColor, swimlane, tbTest);
|
||||
return new FtileDiamondInside(tbTest, branch0.skinParam(), backColor, borderColor, swimlane);
|
||||
}
|
||||
|
||||
private Ftile getDiamond2(Swimlane swimlane, Branch branch0) {
|
||||
@ -141,12 +168,12 @@ public class FtileFactoryDelegatorSwitch extends FtileFactoryDelegator {
|
||||
? getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBackground)
|
||||
: branch0.getColor();
|
||||
|
||||
return new FtileDiamondInside(branch0.skinParam(), backColor, borderColor, swimlane,
|
||||
TextBlockUtils.empty(0, 0));
|
||||
return new FtileDiamondInside(TextBlockUtils.empty(0, 0), branch0.skinParam(), backColor, borderColor,
|
||||
swimlane);
|
||||
}
|
||||
|
||||
private HColor fontColor(FontParam param) {
|
||||
return skinParam().getFontHtmlColor(null, param);
|
||||
}
|
||||
// private HColor fontColor(FontParam param) {
|
||||
// return skinParam().getFontHtmlColor(null, param);
|
||||
// }
|
||||
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ import net.sourceforge.plantuml.activitydiagram3.Instruction;
|
||||
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Hexagon;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileBreak;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||
@ -124,7 +124,7 @@ public class FtileFactoryDelegatorWhile extends FtileFactoryDelegator {
|
||||
|
||||
final Snake snake = Snake.create(arrowColor, Arrows.asToLeft());
|
||||
snake.addPoint(tr1.getDx(), tr1.getDy());
|
||||
snake.addPoint(Diamond.diamondHalfSize, tr1.getDy());
|
||||
snake.addPoint(Hexagon.hexagonHalfSize, tr1.getDy());
|
||||
ug.draw(snake);
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Hexagon;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||
@ -134,12 +134,12 @@ class FtileIfAndStop extends AbstractFtile {
|
||||
final Sheet sheet = Parser.build(fcTest, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), skinParam, CreoleMode.FULL)
|
||||
.createSheet(labelTest);
|
||||
final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, LineBreakStrategy.NONE, skinParam.getPadding());
|
||||
final TextBlock tbTest = new SheetBlock2(sheetBlock1, Diamond.asStencil(sheetBlock1),
|
||||
final TextBlock tbTest = new SheetBlock2(sheetBlock1, Hexagon.asStencil(sheetBlock1),
|
||||
tileNonStop.getThickness());
|
||||
|
||||
final Ftile diamond1;
|
||||
if (conditionStyle == ConditionStyle.INSIDE_HEXAGON) {
|
||||
diamond1 = new FtileDiamondInside(tileNonStop.skinParam(), backColor, borderColor, swimlane, tbTest);
|
||||
diamond1 = new FtileDiamondInside(tbTest, tileNonStop.skinParam(), backColor, borderColor, swimlane);
|
||||
// .withWest(tb1).withEast(tb2);
|
||||
} else if (conditionStyle == ConditionStyle.EMPTY_DIAMOND) {
|
||||
diamond1 = new FtileDiamond(tileNonStop.skinParam(), backColor, borderColor, swimlane).withNorth(tbTest);
|
||||
|
@ -50,7 +50,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.ConnectionTranslatable;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Hexagon;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileEmpty;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||
@ -205,6 +205,7 @@ public class FtileIfDown extends AbstractFtile {
|
||||
ug.draw(snake);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final Point2D p1 = getP1(stringBounder);
|
||||
@ -266,6 +267,7 @@ public class FtileIfDown extends AbstractFtile {
|
||||
ug.draw(snake);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
|
||||
if (getFtile1().calculateDimension(ug.getStringBounder()).hasPointOut() == false) {
|
||||
@ -326,16 +328,15 @@ public class FtileIfDown extends AbstractFtile {
|
||||
final double y2 = p2.getY();
|
||||
|
||||
final FtileGeometry thenGeom = thenBlock.calculateDimension(stringBounder);
|
||||
final double xmax = Math.max(x1 + Diamond.diamondHalfSize,
|
||||
final double xmax = Math.max(x1 + Hexagon.hexagonHalfSize,
|
||||
getTranslateForThen(stringBounder).getDx() + thenGeom.getWidth());
|
||||
|
||||
final Snake snake = Snake.create(endInlinkColor, Arrows.asToLeft())
|
||||
.emphasizeDirection(Direction.DOWN);
|
||||
final Snake snake = Snake.create(endInlinkColor, Arrows.asToLeft()).emphasizeDirection(Direction.DOWN);
|
||||
snake.addPoint(x1, y1);
|
||||
snake.addPoint(xmax, y1);
|
||||
snake.addPoint(xmax, y2);
|
||||
snake.addPoint(x2, y2);
|
||||
ug.apply(new UTranslate(x2, y2 - Diamond.diamondHalfSize)).draw(new UEmpty(5, Diamond.diamondHalfSize));
|
||||
ug.apply(new UTranslate(x2, y2 - Hexagon.hexagonHalfSize)).draw(new UEmpty(5, Hexagon.hexagonHalfSize));
|
||||
ug.draw(snake);
|
||||
|
||||
}
|
||||
@ -366,7 +367,7 @@ public class FtileIfDown extends AbstractFtile {
|
||||
final double y2 = p2.getY();
|
||||
|
||||
final FtileGeometry thenGeom = thenBlock.calculateDimension(stringBounder);
|
||||
final double xmax = Math.max(x1 + Diamond.diamondHalfSize,
|
||||
final double xmax = Math.max(x1 + Hexagon.hexagonHalfSize,
|
||||
getTranslateForThen(stringBounder).getDx() + thenGeom.getWidth());
|
||||
|
||||
/*
|
||||
@ -381,7 +382,7 @@ public class FtileIfDown extends AbstractFtile {
|
||||
snake.addPoint(x1, y1);
|
||||
snake.addPoint(xmax, y1);
|
||||
snake.addPoint(xmax, y2);
|
||||
ug.apply(new UTranslate(xmax, y2 - Diamond.diamondHalfSize)).draw(new UEmpty(5, Diamond.diamondHalfSize));
|
||||
ug.apply(new UTranslate(xmax, y2 - Hexagon.hexagonHalfSize)).draw(new UEmpty(5, Hexagon.hexagonHalfSize));
|
||||
ug.draw(snake);
|
||||
/*
|
||||
* final Snake snake2 = Snake.create(arrowHorizontalAlignment(),
|
||||
@ -457,7 +458,7 @@ public class FtileIfDown extends AbstractFtile {
|
||||
final double y3 = p3.getY();
|
||||
|
||||
final FtileGeometry thenGeom = thenBlock.calculateDimension(stringBounder);
|
||||
final double xmax = Math.max(x1 + Diamond.diamondHalfSize,
|
||||
final double xmax = Math.max(x1 + Hexagon.hexagonHalfSize,
|
||||
getTranslateForThen(stringBounder).getDx() + thenGeom.getWidth());
|
||||
|
||||
final Snake snake = Snake.create(endInlinkColor).withMerge(MergeStrategy.NONE);
|
||||
@ -489,9 +490,9 @@ public class FtileIfDown extends AbstractFtile {
|
||||
final FtileGeometry geoThen = thenBlock.calculateDimension(stringBounder);
|
||||
final FtileGeometry geoDiamond2 = diamond2.calculateDimension(stringBounder);
|
||||
final FtileGeometry geo = geoDiamond1.appendBottom(geoThen).appendBottom(geoDiamond2);
|
||||
final double height = geo.getHeight() + 3 * Diamond.diamondHalfSize
|
||||
+ Math.max(Diamond.diamondHalfSize * 1, getSouthLabelHeight(stringBounder));
|
||||
double width = geo.getWidth() + Diamond.diamondHalfSize;
|
||||
final double height = geo.getHeight() + 3 * Hexagon.hexagonHalfSize
|
||||
+ Math.max(Hexagon.hexagonHalfSize * 1, getSouthLabelHeight(stringBounder));
|
||||
double width = geo.getWidth() + Hexagon.hexagonHalfSize;
|
||||
if (optionalStop != null) {
|
||||
width += optionalStop.calculateDimension(stringBounder).getWidth() + getAdditionalWidth(stringBounder);
|
||||
}
|
||||
|
@ -156,15 +156,15 @@ class FtileIfLongHorizontal extends AbstractFtile {
|
||||
List<Ftile> diamonds = new ArrayList<>();
|
||||
List<Double> inlabelSizes = new ArrayList<>();
|
||||
for (Branch branch : thens) {
|
||||
final TextBlock tb1 = branch.getLabelPositive().create(fcArrow, HorizontalAlignment.LEFT,
|
||||
final TextBlock tb1 = branch.getDisplayPositive().create(fcArrow, HorizontalAlignment.LEFT,
|
||||
ftileFactory.skinParam());
|
||||
final TextBlock tbTest = branch.getLabelTest().create(fcTest,
|
||||
ftileFactory.skinParam().getDefaultTextAlignment(HorizontalAlignment.LEFT),
|
||||
ftileFactory.skinParam());
|
||||
final HColor diamondColor = branch.getColor() == null ? backColor : branch.getColor();
|
||||
|
||||
FtileDiamondInside2 diamond = new FtileDiamondInside2(branch.skinParam(), diamondColor, borderColor,
|
||||
swimlane, tbTest);
|
||||
FtileDiamondInside2 diamond = new FtileDiamondInside2(tbTest, branch.skinParam(), diamondColor,
|
||||
borderColor, swimlane);
|
||||
TextBlock tbInlabel = null;
|
||||
if (Display.isNull(branch.getInlabel())) {
|
||||
inlabelSizes.add(0.0);
|
||||
@ -177,7 +177,7 @@ class FtileIfLongHorizontal extends AbstractFtile {
|
||||
diamonds.add(diamond);
|
||||
}
|
||||
|
||||
final TextBlock tb2 = branch2.getLabelPositive().create(fcArrow, HorizontalAlignment.LEFT,
|
||||
final TextBlock tb2 = branch2.getDisplayPositive().create(fcArrow, HorizontalAlignment.LEFT,
|
||||
ftileFactory.skinParam());
|
||||
final int last = diamonds.size() - 1;
|
||||
diamonds.set(last, ((FtileDiamondInside2) diamonds.get(last)).withEast(tb2));
|
||||
@ -402,6 +402,7 @@ class FtileIfLongHorizontal extends AbstractFtile {
|
||||
return getTranslate1(getFtile2(), stringBounder).getTranslated(p);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
final Point2D p1 = getP1(ug.getStringBounder());
|
||||
final Point2D p2 = getP2(ug.getStringBounder());
|
||||
|
@ -53,18 +53,20 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileMargedWest;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileMinWidthCentered;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileOverpassing;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamond;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside3;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside2;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.Rainbow;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.VerticalAlignment;
|
||||
import net.sourceforge.plantuml.svek.ConditionStyle;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
@ -128,35 +130,39 @@ class FtileIfLongVertical extends AbstractFtile {
|
||||
static Ftile create(Swimlane swimlane, HColor borderColor, HColor backColor, Rainbow arrowColor,
|
||||
FtileFactory ftileFactory, ConditionStyle conditionStyle, List<Branch> thens, Branch branch2,
|
||||
FontConfiguration fc, LinkRendering topInlinkRendering, LinkRendering afterEndwhile) {
|
||||
final List<Ftile> tiles = new ArrayList<>();
|
||||
|
||||
for (Branch branch : thens) {
|
||||
tiles.add(new FtileMinWidthCentered(branch.getFtile(), 30));
|
||||
}
|
||||
|
||||
final Ftile tile2 = new FtileMinWidthCentered(branch2.getFtile(), 30);
|
||||
|
||||
List<Ftile> diamonds = new ArrayList<>();
|
||||
|
||||
double west = 10;
|
||||
for (Branch branch : thens) {
|
||||
final TextBlock tb1 = branch.getLabelPositive().create(fc, HorizontalAlignment.LEFT,
|
||||
final TextBlock tb1 = branch.getDisplayPositive().create(fc, HorizontalAlignment.LEFT,
|
||||
ftileFactory.skinParam());
|
||||
final TextBlock tbTest = branch.getLabelTest().create(fc,
|
||||
ftileFactory.skinParam().getDefaultTextAlignment(HorizontalAlignment.LEFT),
|
||||
ftileFactory.skinParam());
|
||||
FtileDiamondInside3 diamond = new FtileDiamondInside3(branch.skinParam(), backColor, borderColor, swimlane,
|
||||
tbTest);
|
||||
FtileDiamondInside2 diamond = new FtileDiamondInside2(tbTest, branch.skinParam(), backColor, borderColor,
|
||||
swimlane);
|
||||
|
||||
diamond = diamond.withEast(tb1);
|
||||
diamonds.add(diamond);
|
||||
|
||||
if (Display.isNull(branch.getInlabel()) == false) {
|
||||
final TextBlock tbInlabel = branch.getInlabel().create(fc, HorizontalAlignment.LEFT,
|
||||
ftileFactory.skinParam());
|
||||
west = Math.max(west, tbInlabel.calculateDimension(ftileFactory.getStringBounder()).getWidth());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
final TextBlock tb2 = branch2.getLabelPositive().create(fc, HorizontalAlignment.LEFT, ftileFactory.skinParam());
|
||||
final int last = diamonds.size() - 1;
|
||||
diamonds.set(last, ((FtileDiamondInside3) diamonds.get(last)).withSouth(tb2));
|
||||
final List<Ftile> tiles = new ArrayList<>();
|
||||
|
||||
// diamonds = alignDiamonds(diamonds, ftileFactory.getStringBounder());
|
||||
for (Branch branch : thens) {
|
||||
tiles.add(new FtileMargedWest(branch.getFtile(), west));
|
||||
}
|
||||
|
||||
final Ftile lastDiamond = new FtileDiamond(tiles.get(0).skinParam(), backColor, borderColor, swimlane);
|
||||
|
||||
final Ftile tile2 = new FtileMinWidthCentered(branch2.getFtile(), 30);
|
||||
final FtileIfLongVertical result = new FtileIfLongVertical(diamonds, tiles, tile2, arrowColor, lastDiamond);
|
||||
|
||||
final List<Connection> conns = new ArrayList<>();
|
||||
@ -165,12 +171,17 @@ class FtileIfLongVertical extends AbstractFtile {
|
||||
final Ftile diam = diamonds.get(i);
|
||||
|
||||
final Rainbow color = thens.get(i).getInColor(arrowColor);
|
||||
|
||||
conns.add(result.new ConnectionVerticalIn(diam, ftile, color == null ? arrowColor : color));
|
||||
// conns.add(result.new ConnectionVerticalOut(ftile, arrowColor));
|
||||
}
|
||||
|
||||
for (int i = 0; i < diamonds.size() - 1; i++) {
|
||||
conns.add(result.new ConnectionVertical(diamonds.get(i), diamonds.get(i + 1), arrowColor));
|
||||
final Branch branch = thens.get(i + 1);
|
||||
TextBlock tbInlabel = null;
|
||||
if (Display.isNull(branch.getInlabel()) == false)
|
||||
tbInlabel = branch.getInlabel().create(fc, HorizontalAlignment.LEFT, ftileFactory.skinParam());
|
||||
|
||||
conns.add(result.new ConnectionVertical(diamonds.get(i), diamonds.get(i + 1), arrowColor, tbInlabel));
|
||||
}
|
||||
conns.add(result.new ConnectionThenOut(tiles.get(0), arrowColor));
|
||||
for (int i = 1; i < tiles.size(); i++) {
|
||||
@ -179,7 +190,10 @@ class FtileIfLongVertical extends AbstractFtile {
|
||||
|
||||
final Rainbow topInColor = topInlinkRendering.getRainbow(arrowColor);
|
||||
conns.add(result.new ConnectionIn(topInColor));
|
||||
conns.add(result.new ConnectionLastElse(topInColor));
|
||||
|
||||
final TextBlock tb2 = branch2.getDisplayPositive().create(fc, HorizontalAlignment.LEFT,
|
||||
ftileFactory.skinParam());
|
||||
conns.add(result.new ConnectionLastElse(topInColor, tb2));
|
||||
conns.add(result.new ConnectionLastElseOut(arrowColor));
|
||||
|
||||
return FtileUtils.addConnection(result, conns);
|
||||
@ -247,10 +261,12 @@ class FtileIfLongVertical extends AbstractFtile {
|
||||
class ConnectionVertical extends AbstractConnection {
|
||||
|
||||
private final Rainbow color;
|
||||
private final TextBlock label;
|
||||
|
||||
public ConnectionVertical(Ftile diamond1, Ftile diamond2, Rainbow color) {
|
||||
public ConnectionVertical(Ftile diamond1, Ftile diamond2, Rainbow color, TextBlock label) {
|
||||
super(diamond1, diamond2);
|
||||
this.color = color;
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
@ -258,7 +274,7 @@ class FtileIfLongVertical extends AbstractFtile {
|
||||
final Point2D p1 = getP1(stringBounder);
|
||||
final Point2D p2 = getP2(stringBounder);
|
||||
|
||||
final Snake snake = Snake.create(color, Arrows.asToDown());
|
||||
final Snake snake = Snake.create(color, Arrows.asToDown()).withLabel(label, VerticalAlignment.CENTER);
|
||||
snake.addPoint(p1);
|
||||
snake.addPoint(p2);
|
||||
ug.draw(snake);
|
||||
@ -279,10 +295,12 @@ class FtileIfLongVertical extends AbstractFtile {
|
||||
class ConnectionLastElse extends AbstractConnection {
|
||||
|
||||
private final Rainbow arrowColor;
|
||||
private final TextBlock label;
|
||||
|
||||
public ConnectionLastElse(Rainbow arrowColor) {
|
||||
public ConnectionLastElse(Rainbow arrowColor, TextBlock label) {
|
||||
super(diamonds.get(diamonds.size() - 1), tile2);
|
||||
this.arrowColor = arrowColor;
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
@ -294,7 +312,7 @@ class FtileIfLongVertical extends AbstractFtile {
|
||||
final Point2D p2 = getTranslate2(stringBounder)
|
||||
.getTranslated(getFtile2().calculateDimension(stringBounder).getPointIn());
|
||||
|
||||
final Snake snake = Snake.create(arrowColor, Arrows.asToDown());
|
||||
final Snake snake = Snake.create(arrowColor, Arrows.asToDown()).withLabel(label, VerticalAlignment.CENTER);
|
||||
snake.addPoint(p1);
|
||||
snake.addPoint(p1.getX(), p2.getY() - 15);
|
||||
snake.addPoint(p2.getX(), p2.getY() - 15);
|
||||
@ -480,21 +498,22 @@ class FtileIfLongVertical extends AbstractFtile {
|
||||
|
||||
private FtileGeometry calculateDimensionInternal(StringBounder stringBounder) {
|
||||
double col1 = 0;
|
||||
double col1overpass = 0;
|
||||
// double col1overpass = 0;
|
||||
double col2 = 0;
|
||||
double height = marginy1;
|
||||
for (int i = 0; i < tiles.size(); i++) {
|
||||
final FtileGeometry dim1 = tiles.get(i).calculateDimension(stringBounder);
|
||||
final FtileGeometry diamondOverpassing = ((FtileOverpassing) diamonds.get(i))
|
||||
.getOverpassDimension(stringBounder);
|
||||
// final FtileGeometry diamondOverpassing = ((FtileOverpassing) diamonds.get(i))
|
||||
// .getOverpassDimension(stringBounder);
|
||||
final FtileGeometry diamondDim = diamonds.get(i).calculateDimension(stringBounder);
|
||||
|
||||
height += diamondDim.getHeight() + dim1.getHeight();
|
||||
col1 = Math.max(col1, diamondDim.getWidth());
|
||||
col1overpass = Math.max(col1overpass, diamondOverpassing.getWidth());
|
||||
// col1overpass = Math.max(col1overpass, diamondOverpassing.getWidth());
|
||||
col2 = Math.max(col2, dim1.getWidth());
|
||||
}
|
||||
final double width = Math.max(col1 + col2, col1overpass);
|
||||
// final double width = Math.max(col1 + col2, col1overpass);
|
||||
final double width = col1 + col2;
|
||||
FtileGeometry result = new FtileGeometry(width, height, width / 2, 0);
|
||||
|
||||
final FtileGeometry dimTile2 = tile2.calculateDimension(stringBounder);
|
||||
|
@ -54,7 +54,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.ConnectionTranslatable;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Hexagon;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileEmpty;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||
@ -121,7 +121,8 @@ class FtileRepeat extends AbstractFtile {
|
||||
FontConfiguration fcDiamond, FontConfiguration fcArrow, Ftile backward, boolean noOut,
|
||||
LinkRendering incoming1, LinkRendering incoming2) {
|
||||
|
||||
final FontConfiguration fontConfiguration1 = conditionStyle == ConditionStyle.INSIDE_HEXAGON ? fcDiamond : fcArrow;
|
||||
final FontConfiguration fontConfiguration1 = conditionStyle == ConditionStyle.INSIDE_HEXAGON ? fcDiamond
|
||||
: fcArrow;
|
||||
|
||||
final TextBlock tbTest = (Display.isNull(test) || test.isWhite()) ? TextBlockUtils.empty(0, 0)
|
||||
: test.create(fontConfiguration1, repeat.skinParam().getDefaultTextAlignment(HorizontalAlignment.LEFT),
|
||||
@ -142,7 +143,7 @@ class FtileRepeat extends AbstractFtile {
|
||||
if (noOut && Display.isNull(test)) {
|
||||
diamond2 = new FtileEmpty(repeat.skinParam());
|
||||
} else {
|
||||
diamond2 = new FtileDiamondInside(repeat.skinParam(), diamondColor, borderColor, swimlaneOut, tbTest)
|
||||
diamond2 = new FtileDiamondInside(tbTest, repeat.skinParam(), diamondColor, borderColor, swimlaneOut)
|
||||
.withEast(yesTb).withSouth(outTb);
|
||||
}
|
||||
result = new FtileRepeat(repeat, diamond1, diamond2, TextBlockUtils.empty(0, 0), backward);
|
||||
@ -151,8 +152,8 @@ class FtileRepeat extends AbstractFtile {
|
||||
.withEast(tbTest);
|
||||
result = new FtileRepeat(repeat, diamond1, diamond2, tbTest, backward);
|
||||
} else if (conditionStyle == ConditionStyle.INSIDE_DIAMOND) {
|
||||
final Ftile diamond2 = new FtileDiamondSquare(repeat.skinParam(), diamondColor, borderColor, swimlane,
|
||||
tbTest);
|
||||
final Ftile diamond2 = new FtileDiamondSquare(tbTest, repeat.skinParam(), diamondColor, borderColor,
|
||||
swimlane);
|
||||
result = new FtileRepeat(repeat, diamond1, diamond2, TextBlockUtils.empty(0, 0), backward);
|
||||
} else {
|
||||
throw new IllegalStateException();
|
||||
@ -164,26 +165,24 @@ class FtileRepeat extends AbstractFtile {
|
||||
: in1.create7(fcArrow, HorizontalAlignment.LEFT, spriteContainer, CreoleMode.SIMPLE_LINE);
|
||||
conns.add(result.new ConnectionIn(repeat.getInLinkRendering().getRainbow(arrowColor), tbin1));
|
||||
|
||||
final TextBlock incomingText = incoming1 == null || incoming1.getDisplay() == null ? null
|
||||
: incoming1.getDisplay().create7(fcArrow, HorizontalAlignment.LEFT, spriteContainer,
|
||||
CreoleMode.SIMPLE_LINE);
|
||||
final TextBlock incomingText;
|
||||
if (incoming1 == null || incoming1.getDisplay() == null)
|
||||
incomingText = null;
|
||||
else
|
||||
incomingText = incoming1.getDisplay().create7(fcArrow, HorizontalAlignment.LEFT, spriteContainer,
|
||||
CreoleMode.SIMPLE_LINE);
|
||||
|
||||
if (repeat.getSwimlaneIn() == null || repeat.getSwimlaneIn() == swimlaneOut) {
|
||||
if (backward == null) {
|
||||
conns.add(result.new ConnectionBackSimple(incoming1.getRainbow(arrowColor), incomingText));
|
||||
} else {
|
||||
final Rainbow rainbow1 = incoming1.getRainbow(arrowColor);
|
||||
conns.add(result.new ConnectionBackBackward1(rainbow1, incomingText));
|
||||
final TextBlock backArrowLabel = incoming2 == null || incoming2.getDisplay() == null ? null
|
||||
: incoming2.getDisplay().create(fcArrow, HorizontalAlignment.LEFT, spriteContainer);
|
||||
final Rainbow rainbow2 = incoming2.getRainbow(arrowColor);
|
||||
conns.add(result.new ConnectionBackBackward2(rainbow2, backArrowLabel));
|
||||
}
|
||||
if (backward != null) {
|
||||
final Rainbow rainbow1 = incoming1.getRainbow(arrowColor);
|
||||
conns.add(result.new ConnectionBackBackward1(rainbow1, incomingText));
|
||||
final TextBlock backArrowLabel = incoming2 == null || incoming2.getDisplay() == null ? null
|
||||
: incoming2.getDisplay().create(fcArrow, HorizontalAlignment.LEFT, spriteContainer);
|
||||
final Rainbow rainbow2 = incoming2.getRainbow(arrowColor);
|
||||
conns.add(result.new ConnectionBackBackward2(rainbow2, backArrowLabel));
|
||||
} else if (repeat.getSwimlaneIn() == null || repeat.getSwimlaneIn() == swimlaneOut) {
|
||||
conns.add(result.new ConnectionBackSimple(incoming1.getRainbow(arrowColor), incomingText));
|
||||
} else {
|
||||
conns.add(result.new ConnectionBackComplex1(incoming1.getRainbow(arrowColor)));
|
||||
// conns.add(result.new
|
||||
// ConnectionBackComplexHorizontalOnly(incoming1.getRainbow(arrowColor),
|
||||
// incomingText));
|
||||
}
|
||||
|
||||
final Display out1 = repeat.getOutLinkRendering().getDisplay();
|
||||
@ -219,8 +218,15 @@ class FtileRepeat extends AbstractFtile {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
|
||||
final Snake snake = Snake.create(arrowColor, Arrows.asToDown()).withLabel(tbin, arrowHorizontalAlignment());
|
||||
snake.addPoint(getP1(stringBounder));
|
||||
snake.addPoint(getP2(stringBounder));
|
||||
final Point2D p1 = getP1(stringBounder);
|
||||
final Point2D p2 = getP2(stringBounder);
|
||||
snake.addPoint(p1);
|
||||
if (p1.getX() != p2.getX()) {
|
||||
final double my = (p1.getY() + p2.getY()) / 2;
|
||||
snake.addPoint(new Point2D.Double(p1.getX(), my));
|
||||
snake.addPoint(new Point2D.Double(p2.getX(), my));
|
||||
}
|
||||
snake.addPoint(p2);
|
||||
|
||||
ug.draw(snake);
|
||||
}
|
||||
@ -260,6 +266,7 @@ class FtileRepeat extends AbstractFtile {
|
||||
ug.draw(snake);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
if (getFtile1().calculateDimension(stringBounder).hasPointOut() == false) {
|
||||
@ -304,6 +311,7 @@ class FtileRepeat extends AbstractFtile {
|
||||
// throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final Dimension2D dimRepeat = repeat.calculateDimension(stringBounder);
|
||||
@ -321,7 +329,7 @@ class FtileRepeat extends AbstractFtile {
|
||||
final double x1_a = p1.getX() + dimDiamond2.getWidth();
|
||||
|
||||
final double x1_b = p1.getX() + dimDiamond2.getWidth() / 2 + dimRepeat.getWidth() / 2
|
||||
+ Diamond.diamondHalfSize;
|
||||
+ Hexagon.hexagonHalfSize;
|
||||
|
||||
UPolygon arrow = Arrows.asToLeft();
|
||||
if (x1_b < x2) {
|
||||
@ -345,39 +353,6 @@ class FtileRepeat extends AbstractFtile {
|
||||
|
||||
}
|
||||
|
||||
// class ConnectionBackComplexHorizontalOnly extends AbstractConnection {
|
||||
// private final Rainbow arrowColor;
|
||||
// private final TextBlock tbback;
|
||||
//
|
||||
// public ConnectionBackComplexHorizontalOnly(Rainbow arrowColor, TextBlock tbback) {
|
||||
// super(diamond2, diamond2);
|
||||
// this.arrowColor = arrowColor;
|
||||
// this.tbback = tbback;
|
||||
// }
|
||||
//
|
||||
// private Point2D getP1(final StringBounder stringBounder) {
|
||||
// return getTranslateDiamond2(stringBounder).getTranslated(new Point2D.Double(0, 0));
|
||||
// }
|
||||
//
|
||||
// public void drawU(UGraphic ug) {
|
||||
// final StringBounder stringBounder = ug.getStringBounder();
|
||||
//
|
||||
// final Snake snake = Snake.create(arrowColor, null).withLabel(tbback, arrowHorizontalAlignment());
|
||||
// final Dimension2D dimRepeat = repeat.calculateDimension(stringBounder);
|
||||
// final Point2D p1 = getP1(stringBounder);
|
||||
// final Dimension2D dimDiamond2 = diamond2.calculateDimension(stringBounder);
|
||||
// final double x1 = p1.getX() + dimDiamond2.getWidth();
|
||||
// final double y1 = p1.getY() + dimDiamond2.getHeight() / 2;
|
||||
//
|
||||
// snake.addPoint(x1, y1);
|
||||
// final double xmax = p1.getX() + dimDiamond2.getWidth() / 2 + dimRepeat.getWidth() / 2
|
||||
// + Diamond.diamondHalfSize;
|
||||
// snake.addPoint(xmax, y1);
|
||||
// ug.draw(snake);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
class ConnectionBackBackward1 extends AbstractConnection {
|
||||
private final Rainbow arrowColor;
|
||||
private final TextBlock tbback;
|
||||
@ -400,7 +375,6 @@ class FtileRepeat extends AbstractFtile {
|
||||
public void drawU(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
|
||||
final Snake snake = Snake.create(arrowColor, Arrows.asToUp()).withLabel(tbback, arrowHorizontalAlignment());
|
||||
final Point2D p1 = getP1(stringBounder);
|
||||
final Point2D p2 = getP2(stringBounder);
|
||||
final Dimension2D dimDiamond2 = diamond2.calculateDimension(stringBounder);
|
||||
@ -409,6 +383,8 @@ class FtileRepeat extends AbstractFtile {
|
||||
final double x2 = p2.getX();
|
||||
final double y2 = p2.getY();
|
||||
|
||||
final Snake snake = Snake.create(arrowColor, Arrows.asToUp()).withLabel(tbback, arrowHorizontalAlignment());
|
||||
|
||||
snake.addPoint(x1, y1);
|
||||
snake.addPoint(x2, y1);
|
||||
snake.addPoint(x2, y2);
|
||||
@ -418,7 +394,7 @@ class FtileRepeat extends AbstractFtile {
|
||||
|
||||
}
|
||||
|
||||
class ConnectionBackBackward2 extends AbstractConnection {
|
||||
class ConnectionBackBackward2 extends AbstractConnection implements ConnectionTranslatable {
|
||||
private final Rainbow arrowColor;
|
||||
private final TextBlock label;
|
||||
|
||||
@ -437,11 +413,41 @@ class FtileRepeat extends AbstractFtile {
|
||||
return getTranslateDiamond1(stringBounder).getTranslated(new Point2D.Double(0, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
|
||||
Point2D p1 = getP1(stringBounder);
|
||||
Point2D p2 = getP2(stringBounder);
|
||||
p1 = translate1.getTranslated(p1);
|
||||
p2 = translate2.getTranslated(p2);
|
||||
|
||||
final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
||||
|
||||
final double x1 = p1.getX();
|
||||
final double y1 = p1.getY();
|
||||
double x2 = p2.getX();
|
||||
if (x2 < x1)
|
||||
x2 += dimDiamond1.getWidth();
|
||||
final double y2 = p2.getY() + dimDiamond1.getHeight() / 2;
|
||||
|
||||
Snake snake = Snake.create(arrowColor, x2 < x1 ? Arrows.asToLeft() : Arrows.asToRight());
|
||||
if (label != null) {
|
||||
snake = snake.withLabel(label, arrowHorizontalAlignment());
|
||||
}
|
||||
|
||||
snake.addPoint(x1, y1);
|
||||
snake.addPoint(x1, y2);
|
||||
snake.addPoint(x2, y2);
|
||||
|
||||
ug.draw(snake);
|
||||
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
|
||||
Snake snake = Snake.create(arrowColor, Arrows.asToLeft());
|
||||
// .emphasizeDirection(Direction.UP);
|
||||
if (label != null) {
|
||||
snake = snake.withLabel(label, arrowHorizontalAlignment());
|
||||
}
|
||||
@ -496,7 +502,7 @@ class FtileRepeat extends AbstractFtile {
|
||||
final double y2 = p2.getY() + dimDiamond1.getHeight() / 2;
|
||||
|
||||
snake.addPoint(x1, y1);
|
||||
final double xmax = dimTotal.getWidth() - Diamond.diamondHalfSize;
|
||||
final double xmax = dimTotal.getWidth() - Hexagon.hexagonHalfSize;
|
||||
snake.addPoint(xmax, y1);
|
||||
snake.addPoint(xmax, y2);
|
||||
snake.addPoint(x2, y2);
|
||||
@ -504,6 +510,7 @@ class FtileRepeat extends AbstractFtile {
|
||||
ug.draw(snake);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final Snake snake = Snake.create(arrowColor, Arrows.asToLeft()).emphasizeDirection(Direction.UP)
|
||||
@ -523,7 +530,7 @@ class FtileRepeat extends AbstractFtile {
|
||||
|
||||
snake.addPoint(x1, y1);
|
||||
final double xmax = p1.getX() + dimDiamond2.getWidth() / 2 + dimRepeat.getWidth() / 2
|
||||
+ Diamond.diamondHalfSize;
|
||||
+ Hexagon.hexagonHalfSize;
|
||||
snake.addPoint(xmax, y1);
|
||||
snake.addPoint(xmax, y2);
|
||||
snake.addPoint(x2, y2);
|
||||
@ -558,13 +565,13 @@ class FtileRepeat extends AbstractFtile {
|
||||
final double w = tbTest.calculateDimension(stringBounder).getWidth();
|
||||
|
||||
double width = getLeft(stringBounder) + getRight(stringBounder);
|
||||
width = Math.max(width, w + 2 * Diamond.diamondHalfSize);
|
||||
width = Math.max(width, w + 2 * Hexagon.hexagonHalfSize);
|
||||
if (backward != null) {
|
||||
width += backward.calculateDimension(stringBounder).getWidth();
|
||||
}
|
||||
final double height = dimDiamond1.getHeight() + dimRepeat.getHeight() + dimDiamond2.getHeight()
|
||||
+ 8 * Diamond.diamondHalfSize;
|
||||
return new Dimension2DDouble(width + 2 * Diamond.diamondHalfSize, height);
|
||||
+ 8 * Hexagon.hexagonHalfSize;
|
||||
return new Dimension2DDouble(width + 2 * Hexagon.hexagonHalfSize, height);
|
||||
|
||||
}
|
||||
|
||||
|
@ -108,15 +108,15 @@ class FtileSwitch extends AbstractFtile {
|
||||
|
||||
List<Double> inlabelSizes = new ArrayList<>();
|
||||
for (Branch branch : thens) {
|
||||
final TextBlock tb1 = branch.getLabelPositive().create(fcArrow, HorizontalAlignment.LEFT,
|
||||
final TextBlock tb1 = branch.getDisplayPositive().create(fcArrow, HorizontalAlignment.LEFT,
|
||||
ftileFactory.skinParam());
|
||||
final TextBlock tbTest = branch.getLabelTest().create(fcTest,
|
||||
ftileFactory.skinParam().getDefaultTextAlignment(HorizontalAlignment.LEFT),
|
||||
ftileFactory.skinParam());
|
||||
final HColor diamondColor = branch.getColor() == null ? backColor : branch.getColor();
|
||||
|
||||
FtileDiamondInside2 diamond = new FtileDiamondInside2(branch.skinParam(), diamondColor, borderColor,
|
||||
swimlane, tbTest);
|
||||
FtileDiamondInside2 diamond = new FtileDiamondInside2(tbTest, branch.skinParam(), diamondColor,
|
||||
borderColor, swimlane);
|
||||
TextBlock tbInlabel = null;
|
||||
if (Display.isNull(branch.getInlabel())) {
|
||||
inlabelSizes.add(0.0);
|
||||
|
@ -52,7 +52,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.ConnectionTranslatable;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Hexagon;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||
@ -127,10 +127,10 @@ class FtileWhile extends AbstractFtile {
|
||||
|
||||
final Ftile diamond1;
|
||||
if (conditionStyle == ConditionStyle.INSIDE_HEXAGON) {
|
||||
diamond1 = new FtileDiamondInside(whileBlock.skinParam(), backColor, borderColor, swimlane, testTb)
|
||||
diamond1 = new FtileDiamondInside(testTb, whileBlock.skinParam(), backColor, borderColor, swimlane)
|
||||
.withNorth(yesTb).withWest(outTb);
|
||||
} else if (conditionStyle == ConditionStyle.INSIDE_DIAMOND) {
|
||||
diamond1 = new FtileDiamondSquare(whileBlock.skinParam(), backColor, borderColor, swimlane, testTb)
|
||||
diamond1 = new FtileDiamondSquare(testTb, whileBlock.skinParam(), backColor, borderColor, swimlane)
|
||||
.withNorth(yesTb).withWest(outTb);
|
||||
} else if (conditionStyle == ConditionStyle.EMPTY_DIAMOND) {
|
||||
diamond1 = new FtileDiamond(whileBlock.skinParam(), backColor, borderColor, swimlane).withNorth(testTb)
|
||||
@ -196,6 +196,7 @@ class FtileWhile extends AbstractFtile {
|
||||
ug.draw(snake);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final Point2D p1 = getP1(stringBounder);
|
||||
@ -259,7 +260,7 @@ class FtileWhile extends AbstractFtile {
|
||||
final Snake snake = Snake.create(endInlinkColor, Arrows.asToLeft()).emphasizeDirection(Direction.UP)
|
||||
.withLabel(back, arrowHorizontalAlignment());
|
||||
snake.addPoint(x1, y1);
|
||||
final double y1bis = Math.max(y1, getBottom(stringBounder)) + Diamond.diamondHalfSize;
|
||||
final double y1bis = Math.max(y1, getBottom(stringBounder)) + Hexagon.hexagonHalfSize;
|
||||
snake.addPoint(x1, y1bis);
|
||||
final double xx = dimTotal.getWidth();
|
||||
snake.addPoint(xx, y1bis);
|
||||
@ -267,10 +268,11 @@ class FtileWhile extends AbstractFtile {
|
||||
snake.addPoint(x2, y2);
|
||||
|
||||
ug.draw(snake);
|
||||
ug.apply(new UTranslate(x1, y1bis)).draw(new UEmpty(5, Diamond.diamondHalfSize));
|
||||
ug.apply(new UTranslate(x1, y1bis)).draw(new UEmpty(5, Hexagon.hexagonHalfSize));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final Snake snake = Snake.create(endInlinkColor, Arrows.asToLeft()).withMerge(MergeStrategy.LIMITED);
|
||||
@ -289,15 +291,15 @@ class FtileWhile extends AbstractFtile {
|
||||
final double y2 = p2.getY() + dimDiamond1.getInY() + half;
|
||||
|
||||
snake.addPoint(x1, y1);
|
||||
snake.addPoint(x1, y1 + Diamond.diamondHalfSize);
|
||||
snake.addPoint(x1, y1 + Hexagon.hexagonHalfSize);
|
||||
final double xx = Math.max(translate1.getDx(), translate2.getDx()) + dimTotal.getWidth();
|
||||
snake.addPoint(xx, y1 + Diamond.diamondHalfSize);
|
||||
snake.addPoint(xx, y1 + Hexagon.hexagonHalfSize);
|
||||
snake.addPoint(xx, y2);
|
||||
snake.addPoint(x2, y2);
|
||||
|
||||
ug.draw(snake);
|
||||
|
||||
ug.apply(new UTranslate(x1, y1 + Diamond.diamondHalfSize)).draw(new UEmpty(5, Diamond.diamondHalfSize));
|
||||
ug.apply(new UTranslate(x1, y1 + Hexagon.hexagonHalfSize)).draw(new UEmpty(5, Hexagon.hexagonHalfSize));
|
||||
|
||||
ug = ug.apply(endInlinkColor.getColor()).apply(endInlinkColor.getColor().bg());
|
||||
ug.apply(new UTranslate(xx, (y1 + y2) / 2)).draw(Arrows.asToUp());
|
||||
@ -350,13 +352,13 @@ class FtileWhile extends AbstractFtile {
|
||||
final Snake snake = Snake.create(endInlinkColor, Arrows.asToUp()).withLabel(back,
|
||||
arrowHorizontalAlignment());
|
||||
snake.addPoint(x1, y1);
|
||||
final double y1bis = Math.max(y1, getBottom(stringBounder)) + Diamond.diamondHalfSize;
|
||||
final double y1bis = Math.max(y1, getBottom(stringBounder)) + Hexagon.hexagonHalfSize;
|
||||
snake.addPoint(x1, y1bis);
|
||||
snake.addPoint(x2, y1bis);
|
||||
snake.addPoint(x2, y2);
|
||||
|
||||
ug.draw(snake);
|
||||
ug.apply(new UTranslate(x1, y1bis)).draw(new UEmpty(5, Diamond.diamondHalfSize));
|
||||
ug.apply(new UTranslate(x1, y1bis)).draw(new UEmpty(5, Hexagon.hexagonHalfSize));
|
||||
}
|
||||
}
|
||||
|
||||
@ -442,7 +444,7 @@ class FtileWhile extends AbstractFtile {
|
||||
final double y2 = p2.getY() + dimDiamond1.getInY() + half;
|
||||
|
||||
snake.addPoint(x1, y1);
|
||||
final double y1bis = Math.max(y1, getBottom(stringBounder)) + Diamond.diamondHalfSize;
|
||||
final double y1bis = Math.max(y1, getBottom(stringBounder)) + Hexagon.hexagonHalfSize;
|
||||
snake.addPoint(x1, y1bis);
|
||||
final double xx = dimTotal.getWidth();
|
||||
snake.addPoint(xx, y1bis);
|
||||
@ -451,7 +453,7 @@ class FtileWhile extends AbstractFtile {
|
||||
|
||||
ug.draw(snake);
|
||||
|
||||
ug.apply(new UTranslate(x1, y1bis)).draw(new UEmpty(5, Diamond.diamondHalfSize));
|
||||
ug.apply(new UTranslate(x1, y1bis)).draw(new UEmpty(5, Hexagon.hexagonHalfSize));
|
||||
|
||||
}
|
||||
|
||||
@ -491,13 +493,13 @@ class FtileWhile extends AbstractFtile {
|
||||
final double y2 = p2.getY();
|
||||
|
||||
snake.addPoint(x1, y1);
|
||||
snake.addPoint(Diamond.diamondHalfSize, y1);
|
||||
snake.addPoint(Diamond.diamondHalfSize, y2);
|
||||
snake.addPoint(Hexagon.hexagonHalfSize, y1);
|
||||
snake.addPoint(Hexagon.hexagonHalfSize, y2);
|
||||
|
||||
ug.draw(snake);
|
||||
|
||||
final Snake snake2 = Snake.create(afterEndwhileColor);
|
||||
snake2.addPoint(Diamond.diamondHalfSize, y2);
|
||||
snake2.addPoint(Hexagon.hexagonHalfSize, y2);
|
||||
snake2.addPoint(x2, y2);
|
||||
// snake2.goUnmergeable(MergeStrategy.LIMITED);
|
||||
ug.draw(snake2);
|
||||
@ -577,14 +579,14 @@ class FtileWhile extends AbstractFtile {
|
||||
assert false;
|
||||
}
|
||||
final FtileGeometry geo = geoDiamond1.appendBottom(geoWhile);
|
||||
final double height = geo.getHeight() + 4 * Diamond.diamondHalfSize;
|
||||
final double dx = 2 * Diamond.diamondHalfSize;
|
||||
final double height = geo.getHeight() + 4 * Hexagon.hexagonHalfSize;
|
||||
final double dx = 2 * Hexagon.hexagonHalfSize;
|
||||
double backwardWidth = 0;
|
||||
if (backward != null) {
|
||||
backwardWidth += backward.calculateDimension(stringBounder).getWidth();
|
||||
}
|
||||
return new FtileGeometry(
|
||||
xDeltaBecauseSpecial(stringBounder) + geo.getWidth() + dx + Diamond.diamondHalfSize + backwardWidth,
|
||||
xDeltaBecauseSpecial(stringBounder) + geo.getWidth() + dx + Hexagon.hexagonHalfSize + backwardWidth,
|
||||
height, xDeltaBecauseSpecial(stringBounder) + geo.getLeft() + dx, geoDiamond1.getInY(), height);
|
||||
|
||||
}
|
||||
@ -633,8 +635,8 @@ class FtileWhile extends AbstractFtile {
|
||||
private UTranslate getTranslateForSpecial(StringBounder stringBounder) {
|
||||
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
||||
final double half = (dimDiamond1.getOutY() - dimDiamond1.getInY()) / 2;
|
||||
final double y1 = Math.max(3 * half, 4 * Diamond.diamondHalfSize);
|
||||
final double xWhile = getTranslateForWhile(stringBounder).getDx() - Diamond.diamondHalfSize;
|
||||
final double y1 = Math.max(3 * half, 4 * Hexagon.hexagonHalfSize);
|
||||
final double xWhile = getTranslateForWhile(stringBounder).getDx() - Hexagon.hexagonHalfSize;
|
||||
final double xDiamond = getTranslateDiamond1(stringBounder).getDx();
|
||||
// final double x1 = xWhile - xDeltaBecauseSpecial(stringBounder);
|
||||
final double x1 = Math.min(xWhile, xDiamond) - xDeltaBecauseSpecial(stringBounder);
|
||||
|
@ -84,7 +84,6 @@ public class FtileWithNoteOpale extends AbstractFtile implements Stencil, Stylea
|
||||
private final Ftile tile;
|
||||
private final Opale opale;
|
||||
|
||||
// private final HtmlColor arrowColor;
|
||||
private final NotePosition notePosition;
|
||||
private final double suppSpace = 20;
|
||||
private final Swimlane swimlaneNote;
|
||||
@ -184,6 +183,13 @@ public class FtileWithNoteOpale extends AbstractFtile implements Stencil, Stylea
|
||||
}
|
||||
|
||||
return new UTranslate(marge, yForFtile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UTranslate getTranslateFor(Ftile child, StringBounder stringBounder) {
|
||||
if (child == tile)
|
||||
return new UTranslate();
|
||||
return super.getTranslateFor(child, stringBounder);
|
||||
|
||||
}
|
||||
|
||||
|
@ -244,6 +244,7 @@ public class ParallelBuilderFork extends AbstractParallelFtilesBuilder {
|
||||
ug.draw(snake);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
ug = ug.apply(UTranslate.dx(x));
|
||||
final FtileGeometry geo2 = getFtile2().calculateDimension(getStringBounder());
|
||||
@ -297,6 +298,7 @@ public class ParallelBuilderFork extends AbstractParallelFtilesBuilder {
|
||||
ug.draw(snake);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
ug = ug.apply(UTranslate.dx(x));
|
||||
final FtileGeometry geo = getFtile1().calculateDimension(getStringBounder());
|
||||
|
@ -225,6 +225,7 @@ public class ParallelBuilderMerge extends AbstractParallelFtilesBuilder {
|
||||
ug.draw(snake);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
ug = ug.apply(UTranslate.dx(x));
|
||||
final FtileGeometry geo = getFtile2().calculateDimension(getStringBounder());
|
||||
|
@ -236,6 +236,7 @@ public class ParallelBuilderSplit extends AbstractParallelFtilesBuilder {
|
||||
ug.draw(snake);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
ug = ug.apply(UTranslate.dx(x));
|
||||
final FtileGeometry geo = getFtile2().calculateDimension(getStringBounder());
|
||||
@ -292,6 +293,7 @@ public class ParallelBuilderSplit extends AbstractParallelFtilesBuilder {
|
||||
ug.draw(snake);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
ug = ug.apply(UTranslate.dx(x));
|
||||
final FtileGeometry geo = getFtile1().calculateDimension(getStringBounder());
|
||||
|
@ -42,7 +42,7 @@ import net.sourceforge.plantuml.LineBreakStrategy;
|
||||
import net.sourceforge.plantuml.Url;
|
||||
import net.sourceforge.plantuml.UseStyle;
|
||||
import net.sourceforge.plantuml.activitydiagram3.Branch;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Hexagon;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileEmpty;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||
@ -78,6 +78,8 @@ public class ConditionalBuilder {
|
||||
private final Swimlane swimlane;
|
||||
private final HColor borderColor;
|
||||
private final HColor backColor;
|
||||
private final LineBreakStrategy diamondLineBreak;
|
||||
private final LineBreakStrategy labelLineBreak;
|
||||
private final Rainbow arrowColor;
|
||||
private final FtileFactory ftileFactory;
|
||||
private final ConditionStyle conditionStyle;
|
||||
@ -110,6 +112,8 @@ public class ConditionalBuilder {
|
||||
.getMergedStyle(skinParam.getCurrentStyleBuilder());
|
||||
final Style styleDiamond = getDefaultStyleDefinitionDiamond()
|
||||
.getMergedStyle(skinParam.getCurrentStyleBuilder());
|
||||
this.diamondLineBreak = styleDiamond.wrapWidth();
|
||||
this.labelLineBreak = styleArrow.wrapWidth();
|
||||
this.borderColor = styleDiamond.value(PName.LineColor).asColor(skinParam.getThemeStyle(),
|
||||
skinParam.getIHtmlColorSet());
|
||||
this.backColor = styleDiamond.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(),
|
||||
@ -120,6 +124,8 @@ public class ConditionalBuilder {
|
||||
this.fontTest = styleDiamond.getFontConfiguration(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet());
|
||||
this.fontArrow = styleArrow.getFontConfiguration(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet());
|
||||
} else {
|
||||
this.diamondLineBreak = LineBreakStrategy.NONE;
|
||||
this.labelLineBreak = LineBreakStrategy.NONE;
|
||||
this.borderColor = borderColor;
|
||||
this.backColor = backColor;
|
||||
this.arrowColor = arrowColor;
|
||||
@ -174,8 +180,8 @@ public class ConditionalBuilder {
|
||||
final Ftile tile2 = new FtileMinWidthCentered(branch2.getFtile(), 30);
|
||||
final TextBlock tb1 = getLabelPositive(branch1);
|
||||
final TextBlock tb2 = getLabelPositive(branch2);
|
||||
final Ftile diamond1 = getDiamond1(false, tb1, tb2);
|
||||
final Ftile diamond2 = getDiamond2(branch1, branch2, true);
|
||||
final Ftile diamond1 = getShape1(false, tb1, tb2);
|
||||
final Ftile diamond2 = getShape2(branch1, branch2, true);
|
||||
if (branch2.isOnlySingleStopOrSpot()) {
|
||||
return FtileIfDown.create(diamond1, diamond2, swimlane, FtileUtils.addHorizontalMargin(tile1, 10),
|
||||
arrowColor, conditionEndStyle, ftileFactory, branch2.getFtile(), branch2.getOut());
|
||||
@ -199,7 +205,7 @@ public class ConditionalBuilder {
|
||||
|
||||
private Ftile createWithDiamonds() {
|
||||
final Ftile diamond1 = getDiamond1(true);
|
||||
final Ftile diamond2 = getDiamond2(branch1, branch2, false);
|
||||
final Ftile diamond2 = getShape2(branch1, branch2, false);
|
||||
final FtileIfWithDiamonds ftile = new FtileIfWithDiamonds(diamond1, tile1, tile2, diamond2, swimlane,
|
||||
stringBounder);
|
||||
final Dimension2D label1 = getLabelPositive(branch1).calculateDimension(stringBounder);
|
||||
@ -217,7 +223,7 @@ public class ConditionalBuilder {
|
||||
if (url != null) {
|
||||
diamond1 = new FtileWithUrl(diamond1, url);
|
||||
}
|
||||
final Ftile diamond2 = getDiamond2(branch1, branch2, false);
|
||||
final Ftile diamond2 = getShape2(branch1, branch2, false);
|
||||
final Ftile tmp1 = FtileUtils.addHorizontalMargin(tile1, 10);
|
||||
final Ftile tmp2 = FtileUtils.addHorizontalMargin(tile2, 10);
|
||||
final FtileIfWithLinks ftile = new FtileIfWithLinks(diamond1, tmp1, tmp2, diamond2, swimlane, arrowColor,
|
||||
@ -234,57 +240,57 @@ public class ConditionalBuilder {
|
||||
}
|
||||
|
||||
private Ftile getDiamond1(boolean eastWest) {
|
||||
return getDiamond1(eastWest, getLabelPositive(branch1), getLabelPositive(branch2));
|
||||
return getShape1(eastWest, getLabelPositive(branch1), getLabelPositive(branch2));
|
||||
}
|
||||
|
||||
private Ftile getDiamond1(boolean eastWest, TextBlock tb1, TextBlock tb2) {
|
||||
private Ftile getShape1(boolean eastWest, TextBlock tb1, TextBlock tb2) {
|
||||
final Display labelTest = branch1.getLabelTest();
|
||||
|
||||
final Sheet sheet = Parser.build(fontTest, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT),
|
||||
skinParam, CreoleMode.FULL).createSheet(labelTest);
|
||||
final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, LineBreakStrategy.NONE, skinParam.getPadding());
|
||||
final TextBlock tbTest = new SheetBlock2(sheetBlock1, Diamond.asStencil(sheetBlock1), tile1.getThickness());
|
||||
final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, diamondLineBreak, skinParam.getPadding());
|
||||
final TextBlock tbTest = new SheetBlock2(sheetBlock1, Hexagon.asStencil(sheetBlock1), tile1.getThickness());
|
||||
|
||||
final Ftile diamond1;
|
||||
final Ftile shape1;
|
||||
if (conditionStyle == ConditionStyle.INSIDE_HEXAGON) {
|
||||
if (eastWest) {
|
||||
diamond1 = new FtileDiamondInside(tile1.skinParam(), backColor, borderColor, swimlane, tbTest)
|
||||
shape1 = new FtileDiamondInside(tbTest, tile1.skinParam(), backColor, borderColor, swimlane)
|
||||
.withWestAndEast(tb1, tb2);
|
||||
} else {
|
||||
diamond1 = new FtileDiamondInside(tile1.skinParam(), backColor, borderColor, swimlane, tbTest)
|
||||
shape1 = new FtileDiamondInside(tbTest, tile1.skinParam(), backColor, borderColor, swimlane)
|
||||
.withSouth(tb1).withEast(tb2);
|
||||
}
|
||||
} else if (conditionStyle == ConditionStyle.EMPTY_DIAMOND) {
|
||||
if (eastWest) {
|
||||
diamond1 = new FtileDiamond(tile1.skinParam(), backColor, borderColor, swimlane).withNorth(tbTest)
|
||||
shape1 = new FtileDiamond(tile1.skinParam(), backColor, borderColor, swimlane).withNorth(tbTest)
|
||||
.withWestAndEast(tb1, tb2);
|
||||
} else {
|
||||
diamond1 = new FtileDiamond(tile1.skinParam(), backColor, borderColor, swimlane).withNorth(tbTest)
|
||||
shape1 = new FtileDiamond(tile1.skinParam(), backColor, borderColor, swimlane).withNorth(tbTest)
|
||||
.withSouth(tb1).withEast(tb2);
|
||||
}
|
||||
} else if (conditionStyle == ConditionStyle.INSIDE_DIAMOND) {
|
||||
if (eastWest) {
|
||||
diamond1 = new FtileDiamondSquare(tile1.skinParam(), backColor, borderColor, swimlane, tbTest)
|
||||
shape1 = new FtileDiamondSquare(tbTest, tile1.skinParam(), backColor, borderColor, swimlane)
|
||||
.withWestAndEast(tb1, tb2);
|
||||
} else {
|
||||
diamond1 = new FtileDiamondSquare(tile1.skinParam(), backColor, borderColor, swimlane, tbTest)
|
||||
shape1 = new FtileDiamondSquare(tbTest, tile1.skinParam(), backColor, borderColor, swimlane)
|
||||
.withSouth(tb1).withEast(tb2);
|
||||
}
|
||||
} else {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
return diamond1;
|
||||
return shape1;
|
||||
}
|
||||
|
||||
private TextBlock getLabelPositive(Branch branch) {
|
||||
return branch.getLabelPositive().create7(fontArrow, HorizontalAlignment.LEFT, ftileFactory.skinParam(),
|
||||
CreoleMode.SIMPLE_LINE);
|
||||
return branch.getDisplayPositive().create0(fontArrow, HorizontalAlignment.LEFT, ftileFactory.skinParam(),
|
||||
labelLineBreak, CreoleMode.SIMPLE_LINE, null, null);
|
||||
}
|
||||
|
||||
private Ftile getDiamond2(Branch branch1, Branch branch2, boolean useNorth) {
|
||||
final Ftile diamond2;
|
||||
private Ftile getShape2(Branch branch1, Branch branch2, boolean useNorth) {
|
||||
final Ftile shape2;
|
||||
if (conditionEndStyle == ConditionEndStyle.HLINE) {
|
||||
return new FtileEmpty(tile1.skinParam(), 0, Diamond.diamondHalfSize, swimlane, swimlane);
|
||||
return new FtileEmpty(tile1.skinParam(), 0, Hexagon.hexagonHalfSize, swimlane);
|
||||
}
|
||||
// else use default ConditionEndStyle.DIAMOND
|
||||
if (hasTwoBranches()) {
|
||||
@ -299,11 +305,11 @@ public class ConditionalBuilder {
|
||||
FtileDiamond tmp = new FtileDiamond(tile1.skinParam(), backColor, borderColor, swimlane);
|
||||
tmp = useNorth ? tmp.withNorth(tbout1) : tmp.withWest(tbout1);
|
||||
tmp = tmp.withEast(tbout2);
|
||||
diamond2 = tmp;
|
||||
shape2 = tmp;
|
||||
} else {
|
||||
diamond2 = new FtileEmpty(tile1.skinParam(), 0, Diamond.diamondHalfSize / 2, swimlane, swimlane);
|
||||
shape2 = new FtileEmpty(tile1.skinParam(), 0, Hexagon.hexagonHalfSize / 2, swimlane);
|
||||
}
|
||||
return diamond2;
|
||||
return shape2;
|
||||
}
|
||||
|
||||
public boolean hasTwoBranches() {
|
||||
|
@ -65,16 +65,13 @@ public class FtileIfWithDiamonds extends FtileIfNude {
|
||||
}
|
||||
|
||||
public int getYdelta1a(StringBounder stringBounder) {
|
||||
// if (getSwimlanes().size() > 1 && hasTwoBranches(stringBounder)) {
|
||||
if (getSwimlanes().size() > 1) {
|
||||
return 20;
|
||||
}
|
||||
return 10;
|
||||
// return hasTwoBranches(stringBounder) ? 6 : 6;
|
||||
}
|
||||
|
||||
public int getYdelta1b(StringBounder stringBounder) {
|
||||
// if (getSwimlanes().size() > 1 && hasTwoBranches(stringBounder)) {
|
||||
if (getSwimlanes().size() > 1) {
|
||||
return 10;
|
||||
}
|
||||
@ -98,9 +95,6 @@ public class FtileIfWithDiamonds extends FtileIfNude {
|
||||
|
||||
return all.addDim(0, getYdelta1a(stringBounder) + getYdelta1b(stringBounder));
|
||||
|
||||
// final double height = dimNude.getHeight() + dim1.getHeight() + dim2.getHeight() + getYdelta1a(stringBounder)
|
||||
// + getYdelta1b(stringBounder);
|
||||
// return new Dimension2DDouble(width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -115,22 +109,21 @@ public class FtileIfWithDiamonds extends FtileIfNude {
|
||||
@Override
|
||||
protected UTranslate getTranslate1(StringBounder stringBounder) {
|
||||
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
||||
return super.getTranslate1(stringBounder).compose(
|
||||
UTranslate.dy(dimDiamond1.getHeight() + getYdelta1a(stringBounder)));
|
||||
return super.getTranslate1(stringBounder)
|
||||
.compose(UTranslate.dy(dimDiamond1.getHeight() + getYdelta1a(stringBounder)));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected UTranslate getTranslate2(StringBounder stringBounder) {
|
||||
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
||||
return super.getTranslate2(stringBounder).compose(
|
||||
UTranslate.dy(dimDiamond1.getHeight() + getYdelta1a(stringBounder)));
|
||||
return super.getTranslate2(stringBounder)
|
||||
.compose(UTranslate.dy(dimDiamond1.getHeight() + getYdelta1a(stringBounder)));
|
||||
}
|
||||
|
||||
protected UTranslate getTranslateDiamond1(StringBounder stringBounder) {
|
||||
final double y1 = 0;
|
||||
final FtileGeometry dimTotal = calculateDimensionInternal(stringBounder);
|
||||
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
||||
// final double x1 = getLeft(stringBounder) - dimDiamond1.getWidth() / 2;
|
||||
final double x1 = dimTotal.getLeft() - dimDiamond1.getLeft();
|
||||
return new UTranslate(x1, y1);
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.ConnectionTranslatable;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Hexagon;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
|
||||
@ -135,6 +135,7 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
Point2D p1 = getP1(stringBounder);
|
||||
@ -144,7 +145,7 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
|
||||
p2 = translate2.getTranslated(p2);
|
||||
final Direction newDirection = Direction.leftOrRight(p1, p2);
|
||||
if (originalDirection != newDirection) {
|
||||
final double delta = (originalDirection == Direction.RIGHT ? -1 : 1) * Diamond.diamondHalfSize;
|
||||
final double delta = (originalDirection == Direction.RIGHT ? -1 : 1) * Hexagon.hexagonHalfSize;
|
||||
final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
||||
final Snake small = Snake.create(color);
|
||||
small.addPoint(p1);
|
||||
@ -223,6 +224,7 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final FtileGeometry geo = getFtile1().calculateDimension(stringBounder);
|
||||
@ -240,7 +242,7 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
|
||||
final Direction newDirection = Direction.leftOrRight(mp1a, mp2b);
|
||||
final UPolygon arrow = x2 > x1 ? Arrows.asToRight() : Arrows.asToLeft();
|
||||
if (originalDirection == newDirection) {
|
||||
final double delta = (x2 > x1 ? -1 : 1) * 1.5 * Diamond.diamondHalfSize;
|
||||
final double delta = (x2 > x1 ? -1 : 1) * 1.5 * Hexagon.hexagonHalfSize;
|
||||
final Point2D mp2bc = new Point2D.Double(mp2b.getX() + delta, mp2b.getY());
|
||||
final Snake snake = Snake.create(myArrowColor).withMerge(MergeStrategy.LIMITED);
|
||||
final double middle = (mp1a.getY() + mp2b.getY()) / 2.0;
|
||||
@ -255,9 +257,9 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
|
||||
small.addPoint(mp2b);
|
||||
ug.draw(small);
|
||||
} else {
|
||||
final double delta = (x2 > x1 ? -1 : 1) * 1.5 * Diamond.diamondHalfSize;
|
||||
final double delta = (x2 > x1 ? -1 : 1) * 1.5 * Hexagon.hexagonHalfSize;
|
||||
final Point2D mp2bb = new Point2D.Double(mp2b.getX() + delta,
|
||||
mp2b.getY() - 1.5 * Diamond.diamondHalfSize);
|
||||
mp2b.getY() - 1.5 * Hexagon.hexagonHalfSize);
|
||||
final Snake snake = Snake.create(myArrowColor).withMerge(MergeStrategy.LIMITED);
|
||||
snake.addPoint(mp1a);
|
||||
snake.addPoint(mp1a.getX(), mp2bb.getY());
|
||||
@ -313,6 +315,7 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
|
||||
ug.draw(snake);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final FtileGeometry dimTotal = calculateDimensionInternal(stringBounder);
|
||||
@ -322,7 +325,7 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
|
||||
return;
|
||||
}
|
||||
final Point2D p1 = geo.translate(translate(stringBounder)).getPointOut();
|
||||
final Point2D p2 = new Point2D.Double(dimTotal.getLeft(), dimTotal.getHeight() - Diamond.diamondHalfSize);
|
||||
final Point2D p2 = new Point2D.Double(dimTotal.getLeft(), dimTotal.getHeight() - Hexagon.hexagonHalfSize);
|
||||
|
||||
final Point2D mp1a = translate1.getTranslated(p1);
|
||||
final Point2D mp2b = translate2.getTranslated(p2);
|
||||
@ -416,7 +419,7 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
|
||||
super(null, null);
|
||||
this.arrowColor = arrowColor;
|
||||
}
|
||||
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final Dimension2D totalDim = calculateDimensionInternal(stringBounder);
|
||||
@ -446,7 +449,7 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
|
||||
s.addPoint(maxX, totalDim.getHeight());
|
||||
ug.draw(s);
|
||||
}
|
||||
|
||||
|
||||
private double[] getMinmax(StringBounder stringBounder, double width, List<Ftile> allTiles, Swimlane intoSw,
|
||||
List<Swimlane> allSwimlanes) {
|
||||
final int current = allSwimlanes.indexOf(intoSw);
|
||||
@ -499,7 +502,7 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
|
||||
}
|
||||
return new double[] { minX, maxX };
|
||||
}
|
||||
|
||||
|
||||
private int getFirstSwimlane(StringBounder stringBounder, List<Ftile> allTiles, List<Swimlane> allSwimlanes) {
|
||||
for (int i = 0; i < allSwimlanes.size(); i++) {
|
||||
if (atLeastOne(stringBounder, allSwimlanes.get(i), allTiles)) {
|
||||
@ -529,7 +532,6 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
|
||||
return ftile.getSwimlaneOut() == swimlane && ftile.getSwimlanes().contains(swimlane);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public Ftile addLinks(Branch branch1, Branch branch2, StringBounder stringBounder) {
|
||||
|
@ -41,6 +41,8 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.LineBreakStrategy;
|
||||
import net.sourceforge.plantuml.UseStyle;
|
||||
import net.sourceforge.plantuml.activitydiagram3.Branch;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||
@ -50,6 +52,10 @@ import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
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.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
@ -64,7 +70,7 @@ public class FtileSwitchWithDiamonds extends FtileSwitchNude {
|
||||
protected final Ftile diamond1;
|
||||
protected final Ftile diamond2;
|
||||
protected final List<Branch> branches;
|
||||
private Mode mode;
|
||||
protected final Mode mode;
|
||||
private final double w13;
|
||||
private final double w9;
|
||||
|
||||
@ -95,18 +101,18 @@ public class FtileSwitchWithDiamonds extends FtileSwitchNude {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Ftile> getMyChildren() {
|
||||
final public Collection<Ftile> getMyChildren() {
|
||||
final Collection<Ftile> result = new ArrayList<>(super.getMyChildren());
|
||||
result.add(diamond1);
|
||||
result.add(diamond2);
|
||||
return Collections.unmodifiableCollection(result);
|
||||
}
|
||||
|
||||
public double getYdelta1a(StringBounder stringBounder) {
|
||||
protected double getYdelta1a(StringBounder stringBounder) {
|
||||
return 20;
|
||||
}
|
||||
|
||||
public double getYdelta1b(StringBounder stringBounder) {
|
||||
final protected double getYdelta1b(StringBounder stringBounder) {
|
||||
return 10;
|
||||
}
|
||||
|
||||
@ -134,7 +140,7 @@ public class FtileSwitchWithDiamonds extends FtileSwitchNude {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawU(UGraphic ug) {
|
||||
final public void drawU(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
|
||||
ug.apply(getTranslateDiamond1(stringBounder)).draw(diamond1);
|
||||
@ -151,7 +157,7 @@ public class FtileSwitchWithDiamonds extends FtileSwitchNude {
|
||||
}
|
||||
}
|
||||
|
||||
protected UTranslate getTranslateOf(Ftile tile, StringBounder stringBounder) {
|
||||
final protected UTranslate getTranslateOf(Ftile tile, StringBounder stringBounder) {
|
||||
final UTranslate main = getTranslateMain(stringBounder);
|
||||
if (mode == Mode.BIG_DIAMOND) {
|
||||
double dx = 0;
|
||||
@ -173,13 +179,13 @@ public class FtileSwitchWithDiamonds extends FtileSwitchNude {
|
||||
return getTranslateNude(tile, stringBounder).compose(main);
|
||||
}
|
||||
|
||||
protected UTranslate getTranslateMain(StringBounder stringBounder) {
|
||||
final protected UTranslate getTranslateMain(StringBounder stringBounder) {
|
||||
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
||||
final double dy1 = dimDiamond1.getHeight() + getYdelta1a(stringBounder);
|
||||
return UTranslate.dy(dy1);
|
||||
}
|
||||
|
||||
protected UTranslate getTranslateDiamond1(StringBounder stringBounder) {
|
||||
final protected UTranslate getTranslateDiamond1(StringBounder stringBounder) {
|
||||
final double y1 = 0;
|
||||
final FtileGeometry dimTotal = calculateDimensionInternal(stringBounder);
|
||||
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
||||
@ -187,7 +193,7 @@ public class FtileSwitchWithDiamonds extends FtileSwitchNude {
|
||||
return new UTranslate(x1, y1);
|
||||
}
|
||||
|
||||
protected UTranslate getTranslateDiamond2(StringBounder stringBounder) {
|
||||
final protected UTranslate getTranslateDiamond2(StringBounder stringBounder) {
|
||||
final FtileGeometry dimTotal = calculateDimensionInternal(stringBounder);
|
||||
final FtileGeometry dimDiamond2 = diamond2.calculateDimension(stringBounder);
|
||||
final double y2 = dimTotal.getHeight() - dimDiamond2.getHeight();
|
||||
@ -195,10 +201,4 @@ public class FtileSwitchWithDiamonds extends FtileSwitchNude {
|
||||
return new UTranslate(x2, y2);
|
||||
}
|
||||
|
||||
protected TextBlock getLabelPositive(Branch branch) {
|
||||
final FontConfiguration fcArrow = new FontConfiguration(skinParam(), FontParam.ARROW, null);
|
||||
return branch.getLabelPositive().create7(fcArrow, HorizontalAlignment.LEFT, skinParam(),
|
||||
CreoleMode.SIMPLE_LINE);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.Direction;
|
||||
import net.sourceforge.plantuml.activitydiagram3.Branch;
|
||||
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
|
||||
@ -49,8 +50,10 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.Rainbow;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.VerticalAlignment;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UPolygon;
|
||||
@ -85,8 +88,8 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
|
||||
final double x2 = p2.getX();
|
||||
final double y2 = p2.getY();
|
||||
|
||||
final Snake snake = Snake.create(null, arrowColor, Arrows.asToDown()).withLabel(getLabelPositive(branch),
|
||||
arrowHorizontalAlignment());
|
||||
final Snake snake = Snake.create(null, arrowColor, Arrows.asToDown())
|
||||
.withLabel(branch.getTextBlockPositive(), arrowHorizontalAlignment());
|
||||
snake.addPoint(x1, y1);
|
||||
snake.addPoint(x2, y1);
|
||||
snake.addPoint(x2, y2);
|
||||
@ -116,8 +119,11 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
|
||||
|
||||
class ConnectionVerticalThenHorizontal extends AbstractConnection {
|
||||
|
||||
public ConnectionVerticalThenHorizontal(Ftile tile) {
|
||||
private final TextBlock outLabel;
|
||||
|
||||
public ConnectionVerticalThenHorizontal(Ftile tile, TextBlock outLabel) {
|
||||
super(tile, diamond2);
|
||||
this.outLabel = outLabel;
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
@ -154,7 +160,7 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
|
||||
final double x2 = p2.getX();
|
||||
final double y2 = p2.getY();
|
||||
|
||||
final Snake snake = Snake.create(arrowColor, arrow);
|
||||
final Snake snake = Snake.create(arrowColor, arrow).withLabel(outLabel, VerticalAlignment.CENTER);
|
||||
snake.addPoint(x1, y1);
|
||||
if (direction == Direction.LEFT && x2 > x1 - 10) {
|
||||
snake.addPoint(x1, y2 - 8);
|
||||
@ -195,8 +201,8 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
|
||||
final double x2 = p2.getX();
|
||||
final double y2 = p2.getY();
|
||||
|
||||
final Snake snake = Snake.create(null, arrowColor, Arrows.asToDown()).withLabel(getLabelPositive(branch),
|
||||
VerticalAlignment.BOTTOM);
|
||||
final Snake snake = Snake.create(null, arrowColor, Arrows.asToDown())
|
||||
.withLabel(branch.getTextBlockPositive(), VerticalAlignment.CENTER);
|
||||
if (x2 < p1d.getX() - margin || x2 > p1b.getX() + margin) {
|
||||
snake.addPoint(x2, p1d.getY());
|
||||
snake.addPoint(x2, y2);
|
||||
@ -222,8 +228,11 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
|
||||
|
||||
class ConnectionVerticalBottom extends AbstractConnection {
|
||||
|
||||
public ConnectionVerticalBottom(Ftile tile) {
|
||||
final private TextBlock outLabel;
|
||||
|
||||
public ConnectionVerticalBottom(Ftile tile, TextBlock textBlock) {
|
||||
super(tile, diamond2);
|
||||
this.outLabel = textBlock;
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
@ -248,7 +257,8 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
|
||||
|
||||
final double ym = (y1 + y2) / 2;
|
||||
|
||||
final Snake snake = Snake.create(null, arrowColor, Arrows.asToDown());
|
||||
final Snake snake = Snake.create(null, arrowColor, Arrows.asToDown()).withLabel(outLabel,
|
||||
VerticalAlignment.CENTER);
|
||||
|
||||
if (x1 < p1d.getX() - margin || x1 > p1b.getX() + margin) {
|
||||
snake.addPoint(x1, y1);
|
||||
@ -270,10 +280,15 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
|
||||
|
||||
}
|
||||
|
||||
public double getYdelta1a(StringBounder stringBounder) {
|
||||
@Override
|
||||
protected double getYdelta1a(StringBounder stringBounder) {
|
||||
double max = 10;
|
||||
for (Branch branch : branches) {
|
||||
max = Math.max(max, getLabelPositive(branch).calculateDimension(stringBounder).getHeight());
|
||||
max = Math.max(max, branch.getTextBlockPositive().calculateDimension(stringBounder).getHeight());
|
||||
}
|
||||
if (mode == Mode.BIG_DIAMOND) {
|
||||
final double diamondHeight = diamond1.calculateDimension(stringBounder).getHeight();
|
||||
max += diamondHeight / 2;
|
||||
}
|
||||
return max + 10;
|
||||
}
|
||||
@ -298,13 +313,15 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
|
||||
final int firstOutgoingArrow = getFirstOutgoingArrow(stringBounder);
|
||||
final int lastOutgoingArrow = getLastOutgoingArrow(stringBounder);
|
||||
if (firstOutgoingArrow < tiles.size())
|
||||
conns.add(new ConnectionVerticalThenHorizontal(tiles.get(firstOutgoingArrow)));
|
||||
conns.add(new ConnectionVerticalThenHorizontal(tiles.get(firstOutgoingArrow),
|
||||
branches.get(firstOutgoingArrow).getTextBlockSpecial()));
|
||||
if (lastOutgoingArrow > 0)
|
||||
conns.add(new ConnectionVerticalThenHorizontal(tiles.get(lastOutgoingArrow)));
|
||||
conns.add(new ConnectionVerticalThenHorizontal(tiles.get(lastOutgoingArrow),
|
||||
branches.get(lastOutgoingArrow).getTextBlockSpecial()));
|
||||
for (int i = firstOutgoingArrow + 1; i < lastOutgoingArrow; i++) {
|
||||
final Ftile tile = tiles.get(i);
|
||||
if (tile.calculateDimension(stringBounder).hasPointOut()) {
|
||||
conns.add(new ConnectionVerticalBottom(tile));
|
||||
conns.add(new ConnectionVerticalBottom(tile, branches.get(i).getTextBlockSpecial()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ public class FtileSwitchWithOneLink extends FtileSwitchWithDiamonds {
|
||||
final double x2 = p2.getX();
|
||||
final double y2 = p2.getY();
|
||||
|
||||
final Snake snake = Snake.create(null, arrowColor, Arrows.asToDown()).withLabel(getLabelPositive(branch),
|
||||
final Snake snake = Snake.create(null, arrowColor, Arrows.asToDown()).withLabel(branch.getTextBlockPositive(),
|
||||
arrowHorizontalAlignment());
|
||||
// snake.addPoint(x1, y1);
|
||||
snake.addPoint(x2, y1);
|
||||
|
@ -73,7 +73,6 @@ import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft;
|
||||
import net.sourceforge.plantuml.style.PName;
|
||||
import net.sourceforge.plantuml.style.SName;
|
||||
import net.sourceforge.plantuml.style.Style;
|
||||
import net.sourceforge.plantuml.style.StyleBuilder;
|
||||
import net.sourceforge.plantuml.style.StyleSignature;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
@ -152,32 +151,6 @@ public class FtileBox extends AbstractFtile {
|
||||
return new FtileBox(skinParam, label, swimlane, boxStyle, style, styleArrow);
|
||||
}
|
||||
|
||||
// public static TextBlock createWbs(StyleBuilder styleBuilder, ISkinParam skinParam, Display label,
|
||||
// StyleSignature styleDefinition) {
|
||||
// Style style = null;
|
||||
// Style styleArrow = null;
|
||||
// if (UseStyle.useBetaStyle()) {
|
||||
// style = styleDefinition.getMergedStyle(styleBuilder);
|
||||
// styleArrow = style;
|
||||
// }
|
||||
// return new FtileBox(skinParam, label, null, BoxStyle.PLAIN, style, styleArrow);
|
||||
// }
|
||||
//
|
||||
// public static TextBlock createWbs(Style style, ISkinParam skinParam, Display label) {
|
||||
// Style styleArrow = null;
|
||||
// if (UseStyle.useBetaStyle()) {
|
||||
// styleArrow = style;
|
||||
// }
|
||||
// return new FtileBox(skinParam, label, null, BoxStyle.PLAIN, style, styleArrow);
|
||||
// }
|
||||
//
|
||||
// public static TextBlock createMindMap(StyleBuilder styleBuilder, ISkinParam skinParam, Display label,
|
||||
// StyleSignature styleDefinition) {
|
||||
// final Style style = styleDefinition.getMergedStyle(styleBuilder);
|
||||
// final Style styleArrow = style;
|
||||
// return new FtileBox(skinParam, label, null, BoxStyle.PLAIN, style, styleArrow);
|
||||
// }
|
||||
|
||||
private FtileBox(ISkinParam skinParam, Display label, Swimlane swimlane, BoxStyle boxStyle, Style style,
|
||||
Style styleArrow) {
|
||||
super(skinParam);
|
||||
|
@ -73,7 +73,6 @@ import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft;
|
||||
import net.sourceforge.plantuml.style.PName;
|
||||
import net.sourceforge.plantuml.style.SName;
|
||||
import net.sourceforge.plantuml.style.Style;
|
||||
import net.sourceforge.plantuml.style.StyleBuilder;
|
||||
import net.sourceforge.plantuml.style.StyleSignature;
|
||||
import net.sourceforge.plantuml.ugraphic.UEmpty;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
|
@ -0,0 +1,77 @@
|
||||
/* ========================================================================
|
||||
* 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.activitydiagram3.ftile.vertical;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class FtileDecorateInLabel extends FtileDecorate {
|
||||
|
||||
final private double xl;
|
||||
final private double yl;
|
||||
|
||||
public FtileDecorateInLabel(Ftile ftile, Dimension2D dim) {
|
||||
this(ftile, dim.getWidth(), dim.getHeight());
|
||||
}
|
||||
|
||||
private FtileDecorateInLabel(final Ftile ftile, double xl, double yl) {
|
||||
super(ftile);
|
||||
this.xl = xl;
|
||||
this.yl = yl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FtileGeometry calculateDimension(StringBounder stringBounder) {
|
||||
FtileGeometry result = super.calculateDimension(stringBounder);
|
||||
result = result.addTop(yl);
|
||||
final double missing = xl - result.getRight();
|
||||
if (missing > 0)
|
||||
result = result.incRight(missing);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawU(UGraphic ug) {
|
||||
super.drawU(ug.apply(UTranslate.dy(yl)));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
/* ========================================================================
|
||||
* 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.activitydiagram3.ftile.vertical;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
|
||||
public class FtileDecorateOutLabel extends FtileDecorate {
|
||||
|
||||
final private double xl;
|
||||
final private double yl;
|
||||
|
||||
public FtileDecorateOutLabel(Ftile ftile, Dimension2D dim) {
|
||||
this(ftile, dim.getWidth(), dim.getHeight());
|
||||
}
|
||||
|
||||
private FtileDecorateOutLabel(Ftile ftile, double xl, double yl) {
|
||||
super(ftile);
|
||||
this.xl = xl;
|
||||
this.yl = yl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FtileGeometry calculateDimension(StringBounder stringBounder) {
|
||||
FtileGeometry result = super.calculateDimension(stringBounder);
|
||||
result = result.addBottom(yl);
|
||||
final double missing = xl - result.getRight();
|
||||
if (missing > 0)
|
||||
result = result.incRight(missing);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawU(UGraphic ug) {
|
||||
super.drawU(ug);
|
||||
}
|
||||
|
||||
}
|
@ -36,136 +36,81 @@
|
||||
package net.sourceforge.plantuml.activitydiagram3.ftile.vertical;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.UseStyle;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Hexagon;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
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.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
|
||||
public class FtileDiamond extends AbstractFtile {
|
||||
|
||||
private final HColor backColor;
|
||||
private final HColor borderColor;
|
||||
private final Swimlane swimlane;
|
||||
private final TextBlock north;
|
||||
private final TextBlock south;
|
||||
private final TextBlock west1;
|
||||
private final TextBlock east1;
|
||||
private final double shadowing;
|
||||
public class FtileDiamond extends FtileDiamondWIP {
|
||||
|
||||
public FtileDiamond(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane) {
|
||||
this(skinParam, backColor, borderColor, swimlane, TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0),
|
||||
TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0));
|
||||
}
|
||||
|
||||
public StyleSignature getDefaultStyleDefinitionDiamond() {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.diamond);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Ftile> getMyChildren() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public FtileDiamond withNorth(TextBlock north) {
|
||||
return new FtileDiamond(skinParam(), backColor, borderColor, swimlane, north, south, east1, west1);
|
||||
return new FtileDiamond(skinParam(), backColor, borderColor, swimlane, north, south, east, west);
|
||||
}
|
||||
|
||||
public FtileDiamond withWest(TextBlock west1) {
|
||||
if (west1 == null) {
|
||||
return this;
|
||||
}
|
||||
return new FtileDiamond(skinParam(), backColor, borderColor, swimlane, north, south, east1, west1);
|
||||
return new FtileDiamond(skinParam(), backColor, borderColor, swimlane, north, south, east, west1);
|
||||
}
|
||||
|
||||
public FtileDiamond withEast(TextBlock east1) {
|
||||
if (east1 == null) {
|
||||
return this;
|
||||
}
|
||||
return new FtileDiamond(skinParam(), backColor, borderColor, swimlane, north, south, east1, west1);
|
||||
return new FtileDiamond(skinParam(), backColor, borderColor, swimlane, north, south, east1, west);
|
||||
}
|
||||
|
||||
public FtileDiamond withSouth(TextBlock south) {
|
||||
return new FtileDiamond(skinParam(), backColor, borderColor, swimlane, north, south, east1, west1);
|
||||
return new FtileDiamond(skinParam(), backColor, borderColor, swimlane, north, south, east, west);
|
||||
}
|
||||
|
||||
private FtileDiamond(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane,
|
||||
TextBlock north, TextBlock south, TextBlock east1, TextBlock west1) {
|
||||
super(skinParam);
|
||||
if (UseStyle.useBetaStyle()) {
|
||||
Style style = getDefaultStyleDefinitionDiamond().getMergedStyle(skinParam.getCurrentStyleBuilder());
|
||||
shadowing = style.value(PName.Shadowing).asDouble();
|
||||
} else {
|
||||
shadowing = skinParam().shadowing(null) ? 3 : 0;
|
||||
}
|
||||
|
||||
this.backColor = backColor;
|
||||
this.swimlane = swimlane;
|
||||
this.borderColor = borderColor;
|
||||
this.north = north;
|
||||
this.west1 = west1;
|
||||
this.east1 = east1;
|
||||
this.south = south;
|
||||
}
|
||||
|
||||
public Set<Swimlane> getSwimlanes() {
|
||||
if (swimlane == null) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
return Collections.singleton(swimlane);
|
||||
}
|
||||
|
||||
public Swimlane getSwimlaneIn() {
|
||||
return swimlane;
|
||||
}
|
||||
|
||||
public Swimlane getSwimlaneOut() {
|
||||
return swimlane;
|
||||
private FtileDiamond(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane, TextBlock north,
|
||||
TextBlock south, TextBlock east, TextBlock west) {
|
||||
super(null, skinParam, backColor, borderColor, swimlane, north, south, east, west);
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
|
||||
final double suppY1 = north.calculateDimension(ug.getStringBounder()).getHeight();
|
||||
ug = ug.apply(UTranslate.dy(suppY1));
|
||||
ug.apply(borderColor).apply(getThickness()).apply(backColor.bg())
|
||||
.draw(Diamond.asPolygon(shadowing));
|
||||
ug.apply(borderColor).apply(getThickness()).apply(backColor.bg()).draw(Hexagon.asPolygon(shadowing));
|
||||
// final Dimension2D dimNorth = north.calculateDimension(ug.getStringBounder());
|
||||
north.drawU(ug.apply(new UTranslate(Diamond.diamondHalfSize * 1.5, -suppY1)));
|
||||
north.drawU(ug.apply(new UTranslate(Hexagon.hexagonHalfSize * 1.5, -suppY1)));
|
||||
|
||||
// final Dimension2D dimSouth = south.calculateDimension(ug.getStringBounder());
|
||||
south.drawU(ug.apply(new UTranslate(Diamond.diamondHalfSize * 1.5, 2 * Diamond.diamondHalfSize)));
|
||||
// south.drawU(ug.apply(new UTranslate(-(dimSouth.getWidth() - 2 * Diamond.diamondHalfSize) / 2,
|
||||
south.drawU(ug.apply(new UTranslate(Hexagon.hexagonHalfSize * 1.5, 2 * Hexagon.hexagonHalfSize)));
|
||||
// south.drawU(ug.apply(new UTranslate(-(dimSouth.getWidth() - 2 *
|
||||
// Diamond.diamondHalfSize) / 2,
|
||||
// 2 * Diamond.diamondHalfSize)));
|
||||
|
||||
final Dimension2D dimWeat1 = west1.calculateDimension(ug.getStringBounder());
|
||||
west1.drawU(ug.apply(new UTranslate(-dimWeat1.getWidth(), -dimWeat1.getHeight() + Diamond.diamondHalfSize)));
|
||||
final Dimension2D dimWeat1 = west.calculateDimension(ug.getStringBounder());
|
||||
west.drawU(ug.apply(new UTranslate(-dimWeat1.getWidth(), -dimWeat1.getHeight() + Hexagon.hexagonHalfSize)));
|
||||
|
||||
final Dimension2D dimEast1 = east1.calculateDimension(ug.getStringBounder());
|
||||
east1.drawU(ug.apply(new UTranslate(Diamond.diamondHalfSize * 2, -dimEast1.getHeight()
|
||||
+ Diamond.diamondHalfSize)));
|
||||
final Dimension2D dimEast1 = east.calculateDimension(ug.getStringBounder());
|
||||
east.drawU(
|
||||
ug.apply(new UTranslate(Hexagon.hexagonHalfSize * 2, -dimEast1.getHeight() + Hexagon.hexagonHalfSize)));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FtileGeometry calculateDimensionFtile(StringBounder stringBounder) {
|
||||
final double suppY1 = north.calculateDimension(stringBounder).getHeight();
|
||||
final Dimension2D dim = new Dimension2DDouble(Diamond.diamondHalfSize * 2, Diamond.diamondHalfSize * 2 + suppY1);
|
||||
final Dimension2D dim = new Dimension2DDouble(Hexagon.hexagonHalfSize * 2,
|
||||
Hexagon.hexagonHalfSize * 2 + suppY1);
|
||||
return new FtileGeometry(dim, dim.getWidth() / 2, suppY1, dim.getHeight());
|
||||
}
|
||||
|
||||
@ -174,7 +119,7 @@ public class FtileDiamond extends AbstractFtile {
|
||||
}
|
||||
|
||||
public double getEastLabelWidth(StringBounder stringBounder) {
|
||||
final Dimension2D dimEast = east1.calculateDimension(stringBounder);
|
||||
final Dimension2D dimEast = east.calculateDimension(stringBounder);
|
||||
return dimEast.getWidth();
|
||||
}
|
||||
|
||||
|
@ -36,67 +36,38 @@
|
||||
package net.sourceforge.plantuml.activitydiagram3.ftile.vertical;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.UseStyle;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Hexagon;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
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.style.Styleable;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
|
||||
public class FtileDiamondInside extends AbstractFtile implements Styleable {
|
||||
public class FtileDiamondInside extends FtileDiamondWIP {
|
||||
|
||||
private final HColor backColor;
|
||||
private final HColor borderColor;
|
||||
private final Swimlane swimlane;
|
||||
private final TextBlock label;
|
||||
private final TextBlock west;
|
||||
private final TextBlock east;
|
||||
private final TextBlock north;
|
||||
private final TextBlock south;
|
||||
private final double shadowing;
|
||||
|
||||
@Override
|
||||
public Collection<Ftile> getMyChildren() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public StyleSignature getDefaultStyleDefinition() {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activity, SName.diamond);
|
||||
}
|
||||
|
||||
public FtileDiamondInside(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane,
|
||||
TextBlock label) {
|
||||
this(skinParam, backColor, borderColor, swimlane, label, TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0),
|
||||
public FtileDiamondInside(TextBlock label, ISkinParam skinParam, HColor backColor, HColor borderColor,
|
||||
Swimlane swimlane) {
|
||||
this(label, skinParam, backColor, borderColor, swimlane, TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0),
|
||||
TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0));
|
||||
}
|
||||
|
||||
public FtileDiamondInside withNorth(TextBlock north) {
|
||||
return new FtileDiamondInside(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east);
|
||||
return new FtileDiamondInside(label, skinParam(), backColor, borderColor, swimlane, north, south, west, east);
|
||||
}
|
||||
|
||||
public FtileDiamondInside withWest(TextBlock west) {
|
||||
return new FtileDiamondInside(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east);
|
||||
return new FtileDiamondInside(label, skinParam(), backColor, borderColor, swimlane, north, south, west, east);
|
||||
}
|
||||
|
||||
public FtileDiamondInside withEast(TextBlock east) {
|
||||
return new FtileDiamondInside(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east);
|
||||
return new FtileDiamondInside(label, skinParam(), backColor, borderColor, swimlane, north, south, west, east);
|
||||
}
|
||||
|
||||
public Ftile withWestAndEast(TextBlock tb1, TextBlock tb2) {
|
||||
@ -104,43 +75,12 @@ public class FtileDiamondInside extends AbstractFtile implements Styleable {
|
||||
}
|
||||
|
||||
public FtileDiamondInside withSouth(TextBlock south) {
|
||||
return new FtileDiamondInside(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east);
|
||||
return new FtileDiamondInside(label, skinParam(), backColor, borderColor, swimlane, north, south, west, east);
|
||||
}
|
||||
|
||||
private FtileDiamondInside(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane,
|
||||
TextBlock label, TextBlock north, TextBlock south, TextBlock west, TextBlock east) {
|
||||
super(skinParam);
|
||||
if (UseStyle.useBetaStyle()) {
|
||||
final Style style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder());
|
||||
this.borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet());
|
||||
this.backColor = style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet());
|
||||
this.shadowing = style.value(PName.Shadowing).asDouble();
|
||||
} else {
|
||||
this.backColor = backColor;
|
||||
this.borderColor = borderColor;
|
||||
this.shadowing = skinParam().shadowing(null) ? 3 : 0;
|
||||
}
|
||||
this.swimlane = swimlane;
|
||||
this.label = label;
|
||||
this.west = west;
|
||||
this.east = east;
|
||||
this.north = north;
|
||||
this.south = south;
|
||||
}
|
||||
|
||||
public Set<Swimlane> getSwimlanes() {
|
||||
if (swimlane == null) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
return Collections.singleton(swimlane);
|
||||
}
|
||||
|
||||
public Swimlane getSwimlaneIn() {
|
||||
return swimlane;
|
||||
}
|
||||
|
||||
public Swimlane getSwimlaneOut() {
|
||||
return swimlane;
|
||||
private FtileDiamondInside(TextBlock label, ISkinParam skinParam, HColor backColor, HColor borderColor,
|
||||
Swimlane swimlane, TextBlock north, TextBlock south, TextBlock west, TextBlock east) {
|
||||
super(label, skinParam, backColor, borderColor, swimlane, north, south, east, west);
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
@ -148,7 +88,7 @@ public class FtileDiamondInside extends AbstractFtile implements Styleable {
|
||||
final Dimension2D dimLabel = label.calculateDimension(stringBounder);
|
||||
final Dimension2D dimTotal = calculateDimensionAlone(stringBounder);
|
||||
ug = ug.apply(borderColor).apply(getThickness()).apply(backColor.bg());
|
||||
ug.draw(Diamond.asPolygon(shadowing, dimTotal.getWidth(), dimTotal.getHeight()));
|
||||
ug.draw(Hexagon.asPolygon(shadowing, dimTotal.getWidth(), dimTotal.getHeight()));
|
||||
|
||||
north.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight())));
|
||||
south.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight())));
|
||||
@ -169,11 +109,11 @@ public class FtileDiamondInside extends AbstractFtile implements Styleable {
|
||||
final Dimension2D dimLabel = label.calculateDimension(stringBounder);
|
||||
final Dimension2D dim;
|
||||
if (dimLabel.getWidth() == 0 || dimLabel.getHeight() == 0) {
|
||||
dim = new Dimension2DDouble(Diamond.diamondHalfSize * 2, Diamond.diamondHalfSize * 2);
|
||||
dim = new Dimension2DDouble(Hexagon.hexagonHalfSize * 2, Hexagon.hexagonHalfSize * 2);
|
||||
} else {
|
||||
dim = Dimension2DDouble.delta(
|
||||
Dimension2DDouble.atLeast(dimLabel, Diamond.diamondHalfSize * 2, Diamond.diamondHalfSize * 2),
|
||||
Diamond.diamondHalfSize * 2, 0);
|
||||
Dimension2DDouble.atLeast(dimLabel, Hexagon.hexagonHalfSize * 2, Hexagon.hexagonHalfSize * 2),
|
||||
Hexagon.hexagonHalfSize * 2, 0);
|
||||
}
|
||||
return new FtileGeometry(dim, dim.getWidth() / 2, 0, dim.getHeight());
|
||||
}
|
||||
@ -185,8 +125,6 @@ public class FtileDiamondInside extends AbstractFtile implements Styleable {
|
||||
final Dimension2D dimEast = east.calculateDimension(stringBounder);
|
||||
final double northHeight = north.calculateDimension(stringBounder).getHeight();
|
||||
return dimDiamonAlone.incHeight(northHeight);
|
||||
// return dimDiamonAlone.incHeight(northHeight).addMarginX(dimWest.getWidth(),
|
||||
// dimEast.getWidth());
|
||||
}
|
||||
|
||||
public double getEastLabelWidth(StringBounder stringBounder) {
|
||||
|
@ -36,97 +36,46 @@
|
||||
package net.sourceforge.plantuml.activitydiagram3.ftile.vertical;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.UseStyle;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Hexagon;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
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.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
|
||||
public class FtileDiamondInside2 extends AbstractFtile {
|
||||
public class FtileDiamondInside2 extends FtileDiamondWIP {
|
||||
|
||||
private final HColor backColor;
|
||||
private final HColor borderColor;
|
||||
private final Swimlane swimlane;
|
||||
private final TextBlock label;
|
||||
private final TextBlock west;
|
||||
private final TextBlock east;
|
||||
private final TextBlock north;
|
||||
private final TextBlock south;
|
||||
private final double shadowing;
|
||||
|
||||
public FtileDiamondInside2(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane,
|
||||
TextBlock label) {
|
||||
this(skinParam, backColor, borderColor, swimlane, label, TextBlockUtils.empty(0, 0),
|
||||
TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0));
|
||||
public FtileDiamondInside2(TextBlock label, ISkinParam skinParam, HColor backColor, HColor borderColor,
|
||||
Swimlane swimlane) {
|
||||
this(label, skinParam, backColor, borderColor, swimlane, TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0),
|
||||
TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0));
|
||||
}
|
||||
|
||||
public FtileDiamondInside2 withNorth(TextBlock north) {
|
||||
return new FtileDiamondInside2(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east);
|
||||
return new FtileDiamondInside2(label, skinParam(), backColor, borderColor, swimlane, north, south, west, east);
|
||||
}
|
||||
|
||||
public FtileDiamondInside2 withWest(TextBlock west) {
|
||||
return new FtileDiamondInside2(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east);
|
||||
return new FtileDiamondInside2(label, skinParam(), backColor, borderColor, swimlane, north, south, west, east);
|
||||
}
|
||||
|
||||
public FtileDiamondInside2 withEast(TextBlock east) {
|
||||
return new FtileDiamondInside2(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east);
|
||||
return new FtileDiamondInside2(label, skinParam(), backColor, borderColor, swimlane, north, south, west, east);
|
||||
}
|
||||
|
||||
public FtileDiamondInside2 withSouth(TextBlock south) {
|
||||
return new FtileDiamondInside2(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east);
|
||||
}
|
||||
|
||||
public StyleSignature getDefaultStyleDefinition() {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activity, SName.diamond);
|
||||
return new FtileDiamondInside2(label, skinParam(), backColor, borderColor, swimlane, north, south, west, east);
|
||||
}
|
||||
|
||||
private FtileDiamondInside2(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane,
|
||||
TextBlock label, TextBlock north, TextBlock south, TextBlock west, TextBlock east) {
|
||||
super(skinParam);
|
||||
if (UseStyle.useBetaStyle()) {
|
||||
final Style style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder());
|
||||
this.shadowing = style.value(PName.Shadowing).asDouble();
|
||||
} else {
|
||||
this.shadowing = skinParam().shadowing(null) ? 3 : 0;
|
||||
}
|
||||
this.backColor = backColor;
|
||||
this.swimlane = swimlane;
|
||||
this.borderColor = borderColor;
|
||||
this.label = label;
|
||||
this.west = west;
|
||||
this.east = east;
|
||||
this.north = north;
|
||||
this.south = south;
|
||||
}
|
||||
|
||||
public Set<Swimlane> getSwimlanes() {
|
||||
if (swimlane == null) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
return Collections.singleton(swimlane);
|
||||
}
|
||||
|
||||
public Swimlane getSwimlaneIn() {
|
||||
return swimlane;
|
||||
}
|
||||
|
||||
public Swimlane getSwimlaneOut() {
|
||||
return swimlane;
|
||||
private FtileDiamondInside2(TextBlock label, ISkinParam skinParam, HColor backColor, HColor borderColor,
|
||||
Swimlane swimlane, TextBlock north, TextBlock south, TextBlock west, TextBlock east) {
|
||||
super(label, skinParam, backColor, borderColor, swimlane, north, south, east, west);
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
@ -134,7 +83,7 @@ public class FtileDiamondInside2 extends AbstractFtile {
|
||||
final Dimension2D dimLabel = label.calculateDimension(stringBounder);
|
||||
final Dimension2D dimTotal = calculateDimensionAlone(stringBounder);
|
||||
ug = ug.apply(borderColor).apply(getThickness()).apply(backColor.bg());
|
||||
ug.draw(Diamond.asPolygon(shadowing, dimTotal.getWidth(), dimTotal.getHeight()));
|
||||
ug.draw(Hexagon.asPolygon(shadowing, dimTotal.getWidth(), dimTotal.getHeight()));
|
||||
|
||||
north.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight())));
|
||||
south.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight())));
|
||||
@ -155,11 +104,11 @@ public class FtileDiamondInside2 extends AbstractFtile {
|
||||
final Dimension2D dimLabel = label.calculateDimension(stringBounder);
|
||||
final Dimension2D dim;
|
||||
if (dimLabel.getWidth() == 0 || dimLabel.getHeight() == 0) {
|
||||
dim = new Dimension2DDouble(Diamond.diamondHalfSize * 2, Diamond.diamondHalfSize * 2);
|
||||
dim = new Dimension2DDouble(Hexagon.hexagonHalfSize * 2, Hexagon.hexagonHalfSize * 2);
|
||||
} else {
|
||||
dim = Dimension2DDouble.delta(
|
||||
Dimension2DDouble.atLeast(dimLabel, Diamond.diamondHalfSize * 2, Diamond.diamondHalfSize * 2),
|
||||
Diamond.diamondHalfSize * 2, 0);
|
||||
Dimension2DDouble.atLeast(dimLabel, Hexagon.hexagonHalfSize * 2, Hexagon.hexagonHalfSize * 2),
|
||||
Hexagon.hexagonHalfSize * 2, 0);
|
||||
}
|
||||
return new FtileGeometry(dim, dim.getWidth() / 2, 0, dim.getHeight());
|
||||
}
|
||||
|
@ -1,178 +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.activitydiagram3.ftile.vertical;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileOverpassing;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
import net.sourceforge.plantuml.utils.MathUtils;
|
||||
|
||||
public class FtileDiamondInside3 extends AbstractFtile implements FtileOverpassing {
|
||||
|
||||
private final HColor backColor;
|
||||
private final HColor borderColor;
|
||||
private final Swimlane swimlane;
|
||||
private final TextBlock label;
|
||||
private final TextBlock west;
|
||||
private final TextBlock east;
|
||||
private final TextBlock north;
|
||||
private final TextBlock south;
|
||||
|
||||
public FtileDiamondInside3(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane,
|
||||
TextBlock label) {
|
||||
this(skinParam, backColor, borderColor, swimlane, label, TextBlockUtils.empty(0, 0),
|
||||
TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0));
|
||||
}
|
||||
|
||||
public FtileDiamondInside3 withNorth(TextBlock north) {
|
||||
return new FtileDiamondInside3(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east);
|
||||
}
|
||||
|
||||
public FtileDiamondInside3 withWest(TextBlock west) {
|
||||
return new FtileDiamondInside3(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east);
|
||||
}
|
||||
|
||||
public FtileDiamondInside3 withEast(TextBlock east) {
|
||||
return new FtileDiamondInside3(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east);
|
||||
}
|
||||
|
||||
public FtileDiamondInside3 withSouth(TextBlock south) {
|
||||
return new FtileDiamondInside3(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east);
|
||||
}
|
||||
|
||||
private FtileDiamondInside3(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane,
|
||||
TextBlock label, TextBlock north, TextBlock south, TextBlock west, TextBlock east) {
|
||||
super(skinParam);
|
||||
this.backColor = backColor;
|
||||
this.swimlane = swimlane;
|
||||
this.borderColor = borderColor;
|
||||
this.label = label;
|
||||
this.west = west;
|
||||
this.east = east;
|
||||
this.north = north;
|
||||
this.south = south;
|
||||
}
|
||||
|
||||
public Set<Swimlane> getSwimlanes() {
|
||||
if (swimlane == null) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
return Collections.singleton(swimlane);
|
||||
}
|
||||
|
||||
public Swimlane getSwimlaneIn() {
|
||||
return swimlane;
|
||||
}
|
||||
|
||||
public Swimlane getSwimlaneOut() {
|
||||
return swimlane;
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final Dimension2D dimLabel = label.calculateDimension(stringBounder);
|
||||
final Dimension2D dimTotal = calculateDimensionAlone(stringBounder);
|
||||
ug = ug.apply(borderColor).apply(getThickness()).apply(backColor.bg());
|
||||
final double shadowing = skinParam().shadowing(null) ? 3 : 0;
|
||||
ug.draw(Diamond.asPolygon(shadowing, dimTotal.getWidth(), dimTotal.getHeight()));
|
||||
|
||||
north.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight())));
|
||||
south.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight())));
|
||||
|
||||
final double lx = (dimTotal.getWidth() - dimLabel.getWidth()) / 2;
|
||||
final double ly = (dimTotal.getHeight() - dimLabel.getHeight()) / 2;
|
||||
label.drawU(ug.apply(new UTranslate(lx, ly)));
|
||||
|
||||
final Dimension2D dimWeat = west.calculateDimension(stringBounder);
|
||||
west.drawU(ug.apply(new UTranslate(-dimWeat.getWidth(), -dimWeat.getHeight() + dimTotal.getHeight() / 2)));
|
||||
|
||||
final Dimension2D dimEast = east.calculateDimension(stringBounder);
|
||||
east.drawU(ug.apply(new UTranslate(dimTotal.getWidth(), -dimEast.getHeight() + dimTotal.getHeight() / 2)));
|
||||
|
||||
}
|
||||
|
||||
private FtileGeometry calculateDimensionAlone(StringBounder stringBounder) {
|
||||
final Dimension2D dimLabel = label.calculateDimension(stringBounder);
|
||||
final Dimension2D dim;
|
||||
if (dimLabel.getWidth() == 0 || dimLabel.getHeight() == 0) {
|
||||
dim = new Dimension2DDouble(Diamond.diamondHalfSize * 2, Diamond.diamondHalfSize * 2);
|
||||
} else {
|
||||
dim = Dimension2DDouble.delta(
|
||||
Dimension2DDouble.atLeast(dimLabel, Diamond.diamondHalfSize * 2, Diamond.diamondHalfSize * 2),
|
||||
Diamond.diamondHalfSize * 2, 0);
|
||||
}
|
||||
return new FtileGeometry(dim, dim.getWidth() / 2, 0, dim.getHeight());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FtileGeometry calculateDimensionFtile(StringBounder stringBounder) {
|
||||
final Dimension2D diamond = calculateDimensionAlone(stringBounder);
|
||||
final Dimension2D north = this.north.calculateDimension(stringBounder);
|
||||
final double height = diamond.getHeight() + north.getHeight();
|
||||
final double left = diamond.getWidth() / 2;
|
||||
// final double width = north.getWidth() > left ? left + north.getWidth() : diamond.getWidth();
|
||||
final double width = diamond.getWidth();
|
||||
return new FtileGeometry(width, height, left, 0, diamond.getHeight());
|
||||
}
|
||||
|
||||
public FtileGeometry getOverpassDimension(StringBounder stringBounder) {
|
||||
final Dimension2D total = calculateDimension(stringBounder);
|
||||
final Dimension2D north = this.north.calculateDimension(stringBounder);
|
||||
final Dimension2D east = this.east.calculateDimension(stringBounder);
|
||||
final Dimension2D west = this.west.calculateDimension(stringBounder);
|
||||
final double height = total.getHeight(); // + north.getHeight();
|
||||
final double left = total.getWidth() / 2;
|
||||
final double supp = MathUtils.max(north.getWidth(), east.getWidth(), west.getWidth());
|
||||
// final double width = supp > left ? left + supp : diamond.getWidth();
|
||||
final double width = total.getWidth() + supp;
|
||||
return new FtileGeometry(width, height, left, 0, total.getHeight());
|
||||
}
|
||||
|
||||
}
|
@ -36,16 +36,12 @@
|
||||
package net.sourceforge.plantuml.activitydiagram3.ftile.vertical;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Hexagon;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
@ -54,74 +50,37 @@ import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
|
||||
public class FtileDiamondSquare extends AbstractFtile {
|
||||
public class FtileDiamondSquare extends FtileDiamondWIP {
|
||||
|
||||
private final HColor backColor;
|
||||
private final HColor borderColor;
|
||||
private final Swimlane swimlane;
|
||||
private final TextBlock label;
|
||||
private final TextBlock west;
|
||||
private final TextBlock east;
|
||||
private final TextBlock north;
|
||||
private final TextBlock south;
|
||||
|
||||
public FtileDiamondSquare(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane,
|
||||
TextBlock label) {
|
||||
this(skinParam, backColor, borderColor, swimlane, label, TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0),
|
||||
public FtileDiamondSquare(TextBlock label, ISkinParam skinParam, HColor backColor, HColor borderColor,
|
||||
Swimlane swimlane) {
|
||||
this(label, skinParam, backColor, borderColor, swimlane, TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0),
|
||||
TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Ftile> getMyChildren() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public FtileDiamondSquare withNorth(TextBlock north) {
|
||||
return new FtileDiamondSquare(skinParam(), backColor, borderColor, swimlane, label, north, west, east, south);
|
||||
return new FtileDiamondSquare(label, skinParam(), backColor, borderColor, swimlane, north, west, east, south);
|
||||
}
|
||||
|
||||
public FtileDiamondSquare withWest(TextBlock west) {
|
||||
return new FtileDiamondSquare(skinParam(), backColor, borderColor, swimlane, label, north, west, east, south);
|
||||
return new FtileDiamondSquare(label, skinParam(), backColor, borderColor, swimlane, north, west, east, south);
|
||||
}
|
||||
|
||||
public FtileDiamondSquare withEast(TextBlock east) {
|
||||
return new FtileDiamondSquare(skinParam(), backColor, borderColor, swimlane, label, north, west, east, south);
|
||||
return new FtileDiamondSquare(label, skinParam(), backColor, borderColor, swimlane, north, west, east, south);
|
||||
}
|
||||
|
||||
public FtileDiamondSquare withSouth(TextBlock south) {
|
||||
return new FtileDiamondSquare(skinParam(), backColor, borderColor, swimlane, label, north, west, east, south);
|
||||
return new FtileDiamondSquare(label, skinParam(), backColor, borderColor, swimlane, north, west, east, south);
|
||||
}
|
||||
|
||||
public Ftile withWestAndEast(TextBlock tb1, TextBlock tb2) {
|
||||
return withWest(tb1).withEast(tb2);
|
||||
}
|
||||
|
||||
private FtileDiamondSquare(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane,
|
||||
TextBlock label, TextBlock north, TextBlock west, TextBlock east, TextBlock south) {
|
||||
super(skinParam);
|
||||
this.backColor = backColor;
|
||||
this.swimlane = swimlane;
|
||||
this.borderColor = borderColor;
|
||||
this.label = label;
|
||||
this.west = west;
|
||||
this.east = east;
|
||||
this.north = north;
|
||||
this.south = south;
|
||||
}
|
||||
|
||||
public Set<Swimlane> getSwimlanes() {
|
||||
if (swimlane == null) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
return Collections.singleton(swimlane);
|
||||
}
|
||||
|
||||
public Swimlane getSwimlaneIn() {
|
||||
return swimlane;
|
||||
}
|
||||
|
||||
public Swimlane getSwimlaneOut() {
|
||||
return swimlane;
|
||||
private FtileDiamondSquare(TextBlock label, ISkinParam skinParam, HColor backColor, HColor borderColor,
|
||||
Swimlane swimlane, TextBlock north, TextBlock west, TextBlock east, TextBlock south) {
|
||||
super(label, skinParam, backColor, borderColor, swimlane, north, south, east, west);
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
@ -129,7 +88,7 @@ public class FtileDiamondSquare extends AbstractFtile {
|
||||
final Dimension2D dimLabel = label.calculateDimension(stringBounder);
|
||||
final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
|
||||
ug = ug.apply(borderColor).apply(getThickness()).apply(backColor.bg());
|
||||
ug.draw(Diamond.asPolygonSquare(skinParam().shadowing(null), dimTotal.getWidth(), dimTotal.getHeight()));
|
||||
ug.draw(Hexagon.asPolygonSquare(skinParam().shadowing(null), dimTotal.getWidth(), dimTotal.getHeight()));
|
||||
|
||||
// Fix why north and south are the same
|
||||
north.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight())));
|
||||
@ -140,10 +99,10 @@ public class FtileDiamondSquare extends AbstractFtile {
|
||||
label.drawU(ug.apply(new UTranslate(lx, ly)));
|
||||
|
||||
final Dimension2D dimWeat = west.calculateDimension(stringBounder);
|
||||
west.drawU(ug.apply(new UTranslate(-dimWeat.getWidth(), -dimWeat.getHeight() + Diamond.diamondHalfSize)));
|
||||
west.drawU(ug.apply(new UTranslate(-dimWeat.getWidth(), -dimWeat.getHeight() + Hexagon.hexagonHalfSize)));
|
||||
|
||||
final Dimension2D dimEast = east.calculateDimension(stringBounder);
|
||||
east.drawU(ug.apply(new UTranslate(dimTotal.getWidth(), -dimEast.getHeight() + Diamond.diamondHalfSize)));
|
||||
east.drawU(ug.apply(new UTranslate(dimTotal.getWidth(), -dimEast.getHeight() + Hexagon.hexagonHalfSize)));
|
||||
|
||||
}
|
||||
|
||||
@ -156,10 +115,10 @@ public class FtileDiamondSquare extends AbstractFtile {
|
||||
private Dimension2D calculateDimensionInternal(StringBounder stringBounder) {
|
||||
final Dimension2D dimLabel = label.calculateDimension(stringBounder);
|
||||
if (dimLabel.getWidth() == 0 || dimLabel.getHeight() == 0) {
|
||||
return new Dimension2DDouble(Diamond.diamondHalfSize * 2, Diamond.diamondHalfSize * 2);
|
||||
return new Dimension2DDouble(Hexagon.hexagonHalfSize * 2, Hexagon.hexagonHalfSize * 2);
|
||||
}
|
||||
Dimension2D result = dimLabel;
|
||||
result = Dimension2DDouble.delta(result, Diamond.diamondHalfSize * 2, Diamond.diamondHalfSize * 2);
|
||||
result = Dimension2DDouble.delta(result, Hexagon.hexagonHalfSize * 2, Hexagon.hexagonHalfSize * 2);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,117 @@
|
||||
/* ========================================================================
|
||||
* 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.activitydiagram3.ftile.vertical;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.UseStyle;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
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.style.Styleable;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
|
||||
abstract class FtileDiamondWIP extends AbstractFtile implements Styleable {
|
||||
|
||||
protected final HColor backColor;
|
||||
protected final HColor borderColor;
|
||||
protected final Swimlane swimlane;
|
||||
|
||||
protected final TextBlock label;
|
||||
|
||||
protected final TextBlock north;
|
||||
protected final TextBlock south;
|
||||
protected final TextBlock west;
|
||||
protected final TextBlock east;
|
||||
|
||||
protected final double shadowing;
|
||||
|
||||
final public StyleSignature getDefaultStyleDefinition() {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activity, SName.diamond);
|
||||
}
|
||||
|
||||
@Override
|
||||
final public Collection<Ftile> getMyChildren() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
protected FtileDiamondWIP(TextBlock label, ISkinParam skinParam, HColor backColor, HColor borderColor,
|
||||
Swimlane swimlane, TextBlock north, TextBlock south, TextBlock east, TextBlock west) {
|
||||
super(skinParam);
|
||||
if (UseStyle.useBetaStyle()) {
|
||||
Style style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder());
|
||||
this.borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet());
|
||||
this.backColor = style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet());
|
||||
this.shadowing = style.value(PName.Shadowing).asDouble();
|
||||
} else {
|
||||
this.backColor = backColor;
|
||||
this.borderColor = borderColor;
|
||||
this.shadowing = skinParam().shadowing(null) ? 3 : 0;
|
||||
}
|
||||
|
||||
this.swimlane = swimlane;
|
||||
|
||||
this.label = label;
|
||||
this.north = north;
|
||||
this.west = west;
|
||||
this.east = east;
|
||||
this.south = south;
|
||||
}
|
||||
|
||||
final public Set<Swimlane> getSwimlanes() {
|
||||
if (swimlane == null) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
return Collections.singleton(swimlane);
|
||||
}
|
||||
|
||||
final public Swimlane getSwimlaneIn() {
|
||||
return swimlane;
|
||||
}
|
||||
|
||||
final public Swimlane getSwimlaneOut() {
|
||||
return swimlane;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,191 @@
|
||||
/* ========================================================================
|
||||
* 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.activitydiagram3.gtile;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.LineParam;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.skin.rose.Rose;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorSet;
|
||||
|
||||
public abstract class AbstractGtile extends AbstractTextBlock implements Gtile {
|
||||
|
||||
protected final StringBounder stringBounder;
|
||||
private final ISkinParam skinParam;
|
||||
private final Swimlane singleSwimlane;
|
||||
|
||||
public AbstractGtile(StringBounder stringBounder, ISkinParam skinParam, Swimlane singleSwimlane) {
|
||||
this.stringBounder = stringBounder;
|
||||
this.skinParam = skinParam;
|
||||
this.singleSwimlane = singleSwimlane;
|
||||
}
|
||||
|
||||
public StringBounder getStringBounder() {
|
||||
return stringBounder;
|
||||
}
|
||||
|
||||
public AbstractGtile(StringBounder stringBounder, ISkinParam skinParam) {
|
||||
this(stringBounder, skinParam, null);
|
||||
}
|
||||
|
||||
final public ISkinParam skinParam() {
|
||||
if (skinParam == null) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
return skinParam;
|
||||
}
|
||||
|
||||
final public HColorSet getIHtmlColorSet() {
|
||||
return skinParam.getIHtmlColorSet();
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public UTranslate getTranslateFor(Gtile child) {
|
||||
// throw new UnsupportedOperationException();
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// public Collection<Gtile> getMyChildren() {
|
||||
// return Collections.emptySet();
|
||||
// }
|
||||
|
||||
@Override
|
||||
public UTranslate getCoord(String name) {
|
||||
final Dimension2D dim = calculateDimension(stringBounder);
|
||||
if (name.equals(GPoint.NORTH_HOOK))
|
||||
return new UTranslate(dim.getWidth() / 2, 0);
|
||||
if (name.equals(GPoint.SOUTH_HOOK))
|
||||
return new UTranslate(dim.getWidth() / 2, dim.getHeight());
|
||||
if (name.equals(GPoint.WEST_HOOK))
|
||||
return new UTranslate(0, dim.getHeight() / 2);
|
||||
if (name.equals(GPoint.EAST_HOOK))
|
||||
return new UTranslate(dim.getWidth(), dim.getHeight() / 2);
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public GPoint getGPoint(String name) {
|
||||
if (name.equals(GPoint.NORTH_HOOK) || name.equals(GPoint.SOUTH_HOOK) || name.equals(GPoint.WEST_HOOK)
|
||||
|| name.equals(GPoint.EAST_HOOK))
|
||||
return new GPoint(this, name);
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Swimlane> getSwimlanes() {
|
||||
if (singleSwimlane == null)
|
||||
return Collections.emptySet();
|
||||
return Collections.singleton(singleSwimlane);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Swimlane getSwimlane(String point) {
|
||||
return singleSwimlane;
|
||||
}
|
||||
|
||||
// public LinkRendering getInLinkRendering() {
|
||||
// return LinkRendering.none();
|
||||
// }
|
||||
//
|
||||
// public LinkRendering getOutLinkRendering() {
|
||||
// return LinkRendering.none();
|
||||
// }
|
||||
|
||||
public Collection<GConnection> getInnerConnections() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// public UTranslate getTranslateFor(Ftile child, StringBounder stringBounder) {
|
||||
// throw new UnsupportedOperationException("" + getClass());
|
||||
// }
|
||||
|
||||
public final UStroke getThickness() {
|
||||
UStroke thickness = skinParam.getThickness(LineParam.activityBorder, null);
|
||||
if (thickness == null) {
|
||||
thickness = new UStroke(1.5);
|
||||
}
|
||||
return thickness;
|
||||
}
|
||||
|
||||
private final Rose rose = new Rose();
|
||||
|
||||
protected final Rose getRose() {
|
||||
return rose;
|
||||
}
|
||||
|
||||
// public List<WeldingPoint> getWeldingPoints() {
|
||||
// return Collections.emptyList();
|
||||
// }
|
||||
//
|
||||
// public Collection<Ftile> getMyChildren() {
|
||||
// throw new UnsupportedOperationException("" + getClass());
|
||||
// }
|
||||
//
|
||||
// public HorizontalAlignment arrowHorizontalAlignment() {
|
||||
// return skinParam.getHorizontalAlignment(AlignmentParam.arrowMessageAlignment, null, false, null);
|
||||
// }
|
||||
//
|
||||
// private FtileGeometry cachedGeometry;
|
||||
//
|
||||
// final public FtileGeometry calculateDimension(StringBounder stringBounder) {
|
||||
// if (cachedGeometry == null) {
|
||||
// cachedGeometry = calculateDimensionFtile(stringBounder);
|
||||
// }
|
||||
// return cachedGeometry;
|
||||
// }
|
||||
//
|
||||
// abstract protected FtileGeometry calculateDimensionFtile(StringBounder stringBounder);
|
||||
//
|
||||
// @Override
|
||||
// final public MinMax getMinMax(StringBounder stringBounder) {
|
||||
// throw new UnsupportedOperationException();
|
||||
// // return getMinMaxFtile(stringBounder);
|
||||
// }
|
||||
//
|
||||
// // protected MinMax getMinMaxFtile(StringBounder stringBounder) {
|
||||
// // throw new UnsupportedOperationException();
|
||||
// // }
|
||||
|
||||
}
|
@ -30,34 +30,32 @@
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.ugraphic;
|
||||
package net.sourceforge.plantuml.activitydiagram3.gtile;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class UScale implements UChange {
|
||||
public abstract class GAbstractConnection implements GConnection {
|
||||
|
||||
private final double scale;
|
||||
protected final GPoint gpoint1;
|
||||
protected final GPoint gpoint2;
|
||||
|
||||
public GAbstractConnection(GPoint gpoint1, GPoint gpoint2) {
|
||||
this.gpoint1 = gpoint1;
|
||||
this.gpoint2 = gpoint2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "scale scale=" + scale;
|
||||
return "[" + gpoint1 + "]->[" + gpoint2 + "]";
|
||||
}
|
||||
|
||||
public UScale(double scale) {
|
||||
this.scale = scale;
|
||||
@Override
|
||||
final public List<GPoint> getHooks() {
|
||||
return Arrays.asList(gpoint1, gpoint2);
|
||||
}
|
||||
|
||||
public double getScale() {
|
||||
return scale;
|
||||
}
|
||||
|
||||
// public Point2D getTranslated(Point2D p) {
|
||||
// if (p == null) {
|
||||
// return null;
|
||||
// }
|
||||
// return new Point2D.Double(p.getX() + dx, p.getY() + dy);
|
||||
// }
|
||||
|
||||
}
|
@ -31,17 +31,17 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.braille;
|
||||
package net.sourceforge.plantuml.activitydiagram3.gtile;
|
||||
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
|
||||
|
||||
public class DriverNoneBraille implements UDriver<BrailleGrid> {
|
||||
public interface GConnection extends UDrawable, UShape {
|
||||
|
||||
public void draw(UShape shape, double x, double y, ColorMapper mapper, UParam param, BrailleGrid object) {
|
||||
}
|
||||
public List<GPoint> getHooks();
|
||||
|
||||
}
|
@ -0,0 +1,130 @@
|
||||
/* ========================================================================
|
||||
* 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.activitydiagram3.gtile;
|
||||
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.Rainbow;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class GConnectionHorizontalThenVerticalDown extends GAbstractConnection implements GConnectionTranslatable {
|
||||
|
||||
private final TextBlock textBlock;
|
||||
private final UTranslate pos1;
|
||||
private final UTranslate pos2;
|
||||
|
||||
public GConnectionHorizontalThenVerticalDown(UTranslate pos1, GPoint gpoint1, UTranslate pos2, GPoint gpoint2,
|
||||
TextBlock textBlock) {
|
||||
super(gpoint1, gpoint2);
|
||||
this.textBlock = textBlock;
|
||||
this.pos1 = pos1;
|
||||
this.pos2 = pos2;
|
||||
// See FtileFactoryDelegatorAssembly
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawU(UGraphic ug) {
|
||||
ug.draw(getSimpleSnake());
|
||||
}
|
||||
|
||||
// public double getMaxX(StringBounder stringBounder) {
|
||||
// return getSimpleSnake().getMaxX(stringBounder);
|
||||
// }
|
||||
|
||||
private Rainbow getInLinkRenderingColor() {
|
||||
Rainbow color;
|
||||
color = Rainbow.build(gpoint1.getGtile().skinParam());
|
||||
// final LinkRendering linkRendering = tile.getInLinkRendering();
|
||||
// if (linkRendering == null) {
|
||||
// if (UseStyle.useBetaStyle()) {
|
||||
// final Style style = getDefaultStyleDefinitionArrow()
|
||||
// .getMergedStyle(skinParam().getCurrentStyleBuilder());
|
||||
// return Rainbow.build(style, skinParam().getIHtmlColorSet(), skinParam().getThemeStyle());
|
||||
// } else {
|
||||
// color = Rainbow.build(skinParam());
|
||||
// }
|
||||
// } else {
|
||||
// color = linkRendering.getRainbow();
|
||||
// }
|
||||
// if (color.size() == 0) {
|
||||
// if (UseStyle.useBetaStyle()) {
|
||||
// final Style style = getDefaultStyleDefinitionArrow()
|
||||
// .getMergedStyle(skinParam().getCurrentStyleBuilder());
|
||||
// return Rainbow.build(style, skinParam().getIHtmlColorSet(), skinParam().getThemeStyle());
|
||||
// } else {
|
||||
// color = Rainbow.build(skinParam());
|
||||
// }
|
||||
// }
|
||||
return color;
|
||||
}
|
||||
|
||||
private Snake getSimpleSnake() {
|
||||
final Snake snake = Snake.create(getInLinkRenderingColor(), Arrows.asToDown()).withLabel(textBlock,
|
||||
HorizontalAlignment.LEFT);
|
||||
final Point2D p1 = pos1.getTranslated(gpoint1.getPoint2D());
|
||||
final Point2D p2 = pos2.getTranslated(gpoint2.getPoint2D());
|
||||
snake.addPoint(p1);
|
||||
snake.addPoint(new Point2D.Double(p2.getX(), p1.getY()));
|
||||
snake.addPoint(p2);
|
||||
return snake;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
// final Snake snake = Snake.create(color, Arrows.asToDown()).withLabel(textBlock, HorizontalAlignment.LEFT);
|
||||
// final Point2D mp1a = translate1.getTranslated(p1);
|
||||
// final Point2D mp2b = translate2.getTranslated(p2);
|
||||
// final double middle = (mp1a.getY() + mp2b.getY()) / 2.0;
|
||||
// snake.addPoint(mp1a);
|
||||
// snake.addPoint(mp1a.getX(), middle);
|
||||
// snake.addPoint(mp2b.getX(), middle);
|
||||
// snake.addPoint(mp2b);
|
||||
// ug.draw(snake);
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
@ -0,0 +1,137 @@
|
||||
/* ========================================================================
|
||||
* 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.activitydiagram3.gtile;
|
||||
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
import net.sourceforge.plantuml.Direction;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.Rainbow;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class GConnectionLeftThenDownThenRight extends GAbstractConnection implements GConnectionTranslatable {
|
||||
|
||||
private final TextBlock textBlock;
|
||||
private final UTranslate pos1;
|
||||
private final UTranslate pos2;
|
||||
|
||||
private final double xright;
|
||||
|
||||
public GConnectionLeftThenDownThenRight(UTranslate pos1, GPoint gpoint1, UTranslate pos2, GPoint gpoint2,
|
||||
double xright, TextBlock textBlock) {
|
||||
super(gpoint1, gpoint2);
|
||||
this.textBlock = textBlock;
|
||||
this.pos1 = pos1;
|
||||
this.pos2 = pos2;
|
||||
this.xright = xright;
|
||||
// See FtileFactoryDelegatorAssembly
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawU(UGraphic ug) {
|
||||
ug.draw(getSimpleSnake());
|
||||
}
|
||||
|
||||
// public double getMaxX(StringBounder stringBounder) {
|
||||
// return getSimpleSnake().getMaxX(stringBounder);
|
||||
// }
|
||||
|
||||
private Rainbow getInLinkRenderingColor() {
|
||||
Rainbow color;
|
||||
color = Rainbow.build(gpoint1.getGtile().skinParam());
|
||||
// final LinkRendering linkRendering = tile.getInLinkRendering();
|
||||
// if (linkRendering == null) {
|
||||
// if (UseStyle.useBetaStyle()) {
|
||||
// final Style style = getDefaultStyleDefinitionArrow()
|
||||
// .getMergedStyle(skinParam().getCurrentStyleBuilder());
|
||||
// return Rainbow.build(style, skinParam().getIHtmlColorSet(), skinParam().getThemeStyle());
|
||||
// } else {
|
||||
// color = Rainbow.build(skinParam());
|
||||
// }
|
||||
// } else {
|
||||
// color = linkRendering.getRainbow();
|
||||
// }
|
||||
// if (color.size() == 0) {
|
||||
// if (UseStyle.useBetaStyle()) {
|
||||
// final Style style = getDefaultStyleDefinitionArrow()
|
||||
// .getMergedStyle(skinParam().getCurrentStyleBuilder());
|
||||
// return Rainbow.build(style, skinParam().getIHtmlColorSet(), skinParam().getThemeStyle());
|
||||
// } else {
|
||||
// color = Rainbow.build(skinParam());
|
||||
// }
|
||||
// }
|
||||
return color;
|
||||
}
|
||||
|
||||
private Snake getSimpleSnake() {
|
||||
final Snake snake = Snake.create(getInLinkRenderingColor(), Arrows.asToLeft())
|
||||
.emphasizeDirection(Direction.DOWN).withLabel(textBlock, HorizontalAlignment.LEFT);
|
||||
final Point2D p1 = pos1.getTranslated(gpoint1.getPoint2D());
|
||||
final Point2D p2 = pos2.getTranslated(gpoint2.getPoint2D());
|
||||
// final double maxX = Math.max(p1.getX(), p2.getX());
|
||||
final double maxX = xright;
|
||||
snake.addPoint(p1);
|
||||
snake.addPoint(new Point2D.Double(maxX, p1.getY()));
|
||||
snake.addPoint(new Point2D.Double(maxX, p2.getY()));
|
||||
snake.addPoint(p2);
|
||||
return snake;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
// final Snake snake = Snake.create(color, Arrows.asToDown()).withLabel(textBlock, HorizontalAlignment.LEFT);
|
||||
// final Point2D mp1a = translate1.getTranslated(p1);
|
||||
// final Point2D mp2b = translate2.getTranslated(p2);
|
||||
// final double middle = (mp1a.getY() + mp2b.getY()) / 2.0;
|
||||
// snake.addPoint(mp1a);
|
||||
// snake.addPoint(mp1a.getX(), middle);
|
||||
// snake.addPoint(mp2b.getX(), middle);
|
||||
// snake.addPoint(mp2b);
|
||||
// ug.draw(snake);
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
/* ========================================================================
|
||||
* 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.activitydiagram3.gtile;
|
||||
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public interface GConnectionTranslatable extends GConnection {
|
||||
|
||||
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2);
|
||||
|
||||
}
|
@ -0,0 +1,129 @@
|
||||
/* ========================================================================
|
||||
* 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.activitydiagram3.gtile;
|
||||
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.Rainbow;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class GConnectionVerticalDown extends GAbstractConnection implements GConnectionTranslatable {
|
||||
|
||||
private final TextBlock textBlock;
|
||||
private final UTranslate pos1;
|
||||
private final UTranslate pos2;
|
||||
|
||||
public GConnectionVerticalDown(UTranslate pos1, GPoint gpoint1, UTranslate pos2, GPoint gpoint2,
|
||||
TextBlock textBlock) {
|
||||
super(gpoint1, gpoint2);
|
||||
this.textBlock = textBlock;
|
||||
this.pos1 = pos1;
|
||||
this.pos2 = pos2;
|
||||
// See FtileFactoryDelegatorAssembly
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawU(UGraphic ug) {
|
||||
ug.draw(getSimpleSnake());
|
||||
}
|
||||
|
||||
// public double getMaxX(StringBounder stringBounder) {
|
||||
// return getSimpleSnake().getMaxX(stringBounder);
|
||||
// }
|
||||
|
||||
private Rainbow getInLinkRenderingColor() {
|
||||
Rainbow color;
|
||||
color = Rainbow.build(gpoint1.getGtile().skinParam());
|
||||
// final LinkRendering linkRendering = tile.getInLinkRendering();
|
||||
// if (linkRendering == null) {
|
||||
// if (UseStyle.useBetaStyle()) {
|
||||
// final Style style = getDefaultStyleDefinitionArrow()
|
||||
// .getMergedStyle(skinParam().getCurrentStyleBuilder());
|
||||
// return Rainbow.build(style, skinParam().getIHtmlColorSet(), skinParam().getThemeStyle());
|
||||
// } else {
|
||||
// color = Rainbow.build(skinParam());
|
||||
// }
|
||||
// } else {
|
||||
// color = linkRendering.getRainbow();
|
||||
// }
|
||||
// if (color.size() == 0) {
|
||||
// if (UseStyle.useBetaStyle()) {
|
||||
// final Style style = getDefaultStyleDefinitionArrow()
|
||||
// .getMergedStyle(skinParam().getCurrentStyleBuilder());
|
||||
// return Rainbow.build(style, skinParam().getIHtmlColorSet(), skinParam().getThemeStyle());
|
||||
// } else {
|
||||
// color = Rainbow.build(skinParam());
|
||||
// }
|
||||
// }
|
||||
return color;
|
||||
}
|
||||
|
||||
private Snake getSimpleSnake() {
|
||||
final Snake snake = Snake.create(getInLinkRenderingColor(), Arrows.asToDown()).withLabel(textBlock,
|
||||
HorizontalAlignment.LEFT);
|
||||
final Point2D p1 = pos1.getTranslated(gpoint1.getPoint2D());
|
||||
final Point2D p2 = pos2.getTranslated(gpoint2.getPoint2D());
|
||||
snake.addPoint(p1);
|
||||
snake.addPoint(p2);
|
||||
return snake;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
// final Snake snake = Snake.create(color, Arrows.asToDown()).withLabel(textBlock, HorizontalAlignment.LEFT);
|
||||
// final Point2D mp1a = translate1.getTranslated(p1);
|
||||
// final Point2D mp2b = translate2.getTranslated(p2);
|
||||
// final double middle = (mp1a.getY() + mp2b.getY()) / 2.0;
|
||||
// snake.addPoint(mp1a);
|
||||
// snake.addPoint(mp1a.getX(), middle);
|
||||
// snake.addPoint(mp2b.getX(), middle);
|
||||
// snake.addPoint(mp2b);
|
||||
// ug.draw(snake);
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
@ -0,0 +1,132 @@
|
||||
/* ========================================================================
|
||||
* 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.activitydiagram3.gtile;
|
||||
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.Rainbow;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UPolygon;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class GConnectionVerticalDownThenHorizontal extends GAbstractConnection implements GConnectionTranslatable {
|
||||
|
||||
private final TextBlock textBlock;
|
||||
private final UTranslate pos1;
|
||||
private final UTranslate pos2;
|
||||
|
||||
public GConnectionVerticalDownThenHorizontal(UTranslate pos1, GPoint gpoint1, UTranslate pos2, GPoint gpoint2,
|
||||
TextBlock textBlock) {
|
||||
super(gpoint1, gpoint2);
|
||||
this.textBlock = textBlock;
|
||||
this.pos1 = pos1;
|
||||
this.pos2 = pos2;
|
||||
// See FtileFactoryDelegatorAssembly
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawU(UGraphic ug) {
|
||||
ug.draw(getSimpleSnake());
|
||||
}
|
||||
|
||||
// public double getMaxX(StringBounder stringBounder) {
|
||||
// return getSimpleSnake().getMaxX(stringBounder);
|
||||
// }
|
||||
|
||||
private Rainbow getInLinkRenderingColor() {
|
||||
Rainbow color;
|
||||
color = Rainbow.build(gpoint1.getGtile().skinParam());
|
||||
// final LinkRendering linkRendering = tile.getInLinkRendering();
|
||||
// if (linkRendering == null) {
|
||||
// if (UseStyle.useBetaStyle()) {
|
||||
// final Style style = getDefaultStyleDefinitionArrow()
|
||||
// .getMergedStyle(skinParam().getCurrentStyleBuilder());
|
||||
// return Rainbow.build(style, skinParam().getIHtmlColorSet(), skinParam().getThemeStyle());
|
||||
// } else {
|
||||
// color = Rainbow.build(skinParam());
|
||||
// }
|
||||
// } else {
|
||||
// color = linkRendering.getRainbow();
|
||||
// }
|
||||
// if (color.size() == 0) {
|
||||
// if (UseStyle.useBetaStyle()) {
|
||||
// final Style style = getDefaultStyleDefinitionArrow()
|
||||
// .getMergedStyle(skinParam().getCurrentStyleBuilder());
|
||||
// return Rainbow.build(style, skinParam().getIHtmlColorSet(), skinParam().getThemeStyle());
|
||||
// } else {
|
||||
// color = Rainbow.build(skinParam());
|
||||
// }
|
||||
// }
|
||||
return color;
|
||||
}
|
||||
|
||||
private Snake getSimpleSnake() {
|
||||
final Point2D p1 = pos1.getTranslated(gpoint1.getPoint2D());
|
||||
final Point2D p2 = pos2.getTranslated(gpoint2.getPoint2D());
|
||||
final UPolygon arrow = p1.getX() < p2.getX() ? Arrows.asToRight() : Arrows.asToLeft();
|
||||
final Snake snake = Snake.create(getInLinkRenderingColor(), arrow).withLabel(textBlock,
|
||||
HorizontalAlignment.LEFT);
|
||||
snake.addPoint(p1);
|
||||
snake.addPoint(new Point2D.Double(p1.getX(), p2.getY()));
|
||||
snake.addPoint(p2);
|
||||
return snake;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
// final Snake snake = Snake.create(color, Arrows.asToDown()).withLabel(textBlock, HorizontalAlignment.LEFT);
|
||||
// final Point2D mp1a = translate1.getTranslated(p1);
|
||||
// final Point2D mp2b = translate2.getTranslated(p2);
|
||||
// final double middle = (mp1a.getY() + mp2b.getY()) / 2.0;
|
||||
// snake.addPoint(mp1a);
|
||||
// snake.addPoint(mp1a.getX(), middle);
|
||||
// snake.addPoint(mp2b.getX(), middle);
|
||||
// snake.addPoint(mp2b);
|
||||
// ug.draw(snake);
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
/* ========================================================================
|
||||
* 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.activitydiagram3.gtile;
|
||||
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class GPoint {
|
||||
|
||||
public static final String NORTH_HOOK = "NORTH_HOOK";
|
||||
public static final String SOUTH_HOOK = "SOUTH_HOOK";
|
||||
public static final String WEST_HOOK = "WEST_HOOK";
|
||||
public static final String EAST_HOOK = "EAST_HOOK";
|
||||
|
||||
public static final String NORTH_BORDER = "NORTH_BORDER";
|
||||
public static final String SOUTH_BORDER = "SOUTH_BORDER";
|
||||
public static final String WEST_BORDER = "WEST_BORDER";
|
||||
public static final String EAST_BORDER = "EAST_BORDER";
|
||||
|
||||
private final Gtile gtile;
|
||||
private final String name;
|
||||
private final LinkRendering linkRendering;
|
||||
|
||||
public GPoint(Gtile gtile, String name, LinkRendering linkRendering) {
|
||||
this.gtile = gtile;
|
||||
this.name = name;
|
||||
this.linkRendering = linkRendering;
|
||||
}
|
||||
|
||||
public GPoint(Gtile gtile, String name) {
|
||||
this(gtile, name, LinkRendering.none());
|
||||
}
|
||||
|
||||
public Gtile getGtile() {
|
||||
return gtile;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public UTranslate getCoord() {
|
||||
return gtile.getCoord(name);
|
||||
}
|
||||
|
||||
public Point2D getPoint2D() {
|
||||
return getCoord().getPosition();
|
||||
}
|
||||
|
||||
public LinkRendering getLinkRendering() {
|
||||
return linkRendering;
|
||||
}
|
||||
|
||||
}
|
@ -30,12 +30,11 @@
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.ugraphic;
|
||||
package net.sourceforge.plantuml.activitydiagram3.gtile;
|
||||
|
||||
public interface Scalable {
|
||||
public interface Gluon {
|
||||
|
||||
public UShape getScaled(double scale);
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
/* ========================================================================
|
||||
* 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.activitydiagram3.gtile;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public interface Gtile extends Swimable2, TextBlock {
|
||||
|
||||
public static final boolean USE_GTILE = false;
|
||||
|
||||
public ISkinParam skinParam();
|
||||
|
||||
public StringBounder getStringBounder();
|
||||
|
||||
// public UTranslate getTranslateFor(Gtile child);
|
||||
|
||||
// public Collection<Gtile> getMyChildren();
|
||||
|
||||
public UTranslate getCoord(String name);
|
||||
|
||||
public GPoint getGPoint(String name);
|
||||
|
||||
public Collection<GConnection> getInnerConnections();
|
||||
|
||||
// public List<WeldingPoint> getWeldingPoints();
|
||||
//
|
||||
// public HorizontalAlignment arrowHorizontalAlignment();
|
||||
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
/* ========================================================================
|
||||
* 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.activitydiagram3.gtile;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.UseStyle;
|
||||
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
|
||||
import net.sourceforge.plantuml.creole.CreoleMode;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
import net.sourceforge.plantuml.style.SName;
|
||||
import net.sourceforge.plantuml.style.Style;
|
||||
import net.sourceforge.plantuml.style.StyleSignature;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class GtileAssembly extends GtileAssemblySimple {
|
||||
|
||||
private final TextBlock textBlock;
|
||||
|
||||
public GtileAssembly(Gtile tile1, Gtile tile2, LinkRendering linkRendering) {
|
||||
super(tile1, tile2);
|
||||
this.textBlock = getTextBlock(linkRendering.getDisplay());
|
||||
// See FtileFactoryDelegatorAssembly
|
||||
}
|
||||
|
||||
@Override
|
||||
protected UTranslate supplementaryMove() {
|
||||
final double height = 30 + textBlock.calculateDimension(stringBounder).getHeight();
|
||||
return new UTranslate(0, height);
|
||||
}
|
||||
|
||||
final public StyleSignature getDefaultStyleDefinitionArrow() {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.arrow);
|
||||
}
|
||||
|
||||
protected final TextBlock getTextBlock(Display display) {
|
||||
// DUP3945
|
||||
if (Display.isNull(display)) {
|
||||
return TextBlockUtils.EMPTY_TEXT_BLOCK;
|
||||
}
|
||||
final FontConfiguration fontConfiguration;
|
||||
if (UseStyle.useBetaStyle()) {
|
||||
final Style style = getDefaultStyleDefinitionArrow().getMergedStyle(skinParam().getCurrentStyleBuilder());
|
||||
fontConfiguration = style.getFontConfiguration(skinParam().getThemeStyle(), skinParam().getIHtmlColorSet());
|
||||
} else {
|
||||
fontConfiguration = new FontConfiguration(skinParam(), FontParam.ARROW, null);
|
||||
}
|
||||
return display.create7(fontConfiguration, HorizontalAlignment.LEFT, skinParam(), CreoleMode.SIMPLE_LINE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<GConnection> getInnerConnections() {
|
||||
final GConnection arrow = new GConnectionVerticalDown(getPos1(), tile1.getGPoint(GPoint.SOUTH_HOOK), getPos2(),
|
||||
tile2.getGPoint(GPoint.NORTH_HOOK), textBlock);
|
||||
return Collections.singletonList(arrow);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,138 @@
|
||||
/* ========================================================================
|
||||
* 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.activitydiagram3.gtile;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
import net.sourceforge.plantuml.utils.MathUtils;
|
||||
|
||||
public class GtileAssemblySimple extends AbstractGtile {
|
||||
|
||||
protected final Gtile tile1;
|
||||
protected final Gtile tile2;
|
||||
|
||||
private final Dimension2D dim1;
|
||||
private final Dimension2D dim2;
|
||||
|
||||
private final UTranslate pos1;
|
||||
private final UTranslate pos2;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GtileAssemblySimple " + tile1 + " && " + tile2;
|
||||
}
|
||||
|
||||
public GtileAssemblySimple(Gtile tile1, Gtile tile2) {
|
||||
super(tile1.getStringBounder(), tile1.skinParam());
|
||||
this.tile1 = tile1;
|
||||
this.tile2 = tile2;
|
||||
|
||||
this.dim1 = tile1.calculateDimension(stringBounder);
|
||||
this.dim2 = tile2.calculateDimension(stringBounder);
|
||||
|
||||
final UTranslate vector1 = tile1.getCoord(GPoint.SOUTH_HOOK);
|
||||
final UTranslate vector2 = tile2.getCoord(GPoint.NORTH_HOOK);
|
||||
|
||||
// final UTranslate diff = vector1.compose(vector2.reverse());
|
||||
// this.pos1 = diff.getDx() > 0 ? UTranslate.none() : UTranslate.dx(-diff.getDx());
|
||||
// this.pos2 = diff.compose(this.pos1);
|
||||
|
||||
final double maxDx = Math.max(vector1.getDx(), vector2.getDx());
|
||||
this.pos1 = UTranslate.dx(maxDx - vector1.getDx());
|
||||
this.pos2 = new UTranslate(maxDx - vector2.getDx(), dim1.getHeight());
|
||||
}
|
||||
|
||||
protected UTranslate supplementaryMove() {
|
||||
return new UTranslate();
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public List<GPoint> getHooks() {
|
||||
// return Arrays.asList(tile1.getGPoint(GPoint.SOUTH), tile2.getGPoint(GPoint.NORTH));
|
||||
// }
|
||||
|
||||
@Override
|
||||
public UTranslate getCoord(String name) {
|
||||
if (name.equals(GPoint.NORTH_HOOK))
|
||||
return getPos1().compose(tile1.getCoord(name));
|
||||
if (name.equals(GPoint.SOUTH_HOOK))
|
||||
return getPos2().compose(tile2.getCoord(name));
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
protected UTranslate getPos1() {
|
||||
return pos1;
|
||||
}
|
||||
|
||||
protected UTranslate getPos2() {
|
||||
return pos2.compose(supplementaryMove());
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
ug.apply(getPos1()).draw(tile1);
|
||||
ug.apply(getPos2()).draw(tile2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
||||
final Point2D corner1 = getPos1().getTranslated(dim1);
|
||||
final Point2D corner2 = getPos2().getTranslated(dim2);
|
||||
return new Dimension2DDouble(MathUtils.max(corner1, corner2));
|
||||
}
|
||||
|
||||
public Set<Swimlane> getSwimlanes() {
|
||||
final Set<Swimlane> result = new HashSet<>();
|
||||
result.addAll(tile1.getSwimlanes());
|
||||
result.addAll(tile2.getSwimlanes());
|
||||
return Collections.unmodifiableSet(result);
|
||||
}
|
||||
|
||||
public Collection<Gtile> getMyChildren() {
|
||||
return Arrays.asList(tile1, tile2);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,237 @@
|
||||
/* ========================================================================
|
||||
* 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.activitydiagram3.gtile;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
|
||||
import net.sourceforge.plantuml.ColorParam;
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.LineBreakStrategy;
|
||||
import net.sourceforge.plantuml.SkinParamColors;
|
||||
import net.sourceforge.plantuml.SkinParamUtils;
|
||||
import net.sourceforge.plantuml.UseStyle;
|
||||
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.creole.CreoleMode;
|
||||
import net.sourceforge.plantuml.creole.Parser;
|
||||
import net.sourceforge.plantuml.creole.Sheet;
|
||||
import net.sourceforge.plantuml.creole.SheetBlock1;
|
||||
import net.sourceforge.plantuml.creole.SheetBlock2;
|
||||
import net.sourceforge.plantuml.creole.Stencil;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.Rainbow;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft;
|
||||
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.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.HColorNone;
|
||||
|
||||
public class GtileBox extends AbstractGtile {
|
||||
|
||||
private final ClockwiseTopRightBottomLeft padding;
|
||||
private final ClockwiseTopRightBottomLeft margin;
|
||||
|
||||
private final TextBlock tb;
|
||||
private double roundCorner = 25;
|
||||
private final double shadowing;
|
||||
private final HorizontalAlignment horizontalAlignment;
|
||||
private double minimumWidth = 0;
|
||||
|
||||
private final LinkRendering inRendering;
|
||||
private final Swimlane swimlane;
|
||||
private final BoxStyle boxStyle;
|
||||
|
||||
private final HColor borderColor;
|
||||
private final HColor backColor;
|
||||
private final Style style;
|
||||
|
||||
static public StyleSignature getDefaultStyleDefinitionActivity() {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activity);
|
||||
}
|
||||
|
||||
static public StyleSignature getDefaultStyleDefinitionArrow() {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.arrow);
|
||||
}
|
||||
|
||||
final public LinkRendering getInLinkRendering() {
|
||||
return inRendering;
|
||||
}
|
||||
|
||||
class MyStencil implements Stencil {
|
||||
|
||||
public double getStartingX(StringBounder stringBounder, double y) {
|
||||
return -padding.getLeft();
|
||||
}
|
||||
|
||||
public double getEndingX(StringBounder stringBounder, double y) {
|
||||
final Dimension2D dim = calculateDimension(stringBounder);
|
||||
return dim.getWidth() - padding.getRight();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static GtileBox create(StringBounder stringBounder, ISkinParam skinParam, Display label, Swimlane swimlane,
|
||||
BoxStyle boxStyle, Stereotype stereotype) {
|
||||
Style style = null;
|
||||
Style styleArrow = null;
|
||||
if (UseStyle.useBetaStyle()) {
|
||||
style = getDefaultStyleDefinitionActivity().with(stereotype)
|
||||
.getMergedStyle(skinParam.getCurrentStyleBuilder());
|
||||
styleArrow = getDefaultStyleDefinitionArrow().getMergedStyle(skinParam.getCurrentStyleBuilder());
|
||||
}
|
||||
return new GtileBox(stringBounder, skinParam, label, swimlane, boxStyle, style, styleArrow);
|
||||
}
|
||||
|
||||
private GtileBox(StringBounder stringBounder, ISkinParam skinParam, Display label, Swimlane swimlane,
|
||||
BoxStyle boxStyle, Style style, Style styleArrow) {
|
||||
super(stringBounder, skinParam);
|
||||
this.style = style;
|
||||
this.boxStyle = boxStyle;
|
||||
this.swimlane = swimlane;
|
||||
final FontConfiguration fc;
|
||||
final LineBreakStrategy wrapWidth;
|
||||
if (UseStyle.useBetaStyle()) {
|
||||
this.inRendering = new LinkRendering(
|
||||
Rainbow.build(styleArrow, getIHtmlColorSet(), skinParam.getThemeStyle()));
|
||||
Colors specBack = null;
|
||||
if (skinParam instanceof SkinParamColors) {
|
||||
specBack = ((SkinParamColors) skinParam).getColors();
|
||||
}
|
||||
style = style.eventuallyOverride(specBack);
|
||||
this.borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet());
|
||||
this.backColor = style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet());
|
||||
fc = style.getFontConfiguration(skinParam.getThemeStyle(), getIHtmlColorSet());
|
||||
this.horizontalAlignment = style.getHorizontalAlignment();
|
||||
this.padding = style.getPadding();
|
||||
this.margin = style.getMargin();
|
||||
this.roundCorner = style.value(PName.RoundCorner).asDouble();
|
||||
this.shadowing = style.value(PName.Shadowing).asDouble();
|
||||
wrapWidth = style.wrapWidth();
|
||||
this.minimumWidth = style.value(PName.MinimumWidth).asDouble();
|
||||
} else {
|
||||
this.padding = ClockwiseTopRightBottomLeft.same(10);
|
||||
this.margin = ClockwiseTopRightBottomLeft.same(0);
|
||||
this.inRendering = new LinkRendering(Rainbow.build(skinParam));
|
||||
this.borderColor = SkinParamUtils.getColor(skinParam(), null, ColorParam.activityBorder);
|
||||
this.backColor = SkinParamUtils.getColor(skinParam(), null, ColorParam.activityBackground);
|
||||
fc = new FontConfiguration(skinParam, FontParam.ACTIVITY, null);
|
||||
this.horizontalAlignment = HorizontalAlignment.LEFT;
|
||||
this.shadowing = skinParam().shadowing(null) ? 3.0 : 0.0;
|
||||
wrapWidth = skinParam.wrapWidth();
|
||||
|
||||
}
|
||||
final Sheet sheet = Parser
|
||||
.build(fc, skinParam.getDefaultTextAlignment(horizontalAlignment), skinParam, CreoleMode.FULL)
|
||||
.createSheet(label);
|
||||
this.tb = new SheetBlock2(new SheetBlock1(sheet, wrapWidth, skinParam.getPadding()), new MyStencil(),
|
||||
new UStroke(1));
|
||||
this.print = label.toString();
|
||||
|
||||
}
|
||||
|
||||
final private String print;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return print;
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
final Dimension2D dimTotal = calculateDimension(ug.getStringBounder());
|
||||
final double widthTotal = dimTotal.getWidth();
|
||||
final double heightTotal = dimTotal.getHeight();
|
||||
final UDrawable shape = boxStyle.getUDrawable(widthTotal, heightTotal, shadowing, roundCorner);
|
||||
|
||||
final UStroke thickness;
|
||||
if (UseStyle.useBetaStyle()) {
|
||||
thickness = style.getStroke();
|
||||
} else {
|
||||
thickness = getThickness();
|
||||
}
|
||||
|
||||
if (borderColor == null) {
|
||||
ug = ug.apply(new HColorNone());
|
||||
} else {
|
||||
ug = ug.apply(borderColor);
|
||||
}
|
||||
if (backColor == null) {
|
||||
ug = ug.apply(new HColorNone().bg());
|
||||
} else {
|
||||
ug = ug.apply(backColor.bg());
|
||||
}
|
||||
|
||||
ug = ug.apply(thickness);
|
||||
shape.drawU(ug);
|
||||
|
||||
if (horizontalAlignment == HorizontalAlignment.LEFT) {
|
||||
tb.drawU(ug.apply(new UTranslate(padding.getLeft(), padding.getTop())));
|
||||
} else if (horizontalAlignment == HorizontalAlignment.RIGHT) {
|
||||
final Dimension2D dimTb = tb.calculateDimension(ug.getStringBounder());
|
||||
tb.drawU(ug.apply(
|
||||
new UTranslate(dimTotal.getWidth() - dimTb.getWidth() - padding.getRight(), padding.getBottom())));
|
||||
} else if (horizontalAlignment == HorizontalAlignment.CENTER) {
|
||||
final Dimension2D dimTb = tb.calculateDimension(ug.getStringBounder());
|
||||
tb.drawU(ug.apply(new UTranslate((dimTotal.getWidth() - dimTb.getWidth()) / 2, padding.getBottom())));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Dimension2D calculateDimension(StringBounder stringBounder) {
|
||||
Dimension2D dimRaw = tb.calculateDimension(stringBounder);
|
||||
dimRaw = Dimension2DDouble.delta(dimRaw, padding.getLeft() + padding.getRight(),
|
||||
padding.getBottom() + padding.getTop());
|
||||
dimRaw = Dimension2DDouble.atLeast(dimRaw, minimumWidth, 0);
|
||||
return new FtileGeometry(dimRaw.getWidth() + boxStyle.getShield(), dimRaw.getHeight(), dimRaw.getWidth() / 2, 0,
|
||||
dimRaw.getHeight());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
/* ========================================================================
|
||||
* 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.activitydiagram3.gtile;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.UseStyle;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.style.PName;
|
||||
import net.sourceforge.plantuml.style.Style;
|
||||
import net.sourceforge.plantuml.ugraphic.UEllipse;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorNone;
|
||||
|
||||
public class GtileCircleStart extends AbstractGtile {
|
||||
|
||||
private static final int SIZE = 20;
|
||||
|
||||
private final HColor backColor;
|
||||
private double shadowing;
|
||||
|
||||
public GtileCircleStart(StringBounder stringBounder, ISkinParam skinParam, HColor backColor, Swimlane swimlane,
|
||||
Style style) {
|
||||
super(stringBounder, skinParam, swimlane);
|
||||
this.backColor = backColor;
|
||||
if (UseStyle.useBetaStyle()) {
|
||||
this.shadowing = style.value(PName.Shadowing).asDouble();
|
||||
} else {
|
||||
if (skinParam().shadowing(null)) {
|
||||
this.shadowing = 3;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
final UEllipse circle = new UEllipse(SIZE, SIZE);
|
||||
circle.setDeltaShadow(shadowing);
|
||||
ug.apply(new HColorNone()).apply(backColor.bg()).draw(circle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
||||
return new Dimension2DDouble(SIZE, SIZE);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,115 @@
|
||||
/* ========================================================================
|
||||
* 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.activitydiagram3.gtile;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.UseStyle;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Hexagon;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
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.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
|
||||
public class GtileDiamondInside extends AbstractGtile {
|
||||
|
||||
protected final HColor backColor;
|
||||
protected final HColor borderColor;
|
||||
|
||||
protected final TextBlock label;
|
||||
protected final Dimension2D dimLabel;
|
||||
|
||||
protected final double shadowing;
|
||||
|
||||
final public StyleSignature getDefaultStyleDefinition() {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activity, SName.diamond);
|
||||
}
|
||||
|
||||
// FtileDiamondInside
|
||||
public GtileDiamondInside(StringBounder stringBounder, TextBlock label, ISkinParam skinParam, HColor backColor,
|
||||
HColor borderColor, Swimlane swimlane) {
|
||||
super(stringBounder, skinParam, swimlane);
|
||||
if (UseStyle.useBetaStyle()) {
|
||||
Style style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder());
|
||||
this.borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet());
|
||||
this.backColor = style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet());
|
||||
this.shadowing = style.value(PName.Shadowing).asDouble();
|
||||
} else {
|
||||
this.backColor = backColor;
|
||||
this.borderColor = borderColor;
|
||||
this.shadowing = skinParam().shadowing(null) ? 3 : 0;
|
||||
}
|
||||
|
||||
this.label = label;
|
||||
this.dimLabel = label.calculateDimension(stringBounder);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
||||
final Dimension2D dim;
|
||||
if (dimLabel.getWidth() == 0 || dimLabel.getHeight() == 0) {
|
||||
dim = new Dimension2DDouble(Hexagon.hexagonHalfSize * 2, Hexagon.hexagonHalfSize * 2);
|
||||
} else {
|
||||
dim = Dimension2DDouble.delta(
|
||||
Dimension2DDouble.atLeast(dimLabel, Hexagon.hexagonHalfSize * 2, Hexagon.hexagonHalfSize * 2),
|
||||
Hexagon.hexagonHalfSize * 2, 0);
|
||||
}
|
||||
return dim;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawU(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final Dimension2D dimTotal = calculateDimension(stringBounder);
|
||||
ug = ug.apply(borderColor).apply(getThickness()).apply(backColor.bg());
|
||||
ug.draw(Hexagon.asPolygon(shadowing, dimTotal.getWidth(), dimTotal.getHeight()));
|
||||
|
||||
final double lx = (dimTotal.getWidth() - dimLabel.getWidth()) / 2;
|
||||
final double ly = (dimTotal.getHeight() - dimLabel.getHeight()) / 2;
|
||||
label.drawU(ug.apply(new UTranslate(lx, ly)));
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,107 @@
|
||||
/* ========================================================================
|
||||
* 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.activitydiagram3.gtile;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
|
||||
public class GtileEmpty extends AbstractGtile {
|
||||
|
||||
private final double width;
|
||||
private final double height;
|
||||
|
||||
public GtileEmpty(StringBounder stringBounder, ISkinParam skinParam, double width, double height) {
|
||||
this(stringBounder, skinParam, width, height, null);
|
||||
}
|
||||
|
||||
public GtileEmpty(StringBounder stringBounder, ISkinParam skinParam) {
|
||||
this(stringBounder, skinParam, 0, 0, null);
|
||||
}
|
||||
|
||||
public GtileEmpty(StringBounder stringBounder, ISkinParam skinParam, Swimlane swimlane) {
|
||||
this(stringBounder, skinParam, 0, 0, swimlane);
|
||||
}
|
||||
|
||||
public GtileEmpty(StringBounder stringBounder, ISkinParam skinParam, double width, double height, Swimlane swimlane) {
|
||||
super(stringBounder, skinParam, swimlane);
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "FtileEmpty";
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
||||
return new Dimension2DDouble(width, height);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// protected FtileGeometry calculateDimensionFtile(StringBounder stringBounder) {
|
||||
// return calculateDimensionEmpty();
|
||||
// }
|
||||
//
|
||||
// final protected FtileGeometry calculateDimensionEmpty() {
|
||||
// return new FtileGeometry(width, height, width / 2, 0, height);
|
||||
// }
|
||||
//
|
||||
// public Swimlane getSwimlaneIn() {
|
||||
// return swimlane;
|
||||
// }
|
||||
//
|
||||
// public Swimlane getSwimlaneOut() {
|
||||
// return swimlane;
|
||||
// }
|
||||
//
|
||||
// public Set<Swimlane> getSwimlanes() {
|
||||
// final Set<Swimlane> result = new HashSet<>();
|
||||
// if (swimlane != null) {
|
||||
// result.add(swimlane);
|
||||
// }
|
||||
// return Collections.unmodifiableSet(result);
|
||||
// }
|
||||
|
||||
}
|
@ -0,0 +1,247 @@
|
||||
/* ========================================================================
|
||||
* 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.activitydiagram3.gtile;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
|
||||
import net.sourceforge.plantuml.ColorParam;
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.LineBreakStrategy;
|
||||
import net.sourceforge.plantuml.UseStyle;
|
||||
import net.sourceforge.plantuml.activitydiagram3.Branch;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Hexagon;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.creole.CreoleMode;
|
||||
import net.sourceforge.plantuml.creole.Parser;
|
||||
import net.sourceforge.plantuml.creole.Sheet;
|
||||
import net.sourceforge.plantuml.creole.SheetBlock1;
|
||||
import net.sourceforge.plantuml.creole.SheetBlock2;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
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.ConditionEndStyle;
|
||||
import net.sourceforge.plantuml.svek.ConditionStyle;
|
||||
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;
|
||||
|
||||
public class GtileIfHexagon extends GtileIfSimple {
|
||||
|
||||
private final List<Branch> branches;
|
||||
private final Gtile shape1;
|
||||
private final Gtile shape2;
|
||||
|
||||
private final UTranslate positionShape1;
|
||||
private final UTranslate positionShape2;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GtileIfHexagon " + gtiles;
|
||||
}
|
||||
|
||||
// ConditionalBuilder
|
||||
// FtileFactoryDelegatorIf
|
||||
|
||||
public GtileIfHexagon(Swimlane swimlane, List<Gtile> gtiles, List<Branch> branches) {
|
||||
super(gtiles);
|
||||
|
||||
final ConditionStyle conditionStyle = skinParam().getConditionStyle();
|
||||
final ConditionEndStyle conditionEndStyle = skinParam().getConditionEndStyle();
|
||||
|
||||
this.branches = branches;
|
||||
|
||||
final Branch branch0 = branches.get(0);
|
||||
|
||||
final HColor borderColor;
|
||||
final HColor backColor;
|
||||
final FontConfiguration fcTest;
|
||||
|
||||
if (UseStyle.useBetaStyle()) {
|
||||
final Style styleArrow = getDefaultStyleDefinitionArrow()
|
||||
.getMergedStyle(skinParam().getCurrentStyleBuilder());
|
||||
final Style styleDiamond = getDefaultStyleDefinitionDiamond()
|
||||
.getMergedStyle(skinParam().getCurrentStyleBuilder());
|
||||
borderColor = styleDiamond.value(PName.LineColor).asColor(skinParam().getThemeStyle(),
|
||||
skinParam().getIHtmlColorSet());
|
||||
backColor = branch0.getColor() == null ? styleDiamond.value(PName.BackGroundColor)
|
||||
.asColor(skinParam().getThemeStyle(), skinParam().getIHtmlColorSet()) : branch0.getColor();
|
||||
// arrowColor = Rainbow.build(styleArrow, skinParam().getIHtmlColorSet(), skinParam().getThemeStyle());
|
||||
fcTest = styleDiamond.getFontConfiguration(skinParam().getThemeStyle(), skinParam().getIHtmlColorSet());
|
||||
// fcArrow = styleArrow.getFontConfiguration(skinParam().getThemeStyle(), skinParam().getIHtmlColorSet());
|
||||
} else {
|
||||
final FontParam testParam = conditionStyle == ConditionStyle.INSIDE_HEXAGON ? FontParam.ACTIVITY_DIAMOND
|
||||
: FontParam.ARROW;
|
||||
|
||||
borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder);
|
||||
backColor = branch0.getColor() == null
|
||||
? getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBackground)
|
||||
: branch0.getColor();
|
||||
// arrowColor = Rainbow.build(skinParam());
|
||||
fcTest = new FontConfiguration(skinParam(), testParam, null)
|
||||
.changeColor(fontColor(FontParam.ACTIVITY_DIAMOND));
|
||||
// fcArrow = new FontConfiguration(skinParam(), FontParam.ARROW, null);
|
||||
}
|
||||
|
||||
final Sheet sheet = Parser.build(fcTest, skinParam().getDefaultTextAlignment(HorizontalAlignment.LEFT),
|
||||
skinParam(), CreoleMode.FULL).createSheet(branch0.getLabelTest());
|
||||
final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, LineBreakStrategy.NONE, skinParam().getPadding());
|
||||
final TextBlock tbTest = new SheetBlock2(sheetBlock1, Hexagon.asStencil(sheetBlock1), new UStroke());
|
||||
|
||||
this.shape1 = new GtileDiamondInside(getStringBounder(), tbTest, skinParam(), backColor, borderColor, swimlane);
|
||||
this.shape2 = new GtileDiamondInside(getStringBounder(), TextBlockUtils.EMPTY_TEXT_BLOCK, skinParam(),
|
||||
backColor, borderColor, swimlane);
|
||||
|
||||
final double height1 = shape1.calculateDimension(stringBounder).getHeight() + getSuppHeightMargin();
|
||||
|
||||
// public GtileDiamondInside(StringBounder stringBounder, TextBlock label, ISkinParam skinParam, HColor backColor,
|
||||
// HColor borderColor, Swimlane swimlane) {
|
||||
|
||||
for (ListIterator<UTranslate> it = positions.listIterator(); it.hasNext();) {
|
||||
final UTranslate tmp = it.next();
|
||||
it.set(tmp.compose(UTranslate.dy(height1)));
|
||||
}
|
||||
|
||||
if (branches.size() == 1) {
|
||||
final UTranslate tmp = positions.get(0);
|
||||
positions.set(0, tmp.compose(UTranslate.dx(missingSpace())));
|
||||
}
|
||||
|
||||
this.positionShape1 = this.getCoord(GPoint.NORTH_HOOK).compose(shape1.getCoord(GPoint.NORTH_HOOK).reverse());
|
||||
this.positionShape2 = this.getCoord(GPoint.SOUTH_HOOK).compose(shape2.getCoord(GPoint.SOUTH_HOOK).reverse());
|
||||
|
||||
}
|
||||
|
||||
private double missingSpace() {
|
||||
if (branches.size() != 1)
|
||||
throw new IllegalStateException();
|
||||
return 25;
|
||||
}
|
||||
|
||||
private double getSuppHeightMargin() {
|
||||
if (branches.size() == 1)
|
||||
return 30;
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
||||
final double height2 = shape2.calculateDimension(stringBounder).getHeight() + getSuppHeightMargin();
|
||||
final Dimension2D nude = super.calculateDimension(stringBounder);
|
||||
if (branches.size() > 1)
|
||||
return Dimension2DDouble.delta(nude, 0, height2);
|
||||
return Dimension2DDouble.delta(nude, missingSpace(), height2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UTranslate getCoord(String name) {
|
||||
final UTranslate result = super.getCoord(name);
|
||||
return result;
|
||||
}
|
||||
|
||||
private HColor fontColor(FontParam param) {
|
||||
return skinParam().getFontHtmlColor(null, param);
|
||||
}
|
||||
|
||||
final public StyleSignature getDefaultStyleDefinitionActivity() {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activity);
|
||||
}
|
||||
|
||||
final public StyleSignature getDefaultStyleDefinitionDiamond() {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activity, SName.diamond);
|
||||
}
|
||||
|
||||
final public StyleSignature getDefaultStyleDefinitionArrow() {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.arrow);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawU(UGraphic ug) {
|
||||
super.drawU(ug);
|
||||
|
||||
shape1.drawU(ug.apply(positionShape1));
|
||||
shape2.drawU(ug.apply(positionShape2));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<GConnection> getInnerConnections() {
|
||||
if (branches.size() == 1) {
|
||||
final GConnection arrow1 = new GConnectionVerticalDown(positionShape1, shape1.getGPoint(GPoint.SOUTH_HOOK),
|
||||
positions.get(0), gtiles.get(0).getGPoint(GPoint.NORTH_HOOK), TextBlockUtils.EMPTY_TEXT_BLOCK);
|
||||
final GConnection arrow2 = new GConnectionVerticalDown(positions.get(0),
|
||||
gtiles.get(0).getGPoint(GPoint.SOUTH_HOOK), positionShape2, shape2.getGPoint(GPoint.NORTH_HOOK),
|
||||
TextBlockUtils.EMPTY_TEXT_BLOCK);
|
||||
|
||||
final Dimension2D totalDim = calculateDimension(stringBounder);
|
||||
|
||||
final GConnection arrow3 = new GConnectionLeftThenDownThenRight(positionShape1,
|
||||
shape1.getGPoint(GPoint.EAST_HOOK), positionShape2, shape2.getGPoint(GPoint.EAST_HOOK), totalDim.getWidth(),
|
||||
TextBlockUtils.EMPTY_TEXT_BLOCK);
|
||||
return Arrays.asList(arrow1, arrow2, arrow3);
|
||||
// return Arrays.asList(arrow3);
|
||||
} else if (branches.size() == 2) {
|
||||
final GConnection arrow1 = new GConnectionHorizontalThenVerticalDown(positionShape1,
|
||||
shape1.getGPoint(GPoint.WEST_HOOK), positions.get(0), gtiles.get(0).getGPoint(GPoint.NORTH_HOOK),
|
||||
TextBlockUtils.EMPTY_TEXT_BLOCK);
|
||||
final GConnection arrow2 = new GConnectionHorizontalThenVerticalDown(positionShape1,
|
||||
shape1.getGPoint(GPoint.EAST_HOOK), positions.get(1), gtiles.get(1).getGPoint(GPoint.NORTH_HOOK),
|
||||
TextBlockUtils.EMPTY_TEXT_BLOCK);
|
||||
|
||||
final GConnection arrow3 = new GConnectionVerticalDownThenHorizontal(positions.get(0),
|
||||
gtiles.get(0).getGPoint(GPoint.SOUTH_HOOK), positionShape2, shape2.getGPoint(GPoint.WEST_HOOK),
|
||||
TextBlockUtils.EMPTY_TEXT_BLOCK);
|
||||
final GConnection arrow4 = new GConnectionVerticalDownThenHorizontal(positions.get(1),
|
||||
gtiles.get(1).getGPoint(GPoint.SOUTH_HOOK), positionShape2, shape2.getGPoint(GPoint.EAST_HOOK),
|
||||
TextBlockUtils.EMPTY_TEXT_BLOCK);
|
||||
|
||||
return Arrays.asList(arrow1, arrow2, arrow3, arrow4);
|
||||
}
|
||||
return super.getInnerConnections();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,114 @@
|
||||
/* ========================================================================
|
||||
* 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.activitydiagram3.gtile;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
import net.sourceforge.plantuml.utils.MathUtils;
|
||||
|
||||
public class GtileIfSimple extends AbstractGtile {
|
||||
|
||||
protected final List<Gtile> gtiles;
|
||||
private final List<Dimension2D> dims = new ArrayList<>();
|
||||
protected final List<UTranslate> positions = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GtileIfSimple " + gtiles;
|
||||
}
|
||||
|
||||
public GtileIfSimple(List<Gtile> gtiles) {
|
||||
super(gtiles.get(0).getStringBounder(), gtiles.get(0).skinParam());
|
||||
this.gtiles = gtiles;
|
||||
|
||||
double dx = 0;
|
||||
for (Gtile tile : gtiles) {
|
||||
final Dimension2D dim = tile.calculateDimension(getStringBounder());
|
||||
final UTranslate pos = UTranslate.dx(dx);
|
||||
dx += dim.getWidth() + getMargin();
|
||||
dims.add(dim);
|
||||
positions.add(pos);
|
||||
}
|
||||
}
|
||||
|
||||
private double getMargin() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
for (int i = 0; i < gtiles.size(); i++) {
|
||||
final Gtile tile = gtiles.get(i);
|
||||
final UTranslate pos = positions.get(i);
|
||||
ug.apply(pos).draw(tile);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
||||
Point2D result = new Point2D.Double();
|
||||
for (int i = 0; i < dims.size(); i++) {
|
||||
final Dimension2D dim = dims.get(i);
|
||||
final UTranslate pos = positions.get(i);
|
||||
final Point2D corner = pos.getTranslated(dim);
|
||||
result = MathUtils.max(result, corner);
|
||||
}
|
||||
return new Dimension2DDouble(result);
|
||||
}
|
||||
|
||||
public Set<Swimlane> getSwimlanes() {
|
||||
final Set<Swimlane> result = new HashSet<>();
|
||||
for (Gtile tile : gtiles)
|
||||
result.addAll(tile.getSwimlanes());
|
||||
return Collections.unmodifiableSet(result);
|
||||
}
|
||||
|
||||
public Collection<Gtile> getMyChildren() {
|
||||
return Collections.unmodifiableCollection(gtiles);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,173 @@
|
||||
/* ========================================================================
|
||||
* 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.activitydiagram3.gtile;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
|
||||
import net.sourceforge.plantuml.AlignmentParam;
|
||||
import net.sourceforge.plantuml.ColorParam;
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.LineBreakStrategy;
|
||||
import net.sourceforge.plantuml.UseStyle;
|
||||
import net.sourceforge.plantuml.activitydiagram3.PositionedNote;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.creole.CreoleMode;
|
||||
import net.sourceforge.plantuml.creole.Parser;
|
||||
import net.sourceforge.plantuml.creole.Sheet;
|
||||
import net.sourceforge.plantuml.creole.SheetBlock1;
|
||||
import net.sourceforge.plantuml.creole.SheetBlock2;
|
||||
import net.sourceforge.plantuml.creole.Stencil;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||
import net.sourceforge.plantuml.skin.rose.Rose;
|
||||
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.style.Styleable;
|
||||
import net.sourceforge.plantuml.svek.image.Opale;
|
||||
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;
|
||||
|
||||
public class GtileWithNoteOpale extends AbstractGtile implements Stencil, Styleable {
|
||||
|
||||
private final Gtile tile;
|
||||
private final Opale opale;
|
||||
|
||||
private final NotePosition notePosition;
|
||||
private final double suppSpace = 20;
|
||||
private final Swimlane swimlaneNote;
|
||||
|
||||
private final UTranslate positionNote;
|
||||
private final UTranslate positionTile;
|
||||
|
||||
private final Dimension2D dimNote;
|
||||
private final Dimension2D dimTile;
|
||||
|
||||
public StyleSignature getDefaultStyleDefinition() {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.note);
|
||||
}
|
||||
|
||||
public GtileWithNoteOpale(Gtile tile, PositionedNote note, ISkinParam skinParam, boolean withLink) {
|
||||
super(tile.getStringBounder(), tile.skinParam());
|
||||
this.swimlaneNote = note.getSwimlaneNote();
|
||||
if (note.getColors() != null) {
|
||||
skinParam = note.getColors().mute(skinParam);
|
||||
}
|
||||
this.tile = tile;
|
||||
this.notePosition = note.getNotePosition();
|
||||
if (note.getType() == NoteType.FLOATING_NOTE) {
|
||||
withLink = false;
|
||||
}
|
||||
|
||||
final Rose rose = new Rose();
|
||||
|
||||
final HColor noteBackgroundColor;
|
||||
final HColor borderColor;
|
||||
final FontConfiguration fc;
|
||||
|
||||
final double shadowing;
|
||||
final LineBreakStrategy wrapWidth;
|
||||
if (UseStyle.useBetaStyle()) {
|
||||
final Style style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder())
|
||||
.eventuallyOverride(note.getColors());
|
||||
noteBackgroundColor = style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(),
|
||||
getIHtmlColorSet());
|
||||
borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet());
|
||||
fc = style.getFontConfiguration(skinParam.getThemeStyle(), getIHtmlColorSet());
|
||||
shadowing = style.value(PName.Shadowing).asDouble();
|
||||
wrapWidth = style.wrapWidth();
|
||||
} else {
|
||||
noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.noteBackground);
|
||||
borderColor = rose.getHtmlColor(skinParam, ColorParam.noteBorder);
|
||||
fc = new FontConfiguration(skinParam, FontParam.NOTE, null);
|
||||
shadowing = skinParam.shadowing(null) ? 4 : 0;
|
||||
wrapWidth = skinParam.wrapWidth();
|
||||
}
|
||||
|
||||
final HorizontalAlignment align = skinParam.getHorizontalAlignment(AlignmentParam.noteTextAlignment, null,
|
||||
false, null);
|
||||
final Sheet sheet = Parser.build(fc, align, skinParam, CreoleMode.FULL).createSheet(note.getDisplay());
|
||||
final TextBlock text = new SheetBlock2(new SheetBlock1(sheet, wrapWidth, skinParam.getPadding()), this,
|
||||
new UStroke(1));
|
||||
this.opale = new Opale(shadowing, borderColor, noteBackgroundColor, text, withLink);
|
||||
|
||||
this.dimNote = opale.calculateDimension(stringBounder);
|
||||
this.dimTile = tile.calculateDimension(stringBounder);
|
||||
|
||||
final Dimension2D dimTotal = calculateDimension(stringBounder);
|
||||
|
||||
this.positionNote = new UTranslate(0, (dimTotal.getHeight() - dimNote.getHeight()) / 2);
|
||||
this.positionTile = new UTranslate(dimNote.getWidth() + suppSpace,
|
||||
(dimTotal.getHeight() - dimTile.getHeight()) / 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UTranslate getCoord(String name) {
|
||||
return tile.getCoord(name).compose(positionTile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
||||
final double height = Math.max(dimNote.getHeight(), dimTile.getHeight());
|
||||
return new Dimension2DDouble(dimTile.getWidth() + dimNote.getWidth() + suppSpace, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawU(UGraphic ug) {
|
||||
ug.apply(positionNote).draw(opale);
|
||||
ug.apply(positionTile).draw(tile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getStartingX(StringBounder stringBounder, double y) {
|
||||
return -opale.getMarginX1();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getEndingX(StringBounder stringBounder, double y) {
|
||||
return opale.calculateDimension(stringBounder).getWidth() - opale.getMarginX1();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
/* ========================================================================
|
||||
* 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.activitydiagram3.gtile;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
|
||||
public interface Swimable2 {
|
||||
|
||||
public Set<Swimlane> getSwimlanes();
|
||||
|
||||
public Swimlane getSwimlane(String point);
|
||||
|
||||
}
|
@ -38,14 +38,11 @@ package net.sourceforge.plantuml.braille;
|
||||
import net.sourceforge.plantuml.ugraphic.UCenteredCharacter;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
|
||||
|
||||
public class DriverCenteredCharacterBraille implements UDriver<BrailleGrid> {
|
||||
|
||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, BrailleGrid grid) {
|
||||
final UCenteredCharacter characterCircled = (UCenteredCharacter) ushape;
|
||||
public class DriverCenteredCharacterBraille implements UDriver<UCenteredCharacter, BrailleGrid> {
|
||||
|
||||
public void draw(UCenteredCharacter characterCircled, double x, double y, ColorMapper mapper, UParam param, BrailleGrid grid) {
|
||||
final double xpos = x;
|
||||
final double ypos = y;
|
||||
|
||||
|
@ -38,14 +38,11 @@ package net.sourceforge.plantuml.braille;
|
||||
import net.sourceforge.plantuml.posimo.DotPath;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
|
||||
|
||||
public class DriverDotPathBraille implements UDriver<BrailleGrid> {
|
||||
|
||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, BrailleGrid grid) {
|
||||
final DotPath shape = (DotPath) ushape;
|
||||
public class DriverDotPathBraille implements UDriver<DotPath, BrailleGrid> {
|
||||
|
||||
public void draw(DotPath shape, double x, double y, ColorMapper mapper, UParam param, BrailleGrid grid) {
|
||||
if (param.getColor() != null) {
|
||||
grid.drawDotPath(x, y, shape);
|
||||
}
|
||||
|
@ -41,10 +41,9 @@ import net.sourceforge.plantuml.ugraphic.UClip;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.ULine;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
|
||||
|
||||
public class DriverLineBraille implements UDriver<BrailleGrid> {
|
||||
public class DriverLineBraille implements UDriver<ULine, BrailleGrid> {
|
||||
|
||||
private final ClipContainer clipContainer;
|
||||
|
||||
@ -52,9 +51,7 @@ public class DriverLineBraille implements UDriver<BrailleGrid> {
|
||||
this.clipContainer = clipContainer;
|
||||
}
|
||||
|
||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, BrailleGrid grid) {
|
||||
final ULine shape = (ULine) ushape;
|
||||
|
||||
public void draw(ULine shape , double x, double y, ColorMapper mapper, UParam param, BrailleGrid grid) {
|
||||
double x2 = x + shape.getDX();
|
||||
double y2 = y + shape.getDY();
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user