1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-21 20:45:10 +00:00

Adding awslib10 and awslib14

This commit is contained in:
Arnaud Roques 2022-11-17 18:56:16 +01:00
parent 97d3281ec3
commit 665cae15ba
20 changed files with 75 additions and 46 deletions

View File

@ -67,7 +67,7 @@ import net.sourceforge.plantuml.ugraphic.UImage;
public class AtomImg extends AbstractAtom implements Atom {
private static final String DATA_IMAGE_PNG_BASE64 = "data:image/png;base64,";
public static final String DATA_IMAGE_PNG_BASE64 = "data:image/png;base64,";
private static final String DATA_IMAGE_SVG_BASE64 = "data:image/svg+xml;base64,";
private final BufferedImage image;
private final double scale;

View File

@ -89,6 +89,8 @@ public class StereotypeDecoration {
new RegexLeaf("\\>\\>") //
);
public static final String PREFIX = "%";
final String label;
final HColor htmlColor;
final char character;
@ -101,13 +103,15 @@ public class StereotypeDecoration {
}
public List<String> getStyleNames() {
final List<String> result = new ArrayList<>(cutLabels(label, Guillemet.NONE));
final List<String> result = new ArrayList<>();
for (String s : cutLabels(label, Guillemet.NONE))
result.add(PREFIX + s);
if (spriteName == null)
return Collections.unmodifiableList(result);
final int idx = spriteName.lastIndexOf('/');
if (idx != -1)
result.add(spriteName.substring(idx + 1));
result.add(PREFIX + spriteName.substring(idx + 1));
return Collections.unmodifiableList(result);
}

View File

@ -64,22 +64,22 @@ class Idea {
final String depth = SName.depth(level);
if (level == 0)
return StyleSignatureBasic.of(SName.root, SName.element, SName.mindmapDiagram, SName.node, SName.rootNode)
.add(stereotype).add(depth);
.addS(stereotype).add(depth);
if (shape == IdeaShape.NONE && children.size() == 0)
return StyleSignatureBasic
.of(SName.root, SName.element, SName.mindmapDiagram, SName.node, SName.leafNode, SName.boxless)
.add(stereotype).add(depth);
.addS(stereotype).add(depth);
if (shape == IdeaShape.NONE)
return StyleSignatureBasic.of(SName.root, SName.element, SName.mindmapDiagram, SName.node, SName.boxless)
.add(stereotype).add(depth);
.addS(stereotype).add(depth);
if (children.size() == 0)
return StyleSignatureBasic.of(SName.root, SName.element, SName.mindmapDiagram, SName.node, SName.leafNode)
.add(stereotype).add(depth);
.addS(stereotype).add(depth);
return StyleSignatureBasic.of(SName.root, SName.element, SName.mindmapDiagram, SName.node).add(stereotype)
return StyleSignatureBasic.of(SName.root, SName.element, SName.mindmapDiagram, SName.node).addS(stereotype)
.add(depth);
}
@ -100,7 +100,7 @@ class Idea {
public Style getStyleArrow() {
final String depth = SName.depth(level);
final StyleSignatureBasic defaultStyleDefinitionArrow = StyleSignatureBasic
.of(SName.root, SName.element, SName.mindmapDiagram, SName.arrow).add(stereotype).add(depth);
.of(SName.root, SName.element, SName.mindmapDiagram, SName.arrow).addS(stereotype).add(depth);
return defaultStyleDefinitionArrow.getMergedStyle(styleBuilder);
}

View File

@ -43,6 +43,8 @@ import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import net.sourceforge.plantuml.cucadiagram.StereotypeDecoration;
public class FromSkinparamToStyle {
static class Data {
@ -223,7 +225,6 @@ public class FromSkinparamToStyle {
addConvert("MinClassWidth", PName.MinimumWidth);
// addConvert("nodeStereotypeFontSize", PName.FontSize, SName.node, SName.stereotype);
// addConvert("sequenceStereotypeFontSize", PName.FontSize, SName.stereotype);
// addConvert("sequenceStereotypeFontStyle", PName.FontStyle, SName.stereotype);
@ -356,7 +357,7 @@ public class FromSkinparamToStyle {
if (stereo != null) {
map = StyleLoader.addPriorityForStereotype(map);
for (String s : stereo.split("\\&"))
sig = sig.add(s);
sig = sig.add(StereotypeDecoration.PREFIX + s);
}
final Style style = new Style(sig, map);

View File

@ -130,6 +130,7 @@ public enum SName {
storage, //
swimlane, //
task, //
timegrid, //
timeline, //
timingDiagram, //
title, //

View File

@ -45,6 +45,7 @@ import java.util.Set;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.cucadiagram.Stereostyles;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.cucadiagram.StereotypeDecoration;
public class StyleSignatureBasic implements StyleSignature {
@ -94,6 +95,18 @@ public class StyleSignatureBasic implements StyleSignature {
return new StyleSignatureBasic(withDot || s.contains("."), result);
}
public StyleSignatureBasic addS(String s) {
if (s == null)
return this;
if (s.contains("&"))
throw new IllegalArgumentException();
final Set<String> result = new LinkedHashSet<>(names);
result.add(StereotypeDecoration.PREFIX + clean(s));
return new StyleSignatureBasic(withDot || s.contains("."), result);
}
public StyleSignatureBasic add(SName name) {
return add(name.name().toLowerCase().replace("_", ""));
}
@ -218,12 +231,15 @@ public class StyleSignatureBasic implements StyleSignature {
return this;
final List<String> result = new ArrayList<>(names);
for (String name : stereostyles.getStyleNames())
result.add(clean(name));
result.add(StereotypeDecoration.PREFIX + clean(name));
return new StyleSignatureBasic(true, result);
}
private String clean(String name) {
if (name.startsWith("."))
name = StereotypeDecoration.PREFIX + name;
return name.toLowerCase().replace("_", "").replace(".", "");
}

View File

@ -266,9 +266,9 @@ public class TContext {
try {
while ((s = it.peek()) != null) {
final TValue result = executeOneLineSafe(memory, s, ftype, modeSpecial);
if (result != null) {
if (result != null)
return result;
}
it.next();
}
return null;
@ -428,9 +428,9 @@ public class TContext {
// https://en.wikipedia.org/wiki/String-searching_algorithm
// https://www.quora.com/What-is-the-most-efficient-algorithm-to-replace-all-occurrences-of-a-pattern-P-in-a-string-with-a-pattern-P
// https://en.wikipedia.org/wiki/Trie
if (memory.isEmpty() && functionsSet.size() == 0) {
if (memory.isEmpty() && functionsSet.size() == 0)
return str;
}
final StringBuilder result = new StringBuilder();
for (int i = 0; i < str.length(); i++) {
final char c = str.charAt(i);

View File

@ -94,6 +94,9 @@ public class ShuntingYard {
} else if (token.getTokenType() == TokenType.OPEN_PAREN_MATH) {
operatorStack.addFirst(token);
} else if (token.getTokenType() == TokenType.CLOSE_PAREN_FUNC) {
while (operatorStack.peekFirst() != null
&& operatorStack.peekFirst().getTokenType() != TokenType.OPEN_PAREN_FUNC)
ouputQueue.add(operatorStack.removeFirst());
final Token first = operatorStack.removeFirst();
ouputQueue.add(first);
} else if (token.getTokenType() == TokenType.CLOSE_PAREN_MATH) {

View File

@ -60,15 +60,15 @@ public class Substr extends SimpleReturnFunction {
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
final String full = values.get(0).toString();
final int pos = values.get(1).toInt();
if (pos >= full.length()) {
if (pos >= full.length())
return TValue.fromString("");
}
String result = full.substring(pos);
if (values.size() == 3) {
final int len = values.get(2).toInt();
if (len < result.length()) {
if (len < result.length())
result = result.substring(0, len);
}
}
return TValue.fromString(result);
}

View File

@ -170,7 +170,7 @@ public class PlayerAnalog extends Player {
@Override
public void createConstraint(TimeTick tick1, TimeTick tick2, String message, ArrowConfiguration config) {
this.constraints.add(new TimeConstraint(tick1, tick2, message, skinParam, config));
this.constraints.add(new TimeConstraint(1, tick1, tick2, message, skinParam, config));
}
private double getYpos(StringBounder stringBounder, double value) {

View File

@ -128,7 +128,7 @@ public class PlayerBinary extends Player {
@Override
public void createConstraint(TimeTick tick1, TimeTick tick2, String message, ArrowConfiguration config) {
this.constraints.add(new TimeConstraint(tick1, tick2, message, skinParam, config));
this.constraints.add(new TimeConstraint(2.5, tick1, tick2, message, skinParam, config));
}
private final double ymargin = 8;

View File

@ -83,6 +83,12 @@ public final class PlayerRobustConcise extends Player {
this.suggestedHeight = 0;
}
@Override
public final void createConstraint(TimeTick tick1, TimeTick tick2, String message, ArrowConfiguration config) {
final double margin = type == TimingStyle.ROBUST ? 2.5 : 1;
this.constraints.add(new TimeConstraint(margin, tick1, tick2, message, skinParam, config));
}
@Override
protected StyleSignature getStyleSignature() {
if (type == TimingStyle.CONCISE)
@ -205,11 +211,6 @@ public final class PlayerRobustConcise extends Player {
return point.translated(translation);
}
@Override
public final void createConstraint(TimeTick tick1, TimeTick tick2, String message, ArrowConfiguration config) {
this.constraints.add(new TimeConstraint(tick1, tick2, message, skinParam, config));
}
public final void addNote(TimeTick now, Display note, Position position) {
final StyleSignatureBasic signature = StyleSignatureBasic.of(SName.root, SName.element, SName.timingDiagram,

View File

@ -52,7 +52,6 @@ import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleBuilder;
import net.sourceforge.plantuml.style.StyleSignatureBasic;
import net.sourceforge.plantuml.timingdiagram.graphic.TimeArrow;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.ULine;
import net.sourceforge.plantuml.ugraphic.UPolygon;
@ -68,9 +67,11 @@ public class TimeConstraint {
private final ISkinParam skinParam;
private final StyleBuilder styleBuilder;
private final ArrowConfiguration config;
private final double marginx;
public TimeConstraint(TimeTick tick1, TimeTick tick2, String label, ISkinParam skinParam,
public TimeConstraint(double marginx, TimeTick tick1, TimeTick tick2, String label, ISkinParam skinParam,
ArrowConfiguration config) {
this.marginx = marginx;
this.tick1 = Objects.requireNonNull(tick1);
this.tick2 = Objects.requireNonNull(tick2);
this.label = Display.getWithNewlines(label);
@ -106,8 +107,8 @@ public class TimeConstraint {
public void drawU(UGraphic ug, TimingRuler ruler) {
final HColor arrowColor = getArrowColor();
ug = ug.apply(arrowColor).apply(arrowColor.bg());
final double x1 = ruler.getPosInPixel(tick1);
final double x2 = ruler.getPosInPixel(tick2);
final double x1 = ruler.getPosInPixel(tick1) + marginx;
final double x2 = ruler.getPosInPixel(tick2) - marginx;
ug = ug.apply(UTranslate.dx(x1));
final double len = x2 - x1;
ug.apply(getUStroke()).draw(ULine.hline(len));

View File

@ -177,11 +177,12 @@ public class TimingRuler {
}
private FontConfiguration getFontConfiguration() {
return FontConfiguration.create(skinParam, getStyle());
private Style getStyleTimegrid() {
return StyleSignatureBasic.of(SName.root, SName.element, SName.timingDiagram, SName.timegrid)
.getMergedStyle(skinParam.getCurrentStyleBuilder());
}
private Style getStyle() {
private Style getStyleTimeline() {
return StyleSignatureBasic.of(SName.root, SName.element, SName.timingDiagram, SName.timeline)
.getMergedStyle(skinParam.getCurrentStyleBuilder());
}
@ -192,18 +193,19 @@ public class TimingRuler {
private TextBlock getTimeTextBlock(String string) {
final Display display = Display.getWithNewlines(string);
return display.create(getFontConfiguration(), HorizontalAlignment.LEFT, skinParam);
final FontConfiguration fontConfiguration = FontConfiguration.create(skinParam, getStyleTimeline());
return display.create(fontConfiguration, HorizontalAlignment.LEFT, skinParam);
}
public void drawTimeAxis(UGraphic ug, TimeAxisStategy timeAxisStategy, Map<String, TimeTick> codes) {
if (timeAxisStategy == TimeAxisStategy.HIDDEN)
return;
final Style style = StyleSignatureBasic.of(SName.root, SName.timingDiagram, SName.timeline)
.getMergedStyle(skinParam.getCurrentStyleBuilder());
final Style styleTimeline = getStyleTimeline();
final Style styleTimegrid = getStyleTimegrid();
final HColor color = style.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet());
final UStroke stroke = style.getStroke();
final HColor color = styleTimeline.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet());
final UStroke stroke = styleTimeline.getStroke();
ug = ug.apply(stroke).apply(color);
@ -291,7 +293,7 @@ public class TimingRuler {
}
public void drawVlines(UGraphic ug, double height) {
ug = applyForVLines(ug, getStyle(), skinParam);
ug = applyForVLines(ug, getStyleTimegrid(), skinParam);
final ULine line = ULine.vline(height);
final int nb = getNbTick();
for (int i = 0; i <= nb; i++)

View File

@ -70,22 +70,22 @@ final public class WElement {
final String depth = SName.depth(level);
if (level == 0)
return StyleSignatureBasic.of(SName.root, SName.element, SName.wbsDiagram, SName.node, SName.rootNode)
.add(stereotype).add(depth);
.addS(stereotype).add(depth);
if (shape == IdeaShape.NONE && isLeaf())
return StyleSignatureBasic
.of(SName.root, SName.element, SName.wbsDiagram, SName.node, SName.leafNode, SName.boxless)
.add(stereotype).add(depth);
.addS(stereotype).add(depth);
if (isLeaf())
return StyleSignatureBasic.of(SName.root, SName.element, SName.wbsDiagram, SName.node, SName.leafNode)
.add(stereotype).add(depth);
.addS(stereotype).add(depth);
if (shape == IdeaShape.NONE)
return StyleSignatureBasic.of(SName.root, SName.element, SName.wbsDiagram, SName.node, SName.boxless)
.add(stereotype).add(depth);
.addS(stereotype).add(depth);
return StyleSignatureBasic.of(SName.root, SName.element, SName.wbsDiagram, SName.node).add(stereotype).add(depth);
return StyleSignatureBasic.of(SName.root, SName.element, SName.wbsDiagram, SName.node).addS(stereotype).add(depth);
}
public ISkinParam withBackColor(ISkinParam skinParam) {

Binary file not shown.

BIN
stdlib/awslib10-abx.repx Normal file

Binary file not shown.

BIN
stdlib/awslib10-dex.repx Normal file

Binary file not shown.

BIN
stdlib/awslib14-abx.repx Normal file

Binary file not shown.

BIN
stdlib/awslib14-dex.repx Normal file

Binary file not shown.