1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-12-22 10:59:01 +00:00

Fix background color for MinMapDiagram

This commit is contained in:
Arnaud Roques 2021-03-09 19:02:38 +01:00
parent 89c170d3ae
commit bedbe1036b
8 changed files with 58 additions and 36 deletions

View File

@ -171,7 +171,15 @@ public class Run {
dir = f;
}
}
new MainWindow2(option, dir);
try {
new MainWindow2(option, dir);
} catch (java.awt.HeadlessException e) {
System.err.println("There is an issue with your server. You will find some tips here:");
System.err.println("https://forum.plantuml.net/3399/problem-with-x11-and-headless-exception");
System.err.println("https://plantuml.com/en/faq#239d64f675c3e515");
throw e;
}
} else if (option.isPipe() || option.isPipeMap() || option.isSyntax()) {
managePipe(option, error);
forceQuit = true;

View File

@ -35,9 +35,9 @@
*/
package net.sourceforge.plantuml.command;
import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.TitledDiagram;
public class CommandAffineTransformMultiline extends CommandMultilines<UmlDiagram> {
public class CommandAffineTransformMultiline extends CommandMultilines<TitledDiagram> {
public CommandAffineTransformMultiline() {
super("(?i)^!transformation[%s]+\\{[%s]*$");
@ -48,7 +48,7 @@ public class CommandAffineTransformMultiline extends CommandMultilines<UmlDiagra
return "(?i)^[%s]*!\\}[%s]*$";
}
public CommandExecutionResult execute(final UmlDiagram diagram, BlocLines lines) {
public CommandExecutionResult execute(final TitledDiagram diagram, BlocLines lines) {
// lines = lines.subExtract(1, 1);
// diagram.setAnimation(lines);
return CommandExecutionResult.error("Not yet implemented");

View File

@ -123,6 +123,7 @@ public final class EntityFactory {
final USymbol symbol = g.getUSymbol();
folder.setUSymbol(symbol);
folder.setStereotype(g.getStereotype());
folder.setColors(g.getColors(skinParam));
if (g.getUrl99() != null) {
folder.addUrl(g.getUrl99());
}

View File

@ -98,7 +98,9 @@ public class CommandLinkElement extends SingleLineCommand2<DescriptionDiagram> {
color().getRegex(), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), new RegexLeaf("LABEL_LINK", "(?::[%s]*(.+))?"), RegexLeaf.end());
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("LABEL_LINK", "(?::[%s]*(.+))?"), //
RegexLeaf.end());
}
private static ColorParser color() {

View File

@ -56,10 +56,7 @@ import net.sourceforge.plantuml.graphic.InnerStrategy;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.style.NoStyleAvailableException;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleBuilder;
import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.svek.TextBlockBackcolored;
import net.sourceforge.plantuml.ugraphic.ImageBuilder;
import net.sourceforge.plantuml.ugraphic.ImageParameter;
@ -93,18 +90,11 @@ public class MindMapDiagram extends UmlDiagram {
final Scale scale = getScale();
final double dpiFactor = scale == null ? getScaleCoef(fileFormatOption) : scale.getScale(100, 100);
final ISkinParam skinParam = getSkinParam();
final Style style = StyleSignature.of(SName.root, SName.document, SName.mindmapDiagram)
.getMergedStyle(skinParam.getCurrentStyleBuilder());
final ImageParameter imageParameter = new ImageParameter(this,
fileFormatOption, null, dpiFactor, "");
final ImageParameter imageParameter = new ImageParameter(this, fileFormatOption, null, dpiFactor, "");
final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter);
TextBlock result = getTextBlock();
result = new AnnotatedWorker(this, skinParam, fileFormatOption.getDefaultStringBounder(getSkinParam()))
result = new AnnotatedWorker(this, getSkinParam(), fileFormatOption.getDefaultStringBounder(getSkinParam()))
.addAdd(result);
imageBuilder.setUDrawable(result);

View File

@ -147,7 +147,7 @@ public class Line implements Moveable, Hideable, GuideLine {
private HColor arrowLollipopColor;
private final ISkinParam skinParam;
// private final UmlDiagramType umlType;
private final double labelShield;
@Override
public String toString() {
@ -304,6 +304,12 @@ public class Line implements Moveable, Hideable, GuideLine {
skinParam);
}
if (link.getType().getMiddleDecor() == LinkMiddleDecor.NONE) {
this.labelShield = 0;
} else {
this.labelShield = 7;
}
}
private TextBlock addVisibilityModifier(TextBlock block, Link link, ISkinParam skinParam) {
@ -376,8 +382,9 @@ public class Line implements Moveable, Hideable, GuideLine {
} else {
sb.append("label=<");
}
final Dimension2D dimNote = hasNoteLabelText() ? labelText.calculateDimension(stringBounder)
: CONSTRAINT_SPOT;
Dimension2D dimNote = hasNoteLabelText() ? labelText.calculateDimension(stringBounder) : CONSTRAINT_SPOT;
dimNote = Dimension2DDouble.delta(dimNote, 2 * labelShield);
appendTable(sb, eventuallyDivideByTwo(dimNote), noteLabelColor, graphvizVersion);
sb.append(">");
}
@ -711,8 +718,8 @@ public class Line implements Moveable, Hideable, GuideLine {
if (hasNoteLabelText() && this.labelXY != null
&& link.getNoteLinkStrategy() != NoteLinkStrategy.HALF_NOT_PRINTED) {
this.labelText.drawU(ug.apply(
new UTranslate(x + this.labelXY.getPosition().getX(), y + this.labelXY.getPosition().getY())));
this.labelText.drawU(ug.apply(new UTranslate(x + this.labelXY.getPosition().getX() + labelShield,
y + this.labelXY.getPosition().getY() + labelShield)));
}
if (this.startTailText != null && this.startTailLabelXY != null
&& this.startTailLabelXY.getPosition() != null) {

View File

@ -53,6 +53,7 @@ import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.svg.LengthAdjust;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
public class ImageParameter {
@ -93,20 +94,32 @@ public class ImageParameter {
this.fileFormatOption = null;
}
public ImageParameter(TitledDiagram diagram, FileFormatOption fileFormatOption, Animation animation, double dpiFactor, String warningOrError) {
this(
diagram,
fileFormatOption,
animation,
dpiFactor,
fileFormatOption.isWithMetadata() ? diagram.getMetadata() : null,
warningOrError,
diagram.getSkinParam().getBackgroundColor(false)
);
public ImageParameter(TitledDiagram diagram, FileFormatOption fileFormatOption, Animation animation,
double dpiFactor, String warningOrError) {
this(diagram, fileFormatOption, animation, dpiFactor,
fileFormatOption.isWithMetadata() ? diagram.getMetadata() : null, warningOrError,
getBackgroundColor(diagram));
}
public ImageParameter(TitledDiagram diagram, FileFormatOption fileFormatOption, Animation animation, double dpiFactor, String metadata,
String warningOrError, HColor backcolor) {
private static HColor getBackgroundColor(TitledDiagram diagram) {
if (UseStyle.useBetaStyle()) {
final Style style = StyleSignature
.of(SName.root, SName.document, diagram.getUmlDiagramType().getStyleName())
.getMergedStyle(diagram.getSkinParam().getCurrentStyleBuilder());
HColor backgroundColor = style.value(PName.BackGroundColor)
.asColor(diagram.getSkinParam().getIHtmlColorSet());
if (backgroundColor == null) {
backgroundColor = HColorUtils.transparent();
}
return backgroundColor;
}
return diagram.getSkinParam().getBackgroundColor(false);
}
public ImageParameter(TitledDiagram diagram, FileFormatOption fileFormatOption, Animation animation,
double dpiFactor, String metadata, String warningOrError, HColor backcolor) {
final ISkinParam skinParam = diagram.getSkinParam();
this.fileFormatOption = fileFormatOption;
this.colorMapper = skinParam.getColorMapper();
@ -196,7 +209,8 @@ public class ImageParameter {
private static ClockwiseTopRightBottomLeft calculateDiagramMargin(TitledDiagram diagram) {
if (UseStyle.useBetaStyle()) {
final Style style = StyleSignature.of(SName.root, SName.document).getMergedStyle(diagram.getSkinParam().getCurrentStyleBuilder());
final Style style = StyleSignature.of(SName.root, SName.document)
.getMergedStyle(diagram.getSkinParam().getCurrentStyleBuilder());
if (style.hasValue(PName.Margin)) {
return style.getMargin();
}

View File

@ -80,7 +80,7 @@ public class Version {
}
public static int beta() {
final int beta = 0;
final int beta = 2;
return beta;
}