diff --git a/pom.xml b/pom.xml index b53f19236..5cb3fa7ad 100644 --- a/pom.xml +++ b/pom.xml @@ -35,7 +35,7 @@ net.sourceforge.plantuml plantuml - 1.2021.3-SNAPSHOT + 1.2021.5-SNAPSHOT jar PlantUML diff --git a/skin/plantuml.skin b/skin/plantuml.skin index da3569d17..54dd78963 100644 --- a/skin/plantuml.skin +++ b/skin/plantuml.skin @@ -296,6 +296,9 @@ yamlDiagram { LineThickness 1 LineColor #A80036 } + highlight { + BackGroundColor #ccff02 + } } } diff --git a/src/net/sourceforge/plantuml/ColorParam.java b/src/net/sourceforge/plantuml/ColorParam.java index 983b60613..241e3d75e 100644 --- a/src/net/sourceforge/plantuml/ColorParam.java +++ b/src/net/sourceforge/plantuml/ColorParam.java @@ -144,6 +144,8 @@ public enum ColorParam { rectangleBorder(HColorUtils.BLACK, ColorType.LINE), hexagonBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), hexagonBorder(HColorUtils.BLACK, ColorType.LINE), + personBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + personBorder(HColorUtils.BLACK, ColorType.LINE), archimateBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), archimateBorder(HColorUtils.BLACK, ColorType.LINE), cardBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), diff --git a/src/net/sourceforge/plantuml/CornerParam.java b/src/net/sourceforge/plantuml/CornerParam.java index f4161a4ad..55549c270 100644 --- a/src/net/sourceforge/plantuml/CornerParam.java +++ b/src/net/sourceforge/plantuml/CornerParam.java @@ -36,7 +36,7 @@ package net.sourceforge.plantuml; 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() { if (this == DEFAULT) { diff --git a/src/net/sourceforge/plantuml/FontParam.java b/src/net/sourceforge/plantuml/FontParam.java index 12373e782..2d7ec2569 100644 --- a/src/net/sourceforge/plantuml/FontParam.java +++ b/src/net/sourceforge/plantuml/FontParam.java @@ -81,6 +81,7 @@ public enum FontParam { RECTANGLE(14, Font.PLAIN), // LABEL(14, Font.PLAIN), // HEXAGON(14, Font.PLAIN), // + PERSON(14, Font.PLAIN), // ARCHIMATE(14, Font.PLAIN), // CARD(14, Font.PLAIN), // NODE(14, Font.PLAIN), // @@ -116,6 +117,7 @@ public enum FontParam { AGENT_STEREOTYPE(14, Font.ITALIC), // RECTANGLE_STEREOTYPE(14, Font.ITALIC), // LABEL_STEREOTYPE(14, Font.ITALIC), // + PERSON_STEREOTYPE(14, Font.ITALIC), // HEXAGON_STEREOTYPE(14, Font.ITALIC), // ARCHIMATE_STEREOTYPE(14, Font.ITALIC), // CARD_STEREOTYPE(14, Font.ITALIC), // diff --git a/src/net/sourceforge/plantuml/LineParam.java b/src/net/sourceforge/plantuml/LineParam.java index 89fdc66e2..3df22df8c 100644 --- a/src/net/sourceforge/plantuml/LineParam.java +++ b/src/net/sourceforge/plantuml/LineParam.java @@ -56,6 +56,7 @@ public enum LineParam { diagramBorder, rectangleBorder, hexagonBorder, + personBorder, archimateBorder, componentBorder, cardBorder, diff --git a/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementFull.java b/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementFull.java index 77bc95f7b..cf1d0ff2e 100644 --- a/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementFull.java +++ b/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementFull.java @@ -70,7 +70,7 @@ import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException; public class CommandCreateElementFull extends SingleLineCommand2 { - 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() { super(getRegexConcat()); diff --git a/src/net/sourceforge/plantuml/graphic/SkinParameter.java b/src/net/sourceforge/plantuml/graphic/SkinParameter.java index 239063952..a86c7bd73 100644 --- a/src/net/sourceforge/plantuml/graphic/SkinParameter.java +++ b/src/net/sourceforge/plantuml/graphic/SkinParameter.java @@ -104,10 +104,14 @@ public class SkinParameter { public static final SkinParameter LABEL = new SkinParameter(SName.label, "LABEL", ColorParam.rectangleBackground, 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, 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", ColorParam.archimateBackground, ColorParam.archimateBorder, FontParam.ARCHIMATE, FontParam.ARCHIMATE_STEREOTYPE, CornerParam.archimate, LineParam.archimateBorder); diff --git a/src/net/sourceforge/plantuml/graphic/USymbol.java b/src/net/sourceforge/plantuml/graphic/USymbol.java index c26cdab78..4111387b4 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbol.java +++ b/src/net/sourceforge/plantuml/graphic/USymbol.java @@ -67,6 +67,7 @@ public abstract class USymbol { public final static USymbol RECTANGLE = record("RECTANGLE", SkinParameter.RECTANGLE, new USymbolRectangle(SkinParameter.RECTANGLE)); 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, new USymbolLabel(SkinParameter.LABEL)); public final static USymbol ARCHIMATE = record("ARCHIMATE", SkinParameter.ARCHIMATE, @@ -218,6 +219,8 @@ public abstract class USymbol { usymbol = USymbol.PACKAGE; } else if (symbol.equalsIgnoreCase("rectangle")) { usymbol = USymbol.RECTANGLE; + } else if (symbol.equalsIgnoreCase("person")) { + usymbol = USymbol.PERSON; } else if (symbol.equalsIgnoreCase("hexagon")) { usymbol = USymbol.HEXAGON; } else if (symbol.equalsIgnoreCase("label")) { diff --git a/src/net/sourceforge/plantuml/graphic/USymbolPerson.java b/src/net/sourceforge/plantuml/graphic/USymbolPerson.java new file mode 100644 index 000000000..baa3024c9 --- /dev/null +++ b/src/net/sourceforge/plantuml/graphic/USymbolPerson.java @@ -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); + } + }; + } + +} \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/project/GanttDiagram.java b/src/net/sourceforge/plantuml/project/GanttDiagram.java index fe41d573d..4d803d601 100644 --- a/src/net/sourceforge/plantuml/project/GanttDiagram.java +++ b/src/net/sourceforge/plantuml/project/GanttDiagram.java @@ -35,6 +35,8 @@ */ package net.sourceforge.plantuml.project; +import static net.sourceforge.plantuml.ugraphic.ImageBuilder.styledImageBuilder; + import java.awt.geom.Dimension2D; import java.awt.geom.Rectangle2D; 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.HColorUtils; -import static net.sourceforge.plantuml.ugraphic.ImageBuilder.styledImageBuilder; - public class GanttDiagram extends TitledDiagram implements ToTaskDraw, WithSprite { private final Map draws = new LinkedHashMap(); @@ -169,25 +169,24 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw, WithSprit protected ImageData exportDiagramNow(OutputStream os, int index, FileFormatOption fileFormatOption) throws IOException { final StringBounder stringBounder = fileFormatOption.getDefaultStringBounder(getSkinParam()); - return styledImageBuilder(this, getTextBlock(stringBounder), index, fileFormatOption) - .write(os); + return styledImageBuilder(this, getTextBlock(stringBounder), index, fileFormatOption).write(os); } public void setPrintScale(PrintScale printScale) { this.printScale = printScale; } - public void setCompress(int compress) { this.compress = compress; } - + private int getCompress() { if (this.compress != null) { return this.compress; } return printScale.getCompress(); } + private boolean isHidden(Task task) { if (printStart == null || task instanceof TaskSeparator) { return false; @@ -247,13 +246,17 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw, WithSprit if (openClose.getCalendar() == null) { return new TimeHeaderSimple(min, max); } 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) { - 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) { - 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) { - return new TimeHeaderYearly(openClose.getCalendar(), min, max, openClose, colorDays, colorDaysOfWeek, getCompress()); + return new TimeHeaderYearly(openClose.getCalendar(), min, max, openClose, colorDays, colorDaysOfWeek, + getCompress()); } else { return new TimeHeaderDaily(openClose.getCalendar(), min, max, openClose, colorDays, colorDaysOfWeek, nameDays, printStart, printEnd); diff --git a/src/net/sourceforge/plantuml/project/command/CommandPrintScale.java b/src/net/sourceforge/plantuml/project/command/CommandPrintScale.java index bc426fd9f..92c0edb46 100644 --- a/src/net/sourceforge/plantuml/project/command/CommandPrintScale.java +++ b/src/net/sourceforge/plantuml/project/command/CommandPrintScale.java @@ -79,7 +79,8 @@ public class CommandPrintScale extends SingleLineCommand2 { final String scaleString = arg.get("SCALE", 0); final PrintScale scale = PrintScale.fromString(scaleString); diagram.setPrintScale(scale); - RegexPartialMatch compress = arg.get("COMPRESS"); + + final RegexPartialMatch compress = arg.get("COMPRESS"); if (compress.size() > 0 && compress.get(0) != null) { diagram.setCompress(Integer.parseInt(compress.get(0))); } diff --git a/src/net/sourceforge/plantuml/style/SName.java b/src/net/sourceforge/plantuml/style/SName.java index 2627a138e..f17e0ec38 100644 --- a/src/net/sourceforge/plantuml/style/SName.java +++ b/src/net/sourceforge/plantuml/style/SName.java @@ -73,6 +73,7 @@ public enum SName { ganttDiagram, // group, // groupHeader, // + hexagon, // highlight, // header, // interface_, // @@ -90,6 +91,7 @@ public enum SName { package_, // participant, // partition, // + person, // queue, // rectangle, // reference, // diff --git a/src/net/sourceforge/plantuml/version/Version.java b/src/net/sourceforge/plantuml/version/Version.java index 4ed3e7330..a094bb86c 100644 --- a/src/net/sourceforge/plantuml/version/Version.java +++ b/src/net/sourceforge/plantuml/version/Version.java @@ -44,7 +44,7 @@ public class Version { private static final int MAJOR_SEPARATOR = 1000000; public static int version() { - return 1202103; + return 1202104; } public static int versionPatched() { @@ -80,7 +80,7 @@ public class Version { } public static int beta() { - final int beta = 4; + final int beta = 0; return beta; } @@ -93,7 +93,7 @@ public class Version { } public static long compileTime() { - return 1616431999785L; + return 1617526179012L; } public static String compileTimeString() {