1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-25 14:27:33 +00:00

fix: allow notes with ELK

https://github.com/plantuml/plantuml/issues/1331
This commit is contained in:
Arnaud Roques 2023-03-17 22:53:25 +01:00
parent 89ff4699a0
commit 7447766553
2 changed files with 8 additions and 37 deletions

View File

@ -62,7 +62,6 @@ import h.ST_GVC_s;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.abel.CucaNote;
import net.sourceforge.plantuml.abel.Entity;
import net.sourceforge.plantuml.abel.GroupType;
import net.sourceforge.plantuml.abel.LeafType;
@ -80,7 +79,6 @@ import net.sourceforge.plantuml.klimt.font.StringBounder;
import net.sourceforge.plantuml.klimt.geom.HorizontalAlignment;
import net.sourceforge.plantuml.klimt.geom.MinMaxMutable;
import net.sourceforge.plantuml.klimt.geom.Rankdir;
import net.sourceforge.plantuml.klimt.geom.VerticalAlignment;
import net.sourceforge.plantuml.klimt.geom.XDimension2D;
import net.sourceforge.plantuml.klimt.geom.XPoint2D;
import net.sourceforge.plantuml.klimt.shape.AbstractTextBlock;
@ -100,8 +98,6 @@ import net.sourceforge.plantuml.svek.GeneralImageBuilder;
import net.sourceforge.plantuml.svek.GraphvizCrash;
import net.sourceforge.plantuml.svek.IEntityImage;
import net.sourceforge.plantuml.svek.SvekNode;
import net.sourceforge.plantuml.svek.image.EntityImageNoteLink;
import net.sourceforge.plantuml.utils.Position;
import smetana.core.CString;
import smetana.core.Globals;
import smetana.core.JUtils;
@ -465,32 +461,16 @@ public class CucaDiagramFileMakerSmetana implements CucaDiagramFileMaker {
}
private TextBlock getLabel(Link link) {
ISkinParam skinParam = diagram.getSkinParam();
final double marginLabel = 1; // startUid.equals(endUid) ? 6 : 1;
ISkinParam skinParam = diagram.getSkinParam();
final Style style = getStyle();
final FontConfiguration labelFont = style.getFontConfiguration(skinParam.getIHtmlColorSet());
TextBlock labelOnly = link.getLabel().create(labelFont,
final TextBlock label = link.getLabel().create(labelFont,
skinParam.getDefaultTextAlignment(HorizontalAlignment.CENTER), skinParam);
if (TextBlockUtils.isEmpty(label, stringBounder))
return label;
final CucaNote note = link.getNote();
if (note == null) {
if (TextBlockUtils.isEmpty(labelOnly, stringBounder) == false)
labelOnly = TextBlockUtils.withMargin(labelOnly, marginLabel, marginLabel);
return labelOnly;
}
final TextBlock noteOnly = new EntityImageNoteLink(note.getDisplay(), note.getColors(), skinParam,
link.getStyleBuilder());
if (note.getPosition() == Position.LEFT)
return TextBlockUtils.mergeLR(noteOnly, labelOnly, VerticalAlignment.CENTER);
else if (note.getPosition() == Position.RIGHT)
return TextBlockUtils.mergeLR(labelOnly, noteOnly, VerticalAlignment.CENTER);
else if (note.getPosition() == Position.TOP)
return TextBlockUtils.mergeTB(noteOnly, labelOnly, HorizontalAlignment.CENTER);
else
return TextBlockUtils.mergeTB(labelOnly, noteOnly, HorizontalAlignment.CENTER);
return TextBlockUtils.withMargin(label, marginLabel, marginLabel);
}
private TextBlock getQuantifier(Link link, int n) {

View File

@ -46,7 +46,7 @@ import java.util.StringTokenizer;
import net.sourceforge.plantuml.stereo.StereotypeDecoration;
public class FromSkinparamToStyle {
// ::remove file when __HAXE__
// ::remove file when __HAXE__
static class Data {
final private SName[] styleNames;
@ -181,17 +181,8 @@ public class FromSkinparamToStyle {
addConvert("classBackgroundColor", PName.BackGroundColor, SName.element, SName.class_);
addConvert("classBorderColor", PName.LineColor, SName.element, SName.class_);
addConvert("classFontSize", PName.FontSize, SName.element, SName.class_, SName.header);
addConvert("classFontStyle", PName.FontStyle, SName.element, SName.class_, SName.header);
addConvert("classFontColor", PName.FontColor, SName.element, SName.class_, SName.header);
addConvert("classFontName", PName.FontName, SName.element, SName.class_, SName.header);
addConvert("classAttributeFontSize", PName.FontSize, SName.element, SName.class_);
addConvert("classAttributeFontStyle", PName.FontStyle, SName.element, SName.class_);
addConvert("classAttributeFontColor", PName.FontColor, SName.element, SName.class_);
addConvert("classAttributeFontName", PName.FontName, SName.element, SName.class_);
addConFont("class", SName.element, SName.class_);
addConFont("classAttribute", SName.element, SName.class_);
addConvert("classBorderThickness", PName.LineThickness, SName.element, SName.class_);
addConvert("classHeaderBackgroundColor", PName.BackGroundColor, SName.element, SName.class_, SName.header);