1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-26 06:46:45 +00:00

Merge branch 'wo'

This commit is contained in:
Arnaud Roques 2022-06-06 14:37:25 +02:00
commit 16ad46f0ea
15 changed files with 135 additions and 93 deletions

View File

@ -72,15 +72,15 @@ public abstract class CommandMultilines<S extends Diagram> implements Command<S>
if (m1.matches() == false) if (m1.matches() == false)
return CommandControl.OK_PARTIAL; return CommandControl.OK_PARTIAL;
actionIfCommandValid(); return finalVerification();
return CommandControl.OK;
} }
protected boolean isCommandForbidden() { protected boolean isCommandForbidden() {
return false; return false;
} }
protected void actionIfCommandValid() { protected CommandControl finalVerification() {
return CommandControl.OK;
} }
protected final Pattern2 getStartingPattern() { protected final Pattern2 getStartingPattern() {

View File

@ -96,8 +96,7 @@ public abstract class CommandMultilines2<S extends Diagram> implements Command<S
if (m1.matches() == false) if (m1.matches() == false)
return CommandControl.OK_PARTIAL; return CommandControl.OK_PARTIAL;
actionIfCommandValid(); return finalVerification(lines);
return CommandControl.OK;
} }
public final CommandExecutionResult execute(S system, BlocLines lines) { public final CommandExecutionResult execute(S system, BlocLines lines) {
@ -118,7 +117,8 @@ public abstract class CommandMultilines2<S extends Diagram> implements Command<S
return false; return false;
} }
protected void actionIfCommandValid() { protected CommandControl finalVerification(BlocLines lines) {
return CommandControl.OK;
} }
protected final IRegex getStartingPattern() { protected final IRegex getStartingPattern() {

View File

@ -81,8 +81,7 @@ public abstract class CommandMultilines3<S extends Diagram> implements Command<S
if (m1 == false) if (m1 == false)
return CommandControl.OK_PARTIAL; return CommandControl.OK_PARTIAL;
actionIfCommandValid(); return finalVerification();
return CommandControl.OK;
} }
public final CommandExecutionResult execute(S system, BlocLines lines) { public final CommandExecutionResult execute(S system, BlocLines lines) {
@ -96,7 +95,8 @@ public abstract class CommandMultilines3<S extends Diagram> implements Command<S
return false; return false;
} }
protected void actionIfCommandValid() { protected CommandControl finalVerification() {
return CommandControl.OK;
} }
protected final IRegex getStartingPattern() { protected final IRegex getStartingPattern() {

View File

@ -60,7 +60,8 @@ public abstract class CommandMultilinesBracket<S extends Diagram> implements Com
return new String[] { "BRACKET: " + starting.pattern() }; return new String[] { "BRACKET: " + starting.pattern() };
} }
protected void actionIfCommandValid() { protected CommandControl finalVerification() {
return CommandControl.OK;
} }
protected final Pattern2 getStartingPattern() { protected final Pattern2 getStartingPattern() {
@ -98,8 +99,7 @@ public abstract class CommandMultilinesBracket<S extends Diagram> implements Com
if (level != 0) if (level != 0)
return CommandControl.OK_PARTIAL; return CommandControl.OK_PARTIAL;
actionIfCommandValid(); return finalVerification();
return CommandControl.OK;
} }
protected abstract boolean isLineConsistent(String line, int level); protected abstract boolean isLineConsistent(String line, int level);

View File

