diff --git a/pom.xml b/pom.xml index ed0e15aef..01299bb53 100644 --- a/pom.xml +++ b/pom.xml @@ -35,7 +35,7 @@ net.sourceforge.plantuml plantuml - 1.2019.12-SNAPSHOT + 1.2019.13-SNAPSHOT jar PlantUML diff --git a/src/gen/lib/label/index__c.java b/src/gen/lib/label/index__c.java index 40b1fbeb2..7b38b24b7 100644 --- a/src/gen/lib/label/index__c.java +++ b/src/gen/lib/label/index__c.java @@ -379,11 +379,12 @@ UNSUPPORTED("1um729vqiy3529kbsrzyl9u3y"); // rtp->InTouchCount++; CombineRect((ST_Rect_t)r, (ST_Rect_t) n.branch[i].rect)); return 0; } else { /* child was split */ -UNSUPPORTED("7evrfdq7uc1smqislqm9d82l6"); // n->branch[i].rect = NodeCover(n->branch[i].child); -UNSUPPORTED("echuth2qnq0o4n5gkzgtu5bgs"); // b.child = n2; -UNSUPPORTED("50z4r9qcomgi4o7vvwq0v0xs"); // b.rect = NodeCover(n2); -UNSUPPORTED("451qw2ioqybj69k9abzvqw4mk"); // rtp->EntryCount++; -UNSUPPORTED("9uz11nbvh6yp6yq2axvo7e0fb"); // return AddBranch(rtp, &b, n, new); + n.branch[i].setStruct("rect", + NodeCover((ST_Node_t___)n.branch[i].child)); + b.child = n2[0]; + b.rect.___(NodeCover(n2[0])); + rtp.setInt("EntryCount", rtp.EntryCount+1); + return AddBranch(rtp, b, n, new_); } } else if (n.level == level) { /* at level for insertion. */ /*Add rect, split if necessary */ diff --git a/src/net/sourceforge/plantuml/FileFormatOption.java b/src/net/sourceforge/plantuml/FileFormatOption.java index 4dd262bed..dc8ee678a 100644 --- a/src/net/sourceforge/plantuml/FileFormatOption.java +++ b/src/net/sourceforge/plantuml/FileFormatOption.java @@ -57,13 +57,14 @@ public final class FileFormatOption implements Serializable { private final String hoverColor; private final TikzFontDistortion tikzFontDistortion; private final double scale; + private final String preserveAspectRatio; public double getScaleCoef() { return scale; } public FileFormatOption(FileFormat fileFormat) { - this(fileFormat, null, true, false, "_top", false, null, TikzFontDistortion.getDefault(), 1.0); + this(fileFormat, null, true, false, "_top", false, null, TikzFontDistortion.getDefault(), 1.0, "none"); } public StringBounder getDefaultStringBounder() { @@ -78,13 +79,17 @@ public final class FileFormatOption implements Serializable { return withMetadata; } + public final String getPreserveAspectRatio() { + return preserveAspectRatio; + } + public FileFormatOption(FileFormat fileFormat, boolean withMetadata) { - this(fileFormat, null, withMetadata, false, "_top", false, null, TikzFontDistortion.getDefault(), 1.0); + this(fileFormat, null, withMetadata, false, "_top", false, null, TikzFontDistortion.getDefault(), 1.0, "none"); } private FileFormatOption(FileFormat fileFormat, AffineTransform at, boolean withMetadata, boolean useRedForError, String svgLinkTarget, boolean debugsvek, String hoverColor, TikzFontDistortion tikzFontDistortion, - double scale) { + double scale, String preserveAspectRatio) { this.hoverColor = hoverColor; this.fileFormat = fileFormat; this.affineTransform = at; @@ -94,6 +99,7 @@ public final class FileFormatOption implements Serializable { this.debugsvek = debugsvek; this.tikzFontDistortion = tikzFontDistortion; this.scale = scale; + this.preserveAspectRatio = preserveAspectRatio; if (tikzFontDistortion == null) { throw new IllegalArgumentException(); } @@ -101,27 +107,32 @@ public final class FileFormatOption implements Serializable { public FileFormatOption withUseRedForError() { return new FileFormatOption(fileFormat, affineTransform, withMetadata, true, svgLinkTarget, debugsvek, - hoverColor, tikzFontDistortion, scale); + hoverColor, tikzFontDistortion, scale, preserveAspectRatio); } public FileFormatOption withTikzFontDistortion(TikzFontDistortion tikzFontDistortion) { return new FileFormatOption(fileFormat, affineTransform, withMetadata, true, svgLinkTarget, debugsvek, - hoverColor, tikzFontDistortion, scale); + hoverColor, tikzFontDistortion, scale, preserveAspectRatio); } public FileFormatOption withSvgLinkTarget(String svgLinkTarget) { return new FileFormatOption(fileFormat, affineTransform, withMetadata, useRedForError, svgLinkTarget, - debugsvek, hoverColor, tikzFontDistortion, scale); + debugsvek, hoverColor, tikzFontDistortion, scale, preserveAspectRatio); + } + + public FileFormatOption withPreserveAspectRatio(String preserveAspectRatio) { + return new FileFormatOption(fileFormat, affineTransform, withMetadata, useRedForError, svgLinkTarget, + debugsvek, hoverColor, tikzFontDistortion, scale, preserveAspectRatio); } public FileFormatOption withHoverColor(String hoverColor) { return new FileFormatOption(fileFormat, affineTransform, withMetadata, useRedForError, svgLinkTarget, - debugsvek, hoverColor, tikzFontDistortion, scale); + debugsvek, hoverColor, tikzFontDistortion, scale, preserveAspectRatio); } public FileFormatOption withScale(double scale) { return new FileFormatOption(fileFormat, affineTransform, withMetadata, useRedForError, svgLinkTarget, - debugsvek, hoverColor, tikzFontDistortion, scale); + debugsvek, hoverColor, tikzFontDistortion, scale, preserveAspectRatio); } @Override diff --git a/src/net/sourceforge/plantuml/ISkinParam.java b/src/net/sourceforge/plantuml/ISkinParam.java index cd191cae2..ef2689ad3 100644 --- a/src/net/sourceforge/plantuml/ISkinParam.java +++ b/src/net/sourceforge/plantuml/ISkinParam.java @@ -141,6 +141,8 @@ public interface ISkinParam extends ISkinSimple { public String getSvgLinkTarget(); + public String getPreserveAspectRatio(); + public int getTabSize(); public int maxAsciiMessageLength(); diff --git a/src/net/sourceforge/plantuml/SkinParam.java b/src/net/sourceforge/plantuml/SkinParam.java index a1469c6ca..88f1afc32 100644 --- a/src/net/sourceforge/plantuml/SkinParam.java +++ b/src/net/sourceforge/plantuml/SkinParam.java @@ -1046,6 +1046,15 @@ public class SkinParam implements ISkinParam { } return value; } + + public String getPreserveAspectRatio() { + final String value = getValue("preserveaspectratio"); + if (value == null) { + return "none"; + } + return value; + } + public String getMonospacedFamily() { final String value = getValue("defaultMonospacedFontName"); diff --git a/src/net/sourceforge/plantuml/SkinParamDelegator.java b/src/net/sourceforge/plantuml/SkinParamDelegator.java index cf6f1a8c9..40d0cf461 100644 --- a/src/net/sourceforge/plantuml/SkinParamDelegator.java +++ b/src/net/sourceforge/plantuml/SkinParamDelegator.java @@ -234,6 +234,10 @@ public class SkinParamDelegator implements ISkinParam { public String getSvgLinkTarget() { return skinParam.getSvgLinkTarget(); } + + public String getPreserveAspectRatio() { + return skinParam.getPreserveAspectRatio(); + } public String getMonospacedFamily() { return skinParam.getMonospacedFamily(); @@ -355,4 +359,5 @@ public class SkinParamDelegator implements ISkinParam { skinParam.setDefaultSkin(newFileName); } + } diff --git a/src/net/sourceforge/plantuml/UmlDiagram.java b/src/net/sourceforge/plantuml/UmlDiagram.java index e0c134903..2254c09b7 100644 --- a/src/net/sourceforge/plantuml/UmlDiagram.java +++ b/src/net/sourceforge/plantuml/UmlDiagram.java @@ -186,6 +186,7 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot if (fileFormatOption.getSvgLinkTarget() == null || fileFormatOption.getSvgLinkTarget().equals("_top")) { fileFormatOption = fileFormatOption.withSvgLinkTarget(getSkinParam().getSvgLinkTarget()); } + fileFormatOption = fileFormatOption.withPreserveAspectRatio(getSkinParam().getPreserveAspectRatio()); fileFormatOption = fileFormatOption.withTikzFontDistortion(getSkinParam().getTikzFontDistortion()); if (hover != null) { fileFormatOption = fileFormatOption.withHoverColor(StringUtils.getAsHtml(getSkinParam().getColorMapper() diff --git a/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java b/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java index 704780e7f..f9c87602d 100644 --- a/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java +++ b/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java @@ -61,6 +61,7 @@ import net.sourceforge.plantuml.command.CommandEndPackage; import net.sourceforge.plantuml.command.CommandFootboxIgnored; import net.sourceforge.plantuml.command.CommandNamespace; import net.sourceforge.plantuml.command.CommandNamespace2; +import net.sourceforge.plantuml.command.CommandNamespaceEmpty; import net.sourceforge.plantuml.command.CommandPackage; import net.sourceforge.plantuml.command.CommandPackageEmpty; import net.sourceforge.plantuml.command.CommandPage; @@ -125,6 +126,7 @@ public class ClassDiagramFactory extends UmlDiagramFactory { cmds.add(new CommandNamespace()); cmds.add(new CommandNamespace2()); + cmds.add(new CommandNamespaceEmpty()); cmds.add(new CommandStereotype()); cmds.add(new CommandLinkClass(UmlDiagramType.CLASS)); diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java index b94d766f5..3ec0dfbd1 100644 --- a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java +++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java @@ -76,7 +76,8 @@ public class CommandCreateClass extends SingleLineCommand2 { } private static IRegex getRegexConcat() { - return RegexConcat.build(CommandCreateClass.class.getName(), RegexLeaf.start(), // + return RegexConcat.build(CommandCreateClass.class.getName(), + RegexLeaf.start(), // new RegexLeaf("TYPE", // "(interface|enum|annotation|abstract[%s]+class|abstract|class|entity|circle|diamond)"), // RegexLeaf.spaceOneOrMore(), // @@ -95,7 +96,8 @@ public class CommandCreateClass extends SingleLineCommand2 { new RegexLeaf("DISPLAY2", DISPLAY_WITH_GENERIC)), // new RegexLeaf("CODE3", "(" + CODE + ")"), // new RegexLeaf("CODE4", "[%g]([^%g]+)[%g]")), // - new RegexOptional(new RegexConcat(RegexLeaf.spaceZeroOrMore(), new RegexLeaf("GENERIC", "\\<(" + GenericRegexProducer.PATTERN + ")\\>"))), // + new RegexOptional(new RegexConcat(RegexLeaf.spaceZeroOrMore(), new RegexLeaf("GENERIC", "\\<(" + + GenericRegexProducer.PATTERN + ")\\>"))), // RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), // RegexLeaf.spaceZeroOrMore(), // @@ -105,9 +107,14 @@ public class CommandCreateClass extends SingleLineCommand2 { RegexLeaf.spaceZeroOrMore(), // color().getRegex(), // RegexLeaf.spaceZeroOrMore(), // - new RegexOptional(new RegexConcat(new RegexLeaf("##"), new RegexLeaf("LINECOLOR", "(?:\\[(dotted|dashed|bold)\\])?(\\w+)?"))), // - new RegexOptional(new RegexConcat(RegexLeaf.spaceOneOrMore(), new RegexLeaf("EXTENDS", "(extends)[%s]+(" + CommandCreateClassMultilines.CODES + ")"))), // - new RegexOptional(new RegexConcat(RegexLeaf.spaceOneOrMore(), new RegexLeaf("IMPLEMENTS", "(implements)[%s]+(" + CommandCreateClassMultilines.CODES + ")"))), // + new RegexOptional(new RegexConcat(new RegexLeaf("##"), new RegexLeaf("LINECOLOR", + "(?:\\[(dotted|dashed|bold)\\])?(\\w+)?"))), // + new RegexOptional(new RegexConcat(RegexLeaf.spaceOneOrMore(), new RegexLeaf("EXTENDS", + "(extends)[%s]+(" + CommandCreateClassMultilines.CODES + ")"))), // + new RegexOptional(new RegexConcat(RegexLeaf.spaceOneOrMore(), new RegexLeaf("IMPLEMENTS", + "(implements)[%s]+(" + CommandCreateClassMultilines.CODES + ")"))), // + new RegexOptional(new RegexConcat(RegexLeaf.spaceZeroOrMore(), new RegexLeaf("\\{"), RegexLeaf + .spaceZeroOrMore(), new RegexLeaf("\\}"))), // RegexLeaf.end()); } diff --git a/src/net/sourceforge/plantuml/command/CommandFooter.java b/src/net/sourceforge/plantuml/command/CommandFooter.java index 3718a4a54..5ab32c201 100644 --- a/src/net/sourceforge/plantuml/command/CommandFooter.java +++ b/src/net/sourceforge/plantuml/command/CommandFooter.java @@ -48,7 +48,6 @@ import net.sourceforge.plantuml.command.regex.RegexOr; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.style.PName; public class CommandFooter extends SingleLineCommand2 { diff --git a/src/net/sourceforge/plantuml/command/CommandHeader.java b/src/net/sourceforge/plantuml/command/CommandHeader.java index 43c1c951e..b86791772 100644 --- a/src/net/sourceforge/plantuml/command/CommandHeader.java +++ b/src/net/sourceforge/plantuml/command/CommandHeader.java @@ -48,7 +48,6 @@ import net.sourceforge.plantuml.command.regex.RegexOr; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.style.PName; public class CommandHeader extends SingleLineCommand2 { diff --git a/src/net/sourceforge/plantuml/command/CommandMultilinesFooter.java b/src/net/sourceforge/plantuml/command/CommandMultilinesFooter.java index 06e0c0863..71a4c1dcf 100644 --- a/src/net/sourceforge/plantuml/command/CommandMultilinesFooter.java +++ b/src/net/sourceforge/plantuml/command/CommandMultilinesFooter.java @@ -42,7 +42,6 @@ import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.style.PName; public class CommandMultilinesFooter extends CommandMultilines { diff --git a/src/net/sourceforge/plantuml/command/CommandMultilinesHeader.java b/src/net/sourceforge/plantuml/command/CommandMultilinesHeader.java index 8a196e9eb..b87374f25 100644 --- a/src/net/sourceforge/plantuml/command/CommandMultilinesHeader.java +++ b/src/net/sourceforge/plantuml/command/CommandMultilinesHeader.java @@ -42,7 +42,6 @@ import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.style.PName; public class CommandMultilinesHeader extends CommandMultilines { diff --git a/src/net/sourceforge/plantuml/command/CommandNamespace2.java b/src/net/sourceforge/plantuml/command/CommandNamespace2.java index 0feb26a53..3f6356a1d 100644 --- a/src/net/sourceforge/plantuml/command/CommandNamespace2.java +++ b/src/net/sourceforge/plantuml/command/CommandNamespace2.java @@ -43,7 +43,6 @@ import net.sourceforge.plantuml.classdiagram.ClassDiagram; import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; -import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.Display; diff --git a/src/net/sourceforge/plantuml/command/CommandNamespaceEmpty.java b/src/net/sourceforge/plantuml/command/CommandNamespaceEmpty.java new file mode 100644 index 000000000..b466668ec --- /dev/null +++ b/src/net/sourceforge/plantuml/command/CommandNamespaceEmpty.java @@ -0,0 +1,109 @@ +/* ======================================================================== + * 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.command; + +import net.sourceforge.plantuml.LineLocation; +import net.sourceforge.plantuml.Url; +import net.sourceforge.plantuml.UrlBuilder; +import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.classdiagram.ClassDiagram; +import net.sourceforge.plantuml.command.regex.IRegex; +import net.sourceforge.plantuml.command.regex.RegexConcat; +import net.sourceforge.plantuml.command.regex.RegexLeaf; +import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.cucadiagram.Code; +import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.cucadiagram.GroupType; +import net.sourceforge.plantuml.cucadiagram.IEntity; +import net.sourceforge.plantuml.cucadiagram.IGroup; +import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy; +import net.sourceforge.plantuml.cucadiagram.Stereotype; +import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.graphic.color.ColorType; + +public class CommandNamespaceEmpty extends SingleLineCommand2 { + + public CommandNamespaceEmpty() { + super(getRegexConcat()); + } + + private static IRegex getRegexConcat() { + return RegexConcat.build(CommandNamespaceEmpty.class.getName(), RegexLeaf.start(), // + new RegexLeaf("namespace"), // + RegexLeaf.spaceOneOrMore(), // + new RegexLeaf("NAME", "([\\p{L}0-9_][-\\p{L}0-9_.:\\\\]*)"), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), // + RegexLeaf.spaceZeroOrMore(), // + ColorParser.exp1(), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("\\{"), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("\\}"), // + RegexLeaf.end()); + } + + @Override + protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) { + final Code code = Code.of(arg.get("NAME", 0)); + final IGroup currentPackage = diagram.getCurrentGroup(); + final Display display = Display.getWithNewlines(code); + diagram.gotoGroup2(code, display, GroupType.PACKAGE, currentPackage, NamespaceStrategy.MULTIPLE); + final IEntity p = diagram.getCurrentGroup(); + final String stereotype = arg.get("STEREOTYPE", 0); + if (stereotype != null) { + p.setStereotype(new Stereotype(stereotype)); + } + + final String urlString = arg.get("URL", 0); + if (urlString != null) { + final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT); + final Url url = urlBuilder.getUrl(urlString); + p.addUrl(url); + } + + final String color = arg.get("COLOR", 0); + if (color != null) { + p.setSpecificColorTOBEREMOVED(ColorType.BACK, + diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(color)); + } + diagram.endGroup(); + return CommandExecutionResult.ok(); + } + +} diff --git a/src/net/sourceforge/plantuml/command/CommandPackage.java b/src/net/sourceforge/plantuml/command/CommandPackage.java index b55eeeeb6..1feb11f49 100644 --- a/src/net/sourceforge/plantuml/command/CommandPackage.java +++ b/src/net/sourceforge/plantuml/command/CommandPackage.java @@ -69,7 +69,7 @@ public class CommandPackage extends SingleLineCommand2 { private static IRegex getRegexConcat() { return RegexConcat.build(CommandPackage.class.getName(), RegexLeaf.start(), // - new RegexLeaf("TYPE", "(package|together)"), // + new RegexLeaf("TYPE", "(package)"), // RegexLeaf.spaceOneOrMore(), // new RegexLeaf("NAME", "([%g][^%g]+[%g]|[^#%s{}]*)"), // new RegexOptional( // diff --git a/src/net/sourceforge/plantuml/command/UmlDiagramFactory.java b/src/net/sourceforge/plantuml/command/UmlDiagramFactory.java index b3de396e1..b032a8ef4 100644 --- a/src/net/sourceforge/plantuml/command/UmlDiagramFactory.java +++ b/src/net/sourceforge/plantuml/command/UmlDiagramFactory.java @@ -53,7 +53,6 @@ import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.error.PSystemError; import net.sourceforge.plantuml.error.PSystemErrorUtils; import net.sourceforge.plantuml.sequencediagram.command.CommandSkin; -import net.sourceforge.plantuml.sprite.CommandListSprite; import net.sourceforge.plantuml.statediagram.command.CommandHideEmptyDescription; import net.sourceforge.plantuml.style.CommandStyleImport; import net.sourceforge.plantuml.style.CommandStyleMultilinesCSS; diff --git a/src/net/sourceforge/plantuml/cucadiagram/CucaDiagram.java b/src/net/sourceforge/plantuml/cucadiagram/CucaDiagram.java index e8a79de17..405fc0eff 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/CucaDiagram.java +++ b/src/net/sourceforge/plantuml/cucadiagram/CucaDiagram.java @@ -75,6 +75,7 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy, private final List removed = new ArrayList(); protected final EntityFactory entityFactory = new EntityFactory(hides2, removed); private IGroup currentGroup = entityFactory.getRootGroup(); + private List stacks = new ArrayList(); private boolean visibilityModifierPresent; @@ -196,6 +197,8 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy, final protected void gotoGroupInternalWithNamespace(final Code code, Display display, final Code namespace2, GroupType type, IGroup parent) { + + this.stacks.add(currentGroup); if (getNamespaceSeparator() == null) { gotoGroupInternal(code, display, namespace2, type, parent); return; @@ -220,6 +223,18 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy, } + public void endGroup() { + if (EntityUtils.groupRoot(currentGroup)) { + Log.error("No parent group"); + return; + } + if (stacks.size() > 0) { + currentGroup = stacks.remove(stacks.size() - 1); + } else { + currentGroup = currentGroup.getParentContainer(); + } + } + final protected void gotoGroupInternal(final Code code, Display display, final Code namespace2, GroupType type, IGroup parent) { IGroup result = entityFactory.getGroupsget(code); @@ -277,14 +292,6 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy, return p; } - public void endGroup() { - if (EntityUtils.groupRoot(currentGroup)) { - Log.error("No parent group"); - return; - } - currentGroup = currentGroup.getParentContainer(); - } - public final boolean isGroup(Code code) { return leafExist(code) == false && entityFactory.getGroupsget(code) != null; } diff --git a/src/net/sourceforge/plantuml/cucadiagram/Display.java b/src/net/sourceforge/plantuml/cucadiagram/Display.java index f48c47f1d..63f9b7968 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/Display.java +++ b/src/net/sourceforge/plantuml/cucadiagram/Display.java @@ -54,6 +54,7 @@ import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.UrlBuilder; import net.sourceforge.plantuml.UrlBuilder.ModeUrl; import net.sourceforge.plantuml.command.regex.Matcher2; +import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.creole.CreoleMode; import net.sourceforge.plantuml.creole.CreoleParser; @@ -74,6 +75,7 @@ import net.sourceforge.plantuml.skin.VisibilityModifier; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.wbs.WBSDiagram; public class Display implements Iterable { @@ -270,6 +272,26 @@ public class Display implements Iterable { return new Display(result, this.naturalHorizontalAlignment, this.isNull, this.defaultCreoleMode); } + public Display removeEndingStereotype() { + final Matcher2 m = patternStereotype.matcher(displayData.get(displayData.size() - 1)); + if (m.matches()) { + final List result = new ArrayList(this.displayData); + result.set(result.size() - 1, m.group(1)); + return new Display(result, this.naturalHorizontalAlignment, this.isNull, this.defaultCreoleMode); + } + return this; + } + + public final static Pattern2 patternStereotype = MyPattern.cmpile("^(.*?)(?:\\<\\<\\s*(.*)\\s*\\>\\>)\\s*$"); + + public String getEndingStereotype() { + final Matcher2 m = patternStereotype.matcher(displayData.get(displayData.size() - 1)); + if (m.matches()) { + return m.group(2); + } + return null; + } + public Display underlined() { final List result = new ArrayList(); for (CharSequence line : displayData) { diff --git a/src/net/sourceforge/plantuml/donors/PSystemDonors.java b/src/net/sourceforge/plantuml/donors/PSystemDonors.java index 6a85fff67..99fedab08 100644 --- a/src/net/sourceforge/plantuml/donors/PSystemDonors.java +++ b/src/net/sourceforge/plantuml/donors/PSystemDonors.java @@ -71,23 +71,23 @@ public class PSystemDonors extends AbstractPSystem { private static final int COLS = 6; private static final int FREE_LINES = 6; - public static final String DONORS = "6uq902mFw6aNBnoRoJQNUtErFonYo206_-9C-IFeunriW0n1BL5IhOvS7xq622gWQ-ZeCRVlzBZVI7yH" - + "NUdUDys8jcnDSPvH50k27c-JQuPjxkqnSsBnGt1dZe133yW3iacsZHfPkfVj92sddof3IY7pywS6s9OA" - + "ihYRQXukK7S6TknnUzX_ePwbHp_sKxhZEw0nZHBhiAEQb5SFVAsgP8B2sM_7DwrYLapW42cEjd043jcO" - + "YNnrMiUu85NxZte3BJPcM2foJoYssYMf-UVP-hQ1xXCOJ2AmYG4RC7Eew32UO2vGRyGGM4MYYUpiZCQ6" - + "QsvveeC95zInXd-KHKsFLEOSZau4Dg-40Ww_XXE0hIYlmcVxDWCAHNgBkYN9EZMUX9N6XoKfhXyqt006" - + "R2ne7QY2a3T19_nfCVjJatjT3GLUzEpClTaPo4Ms0y3nPaRVPDsPAF_t3yuqiMsfbaXrBlrvhlTn3iZT" - + "Kgj6_37QM6LBtDQJ5nLQUN81_4FGIxsZOdxETMCX6UAvT7iYpdFgojSe0cR5OMJXJx4bDUxIBazZVLcU" - + "eIp1Z_RhL2EPq89N8bu6_QfMA0zqlb2oBArSFlHeMBqCV4t8JBmjkcV7NCh_lrAymupI5RJVnPogQo1A" - + "dh5pLUjigWXC8texv2QGAr3jhbknU_-G_vmFIBqbaO78RCvnlrIig3LT334RrdIwn0nWyfHe9mAxaqGY" - + "faReNR2oZ4mhnQw7g-VqYJ5nxVJ2uxwfCOWFTBBo9EpfHR1cXY79chaDxGUSWt06NvnNN_VXFLO1hBjv" - + "Zxr9pHzd85tfXP4aRKQKszRzgR1c1QLdKPPyM96_U_4p5mzT2bvdikW8Cwysno5ZeNZPf9N-PFJ3aY5l" - + "dygo_aeLUGFkbug5G9XdV0nuF3XPKCKb15RJMGuJ6u1mweDNx3SlSJEekgNav18snAp3LkU1IkU7UGT6" - + "bN7WcOCTtRt4pz0IHSx7vxso-cbbhIfsBA1uLWYMKaVPQweeqkTKCcICGSzXQ-3jDmjT42xrsXkc1Gfl" - + "W-Y-V0EjKyYq4kC7JPybqeLyHRxaiJ02_iwltsGlEDP1nhyPtOV7cUUA8AKgEi0vSRRKQbjQ1-ij-lpv" - + "ifoy1t_-xpLjvrI8vtoM0Bg0WlQlfS2SQDRLF7liJwEF3kmsiW9Y7PpqbLUcNWWm40oQPQcNrcb6uSuO" - + "Ncwg1dt6yQ52No4L9uZZ3SikbYcA6bFEykLanQYys9VU22SvU5x_55M6KbnbkPeOeLNi_2ZEqtWVjHjk" - + "TUa24j0T5mJAVlExtIntZJvVW7qO7b3avoDvwB25QK4Lfx4yDJ15OtrlnjjJPwP-4m00"; + public static final String DONORS = "6wO902mFU3XMJYceJdotTlPGzS6YgH3yYpFbZw2FTx01CWIrH4crEd9zz1eWg82keQF7tBxJutuZ_KLq" + + "fNlVD2FQiZN5UKPHB0Xwl4sk6RQvjmV2d2KlWZjJWfuF5n0bqTtfBCiTANQVa85C9s9S14-RrrZgP2tv" + + "1mcd-zyr5RAlgiAGBgiwVxf2SL807Z2x_5ETowPoBbUrwKqeGAVkNC5DLOUvTgAlJWmIOEBrR-TRrMHM" + + "JF0GASwsS0HEepD3CnUjCx8Xi_OVzGzeip73Kf5RGd7KBedEFo-TsJRGVOu44nAxADWmvb3AOLgWUyYD" + + "cCGcWeRwB4PZipLRdkXXS4CB-_AFHbBZaShCuMYJsDq31KxVnW58hzJK96RxDmFAH4QB6KjITM7SX3ld" + + "OJ4LwGSDDuB2pe9Ma1g2l0bTyEan-rEJMrqD1Lxo3CczsIxKATi6jCsClirrIAByxpRDjF4UKowHwcpz" + + "UQxtSGx8tL8hp_XZj3784TpxoOiALfvQ03y2lLGBbUJdf-mR2oaGzzRjYJmwLwxSHn4Ocp9CBFOgjbYB" + + "_5YNjx4LMLOO2_helYuq8GCjTELoD_HjMfaqTBvGafPMBXzwT5gz369DnaplFFqP7NCv_xzIlCDCYXle" + + "IedPfci4HUGSMaqN6nE1QQ77Gsu2iWBbxheLk_SF-NK-8FEMPGGYjpcZVL_nGjrr4M8wrdGrnGnW_fJI" + + "5ed3WWW5xOBUHfL-fAqKknwkdkaJO-w-w9F7NJDZ40SwHMCHldeHtDqme-hDaGtjUymXU8Wlowkl-_0T" + + "gm3MuTuR_aZDds0Wd-c54P568nhRrlsfSBU24bdK9HShybt5prmyT2TudScYGyoysXo7B0oL1qbQwfyC" + + "FomPVFjCDkolIf4tu7bfc8PmP7mCBXzDUjJa4edDT9PZPYS0bofUiTzymdMXwfQQaoriYCd3Lnz29lWn" + + "le2bCXMU1jQwUr6SGOmIvyIyLrOjAsjLyR60YbaXw4iBfMggADBdD3BYh47FGUjW-yt25kYbNdl3c51u" + + "6wAx6XkmJH7JLKp_Q0AUY2gA9NefayG0lkR3hzL3Onry_6Pq7n47oEwI4485QewUE2tDjsDO1-ij-l_p" + + "PJbv3_xytslQmQaLztnM0NI2aF_hA1W7JLtjCmflNJwSE1om0gasJcBbfQMdGG91v9QTFdMTPgHtOaIv" + + "BLdqZkD3PRvI8Gv8OyFoYtwAeiQKaxwSh3YL3_lE6-4aXyZhdwBAcXHNfP6Q6C4cTdOKvsdiLhlXheih" + + "yA0UN12e-_NZqyqiTuqrNq1g61uqvESZSkZGmxMWfgQ5iIom8iRwtYVzKAR7RyQcW5qbW3dJ0000"; /* * Special thanks to our sponsors and donors: diff --git a/src/net/sourceforge/plantuml/graphic/SkinParameter.java b/src/net/sourceforge/plantuml/graphic/SkinParameter.java index 713dd4c6b..c4b54835e 100644 --- a/src/net/sourceforge/plantuml/graphic/SkinParameter.java +++ b/src/net/sourceforge/plantuml/graphic/SkinParameter.java @@ -116,7 +116,7 @@ public class SkinParameter { public static final SkinParameter CONTROL = new SkinParameter("CONTROL", ColorParam.controlBackground, ColorParam.controlBorder, FontParam.CONTROL, FontParam.CONTROL_STEREOTYPE); - public static final SkinParameter ENTITY_DOMAIN = new SkinParameter("ENTITY_DOMAIN", ColorParam.entityBackground, + public static final SkinParameter ENTITY = new SkinParameter("ENTITY", ColorParam.entityBackground, ColorParam.entityBorder, FontParam.ENTITY, FontParam.ENTITY_STEREOTYPE); public static final SkinParameter INTERFACE = new SkinParameter("INTERFACE", ColorParam.interfaceBackground, diff --git a/src/net/sourceforge/plantuml/graphic/USymbol.java b/src/net/sourceforge/plantuml/graphic/USymbol.java index a82290830..5b169512e 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbol.java +++ b/src/net/sourceforge/plantuml/graphic/USymbol.java @@ -73,7 +73,7 @@ public abstract class USymbol { public final static USymbol COMPONENT1 = record("COMPONENT1", SkinParameter.COMPONENT1, new USymbolComponent1()); public final static USymbol COMPONENT2 = record("COMPONENT2", SkinParameter.COMPONENT2, new USymbolComponent2()); public final static USymbol BOUNDARY = record("BOUNDARY", SkinParameter.BOUNDARY, new USymbolBoundary()); - public final static USymbol ENTITY_DOMAIN = record("ENTITY_DOMAIN", SkinParameter.ENTITY_DOMAIN, + public final static USymbol ENTITY_DOMAIN = record("ENTITY_DOMAIN", SkinParameter.ENTITY, new USymbolEntityDomain(2)); public final static USymbol CONTROL = record("CONTROL", SkinParameter.CONTROL, new USymbolControl(2)); public final static USymbol INTERFACE = record("INTERFACE", SkinParameter.INTERFACE, new USymbolInterface()); diff --git a/src/net/sourceforge/plantuml/graphic/USymbolEntityDomain.java b/src/net/sourceforge/plantuml/graphic/USymbolEntityDomain.java index ed4845373..d7b6ddb89 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolEntityDomain.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolEntityDomain.java @@ -48,7 +48,7 @@ class USymbolEntityDomain extends USymbolSimpleAbstract { @Override public SkinParameter getSkinParameter() { - return SkinParameter.ENTITY_DOMAIN; + return SkinParameter.ENTITY; } diff --git a/src/net/sourceforge/plantuml/mindmap/FingerImpl.java b/src/net/sourceforge/plantuml/mindmap/FingerImpl.java index a077552ec..29017f01c 100644 --- a/src/net/sourceforge/plantuml/mindmap/FingerImpl.java +++ b/src/net/sourceforge/plantuml/mindmap/FingerImpl.java @@ -45,7 +45,7 @@ import net.sourceforge.plantuml.Direction; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.SkinParam; -import net.sourceforge.plantuml.SkinParamBackcolored; +import net.sourceforge.plantuml.SkinParamColors; import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileBox; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; @@ -55,6 +55,7 @@ import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.UDrawable; +import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.SName; @@ -85,19 +86,23 @@ public class FingerImpl implements Finger, UDrawable { private Tetris tetris = null; private StyleSignature getDefaultStyleDefinitionNode() { + final String depth = SName.depth(level); if (level == 0) { - return StyleSignature.of(SName.root, SName.element, SName.mindmapDiagram, SName.node, SName.rootNode).add( - stereotype); + return StyleSignature.of(SName.root, SName.element, SName.mindmapDiagram, SName.node, SName.rootNode) + .add(stereotype).add(depth); } if (nail.size() == 0) { - return StyleSignature.of(SName.root, SName.element, SName.mindmapDiagram, SName.node, SName.leafNode).add( - stereotype); + return StyleSignature.of(SName.root, SName.element, SName.mindmapDiagram, SName.node, SName.leafNode) + .add(stereotype).add(depth); } - return StyleSignature.of(SName.root, SName.element, SName.mindmapDiagram, SName.node).add(stereotype); + return StyleSignature.of(SName.root, SName.element, SName.mindmapDiagram, SName.node).add(stereotype) + .add(depth); } public StyleSignature getDefaultStyleDefinitionArrow() { - return StyleSignature.of(SName.root, SName.element, SName.mindmapDiagram, SName.arrow).add(stereotype); + final String depth = SName.depth(level); + return StyleSignature.of(SName.root, SName.element, SName.mindmapDiagram, SName.arrow).add(stereotype) + .add(depth); } public static FingerImpl build(Idea idea, ISkinParam skinParam, Direction direction) { @@ -237,7 +242,8 @@ public class FingerImpl implements Finger, UDrawable { font = skinParam.getFont(null, false, FontParam.ACTIVITY); } if (shape == IdeaShape.BOX) { - final ISkinParam foo = new SkinParamBackcolored(Colors.empty().mute(skinParam), backColor); + // final ISkinParam foo = new SkinParamBackcolored(Colors.empty().mute(skinParam), backColor); + final ISkinParam foo = new SkinParamColors(skinParam, Colors.empty().add(ColorType.BACK, backColor)); final FtileBox box = FtileBox.createMindMap(styleBuilder, foo, label, getDefaultStyleDefinitionNode()); return TextBlockUtils.withMargin(box, 0, 0, margin(), margin()); } diff --git a/src/net/sourceforge/plantuml/mindmap/Idea.java b/src/net/sourceforge/plantuml/mindmap/Idea.java index 509ecea93..f8cf6c636 100644 --- a/src/net/sourceforge/plantuml/mindmap/Idea.java +++ b/src/net/sourceforge/plantuml/mindmap/Idea.java @@ -46,10 +46,6 @@ import net.sourceforge.plantuml.style.StyleBuilder; class Idea { - // public StyleDefinition getDefaultStyleDefinition() { - // return StyleDefinition.of(SName.root, SName.element, SName.mindmapDiagram, SName.node); - // } - private final Display label; private final int level; private final Idea parent; @@ -59,8 +55,8 @@ class Idea { private final StyleBuilder styleBuilder; private final String stereotype; - public Idea(StyleBuilder styleBuilder, Display label, IdeaShape shape, String stereotype) { - this(styleBuilder, null, 0, null, label, shape, stereotype); + public Idea(StyleBuilder styleBuilder, HtmlColor backColor, Display label, IdeaShape shape, String stereotype) { + this(styleBuilder, backColor, 0, null, label, shape, stereotype); } public Idea createIdea(StyleBuilder styleBuilder, HtmlColor backColor, int newLevel, Display newDisplay, @@ -70,14 +66,6 @@ class Idea { return result; } - // public Style getStyle(StyleBuilder styleBuilder) { - // Style result = getDefaultStyleDefinition().getMergedStyle(styleBuilder); - // if (backColor != null) { - // result = result.eventuallyOverride(PName.BackGroundColor, backColor); - // } - // return result; - // } - private Idea(StyleBuilder styleBuilder, HtmlColor backColor, int level, Idea parent, Display label, IdeaShape shape, String stereotype) { this.backColor = backColor; diff --git a/src/net/sourceforge/plantuml/mindmap/MindMapDiagram.java b/src/net/sourceforge/plantuml/mindmap/MindMapDiagram.java index ed6df8804..5c12e5456 100644 --- a/src/net/sourceforge/plantuml/mindmap/MindMapDiagram.java +++ b/src/net/sourceforge/plantuml/mindmap/MindMapDiagram.java @@ -181,19 +181,17 @@ public class MindMapDiagram extends UmlDiagram { public CommandExecutionResult addIdea(HtmlColor backColor, int level, Display label, IdeaShape shape, Direction direction) { - final Matcher2 m = WBSDiagram.patternStereotype.matcher(label.get(0)); - String stereotype = null; - if (m.matches()) { - label = Display.getWithNewlines(m.group(1)); - stereotype = m.group(2); + String stereotype = label.getEndingStereotype(); + if (stereotype != null) { + label = label.removeEndingStereotype(); } if (level == 0) { if (this.right.root != null) { return CommandExecutionResult .error("I don't know how to draw multi-root diagram. You should suggest an image so that the PlantUML team implements it :-)"); } - right.initRoot(getSkinParam().getCurrentStyleBuilder(), label, shape, stereotype); - left.initRoot(getSkinParam().getCurrentStyleBuilder(), label, shape, stereotype); + right.initRoot(getSkinParam().getCurrentStyleBuilder(), backColor, label, shape, stereotype); + left.initRoot(getSkinParam().getCurrentStyleBuilder(), backColor, label, shape, stereotype); return CommandExecutionResult.ok(); } if (direction == Direction.LEFT) { @@ -207,8 +205,8 @@ public class MindMapDiagram extends UmlDiagram { private Idea last; private Finger finger; - private void initRoot(StyleBuilder styleBuilder, Display label, IdeaShape shape, String stereotype) { - root = new Idea(styleBuilder, label, shape, stereotype); + private void initRoot(StyleBuilder styleBuilder, HtmlColor backColor, Display label, IdeaShape shape, String stereotype) { + root = new Idea(styleBuilder, backColor, label, shape, stereotype); last = root; } diff --git a/src/net/sourceforge/plantuml/project3/ComplementDayOfWeek.java b/src/net/sourceforge/plantuml/project3/ComplementDayOfWeek.java new file mode 100644 index 000000000..ce2a97577 --- /dev/null +++ b/src/net/sourceforge/plantuml/project3/ComplementDayOfWeek.java @@ -0,0 +1,55 @@ +/* ======================================================================== + * 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.project3; + +import net.sourceforge.plantuml.command.regex.IRegex; +import net.sourceforge.plantuml.command.regex.RegexConcat; +import net.sourceforge.plantuml.command.regex.RegexLeaf; +import net.sourceforge.plantuml.command.regex.RegexResult; + +public class ComplementDayOfWeek implements ComplementPattern { + + public IRegex toRegex(String suffix) { + return new RegexConcat( // + new RegexLeaf("COMPLEMENT" + suffix, "(" + DayOfWeek.getRegexString() + ")")); // + } + + public Failable getComplement(GanttDiagram system, RegexResult arg, String suffix) { + final String s = arg.get("COMPLEMENT" + suffix, 0); + return Failable. ok(DayOfWeek.fromString(s)); + } + +} diff --git a/src/net/sourceforge/plantuml/project3/ComplementSeveralDays.java b/src/net/sourceforge/plantuml/project3/ComplementSeveralDays.java index cb8c44c46..91a1cd021 100644 --- a/src/net/sourceforge/plantuml/project3/ComplementSeveralDays.java +++ b/src/net/sourceforge/plantuml/project3/ComplementSeveralDays.java @@ -45,19 +45,14 @@ public class ComplementSeveralDays implements ComplementPattern { public IRegex toRegex(String suffix) { return new RegexConcat( // new RegexLeaf("COMPLEMENT" + suffix, "(\\d+)[%s]+(days?|weeks?)")); // - // new RegexLeaf("LOAD" + suffix, "([%s]+at[%s]+(\\d+)%)?")); } public Failable getComplement(GanttDiagram system, RegexResult arg, String suffix) { final String number = arg.get("COMPLEMENT" + suffix, 0); final boolean inWeeks = arg.get("COMPLEMENT" + suffix, 1).startsWith("w"); final int factor = inWeeks ? system.daysInWeek() : 1; - // final String load = arg.get("LOAD" + suffix, 1); final int days = Integer.parseInt(number) * factor; - // if (load == null) { return Failable. ok(LoadInDays.inDay(days)); - // } - // return Failable. ok(LoadInDays.inDayWithLoad(days, Integer.parseInt(load))); } } diff --git a/src/net/sourceforge/plantuml/project3/DayOfWeek.java b/src/net/sourceforge/plantuml/project3/DayOfWeek.java index 6f8a09c8c..54af9a75b 100644 --- a/src/net/sourceforge/plantuml/project3/DayOfWeek.java +++ b/src/net/sourceforge/plantuml/project3/DayOfWeek.java @@ -37,7 +37,7 @@ package net.sourceforge.plantuml.project3; import net.sourceforge.plantuml.StringUtils; -public enum DayOfWeek implements Subject { +public enum DayOfWeek implements Subject, Complement { MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY; diff --git a/src/net/sourceforge/plantuml/project3/GanttDiagram.java b/src/net/sourceforge/plantuml/project3/GanttDiagram.java index b298e305c..b22f34344 100644 --- a/src/net/sourceforge/plantuml/project3/GanttDiagram.java +++ b/src/net/sourceforge/plantuml/project3/GanttDiagram.java @@ -586,7 +586,7 @@ public class GanttDiagram extends TitledDiagram implements Subject { public Resource getResource(String resourceName) { Resource resource = resources.get(resourceName); if (resource == null) { - resource = new Resource(resourceName, getDefaultPlan()); + resource = new Resource(resourceName, getDefaultPlan(), getCalendarSimple()); } resources.put(resourceName, resource); return resource; diff --git a/src/net/sourceforge/plantuml/project3/GanttDiagramFactory.java b/src/net/sourceforge/plantuml/project3/GanttDiagramFactory.java index e5d9a8446..06ae4948f 100644 --- a/src/net/sourceforge/plantuml/project3/GanttDiagramFactory.java +++ b/src/net/sourceforge/plantuml/project3/GanttDiagramFactory.java @@ -38,7 +38,6 @@ package net.sourceforge.plantuml.project3; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; -import java.util.Collections; import java.util.List; import net.sourceforge.plantuml.command.Command; diff --git a/src/net/sourceforge/plantuml/project3/LoadInDays.java b/src/net/sourceforge/plantuml/project3/LoadInDays.java index 2695cf1c1..7ef804869 100644 --- a/src/net/sourceforge/plantuml/project3/LoadInDays.java +++ b/src/net/sourceforge/plantuml/project3/LoadInDays.java @@ -49,11 +49,6 @@ public class LoadInDays implements Load { return new LoadInDays(days, 100); } -// public static Complement inDayWithLoad(int days, int loadPerDay) { -// final int tmp = (int) Math.ceil(days * 100.0 / loadPerDay); -// return new LoadInDays(tmp, loadPerDay); -// } - public int getFullLoad() { return days * loadPerDay; } diff --git a/src/net/sourceforge/plantuml/project3/Resource.java b/src/net/sourceforge/plantuml/project3/Resource.java index ea95a93aa..668c89d50 100644 --- a/src/net/sourceforge/plantuml/project3/Resource.java +++ b/src/net/sourceforge/plantuml/project3/Resource.java @@ -35,19 +35,25 @@ */ package net.sourceforge.plantuml.project3; +import java.util.Collection; +import java.util.EnumSet; +import java.util.HashSet; import java.util.Set; import java.util.TreeSet; -public class Resource implements Subject /* , LoadPlanable */{ +public class Resource implements Subject { private final String name; private ResourceDraw draw; - // private final LoadPlanable loadPlanable; - private Set closed = new TreeSet(); + private final Set closed = new TreeSet(); + private final Set forcedOn = new TreeSet(); + private final GCalendar calendar; - public Resource(String name, LoadPlanable loadPlanable) { + private final Collection closedDayOfWeek = EnumSet.noneOf(DayOfWeek.class); + + public Resource(String name, LoadPlanable loadPlanable, GCalendar calendar) { this.name = name; - // this.loadPlanable = loadPlanable; + this.calendar = calendar; } @Override @@ -79,17 +85,27 @@ public class Resource implements Subject /* , LoadPlanable */{ } public boolean isClosedAt(Instant instant) { - return this.closed.contains(instant); + if (this.forcedOn.contains(instant)) { + return false; + } + if (closedDayOfWeek.size() > 0 && calendar != null) { + final DayAsDate d = calendar.toDayAsDate((InstantDay) instant); + if (closedDayOfWeek.contains(d.getDayOfWeek())) { + return true; + } + } + return this.closed.contains(instant); } -// public int getLoadAt(Instant instant) { -// if (this.closed.contains(instant)) { -// return 0; -// } -// return loadPlanable.getLoadAt(instant); -// } - public void addCloseDay(Instant instant) { this.closed.add(instant); } + + public void addForceOnDay(Instant instant) { + this.forcedOn.add(instant); + } + + public void addCloseDay(DayOfWeek dayOfWeek) { + closedDayOfWeek.add(dayOfWeek); + } } diff --git a/src/net/sourceforge/plantuml/project3/SubjectResource.java b/src/net/sourceforge/plantuml/project3/SubjectResource.java index e19601dbe..510d074b3 100644 --- a/src/net/sourceforge/plantuml/project3/SubjectResource.java +++ b/src/net/sourceforge/plantuml/project3/SubjectResource.java @@ -46,7 +46,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult; public class SubjectResource implements SubjectPattern { public Collection getVerbs() { - return Arrays. asList(new VerbIsOff()); + return Arrays. asList(new VerbIsOff(), new VerbIsOn()); } public IRegex toRegex() { diff --git a/src/net/sourceforge/plantuml/project3/VerbIsOff.java b/src/net/sourceforge/plantuml/project3/VerbIsOff.java index b2b398ee6..7ce044d75 100644 --- a/src/net/sourceforge/plantuml/project3/VerbIsOff.java +++ b/src/net/sourceforge/plantuml/project3/VerbIsOff.java @@ -42,12 +42,14 @@ import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; +import net.sourceforge.plantuml.command.regex.RegexOr; import net.sourceforge.plantuml.command.regex.RegexResult; public class VerbIsOff implements VerbPattern { public Collection getComplements() { - return Arrays. asList(new ComplementDate(), new ComplementDates()); + return Arrays + . asList(new ComplementDate(), new ComplementDates(), new ComplementDayOfWeek()); } public IRegex toRegex() { @@ -55,14 +57,21 @@ public class VerbIsOff implements VerbPattern { RegexLeaf.spaceOneOrMore(), // new RegexLeaf("off"), // RegexLeaf.spaceOneOrMore(), // - new RegexLeaf("on")); + new RegexOr(// + new RegexLeaf("on"),// + new RegexLeaf("for"),// + new RegexLeaf("the"),// + new RegexLeaf("at") // + )); } public Verb getVerb(final GanttDiagram project, RegexResult arg) { return new Verb() { public CommandExecutionResult execute(Subject subject, Complement complement) { final Resource resource = (Resource) subject; - if (complement instanceof DaysAsDates) { + if (complement instanceof DayOfWeek) { + resource.addCloseDay(((DayOfWeek) complement)); + } else if (complement instanceof DaysAsDates) { for (DayAsDate when : (DaysAsDates) complement) { resource.addCloseDay(project.convert(when)); } @@ -75,5 +84,4 @@ public class VerbIsOff implements VerbPattern { }; } - } diff --git a/src/net/sourceforge/plantuml/project3/VerbIsOn.java b/src/net/sourceforge/plantuml/project3/VerbIsOn.java new file mode 100644 index 000000000..11e468830 --- /dev/null +++ b/src/net/sourceforge/plantuml/project3/VerbIsOn.java @@ -0,0 +1,85 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * PlantUML is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PlantUML distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * + * Original Author: Arnaud Roques + * + * + */ +package net.sourceforge.plantuml.project3; + +import java.util.Arrays; +import java.util.Collection; + +import net.sourceforge.plantuml.command.CommandExecutionResult; +import net.sourceforge.plantuml.command.regex.IRegex; +import net.sourceforge.plantuml.command.regex.RegexConcat; +import net.sourceforge.plantuml.command.regex.RegexLeaf; +import net.sourceforge.plantuml.command.regex.RegexOr; +import net.sourceforge.plantuml.command.regex.RegexResult; + +public class VerbIsOn implements VerbPattern { + + public Collection getComplements() { + return Arrays. asList(new ComplementDate(), new ComplementDates()); + } + + public IRegex toRegex() { + return new RegexConcat(new RegexLeaf("is"), // + RegexLeaf.spaceOneOrMore(), // + new RegexLeaf("on"), // + RegexLeaf.spaceOneOrMore(), // + new RegexOr(// + new RegexLeaf("on"),// + new RegexLeaf("for"),// + new RegexLeaf("the"),// + new RegexLeaf("at") // + ) // + ); + } + + public Verb getVerb(final GanttDiagram project, RegexResult arg) { + return new Verb() { + public CommandExecutionResult execute(Subject subject, Complement complement) { + final Resource resource = (Resource) subject; + if (complement instanceof DaysAsDates) { + for (DayAsDate when : (DaysAsDates) complement) { + resource.addForceOnDay(project.convert(when)); + } + } else { + final DayAsDate when = (DayAsDate) complement; + resource.addForceOnDay(project.convert(when)); + } + return CommandExecutionResult.ok(); + } + + }; + } +} diff --git a/src/net/sourceforge/plantuml/project3/VerbProjectStarts.java b/src/net/sourceforge/plantuml/project3/VerbProjectStarts.java index 5646c1d73..74350ec20 100644 --- a/src/net/sourceforge/plantuml/project3/VerbProjectStarts.java +++ b/src/net/sourceforge/plantuml/project3/VerbProjectStarts.java @@ -40,8 +40,12 @@ import java.util.Collection; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.regex.IRegex; +import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; +import net.sourceforge.plantuml.command.regex.RegexOptional; +import net.sourceforge.plantuml.command.regex.RegexOr; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement; public class VerbProjectStarts implements VerbPattern { @@ -49,10 +53,23 @@ public class VerbProjectStarts implements VerbPattern { return Arrays. asList(new ComplementDate()); } - public IRegex toRegex() { + public IRegex toRegexOld() { return new RegexLeaf("starts[%s]*(the[%s]*|on[%s]*)*"); } + public IRegex toRegex() { + return new RegexConcat(new RegexLeaf("start"), // + new RegexOptional(new RegexLeaf("s")), // + RegexLeaf.spaceZeroOrMore(), // + new RegexOptional(new RegexOr(// + new RegexLeaf("on"),// + new RegexLeaf("for"),// + new RegexLeaf("the"),// + new RegexLeaf("at") // + )) // + ); + } + public Verb getVerb(final GanttDiagram project, RegexResult arg) { return new Verb() { public CommandExecutionResult execute(Subject subject, Complement complement) { diff --git a/src/net/sourceforge/plantuml/skin/rose/Rose.java b/src/net/sourceforge/plantuml/skin/rose/Rose.java index c56eb9bca..334b6ce0e 100644 --- a/src/net/sourceforge/plantuml/skin/rose/Rose.java +++ b/src/net/sourceforge/plantuml/skin/rose/Rose.java @@ -370,6 +370,16 @@ public class Rose { skinParameter = SkinParameter.PARTICIPANT; } else if (color == ColorParam.actorBorder) { skinParameter = SkinParameter.ACTOR; + } else if (color == ColorParam.boundaryBorder) { + skinParameter = SkinParameter.BOUNDARY; + } else if (color == ColorParam.controlBorder) { + skinParameter = SkinParameter.CONTROL; + } else if (color == ColorParam.entityBorder) { + skinParameter = SkinParameter.ENTITY; + } else if (color == ColorParam.collectionsBorder) { + skinParameter = SkinParameter.COLLECTIONS; + } else if (color == ColorParam.databaseBorder) { + skinParameter = SkinParameter.DATABASE; } final boolean result = skinParameter == null ? param.shadowing(null) : param.shadowing2(null, skinParameter); return result ? 4.0 : 0; @@ -403,9 +413,10 @@ public class Rose { .withDeltaShadow(deltaShadow(skin, color)); } if (color == ColorParam.entityBorder) { + final double tmp = deltaShadow(skin, color); return new SymbolContext(getHtmlColor(skin, ColorParam.entityBackground), getHtmlColor(skin, ColorParam.entityBorder)).withStroke(getStroke(skin, LineParam.sequenceActorBorder, 2)) - .withDeltaShadow(deltaShadow(skin, color)); + .withDeltaShadow(tmp); } if (color == ColorParam.databaseBorder) { return new SymbolContext(getHtmlColor(skin, ColorParam.databaseBackground), getHtmlColor(skin, diff --git a/src/net/sourceforge/plantuml/sudoku/GraphicsSudoku.java b/src/net/sourceforge/plantuml/sudoku/GraphicsSudoku.java index e9a8c167b..2057c135c 100644 --- a/src/net/sourceforge/plantuml/sudoku/GraphicsSudoku.java +++ b/src/net/sourceforge/plantuml/sudoku/GraphicsSudoku.java @@ -88,7 +88,7 @@ public class GraphicsSudoku { public ImageData writeImageSvg(OutputStream os) throws IOException { final UGraphicSvg ug = new UGraphicSvg(true, new Dimension2DDouble(0, 0), new ColorMapperIdentity(), - (String) null, false, 1.0, null, null, 0); + (String) null, false, 1.0, null, null, 0, "none"); drawInternal(ug); ug.createXml(os, null); return ImageDataSimple.ok(); diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryCrowfoot.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryCrowfoot.java index 838d07d68..0b49f3977 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryCrowfoot.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryCrowfoot.java @@ -50,7 +50,8 @@ public class ExtremityFactoryCrowfoot extends AbstractExtremityFactory implement @Override public UDrawable createUDrawable(Point2D p0, double angle, Side side) { - throw new UnsupportedOperationException(getClass().toString()); + angle -= Math.PI / 2; + return new ExtremityCrowfoot(p0, angle, side); } } \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/svg/SvgGraphics.java b/src/net/sourceforge/plantuml/svg/SvgGraphics.java index f75e291b3..7b4c221b9 100644 --- a/src/net/sourceforge/plantuml/svg/SvgGraphics.java +++ b/src/net/sourceforge/plantuml/svg/SvgGraphics.java @@ -109,6 +109,8 @@ public class SvgGraphics { private int maxX = 10; private int maxY = 10; + private final String preserveAspectRatio; + private final double scale; private final String filterUid; private final String shadowId; @@ -124,17 +126,19 @@ public class SvgGraphics { } } - public SvgGraphics(boolean svgDimensionStyle, Dimension2D minDim, double scale, String hover, long seed) { - this(svgDimensionStyle, minDim, null, scale, hover, seed); + public SvgGraphics(boolean svgDimensionStyle, Dimension2D minDim, double scale, String hover, long seed, + String preserveAspectRatio) { + this(svgDimensionStyle, minDim, null, scale, hover, seed, preserveAspectRatio); } public SvgGraphics(boolean svgDimensionStyle, Dimension2D minDim, String backcolor, double scale, String hover, - long seed) { + long seed, String preserveAspectRatio) { try { this.svgDimensionStyle = svgDimensionStyle; this.scale = scale; this.document = getDocument(); this.backcolor = backcolor; + this.preserveAspectRatio = preserveAspectRatio; ensureVisible(minDim.getWidth(), minDim.getHeight()); this.root = getRootNode(); @@ -594,7 +598,7 @@ public class SvgGraphics { } root.setAttribute("viewBox", "0 0 " + maxXscaled + " " + maxYscaled); root.setAttribute("zoomAndPan", "magnify"); - root.setAttribute("preserveAspectRatio", "none"); + root.setAttribute("preserveAspectRatio", preserveAspectRatio); root.setAttribute("contentScriptType", "application/ecmascript"); root.setAttribute("contentStyleType", "text/css"); diff --git a/src/net/sourceforge/plantuml/syntax/LanguageDescriptor.java b/src/net/sourceforge/plantuml/syntax/LanguageDescriptor.java index 5d2c0f4f9..00e6785ac 100644 --- a/src/net/sourceforge/plantuml/syntax/LanguageDescriptor.java +++ b/src/net/sourceforge/plantuml/syntax/LanguageDescriptor.java @@ -82,6 +82,7 @@ public class LanguageDescriptor { type.add("queue"); type.add("archimate"); type.add("diamond"); + type.add("detach"); keyword.add("@startuml"); keyword.add("@enduml"); diff --git a/src/net/sourceforge/plantuml/tim/TContext.java b/src/net/sourceforge/plantuml/tim/TContext.java index 7724674f6..2a3ddfd40 100644 --- a/src/net/sourceforge/plantuml/tim/TContext.java +++ b/src/net/sourceforge/plantuml/tim/TContext.java @@ -75,6 +75,7 @@ import net.sourceforge.plantuml.tim.stdlib.FileExists; import net.sourceforge.plantuml.tim.stdlib.Filename; import net.sourceforge.plantuml.tim.stdlib.FunctionExists; import net.sourceforge.plantuml.tim.stdlib.GetVariableValue; +import net.sourceforge.plantuml.tim.stdlib.GetVersion; import net.sourceforge.plantuml.tim.stdlib.Getenv; import net.sourceforge.plantuml.tim.stdlib.IntVal; import net.sourceforge.plantuml.tim.stdlib.InvokeVoidFunction; @@ -125,6 +126,7 @@ public class TContext { addFunction(new SetVariableValue()); addFunction(new GetVariableValue()); addFunction(new IntVal()); + addFunction(new GetVersion()); // !exit // !log // %min diff --git a/src/net/sourceforge/plantuml/tim/stdlib/GetVersion.java b/src/net/sourceforge/plantuml/tim/stdlib/GetVersion.java new file mode 100644 index 000000000..1e48a2c56 --- /dev/null +++ b/src/net/sourceforge/plantuml/tim/stdlib/GetVersion.java @@ -0,0 +1,59 @@ +/* ======================================================================== + * 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.tim.stdlib; + +import java.util.List; + +import net.sourceforge.plantuml.tim.EaterException; +import net.sourceforge.plantuml.tim.TContext; +import net.sourceforge.plantuml.tim.TFunctionSignature; +import net.sourceforge.plantuml.tim.TMemory; +import net.sourceforge.plantuml.tim.expression.TValue; +import net.sourceforge.plantuml.version.Version; + +public class GetVersion extends SimpleReturnFunction { + + public TFunctionSignature getSignature() { + return new TFunctionSignature("%version", 1); + } + + public boolean canCover(int nbArg) { + return nbArg == 0; + } + + public TValue executeReturn(TContext context, TMemory memory, List args) throws EaterException { + return TValue.fromString(Version.versionString()); + } +} diff --git a/src/net/sourceforge/plantuml/ugraphic/FontChecker.java b/src/net/sourceforge/plantuml/ugraphic/FontChecker.java index caa03b91d..3767e57c7 100644 --- a/src/net/sourceforge/plantuml/ugraphic/FontChecker.java +++ b/src/net/sourceforge/plantuml/ugraphic/FontChecker.java @@ -157,7 +157,7 @@ public class FontChecker { } private String getSvgImage(char c) throws IOException, TransformerException { - final SvgGraphics svg = new SvgGraphics(true, new Dimension2DDouble(0, 0), 1.0, null, 42); + final SvgGraphics svg = new SvgGraphics(true, new Dimension2DDouble(0, 0), 1.0, null, 42, "none"); svg.setStrokeColor("black"); svg.svgImage(getBufferedImage(c), 0, 0); final ByteArrayOutputStream os = new ByteArrayOutputStream(); diff --git a/src/net/sourceforge/plantuml/ugraphic/ImageBuilder.java b/src/net/sourceforge/plantuml/ugraphic/ImageBuilder.java index f9eba490a..5fabb1ea7 100644 --- a/src/net/sourceforge/plantuml/ugraphic/ImageBuilder.java +++ b/src/net/sourceforge/plantuml/ugraphic/ImageBuilder.java @@ -393,7 +393,7 @@ public class ImageBuilder { return createUGraphicPNG(colorMapper, dpiFactor, dim, mybackcolor, animationArg, dx, dy); case SVG: return createUGraphicSVG(colorMapper, dpiFactor, dim, mybackcolor, fileFormatOption.getSvgLinkTarget(), - fileFormatOption.getHoverColor(), seed); + fileFormatOption.getHoverColor(), seed, fileFormatOption.getPreserveAspectRatio()); case EPS: return new UGraphicEps(colorMapper, EpsStrategy.getDefault2()); case EPS_TEXT: @@ -417,7 +417,7 @@ public class ImageBuilder { } private UGraphic2 createUGraphicSVG(ColorMapper colorMapper, double scale, Dimension2D dim, HtmlColor mybackcolor, - String svgLinkTarget, String hover, long seed) { + String svgLinkTarget, String hover, long seed, String preserveAspectRatio) { Color backColor = Color.WHITE; if (mybackcolor instanceof HtmlColorSimple) { backColor = colorMapper.getMappedColor(mybackcolor); @@ -425,12 +425,12 @@ public class ImageBuilder { final UGraphicSvg ug; if (mybackcolor instanceof HtmlColorGradient) { ug = new UGraphicSvg(svgDimensionStyle, dim, colorMapper, (HtmlColorGradient) mybackcolor, false, scale, - svgLinkTarget, hover, seed); + svgLinkTarget, hover, seed, preserveAspectRatio); } else if (backColor == null || backColor.equals(Color.WHITE)) { - ug = new UGraphicSvg(svgDimensionStyle, dim, colorMapper, false, scale, svgLinkTarget, hover, seed); + ug = new UGraphicSvg(svgDimensionStyle, dim, colorMapper, false, scale, svgLinkTarget, hover, seed, preserveAspectRatio); } else { ug = new UGraphicSvg(svgDimensionStyle, dim, colorMapper, StringUtils.getAsHtml(backColor), false, scale, - svgLinkTarget, hover, seed); + svgLinkTarget, hover, seed, preserveAspectRatio); } return ug; diff --git a/src/net/sourceforge/plantuml/ugraphic/UGraphicUtils.java b/src/net/sourceforge/plantuml/ugraphic/UGraphicUtils.java index ef66b0262..8cbf193e9 100644 --- a/src/net/sourceforge/plantuml/ugraphic/UGraphicUtils.java +++ b/src/net/sourceforge/plantuml/ugraphic/UGraphicUtils.java @@ -65,7 +65,7 @@ public abstract class UGraphicUtils { final Dimension2D size = computeSize(colorMapper, background, image); final UGraphicSvg svg = new UGraphicSvg(true, size, colorMapper, StringUtils.getAsHtml(colorMapper .getMappedColor(background)), false, 1.0, fileFormatOption.getSvgLinkTarget(), - fileFormatOption.getHoverColor(), seed); + fileFormatOption.getHoverColor(), seed, fileFormatOption.getPreserveAspectRatio()); image.drawU(svg); svg.createXml(os, fileFormatOption.isWithMetadata() ? metadata : null); } else if (fileFormat == FileFormat.EPS) { diff --git a/src/net/sourceforge/plantuml/ugraphic/svg/UGraphicSvg.java b/src/net/sourceforge/plantuml/ugraphic/svg/UGraphicSvg.java index 44cea4efe..97aebdc93 100644 --- a/src/net/sourceforge/plantuml/ugraphic/svg/UGraphicSvg.java +++ b/src/net/sourceforge/plantuml/ugraphic/svg/UGraphicSvg.java @@ -88,20 +88,21 @@ public class UGraphicSvg extends AbstractUGraphic implements ClipCo } public UGraphicSvg(boolean svgDimensionStyle, Dimension2D minDim, ColorMapper colorMapper, String backcolor, - boolean textAsPath, double scale, String linkTarget, String hover, long seed) { - this(minDim, colorMapper, new SvgGraphics(svgDimensionStyle, minDim, backcolor, scale, hover, seed), - textAsPath, linkTarget); + boolean textAsPath, double scale, String linkTarget, String hover, long seed, String preserveAspectRatio) { + this(minDim, colorMapper, new SvgGraphics(svgDimensionStyle, minDim, backcolor, scale, hover, seed, + preserveAspectRatio), textAsPath, linkTarget); } public UGraphicSvg(boolean svgDimensionStyle, Dimension2D minDim, ColorMapper colorMapper, boolean textAsPath, - double scale, String linkTarget, String hover, long seed) { - this(minDim, colorMapper, new SvgGraphics(svgDimensionStyle, minDim, scale, hover, seed), textAsPath, - linkTarget); + double scale, String linkTarget, String hover, long seed, String preserveAspectRatio) { + this(minDim, colorMapper, new SvgGraphics(svgDimensionStyle, minDim, scale, hover, seed, preserveAspectRatio), + textAsPath, linkTarget); } public UGraphicSvg(boolean svgDimensionStyle, Dimension2D minDim, ColorMapper mapper, HtmlColorGradient gr, - boolean textAsPath, double scale, String linkTarget, String hover, long seed) { - this(minDim, mapper, new SvgGraphics(svgDimensionStyle, minDim, scale, hover, seed), textAsPath, linkTarget); + boolean textAsPath, double scale, String linkTarget, String hover, long seed, String preserveAspectRatio) { + this(minDim, mapper, new SvgGraphics(svgDimensionStyle, minDim, scale, hover, seed, preserveAspectRatio), + textAsPath, linkTarget); final SvgGraphics svg = getGraphicObject(); svg.paintBackcolorGradient(mapper, gr); diff --git a/src/net/sourceforge/plantuml/utils/CharHidder.java b/src/net/sourceforge/plantuml/utils/CharHidder.java index 5ce1a31a0..beb4ba2f6 100644 --- a/src/net/sourceforge/plantuml/utils/CharHidder.java +++ b/src/net/sourceforge/plantuml/utils/CharHidder.java @@ -46,7 +46,10 @@ public class CharHidder { final StringBuilder result = new StringBuilder(); for (int i = 0; i < s.length(); i++) { final char c = s.charAt(i); - if (c == '~' && i + 1 < s.length()) { + if (c == '\\' && i + 1 < s.length() && s.charAt(i + 1) == '~') { + result.append(hideChar('~')); + i++; + } else if (c == '~' && i + 1 < s.length()) { i++; final char c2 = s.charAt(i); if (isToBeHidden(c2)) { diff --git a/src/net/sourceforge/plantuml/version/Version.java b/src/net/sourceforge/plantuml/version/Version.java index 947113ca7..cdfee3042 100644 --- a/src/net/sourceforge/plantuml/version/Version.java +++ b/src/net/sourceforge/plantuml/version/Version.java @@ -43,7 +43,7 @@ public class Version { private static final int MAJOR_SEPARATOR = 1000000; public static int version() { - return 1201911; + return 1201912; } public static int versionPatched() { @@ -93,7 +93,7 @@ public class Version { } public static long compileTime() { - return 1569146535007L; + return 1572776694309L; } public static String compileTimeString() { diff --git a/stdlib/home.repx b/stdlib/home.repx index 9496900f7..b09566345 100644 --- a/stdlib/home.repx +++ b/stdlib/home.repx @@ -8,3 +8,4 @@ material office c4 osa +kubernetes diff --git a/stdlib/kubernetes-abx.repx b/stdlib/kubernetes-abx.repx new file mode 100644 index 000000000..5563efebb Binary files /dev/null and b/stdlib/kubernetes-abx.repx differ diff --git a/stdlib/kubernetes-dex.repx b/stdlib/kubernetes-dex.repx new file mode 100644 index 000000000..22b008ffa Binary files /dev/null and b/stdlib/kubernetes-dex.repx differ diff --git a/stdlib/osa-abx.repx b/stdlib/osa-abx.repx index 95516ae18..14cbddfde 100644 Binary files a/stdlib/osa-abx.repx and b/stdlib/osa-abx.repx differ diff --git a/stdlib/osa-dex.repx b/stdlib/osa-dex.repx index e0870ae6e..d471bdd3d 100644 Binary files a/stdlib/osa-dex.repx and b/stdlib/osa-dex.repx differ