diff --git a/src/net/sourceforge/plantuml/abel/Link.java b/src/net/sourceforge/plantuml/abel/Link.java index bffd58234..468351a04 100644 --- a/src/net/sourceforge/plantuml/abel/Link.java +++ b/src/net/sourceforge/plantuml/abel/Link.java @@ -59,6 +59,7 @@ import net.sourceforge.plantuml.style.ISkinSimple; import net.sourceforge.plantuml.style.StyleBuilder; import net.sourceforge.plantuml.svek.Bibliotekon; import net.sourceforge.plantuml.url.Url; +import net.sourceforge.plantuml.utils.Direction; import net.sourceforge.plantuml.utils.LineLocation; public class Link extends WithLinkType implements Hideable, Removeable { @@ -541,4 +542,11 @@ public class Link extends WithLinkType implements Hideable, Removeable { return opale; } + public final boolean hasKal1() { + return this.linkArg.getKal1() != null && !this.linkArg.getKal1().isEmpty(); + } + + public final boolean hasKal2() { + return this.linkArg.getKal2() != null && !this.linkArg.getKal2().isEmpty(); + } } diff --git a/src/net/sourceforge/plantuml/abel/LinkArg.java b/src/net/sourceforge/plantuml/abel/LinkArg.java index a02181034..df5d0a5e9 100644 --- a/src/net/sourceforge/plantuml/abel/LinkArg.java +++ b/src/net/sourceforge/plantuml/abel/LinkArg.java @@ -103,8 +103,8 @@ public class LinkArg { } public LinkArg getInv() { - return new LinkArg(label, length, quantifier2, quantifier1, labeldistance, labelangle, visibilityModifier, kal1, - kal2); + return new LinkArg(label, length, quantifier2, quantifier1, labeldistance, labelangle, visibilityModifier, kal2, + kal1); } public final Display getLabel() { diff --git a/src/net/sourceforge/plantuml/svek/Kal.java b/src/net/sourceforge/plantuml/svek/Kal.java index 94df3f10b..05b9426fd 100644 --- a/src/net/sourceforge/plantuml/svek/Kal.java +++ b/src/net/sourceforge/plantuml/svek/Kal.java @@ -83,11 +83,11 @@ public class Kal implements UDrawable { } else if (link.getEntity1() == entity) { this.position = Direction.DOWN; - entity.ensureMargins(new Margins(0, 0, dim.getHeight(), 0)); + entity.ensureMargins(new Margins(0, 0, 0, dim.getHeight())); } else if (link.getEntity2() == entity) { this.position = Direction.UP; - entity.ensureMargins(new Margins(0, 0, 0, dim.getHeight())); + entity.ensureMargins(new Margins(0, 0, dim.getHeight(),0 )); } else { throw new IllegalStateException(); diff --git a/src/net/sourceforge/plantuml/svek/SvekNode.java b/src/net/sourceforge/plantuml/svek/SvekNode.java index 23ead13eb..722d7963c 100644 --- a/src/net/sourceforge/plantuml/svek/SvekNode.java +++ b/src/net/sourceforge/plantuml/svek/SvekNode.java @@ -5,12 +5,12 @@ * (C) Copyright 2009-2024, Arnaud Roques * * Project Info: https://plantuml.com - * + * * If you like this project or if you find it useful, you can support us at: - * + * * https://plantuml.com/patreon (only 1$ per month!) * https://plantuml.com/paypal - * + * * This file is part of PlantUML. * * PlantUML is free software; you can redistribute it and/or modify it @@ -31,7 +31,7 @@ * * Original Author: Arnaud Roques * - * + * */ package net.sourceforge.plantuml.svek; @@ -381,7 +381,18 @@ public class SvekNode implements Positionable, Hideable { } public boolean isShielded() { - return shield().isZero() == false; + if (this.shield != null) { + return this.shield.isZero() == false; + } + + // 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) + // 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.) + return this.leaf.getDiagram().getLinks().stream() + .filter(link -> link.getEntity1() == this.leaf || link.getEntity2() == this.leaf) + .anyMatch(link -> (this.leaf == link.getEntity1() && link.hasKal1()) + || (this.leaf == link.getEntity2() && link.hasKal2())); } public void resetMoveSvek() {