mirror of
https://github.com/octoleo/plantuml.git
synced 2024-12-22 10:59:01 +00:00
Version 1.2022.3
This commit is contained in:
parent
b38adcfcdc
commit
a5fe482b59
@ -432,6 +432,12 @@ timingDiagram {
|
||||
LineThickness 2
|
||||
BackgroundColor: var(--grey-blue);
|
||||
}
|
||||
binary {
|
||||
FontStyle plain
|
||||
FontSize 12
|
||||
LineColor darkgreen
|
||||
LineThickness 2
|
||||
}
|
||||
highlight {
|
||||
BackgroundColor #e
|
||||
LineThickness 2
|
||||
|
@ -50,7 +50,9 @@ abstract class MonoSwimable extends WithNote implements Swimable {
|
||||
}
|
||||
|
||||
final public Set<Swimlane> getSwimlanes() {
|
||||
return swimlane == null ? Collections.emptySet() : Collections.<Swimlane>singleton(swimlane);
|
||||
if (swimlane == null)
|
||||
return Collections.emptySet();
|
||||
return Collections.<Swimlane>singleton(swimlane);
|
||||
}
|
||||
|
||||
final public Swimlane getSwimlaneIn() {
|
||||
|
@ -42,6 +42,7 @@ import net.sourceforge.plantuml.graphic.AbstractTextBlock;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class TextBlockInterceptorUDrawable extends AbstractTextBlock implements TextBlock {
|
||||
|
||||
@ -52,10 +53,14 @@ public class TextBlockInterceptorUDrawable extends AbstractTextBlock implements
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
new UGraphicInterceptorUDrawable2(ug, new HashMap<>()).draw(textBlock);
|
||||
new UGraphicInterceptorUDrawable2(ug, emptyHashMap()).draw(textBlock);
|
||||
ug.flushUg();
|
||||
}
|
||||
|
||||
private HashMap<String, UTranslate> emptyHashMap() {
|
||||
return new HashMap<>();
|
||||
}
|
||||
|
||||
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ final public class UmlSource {
|
||||
}
|
||||
|
||||
public static UmlSource create(List<StringLocated> source, boolean checkEndingBackslash) {
|
||||
return createWithRaw(source, checkEndingBackslash, new ArrayList<>());
|
||||
return createWithRaw(source, checkEndingBackslash, emptyArrayList());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -109,11 +109,15 @@ final public class UmlSource {
|
||||
*/
|
||||
public static UmlSource createWithRaw(List<StringLocated> source, boolean checkEndingBackslash,
|
||||
List<StringLocated> rawSource) {
|
||||
final UmlSource result = new UmlSource(new ArrayList<StringLocated>(), rawSource);
|
||||
final UmlSource result = new UmlSource(emptyArrayList(), rawSource);
|
||||
result.loadInternal(source, checkEndingBackslash);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static ArrayList<StringLocated> emptyArrayList() {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
private void loadInternal(List<StringLocated> source, boolean checkEndingBackslash) {
|
||||
if (checkEndingBackslash) {
|
||||
final StringBuilder pending = new StringBuilder();
|
||||
|
@ -292,6 +292,9 @@ public class FromSkinparamToStyle {
|
||||
} else if (read.startsWith("line.dashed")) {
|
||||
for (Data data : datas)
|
||||
addStyle(PName.LineStyle, ValueImpl.regular("7;7", counter), data.styleNames);
|
||||
} else if (read.toLowerCase().contains("bold")) {
|
||||
for (Data data : datas)
|
||||
addStyle(PName.LineThickness, ValueImpl.regular("2", counter), data.styleNames);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,7 @@ public enum SName {
|
||||
archimate, //
|
||||
arrow, //
|
||||
artifact, //
|
||||
binary, //
|
||||
boundary, //
|
||||
box, //
|
||||
boxless, //
|
||||
|
@ -43,32 +43,44 @@ import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.UseStyle;
|
||||
import net.sourceforge.plantuml.command.Position;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.SymbolContext;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.style.PName;
|
||||
import net.sourceforge.plantuml.style.SName;
|
||||
import net.sourceforge.plantuml.style.Style;
|
||||
import net.sourceforge.plantuml.style.StyleSignatureBasic;
|
||||
import net.sourceforge.plantuml.timingdiagram.graphic.IntricatedPoint;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.ULine;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
|
||||
|
||||
public class PlayerBinary extends Player {
|
||||
|
||||
private static final String LOW_STRING = "0";
|
||||
private static final String HIGH_STRING = "1";
|
||||
|
||||
private final List<TimeConstraint> constraints = new ArrayList<>();
|
||||
private final SortedMap<TimeTick, Boolean> values = new TreeMap<TimeTick, Boolean>();
|
||||
private Boolean initialState;
|
||||
private final SortedMap<TimeTick, ChangeState> values = new TreeMap<>();
|
||||
private ChangeState initialState;
|
||||
private final Style style;
|
||||
|
||||
public PlayerBinary(String code, ISkinParam skinParam, TimingRuler ruler, boolean compact) {
|
||||
super(code, skinParam, ruler, compact);
|
||||
this.style = getStyleSignature().getMergedStyle(skinParam.getCurrentStyleBuilder());
|
||||
this.suggestedHeight = 30;
|
||||
}
|
||||
|
||||
@ -82,18 +94,28 @@ public class PlayerBinary extends Player {
|
||||
|
||||
@Override
|
||||
protected StyleSignatureBasic getStyleSignature() {
|
||||
return StyleSignatureBasic.of(SName.root, SName.element, SName.timingDiagram, SName.clock);
|
||||
return StyleSignatureBasic.of(SName.root, SName.element, SName.timingDiagram, SName.binary);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SymbolContext getContextLegacy() {
|
||||
return new SymbolContext(HColorUtils.COL_D7E0F2, HColorUtils.COL_038048).withStroke(new UStroke(1.5));
|
||||
|
||||
if (UseStyle.useBetaStyle() == false)
|
||||
return new SymbolContext(HColorUtils.COL_D7E0F2, HColorUtils.COL_038048).withStroke(new UStroke(2));
|
||||
|
||||
final HColor lineColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(),
|
||||
skinParam.getIHtmlColorSet());
|
||||
final HColor backgroundColor = style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(),
|
||||
skinParam.getIHtmlColorSet());
|
||||
|
||||
return new SymbolContext(backgroundColor, lineColor).withStroke(getStroke());
|
||||
|
||||
}
|
||||
|
||||
public IntricatedPoint getTimeProjection(StringBounder stringBounder, TimeTick tick) {
|
||||
final double x = ruler.getPosInPixel(tick);
|
||||
return new IntricatedPoint(new Point2D.Double(x, getYpos(stringBounder, false)),
|
||||
new Point2D.Double(x, getYpos(stringBounder, true)));
|
||||
return new IntricatedPoint(new Point2D.Double(x, getYpos(stringBounder, HIGH_STRING)),
|
||||
new Point2D.Double(x, getYpos(stringBounder, HIGH_STRING)));
|
||||
}
|
||||
|
||||
public void addNote(TimeTick now, Display note, Position position) {
|
||||
@ -105,16 +127,18 @@ public class PlayerBinary extends Player {
|
||||
}
|
||||
|
||||
public void setState(TimeTick now, String comment, Colors color, String... states) {
|
||||
final boolean state = getState(states[0]);
|
||||
if (now == null) {
|
||||
this.initialState = state;
|
||||
} else {
|
||||
this.values.put(now, state);
|
||||
}
|
||||
final ChangeState cs = new ChangeState(now, comment, color, convert(states[0]));
|
||||
if (now == null)
|
||||
this.initialState = cs;
|
||||
else
|
||||
this.values.put(now, cs);
|
||||
|
||||
}
|
||||
|
||||
private boolean getState(String value) {
|
||||
return "1".equals(value) || "high".equalsIgnoreCase(value);
|
||||
private String[] convert(String value) {
|
||||
if ("1".equals(value) || "high".equalsIgnoreCase(value))
|
||||
return new String[] { HIGH_STRING };
|
||||
return new String[] { LOW_STRING };
|
||||
}
|
||||
|
||||
public void createConstraint(TimeTick tick1, TimeTick tick2, String message) {
|
||||
@ -123,8 +147,10 @@ public class PlayerBinary extends Player {
|
||||
|
||||
private final double ymargin = 8;
|
||||
|
||||
private double getYpos(StringBounder stringBounder, boolean state) {
|
||||
return state ? getYhigh(stringBounder) : getYlow(stringBounder);
|
||||
private double getYpos(StringBounder stringBounder, String state) {
|
||||
if (state.equalsIgnoreCase(LOW_STRING))
|
||||
return getYlow(stringBounder);
|
||||
return getYhigh(stringBounder);
|
||||
}
|
||||
|
||||
private double getYlow(StringBounder stringBounder) {
|
||||
@ -158,17 +184,25 @@ public class PlayerBinary extends Player {
|
||||
public void drawU(UGraphic ug) {
|
||||
ug = getContext().apply(ug);
|
||||
double lastx = 0;
|
||||
boolean lastValue = initialState == null ? false : initialState;
|
||||
String lastValue = initialState == null ? LOW_STRING : initialState.getState();
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final ULine vline = ULine.vline(getYlow(stringBounder) - getYhigh(stringBounder));
|
||||
for (Map.Entry<TimeTick, Boolean> ent : values.entrySet()) {
|
||||
for (Map.Entry<TimeTick, ChangeState> ent : values.entrySet()) {
|
||||
final ChangeState value = ent.getValue();
|
||||
final double x = ruler.getPosInPixel(ent.getKey());
|
||||
|
||||
ug.apply(new UTranslate(lastx, getYpos(stringBounder, lastValue))).draw(ULine.hline(x - lastx));
|
||||
if (lastValue != ent.getValue()) {
|
||||
if (lastValue.equalsIgnoreCase(value.getState()) == false)
|
||||
ug.apply(new UTranslate(x, getYhigh(stringBounder))).draw(vline);
|
||||
|
||||
if (value.getComment() != null) {
|
||||
final TextBlock label = getTextBlock(value.getComment());
|
||||
// final Dimension2D dim = label.calculateDimension(ug.getStringBounder());
|
||||
label.drawU(ug.apply(new UTranslate(x + 2, getYhigh(stringBounder))));
|
||||
}
|
||||
|
||||
lastx = x;
|
||||
lastValue = ent.getValue();
|
||||
lastValue = value.getState();
|
||||
}
|
||||
ug.apply(new UTranslate(lastx, getYpos(stringBounder, lastValue)))
|
||||
.draw(ULine.hline(ruler.getWidth() - lastx));
|
||||
@ -179,6 +213,18 @@ public class PlayerBinary extends Player {
|
||||
};
|
||||
}
|
||||
|
||||
final protected FontConfiguration getCommentFontConfiguration() {
|
||||
if (UseStyle.useBetaStyle() == false)
|
||||
return FontConfiguration.create(skinParam, FontParam.TIMING, null);
|
||||
return FontConfiguration.create(skinParam,
|
||||
getStyleSignature().getMergedStyle(skinParam.getCurrentStyleBuilder()));
|
||||
}
|
||||
|
||||
private TextBlock getTextBlock(String value) {
|
||||
final Display display = Display.getWithNewlines(value);
|
||||
return display.create(getCommentFontConfiguration(), HorizontalAlignment.LEFT, skinParam);
|
||||
}
|
||||
|
||||
private void drawConstraints(final UGraphic ug) {
|
||||
for (TimeConstraint constraint : constraints) {
|
||||
constraint.drawU(ug, ruler);
|
||||
|
@ -34,7 +34,6 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.timingdiagram.graphic;
|
||||
|
||||
import net.sourceforge.plantuml.awt.geom.Dimension2D;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@ -46,6 +45,7 @@ import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.UseStyle;
|
||||
import net.sourceforge.plantuml.awt.geom.Dimension2D;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
@ -56,9 +56,7 @@ import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.style.PName;
|
||||
import net.sourceforge.plantuml.style.SName;
|
||||
import net.sourceforge.plantuml.style.Style;
|
||||
import net.sourceforge.plantuml.style.StyleSignatureBasic;
|
||||
import net.sourceforge.plantuml.timingdiagram.ChangeState;
|
||||
import net.sourceforge.plantuml.timingdiagram.TimeConstraint;
|
||||
import net.sourceforge.plantuml.timingdiagram.TimeTick;
|
||||
|
@ -44,7 +44,7 @@ public class Version {
|
||||
private static final int MAJOR_SEPARATOR = 1000000;
|
||||
|
||||
public static int version() {
|
||||
return 1202202;
|
||||
return 1202203;
|
||||
}
|
||||
|
||||
public static int versionPatched() {
|
||||
@ -80,7 +80,7 @@ public class Version {
|
||||
}
|
||||
|
||||
public static int beta() {
|
||||
final int beta = 4;
|
||||
final int beta = 0;
|
||||
return beta;
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ public class Version {
|
||||
}
|
||||
|
||||
public static long compileTime() {
|
||||
return 1646497819191L;
|
||||
return 1648570257787L;
|
||||
}
|
||||
|
||||
public static String compileTimeString() {
|
||||
|
Loading…
Reference in New Issue
Block a user