1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-12-22 02:49:06 +00:00

Merge pull request #1509 from DRKV333/master

Fixed nested togethers not working
This commit is contained in:
PlantUML 2023-08-04 09:18:41 +02:00 committed by GitHub
commit a27ff9b7f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -485,7 +485,7 @@ public class Cluster implements Moveable {
private int togetherCounter = 0;
private void printTogether(Together together, StringBuilder sb, List<SvekNode> nodesOrderedWithoutTop,
private void printTogether(Together together, Collection<Together> otherTogethers, StringBuilder sb, List<SvekNode> nodesOrderedWithoutTop,
StringBounder stringBounder, Collection<SvekLine> lines, DotMode dotMode, GraphvizVersion graphvizVersion,
UmlDiagramType type) {
sb.append("subgraph " + getClusterId() + "t" + togetherCounter + " {\n");
@ -497,6 +497,10 @@ public class Cluster implements Moveable {
if (child.group.getTogether() == together)
child.printInternal(sb, lines, stringBounder, dotMode, graphvizVersion, type);
for (Together otherTogether : otherTogethers)
if (otherTogether.getParent() == together)
printTogether(otherTogether, otherTogethers, sb, nodesOrderedWithoutTop, stringBounder, lines, dotMode, graphvizVersion, type);
sb.append("}\n");
togetherCounter++;
@ -513,16 +517,17 @@ public class Cluster implements Moveable {
if (together == null)
node.appendShape(sb, stringBounder);
else
togethers.add(together);
addTogetherWithParents(togethers, together);
added = node;
}
for (Cluster child : children)
if (child.group.getTogether() != null)
togethers.add(child.group.getTogether());
addTogetherWithParents(togethers, child.group.getTogether());
for (Together together : togethers)
printTogether(together, sb, nodesOrderedWithoutTop, stringBounder, lines, dotMode, graphvizVersion, type);
if (together.getParent() == null)
printTogether(together, togethers, sb, nodesOrderedWithoutTop, stringBounder, lines, dotMode, graphvizVersion, type);
if (skinParam.useRankSame() && dotMode != DotMode.NO_LEFT_RIGHT_AND_XLABEL
&& graphvizVersion.ignoreHorizontalLinks() == false)
@ -535,6 +540,14 @@ public class Cluster implements Moveable {
return added;
}
private static void addTogetherWithParents(Collection<Together> collection, Together together) {
Together t = together;
while (t != null) {
collection.add(t);
t = t.getParent();
}
}
public void printCluster3_forKermor(StringBuilder sb, Collection<SvekLine> lines, StringBounder stringBounder,
DotMode dotMode, GraphvizVersion graphvizVersion, UmlDiagramType type) {
final List<SvekNode> tmp = getNodes(EntityPosition.getNormals());