1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-06-03 00:50:49 +00:00

Import version 1.2021.12

This commit is contained in:
Arnaud Roques 2021-10-05 18:52:46 +02:00
parent 5fb770cb57
commit c874842158
7 changed files with 87 additions and 32 deletions

View File

@ -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>
@ -179,7 +179,7 @@
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.1</version>
<version>3.2.0</version>
<executions>
<execution>
<id>attach-javadocs</id>

View File

@ -137,7 +137,7 @@ public class Snake implements UShape {
if (textBlock != null) {
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;

View File

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

View File

@ -40,6 +40,7 @@ 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;
@ -53,12 +54,14 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.FtileSwitch
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.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;
@ -121,16 +124,33 @@ 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);
}
@ -145,8 +165,8 @@ public class FtileFactoryDelegatorSwitch extends FtileFactoryDelegator {
TextBlockUtils.empty(0, 0));
}
private HColor fontColor(FontParam param) {
return skinParam().getFontHtmlColor(null, param);
}
// private HColor fontColor(FontParam param) {
// return skinParam().getFontHtmlColor(null, param);
// }
}

View File

@ -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,23 @@ 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);
final public StyleSignature getDefaultStyleDefinitionArrow() {
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activity, SName.arrow);
}
final protected TextBlock getLabelPositive(Branch branch) {
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(), getIHtmlColorSet());
} else {
fcArrow = new FontConfiguration(skinParam(), FontParam.ARROW, null);
}
return branch.getLabelPositive().create0(fcArrow, HorizontalAlignment.LEFT, skinParam(), lineBreak,
CreoleMode.SIMPLE_LINE, null, null);
}
}

View File

@ -196,7 +196,7 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
final double y2 = p2.getY();
final Snake snake = Snake.create(null, arrowColor, Arrows.asToDown()).withLabel(getLabelPositive(branch),
VerticalAlignment.BOTTOM);
VerticalAlignment.CENTER);
if (x2 < p1d.getX() - margin || x2 > p1b.getX() + margin) {
snake.addPoint(x2, p1d.getY());
snake.addPoint(x2, y2);
@ -270,11 +270,16 @@ 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());
}
if (mode == Mode.BIG_DIAMOND) {
final double diamondHeight = diamond1.calculateDimension(stringBounder).getHeight();
max += diamondHeight / 2;
}
return max + 10;
}

View File

@ -44,7 +44,7 @@ public class Version {
private static final int MAJOR_SEPARATOR = 1000000;
public static int version() {
return 1202111;
return 1202112;
}
public static int versionPatched() {
@ -93,7 +93,7 @@ public class Version {
}
public static long compileTime() {
return 1633181171844L;
return 1633449718349L;
}
public static String compileTimeString() {