1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-22 21:15:09 +00:00

minor fixes

This commit is contained in:
Arnaud Roques 2022-02-14 18:44:01 +01:00
parent fe4c5cb957
commit e7785ff144
7 changed files with 183 additions and 149 deletions

View File

@ -112,9 +112,9 @@ public class FtileBoxOld extends AbstractFtile {
} }
public Set<Swimlane> getSwimlanes() { public Set<Swimlane> getSwimlanes() {
if (swimlane == null) { if (swimlane == null)
return Collections.emptySet(); return Collections.emptySet();
}
return Collections.singleton(swimlane); return Collections.singleton(swimlane);
} }
@ -164,9 +164,9 @@ public class FtileBoxOld extends AbstractFtile {
public static TextBlock createWbs(Style style, ISkinParam skinParam, Display label) { public static TextBlock createWbs(Style style, ISkinParam skinParam, Display label) {
Style styleArrow = null; Style styleArrow = null;
if (UseStyle.useBetaStyle()) { if (UseStyle.useBetaStyle())
styleArrow = style; styleArrow = style;
}
return new FtileBoxOld(skinParam, label, null, BoxStyle.PLAIN, style, styleArrow); return new FtileBoxOld(skinParam, label, null, BoxStyle.PLAIN, style, styleArrow);
} }
@ -189,9 +189,9 @@ public class FtileBoxOld extends AbstractFtile {
this.inRendering = new LinkRendering( this.inRendering = new LinkRendering(
Rainbow.build(styleArrow, getIHtmlColorSet(), skinParam.getThemeStyle())); Rainbow.build(styleArrow, getIHtmlColorSet(), skinParam.getThemeStyle()));
Colors specBack = null; Colors specBack = null;
if (skinParam instanceof SkinParamColors) { if (skinParam instanceof SkinParamColors)
specBack = ((SkinParamColors) skinParam).getColors(); specBack = ((SkinParamColors) skinParam).getColors();
}
style = style.eventuallyOverride(specBack); style = style.eventuallyOverride(specBack);
this.borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet()); this.borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet());
this.backColor = style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet()); this.backColor = style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet());
@ -230,42 +230,44 @@ public class FtileBoxOld extends AbstractFtile {
} }
public void drawU(UGraphic ug) { public void drawU(UGraphic ug) {
final Dimension2D dimTotal = calculateDimension(ug.getStringBounder()); final StringBounder stringBounder = ug.getStringBounder();
final Dimension2D dimTotal = calculateDimension(stringBounder);
final double widthTotal = dimTotal.getWidth(); final double widthTotal = dimTotal.getWidth();
final double heightTotal = dimTotal.getHeight(); final double heightTotal = dimTotal.getHeight();
final UDrawable shape = boxStyle.getUDrawable(widthTotal, heightTotal, shadowing, roundCorner); final UDrawable shape = boxStyle.getUDrawable(widthTotal, heightTotal, shadowing, roundCorner);
final UStroke thickness; final UStroke thickness;
if (UseStyle.useBetaStyle()) { if (UseStyle.useBetaStyle())
thickness = style.getStroke(); thickness = style.getStroke();
} else { else
thickness = getThickness(style); thickness = getThickness(style);
}
if (borderColor == null) { if (borderColor == null)
ug = ug.apply(new HColorNone()); ug = ug.apply(new HColorNone());
} else { else
ug = ug.apply(borderColor); ug = ug.apply(borderColor);
}
if (backColor == null) { if (backColor == null)
ug = ug.apply(new HColorNone().bg()); ug = ug.apply(new HColorNone().bg());
} else { else
ug = ug.apply(backColor.bg()); ug = ug.apply(backColor.bg());
}
ug = ug.apply(thickness); ug = ug.apply(thickness);
shape.drawU(ug); shape.drawU(ug);
if (horizontalAlignment == HorizontalAlignment.LEFT) { if (horizontalAlignment == HorizontalAlignment.LEFT)
tb.drawU(ug.apply(new UTranslate(padding.getLeft(), padding.getTop()))); tb.drawU(ug.apply(new UTranslate(padding.getLeft(), padding.getTop())));
} else if (horizontalAlignment == HorizontalAlignment.RIGHT) { else if (horizontalAlignment == HorizontalAlignment.RIGHT)
final Dimension2D dimTb = tb.calculateDimension(ug.getStringBounder()); tb.drawU(ug.apply(new UTranslate(dimTotal.getWidth() - tbWidth(stringBounder) - padding.getRight(),
tb.drawU(ug.apply( padding.getBottom())));
new UTranslate(dimTotal.getWidth() - dimTb.getWidth() - padding.getRight(), padding.getBottom()))); else if (horizontalAlignment == HorizontalAlignment.CENTER)
} else if (horizontalAlignment == HorizontalAlignment.CENTER) { tb.drawU(ug.apply(new UTranslate(padding.getRight() + (dimTotal.getWidth() - tbWidth(stringBounder)) / 2,
final Dimension2D dimTb = tb.calculateDimension(ug.getStringBounder()); padding.getBottom())));
tb.drawU(ug.apply(new UTranslate((dimTotal.getWidth() - dimTb.getWidth()) / 2, padding.getBottom())));
} }
private double tbWidth(final StringBounder stringBounder) {
return Math.max(minimumWidth, tb.calculateDimension(stringBounder).getWidth());
} }
@Override @Override

