1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-25 14:27:33 +00:00

Import version 1.2021.4

This commit is contained in:
Arnaud Roques 2021-04-04 12:31:53 +02:00
parent 33ba37318c
commit feba01473c
14 changed files with 178 additions and 18 deletions

View File

@ -35,7 +35,7 @@
<groupId>net.sourceforge.plantuml</groupId> <groupId>net.sourceforge.plantuml</groupId>
<artifactId>plantuml</artifactId> <artifactId>plantuml</artifactId>
<version>1.2021.3-SNAPSHOT</version> <version>1.2021.5-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>PlantUML</name> <name>PlantUML</name>

View File

@ -296,6 +296,9 @@ yamlDiagram {
LineThickness 1 LineThickness 1
LineColor #A80036 LineColor #A80036
} }
highlight {
BackGroundColor #ccff02
}
} }
} }

View File

@ -144,6 +144,8 @@ public enum ColorParam {
rectangleBorder(HColorUtils.BLACK, ColorType.LINE), rectangleBorder(HColorUtils.BLACK, ColorType.LINE),
hexagonBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), hexagonBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK),
hexagonBorder(HColorUtils.BLACK, ColorType.LINE), hexagonBorder(HColorUtils.BLACK, ColorType.LINE),
personBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK),
personBorder(HColorUtils.BLACK, ColorType.LINE),
archimateBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), archimateBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK),
archimateBorder(HColorUtils.BLACK, ColorType.LINE), archimateBorder(HColorUtils.BLACK, ColorType.LINE),
cardBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), cardBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK),

View File

