Skip to content

Commit

Permalink
version 1.2019.12
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudroques committed Nov 3, 2019
1 parent 82b570d commit 36c461d
Show file tree
Hide file tree
Showing 55 changed files with 557 additions and 142 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

<groupId>net.sourceforge.plantuml</groupId>
<artifactId>plantuml</artifactId>
<version>1.2019.12-SNAPSHOT</version>
<version>1.2019.13-SNAPSHOT</version>
<packaging>jar</packaging>

<name>PlantUML</name>
Expand Down
11 changes: 6 additions & 5 deletions src/gen/lib/label/index__c.java
Original file line number Diff line number Diff line change
Expand Up @@ -379,11 +379,12 @@ public static int RTreeInsert2(ST_RTree rtp, ST_Rect_t r, __ptr__ data, ST_Node_
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 */
Expand Down
27 changes: 19 additions & 8 deletions src/net/sourceforge/plantuml/FileFormatOption.java
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -78,13 +79,17 @@ public final boolean isWithMetadata() {
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;
Expand All @@ -94,34 +99,40 @@ private FileFormatOption(FileFormat fileFormat, AffineTransform at, boolean with
this.debugsvek = debugsvek;
this.tikzFontDistortion = tikzFontDistortion;
this.scale = scale;
this.preserveAspectRatio = preserveAspectRatio;
if (tikzFontDistortion == null) {
throw new IllegalArgumentException();
}
}

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
Expand Down
2 changes: 2 additions & 0 deletions src/net/sourceforge/plantuml/ISkinParam.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ public HorizontalAlignment getHorizontalAlignment(AlignmentParam param, ArrowDir

public String getSvgLinkTarget();

public String getPreserveAspectRatio();

public int getTabSize();

public int maxAsciiMessageLength();
Expand Down
9 changes: 9 additions & 0 deletions src/net/sourceforge/plantuml/SkinParam.java
Original file line number Diff line number Diff line change
Expand Up @@ -1046,6 +1046,15 @@ public String getSvgLinkTarget() {
}
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");
Expand Down
5 changes: 5 additions & 0 deletions src/net/sourceforge/plantuml/SkinParamDelegator.java
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,10 @@ public boolean handwritten() {
public String getSvgLinkTarget() {
return skinParam.getSvgLinkTarget();
}

public String getPreserveAspectRatio() {
return skinParam.getPreserveAspectRatio();
}

public String getMonospacedFamily() {
return skinParam.getMonospacedFamily();
Expand Down Expand Up @@ -355,4 +359,5 @@ public void setDefaultSkin(String newFileName) {
skinParam.setDefaultSkin(newFileName);
}


}
1 change: 1 addition & 0 deletions src/net/sourceforge/plantuml/UmlDiagram.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ final protected ImageData exportDiagramNow(OutputStream os, int index, FileForma
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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
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;
Expand Down Expand Up @@ -125,6 +126,7 @@ protected List<Command> createCommands() {

cmds.add(new CommandNamespace());
cmds.add(new CommandNamespace2());
cmds.add(new CommandNamespaceEmpty());
cmds.add(new CommandStereotype());

cmds.add(new CommandLinkClass(UmlDiagramType.CLASS));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ public CommandCreateClass() {
}

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(), //
Expand All @@ -95,7 +96,8 @@ private static IRegex getRegexConcat() {
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(), //
Expand All @@ -105,9 +107,14 @@ private static IRegex getRegexConcat() {
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());
}

Expand Down
1 change: 0 additions & 1 deletion src/net/sourceforge/plantuml/command/CommandFooter.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
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<TitledDiagram> {

Expand Down
1 change: 0 additions & 1 deletion src/net/sourceforge/plantuml/command/CommandHeader.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
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<TitledDiagram> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
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<TitledDiagram> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
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<TitledDiagram> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
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;
Expand Down
109 changes: 109 additions & 0 deletions src/net/sourceforge/plantuml/command/CommandNamespaceEmpty.java
Original file line number Diff line number Diff line change
@@ -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();
}

}
2 changes: 1 addition & 1 deletion src/net/sourceforge/plantuml/command/CommandPackage.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public CommandPackage() {

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( //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
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;
Expand Down
Loading

0 comments on commit 36c461d

Please sign in to comment.