View File

@ -140,29 +140,26 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
} }
final public String getNamespaceSeparator() { final public String getNamespaceSeparator() {
if (namespaceSeparatorHasBeenSet == false) { if (namespaceSeparatorHasBeenSet == false)
return V1972() ? "::" : "."; return V1972() ? "::" : ".";
}
return namespaceSeparator; return namespaceSeparator;
} }
@Override @Override
public boolean hasUrl() { public boolean hasUrl() {
for (IEntity entity : getGroups(true)) { for (IEntity entity : getGroups(true))
if (entity.hasUrl()) { if (entity.hasUrl())
return true; return true;
}
} for (IEntity entity : entityFactory.leafs())
for (IEntity entity : entityFactory.leafs()) { if (entity.hasUrl())
if (entity.hasUrl()) {
return true; return true;
}
} for (Link link : getLinks())
for (Link link : getLinks()) { if (link.hasUrl())
if (link.hasUrl()) {
return true; return true;
}
}
return false; return false;
} }
@ -178,15 +175,16 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
result = entityFactory.getLeafStrict(idNewLong); result = entityFactory.getLeafStrict(idNewLong);
else else
result = entityFactory.getLeaf(code); result = entityFactory.getLeaf(code);
if (result == null) { if (result == null) {
result = createLeafInternal(idNewLong, code, Display.getWithNewlines(code), type, symbol); result = createLeafInternal(idNewLong, code, Display.getWithNewlines(code), type, symbol);
result.setUSymbol(symbol); result.setUSymbol(symbol);
} }
if (result.getLeafType() == LeafType.CLASS && type == LeafType.OBJECT) {
if (result.muteToType(type, symbol) == false) { if (result.getLeafType() == LeafType.CLASS && type == LeafType.OBJECT)
if (result.muteToType(type, symbol) == false)
return null; return null;
}
}
this.lastEntity = result; this.lastEntity = result;
return result; return result;
} }
@ -203,9 +201,9 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
final protected ILeaf createLeafInternal(Ident newIdent, Code code, Display display, LeafType type, final protected ILeaf createLeafInternal(Ident newIdent, Code code, Display display, LeafType type,
USymbol symbol) { USymbol symbol) {
Objects.requireNonNull(newIdent); Objects.requireNonNull(newIdent);
if (Display.isNull(display)) { if (Display.isNull(display))
display = Display.getWithNewlines(code).withCreoleMode(CreoleMode.SIMPLE_LINE); display = Display.getWithNewlines(code).withCreoleMode(CreoleMode.SIMPLE_LINE);
}
final ILeaf leaf = entityFactory.createLeaf(newIdent, code, display, type, getCurrentGroup(), getHides(), final ILeaf leaf = entityFactory.createLeaf(newIdent, code, display, type, getCurrentGroup(), getHides(),
getNamespaceSeparator()); getNamespaceSeparator());
entityFactory.addLeaf(leaf); entityFactory.addLeaf(leaf);
@ -259,21 +257,19 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
if (this.V1972()) if (this.V1972())
return getChildrenGroupsIdent1972(parent); return getChildrenGroupsIdent1972(parent);
final Collection<IGroup> result = new ArrayList<>(); final Collection<IGroup> result = new ArrayList<>();
for (IGroup gg : getGroups(false)) { for (IGroup gg : getGroups(false))
if (gg.getParentContainer() == parent) { if (gg.getParentContainer() == parent)
result.add(gg); result.add(gg);
}
}
return Collections.unmodifiableCollection(result); return Collections.unmodifiableCollection(result);
} }
private Collection<IGroup> getChildrenGroupsIdent1972(IGroup parent) { private Collection<IGroup> getChildrenGroupsIdent1972(IGroup parent) {
final Collection<IGroup> result = new ArrayList<>(); final Collection<IGroup> result = new ArrayList<>();
for (IGroup gg : entityFactory.groups2()) { for (IGroup gg : entityFactory.groups2())
if (gg.getIdent().parent().equals(parent.getIdent())) { if (gg.getIdent().parent().equals(parent.getIdent()))
result.add(gg); result.add(gg);
}
}
return Collections.unmodifiableCollection(result); return Collections.unmodifiableCollection(result);
} }
@ -285,9 +281,9 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
} }
if (strategy == NamespaceStrategy.MULTIPLE) { if (strategy == NamespaceStrategy.MULTIPLE) {
if (getNamespaceSeparator() != null) { if (getNamespaceSeparator() != null)
code = getFullyQualifiedCode1972(code); code = getFullyQualifiedCode1972(code);
}
gotoGroupInternalWithNamespace(ident, code, display, code, type, parent); gotoGroupInternalWithNamespace(ident, code, display, code, type, parent);
} else if (strategy == NamespaceStrategy.SINGLE) { } else if (strategy == NamespaceStrategy.SINGLE) {
final Ident newIdLong = buildLeafIdentSpecial(ident.toString(this.getNamespaceSeparator())); final Ident newIdLong = buildLeafIdentSpecial(ident.toString(this.getNamespaceSeparator()));
@ -303,9 +299,9 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
Objects.requireNonNull(separator); Objects.requireNonNull(separator);
do { do {
final int x = name.lastIndexOf(separator); final int x = name.lastIndexOf(separator);
if (x == -1) { if (x == -1)
return null; return null;
}
name = name.substring(0, x); name = name.substring(0, x);
} while (entityFactory.getLeaf(buildCode(name)) != null); } while (entityFactory.getLeaf(buildCode(name)) != null);
return name; return name;
@ -353,12 +349,11 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
Log.error("No parent group"); Log.error("No parent group");
return; return;
} }
if (stacks.size() > 0) { if (stacks.size() > 0)
currentGroup = stacks.remove(stacks.size() - 1); currentGroup = stacks.remove(stacks.size() - 1);
} else { else
currentGroup = currentGroup.getParentContainer(); currentGroup = currentGroup.getParentContainer();
} }
}
private void gotoGroupInternal(Ident idNewLong, final Code code, Display display, final Code namespace, private void gotoGroupInternal(Ident idNewLong, final Code code, Display display, final Code namespace,
GroupType type, IGroup parent) { GroupType type, IGroup parent) {
@ -433,19 +428,19 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
final protected Code getFullyQualifiedCode1972(Code code) { final protected Code getFullyQualifiedCode1972(Code code) {
final String separator = Objects.requireNonNull(getNamespaceSeparator()); final String separator = Objects.requireNonNull(getNamespaceSeparator());
final String full = code.getName(); final String full = code.getName();
if (full.startsWith(separator)) { if (full.startsWith(separator))
return buildCode(full.substring(separator.length())); return buildCode(full.substring(separator.length()));
}
if (full.contains(separator)) { if (full.contains(separator))
return buildCode(full); return buildCode(full);
}
if (EntityUtils.groupRoot(currentGroup)) { if (EntityUtils.groupRoot(currentGroup))
return buildCode(full); return buildCode(full);
}
final Code namespace = currentGroup.getNamespace(); final Code namespace = currentGroup.getNamespace();
if (namespace == null) { if (namespace == null)
return buildCode(full); return buildCode(full);
}
return buildCode(namespace.getName() + separator + full); return buildCode(namespace.getName() + separator + full);
} }
@ -491,9 +486,9 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
} }
public final Collection<IGroup> getGroups(boolean withRootGroup) { public final Collection<IGroup> getGroups(boolean withRootGroup) {
if (withRootGroup == false) { if (withRootGroup == false)
return entityFactory.groups(); return entityFactory.groups();
}
final Collection<IGroup> result = new ArrayList<>(); final Collection<IGroup> result = new ArrayList<>();
result.add(getRootGroup()); result.add(getRootGroup());
result.addAll(entityFactory.groups()); result.addAll(entityFactory.groups());
@ -548,20 +543,19 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
final public String[] getDotStringSkek() { final public String[] getDotStringSkek() {
final List<String> result = new ArrayList<>(); final List<String> result = new ArrayList<>();
for (String s : getDotStrings()) { for (String s : getDotStrings())
if (s.startsWith("nodesep") || s.startsWith("ranksep")) { if (s.startsWith("nodesep") || s.startsWith("ranksep") || s.startsWith("layout"))
result.add(s); result.add(s);
}
}
String aspect = getPragma().getValue("aspect"); String aspect = getPragma().getValue("aspect");
if (aspect != null) { if (aspect != null) {
aspect = aspect.replace(',', '.'); aspect = aspect.replace(',', '.');
result.add("aspect=" + aspect + ";"); result.add("aspect=" + aspect + ";");
} }
final String ratio = getPragma().getValue("ratio"); final String ratio = getPragma().getValue("ratio");
if (ratio != null) { if (ratio != null)
result.add("ratio=" + ratio + ";"); result.add("ratio=" + ratio + ";");
}
return result.toArray(new String[result.size()]); return result.toArray(new String[result.size()]);
} }
@ -606,18 +600,18 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
entityFactory.buildSuperGroups(); entityFactory.buildSuperGroups();
final CucaDiagramFileMaker maker; final CucaDiagramFileMaker maker;
if (this.isUseElk()) { if (this.isUseElk())
maker = new CucaDiagramFileMakerElk(this, fileFormatOption.getDefaultStringBounder(getSkinParam())); maker = new CucaDiagramFileMakerElk(this, fileFormatOption.getDefaultStringBounder(getSkinParam()));
} else if (this.isUseSmetana()) { else if (this.isUseSmetana())
maker = new CucaDiagramFileMakerSmetana(this, fileFormatOption.getDefaultStringBounder(getSkinParam())); maker = new CucaDiagramFileMakerSmetana(this, fileFormatOption.getDefaultStringBounder(getSkinParam()));
} else { else
maker = new CucaDiagramFileMakerSvek(this); maker = new CucaDiagramFileMakerSvek(this);
}
final ImageData result = maker.createFile(os, getDotStrings(), fileFormatOption); final ImageData result = maker.createFile(os, getDotStrings(), fileFormatOption);
if (result == null) { if (result == null)
return ImageDataSimple.error(); return ImageDataSimple.error();
}
this.warningOrError = result.getWarningOrError(); this.warningOrError = result.getWarningOrError();
return result; return result;
} }
@ -627,12 +621,12 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
@Override @Override
public String getWarningOrError() { public String getWarningOrError() {
final String generalWarningOrError = super.getWarningOrError(); final String generalWarningOrError = super.getWarningOrError();
if (warningOrError == null) { if (warningOrError == null)
return generalWarningOrError; return generalWarningOrError;
}
if (generalWarningOrError == null) { if (generalWarningOrError == null)
return warningOrError; return warningOrError;
}
return generalWarningOrError + BackSlash.NEWLINE + warningOrError; return generalWarningOrError + BackSlash.NEWLINE + warningOrError;
} }
@ -642,31 +636,29 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
} }
public boolean isAutarkic(IGroup g) { public boolean isAutarkic(IGroup g) {
if (g.getGroupType() == GroupType.PACKAGE) { if (g.getGroupType() == GroupType.PACKAGE)
return false; return false;
}
if (g.getGroupType() == GroupType.INNER_ACTIVITY) { if (g.getGroupType() == GroupType.INNER_ACTIVITY)
return true; return true;
}
if (g.getGroupType() == GroupType.CONCURRENT_ACTIVITY) { if (g.getGroupType() == GroupType.CONCURRENT_ACTIVITY)
return true; return true;
}
if (g.getGroupType() == GroupType.CONCURRENT_STATE) { if (g.getGroupType() == GroupType.CONCURRENT_STATE)
return true; return true;
}
if (getChildrenGroups(g).size() > 0) { if (getChildrenGroups(g).size() > 0)
return false; return false;
}
for (Link link : getLinks()) { for (Link link : getLinks())
if (EntityUtils.isPureInnerLink3(g, link) == false) { if (EntityUtils.isPureInnerLink3(g, link) == false)
return false; return false;
}
} for (ILeaf leaf : g.getLeafsDirect())
for (ILeaf leaf : g.getLeafsDirect()) { if (leaf.getEntityPosition() != EntityPosition.NORMAL)
if (leaf.getEntityPosition() != EntityPosition.NORMAL) {
return false; return false;
}
}
return true; return true;
} }
@ -682,15 +674,15 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
public String getLabeldistance() { public String getLabeldistance() {
if (getPragma().isDefine("labeldistance")) { if (getPragma().isDefine("labeldistance")) {
final String s = getPragma().getValue("labeldistance"); final String s = getPragma().getValue("labeldistance");
if (isNumber(s)) { if (isNumber(s))
return s; return s;
}
} }
if (getPragma().isDefine("defaultlabeldistance")) { if (getPragma().isDefine("defaultlabeldistance")) {
final String s = getPragma().getValue("defaultlabeldistance"); final String s = getPragma().getValue("defaultlabeldistance");
if (isNumber(s)) { if (isNumber(s))
return s; return s;
}
} }
// Default in dot 1.0 // Default in dot 1.0
return "1.7"; return "1.7";
@ -699,15 +691,15 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
public String getLabelangle() { public String getLabelangle() {
if (getPragma().isDefine("labelangle")) { if (getPragma().isDefine("labelangle")) {
final String s = getPragma().getValue("labelangle"); final String s = getPragma().getValue("labelangle");
if (isNumber(s)) { if (isNumber(s))
return s; return s;
}
} }
if (getPragma().isDefine("defaultlabelangle")) { if (getPragma().isDefine("defaultlabelangle")) {
final String s = getPragma().getValue("defaultlabelangle"); final String s = getPragma().getValue("defaultlabelangle");
if (isNumber(s)) { if (isNumber(s))
return s; return s;
}
} }
// Default in dot -25 // Default in dot -25
return "25"; return "25";
@ -715,12 +707,12 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
final public boolean isEmpty(IGroup gToTest) { final public boolean isEmpty(IGroup gToTest) {
for (IEntity gg : getGroups(false)) { for (IEntity gg : getGroups(false)) {
if (gg == gToTest) { if (gg == gToTest)
continue; continue;
}
if (gg.getParentContainer() == gToTest) { if (gg.getParentContainer() == gToTest)
return false; return false;
}
} }
return gToTest.size() == 0; return gToTest.size() == 0;
} }
@ -734,31 +726,29 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
} }
public final boolean showPortion(EntityPortion portion, IEntity entity) { public final boolean showPortion(EntityPortion portion, IEntity entity) {
if (getSkinParam().strictUmlStyle() && portion == EntityPortion.CIRCLED_CHARACTER) { if (getSkinParam().strictUmlStyle() && portion == EntityPortion.CIRCLED_CHARACTER)
return false; return false;
}
boolean result = true; boolean result = true;
for (HideOrShow cmd : hideOrShows) { for (HideOrShow cmd : hideOrShows)
if (cmd.portion == portion && cmd.gender.contains(entity)) { if (cmd.portion == portion && cmd.gender.contains(entity))
result = cmd.show; result = cmd.show;
}
}
return result; return result;
} }
public final void hideOrShow(EntityGender gender, EntityPortion portions, boolean show) { public final void hideOrShow(EntityGender gender, EntityPortion portions, boolean show) {
for (EntityPortion portion : portions.asSet()) { for (EntityPortion portion : portions.asSet())
this.hideOrShows.add(new HideOrShow(gender, portion, show)); this.hideOrShows.add(new HideOrShow(gender, portion, show));
}
} }
public void hideOrShow(Set<VisibilityModifier> visibilities, boolean show) { public void hideOrShow(Set<VisibilityModifier> visibilities, boolean show) {
if (show) { if (show)
hides.removeAll(visibilities); hides.removeAll(visibilities);
} else { else
hides.addAll(visibilities); hides.addAll(visibilities);
} }
}
public void hideOrShow2(String what, boolean show) { public void hideOrShow2(String what, boolean show) {
this.hides2.add(new HideOrShow2(what, show)); this.hides2.add(new HideOrShow2(what, show));
@ -792,11 +782,10 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
} }
final public boolean isStandalone(IEntity ent) { final public boolean isStandalone(IEntity ent) {
for (final Link link : getLinks()) { for (final Link link : getLinks())
if (link.getEntity1() == ent || link.getEntity2() == ent) { if (link.getEntity1() == ent || link.getEntity2() == ent)
return false; return false;
}
}
return true; return true;
} }
@ -804,9 +793,9 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
final List<Link> links = getLinks(); final List<Link> links = getLinks();
for (int i = links.size() - 1; i >= 0; i--) { for (int i = links.size() - 1; i >= 0; i--) {
final Link link = links.get(i); final Link link = links.get(i);
if (link.getEntity1().getLeafType() != LeafType.NOTE && link.getEntity2().getLeafType() != LeafType.NOTE) { if (link.getEntity1().getLeafType() != LeafType.NOTE && link.getEntity2().getLeafType() != LeafType.NOTE)
return link; return link;
}
} }
return null; return null;
} }
@ -818,9 +807,9 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
final Link link = links.get(i); final Link link = links.get(i);
if (link.getEntity1().getLeafType() != LeafType.NOTE && link.getEntity2().getLeafType() != LeafType.NOTE) { if (link.getEntity1().getLeafType() != LeafType.NOTE && link.getEntity2().getLeafType() != LeafType.NOTE) {
result.add(link); result.add(link);
if (result.size() == 2) { if (result.size() == 2)
return Collections.unmodifiableList(result); return Collections.unmodifiableList(result);
}
} }
} }
return null; return null;
@ -842,14 +831,13 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
for (IGroup g : getGroups(true)) { for (IGroup g : getGroups(true)) {
final List<ILeaf> standalones = new ArrayList<>(); final List<ILeaf> standalones = new ArrayList<>();
for (ILeaf ent : g.getLeafsDirect()) { for (ILeaf ent : g.getLeafsDirect())
if (isStandalone(ent)) { if (isStandalone(ent))
standalones.add(ent); standalones.add(ent);
}
} if (standalones.size() < 3)
if (standalones.size() < 3) {
continue; continue;
}
final Magma magma = new Magma(this, standalones); final Magma magma = new Magma(this, standalones);
magma.putInSquare(); magma.putInSquare();
magmaList.add(magma); magmaList.add(magma);
@ -857,9 +845,9 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
for (IGroup g : getGroups(true)) { for (IGroup g : getGroups(true)) {
final MagmaList magmas = magmaList.getMagmas(g); final MagmaList magmas = magmaList.getMagmas(g);
if (magmas.size() < 3) { if (magmas.size() < 3)
continue; continue;
}
magmas.putInSquare(); magmas.putInSquare();
} }

View File

@ -0,0 +1,40 @@
/* ========================================================================
* 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.svg;
public enum DarkStrategy {
IGNORE_DARK_COLOR, USE_PREFERS_COLOR_SCHEME_DARK;
}

View File

@ -141,7 +141,7 @@ public class SvgGraphics {
} }
public SvgGraphics(String backcolor, boolean svgDimensionStyle, Dimension2D minDim, double scale, String hover, public SvgGraphics(String backcolor, boolean svgDimensionStyle, Dimension2D minDim, double scale, String hover,
long seed, String preserveAspectRatio, LengthAdjust lengthAdjust) { long seed, String preserveAspectRatio, LengthAdjust lengthAdjust, DarkStrategy darkStrategy) {
try { try {
this.lengthAdjust = lengthAdjust; this.lengthAdjust = lengthAdjust;
this.svgDimensionStyle = svgDimensionStyle; this.svgDimensionStyle = svgDimensionStyle;

View File

@ -58,6 +58,7 @@ import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.UDrawable;
import net.sourceforge.plantuml.security.SImageIO; import net.sourceforge.plantuml.security.SImageIO;
import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.security.SFile;
import net.sourceforge.plantuml.svg.DarkStrategy;
import net.sourceforge.plantuml.svg.LengthAdjust; import net.sourceforge.plantuml.svg.LengthAdjust;
import net.sourceforge.plantuml.svg.SvgGraphics; import net.sourceforge.plantuml.svg.SvgGraphics;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils; import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
@ -158,7 +159,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(null, true, new Dimension2DDouble(0, 0), 1.0, null, 42, "none", final SvgGraphics svg = new SvgGraphics(null, true, new Dimension2DDouble(0, 0), 1.0, null, 42, "none",
LengthAdjust.defaultValue()); LengthAdjust.defaultValue(), DarkStrategy.IGNORE_DARK_COLOR);
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

@ -207,7 +207,8 @@ public class HColorSimple extends HColorAbstract implements HColor {
} }
public HColor withDark(HColor dark) { public HColor withDark(HColor dark) {
return new HColorSimple(color, monochrome, dark); return this;
// return new HColorSimple(color, monochrome, dark);
} }
@Override @Override

View File

@ -43,6 +43,7 @@ import javax.xml.transform.TransformerException;
import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.posimo.DotPath; import net.sourceforge.plantuml.posimo.DotPath;
import net.sourceforge.plantuml.svg.DarkStrategy;
import net.sourceforge.plantuml.svg.LengthAdjust; import net.sourceforge.plantuml.svg.LengthAdjust;
import net.sourceforge.plantuml.svg.SvgGraphics; import net.sourceforge.plantuml.svg.SvgGraphics;
import net.sourceforge.plantuml.ugraphic.AbstractCommonUGraphic; import net.sourceforge.plantuml.ugraphic.AbstractCommonUGraphic;
@ -88,9 +89,10 @@ public class UGraphicSvg extends AbstractUGraphic<SvgGraphics> implements ClipCo
public UGraphicSvg(HColor defaultBackground, boolean svgDimensionStyle, Dimension2D minDim, ColorMapper colorMapper, public UGraphicSvg(HColor defaultBackground, boolean svgDimensionStyle, Dimension2D minDim, ColorMapper colorMapper,
boolean textAsPath, double scale, String linkTarget, String hover, long seed, String preserveAspectRatio, boolean textAsPath, double scale, String linkTarget, String hover, long seed, String preserveAspectRatio,
StringBounder stringBounder, LengthAdjust lengthAdjust) { StringBounder stringBounder, LengthAdjust lengthAdjust) {
this(defaultBackground, minDim, colorMapper, new SvgGraphics(colorMapper.toSvg(defaultBackground), this(defaultBackground, minDim, colorMapper,
svgDimensionStyle, minDim, scale, hover, seed, preserveAspectRatio, lengthAdjust), textAsPath, new SvgGraphics(colorMapper.toSvg(defaultBackground), svgDimensionStyle, minDim, scale, hover, seed,
linkTarget, stringBounder); preserveAspectRatio, lengthAdjust, DarkStrategy.IGNORE_DARK_COLOR),
textAsPath, linkTarget, stringBounder);
if (defaultBackground instanceof HColorGradient) { if (defaultBackground instanceof HColorGradient) {
final SvgGraphics svg = getGraphicObject(); final SvgGraphics svg = getGraphicObject();
svg.paintBackcolorGradient(colorMapper, (HColorGradient) defaultBackground); svg.paintBackcolorGradient(colorMapper, (HColorGradient) defaultBackground);