1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-24 13:57:33 +00:00

version 1.2019.12

This commit is contained in:
Arnaud Roques 2019-11-03 18:40:03 +01:00
parent 82b570d0f0
commit 36c461dabe
55 changed files with 557 additions and 142 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.2019.12-SNAPSHOT</version> <version>1.2019.13-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>PlantUML</name> <name>PlantUML</name>

View File

@ -379,11 +379,12 @@ UNSUPPORTED("1um729vqiy3529kbsrzyl9u3y"); // rtp->InTouchCount++;
CombineRect((ST_Rect_t)r, (ST_Rect_t) n.branch[i].rect)); CombineRect((ST_Rect_t)r, (ST_Rect_t) n.branch[i].rect));
return 0; return 0;
} else { /* child was split */ } else { /* child was split */
UNSUPPORTED("7evrfdq7uc1smqislqm9d82l6"); // n->branch[i].rect = NodeCover(n->branch[i].child); n.branch[i].setStruct("rect",
UNSUPPORTED("echuth2qnq0o4n5gkzgtu5bgs"); // b.child = n2; NodeCover((ST_Node_t___)n.branch[i].child));
UNSUPPORTED("50z4r9qcomgi4o7vvwq0v0xs"); // b.rect = NodeCover(n2); b.child = n2[0];
UNSUPPORTED("451qw2ioqybj69k9abzvqw4mk"); // rtp->EntryCount++; b.rect.___(NodeCover(n2[0]));
UNSUPPORTED("9uz11nbvh6yp6yq2axvo7e0fb"); // return AddBranch(rtp, &b, n, new); rtp.setInt("EntryCount", rtp.EntryCount+1);
return AddBranch(rtp, b, n, new_);
} }
} else if (n.level == level) { /* at level for insertion. */ } else if (n.level == level) { /* at level for insertion. */
/*Add rect, split if necessary */ /*Add rect, split if necessary */

View File

@ -57,13 +57,14 @@ public final class FileFormatOption implements Serializable {
private final String hoverColor; private final String hoverColor;
private final TikzFontDistortion tikzFontDistortion; private final TikzFontDistortion tikzFontDistortion;
private final double scale; private final double scale;
private final String preserveAspectRatio;
public double getScaleCoef() { public double getScaleCoef() {
return scale; return scale;
} }
public FileFormatOption(FileFormat fileFormat) { 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() { public StringBounder getDefaultStringBounder() {
@ -78,13 +79,17 @@ public final class FileFormatOption implements Serializable {
return withMetadata; return withMetadata;
} }
public final String getPreserveAspectRatio() {
return preserveAspectRatio;
}
public FileFormatOption(FileFormat fileFormat, boolean withMetadata) { 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, private FileFormatOption(FileFormat fileFormat, AffineTransform at, boolean withMetadata, boolean useRedForError,
String svgLinkTarget, boolean debugsvek, String hoverColor, TikzFontDistortion tikzFontDistortion, String svgLinkTarget, boolean debugsvek, String hoverColor, TikzFontDistortion tikzFontDistortion,
double scale) { double scale, String preserveAspectRatio) {
this.hoverColor = hoverColor; this.hoverColor = hoverColor;
this.fileFormat = fileFormat; this.fileFormat = fileFormat;
this.affineTransform = at; this.affineTransform = at;
@ -94,6 +99,7 @@ public final class FileFormatOption implements Serializable {
this.debugsvek = debugsvek; this.debugsvek = debugsvek;
this.tikzFontDistortion = tikzFontDistortion; this.tikzFontDistortion = tikzFontDistortion;
this.scale = scale; this.scale = scale;
this.preserveAspectRatio = preserveAspectRatio;
if (tikzFontDistortion == null) { if (tikzFontDistortion == null) {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
@ -101,27 +107,32 @@ public final class FileFormatOption implements Serializable {
public FileFormatOption withUseRedForError() { public FileFormatOption withUseRedForError() {
return new FileFormatOption(fileFormat, affineTransform, withMetadata, true, svgLinkTarget, debugsvek, return new FileFormatOption(fileFormat, affineTransform, withMetadata, true, svgLinkTarget, debugsvek,
hoverColor, tikzFontDistortion, scale); hoverColor, tikzFontDistortion, scale, preserveAspectRatio);
} }
public FileFormatOption withTikzFontDistortion(TikzFontDistortion tikzFontDistortion) { public FileFormatOption withTikzFontDistortion(TikzFontDistortion tikzFontDistortion) {
return new FileFormatOption(fileFormat, affineTransform, withMetadata, true, svgLinkTarget, debugsvek, return new FileFormatOption(fileFormat, affineTransform, withMetadata, true, svgLinkTarget, debugsvek,
hoverColor, tikzFontDistortion, scale); hoverColor, tikzFontDistortion, scale, preserveAspectRatio);
} }
public FileFormatOption withSvgLinkTarget(String svgLinkTarget) { public FileFormatOption withSvgLinkTarget(String svgLinkTarget) {
return new FileFormatOption(fileFormat, affineTransform, withMetadata, useRedForError, 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) { public FileFormatOption withHoverColor(String hoverColor) {
return new FileFormatOption(fileFormat, affineTransform, withMetadata, useRedForError, svgLinkTarget, return new FileFormatOption(fileFormat, affineTransform, withMetadata, useRedForError, svgLinkTarget,
debugsvek, hoverColor, tikzFontDistortion, scale); debugsvek, hoverColor, tikzFontDistortion, scale, preserveAspectRatio);
} }
public FileFormatOption withScale(double scale) { public FileFormatOption withScale(double scale) {
return new FileFormatOption(fileFormat, affineTransform, withMetadata, useRedForError, svgLinkTarget, return new FileFormatOption(fileFormat, affineTransform, withMetadata, useRedForError, svgLinkTarget,
debugsvek, hoverColor, tikzFontDistortion, scale); debugsvek, hoverColor, tikzFontDistortion, scale, preserveAspectRatio);
} }
@Override @Override

View File

@ -141,6 +141,8 @@ public interface ISkinParam extends ISkinSimple {
public String getSvgLinkTarget(); public String getSvgLinkTarget();
public String getPreserveAspectRatio();
public int getTabSize(); public int getTabSize();
public int maxAsciiMessageLength(); public int maxAsciiMessageLength();

View File

@ -1046,6 +1046,15 @@ public class SkinParam implements ISkinParam {
} }
return value; return value;
} }
public String getPreserveAspectRatio() {
final String value = getValue("preserveaspectratio");
if (value == null) {
return "none";
}
return value;
}
public String getMonospacedFamily() { public String getMonospacedFamily() {
final String value = getValue("defaultMonospacedFontName"); final String value = getValue("defaultMonospacedFontName");

View File

@ -234,6 +234,10 @@ public class SkinParamDelegator implements ISkinParam {
public String getSvgLinkTarget() { public String getSvgLinkTarget() {
return skinParam.getSvgLinkTarget(); return skinParam.getSvgLinkTarget();
} }
public String getPreserveAspectRatio() {
return skinParam.getPreserveAspectRatio();
}
public String getMonospacedFamily() { public String getMonospacedFamily() {
return skinParam.getMonospacedFamily(); return skinParam.getMonospacedFamily();
@ -355,4 +359,5 @@ public class SkinParamDelegator implements ISkinParam {
skinParam.setDefaultSkin(newFileName); skinParam.setDefaultSkin(newFileName);
} }
} }

View File

@ -186,6 +186,7 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot
if (fileFormatOption.getSvgLinkTarget() == null || fileFormatOption.getSvgLinkTarget().equals("_top")) { if (fileFormatOption.getSvgLinkTarget() == null || fileFormatOption.getSvgLinkTarget().equals("_top")) {
fileFormatOption = fileFormatOption.withSvgLinkTarget(getSkinParam().getSvgLinkTarget()); fileFormatOption = fileFormatOption.withSvgLinkTarget(getSkinParam().getSvgLinkTarget());
} }
fileFormatOption = fileFormatOption.withPreserveAspectRatio(getSkinParam().getPreserveAspectRatio());
fileFormatOption = fileFormatOption.withTikzFontDistortion(getSkinParam().getTikzFontDistortion()); fileFormatOption = fileFormatOption.withTikzFontDistortion(getSkinParam().getTikzFontDistortion());
if (hover != null) { if (hover != null) {
fileFormatOption = fileFormatOption.withHoverColor(StringUtils.getAsHtml(getSkinParam().getColorMapper() fileFormatOption = fileFormatOption.withHoverColor(StringUtils.getAsHtml(getSkinParam().getColorMapper()

View File

@ -61,6 +61,7 @@ import net.sourceforge.plantuml.command.CommandEndPackage;
import net.sourceforge.plantuml.command.CommandFootboxIgnored; import net.sourceforge.plantuml.command.CommandFootboxIgnored;
import net.sourceforge.plantuml.command.CommandNamespace; import net.sourceforge.plantuml.command.CommandNamespace;
import net.sourceforge.plantuml.command.CommandNamespace2; import net.sourceforge.plantuml.command.CommandNamespace2;
import net.sourceforge.plantuml.command.CommandNamespaceEmpty;
import net.sourceforge.plantuml.command.CommandPackage; import net.sourceforge.plantuml.command.CommandPackage;
import net.sourceforge.plantuml.command.CommandPackageEmpty; import net.sourceforge.plantuml.command.CommandPackageEmpty;
import net.sourceforge.plantuml.command.CommandPage; import net.sourceforge.plantuml.command.CommandPage;
@ -125,6 +126,7 @@ public class ClassDiagramFactory extends UmlDiagramFactory {
cmds.add(new CommandNamespace()); cmds.add(new CommandNamespace());
cmds.add(new CommandNamespace2()); cmds.add(new CommandNamespace2());
cmds.add(new CommandNamespaceEmpty());
cmds.add(new CommandStereotype()); cmds.add(new CommandStereotype());
cmds.add(new CommandLinkClass(UmlDiagramType.CLASS)); cmds.add(new CommandLinkClass(UmlDiagramType.CLASS));

View File

@ -76,7 +76,8 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
} }
private static IRegex getRegexConcat() { private static IRegex getRegexConcat() {
return RegexConcat.build(CommandCreateClass.class.getName(), RegexLeaf.start(), // return RegexConcat.build(CommandCreateClass.class.getName(),
RegexLeaf.start(), //
new RegexLeaf("TYPE", // new RegexLeaf("TYPE", //
"(interface|enum|annotation|abstract[%s]+class|abstract|class|entity|circle|diamond)"), // "(interface|enum|annotation|abstract[%s]+class|abstract|class|entity|circle|diamond)"), //
RegexLeaf.spaceOneOrMore(), // RegexLeaf.spaceOneOrMore(), //
@ -95,7 +96,8 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
new RegexLeaf("DISPLAY2", DISPLAY_WITH_GENERIC)), // new RegexLeaf("DISPLAY2", DISPLAY_WITH_GENERIC)), //
new RegexLeaf("CODE3", "(" + CODE + ")"), // new RegexLeaf("CODE3", "(" + CODE + ")"), //
new RegexLeaf("CODE4", "[%g]([^%g]+)[%g]")), // 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(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), // new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
@ -105,9 +107,14 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
color().getRegex(), // color().getRegex(), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexOptional(new RegexConcat(new RegexLeaf("##"), new RegexLeaf("LINECOLOR", "(?:\\[(dotted|dashed|bold)\\])?(\\w+)?"))), // new RegexOptional(new RegexConcat(new RegexLeaf("##"), new RegexLeaf("LINECOLOR",
new RegexOptional(new RegexConcat(RegexLeaf.spaceOneOrMore(), new RegexLeaf("EXTENDS", "(extends)[%s]+(" + CommandCreateClassMultilines.CODES + ")"))), // "(?:\\[(dotted|dashed|bold)\\])?(\\w+)?"))), //
new RegexOptional(new RegexConcat(RegexLeaf.spaceOneOrMore(), new RegexLeaf("IMPLEMENTS", "(implements)[%s]+(" + CommandCreateClassMultilines.CODES + ")"))), // 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()); RegexLeaf.end());
} }

View File

@ -48,7 +48,6 @@ import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.style.PName;
public class CommandFooter extends SingleLineCommand2<TitledDiagram> { public class CommandFooter extends SingleLineCommand2<TitledDiagram> {

View File

@ -48,7 +48,6 @@ import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.style.PName;
public class CommandHeader extends SingleLineCommand2<TitledDiagram> { public class CommandHeader extends SingleLineCommand2<TitledDiagram> {

View File

@ -42,7 +42,6 @@ import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.style.PName;
public class CommandMultilinesFooter extends CommandMultilines<TitledDiagram> { public class CommandMultilinesFooter extends CommandMultilines<TitledDiagram> {

View File

@ -42,7 +42,6 @@ import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.style.PName;
public class CommandMultilinesHeader extends CommandMultilines<TitledDiagram> { public class CommandMultilinesHeader extends CommandMultilines<TitledDiagram> {

View File

@ -43,7 +43,6 @@ import net.sourceforge.plantuml.classdiagram.ClassDiagram;
import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; 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.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;

View File

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

View File

@ -69,7 +69,7 @@ public class CommandPackage extends SingleLineCommand2<AbstractEntityDiagram> {
private static IRegex getRegexConcat() { private static IRegex getRegexConcat() {
return RegexConcat.build(CommandPackage.class.getName(), RegexLeaf.start(), // return RegexConcat.build(CommandPackage.class.getName(), RegexLeaf.start(), //
new RegexLeaf("TYPE", "(package|together)"), // new RegexLeaf("TYPE", "(package)"), //
RegexLeaf.spaceOneOrMore(), // RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("NAME", "([%g][^%g]+[%g]|[^#%s{}]*)"), // new RegexLeaf("NAME", "([%g][^%g]+[%g]|[^#%s{}]*)"), //
new RegexOptional( // new RegexOptional( //

View File

@ -53,7 +53,6 @@ import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.error.PSystemError; import net.sourceforge.plantuml.error.PSystemError;
import net.sourceforge.plantuml.error.PSystemErrorUtils; import net.sourceforge.plantuml.error.PSystemErrorUtils;
import net.sourceforge.plantuml.sequencediagram.command.CommandSkin; import net.sourceforge.plantuml.sequencediagram.command.CommandSkin;
import net.sourceforge.plantuml.sprite.CommandListSprite;
import net.sourceforge.plantuml.statediagram.command.CommandHideEmptyDescription; import net.sourceforge.plantuml.statediagram.command.CommandHideEmptyDescription;
import net.sourceforge.plantuml.style.CommandStyleImport; import net.sourceforge.plantuml.style.CommandStyleImport;
import net.sourceforge.plantuml.style.CommandStyleMultilinesCSS; import net.sourceforge.plantuml.style.CommandStyleMultilinesCSS;

View File

@ -75,6 +75,7 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
private final List<HideOrShow2> removed = new ArrayList<HideOrShow2>(); private final List<HideOrShow2> removed = new ArrayList<HideOrShow2>();
protected final EntityFactory entityFactory = new EntityFactory(hides2, removed); protected final EntityFactory entityFactory = new EntityFactory(hides2, removed);
private IGroup currentGroup = entityFactory.getRootGroup(); private IGroup currentGroup = entityFactory.getRootGroup();
private List<IGroup> stacks = new ArrayList<IGroup>();
private boolean visibilityModifierPresent; 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, final protected void gotoGroupInternalWithNamespace(final Code code, Display display, final Code namespace2,
GroupType type, IGroup parent) { GroupType type, IGroup parent) {
this.stacks.add(currentGroup);
if (getNamespaceSeparator() == null) { if (getNamespaceSeparator() == null) {
gotoGroupInternal(code, display, namespace2, type, parent); gotoGroupInternal(code, display, namespace2, type, parent);
return; 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, final protected void gotoGroupInternal(final Code code, Display display, final Code namespace2, GroupType type,
IGroup parent) { IGroup parent) {
IGroup result = entityFactory.getGroupsget(code); IGroup result = entityFactory.getGroupsget(code);
@ -277,14 +292,6 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
return p; return p;
} }
public void endGroup() {
if (EntityUtils.groupRoot(currentGroup)) {
Log.error("No parent group");
return;
}
currentGroup = currentGroup.getParentContainer();
}
public final boolean isGroup(Code code) { public final boolean isGroup(Code code) {
return leafExist(code) == false && entityFactory.getGroupsget(code) != null; return leafExist(code) == false && entityFactory.getGroupsget(code) != null;
} }

View File

@ -54,6 +54,7 @@ import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.UrlBuilder; import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlBuilder.ModeUrl; import net.sourceforge.plantuml.UrlBuilder.ModeUrl;
import net.sourceforge.plantuml.command.regex.Matcher2; 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.command.regex.Pattern2;
import net.sourceforge.plantuml.creole.CreoleMode; import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.creole.CreoleParser; 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.style.Style;
import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.wbs.WBSDiagram;
public class Display implements Iterable<CharSequence> { public class Display implements Iterable<CharSequence> {
@ -270,6 +272,26 @@ public class Display implements Iterable<CharSequence> {
return new Display(result, this.naturalHorizontalAlignment, this.isNull, this.defaultCreoleMode); 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<CharSequence> result = new ArrayList<CharSequence>(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() { public Display underlined() {
final List<CharSequence> result = new ArrayList<CharSequence>(); final List<CharSequence> result = new ArrayList<CharSequence>();
for (CharSequence line : displayData) { for (CharSequence line : displayData) {

View File

@ -71,23 +71,23 @@ public class PSystemDonors extends AbstractPSystem {
private static final int COLS = 6; private static final int COLS = 6;
private static final int FREE_LINES = 6; private static final int FREE_LINES = 6;
public static final String DONORS = "6uq902mFw6aNBnoRoJQNUtErFonYo206_-9C-IFeunriW0n1BL5IhOvS7xq622gWQ-ZeCRVlzBZVI7yH" public static final String DONORS = "6wO902mFU3XMJYceJdotTlPGzS6YgH3yYpFbZw2FTx01CWIrH4crEd9zz1eWg82keQF7tBxJutuZ_KLq"
+ "NUdUDys8jcnDSPvH50k27c-JQuPjxkqnSsBnGt1dZe133yW3iacsZHfPkfVj92sddof3IY7pywS6s9OA" + "fNlVD2FQiZN5UKPHB0Xwl4sk6RQvjmV2d2KlWZjJWfuF5n0bqTtfBCiTANQVa85C9s9S14-RrrZgP2tv"
+ "ihYRQXukK7S6TknnUzX_ePwbHp_sKxhZEw0nZHBhiAEQb5SFVAsgP8B2sM_7DwrYLapW42cEjd043jcO" + "1mcd-zyr5RAlgiAGBgiwVxf2SL807Z2x_5ETowPoBbUrwKqeGAVkNC5DLOUvTgAlJWmIOEBrR-TRrMHM"
+ "YNnrMiUu85NxZte3BJPcM2foJoYssYMf-UVP-hQ1xXCOJ2AmYG4RC7Eew32UO2vGRyGGM4MYYUpiZCQ6" + "JF0GASwsS0HEepD3CnUjCx8Xi_OVzGzeip73Kf5RGd7KBedEFo-TsJRGVOu44nAxADWmvb3AOLgWUyYD"
+ "QsvveeC95zInXd-KHKsFLEOSZau4Dg-40Ww_XXE0hIYlmcVxDWCAHNgBkYN9EZMUX9N6XoKfhXyqt006" + "cCGcWeRwB4PZipLRdkXXS4CB-_AFHbBZaShCuMYJsDq31KxVnW58hzJK96RxDmFAH4QB6KjITM7SX3ld"
+ "R2ne7QY2a3T19_nfCVjJatjT3GLUzEpClTaPo4Ms0y3nPaRVPDsPAF_t3yuqiMsfbaXrBlrvhlTn3iZT" + "OJ4LwGSDDuB2pe9Ma1g2l0bTyEan-rEJMrqD1Lxo3CczsIxKATi6jCsClirrIAByxpRDjF4UKowHwcpz"
+ "Kgj6_37QM6LBtDQJ5nLQUN81_4FGIxsZOdxETMCX6UAvT7iYpdFgojSe0cR5OMJXJx4bDUxIBazZVLcU" + "UQxtSGx8tL8hp_XZj3784TpxoOiALfvQ03y2lLGBbUJdf-mR2oaGzzRjYJmwLwxSHn4Ocp9CBFOgjbYB"
+ "eIp1Z_RhL2EPq89N8bu6_QfMA0zqlb2oBArSFlHeMBqCV4t8JBmjkcV7NCh_lrAymupI5RJVnPogQo1A" + "_5YNjx4LMLOO2_helYuq8GCjTELoD_HjMfaqTBvGafPMBXzwT5gz369DnaplFFqP7NCv_xzIlCDCYXle"
+ "dh5pLUjigWXC8texv2QGAr3jhbknU_-G_vmFIBqbaO78RCvnlrIig3LT334RrdIwn0nWyfHe9mAxaqGY" + "IedPfci4HUGSMaqN6nE1QQ77Gsu2iWBbxheLk_SF-NK-8FEMPGGYjpcZVL_nGjrr4M8wrdGrnGnW_fJI"
+ "faReNR2oZ4mhnQw7g-VqYJ5nxVJ2uxwfCOWFTBBo9EpfHR1cXY79chaDxGUSWt06NvnNN_VXFLO1hBjv" + "5ed3WWW5xOBUHfL-fAqKknwkdkaJO-w-w9F7NJDZ40SwHMCHldeHtDqme-hDaGtjUymXU8Wlowkl-_0T"
+ "Zxr9pHzd85tfXP4aRKQKszRzgR1c1QLdKPPyM96_U_4p5mzT2bvdikW8Cwysno5ZeNZPf9N-PFJ3aY5l" + "gm3MuTuR_aZDds0Wd-c54P568nhRrlsfSBU24bdK9HShybt5prmyT2TudScYGyoysXo7B0oL1qbQwfyC"
+ "dygo_aeLUGFkbug5G9XdV0nuF3XPKCKb15RJMGuJ6u1mweDNx3SlSJEekgNav18snAp3LkU1IkU7UGT6" + "FomPVFjCDkolIf4tu7bfc8PmP7mCBXzDUjJa4edDT9PZPYS0bofUiTzymdMXwfQQaoriYCd3Lnz29lWn"
+ "bN7WcOCTtRt4pz0IHSx7vxso-cbbhIfsBA1uLWYMKaVPQweeqkTKCcICGSzXQ-3jDmjT42xrsXkc1Gfl" + "le2bCXMU1jQwUr6SGOmIvyIyLrOjAsjLyR60YbaXw4iBfMggADBdD3BYh47FGUjW-yt25kYbNdl3c51u"
+ "W-Y-V0EjKyYq4kC7JPybqeLyHRxaiJ02_iwltsGlEDP1nhyPtOV7cUUA8AKgEi0vSRRKQbjQ1-ij-lpv" + "6wAx6XkmJH7JLKp_Q0AUY2gA9NefayG0lkR3hzL3Onry_6Pq7n47oEwI4485QewUE2tDjsDO1-ij-l_p"
+ "ifoy1t_-xpLjvrI8vtoM0Bg0WlQlfS2SQDRLF7liJwEF3kmsiW9Y7PpqbLUcNWWm40oQPQcNrcb6uSuO" + "PJbv3_xytslQmQaLztnM0NI2aF_hA1W7JLtjCmflNJwSE1om0gasJcBbfQMdGG91v9QTFdMTPgHtOaIv"
+ "Ncwg1dt6yQ52No4L9uZZ3SikbYcA6bFEykLanQYys9VU22SvU5x_55M6KbnbkPeOeLNi_2ZEqtWVjHjk" + "BLdqZkD3PRvI8Gv8OyFoYtwAeiQKaxwSh3YL3_lE6-4aXyZhdwBAcXHNfP6Q6C4cTdOKvsdiLhlXheih"
+ "TUa24j0T5mJAVlExtIntZJvVW7qO7b3avoDvwB25QK4Lfx4yDJ15OtrlnjjJPwP-4m00"; + "yA0UN12e-_NZqyqiTuqrNq1g61uqvESZSkZGmxMWfgQ5iIom8iRwtYVzKAR7RyQcW5qbW3dJ0000";
/* /*
* Special thanks to our sponsors and donors: * Special thanks to our sponsors and donors:

View File

@ -116,7 +116,7 @@ public class SkinParameter {
public static final SkinParameter CONTROL = new SkinParameter("CONTROL", ColorParam.controlBackground, public static final SkinParameter CONTROL = new SkinParameter("CONTROL", ColorParam.controlBackground,
ColorParam.controlBorder, FontParam.CONTROL, FontParam.CONTROL_STEREOTYPE); 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); ColorParam.entityBorder, FontParam.ENTITY, FontParam.ENTITY_STEREOTYPE);
public static final SkinParameter INTERFACE = new SkinParameter("INTERFACE", ColorParam.interfaceBackground, public static final SkinParameter INTERFACE = new SkinParameter("INTERFACE", ColorParam.interfaceBackground,

View File

@ -73,7 +73,7 @@ public abstract class USymbol {
public final static USymbol COMPONENT1 = record("COMPONENT1", SkinParameter.COMPONENT1, new USymbolComponent1()); 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 COMPONENT2 = record("COMPONENT2", SkinParameter.COMPONENT2, new USymbolComponent2());
public final static USymbol BOUNDARY = record("BOUNDARY", SkinParameter.BOUNDARY, new USymbolBoundary()); 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)); new USymbolEntityDomain(2));
public final static USymbol CONTROL = record("CONTROL", SkinParameter.CONTROL, new USymbolControl(2)); public final static USymbol CONTROL = record("CONTROL", SkinParameter.CONTROL, new USymbolControl(2));
public final static USymbol INTERFACE = record("INTERFACE", SkinParameter.INTERFACE, new USymbolInterface()); public final static USymbol INTERFACE = record("INTERFACE", SkinParameter.INTERFACE, new USymbolInterface());

View File

@ -48,7 +48,7 @@ class USymbolEntityDomain extends USymbolSimpleAbstract {
@Override @Override
public SkinParameter getSkinParameter() { public SkinParameter getSkinParameter() {
return SkinParameter.ENTITY_DOMAIN; return SkinParameter.ENTITY;
} }

View File

@ -45,7 +45,7 @@ import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.SkinParam; 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.activitydiagram3.ftile.vertical.FtileBox;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration; 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.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.UDrawable;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.SName;
@ -85,19 +86,23 @@ public class FingerImpl implements Finger, UDrawable {
private Tetris tetris = null; private Tetris tetris = null;
private StyleSignature getDefaultStyleDefinitionNode() { private StyleSignature getDefaultStyleDefinitionNode() {
final String depth = SName.depth(level);
if (level == 0) { if (level == 0) {
return StyleSignature.of(SName.root, SName.element, SName.mindmapDiagram, SName.node, SName.rootNode).add( return StyleSignature.of(SName.root, SName.element, SName.mindmapDiagram, SName.node, SName.rootNode)
stereotype); .add(stereotype).add(depth);
} }
if (nail.size() == 0) { if (nail.size() == 0) {
return StyleSignature.of(SName.root, SName.element, SName.mindmapDiagram, SName.node, SName.leafNode).add( return StyleSignature.of(SName.root, SName.element, SName.mindmapDiagram, SName.node, SName.leafNode)
stereotype); .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() { 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) { 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); font = skinParam.getFont(null, false, FontParam.ACTIVITY);
} }
if (shape == IdeaShape.BOX) { 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()); final FtileBox box = FtileBox.createMindMap(styleBuilder, foo, label, getDefaultStyleDefinitionNode());
return TextBlockUtils.withMargin(box, 0, 0, margin(), margin()); return TextBlockUtils.withMargin(box, 0, 0, margin(), margin());
} }

View File

@ -46,10 +46,6 @@ import net.sourceforge.plantuml.style.StyleBuilder;
class Idea { class Idea {
// public StyleDefinition getDefaultStyleDefinition() {
// return StyleDefinition.of(SName.root, SName.element, SName.mindmapDiagram, SName.node);
// }
private final Display label; private final Display label;
private final int level; private final int level;
private final Idea parent; private final Idea parent;
@ -59,8 +55,8 @@ class Idea {
private final StyleBuilder styleBuilder; private final StyleBuilder styleBuilder;
private final String stereotype; private final String stereotype;
public Idea(StyleBuilder styleBuilder, Display label, IdeaShape shape, String stereotype) { public Idea(StyleBuilder styleBuilder, HtmlColor backColor, Display label, IdeaShape shape, String stereotype) {
this(styleBuilder, null, 0, null, label, shape, stereotype); this(styleBuilder, backColor, 0, null, label, shape, stereotype);
} }
public Idea createIdea(StyleBuilder styleBuilder, HtmlColor backColor, int newLevel, Display newDisplay, public Idea createIdea(StyleBuilder styleBuilder, HtmlColor backColor, int newLevel, Display newDisplay,
@ -70,14 +66,6 @@ class Idea {
return result; 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, private Idea(StyleBuilder styleBuilder, HtmlColor backColor, int level, Idea parent, Display label,
IdeaShape shape, String stereotype) { IdeaShape shape, String stereotype) {
this.backColor = backColor; this.backColor = backColor;

View File

@ -181,19 +181,17 @@ public class MindMapDiagram extends UmlDiagram {
public CommandExecutionResult addIdea(HtmlColor backColor, int level, Display label, IdeaShape shape, public CommandExecutionResult addIdea(HtmlColor backColor, int level, Display label, IdeaShape shape,
Direction direction) { Direction direction) {
final Matcher2 m = WBSDiagram.patternStereotype.matcher(label.get(0)); String stereotype = label.getEndingStereotype();
String stereotype = null; if (stereotype != null) {
if (m.matches()) { label = label.removeEndingStereotype();
label = Display.getWithNewlines(m.group(1));
stereotype = m.group(2);
} }
if (level == 0) { if (level == 0) {
if (this.right.root != null) { if (this.right.root != null) {
return CommandExecutionResult 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 :-)"); .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); right.initRoot(getSkinParam().getCurrentStyleBuilder(), backColor, label, shape, stereotype);
left.initRoot(getSkinParam().getCurrentStyleBuilder(), label, shape, stereotype); left.initRoot(getSkinParam().getCurrentStyleBuilder(), backColor, label, shape, stereotype);
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
} }
if (direction == Direction.LEFT) { if (direction == Direction.LEFT) {
@ -207,8 +205,8 @@ public class MindMapDiagram extends UmlDiagram {
private Idea last; private Idea last;
private Finger finger; private Finger finger;
private void initRoot(StyleBuilder styleBuilder, Display label, IdeaShape shape, String stereotype) { private void initRoot(StyleBuilder styleBuilder, HtmlColor backColor, Display label, IdeaShape shape, String stereotype) {
root = new Idea(styleBuilder, label, shape, stereotype); root = new Idea(styleBuilder, backColor, label, shape, stereotype);
last = root; last = root;
} }

View File

@ -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<Complement> getComplement(GanttDiagram system, RegexResult arg, String suffix) {
final String s = arg.get("COMPLEMENT" + suffix, 0);
return Failable.<Complement> ok(DayOfWeek.fromString(s));
}
}

View File

@ -45,19 +45,14 @@ public class ComplementSeveralDays implements ComplementPattern {
public IRegex toRegex(String suffix) { public IRegex toRegex(String suffix) {
return new RegexConcat( // return new RegexConcat( //
new RegexLeaf("COMPLEMENT" + suffix, "(\\d+)[%s]+(days?|weeks?)")); // new RegexLeaf("COMPLEMENT" + suffix, "(\\d+)[%s]+(days?|weeks?)")); //
// new RegexLeaf("LOAD" + suffix, "([%s]+at[%s]+(\\d+)%)?"));
} }
public Failable<Complement> getComplement(GanttDiagram system, RegexResult arg, String suffix) { public Failable<Complement> getComplement(GanttDiagram system, RegexResult arg, String suffix) {
final String number = arg.get("COMPLEMENT" + suffix, 0); final String number = arg.get("COMPLEMENT" + suffix, 0);
final boolean inWeeks = arg.get("COMPLEMENT" + suffix, 1).startsWith("w"); final boolean inWeeks = arg.get("COMPLEMENT" + suffix, 1).startsWith("w");
final int factor = inWeeks ? system.daysInWeek() : 1; final int factor = inWeeks ? system.daysInWeek() : 1;
// final String load = arg.get("LOAD" + suffix, 1);
final int days = Integer.parseInt(number) * factor; final int days = Integer.parseInt(number) * factor;
// if (load == null) {
return Failable.<Complement> ok(LoadInDays.inDay(days)); return Failable.<Complement> ok(LoadInDays.inDay(days));
// }
// return Failable.<Complement> ok(LoadInDays.inDayWithLoad(days, Integer.parseInt(load)));
} }
} }

View File

@ -37,7 +37,7 @@ package net.sourceforge.plantuml.project3;
import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.StringUtils;
public enum DayOfWeek implements Subject { public enum DayOfWeek implements Subject, Complement {
MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY; MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY;

View File

@ -586,7 +586,7 @@ public class GanttDiagram extends TitledDiagram implements Subject {
public Resource getResource(String resourceName) { public Resource getResource(String resourceName) {
Resource resource = resources.get(resourceName); Resource resource = resources.get(resourceName);
if (resource == null) { if (resource == null) {
resource = new Resource(resourceName, getDefaultPlan()); resource = new Resource(resourceName, getDefaultPlan(), getCalendarSimple());
} }
resources.put(resourceName, resource); resources.put(resourceName, resource);
return resource; return resource;

View File

@ -38,7 +38,6 @@ package net.sourceforge.plantuml.project3;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
import java.util.List; import java.util.List;
import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.Command;

View File

@ -49,11 +49,6 @@ public class LoadInDays implements Load {
return new LoadInDays(days, 100); 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() { public int getFullLoad() {
return days * loadPerDay; return days * loadPerDay;
} }

View File

@ -35,19 +35,25 @@
*/ */
package net.sourceforge.plantuml.project3; package net.sourceforge.plantuml.project3;
import java.util.Collection;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.Set; import java.util.Set;
import java.util.TreeSet; import java.util.TreeSet;
public class Resource implements Subject /* , LoadPlanable */{ public class Resource implements Subject {
private final String name; private final String name;
private ResourceDraw draw; private ResourceDraw draw;
// private final LoadPlanable loadPlanable; private final Set<Instant> closed = new TreeSet<Instant>();
private Set<Instant> closed = new TreeSet<Instant>(); private final Set<Instant> forcedOn = new TreeSet<Instant>();
private final GCalendar calendar;
public Resource(String name, LoadPlanable loadPlanable) { private final Collection<DayOfWeek> closedDayOfWeek = EnumSet.noneOf(DayOfWeek.class);
public Resource(String name, LoadPlanable loadPlanable, GCalendar calendar) {
this.name = name; this.name = name;
// this.loadPlanable = loadPlanable; this.calendar = calendar;
} }
@Override @Override
@ -79,17 +85,27 @@ public class Resource implements Subject /* , LoadPlanable */{
} }
public boolean isClosedAt(Instant instant) { 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) { public void addCloseDay(Instant instant) {
this.closed.add(instant); this.closed.add(instant);
} }
public void addForceOnDay(Instant instant) {
this.forcedOn.add(instant);
}
public void addCloseDay(DayOfWeek dayOfWeek) {
closedDayOfWeek.add(dayOfWeek);
}
} }

View File

@ -46,7 +46,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
public class SubjectResource implements SubjectPattern { public class SubjectResource implements SubjectPattern {
public Collection<VerbPattern> getVerbs() { public Collection<VerbPattern> getVerbs() {
return Arrays.<VerbPattern> asList(new VerbIsOff()); return Arrays.<VerbPattern> asList(new VerbIsOff(), new VerbIsOn());
} }
public IRegex toRegex() { public IRegex toRegex() {

View File

@ -42,12 +42,14 @@ import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
public class VerbIsOff implements VerbPattern { public class VerbIsOff implements VerbPattern {
public Collection<ComplementPattern> getComplements() { public Collection<ComplementPattern> getComplements() {
return Arrays.<ComplementPattern> asList(new ComplementDate(), new ComplementDates()); return Arrays
.<ComplementPattern> asList(new ComplementDate(), new ComplementDates(), new ComplementDayOfWeek());
} }
public IRegex toRegex() { public IRegex toRegex() {
@ -55,14 +57,21 @@ public class VerbIsOff implements VerbPattern {
RegexLeaf.spaceOneOrMore(), // RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("off"), // new RegexLeaf("off"), //
RegexLeaf.spaceOneOrMore(), // 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) { public Verb getVerb(final GanttDiagram project, RegexResult arg) {
return new Verb() { return new Verb() {
public CommandExecutionResult execute(Subject subject, Complement complement) { public CommandExecutionResult execute(Subject subject, Complement complement) {
final Resource resource = (Resource) subject; 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) { for (DayAsDate when : (DaysAsDates) complement) {
resource.addCloseDay(project.convert(when)); resource.addCloseDay(project.convert(when));
} }
@ -75,5 +84,4 @@ public class VerbIsOff implements VerbPattern {
}; };
} }
} }

View File

@ -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<ComplementPattern> getComplements() {
return Arrays.<ComplementPattern> 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();
}
};
}
}

View File

@ -40,8 +40,12 @@ import java.util.Collection;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.regex.IRegex; 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.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.command.regex.RegexResult;
import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement;
public class VerbProjectStarts implements VerbPattern { public class VerbProjectStarts implements VerbPattern {
@ -49,10 +53,23 @@ public class VerbProjectStarts implements VerbPattern {
return Arrays.<ComplementPattern> asList(new ComplementDate()); return Arrays.<ComplementPattern> asList(new ComplementDate());
} }
public IRegex toRegex() { public IRegex toRegexOld() {
return new RegexLeaf("starts[%s]*(the[%s]*|on[%s]*)*"); 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) { public Verb getVerb(final GanttDiagram project, RegexResult arg) {
return new Verb() { return new Verb() {
public CommandExecutionResult execute(Subject subject, Complement complement) { public CommandExecutionResult execute(Subject subject, Complement complement) {

View File

@ -370,6 +370,16 @@ public class Rose {
skinParameter = SkinParameter.PARTICIPANT; skinParameter = SkinParameter.PARTICIPANT;
} else if (color == ColorParam.actorBorder) { } else if (color == ColorParam.actorBorder) {
skinParameter = SkinParameter.ACTOR; 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); final boolean result = skinParameter == null ? param.shadowing(null) : param.shadowing2(null, skinParameter);
return result ? 4.0 : 0; return result ? 4.0 : 0;
@ -403,9 +413,10 @@ public class Rose {
.withDeltaShadow(deltaShadow(skin, color)); .withDeltaShadow(deltaShadow(skin, color));
} }
if (color == ColorParam.entityBorder) { if (color == ColorParam.entityBorder) {
final double tmp = deltaShadow(skin, color);
return new SymbolContext(getHtmlColor(skin, ColorParam.entityBackground), getHtmlColor(skin, return new SymbolContext(getHtmlColor(skin, ColorParam.entityBackground), getHtmlColor(skin,
ColorParam.entityBorder)).withStroke(getStroke(skin, LineParam.sequenceActorBorder, 2)) ColorParam.entityBorder)).withStroke(getStroke(skin, LineParam.sequenceActorBorder, 2))
.withDeltaShadow(deltaShadow(skin, color)); .withDeltaShadow(tmp);
} }
if (color == ColorParam.databaseBorder) { if (color == ColorParam.databaseBorder) {
return new SymbolContext(getHtmlColor(skin, ColorParam.databaseBackground), getHtmlColor(skin, return new SymbolContext(getHtmlColor(skin, ColorParam.databaseBackground), getHtmlColor(skin,

View File

@ -88,7 +88,7 @@ public class GraphicsSudoku {
public ImageData writeImageSvg(OutputStream os) throws IOException { public ImageData writeImageSvg(OutputStream os) throws IOException {
final UGraphicSvg ug = new UGraphicSvg(true, new Dimension2DDouble(0, 0), new ColorMapperIdentity(), 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); drawInternal(ug);
ug.createXml(os, null); ug.createXml(os, null);
return ImageDataSimple.ok(); return ImageDataSimple.ok();

View File

@ -50,7 +50,8 @@ public class ExtremityFactoryCrowfoot extends AbstractExtremityFactory implement
@Override @Override
public UDrawable createUDrawable(Point2D p0, double angle, Side side) { public UDrawable createUDrawable(Point2D p0, double angle, Side side) {
throw new UnsupportedOperationException(getClass().toString()); angle -= Math.PI / 2;
return new ExtremityCrowfoot(p0, angle, side);
} }
} }

View File

@ -109,6 +109,8 @@ public class SvgGraphics {
private int maxX = 10; private int maxX = 10;
private int maxY = 10; private int maxY = 10;
private final String preserveAspectRatio;
private final double scale; private final double scale;
private final String filterUid; private final String filterUid;
private final String shadowId; private final String shadowId;
@ -124,17 +126,19 @@ public class SvgGraphics {
} }
} }
public SvgGraphics(boolean svgDimensionStyle, Dimension2D minDim, double scale, String hover, long seed) { public SvgGraphics(boolean svgDimensionStyle, Dimension2D minDim, double scale, String hover, long seed,
this(svgDimensionStyle, minDim, null, scale, hover, seed); String preserveAspectRatio) {
this(svgDimensionStyle, minDim, null, scale, hover, seed, preserveAspectRatio);
} }
public SvgGraphics(boolean svgDimensionStyle, Dimension2D minDim, String backcolor, double scale, String hover, public SvgGraphics(boolean svgDimensionStyle, Dimension2D minDim, String backcolor, double scale, String hover,
long seed) { long seed, String preserveAspectRatio) {
try { try {
this.svgDimensionStyle = svgDimensionStyle; this.svgDimensionStyle = svgDimensionStyle;
this.scale = scale; this.scale = scale;
this.document = getDocument(); this.document = getDocument();
this.backcolor = backcolor; this.backcolor = backcolor;
this.preserveAspectRatio = preserveAspectRatio;
ensureVisible(minDim.getWidth(), minDim.getHeight()); ensureVisible(minDim.getWidth(), minDim.getHeight());
this.root = getRootNode(); this.root = getRootNode();
@ -594,7 +598,7 @@ public class SvgGraphics {
} }
root.setAttribute("viewBox", "0 0 " + maxXscaled + " " + maxYscaled); root.setAttribute("viewBox", "0 0 " + maxXscaled + " " + maxYscaled);
root.setAttribute("zoomAndPan", "magnify"); root.setAttribute("zoomAndPan", "magnify");
root.setAttribute("preserveAspectRatio", "none"); root.setAttribute("preserveAspectRatio", preserveAspectRatio);
root.setAttribute("contentScriptType", "application/ecmascript"); root.setAttribute("contentScriptType", "application/ecmascript");
root.setAttribute("contentStyleType", "text/css"); root.setAttribute("contentStyleType", "text/css");

View File

@ -82,6 +82,7 @@ public class LanguageDescriptor {
type.add("queue"); type.add("queue");
type.add("archimate"); type.add("archimate");
type.add("diamond"); type.add("diamond");
type.add("detach");
keyword.add("@startuml"); keyword.add("@startuml");
keyword.add("@enduml"); keyword.add("@enduml");

View File

@ -75,6 +75,7 @@ import net.sourceforge.plantuml.tim.stdlib.FileExists;
import net.sourceforge.plantuml.tim.stdlib.Filename; import net.sourceforge.plantuml.tim.stdlib.Filename;
import net.sourceforge.plantuml.tim.stdlib.FunctionExists; import net.sourceforge.plantuml.tim.stdlib.FunctionExists;
import net.sourceforge.plantuml.tim.stdlib.GetVariableValue; 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.Getenv;
import net.sourceforge.plantuml.tim.stdlib.IntVal; import net.sourceforge.plantuml.tim.stdlib.IntVal;
import net.sourceforge.plantuml.tim.stdlib.InvokeVoidFunction; import net.sourceforge.plantuml.tim.stdlib.InvokeVoidFunction;
@ -125,6 +126,7 @@ public class TContext {
addFunction(new SetVariableValue()); addFunction(new SetVariableValue());
addFunction(new GetVariableValue()); addFunction(new GetVariableValue());
addFunction(new IntVal()); addFunction(new IntVal());
addFunction(new GetVersion());
// !exit // !exit
// !log // !log
// %min // %min

View File

@ -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<TValue> args) throws EaterException {
return TValue.fromString(Version.versionString());
}
}

View File

@ -157,7 +157,7 @@ public class FontChecker {
} }
private String getSvgImage(char c) throws IOException, TransformerException { 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.setStrokeColor("black");
svg.svgImage(getBufferedImage(c), 0, 0); svg.svgImage(getBufferedImage(c), 0, 0);
final ByteArrayOutputStream os = new ByteArrayOutputStream(); final ByteArrayOutputStream os = new ByteArrayOutputStream();

View File

@ -393,7 +393,7 @@ public class ImageBuilder {
return createUGraphicPNG(colorMapper, dpiFactor, dim, mybackcolor, animationArg, dx, dy); return createUGraphicPNG(colorMapper, dpiFactor, dim, mybackcolor, animationArg, dx, dy);
case SVG: case SVG:
return createUGraphicSVG(colorMapper, dpiFactor, dim, mybackcolor, fileFormatOption.getSvgLinkTarget(), return createUGraphicSVG(colorMapper, dpiFactor, dim, mybackcolor, fileFormatOption.getSvgLinkTarget(),
fileFormatOption.getHoverColor(), seed); fileFormatOption.getHoverColor(), seed, fileFormatOption.getPreserveAspectRatio());
case EPS: case EPS:
return new UGraphicEps(colorMapper, EpsStrategy.getDefault2()); return new UGraphicEps(colorMapper, EpsStrategy.getDefault2());
case EPS_TEXT: case EPS_TEXT:
@ -417,7 +417,7 @@ public class ImageBuilder {
} }
private UGraphic2 createUGraphicSVG(ColorMapper colorMapper, double scale, Dimension2D dim, HtmlColor mybackcolor, 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; Color backColor = Color.WHITE;
if (mybackcolor instanceof HtmlColorSimple) { if (mybackcolor instanceof HtmlColorSimple) {
backColor = colorMapper.getMappedColor(mybackcolor); backColor = colorMapper.getMappedColor(mybackcolor);
@ -425,12 +425,12 @@ public class ImageBuilder {
final UGraphicSvg ug; final UGraphicSvg ug;
if (mybackcolor instanceof HtmlColorGradient) { if (mybackcolor instanceof HtmlColorGradient) {
ug = new UGraphicSvg(svgDimensionStyle, dim, colorMapper, (HtmlColorGradient) mybackcolor, false, scale, 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)) { } 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 { } else {
ug = new UGraphicSvg(svgDimensionStyle, dim, colorMapper, StringUtils.getAsHtml(backColor), false, scale, ug = new UGraphicSvg(svgDimensionStyle, dim, colorMapper, StringUtils.getAsHtml(backColor), false, scale,
svgLinkTarget, hover, seed); svgLinkTarget, hover, seed, preserveAspectRatio);
} }
return ug; return ug;

View File

@ -65,7 +65,7 @@ public abstract class UGraphicUtils {
final Dimension2D size = computeSize(colorMapper, background, image); final Dimension2D size = computeSize(colorMapper, background, image);
final UGraphicSvg svg = new UGraphicSvg(true, size, colorMapper, StringUtils.getAsHtml(colorMapper final UGraphicSvg svg = new UGraphicSvg(true, size, colorMapper, StringUtils.getAsHtml(colorMapper
.getMappedColor(background)), false, 1.0, fileFormatOption.getSvgLinkTarget(), .getMappedColor(background)), false, 1.0, fileFormatOption.getSvgLinkTarget(),
fileFormatOption.getHoverColor(), seed); fileFormatOption.getHoverColor(), seed, fileFormatOption.getPreserveAspectRatio());
image.drawU(svg); image.drawU(svg);
svg.createXml(os, fileFormatOption.isWithMetadata() ? metadata : null); svg.createXml(os, fileFormatOption.isWithMetadata() ? metadata : null);
} else if (fileFormat == FileFormat.EPS) { } else if (fileFormat == FileFormat.EPS) {

View File

@ -88,20 +88,21 @@ public class UGraphicSvg extends AbstractUGraphic<SvgGraphics> implements ClipCo
} }
public UGraphicSvg(boolean svgDimensionStyle, Dimension2D minDim, ColorMapper colorMapper, String backcolor, public UGraphicSvg(boolean svgDimensionStyle, Dimension2D minDim, ColorMapper colorMapper, String backcolor,
boolean textAsPath, double scale, String linkTarget, String hover, long seed) { boolean textAsPath, double scale, String linkTarget, String hover, long seed, String preserveAspectRatio) {
this(minDim, colorMapper, new SvgGraphics(svgDimensionStyle, minDim, backcolor, scale, hover, seed), this(minDim, colorMapper, new SvgGraphics(svgDimensionStyle, minDim, backcolor, scale, hover, seed,
textAsPath, linkTarget); preserveAspectRatio), textAsPath, linkTarget);
} }
public UGraphicSvg(boolean svgDimensionStyle, Dimension2D minDim, ColorMapper colorMapper, boolean textAsPath, public UGraphicSvg(boolean svgDimensionStyle, Dimension2D minDim, ColorMapper colorMapper, boolean textAsPath,
double scale, String linkTarget, String hover, long seed) { double scale, String linkTarget, String hover, long seed, String preserveAspectRatio) {
this(minDim, colorMapper, new SvgGraphics(svgDimensionStyle, minDim, scale, hover, seed), textAsPath, this(minDim, colorMapper, new SvgGraphics(svgDimensionStyle, minDim, scale, hover, seed, preserveAspectRatio),
linkTarget); textAsPath, linkTarget);
} }
public UGraphicSvg(boolean svgDimensionStyle, Dimension2D minDim, ColorMapper mapper, HtmlColorGradient gr, public UGraphicSvg(boolean svgDimensionStyle, Dimension2D minDim, ColorMapper mapper, HtmlColorGradient gr,
boolean textAsPath, double scale, String linkTarget, String hover, long seed) { boolean textAsPath, double scale, String linkTarget, String hover, long seed, String preserveAspectRatio) {
this(minDim, mapper, new SvgGraphics(svgDimensionStyle, minDim, scale, hover, seed), textAsPath, linkTarget); this(minDim, mapper, new SvgGraphics(svgDimensionStyle, minDim, scale, hover, seed, preserveAspectRatio),
textAsPath, linkTarget);
final SvgGraphics svg = getGraphicObject(); final SvgGraphics svg = getGraphicObject();
svg.paintBackcolorGradient(mapper, gr); svg.paintBackcolorGradient(mapper, gr);

View File

@ -46,7 +46,10 @@ public class CharHidder {
final StringBuilder result = new StringBuilder(); final StringBuilder result = new StringBuilder();
for (int i = 0; i < s.length(); i++) { for (int i = 0; i < s.length(); i++) {
final char c = s.charAt(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++; i++;
final char c2 = s.charAt(i); final char c2 = s.charAt(i);
if (isToBeHidden(c2)) { if (isToBeHidden(c2)) {

View File

@ -43,7 +43,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 1201911; return 1201912;
} }
public static int versionPatched() { public static int versionPatched() {
@ -93,7 +93,7 @@ public class Version {
} }
public static long compileTime() { public static long compileTime() {
return 1569146535007L; return 1572776694309L;
} }
public static String compileTimeString() { public static String compileTimeString() {

View File

@ -8,3 +8,4 @@ material
office office
c4 c4
osa osa
kubernetes

BIN
stdlib/kubernetes-abx.repx Normal file

Binary file not shown.

BIN
stdlib/kubernetes-dex.repx Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.