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

Merge pull request #1490 from travkin79/patch/1467

Patch #1467
This commit is contained in:
PlantUML 2023-07-24 17:16:53 +02:00 committed by GitHub
commit f28738eb9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,6 +41,7 @@ import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.abel.Entity; import net.sourceforge.plantuml.abel.Entity;
import net.sourceforge.plantuml.abel.EntityPosition; import net.sourceforge.plantuml.abel.EntityPosition;
import net.sourceforge.plantuml.abel.Hideable; import net.sourceforge.plantuml.abel.Hideable;
import net.sourceforge.plantuml.abel.Link;
import net.sourceforge.plantuml.abel.Together; import net.sourceforge.plantuml.abel.Together;
import net.sourceforge.plantuml.klimt.Shadowable; import net.sourceforge.plantuml.klimt.Shadowable;
import net.sourceforge.plantuml.klimt.UTranslate; import net.sourceforge.plantuml.klimt.UTranslate;
@ -145,7 +146,7 @@ public class SvekNode implements Positionable, Hideable {
SvekUtils.println(sb); SvekUtils.println(sb);
return; return;
} }
if (type == ShapeType.RECTANGLE && shield().isZero() == false) { if (type == ShapeType.RECTANGLE && isShielded()) {
appendHtml(sb); appendHtml(sb);
SvekUtils.println(sb); SvekUtils.println(sb);
return; return;
@ -222,7 +223,7 @@ public class SvekNode implements Positionable, Hideable {
private Margins shield() { private Margins shield() {
if (shield == null) { if (shield == null) {
this.shield = image.getShield(stringBounder); this.shield = image.getShield(stringBounder);
if (shield.isZero() == false && type != ShapeType.RECTANGLE && type != ShapeType.RECTANGLE_HTML_FOR_PORTS if (!shield.isZero() && type != ShapeType.RECTANGLE && type != ShapeType.RECTANGLE_HTML_FOR_PORTS
&& type != ShapeType.RECTANGLE_WITH_CIRCLE_INSIDE) && type != ShapeType.RECTANGLE_WITH_CIRCLE_INSIDE)
throw new IllegalStateException(); throw new IllegalStateException();
} }
@ -325,7 +326,7 @@ public class SvekNode implements Positionable, Hideable {
} }
private void appendShapeInternal(StringBuilder sb) { private void appendShapeInternal(StringBuilder sb) {
if (type == ShapeType.RECTANGLE && shield().isZero() == false) if (type == ShapeType.RECTANGLE && isShielded())
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
else if (type == ShapeType.RECTANGLE || type == ShapeType.RECTANGLE_WITH_CIRCLE_INSIDE else if (type == ShapeType.RECTANGLE || type == ShapeType.RECTANGLE_WITH_CIRCLE_INSIDE
|| type == ShapeType.FOLDER) || type == ShapeType.FOLDER)
@ -382,17 +383,22 @@ public class SvekNode implements Positionable, Hideable {
public boolean isShielded() { public boolean isShielded() {
if (this.shield != null) { if (this.shield != null) {
return this.shield.isZero() == false; return !this.shield.isZero();
} }
// Avoid calculating "shield" size through this.shield() before finishing creation of all SvekLines (#1467) // Avoid calculating "shield" size through this.shield() before finishing creation of all SvekLines (#1467)
// Instead, only check if we will have a shield (size is irrelevant here) // Instead, only check if we will have a shield (size is irrelevant here)
// This node will have a shield if it is target of a qualified association (will have a qualifier label // This node will have a shield if it is target of a qualified association (will have a qualifier label
// placed besides this type's bounding box.) // placed besides this type's bounding box.)
return this.leaf.getDiagram().getLinks().stream() for (Link link: this.leaf.getDiagram().getLinks()) {
.filter(link -> link.getEntity1() == this.leaf || link.getEntity2() == this.leaf) if (link.getEntity1() == this.leaf || link.getEntity2() == this.leaf) {
.anyMatch(link -> (this.leaf == link.getEntity1() && link.hasKal1()) if ((this.leaf == link.getEntity1() && link.hasKal1())
|| (this.leaf == link.getEntity2() && link.hasKal2())); || (this.leaf == link.getEntity2() && link.hasKal2())) {
return true;
}
}
}
return false;
} }
public void resetMoveSvek() { public void resetMoveSvek() {