@ -36,7 +36,7 @@
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
public enum CornerParam { public enum CornerParam {
DEFAULT, diagramBorder, titleBorder, rectangle, hexagon, archimate, component, card, agent; DEFAULT, diagramBorder, titleBorder, rectangle, person, hexagon, archimate, component, card, agent;
public String getRoundKey() { public String getRoundKey() {
if (this == DEFAULT) { if (this == DEFAULT) {

View File

@ -81,6 +81,7 @@ public enum FontParam {
RECTANGLE(14, Font.PLAIN), // RECTANGLE(14, Font.PLAIN), //
LABEL(14, Font.PLAIN), // LABEL(14, Font.PLAIN), //
HEXAGON(14, Font.PLAIN), // HEXAGON(14, Font.PLAIN), //
PERSON(14, Font.PLAIN), //
ARCHIMATE(14, Font.PLAIN), // ARCHIMATE(14, Font.PLAIN), //
CARD(14, Font.PLAIN), // CARD(14, Font.PLAIN), //
NODE(14, Font.PLAIN), // NODE(14, Font.PLAIN), //
@ -116,6 +117,7 @@ public enum FontParam {
AGENT_STEREOTYPE(14, Font.ITALIC), // AGENT_STEREOTYPE(14, Font.ITALIC), //
RECTANGLE_STEREOTYPE(14, Font.ITALIC), // RECTANGLE_STEREOTYPE(14, Font.ITALIC), //
LABEL_STEREOTYPE(14, Font.ITALIC), // LABEL_STEREOTYPE(14, Font.ITALIC), //
PERSON_STEREOTYPE(14, Font.ITALIC), //
HEXAGON_STEREOTYPE(14, Font.ITALIC), // HEXAGON_STEREOTYPE(14, Font.ITALIC), //
ARCHIMATE_STEREOTYPE(14, Font.ITALIC), // ARCHIMATE_STEREOTYPE(14, Font.ITALIC), //
CARD_STEREOTYPE(14, Font.ITALIC), // CARD_STEREOTYPE(14, Font.ITALIC), //

View File

@ -56,6 +56,7 @@ public enum LineParam {
diagramBorder, diagramBorder,
rectangleBorder, rectangleBorder,
hexagonBorder, hexagonBorder,
personBorder,
archimateBorder, archimateBorder,
componentBorder, componentBorder,
cardBorder, cardBorder,

View File

@ -70,7 +70,7 @@ import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandCreateElementFull extends SingleLineCommand2<DescriptionDiagram> { public class CommandCreateElementFull extends SingleLineCommand2<DescriptionDiagram> {
public static final String ALL_TYPES = "artifact|actor/|actor|folder|card|file|package|rectangle|hexagon|label|node|frame|cloud|database|queue|stack|storage|agent|usecase/|usecase|component|boundary|control|entity|interface|circle|collections|port|portin|portout"; public static final String ALL_TYPES = "person|artifact|actor/|actor|folder|card|file|package|rectangle|hexagon|label|node|frame|cloud|database|queue|stack|storage|agent|usecase/|usecase|component|boundary|control|entity|interface|circle|collections|port|portin|portout";
public CommandCreateElementFull() { public CommandCreateElementFull() {
super(getRegexConcat()); super(getRegexConcat());

View File

@ -104,10 +104,14 @@ public class SkinParameter {
public static final SkinParameter LABEL = new SkinParameter(SName.label, "LABEL", ColorParam.rectangleBackground, public static final SkinParameter LABEL = new SkinParameter(SName.label, "LABEL", ColorParam.rectangleBackground,
ColorParam.rectangleBorder, FontParam.LABEL, FontParam.LABEL_STEREOTYPE); ColorParam.rectangleBorder, FontParam.LABEL, FontParam.LABEL_STEREOTYPE);
public static final SkinParameter HEXAGON = new SkinParameter(SName.rectangle, "HEXAGON", public static final SkinParameter HEXAGON = new SkinParameter(SName.hexagon, "HEXAGON",
ColorParam.hexagonBackground, ColorParam.hexagonBorder, FontParam.HEXAGON, FontParam.HEXAGON_STEREOTYPE, ColorParam.hexagonBackground, ColorParam.hexagonBorder, FontParam.HEXAGON, FontParam.HEXAGON_STEREOTYPE,
CornerParam.hexagon, LineParam.hexagonBorder); CornerParam.hexagon, LineParam.hexagonBorder);
public static final SkinParameter PERSON = new SkinParameter(SName.person, "PERSON",
ColorParam.personBackground, ColorParam.personBorder, FontParam.PERSON, FontParam.PERSON_STEREOTYPE,
CornerParam.person, LineParam.personBorder);
public static final SkinParameter ARCHIMATE = new SkinParameter(SName.archimate, "ARCHIMATE", public static final SkinParameter ARCHIMATE = new SkinParameter(SName.archimate, "ARCHIMATE",
ColorParam.archimateBackground, ColorParam.archimateBorder, FontParam.ARCHIMATE, ColorParam.archimateBackground, ColorParam.archimateBorder, FontParam.ARCHIMATE,
FontParam.ARCHIMATE_STEREOTYPE, CornerParam.archimate, LineParam.archimateBorder); FontParam.ARCHIMATE_STEREOTYPE, CornerParam.archimate, LineParam.archimateBorder);

View File

@ -67,6 +67,7 @@ public abstract class USymbol {
public final static USymbol RECTANGLE = record("RECTANGLE", SkinParameter.RECTANGLE, public final static USymbol RECTANGLE = record("RECTANGLE", SkinParameter.RECTANGLE,
new USymbolRectangle(SkinParameter.RECTANGLE)); new USymbolRectangle(SkinParameter.RECTANGLE));
public final static USymbol HEXAGON = record("HEXAGON", SkinParameter.HEXAGON, new USymbolHexagon()); public final static USymbol HEXAGON = record("HEXAGON", SkinParameter.HEXAGON, new USymbolHexagon());
public final static USymbol PERSON = record("PERSON", SkinParameter.PERSON, new USymbolPerson());
public final static USymbol LABEL = record("LABEL", SkinParameter.LABEL, public final static USymbol LABEL = record("LABEL", SkinParameter.LABEL,
new USymbolLabel(SkinParameter.LABEL)); new USymbolLabel(SkinParameter.LABEL));
public final static USymbol ARCHIMATE = record("ARCHIMATE", SkinParameter.ARCHIMATE, public final static USymbol ARCHIMATE = record("ARCHIMATE", SkinParameter.ARCHIMATE,
@ -218,6 +219,8 @@ public abstract class USymbol {
usymbol = USymbol.PACKAGE; usymbol = USymbol.PACKAGE;
} else if (symbol.equalsIgnoreCase("rectangle")) { } else if (symbol.equalsIgnoreCase("rectangle")) {
usymbol = USymbol.RECTANGLE; usymbol = USymbol.RECTANGLE;
} else if (symbol.equalsIgnoreCase("person")) {
usymbol = USymbol.PERSON;
} else if (symbol.equalsIgnoreCase("hexagon")) { } else if (symbol.equalsIgnoreCase("hexagon")) {
usymbol = USymbol.HEXAGON; usymbol = USymbol.HEXAGON;
} else if (symbol.equalsIgnoreCase("label")) { } else if (symbol.equalsIgnoreCase("label")) {

View File

@ -0,0 +1,139 @@
/* ========================================================================
* 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.graphic;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.ugraphic.UEllipse;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
import net.sourceforge.plantuml.ugraphic.URectangle;
import net.sourceforge.plantuml.ugraphic.UTranslate;
class USymbolPerson extends USymbol {
@Override
public SkinParameter getSkinParameter() {
return SkinParameter.PERSON;
}
private void drawRect(UGraphic ug, double width, double height, boolean shadowing, double roundCorner,
double diagonalCorner) {
final UEllipse head = new UEllipse(headSize(), headSize());
final URectangle body = new URectangle(width, height - headSize()).rounded(headSize());
if (shadowing) {
body.setDeltaShadow(3.0);
head.setDeltaShadow(1.0);
}
final double posx = (width - headSize()) / 2;
ug.apply(UTranslate.dx(posx)).draw(head);
ug.apply(UTranslate.dy(headSize())).draw(body);
}
private double headSize() {
return 20;
}
private Margin getMargin() {
return new Margin(10, 10, 10, 10);
}
@Override
public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype,
final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
return new AbstractTextBlock() {
public void drawU(UGraphic ug) {
final Dimension2D dim = calculateDimension(ug.getStringBounder());
ug = UGraphicStencil.create(ug, dim);
ug = symbolContext.apply(ug);
drawRect(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(),
symbolContext.getRoundCorner(), symbolContext.getDiagonalCorner());
final Margin margin = getMargin();
final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, stereoAlignment);
tb.drawU(ug.apply(new UTranslate(margin.getX1(), margin.getY1() + headSize())));
}
public Dimension2D calculateDimension(StringBounder stringBounder) {
final Dimension2D dimLabel = label.calculateDimension(stringBounder);
final Dimension2D dimStereo = stereotype.calculateDimension(stringBounder);
return Dimension2DDouble.delta(getMargin().addDimension(Dimension2DDouble.mergeTB(dimStereo, dimLabel)),
0, headSize());
}
};
}
@Override
public TextBlock asBig(final TextBlock title, final HorizontalAlignment labelAlignment, final TextBlock stereotype,
final double width, final double height, final SymbolContext symbolContext,
final HorizontalAlignment stereoAlignment) {
return new AbstractTextBlock() {
public void drawU(UGraphic ug) {
final Dimension2D dim = calculateDimension(ug.getStringBounder());
ug = symbolContext.apply(ug);
drawRect(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(),
symbolContext.getRoundCorner(), 0);
final Dimension2D dimStereo = stereotype.calculateDimension(ug.getStringBounder());
final double posStereoX;
final double posStereoY;
if (stereoAlignment == HorizontalAlignment.RIGHT) {
posStereoX = width - dimStereo.getWidth() - getMargin().getX1() / 2;
posStereoY = getMargin().getY1() / 2;
} else {
posStereoX = (width - dimStereo.getWidth()) / 2;
posStereoY = 2;
}
stereotype.drawU(ug.apply(new UTranslate(posStereoX, posStereoY)));
final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder());
final double posTitle;
if (labelAlignment == HorizontalAlignment.LEFT) {
posTitle = 3;
} else if (labelAlignment == HorizontalAlignment.RIGHT) {
posTitle = width - dimTitle.getWidth() - 3;
} else {
posTitle = (width - dimTitle.getWidth()) / 2;
}
title.drawU(ug.apply(new UTranslate(posTitle, 2 + dimStereo.getHeight())));
}
public Dimension2D calculateDimension(StringBounder stringBounder) {
return new Dimension2DDouble(width, height);
}
};
}
}

View File

@ -35,6 +35,8 @@
*/ */
package net.sourceforge.plantuml.project; package net.sourceforge.plantuml.project;
import static net.sourceforge.plantuml.ugraphic.ImageBuilder.styledImageBuilder;
import java.awt.geom.Dimension2D; import java.awt.geom.Dimension2D;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import java.io.IOException; import java.io.IOException;
@ -100,8 +102,6 @@ import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorSet; import net.sourceforge.plantuml.ugraphic.color.HColorSet;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils; import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
import static net.sourceforge.plantuml.ugraphic.ImageBuilder.styledImageBuilder;
public class GanttDiagram extends TitledDiagram implements ToTaskDraw, WithSprite { public class GanttDiagram extends TitledDiagram implements ToTaskDraw, WithSprite {
private final Map<Task, TaskDraw> draws = new LinkedHashMap<Task, TaskDraw>(); private final Map<Task, TaskDraw> draws = new LinkedHashMap<Task, TaskDraw>();
@ -169,15 +169,13 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw, WithSprit
protected ImageData exportDiagramNow(OutputStream os, int index, FileFormatOption fileFormatOption) protected ImageData exportDiagramNow(OutputStream os, int index, FileFormatOption fileFormatOption)
throws IOException { throws IOException {
final StringBounder stringBounder = fileFormatOption.getDefaultStringBounder(getSkinParam()); final StringBounder stringBounder = fileFormatOption.getDefaultStringBounder(getSkinParam());
return styledImageBuilder(this, getTextBlock(stringBounder), index, fileFormatOption) return styledImageBuilder(this, getTextBlock(stringBounder), index, fileFormatOption).write(os);
.write(os);
} }
public void setPrintScale(PrintScale printScale) { public void setPrintScale(PrintScale printScale) {
this.printScale = printScale; this.printScale = printScale;
} }
public void setCompress(int compress) { public void setCompress(int compress) {
this.compress = compress; this.compress = compress;
} }
@ -188,6 +186,7 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw, WithSprit
} }
return printScale.getCompress(); return printScale.getCompress();
} }
private boolean isHidden(Task task) { private boolean isHidden(Task task) {
if (printStart == null || task instanceof TaskSeparator) { if (printStart == null || task instanceof TaskSeparator) {
return false; return false;
@ -247,13 +246,17 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw, WithSprit
if (openClose.getCalendar() == null) { if (openClose.getCalendar() == null) {
return new TimeHeaderSimple(min, max); return new TimeHeaderSimple(min, max);
} else if (printScale == PrintScale.WEEKLY) { } else if (printScale == PrintScale.WEEKLY) {
return new TimeHeaderWeekly(openClose.getCalendar(), min, max, openClose, colorDays, colorDaysOfWeek, getCompress()); return new TimeHeaderWeekly(openClose.getCalendar(), min, max, openClose, colorDays, colorDaysOfWeek,
getCompress());
} else if (printScale == PrintScale.MONTHLY) { } else if (printScale == PrintScale.MONTHLY) {
return new TimeHeaderMonthly(openClose.getCalendar(), min, max, openClose, colorDays, colorDaysOfWeek, getCompress()); return new TimeHeaderMonthly(openClose.getCalendar(), min, max, openClose, colorDays, colorDaysOfWeek,
getCompress());
} else if (printScale == PrintScale.QUARTERLY) { } else if (printScale == PrintScale.QUARTERLY) {
return new TimeHeaderQuarterly(openClose.getCalendar(), min, max, openClose, colorDays, colorDaysOfWeek, getCompress()); return new TimeHeaderQuarterly(openClose.getCalendar(), min, max, openClose, colorDays, colorDaysOfWeek,
getCompress());
} else if (printScale == PrintScale.YEARLY) { } else if (printScale == PrintScale.YEARLY) {
return new TimeHeaderYearly(openClose.getCalendar(), min, max, openClose, colorDays, colorDaysOfWeek, getCompress()); return new TimeHeaderYearly(openClose.getCalendar(), min, max, openClose, colorDays, colorDaysOfWeek,
getCompress());
} else { } else {
return new TimeHeaderDaily(openClose.getCalendar(), min, max, openClose, colorDays, colorDaysOfWeek, return new TimeHeaderDaily(openClose.getCalendar(), min, max, openClose, colorDays, colorDaysOfWeek,
nameDays, printStart, printEnd); nameDays, printStart, printEnd);

View File

@ -79,7 +79,8 @@ public class CommandPrintScale extends SingleLineCommand2<GanttDiagram> {
final String scaleString = arg.get("SCALE", 0); final String scaleString = arg.get("SCALE", 0);
final PrintScale scale = PrintScale.fromString(scaleString); final PrintScale scale = PrintScale.fromString(scaleString);
diagram.setPrintScale(scale); diagram.setPrintScale(scale);
RegexPartialMatch compress = arg.get("COMPRESS");
final RegexPartialMatch compress = arg.get("COMPRESS");
if (compress.size() > 0 && compress.get(0) != null) { if (compress.size() > 0 && compress.get(0) != null) {
diagram.setCompress(Integer.parseInt(compress.get(0))); diagram.setCompress(Integer.parseInt(compress.get(0)));
} }

View File

@ -73,6 +73,7 @@ public enum SName {
ganttDiagram, // ganttDiagram, //
group, // group, //
groupHeader, // groupHeader, //
hexagon, //
highlight, // highlight, //
header, // header, //
interface_, // interface_, //
@ -90,6 +91,7 @@ public enum SName {
package_, // package_, //
participant, // participant, //
partition, // partition, //
person, //
queue, // queue, //
rectangle, // rectangle, //
reference, // reference, //

View File

@ -44,7 +44,7 @@ public class Version {
private static final int MAJOR_SEPARATOR = 1000000; private static final int MAJOR_SEPARATOR = 1000000;
public static int version() { public static int version() {
return 1202103; return 1202104;
} }
public static int versionPatched() { public static int versionPatched() {
@ -80,7 +80,7 @@ public class Version {
} }
public static int beta() { public static int beta() {
final int beta = 4; final int beta = 0;
return beta; return beta;
} }
@ -93,7 +93,7 @@ public class Version {
} }
public static long compileTime() { public static long compileTime() {
return 1616431999785L; return 1617526179012L;
} }
public static String compileTimeString() { public static String compileTimeString() {