@ -104,9 +104,9 @@ public abstract class SingleLineCommand2<S extends Diagram> implements Command<S
final boolean result = pattern.match(line2); final boolean result = pattern.match(line2);
if (result) if (result)
actionIfCommandValid(); return finalVerification();
return result ? CommandControl.OK : CommandControl.NOT_OK; return CommandControl.NOT_OK;
} }
private CommandControl isValidBracket(BlocLines lines) { private CommandControl isValidBracket(BlocLines lines) {
@ -123,7 +123,8 @@ public abstract class SingleLineCommand2<S extends Diagram> implements Command<S
return false; return false;
} }
protected void actionIfCommandValid() { protected CommandControl finalVerification() {
return CommandControl.OK;
} }
public final CommandExecutionResult execute(S system, BlocLines lines) { public final CommandExecutionResult execute(S system, BlocLines lines) {

View File

@ -111,7 +111,7 @@ public class AtomImg extends AbstractAtom implements Atom {
try { try {
final byte bytes[] = Base64Coder.decode(data); final byte bytes[] = Base64Coder.decode(data);
final String tmp = new String(bytes); final String tmp = new String(bytes);
return new AtomImgSvg(new TileImageSvg(tmp)); return new AtomImgSvg(new TileImageSvg(tmp, scale));
} catch (Exception e) { } catch (Exception e) {
return AtomTextUtils.createLegacy("ERROR " + e.toString(), fc); return AtomTextUtils.createLegacy("ERROR " + e.toString(), fc);
} }
@ -137,7 +137,7 @@ public class AtomImg extends AbstractAtom implements Atom {
if (tmp == null) if (tmp == null)
return AtomTextUtils.createLegacy("(Cannot decode)", fc); return AtomTextUtils.createLegacy("(Cannot decode)", fc);
return new AtomImgSvg(new TileImageSvg(tmp)); return new AtomImgSvg(new TileImageSvg(tmp, scale));
} }
final BufferedImage read = f.readRasterImageFromFile(); final BufferedImage read = f.readRasterImageFromFile();
if (read == null) { if (read == null) {
@ -186,7 +186,7 @@ public class AtomImg extends AbstractAtom implements Atom {
if (read == null) { if (read == null) {
return AtomTextUtils.createLegacy("(Cannot decode SVG: " + text + ")", fc); return AtomTextUtils.createLegacy("(Cannot decode SVG: " + text + ")", fc);
} }
return new AtomImgSvg(new TileImageSvg(new String(read, UTF_8))); return new AtomImgSvg(new TileImageSvg(new String(read, UTF_8), scale));
} }
// End // End

View File

@ -132,6 +132,7 @@ public class CreoleParser implements SheetBuilder {
} }
}; };
} else if (cs instanceof Stereotype) { } else if (cs instanceof Stereotype) {
if (display.showStereotype())
for (String st : ((Stereotype) cs).getLabels(skinParam.guillemet())) for (String st : ((Stereotype) cs).getLabels(skinParam.guillemet()))
sheet.add(createStripe(st, context, sheet.getLastStripe(), stereotype)); sheet.add(createStripe(st, context, sheet.getLastStripe(), stereotype));

View File

@ -77,6 +77,8 @@ import net.sourceforge.plantuml.sequencediagram.MessageNumber;
import net.sourceforge.plantuml.skin.VisibilityModifier; import net.sourceforge.plantuml.skin.VisibilityModifier;
import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.Value;
import net.sourceforge.plantuml.style.ValueNull;
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.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
@ -88,28 +90,25 @@ public class Display implements Iterable<CharSequence> {
private final HorizontalAlignment naturalHorizontalAlignment; private final HorizontalAlignment naturalHorizontalAlignment;
private final boolean isNull; private final boolean isNull;
private final CreoleMode defaultCreoleMode; private final CreoleMode defaultCreoleMode;
private final boolean showStereotype;
public final static Display NULL = new Display(null, null, true, CreoleMode.FULL); public final static Display NULL = new Display(true, null, null, true, CreoleMode.FULL);
public boolean showStereotype() {
return showStereotype;
}
public Display withoutStereotypeIfNeeded(Style usedStyle) { public Display withoutStereotypeIfNeeded(Style usedStyle) {
if (this == NULL) if (this == NULL)
return NULL; return NULL;
final boolean showStereotype = usedStyle.value(PName.ShowStereotype).asBoolean(); final Value showStereotype = usedStyle.value(PName.ShowStereotype);
if (showStereotype) if (showStereotype instanceof ValueNull || showStereotype.asBoolean())
return this; return this;
final List<CharSequence> copy = new ArrayList<>(displayData); return new Display(false, this, this.defaultCreoleMode);
final Display result = new Display(naturalHorizontalAlignment, isNull, defaultCreoleMode);
for (Iterator<CharSequence> it = copy.iterator(); it.hasNext();) {
final CharSequence cs = it.next();
if (cs instanceof Stereotype && usedStyle.getSignature().match(((Stereotype) cs)))
it.remove();
} }
result.displayData.addAll(copy);
return result;
}
public Stereotype getStereotypeIfAny() { public Stereotype getStereotypeIfAny() {
for (CharSequence cs : displayData) for (CharSequence cs : displayData)
@ -121,7 +120,7 @@ public class Display implements Iterable<CharSequence> {
} }
public Display replaceBackslashT() { public Display replaceBackslashT() {
final Display result = new Display(this, defaultCreoleMode); final Display result = new Display(this.showStereotype, this, defaultCreoleMode);
for (int i = 0; i < result.displayData.size(); i++) { for (int i = 0; i < result.displayData.size(); i++) {
final CharSequence s = displayData.get(i); final CharSequence s = displayData.get(i);
if (s.toString().contains("\\t")) if (s.toString().contains("\\t"))
@ -138,7 +137,7 @@ public class Display implements Iterable<CharSequence> {
newDisplay.add(cs); newDisplay.add(cs);
} }
return new Display(newDisplay, naturalHorizontalAlignment, isNull, defaultCreoleMode); return new Display(showStereotype, newDisplay, naturalHorizontalAlignment, isNull, defaultCreoleMode);
} }
public boolean isWhite() { public boolean isWhite() {
@ -147,7 +146,7 @@ public class Display implements Iterable<CharSequence> {
} }
public static Display empty() { public static Display empty() {
return new Display((HorizontalAlignment) null, false, CreoleMode.FULL); return new Display(true, (HorizontalAlignment) null, false, CreoleMode.FULL);
} }
public static Display create(CharSequence... s) { public static Display create(CharSequence... s) {
@ -165,7 +164,7 @@ public class Display implements Iterable<CharSequence> {
} }
public static Display create(Collection<? extends CharSequence> other) { public static Display create(Collection<? extends CharSequence> other) {
return new Display(other, null, false, CreoleMode.FULL); return new Display(true, other, null, false, CreoleMode.FULL);
} }
public static Display getWithNewlines(Code s) { public static Display getWithNewlines(Code s) {
@ -221,24 +220,26 @@ public class Display implements Iterable<CharSequence> {
} }
} }
result.add(current.toString()); result.add(current.toString());
return new Display(result, naturalHorizontalAlignment, false, CreoleMode.FULL); return new Display(true, result, naturalHorizontalAlignment, false, CreoleMode.FULL);
} }
private Display(Display other, CreoleMode mode) { private Display(boolean showStereotype, Display other, CreoleMode mode) {
this(other.naturalHorizontalAlignment, other.isNull, mode); this(showStereotype, other.naturalHorizontalAlignment, other.isNull, mode);
this.displayData.addAll(other.displayData); this.displayData.addAll(other.displayData);
} }
private Display(HorizontalAlignment naturalHorizontalAlignment, boolean isNull, CreoleMode defaultCreoleMode) { private Display(boolean showStereotype, HorizontalAlignment naturalHorizontalAlignment, boolean isNull,
CreoleMode defaultCreoleMode) {
this.showStereotype = showStereotype;
this.defaultCreoleMode = defaultCreoleMode; this.defaultCreoleMode = defaultCreoleMode;
this.isNull = isNull; this.isNull = isNull;
this.displayData = isNull ? null : new ArrayList<CharSequence>(); this.displayData = isNull ? null : new ArrayList<CharSequence>();
this.naturalHorizontalAlignment = isNull ? null : naturalHorizontalAlignment; this.naturalHorizontalAlignment = isNull ? null : naturalHorizontalAlignment;
} }
private Display(Collection<? extends CharSequence> other, HorizontalAlignment naturalHorizontalAlignment, private Display(boolean showStereotype, Collection<? extends CharSequence> other,
boolean isNull, CreoleMode defaultCreoleMode) { HorizontalAlignment naturalHorizontalAlignment, boolean isNull, CreoleMode defaultCreoleMode) {
this(naturalHorizontalAlignment, isNull, defaultCreoleMode); this(showStereotype, naturalHorizontalAlignment, isNull, defaultCreoleMode);
if (isNull == false) if (isNull == false)
this.displayData.addAll(manageEmbeddedDiagrams(other)); this.displayData.addAll(manageEmbeddedDiagrams(other));
@ -284,7 +285,8 @@ public class Display implements Iterable<CharSequence> {
} }
first = false; first = false;
} }
return new Display(result, this.naturalHorizontalAlignment, this.isNull, this.defaultCreoleMode); return new Display(showStereotype, result, this.naturalHorizontalAlignment, this.isNull,
this.defaultCreoleMode);
} }
public Display withPage(int page, int lastpage) { public Display withPage(int page, int lastpage) {
@ -297,7 +299,8 @@ public class Display implements Iterable<CharSequence> {
line = line.toString().replace("%lastpage%", "" + lastpage); line = line.toString().replace("%lastpage%", "" + lastpage);
result.add(line); result.add(line);
} }
return new Display(result, this.naturalHorizontalAlignment, this.isNull, this.defaultCreoleMode); return new Display(showStereotype, result, this.naturalHorizontalAlignment, this.isNull,
this.defaultCreoleMode);
} }
public Display removeEndingStereotype() { public Display removeEndingStereotype() {
@ -305,7 +308,8 @@ public class Display implements Iterable<CharSequence> {
if (m.matches()) { if (m.matches()) {
final List<CharSequence> result = new ArrayList<>(this.displayData); final List<CharSequence> result = new ArrayList<>(this.displayData);
result.set(result.size() - 1, m.group(1)); result.set(result.size() - 1, m.group(1));
return new Display(result, this.naturalHorizontalAlignment, this.isNull, this.defaultCreoleMode); return new Display(showStereotype, result, this.naturalHorizontalAlignment, this.isNull,
this.defaultCreoleMode);
} }
return this; return this;
} }
@ -325,7 +329,8 @@ public class Display implements Iterable<CharSequence> {
for (CharSequence line : displayData) for (CharSequence line : displayData)
result.add("<u>" + line); result.add("<u>" + line);
return new Display(result, this.naturalHorizontalAlignment, this.isNull, this.defaultCreoleMode); return new Display(showStereotype, result, this.naturalHorizontalAlignment, this.isNull,
this.defaultCreoleMode);
} }
public Display underlinedName() { public Display underlinedName() {
@ -342,14 +347,15 @@ public class Display implements Iterable<CharSequence> {
result.add("<u>" + line); result.add("<u>" + line);
} }
} }
return new Display(result, this.naturalHorizontalAlignment, this.isNull, this.defaultCreoleMode); return new Display(showStereotype, result, this.naturalHorizontalAlignment, this.isNull,
this.defaultCreoleMode);
} }
public Display withCreoleMode(CreoleMode mode) { public Display withCreoleMode(CreoleMode mode) {
if (isNull) if (isNull)
throw new IllegalArgumentException(); throw new IllegalArgumentException();
return new Display(this, mode); return new Display(this.showStereotype, this, mode);
} }
@Override @Override
@ -371,25 +377,25 @@ public class Display implements Iterable<CharSequence> {
} }
public Display addAll(Display other) { public Display addAll(Display other) {
final Display result = new Display(this, this.defaultCreoleMode); final Display result = new Display(this.showStereotype, this, this.defaultCreoleMode);
result.displayData.addAll(other.displayData); result.displayData.addAll(other.displayData);
return result; return result;
} }
public Display addFirst(CharSequence s) { public Display addFirst(CharSequence s) {
final Display result = new Display(this, this.defaultCreoleMode); final Display result = new Display(this.showStereotype, this, this.defaultCreoleMode);
result.displayData.add(0, s); result.displayData.add(0, s);
return result; return result;
} }
public Display add(CharSequence s) { public Display add(CharSequence s) {
final Display result = new Display(this, this.defaultCreoleMode); final Display result = new Display(this.showStereotype, this, this.defaultCreoleMode);
result.displayData.add(s); result.displayData.add(s);
return result; return result;
} }
public Display addGeneric(CharSequence s) { public Display addGeneric(CharSequence s) {
final Display result = new Display(this, this.defaultCreoleMode); final Display result = new Display(this.showStereotype, this, this.defaultCreoleMode);
final int size = displayData.size(); final int size = displayData.size();
if (size == 0) if (size == 0)
result.displayData.add("<" + s + ">"); result.displayData.add("<" + s + ">");
@ -415,7 +421,7 @@ public class Display implements Iterable<CharSequence> {
} }
public Display subList(int i, int size) { public Display subList(int i, int size) {
return new Display(displayData.subList(i, size), this.naturalHorizontalAlignment, this.isNull, return new Display(showStereotype, displayData.subList(i, size), this.naturalHorizontalAlignment, this.isNull,
this.defaultCreoleMode); this.defaultCreoleMode);
} }
@ -448,7 +454,8 @@ public class Display implements Iterable<CharSequence> {
public List<Display> splitMultiline(Pattern2 separator) { public List<Display> splitMultiline(Pattern2 separator) {
final List<Display> result = new ArrayList<>(); final List<Display> result = new ArrayList<>();
Display pending = new Display(this.naturalHorizontalAlignment, this.isNull, this.defaultCreoleMode); Display pending = new Display(showStereotype, this.naturalHorizontalAlignment, this.isNull,
this.defaultCreoleMode);
result.add(pending); result.add(pending);
for (CharSequence line : displayData) { for (CharSequence line : displayData) {
final Matcher2 m = separator.matcher(line); final Matcher2 m = separator.matcher(line);
@ -456,7 +463,8 @@ public class Display implements Iterable<CharSequence> {
final CharSequence s1 = line.subSequence(0, m.start()); final CharSequence s1 = line.subSequence(0, m.start());
pending.displayData.add(s1); pending.displayData.add(s1);
final CharSequence s2 = line.subSequence(m.end(), line.length()); final CharSequence s2 = line.subSequence(m.end(), line.length());
pending = new Display(this.naturalHorizontalAlignment, this.isNull, this.defaultCreoleMode); pending = new Display(showStereotype, this.naturalHorizontalAlignment, this.isNull,
this.defaultCreoleMode);
result.add(pending); result.add(pending);
pending.displayData.add(s2); pending.displayData.add(s2);
} else { } else {

View File

@ -63,17 +63,17 @@ public class Img implements HtmlCommand {
static int getVspace(String html) { static int getVspace(String html) {
final Matcher2 m = vspacePattern.matcher(html); final Matcher2 m = vspacePattern.matcher(html);
if (m.find() == false) { if (m.find() == false)
return 0; return 0;
}
return Integer.parseInt(m.group(1)); return Integer.parseInt(m.group(1));
} }
static ImgValign getValign(String html) { static ImgValign getValign(String html) {
final Matcher2 m = valignPattern.matcher(html); final Matcher2 m = valignPattern.matcher(html);
if (m.find() == false) { if (m.find() == false)
return ImgValign.TOP; return ImgValign.TOP;
}
return ImgValign.valueOf(StringUtils.goUpperCase(m.group(1))); return ImgValign.valueOf(StringUtils.goUpperCase(m.group(1)));
} }
@ -99,28 +99,28 @@ public class Img implements HtmlCommand {
// Check if valid URL // Check if valid URL
if (src.startsWith("http:") || src.startsWith("https:")) { if (src.startsWith("http:") || src.startsWith("https:")) {
final SURL tmp = SURL.create(src); final SURL tmp = SURL.create(src);
if (tmp == null) { if (tmp == null)
return new Text("(Cannot decode: " + src + ")"); return new Text("(Cannot decode: " + src + ")");
}
final BufferedImage read = tmp.readRasterImageFromURL(); final BufferedImage read = tmp.readRasterImageFromURL();
if (read == null) { if (read == null)
return new Text("(Cannot decode: " + src + ")"); return new Text("(Cannot decode: " + src + ")");
}
return new Img(new TileImage(read, valign, vspace)); return new Img(new TileImage(read, valign, vspace));
} }
return new Text("(Cannot decode: " + f + ")"); return new Text("(Cannot decode: " + f + ")");
} }
if (f.getName().endsWith(".svg")) { if (f.getName().endsWith(".svg")) {
final String tmp = FileUtils.readSvg(f); final String tmp = FileUtils.readSvg(f);
if (tmp == null) { if (tmp == null)
return new Text("(Cannot decode: " + f + ")"); return new Text("(Cannot decode: " + f + ")");
}
return new Img(new TileImageSvg(tmp)); return new Img(new TileImageSvg(tmp, 1));
} }
final BufferedImage read = f.readRasterImageFromFile(); final BufferedImage read = f.readRasterImageFromFile();
if (read == null) { if (read == null)
return new Text("(Cannot decode: " + f + ")"); return new Text("(Cannot decode: " + f + ")");
}
return new Img(new TileImage(f.readRasterImageFromFile(), valign, vspace)); return new Img(new TileImage(f.readRasterImageFromFile(), valign, vspace));
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();

View File

@ -43,9 +43,11 @@ import net.sourceforge.plantuml.ugraphic.UImageSvg;
public class TileImageSvg extends AbstractTextBlock implements TextBlock { public class TileImageSvg extends AbstractTextBlock implements TextBlock {
private final UImageSvg svg; private final UImageSvg svg;
private final double scale;
public TileImageSvg(String svg) { public TileImageSvg(String svg, double scale) {
this.svg = new UImageSvg(svg, 1); this.svg = new UImageSvg(svg, scale);
this.scale = scale;
} }
public Dimension2D calculateDimension(StringBounder stringBounder) { public Dimension2D calculateDimension(StringBounder stringBounder) {

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.StringLocated; import net.sourceforge.plantuml.StringLocated;
import net.sourceforge.plantuml.UrlBuilder; import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.command.BlocLines; import net.sourceforge.plantuml.command.BlocLines;
import net.sourceforge.plantuml.command.CommandControl;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.CommandMultilines2; import net.sourceforge.plantuml.command.CommandMultilines2;
import net.sourceforge.plantuml.command.MultilinesStrategy; import net.sourceforge.plantuml.command.MultilinesStrategy;
@ -97,22 +98,46 @@ public class CommandCreateJson extends CommandMultilines2<AbstractClassOrObjectD
if (entity1 == null) if (entity1 == null)
return CommandExecutionResult.error("No such entity"); return CommandExecutionResult.error("No such entity");
final JsonValue json = getJsonValue(lines);
if (json == null)
return CommandExecutionResult.error("Bad data");
((BodierJSon) entity1.getBodier()).setJson(json);
return CommandExecutionResult.ok();
}
@Override
protected CommandControl finalVerification(BlocLines lines) {
final JsonValue json = getJsonValue(lines);
if (json == null)
return CommandControl.OK_PARTIAL;
return super.finalVerification(lines);
}
private JsonValue getJsonValue(BlocLines lines) {
try {
final String sb = getJsonString(lines);
final DefaultHandler handler = new DefaultHandler();
new JsonParser(handler).parse(sb);
final JsonValue json = handler.getValue();
return json;
} catch (Exception e) {
return null;
}
}
private String getJsonString(BlocLines lines) {
lines = lines.subExtract(1, 1); lines = lines.subExtract(1, 1);
final StringBuilder sb = new StringBuilder("{"); final StringBuilder sb = new StringBuilder("{");
for (StringLocated sl : lines) { for (StringLocated sl : lines) {
final String line = sl.getString(); final String line = sl.getString();
assert line.length() > 0; assert line.length() > 0;
System.err.println("l=" + line);
sb.append(line); sb.append(line);
} }
sb.append("}"); sb.append("}");
return sb.toString();
final DefaultHandler handler = new DefaultHandler();
new JsonParser(handler).parse(sb.toString());
final JsonValue json = handler.getValue();
((BodierJSon) entity1.getBodier()).setJson(json);
return CommandExecutionResult.ok();
} }
private IEntity executeArg0(AbstractClassOrObjectDiagram diagram, RegexResult line0) throws NoSuchColorException { private IEntity executeArg0(AbstractClassOrObjectDiagram diagram, RegexResult line0) throws NoSuchColorException {

View File

@ -55,8 +55,6 @@ import net.sourceforge.plantuml.ugraphic.color.HColorSet;
public abstract class AbstractTextualComponent extends AbstractComponent { public abstract class AbstractTextualComponent extends AbstractComponent {
private final Display display;
private final int marginX1; private final int marginX1;
private final int marginX2; private final int marginX2;
private final int marginY; private final int marginY;
@ -91,20 +89,18 @@ public abstract class AbstractTextualComponent extends AbstractComponent {
final UFont fontForStereotype = stereo.getUFont(); final UFont fontForStereotype = stereo.getUFont();
final HColor htmlColorForStereotype = stereo.value(PName.FontColor).asColor(spriteContainer.getThemeStyle(), final HColor htmlColorForStereotype = stereo.value(PName.FontColor).asColor(spriteContainer.getThemeStyle(),
getIHtmlColorSet()); getIHtmlColorSet());
this.display = display.withoutStereotypeIfNeeded(style); display = display.withoutStereotypeIfNeeded(style);
this.marginX1 = marginX1; this.marginX1 = marginX1;
this.marginX2 = marginX2; this.marginX2 = marginX2;
this.marginY = marginY; this.marginY = marginY;
// this.display = keepStereotype ? display : display.withoutStereotype();
if (this.display.size() == 1 && this.display.get(0).length() == 0) if (display.size() == 1 && display.get(0).length() == 0)
textBlock = new TextBlockEmpty(); textBlock = new TextBlockEmpty();
else if (enhanced) else if (enhanced)
textBlock = BodyFactory.create3(this.display, spriteContainer, horizontalAlignment, fc, maxMessageSize, textBlock = BodyFactory.create3(display, spriteContainer, horizontalAlignment, fc, maxMessageSize, style);
style);
else else
textBlock = this.display.create0(fc, horizontalAlignment, spriteContainer, maxMessageSize, CreoleMode.FULL, textBlock = display.create0(fc, horizontalAlignment, spriteContainer, maxMessageSize, CreoleMode.FULL,
fontForStereotype, htmlColorForStereotype, marginX1, marginX2); fontForStereotype, htmlColorForStereotype, marginX1, marginX2);
this.alignment = horizontalAlignment; this.alignment = horizontalAlignment;

View File

@ -211,6 +211,15 @@ public class FromSkinparamToStyle {
addMagic(SName.map); addMagic(SName.map);
addMagic(SName.archimate); addMagic(SName.archimate);
addConvert("IconPrivateColor", PName.LineColor, SName.visibilityIcon, SName.private_);
addConvert("IconPrivateBackgroundColor", PName.BackGroundColor, SName.visibilityIcon, SName.private_);
addConvert("IconPackageColor", PName.LineColor, SName.visibilityIcon, SName.package_);
addConvert("IconPackageBackgroundColor", PName.BackGroundColor, SName.visibilityIcon, SName.package_);
addConvert("IconProtectedColor", PName.LineColor, SName.visibilityIcon, SName.protected_);
addConvert("IconProtectedBackgroundColor", PName.BackGroundColor, SName.visibilityIcon, SName.protected_);
addConvert("IconPublicColor", PName.LineColor, SName.visibilityIcon, SName.public_);
addConvert("IconPublicBackgroundColor", PName.BackGroundColor, SName.visibilityIcon, SName.public_);
// addConvert("nodeStereotypeFontSize", PName.FontSize, SName.node, SName.stereotype); // addConvert("nodeStereotypeFontSize", PName.FontSize, SName.node, SName.stereotype);
// addConvert("sequenceStereotypeFontSize", PName.FontSize, SName.stereotype); // addConvert("sequenceStereotypeFontSize", PName.FontSize, SName.stereotype);

View File

@ -128,12 +128,12 @@ public class UImageSvg implements UShape {
throw new IllegalStateException("Cannot find " + name); throw new IllegalStateException("Cannot find " + name);
} }
public int getHeight() { public double getHeight() {
return this.getData("height"); return this.getData("height") * scale;
} }
public int getWidth() { public double getWidth() {
return this.getData("width"); return this.getData("width") * scale;
} }
public double getScale() { public double getScale() {

View File

@ -73,7 +73,7 @@ public class UPolygon extends AbstractShadowable {
(pt1.getY() + pt2.getY()) / 2); (pt1.getY() + pt2.getY()) / 2);
final double delta = middle.distance(center); final double delta = middle.distance(center);
if (delta < 1) if (delta < 1)
return all.get((i - 1) % all.size()); return all.get((i + all.size() - 1) % all.size());
} }
return null; return null;