diff options
author | Andrej Shadura <andrew.shadura@collabora.co.uk> | 2020-03-10 16:38:20 +0100 |
---|---|---|
committer | Andrej Shadura <andrew.shadura@collabora.co.uk> | 2020-03-10 16:38:20 +0100 |
commit | 7cc8c823de644a510fcc434f39b53e5fffe66bfd (patch) | |
tree | 8f4d027284bb366734f610040c621a0c5dd0a12a /src/net/sourceforge/plantuml/svek | |
parent | 567b200b91537405689ae0ca944f121201360a6b (diff) |
New upstream version 1.2020.2
Diffstat (limited to 'src/net/sourceforge/plantuml/svek')
145 files changed, 1762 insertions, 971 deletions
diff --git a/src/net/sourceforge/plantuml/svek/AbstractEntityImage.java b/src/net/sourceforge/plantuml/svek/AbstractEntityImage.java index b8e2707..07cf928 100644 --- a/src/net/sourceforge/plantuml/svek/AbstractEntityImage.java +++ b/src/net/sourceforge/plantuml/svek/AbstractEntityImage.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -80,4 +80,8 @@ public abstract class AbstractEntityImage extends AbstractTextBlock implements I return Margins.NONE; } + public double getOverscanX(StringBounder stringBounder) { + return 0; + } + } diff --git a/src/net/sourceforge/plantuml/svek/AbstractExtremityFactory.java b/src/net/sourceforge/plantuml/svek/AbstractExtremityFactory.java index 06df7c4..89420c7 100644 --- a/src/net/sourceforge/plantuml/svek/AbstractExtremityFactory.java +++ b/src/net/sourceforge/plantuml/svek/AbstractExtremityFactory.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/ArithmeticStrategy.java b/src/net/sourceforge/plantuml/svek/ArithmeticStrategy.java index 6281455..c8de45a 100644 --- a/src/net/sourceforge/plantuml/svek/ArithmeticStrategy.java +++ b/src/net/sourceforge/plantuml/svek/ArithmeticStrategy.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/ArithmeticStrategyMax.java b/src/net/sourceforge/plantuml/svek/ArithmeticStrategyMax.java index f1cc9e5..497f7d5 100644 --- a/src/net/sourceforge/plantuml/svek/ArithmeticStrategyMax.java +++ b/src/net/sourceforge/plantuml/svek/ArithmeticStrategyMax.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/ArithmeticStrategySum.java b/src/net/sourceforge/plantuml/svek/ArithmeticStrategySum.java index bf64ac8..e6630d7 100644 --- a/src/net/sourceforge/plantuml/svek/ArithmeticStrategySum.java +++ b/src/net/sourceforge/plantuml/svek/ArithmeticStrategySum.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/Bibliotekon.java b/src/net/sourceforge/plantuml/svek/Bibliotekon.java index f907c0d..7122bf6 100644 --- a/src/net/sourceforge/plantuml/svek/Bibliotekon.java +++ b/src/net/sourceforge/plantuml/svek/Bibliotekon.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -48,24 +48,27 @@ import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.IGroup; import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.cucadiagram.Link; +import net.sourceforge.plantuml.graphic.StringBounder; public class Bibliotekon { private final List<Cluster> allCluster = new ArrayList<Cluster>(); - private final Map<ILeaf, Shape> shapeMap = new LinkedHashMap<ILeaf, Shape>();; + private final Map<ILeaf, Node> nodeMap = new LinkedHashMap<ILeaf, Node>();; private final List<Line> lines0 = new ArrayList<Line>(); private final List<Line> lines1 = new ArrayList<Line>(); private final List<Line> allLines = new ArrayList<Line>(); - public void putShape(ILeaf ent, Shape shape) { - shapeMap.put(ent, shape); + public Node createNode(ILeaf ent, IEntityImage image, ColorSequence colorSequence, StringBounder stringBounder) { + final Node node = new Node(ent, image, colorSequence, stringBounder); + nodeMap.put(ent, node); + return node; } public Cluster getCluster(IGroup ent) { for (Cluster cl : allCluster) { - if (cl.getGroup() == ent) { + if (cl.getGroups().contains(ent)) { return cl; } } @@ -105,12 +108,12 @@ public class Bibliotekon { allCluster.add(current); } - public Shape getShape(IEntity ent) { - return shapeMap.get(ent); + public Node getNode(IEntity ent) { + return nodeMap.get(ent); } - public String getShapeUid(ILeaf ent) { - final Shape result = getShape(ent); + public String getNodeUid(ILeaf ent) { + final Node result = getNode(ent); if (result != null) { String uid = result.getUid(); if (result.isShielded()) { @@ -120,9 +123,9 @@ public class Bibliotekon { } assert result == null; if (ent.isGroup()) { - for (IEntity i : shapeMap.keySet()) { - if (ent.getCode().equals(i.getCode())) { - return getShape(i).getUid(); + for (IEntity i : nodeMap.keySet()) { + if (ent.getCodeGetName().equals(i.getCodeGetName())) { + return getNode(i).getUid(); } } return Cluster.getSpecialPointId(ent); @@ -132,12 +135,12 @@ public class Bibliotekon { public String getWarningOrError(int warningOrError) { final StringBuilder sb = new StringBuilder(); - for (Map.Entry<ILeaf, Shape> ent : shapeMap.entrySet()) { - final Shape sh = ent.getValue(); + for (Map.Entry<ILeaf, Node> ent : nodeMap.entrySet()) { + final Node sh = ent.getValue(); final double maxX = sh.getMinX() + sh.getWidth(); if (maxX > warningOrError) { final IEntity entity = ent.getKey(); - sb.append(entity.getCode() + " is overpassing the width limit."); + sb.append(entity.getCodeGetName() + " is overpassing the width limit."); sb.append("\n"); } @@ -145,13 +148,13 @@ public class Bibliotekon { return sb.length() == 0 ? "" : sb.toString(); } - public Map<Code, Double> getMaxX() { - final Map<Code, Double> result = new HashMap<Code, Double>(); - for (Map.Entry<ILeaf, Shape> ent : shapeMap.entrySet()) { - final Shape sh = ent.getValue(); + public Map<String, Double> getMaxX() { + final Map<String, Double> result = new HashMap<String, Double>(); + for (Map.Entry<ILeaf, Node> ent : nodeMap.entrySet()) { + final Node sh = ent.getValue(); final double maxX = sh.getMinX() + sh.getWidth(); final IEntity entity = ent.getKey(); - result.put(entity.getCode(), maxX); + result.put(entity.getCodeGetName(), maxX); } return Collections.unmodifiableMap(result); } @@ -172,8 +175,8 @@ public class Bibliotekon { return Collections.unmodifiableList(allCluster); } - public Collection<Shape> allShapes() { - return Collections.unmodifiableCollection(shapeMap.values()); + public Collection<Node> allNodes() { + return Collections.unmodifiableCollection(nodeMap.values()); } public List<Line> getAllLineConnectedTo(IEntity leaf) { @@ -205,9 +208,9 @@ public class Bibliotekon { return null; } - public ILeaf getLeaf(Shape shape) { - for (Map.Entry<ILeaf, Shape> ent : shapeMap.entrySet()) { - if (ent.getValue() == shape) { + public ILeaf getLeaf(Node node) { + for (Map.Entry<ILeaf, Node> ent : nodeMap.entrySet()) { + if (ent.getValue() == node) { return ent.getKey(); } } diff --git a/src/net/sourceforge/plantuml/svek/Boundary.java b/src/net/sourceforge/plantuml/svek/Boundary.java index c1d475c..3c920b5 100644 --- a/src/net/sourceforge/plantuml/svek/Boundary.java +++ b/src/net/sourceforge/plantuml/svek/Boundary.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/CircleAndArrow.java b/src/net/sourceforge/plantuml/svek/CircleAndArrow.java index e3334ea..1d0a9d5 100644 --- a/src/net/sourceforge/plantuml/svek/CircleAndArrow.java +++ b/src/net/sourceforge/plantuml/svek/CircleAndArrow.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/CircleInterface2.java b/src/net/sourceforge/plantuml/svek/CircleInterface2.java index 1b406b1..ec11a99 100644 --- a/src/net/sourceforge/plantuml/svek/CircleInterface2.java +++ b/src/net/sourceforge/plantuml/svek/CircleInterface2.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/Cluster.java b/src/net/sourceforge/plantuml/svek/Cluster.java index 4b6dfd5..ab5681e 100644 --- a/src/net/sourceforge/plantuml/svek/Cluster.java +++ b/src/net/sourceforge/plantuml/svek/Cluster.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -54,6 +54,7 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.LineParam; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.UmlDiagramType; @@ -78,6 +79,10 @@ import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.posimo.Moveable; import net.sourceforge.plantuml.skin.rose.Rose; +import net.sourceforge.plantuml.style.PName; +import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.svek.image.EntityImageState; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; @@ -91,9 +96,9 @@ import net.sourceforge.plantuml.utils.UniqueSequence; public class Cluster implements Moveable { - private final Cluster parent; + private final Cluster parentCluster; private final IGroup group; - private final List<Shape> shapes = new ArrayList<Shape>(); + private final List<Node> nodes = new ArrayList<Node>(); private final List<Cluster> children = new ArrayList<Cluster>(); private final int color; private final int colorTitle; @@ -123,7 +128,7 @@ public class Cluster implements Moveable { } private boolean hasEntryOrExitPoint() { - for (Shape sh : shapes) { + for (Node sh : nodes) { if (sh.getEntityPosition() != EntityPosition.NORMAL) { return true; } @@ -132,16 +137,16 @@ public class Cluster implements Moveable { } public Cluster(ColorSequence colorSequence, ISkinParam skinParam, IGroup root) { - this(null, root, colorSequence, skinParam); + this(null, colorSequence, skinParam, root); } private ColorParam border; - private Cluster(Cluster parent, IGroup group, ColorSequence colorSequence, ISkinParam skinParam) { + private Cluster(Cluster parentCluster, ColorSequence colorSequence, ISkinParam skinParam, IGroup group) { if (group == null) { throw new IllegalStateException(); } - this.parent = parent; + this.parentCluster = parentCluster; this.group = group; if (group.getUSymbol() != null) { border = group.getUSymbol().getColorParamBorder(); @@ -156,46 +161,46 @@ public class Cluster implements Moveable { return super.toString() + " " + group; } - public final Cluster getParent() { - return parent; + public final Cluster getParentCluster() { + return parentCluster; } - public void addShape(Shape sh) { - if (sh == null) { + public void addNode(Node node) { + if (node == null) { throw new IllegalArgumentException(); } - this.shapes.add(sh); - sh.setCluster(this); + this.nodes.add(node); + node.setCluster(this); } - public final List<Shape> getShapes() { - return Collections.unmodifiableList(shapes); + public final List<Node> getNodes() { + return Collections.unmodifiableList(nodes); } - private List<Shape> getShapesOrderedTop(Collection<Line> lines) { - final List<Shape> firsts = new ArrayList<Shape>(); + private List<Node> getNodesOrderedTop(Collection<Line> lines) { + final List<Node> firsts = new ArrayList<Node>(); final Set<String> tops = new HashSet<String>(); - final Map<String, Shape> shs = new HashMap<String, Shape>(); - - for (final Iterator<Shape> it = shapes.iterator(); it.hasNext();) { - final Shape sh = it.next(); - shs.put(sh.getUid(), sh); - if (sh.isTop() && sh.getEntityPosition() == EntityPosition.NORMAL) { - firsts.add(sh); - tops.add(sh.getUid()); + final Map<String, Node> shs = new HashMap<String, Node>(); + + for (final Iterator<Node> it = nodes.iterator(); it.hasNext();) { + final Node node = it.next(); + shs.put(node.getUid(), node); + if (node.isTop() && node.getEntityPosition() == EntityPosition.NORMAL) { + firsts.add(node); + tops.add(node.getUid()); } } for (Line l : lines) { if (tops.contains(l.getStartUidPrefix())) { - final Shape sh = shs.get(l.getEndUidPrefix()); + final Node sh = shs.get(l.getEndUidPrefix()); if (sh != null && sh.getEntityPosition() == EntityPosition.NORMAL) { firsts.add(0, sh); } } if (l.isInverted()) { - final Shape sh = shs.get(l.getStartUidPrefix()); + final Node sh = shs.get(l.getStartUidPrefix()); if (sh != null && sh.getEntityPosition() == EntityPosition.NORMAL) { firsts.add(0, sh); } @@ -205,11 +210,11 @@ public class Cluster implements Moveable { return firsts; } - private List<Shape> getShapesEntryExit(EnumSet<EntityPosition> positions) { - final List<Shape> result = new ArrayList<Shape>(); + private List<Node> getNodesEntryExit(EnumSet<EntityPosition> positions) { + final List<Node> result = new ArrayList<Node>(); - for (final Iterator<Shape> it = shapes.iterator(); it.hasNext();) { - final Shape sh = it.next(); + for (final Iterator<Node> it = nodes.iterator(); it.hasNext();) { + final Node sh = it.next(); if (positions.contains(sh.getEntityPosition())) { result.add(sh); } @@ -217,13 +222,13 @@ public class Cluster implements Moveable { return result; } - private List<Shape> getShapesOrderedWithoutTop(Collection<Line> lines) { - final List<Shape> all = new ArrayList<Shape>(shapes); + private List<Node> getNodesOrderedWithoutTop(Collection<Line> lines) { + final List<Node> all = new ArrayList<Node>(nodes); final Set<String> tops = new HashSet<String>(); - final Map<String, Shape> shs = new HashMap<String, Shape>(); + final Map<String, Node> shs = new HashMap<String, Node>(); - for (final Iterator<Shape> it = all.iterator(); it.hasNext();) { - final Shape sh = it.next(); + for (final Iterator<Node> it = all.iterator(); it.hasNext();) { + final Node sh = it.next(); if (sh.getEntityPosition() != EntityPosition.NORMAL) { it.remove(); continue; @@ -237,14 +242,14 @@ public class Cluster implements Moveable { for (Line l : lines) { if (tops.contains(l.getStartUidPrefix())) { - final Shape sh = shs.get(l.getEndUidPrefix()); + final Node sh = shs.get(l.getEndUidPrefix()); if (sh != null) { all.remove(sh); } } if (l.isInverted()) { - final Shape sh = shs.get(l.getStartUidPrefix()); + final Node sh = shs.get(l.getStartUidPrefix()); if (sh != null) { all.remove(sh); } @@ -258,9 +263,9 @@ public class Cluster implements Moveable { return Collections.unmodifiableList(children); } - public Cluster createChild(IGroup g, int titleAndAttributeWidth, int titleAndAttributeHeight, TextBlock title, - TextBlock stereo, ColorSequence colorSequence, ISkinParam skinParam) { - final Cluster child = new Cluster(this, g, colorSequence, skinParam); + public Cluster createChild(int titleAndAttributeWidth, int titleAndAttributeHeight, TextBlock title, + TextBlock stereo, ColorSequence colorSequence, ISkinParam skinParam, IGroup g) { + final Cluster child = new Cluster(this, colorSequence, skinParam, g); child.titleAndAttributeWidth = titleAndAttributeWidth; child.titleAndAttributeHeight = titleAndAttributeHeight; child.ztitle = title; @@ -269,8 +274,8 @@ public class Cluster implements Moveable { return child; } - public final IGroup getGroup() { - return group; + public final Set<IGroup> getGroups() { + return Collections.singleton(group); } public final int getTitleAndAttributeWidth() { @@ -299,25 +304,35 @@ public class Cluster implements Moveable { } private static HtmlColor getColor(ColorParam colorParam, ISkinParam skinParam, Stereotype stereotype) { - return SkinParamUtils.getColor(skinParam, colorParam, stereotype); + return SkinParamUtils.getColor(skinParam, stereotype, colorParam); + } + + static public StyleSignature getDefaultStyleDefinition() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.group); } public void drawU(UGraphic ug, UStroke stroke, final UmlDiagramType umlDiagramType, final ISkinParam skinParam2) { if (group.isHidden()) { return; } - final String fullName = group.getCode().getFullName(); + final String fullName = group.getCodeGetName(); if (fullName.startsWith("##") == false) { ug.draw(new UComment("cluster " + fullName)); } final Stereotype stereotype = group.getStereotype(); HtmlColor borderColor; - if (umlDiagramType == UmlDiagramType.STATE) { - borderColor = getColor(ColorParam.stateBorder, skinParam, stereotype); - } else if (umlDiagramType == UmlDiagramType.ACTIVITY) { - borderColor = getColor(ColorParam.packageBorder, skinParam, stereotype); + if (SkinParam.USE_STYLES()) { + final Style style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder()); + borderColor = style.value(PName.LineColor).asColor(skinParam2.getIHtmlColorSet()); + } else { - borderColor = getColor(ColorParam.packageBorder, skinParam, stereotype); + if (umlDiagramType == UmlDiagramType.STATE) { + borderColor = getColor(ColorParam.stateBorder, skinParam, stereotype); + } else if (umlDiagramType == UmlDiagramType.ACTIVITY) { + borderColor = getColor(ColorParam.packageBorder, skinParam, stereotype); + } else { + borderColor = getColor(ColorParam.packageBorder, skinParam, stereotype); + } } final Url url = group.getUrl99(); @@ -343,9 +358,9 @@ public class Cluster implements Moveable { drawUState(ug, borderColor, skinParam2, stroke, umlDiagramType); return; } - PackageStyle style = group.getPackageStyle(); - if (style == null) { - style = skinParam2.getPackageStyle(); + PackageStyle packageStyle = group.getPackageStyle(); + if (packageStyle == null) { + packageStyle = skinParam2.getPackageStyle(); } if (border != null) { final HtmlColor tmp = skinParam2.getHtmlColor(border, group.getStereotype(), false); @@ -354,25 +369,35 @@ public class Cluster implements Moveable { } } - final boolean shadowing = group.getUSymbol() == null ? skinParam2.shadowing2(group.getStereotype(), USymbol.PACKAGE.getSkinParameter()) - : skinParam2.shadowing2(group.getStereotype(), group.getUSymbol().getSkinParameter()); + final double shadowing; + if (SkinParam.USE_STYLES()) { + final Style style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder()); + shadowing = style.value(PName.Shadowing).asDouble(); + } else { + if (group.getUSymbol() == null) { + shadowing = skinParam2.shadowing2(group.getStereotype(), USymbol.PACKAGE.getSkinParameter()) ? 3 + : 0; + } else { + shadowing = skinParam2.shadowing2(group.getStereotype(), group.getUSymbol().getSkinParameter()) ? 3 + : 0; + } + } + HtmlColor backColor = getBackColor(umlDiagramType); + backColor = getBackColor(backColor, skinParam2, group.getStereotype()); if (ztitle != null || zstereo != null) { - final HtmlColor back = getBackColor(getBackColor(umlDiagramType), skinParam2, group.getStereotype()); - final double roundCorner = group.getUSymbol() == null ? 0 : group.getUSymbol().getSkinParameter() - .getRoundCorner(skinParam, stereotype); + final double roundCorner = group.getUSymbol() == null ? 0 + : group.getUSymbol().getSkinParameter().getRoundCorner(skinParam, stereotype); final UStroke stroke2 = getStrokeInternal(skinParam2); - final ClusterDecoration decoration = new ClusterDecoration(style, group.getUSymbol(), ztitle, zstereo, - minX, minY, maxX, maxY, stroke2); - decoration.drawU(ug, back, borderColor, shadowing, roundCorner, - skinParam2.getHorizontalAlignment(AlignmentParam.packageTitleAlignment, null, false)); + final ClusterDecoration decoration = new ClusterDecoration(packageStyle, group.getUSymbol(), ztitle, + zstereo, minX, minY, maxX, maxY, stroke2); + decoration.drawU(ug, backColor, borderColor, shadowing, roundCorner, + skinParam2.getHorizontalAlignment(AlignmentParam.packageTitleAlignment, null, false), + skinParam2.getStereotypeAlignment()); return; } final URectangle rect = new URectangle(maxX - minX, maxY - minY); - if (shadowing) { - rect.setDeltaShadow(3.0); - } - final HtmlColor backColor = getBackColor(getBackColor(umlDiagramType), skinParam2, group.getStereotype()); + rect.setDeltaShadow(shadowing); ug = ug.apply(new UChangeBackColor(backColor)).apply(new UChangeColor(borderColor)); ug.apply(new UStroke(2)).apply(new UTranslate(minX, minY)).draw(rect); @@ -402,7 +427,7 @@ public class Cluster implements Moveable { public void manageEntryExitPoint(StringBounder stringBounder) { final Collection<ClusterPosition> insides = new ArrayList<ClusterPosition>(); final List<Point2D> points = new ArrayList<Point2D>(); - for (Shape sh : shapes) { + for (Node sh : nodes) { if (sh.getEntityPosition() == EntityPosition.NORMAL) { insides.add(sh.getClusterPosition()); } else { @@ -439,7 +464,7 @@ public class Cluster implements Moveable { } private HtmlColor getColor(ISkinParam skinParam, ColorParam colorParam, Stereotype stereo) { - return new Rose().getHtmlColor(skinParam, colorParam, stereo); + return new Rose().getHtmlColor(skinParam, stereo, colorParam); } private void drawUState(UGraphic ug, HtmlColor borderColor, ISkinParam skinParam2, UStroke stroke, @@ -460,8 +485,9 @@ public class Cluster implements Moveable { final HtmlColor background = getColor(skinParam2, ColorParam.background, null); final TextBlockWidth attribute = getTextBlockAttribute(skinParam2); final double attributeHeight = attribute.calculateDimension(ug.getStringBounder()).getHeight(); - final RoundedContainer r = new RoundedContainer(total, suppY, attributeHeight - + (attributeHeight > 0 ? IEntityImage.MARGIN : 0), borderColor, stateBack, background, stroke); + final RoundedContainer r = new RoundedContainer(total, suppY, + attributeHeight + (attributeHeight > 0 ? IEntityImage.MARGIN : 0), borderColor, stateBack, background, + stroke); r.drawU(ug.apply(new UTranslate(minX, minY)), skinParam2.shadowing(group.getStereotype())); if (ztitle != null) { @@ -511,12 +537,12 @@ public class Cluster implements Moveable { } public void printCluster1(StringBuilder sb, Collection<Line> lines, StringBounder stringBounder) { - for (Shape sh : getShapesOrderedTop(lines)) { - sh.appendShape(sb, stringBounder); + for (Node node : getNodesOrderedTop(lines)) { + node.appendShape(sb, stringBounder); } } - private List<IShapePseudo> addProtection(List<Shape> entries, double width) { + private List<IShapePseudo> addProtection(List<Node> entries, double width) { final List<IShapePseudo> result = new ArrayList<IShapePseudo>(); result.add(entries.get(0)); for (int i = 1; i < entries.size(); i++) { @@ -526,10 +552,10 @@ public class Cluster implements Moveable { return result; } - private double getMaxWidthFromLabelForEntryExit(List<Shape> entries, StringBounder stringBounder) { + private double getMaxWidthFromLabelForEntryExit(List<Node> entries, StringBounder stringBounder) { double result = -Double.MAX_VALUE; - for (Shape shape : entries) { - final double w = getMaxWidthFromLabelForEntryExit(shape, stringBounder); + for (Node node : entries) { + final double w = getMaxWidthFromLabelForEntryExit(node, stringBounder); if (w > result) { result = w; } @@ -537,19 +563,19 @@ public class Cluster implements Moveable { return result; } - private double getMaxWidthFromLabelForEntryExit(Shape shape, StringBounder stringBounder) { - return shape.getMaxWidthFromLabelForEntryExit(stringBounder); + private double getMaxWidthFromLabelForEntryExit(Node node, StringBounder stringBounder) { + return node.getMaxWidthFromLabelForEntryExit(stringBounder); } public void printClusterEntryExit(StringBuilder sb, StringBounder stringBounder) { - final List<Shape> shapesEntryExitList = getShapesEntryExit(EntityPosition.getInputs()); - final double maxWith = getMaxWidthFromLabelForEntryExit(shapesEntryExitList, stringBounder); + final List<Node> nodesEntryExitList = getNodesEntryExit(EntityPosition.getInputs()); + final double maxWith = getMaxWidthFromLabelForEntryExit(nodesEntryExitList, stringBounder); final double naturalSpace = 70; final List<? extends IShapePseudo> entries; if (maxWith > naturalSpace) { - entries = addProtection(shapesEntryExitList, maxWith - naturalSpace); + entries = addProtection(nodesEntryExitList, maxWith - naturalSpace); } else { - entries = shapesEntryExitList; + entries = nodesEntryExitList; } if (entries.size() > 0) { sb.append("{rank=source;"); @@ -561,26 +587,26 @@ public class Cluster implements Moveable { sh.appendShape(sb, stringBounder); } } - final List<Shape> exits = getShapesEntryExit(EntityPosition.getOutputs()); + final List<Node> exits = getNodesEntryExit(EntityPosition.getOutputs()); if (exits.size() > 0) { sb.append("{rank=sink;"); - for (Shape sh : exits) { + for (Node sh : exits) { sb.append(sh.getUid() + ";"); } sb.append("}"); - for (Shape sh : exits) { + for (Node sh : exits) { sh.appendShape(sb, stringBounder); } } } - public boolean printCluster2(StringBuilder sb, Collection<Line> lines, StringBounder stringBounder, - DotMode dotMode, GraphvizVersion graphvizVersion, UmlDiagramType type) { + public boolean printCluster2(StringBuilder sb, Collection<Line> lines, StringBounder stringBounder, DotMode dotMode, + GraphvizVersion graphvizVersion, UmlDiagramType type) { // Log.println("Cluster::printCluster " + this); boolean added = false; - for (Shape sh : getShapesOrderedWithoutTop(lines)) { - sh.appendShape(sb, stringBounder); + for (Node node : getNodesOrderedWithoutTop(lines)) { + node.appendShape(sb, stringBounder); added = true; } @@ -622,7 +648,7 @@ public class Cluster implements Moveable { } public void fillRankMin(Set<String> rankMin) { - for (Shape sh : getShapes()) { + for (Node sh : getNodes()) { if (sh.isTop()) { rankMin.add(sh.getUid()); } @@ -634,8 +660,8 @@ public class Cluster implements Moveable { } private boolean isInCluster(String uid) { - for (Shape sh : shapes) { - if (sh.getUid().equals(uid)) { + for (Node node : nodes) { + if (node.getUid().equals(uid)) { return true; } } @@ -840,16 +866,16 @@ public class Cluster implements Moveable { } final Stereotype stereo = group.getStereotype(); final USymbol sym = group.getUSymbol() == null ? USymbol.PACKAGE : group.getUSymbol(); - final ColorParam backparam = umlDiagramType == UmlDiagramType.ACTIVITY ? ColorParam.partitionBackground : sym - .getColorParamBack(); + final ColorParam backparam = umlDiagramType == UmlDiagramType.ACTIVITY ? ColorParam.partitionBackground + : sym.getColorParamBack(); final HtmlColor c1 = skinParam.getHtmlColor(backparam, stereo, false); if (c1 != null) { return c1; } - if (parent == null) { + if (parentCluster == null) { return null; } - return parent.getBackColor(umlDiagramType); + return parentCluster.getBackColor(umlDiagramType); } public boolean isClusterOf(IEntity ent) { @@ -860,6 +886,16 @@ public class Cluster implements Moveable { } public static HtmlColor getBackColor(HtmlColor backColor, ISkinParam skinParam, Stereotype stereotype) { + if (SkinParam.USE_STYLES()) { + final Style style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder()); + if (backColor == null) { + backColor = style.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet()); + } + if (backColor == null /* || stateBack instanceof HtmlColorTransparent */) { + backColor = new HtmlColorTransparent(); + } + return backColor; + } if (backColor == null) { backColor = skinParam.getHtmlColor(ColorParam.packageBackground, stereotype, false); } diff --git a/src/net/sourceforge/plantuml/svek/ClusterDecoration.java b/src/net/sourceforge/plantuml/svek/ClusterDecoration.java index 0aef3c4..c41cd2c 100644 --- a/src/net/sourceforge/plantuml/svek/ClusterDecoration.java +++ b/src/net/sourceforge/plantuml/svek/ClusterDecoration.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -47,7 +47,7 @@ import net.sourceforge.plantuml.ugraphic.UTranslate; public class ClusterDecoration { - private final UStroke defaultStroke;// = new UStroke(2); + private final UStroke defaultStroke; final private USymbol symbol; final private TextBlock title; final private TextBlock stereo; @@ -67,9 +67,6 @@ public class ClusterDecoration { this.maxX = maxX; this.maxY = maxY; this.defaultStroke = stroke; - // if (stateBack instanceof HtmlColorTransparent) { - // throw new UnsupportedOperationException(); - // } } private static USymbol guess(USymbol symbol, PackageStyle style) { @@ -86,148 +83,16 @@ public class ClusterDecoration { public final static int marginTitleY1 = 3; public final static int marginTitleY2 = 3; - public void drawU(UGraphic ug, HtmlColor backColor, HtmlColor borderColor, boolean shadowing, double roundCorner, - HorizontalAlignment titleAlignment) { + public void drawU(UGraphic ug, HtmlColor backColor, HtmlColor borderColor, double shadowing, double roundCorner, + HorizontalAlignment titleAlignment, HorizontalAlignment stereoAlignment) { final SymbolContext biColor = new SymbolContext(backColor, borderColor); if (symbol == null) { throw new UnsupportedOperationException(); } final SymbolContext symbolContext = biColor.withShadow(shadowing).withStroke(defaultStroke) .withCorner(roundCorner, 0); - symbol.asBig(title, titleAlignment, stereo, maxX - minX, maxY - minY, symbolContext).drawU( + symbol.asBig(title, titleAlignment, stereo, maxX - minX, maxY - minY, symbolContext, stereoAlignment).drawU( ug.apply(new UTranslate(minX, minY))); - // return; - // } - // if (style == PackageStyle.NODE) { - // drawWithTitleNode(ug, biColor, shadowing); - // } else if (style == PackageStyle.CARD) { - // drawWithTitleCard(ug, biColor, shadowing); - // } else if (style == PackageStyle.DATABASE) { - // drawWithTitleDatabase(ug, biColor, shadowing); - // } else if (style == PackageStyle.CLOUD) { - // drawWithTitleCloud(ug, biColor, shadowing); - // } else if (style == PackageStyle.FRAME) { - // drawWithTitleFrame(ug, biColor, shadowing); - // } else if (style == PackageStyle.RECT) { - // drawWithTitleRect(ug, biColor, shadowing); - // } else { - // throw new UnsupportedOperationException(); - // // drawWithTitleFolder(ug, biColor, shadowing); - // } } - // // Cloud - // private void drawWithTitleCloud(UGraphic ug, SymbolContext biColor, boolean shadowing) { - // final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder()); - // final double width = maxX - minX; - // final double height = maxY - minY; - // ug = biColor.applyColors(ug); - // ug = ug.apply(defaultStroke); - // PackageStyle.CLOUD.drawU(ug.apply(new UTranslate(minX, minY)), new Dimension2DDouble(width, height), dimTitle, - // shadowing); - // ug = ug.apply(new UStroke()); - // title.drawU(ug.apply(new UTranslate(minX + (width - dimTitle.getWidth()) / 2, minY + 10))); - // - // } - // - // // Database - // private void drawWithTitleDatabase(UGraphic ug, SymbolContext biColor, boolean shadowing) { - // final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder()); - // final double width = maxX - minX; - // final double height = maxY - minY; - // ug = ug.apply(defaultStroke); - // ug = biColor.applyColors(ug); - // PackageStyle.DATABASE.drawU(ug.apply(new UTranslate(minX, minY - 10)), - // new Dimension2DDouble(width, height + 10), dimTitle, shadowing); - // ug = ug.apply(new UStroke()); - // title.drawU(ug.apply(new UTranslate(minX + marginTitleX1, minY + 10))); - // - // } - // - // // Corner - // private void drawWithTitleFrame(UGraphic ug, SymbolContext biColor, boolean shadowing) { - // final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder()); - // final double width = maxX - minX; - // final double height = maxY - minY; - // ug = biColor.applyColors(ug); - // ug = ug.apply(defaultStroke); - // PackageStyle.FRAME.drawU(ug.apply(new UTranslate(minX, minY)), new Dimension2DDouble(width, height), dimTitle, - // shadowing); - // ug = ug.apply(new UStroke()); - // title.drawU(ug.apply(new UTranslate(minX + marginTitleX1, minY))); - // - // } - // - // // Card - // private void drawWithTitleCard(UGraphic ug, SymbolContext biColor, boolean shadowing) { - // final double width = maxX - minX; - // final double height = maxY - minY; - // final SymbolContext ctx = biColor.withStroke(defaultStroke).withShadow(shadowing); - // USymbol.CARD.asBig(title, TextBlockUtils.empty(0, 0), width + 10, height, ctx).drawU( - // ug.apply(new UTranslate(minX, minY))); - // } - // - // // Node - // private void drawWithTitleNode(UGraphic ug, SymbolContext biColor, boolean shadowing) { - // final double width = maxX - minX; - // final double height = maxY - minY; - // final SymbolContext ctx = biColor.withStroke(defaultStroke).withShadow(shadowing); - // USymbol.NODE.asBig(title, TextBlockUtils.empty(0, 0), width + 10, height, ctx).drawU( - // ug.apply(new UTranslate(minX, minY))); - // } - // - // // Folder - // private UPolygon getSpecificFrontierForFolder(StringBounder stringBounder) { - // final double width = maxX - minX; - // final double height = maxY - minY; - // final Dimension2D dimTitle = title.calculateDimension(stringBounder); - // final double wtitle = dimTitle.getWidth() + marginTitleX1 + marginTitleX2; - // final double htitle = dimTitle.getHeight() + marginTitleY1 + marginTitleY2; - // final UPolygon shape = new UPolygon(); - // shape.addPoint(0, 0); - // shape.addPoint(wtitle, 0); - // shape.addPoint(wtitle + marginTitleX3, htitle); - // shape.addPoint(width, htitle); - // shape.addPoint(width, height); - // shape.addPoint(0, height); - // shape.addPoint(0, 0); - // return shape; - // } - // - // private void drawWithTitleFolder(UGraphic ug, SymbolContext biColor, boolean shadowing) { - // final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder()); - // final double wtitle = dimTitle.getWidth() + marginTitleX1 + marginTitleX2; - // final double htitle = dimTitle.getHeight() + marginTitleY1 + marginTitleY2; - // final UPolygon shape = getSpecificFrontierForFolder(ug.getStringBounder()); - // if (shadowing) { - // shape.setDeltaShadow(3.0); - // } - // - // ug = biColor.applyColors(ug); - // ug = ug.apply(defaultStroke); - // ug.apply(new UTranslate(minX, minY)).draw(shape); - // ug.apply(new UTranslate(minX, minY + htitle)).draw(new ULine(wtitle + marginTitleX3, 0)); - // ug = ug.apply(new UStroke()); - // title.drawU(ug.apply(new UTranslate(minX + marginTitleX1, minY + marginTitleY1))); - // } - // - // // Rect - // private void drawWithTitleRect(UGraphic ug, SymbolContext biColor, boolean shadowing) { - // final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder()); - // final double width = maxX - minX; - // final double height = maxY - minY; - // final URectangle shape = new URectangle(width, height); - // if (shadowing) { - // shape.setDeltaShadow(3.0); - // } - // - // ug = biColor.applyColors(ug); - // ug = ug.apply(defaultStroke); - // - // ug.apply(new UTranslate(minX, minY)).draw(shape); - // ug = ug.apply(new UStroke()); - // final double deltax = width - dimTitle.getWidth(); - // title.drawU(ug.apply(new UTranslate(minX + deltax / 2, minY + 5))); - // } - } diff --git a/src/net/sourceforge/plantuml/svek/ClusterPosition.java b/src/net/sourceforge/plantuml/svek/ClusterPosition.java index 77369f5..6d3cb67 100644 --- a/src/net/sourceforge/plantuml/svek/ClusterPosition.java +++ b/src/net/sourceforge/plantuml/svek/ClusterPosition.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/ColorSequence.java b/src/net/sourceforge/plantuml/svek/ColorSequence.java index b760c78..b23ecf4 100644 --- a/src/net/sourceforge/plantuml/svek/ColorSequence.java +++ b/src/net/sourceforge/plantuml/svek/ColorSequence.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/ConcurrentStateImage.java b/src/net/sourceforge/plantuml/svek/ConcurrentStateImage.java index 15232bd..e0720ca 100644 --- a/src/net/sourceforge/plantuml/svek/ConcurrentStateImage.java +++ b/src/net/sourceforge/plantuml/svek/ConcurrentStateImage.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -156,4 +156,9 @@ public final class ConcurrentStateImage extends AbstractTextBlock implements IEn public ShapeType getShapeType() { return ShapeType.RECTANGLE; } + + public double getOverscanX(StringBounder stringBounder) { + return 0; + } + } diff --git a/src/net/sourceforge/plantuml/svek/ConditionEndStyle.java b/src/net/sourceforge/plantuml/svek/ConditionEndStyle.java new file mode 100644 index 0000000..20688ff --- /dev/null +++ b/src/net/sourceforge/plantuml/svek/ConditionEndStyle.java @@ -0,0 +1,52 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * PlantUML is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PlantUML distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * Contributed by Jonathan Buhacoff + * Based on ConditionStyle by Arnaud Roques and Arno Peterson + * + * + */ +package net.sourceforge.plantuml.svek; + +import java.util.EnumSet; + +public enum ConditionEndStyle { + + DIAMOND, HLINE; + + public static ConditionEndStyle fromString(String value) { + for (ConditionEndStyle p : EnumSet.allOf(ConditionEndStyle.class)) { + if (p.toString().equalsIgnoreCase(value)) { + return p; + } + } + return null; + } +}
\ No newline at end of file diff --git a/src/net/sourceforge/plantuml/svek/ConditionStyle.java b/src/net/sourceforge/plantuml/svek/ConditionStyle.java index 51dc8bb..9104275 100644 --- a/src/net/sourceforge/plantuml/svek/ConditionStyle.java +++ b/src/net/sourceforge/plantuml/svek/ConditionStyle.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/Control.java b/src/net/sourceforge/plantuml/svek/Control.java index 667b5b9..6cd032a 100644 --- a/src/net/sourceforge/plantuml/svek/Control.java +++ b/src/net/sourceforge/plantuml/svek/Control.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/CucaDiagramFileMaker.java b/src/net/sourceforge/plantuml/svek/CucaDiagramFileMaker.java index d3018a5..d40c669 100644 --- a/src/net/sourceforge/plantuml/svek/CucaDiagramFileMaker.java +++ b/src/net/sourceforge/plantuml/svek/CucaDiagramFileMaker.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek.java b/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek.java index 2d5e16f..2769440 100644 --- a/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek.java +++ b/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -78,13 +78,15 @@ public final class CucaDiagramFileMakerSvek implements CucaDiagramFileMaker { private GeneralImageBuilder createDotDataImageBuilder(DotMode dotMode, StringBounder stringBounder) { final DotData dotData = new DotData(diagram.getEntityFactory().getRootGroup(), getOrderedLinks(), diagram.getLeafsvalues(), diagram.getUmlDiagramType(), diagram.getSkinParam(), diagram, diagram, - diagram.getColorMapper(), diagram.getEntityFactory(), diagram.isHideEmptyDescriptionForState(), - dotMode, diagram.getNamespaceSeparator(), diagram.getPragma()); - return new GeneralImageBuilder(dotData, diagram.getEntityFactory(), diagram.getSource(), diagram.getPragma(), - stringBounder); + diagram.getColorMapper(), diagram.getEntityFactory(), diagram.isHideEmptyDescriptionForState(), dotMode, + diagram.getNamespaceSeparator(), diagram.getPragma()); + final boolean intricated = diagram.mergeIntricated(); + return new GeneralImageBuilder(intricated, dotData, diagram.getEntityFactory(), diagram.getSource(), + diagram.getPragma(), stringBounder); } + private ImageData createFileInternal(OutputStream os, List<String> dotStrings, FileFormatOption fileFormatOption) throws IOException, InterruptedException { if (diagram.getUmlDiagramType() == UmlDiagramType.ACTIVITY) { @@ -161,7 +163,7 @@ public final class CucaDiagramFileMakerSvek implements CucaDiagramFileMaker { final double scale; final Scale diagScale = diagram.getScale(); if (diagScale == null) { - scale = diagram.getDpiFactor(fileFormatOption); + scale = diagram.getScaleCoef(fileFormatOption); } else { scale = diagScale.getScale(dim.getWidth(), dim.getHeight()); } diff --git a/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek2InternalImage.java b/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek2InternalImage.java index 00c4945..c99d586 100644 --- a/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek2InternalImage.java +++ b/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek2InternalImage.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -102,7 +102,7 @@ public final class CucaDiagramFileMakerSvek2InternalImage extends AbstractTextBl } private HtmlColor getColor(ColorParam colorParam, Stereotype stereotype) { - return new Rose().getHtmlColor(skinParam, colorParam, stereotype); + return new Rose().getHtmlColor(skinParam, stereotype, colorParam); } public CucaDiagramFileMakerSvek2InternalImage(List<IEntityImage> inners, char concurrentSeparator, @@ -142,6 +142,10 @@ public final class CucaDiagramFileMakerSvek2InternalImage extends AbstractTextBl public HtmlColor getBackcolor() { return skinParam.getBackgroundColor(); } + + public double getOverscanX(StringBounder stringBounder) { + return 0; + } public boolean isHidden() { return false; diff --git a/src/net/sourceforge/plantuml/svek/DecorateEntityImage.java b/src/net/sourceforge/plantuml/svek/DecorateEntityImage.java index dfbebc5..ec12e7f 100644 --- a/src/net/sourceforge/plantuml/svek/DecorateEntityImage.java +++ b/src/net/sourceforge/plantuml/svek/DecorateEntityImage.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/DecorateEntityImage3.java b/src/net/sourceforge/plantuml/svek/DecorateEntityImage3.java index c8f5966..ece543c 100644 --- a/src/net/sourceforge/plantuml/svek/DecorateEntityImage3.java +++ b/src/net/sourceforge/plantuml/svek/DecorateEntityImage3.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/DotMode.java b/src/net/sourceforge/plantuml/svek/DotMode.java index b711dc6..d29b2d7 100644 --- a/src/net/sourceforge/plantuml/svek/DotMode.java +++ b/src/net/sourceforge/plantuml/svek/DotMode.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/DotStringFactory.java b/src/net/sourceforge/plantuml/svek/DotStringFactory.java index e08a9c3..5d1fad9 100644 --- a/src/net/sourceforge/plantuml/svek/DotStringFactory.java +++ b/src/net/sourceforge/plantuml/svek/DotStringFactory.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -60,6 +60,7 @@ import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils; import net.sourceforge.plantuml.cucadiagram.dot.GraphvizVersion; import net.sourceforge.plantuml.cucadiagram.dot.GraphvizVersions; import net.sourceforge.plantuml.cucadiagram.dot.ProcessState; +import net.sourceforge.plantuml.cucadiagram.entity.EntityFactory; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.posimo.Moveable; @@ -104,8 +105,8 @@ public class DotStringFactory implements Moveable { this.current = root; } - public void addShape(Shape shape) { - current.addShape(shape); + public void addNode(Node node) { + current.addNode(node); } private void printMinRanking(StringBuilder sb) { @@ -343,7 +344,8 @@ public class DotStringFactory implements Moveable { return graphviz.getDotExe(); } - public ClusterPosition solve(final String svg) throws IOException, InterruptedException { + public ClusterPosition solve(boolean mergeIntricated, EntityFactory entityFactory, final String svg) + throws IOException, InterruptedException { if (svg.length() == 0) { throw new EmptySvgException(); } @@ -360,17 +362,18 @@ public class DotStringFactory implements Moveable { final Point2DFunction move = new YDelta(fullHeight); final SvgResult svgResult = new SvgResult(svg, move); - for (Shape sh : bibliotekon.allShapes()) { - int idx = svg.indexOf("<title>" + sh.getUid() + "</title>"); - if (sh.getType() == ShapeType.RECTANGLE || sh.getType() == ShapeType.RECTANGLE_HTML_FOR_PORTS - || sh.getType() == ShapeType.RECTANGLE_WITH_CIRCLE_INSIDE || sh.getType() == ShapeType.FOLDER - || sh.getType() == ShapeType.DIAMOND) { + for (Node node : bibliotekon.allNodes()) { + int idx = svg.indexOf("<title>" + node.getUid() + "</title>"); + if (node.getType() == ShapeType.RECTANGLE || node.getType() == ShapeType.RECTANGLE_HTML_FOR_PORTS + || node.getType() == ShapeType.RECTANGLE_WITH_CIRCLE_INSIDE || node.getType() == ShapeType.FOLDER + || node.getType() == ShapeType.DIAMOND) { final List<Point2D.Double> points = svgResult.substring(idx).extractList(SvgResult.POINTS_EQUALS); - final double minX = SvekUtils.getMinX(points); final double minY = SvekUtils.getMinY(points); - corner1.manage(minX, minY); - sh.moveSvek(minX, minY); - } else if (sh.getType() == ShapeType.ROUND_RECTANGLE) { + final double overscanX = node.getOverscanX(stringBounder); + final double minX = SvekUtils.getMinX(points); + corner1.manage(minX - overscanX, minY); + node.moveSvek(minX, minY); + } else if (node.getType() == ShapeType.ROUND_RECTANGLE) { final int idx2 = svg.indexOf("d=\"", idx + 1); idx = svg.indexOf("points=\"", idx + 1); final List<Point2D.Double> points; @@ -387,29 +390,35 @@ public class DotStringFactory implements Moveable { final double minX = SvekUtils.getMinX(points); final double minY = SvekUtils.getMinY(points); corner1.manage(minX, minY); - sh.moveSvek(minX, minY); - } else if (sh.getType() == ShapeType.OCTAGON) { + node.moveSvek(minX, minY); + } else if (node.getType() == ShapeType.OCTAGON) { idx = svg.indexOf("points=\"", idx + 1); final int starting = idx; final List<Point2D.Double> points = svgResult.substring(starting).extractList(SvgResult.POINTS_EQUALS); final double minX = SvekUtils.getMinX(points); final double minY = SvekUtils.getMinY(points); corner1.manage(minX, minY); - sh.moveSvek(minX, minY); - sh.setOctagon(minX, minY, points); - } else if (sh.getType() == ShapeType.CIRCLE || sh.getType() == ShapeType.CIRCLE_IN_RECT - || sh.getType() == ShapeType.OVAL) { + node.moveSvek(minX, minY); + node.setOctagon(minX, minY, points); + } else if (node.getType() == ShapeType.CIRCLE || node.getType() == ShapeType.CIRCLE_IN_RECT + || node.getType() == ShapeType.OVAL) { final double cx = SvekUtils.getValue(svg, idx, "cx"); final double cy = SvekUtils.getValue(svg, idx, "cy") + fullHeight; final double rx = SvekUtils.getValue(svg, idx, "rx"); final double ry = SvekUtils.getValue(svg, idx, "ry"); - sh.moveSvek(cx - rx, cy - ry); + node.moveSvek(cx - rx, cy - ry); } else { - throw new IllegalStateException(sh.getType().toString() + " " + sh.getUid()); + throw new IllegalStateException(node.getType().toString() + " " + node.getUid()); } } for (Cluster cluster : bibliotekon.allCluster()) { + if (mergeIntricated) { + final IGroup group = cluster.getGroups().iterator().next(); + if (entityFactory.isIntricated(group) != null) { + continue; + } + } int idx = getClusterIndex(svg, cluster.getColor()); final int starting = idx; final List<Point2D.Double> points = svgResult.substring(starting).extractList(SvgResult.POINTS_EQUALS); @@ -437,7 +446,7 @@ public class DotStringFactory implements Moveable { } for (Line line : bibliotekon.allLines()) { - line.manageCollision(bibliotekon.allShapes()); + line.manageCollision(bibliotekon.allNodes()); } corner1.manage(0, 0); return new ClusterPosition(corner1.getMinX(), corner1.getMinY(), fullWidth, fullHeight); @@ -458,22 +467,22 @@ public class DotStringFactory implements Moveable { return idx; } - public void openCluster(IGroup g, int titleAndAttributeWidth, int titleAndAttributeHeight, TextBlock title, - TextBlock stereo) { - this.current = current.createChild(g, titleAndAttributeWidth, titleAndAttributeHeight, title, stereo, - colorSequence, skinParam); + public void openCluster(int titleAndAttributeWidth, int titleAndAttributeHeight, TextBlock title, TextBlock stereo, + IGroup g) { + this.current = current.createChild(titleAndAttributeWidth, titleAndAttributeHeight, title, stereo, + colorSequence, skinParam, g); bibliotekon.addCluster(this.current); } public void closeCluster() { - if (current.getParent() == null) { + if (current.getParentCluster() == null) { throw new IllegalStateException(); } - this.current = current.getParent(); + this.current = current.getParentCluster(); } public void moveSvek(double deltaX, double deltaY) { - for (Shape sh : bibliotekon.allShapes()) { + for (Node sh : bibliotekon.allNodes()) { sh.moveSvek(deltaX, deltaY); } for (Line line : bibliotekon.allLines()) { diff --git a/src/net/sourceforge/plantuml/svek/EmptySvgException.java b/src/net/sourceforge/plantuml/svek/EmptySvgException.java index fb02847..a84e2bc 100644 --- a/src/net/sourceforge/plantuml/svek/EmptySvgException.java +++ b/src/net/sourceforge/plantuml/svek/EmptySvgException.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/EntityDomain.java b/src/net/sourceforge/plantuml/svek/EntityDomain.java index 99062dd..8aa9cee 100644 --- a/src/net/sourceforge/plantuml/svek/EntityDomain.java +++ b/src/net/sourceforge/plantuml/svek/EntityDomain.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/EntityImageProtected.java b/src/net/sourceforge/plantuml/svek/EntityImageProtected.java index 823ad05..5be9388 100644 --- a/src/net/sourceforge/plantuml/svek/EntityImageProtected.java +++ b/src/net/sourceforge/plantuml/svek/EntityImageProtected.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -94,5 +94,10 @@ public class EntityImageProtected extends AbstractTextBlock implements IEntityIm public Margins getShield(StringBounder stringBounder) { return orig.getShield(stringBounder); } + + public double getOverscanX(StringBounder stringBounder) { + return orig.getOverscanX(stringBounder); + } + }
\ No newline at end of file diff --git a/src/net/sourceforge/plantuml/svek/FrontierCalculator.java b/src/net/sourceforge/plantuml/svek/FrontierCalculator.java index b3ae398..3f8a6bc 100644 --- a/src/net/sourceforge/plantuml/svek/FrontierCalculator.java +++ b/src/net/sourceforge/plantuml/svek/FrontierCalculator.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/GeneralImageBuilder.java b/src/net/sourceforge/plantuml/svek/GeneralImageBuilder.java index 38cc28e..a0025f3 100644 --- a/src/net/sourceforge/plantuml/svek/GeneralImageBuilder.java +++ b/src/net/sourceforge/plantuml/svek/GeneralImageBuilder.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -36,6 +36,7 @@ package net.sourceforge.plantuml.svek; import java.awt.geom.Dimension2D; +import java.awt.geom.Rectangle2D; import java.io.File; import java.io.IOException; import java.util.ArrayList; @@ -47,21 +48,26 @@ import java.util.regex.Pattern; import net.sourceforge.plantuml.BaseFile; import net.sourceforge.plantuml.ColorParam; +import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FontParam; +import net.sourceforge.plantuml.Guillemet; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.Pragma; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.SkinParamForecolored; import net.sourceforge.plantuml.SkinParamSameClassWidth; import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.UmlDiagramType; +import net.sourceforge.plantuml.activitydiagram3.ftile.EntityImageLegend; import net.sourceforge.plantuml.core.UmlSource; -import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.cucadiagram.DisplayPositionned; import net.sourceforge.plantuml.cucadiagram.EntityPortion; import net.sourceforge.plantuml.cucadiagram.EntityPosition; +import net.sourceforge.plantuml.cucadiagram.GroupRoot; import net.sourceforge.plantuml.cucadiagram.GroupType; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.IGroup; @@ -78,6 +84,7 @@ import net.sourceforge.plantuml.cucadiagram.dot.ExeState; import net.sourceforge.plantuml.cucadiagram.dot.GraphvizVersion; import net.sourceforge.plantuml.cucadiagram.dot.Neighborhood; import net.sourceforge.plantuml.cucadiagram.entity.EntityFactory; +import net.sourceforge.plantuml.cucadiagram.entity.EntityImpl; import net.sourceforge.plantuml.descdiagram.EntityImageDesignedDomain; import net.sourceforge.plantuml.descdiagram.EntityImageDomain; import net.sourceforge.plantuml.descdiagram.EntityImageMachine; @@ -86,6 +93,7 @@ import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.GraphicStrings; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.graphic.InnerStrategy; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockEmpty; @@ -94,6 +102,9 @@ import net.sourceforge.plantuml.graphic.TextBlockWidth; import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.USymbolInterface; import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.svek.image.EntityImageActivity; import net.sourceforge.plantuml.svek.image.EntityImageArcCircle; import net.sourceforge.plantuml.svek.image.EntityImageAssociation; @@ -118,28 +129,228 @@ import net.sourceforge.plantuml.svek.image.EntityImageStateEmptyDescription; import net.sourceforge.plantuml.svek.image.EntityImageSynchroBar; import net.sourceforge.plantuml.svek.image.EntityImageTips; import net.sourceforge.plantuml.svek.image.EntityImageUseCase; -import net.sourceforge.plantuml.ugraphic.sprite.Sprite; +import net.sourceforge.plantuml.ugraphic.MinMax; +import net.sourceforge.plantuml.ugraphic.UGraphic; public final class GeneralImageBuilder { + public static IEntityImage createEntityImageBlock(ILeaf leaf, ISkinParam skinParam, + boolean isHideEmptyDescriptionForState, PortionShower portionShower, Bibliotekon bibliotekon, + GraphvizVersion graphvizVersion, UmlDiagramType umlDiagramType, Collection<Link> links) { + if (leaf.isRemoved()) { + throw new IllegalStateException(); + } + if (leaf.getLeafType().isLikeClass()) { + final EntityImageClass entityImageClass = new EntityImageClass(graphvizVersion, (ILeaf) leaf, skinParam, + portionShower); + final Neighborhood neighborhood = leaf.getNeighborhood(); + if (neighborhood != null) { + return new EntityImageProtected(entityImageClass, 20, neighborhood, bibliotekon); + } + return entityImageClass; + } + if (leaf.getLeafType() == LeafType.NOTE) { + return new EntityImageNote(leaf, skinParam); + } + if (leaf.getLeafType() == LeafType.ACTIVITY) { + return new EntityImageActivity(leaf, skinParam, bibliotekon); + } + if (leaf.getLeafType() == LeafType.STATE) { + if (leaf.getEntityPosition() != EntityPosition.NORMAL) { + final Cluster stateParent = bibliotekon.getCluster(leaf.getParentContainer()); + return new EntityImageStateBorder(leaf, skinParam, stateParent, bibliotekon); + } + if (isHideEmptyDescriptionForState && leaf.getBodier().getFieldsToDisplay().size() == 0) { + return new EntityImageStateEmptyDescription(leaf, skinParam); + } + if (leaf.getStereotype() != null + && "<<sdlreceive>>".equals(leaf.getStereotype().getLabel(Guillemet.DOUBLE_COMPARATOR))) { + return new EntityImageState2(leaf, skinParam); + } + return new EntityImageState(leaf, skinParam); + + } + if (leaf.getLeafType() == LeafType.CIRCLE_START) { + ColorParam param = ColorParam.activityStart; + if (umlDiagramType == UmlDiagramType.STATE) { + param = ColorParam.stateStart; + } + return new EntityImageCircleStart(leaf, skinParam, param); + } + if (leaf.getLeafType() == LeafType.CIRCLE_END) { + ColorParam param = ColorParam.activityEnd; + if (umlDiagramType == UmlDiagramType.STATE) { + param = ColorParam.stateEnd; + } + return new EntityImageCircleEnd(leaf, skinParam, param); + } + if (leaf.getLeafType() == LeafType.BRANCH || leaf.getLeafType() == LeafType.STATE_CHOICE) { + return new EntityImageBranch(leaf, skinParam); + } + if (leaf.getLeafType() == LeafType.LOLLIPOP_FULL || leaf.getLeafType() == LeafType.LOLLIPOP_HALF) { + return new EntityImageLollipopInterface(leaf, skinParam); + } + if (leaf.getLeafType() == LeafType.CIRCLE) { + return new EntityImageDescription(leaf, skinParam, portionShower, links); + } + + if (leaf.getLeafType() == LeafType.DESCRIPTION) { + if (OptionFlags.USE_INTERFACE_EYE1 && leaf.getUSymbol() instanceof USymbolInterface) { + return new EntityImageLollipopInterfaceEye1(leaf, skinParam, bibliotekon); + } else if (OptionFlags.USE_INTERFACE_EYE2 && leaf.getUSymbol() instanceof USymbolInterface) { + return new EntityImageLollipopInterfaceEye2(leaf, skinParam, portionShower); + } else { + return new EntityImageDescription(leaf, skinParam, portionShower, links); + } + } + if (leaf.getLeafType() == LeafType.USECASE) { + return new EntityImageUseCase(leaf, skinParam, portionShower); + } + // if (leaf.getEntityType() == LeafType.CIRCLE_INTERFACE) { + // return new EntityImageCircleInterface(leaf, skinParam); + // } + if (leaf.getLeafType() == LeafType.OBJECT) { + return new EntityImageObject(leaf, skinParam, portionShower); + } + if (leaf.getLeafType() == LeafType.SYNCHRO_BAR || leaf.getLeafType() == LeafType.STATE_FORK_JOIN) { + return new EntityImageSynchroBar(leaf, skinParam); + } + if (leaf.getLeafType() == LeafType.ARC_CIRCLE) { + return new EntityImageArcCircle(leaf, skinParam); + } + if (leaf.getLeafType() == LeafType.POINT_FOR_ASSOCIATION) { + return new EntityImageAssociationPoint(leaf, skinParam); + } + if (leaf.isGroup()) { + return new EntityImageGroup(leaf, skinParam); + } + if (leaf.getLeafType() == LeafType.EMPTY_PACKAGE) { + if (leaf.getUSymbol() != null) { + // final HtmlColor black = HtmlColorUtils.BLACK; + final HtmlColor black = SkinParamUtils.getColor(skinParam, leaf.getStereotype(), + leaf.getUSymbol().getColorParamBorder()); + return new EntityImageDescription(leaf, new SkinParamForecolored(skinParam, black), portionShower, + links); + } + return new EntityImageEmptyPackage(leaf, skinParam, portionShower); + } + if (leaf.getLeafType() == LeafType.ASSOCIATION) { + return new EntityImageAssociation(leaf, skinParam); + } + if (leaf.getLeafType() == LeafType.PSEUDO_STATE) { + return new EntityImagePseudoState(leaf, skinParam); + } + if (leaf.getLeafType() == LeafType.TIPS) { + return new EntityImageTips(leaf, skinParam, bibliotekon); + } + // TODO Clean + if (leaf.getLeafType() == LeafType.DOMAIN && leaf.getStereotype() != null + && leaf.getStereotype().isMachineOrSpecification()) { + return new EntityImageMachine(leaf, skinParam); + } else if (leaf.getLeafType() == LeafType.DOMAIN && leaf.getStereotype() != null + && leaf.getStereotype().isDesignedOrSolved()) { + return new EntityImageDesignedDomain(leaf, skinParam); + } else if (leaf.getLeafType() == LeafType.REQUIREMENT) { + return new EntityImageRequirement(leaf, skinParam); + } else if (leaf.getLeafType() == LeafType.DOMAIN && leaf.getStereotype() != null + && leaf.getStereotype().isLexicalOrGiven()) { + return new EntityImageDomain(leaf, skinParam, 'X'); + } else if (leaf.getLeafType() == LeafType.DOMAIN && leaf.getStereotype() != null + && leaf.getStereotype().isCausal()) { + return new EntityImageDomain(leaf, skinParam, 'C'); + } else if (leaf.getLeafType() == LeafType.DOMAIN && leaf.getStereotype() != null + && leaf.getStereotype().isBiddableOrUncertain()) { + return new EntityImageDomain(leaf, skinParam, 'B'); + } else if (leaf.getLeafType() == LeafType.DOMAIN) { + return new EntityImageDomain(leaf, skinParam, 'P'); + } else + throw new UnsupportedOperationException(leaf.getLeafType().toString()); + } + private final DotData dotData; private final EntityFactory entityFactory; private final UmlSource source; private final Pragma pragma; - private Map<Code, Double> maxX; + private final boolean strictUmlStyle; + private Map<String, Double> maxX; private final StringBounder stringBounder; + private final boolean mergeIntricated; - public GeneralImageBuilder(DotData dotData, EntityFactory entityFactory, UmlSource source, Pragma pragma, - StringBounder stringBounder) { + public GeneralImageBuilder(boolean mergeIntricated, DotData dotData, EntityFactory entityFactory, UmlSource source, + Pragma pragma, StringBounder stringBounder) { this.dotData = dotData; this.entityFactory = entityFactory; this.source = source; this.pragma = pragma; this.stringBounder = stringBounder; + this.strictUmlStyle = dotData.getSkinParam().strictUmlStyle(); + this.mergeIntricated = mergeIntricated; + } + + final public StyleSignature getDefaultStyleDefinitionArrow() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.arrow); + } + + private boolean isOpalisable(IEntity entity) { + if (strictUmlStyle) { + return false; + } + return entity.isGroup() == false && entity.getLeafType() == LeafType.NOTE && onlyOneLink(entity); + } + + static class IEntityImageEmpty implements IEntityImage { + + public boolean isHidden() { + return false; + } + + public HtmlColor getBackcolor() { + return null; + } + + public Dimension2D calculateDimension(StringBounder stringBounder) { + return new Dimension2DDouble(10, 10); + } + + public MinMax getMinMax(StringBounder stringBounder) { + return MinMax.fromDim(calculateDimension(stringBounder)); + } + + public Rectangle2D getInnerPosition(String member, StringBounder stringBounder, InnerStrategy strategy) { + return null; + } + + public void drawU(UGraphic ug) { + } + + public ShapeType getShapeType() { + return ShapeType.RECTANGLE; + } + + public Margins getShield(StringBounder stringBounder) { + return Margins.NONE; + } + + public double getOverscanX(StringBounder stringBounder) { + return 0; + } + } public IEntityImage buildImage(BaseFile basefile, String dotStrings[]) { + if (dotData.isDegeneratedWithFewEntities(0)) { + return new IEntityImageEmpty(); + } + if (dotData.isDegeneratedWithFewEntities(1) && dotData.getUmlDiagramType() != UmlDiagramType.STATE) { + final ILeaf single = dotData.getLeafs().iterator().next(); + final IGroup group = single.getParentContainer(); + if (group instanceof GroupRoot) { + return new IEntityImageMoved(GeneralImageBuilder.createEntityImageBlock(single, dotData.getSkinParam(), + dotData.isHideEmptyDescriptionForState(), dotData, null, null, dotData.getUmlDiagramType(), + dotData.getLinks())); + } + } dotData.removeIrrelevantSametail(); final DotStringFactory dotStringFactory = new DotStringFactory(stringBounder, dotData); @@ -152,27 +363,32 @@ public final class GeneralImageBuilder { } try { final ISkinParam skinParam = dotData.getSkinParam(); - final FontConfiguration labelFont = new FontConfiguration(skinParam, FontParam.ARROW, null); + final FontConfiguration labelFont; + if (SkinParam.USE_STYLES()) { + final Style style = getDefaultStyleDefinitionArrow() + .getMergedStyle(skinParam.getCurrentStyleBuilder()); + labelFont = style.getFontConfiguration(skinParam.getIHtmlColorSet()); + } else { + labelFont = new FontConfiguration(skinParam, FontParam.ARROW, null); + } final Line line = new Line(link, dotStringFactory.getColorSequence(), skinParam, stringBounder, labelFont, dotStringFactory.getBibliotekon(), dotData.getPragma()); dotStringFactory.getBibliotekon().addLine(line); - if (link.getEntity1().isGroup() == false && link.getEntity1().getLeafType() == LeafType.NOTE - && onlyOneLink(link.getEntity1())) { - final Shape shape = dotStringFactory.getBibliotekon().getShape(link.getEntity1()); - final Shape other = dotStringFactory.getBibliotekon().getShape(link.getEntity2()); + if (isOpalisable(link.getEntity1())) { + final Node node = dotStringFactory.getBibliotekon().getNode(link.getEntity1()); + final Node other = dotStringFactory.getBibliotekon().getNode(link.getEntity2()); if (other != null) { - ((EntityImageNote) shape.getImage()).setOpaleLine(line, shape, other); + ((EntityImageNote) node.getImage()).setOpaleLine(line, node, other); line.setOpale(true); } - } else if (link.getEntity2().isGroup() == false && link.getEntity2().getLeafType() == LeafType.NOTE - && onlyOneLink(link.getEntity2())) { - final Shape shape = dotStringFactory.getBibliotekon().getShape(link.getEntity2()); - final Shape other = dotStringFactory.getBibliotekon().getShape(link.getEntity1()); + } else if (isOpalisable(link.getEntity2())) { + final Node node = dotStringFactory.getBibliotekon().getNode(link.getEntity2()); + final Node other = dotStringFactory.getBibliotekon().getNode(link.getEntity1()); if (other != null) { - ((EntityImageNote) shape.getImage()).setOpaleLine(line, shape, other); + ((EntityImageNote) node.getImage()).setOpaleLine(line, node, other); line.setOpale(true); } } @@ -185,13 +401,10 @@ public final class GeneralImageBuilder { return error(dotStringFactory.getDotExe()); } - // final boolean trace = OptionFlags.getInstance().isKeepTmpFiles() || OptionFlags.TRACE_DOT || isSvekTrace(); - // option.isDebugSvek - // System.err.println("FOO11 svekDebug=" + svekDebug); if (basefile == null && isSvekTrace()) { basefile = new BaseFile(); } - // System.err.println("FOO11 basefile=" + basefile); + final String svg; try { svg = dotStringFactory.getSvg(basefile, dotStrings); @@ -203,7 +416,8 @@ public final class GeneralImageBuilder { } final String graphvizVersion = extractGraphvizVersion(svg); try { - final ClusterPosition position = dotStringFactory.solve(svg).delta(10, 10); + final ClusterPosition position = dotStringFactory.solve(mergeIntricated, dotData.getEntityFactory(), svg) + .delta(10, 10); final double minY = position.getMinY(); final double minX = position.getMinX(); if (minX > 0 || minY > 0) { @@ -283,12 +497,8 @@ public final class GeneralImageBuilder { throw new IllegalStateException(); } final IEntityImage image = printEntityInternal(dotStringFactory, ent); - final Dimension2D dim = image.calculateDimension(stringBounder); - final Shape shape = new Shape(image, image.getShapeType(), dim.getWidth(), dim.getHeight(), - dotStringFactory.getColorSequence(), ent.isTop(), image.getShield(stringBounder), - ent.getEntityPosition()); - dotStringFactory.addShape(shape); - dotStringFactory.getBibliotekon().putShape(ent, shape); + final Node node = dotStringFactory.getBibliotekon().createNode(ent, image, dotStringFactory.getColorSequence(), stringBounder); + dotStringFactory.addNode(node); } private IEntityImage printEntityInternal(DotStringFactory dotStringFactory, ILeaf ent) { @@ -325,138 +535,6 @@ public final class GeneralImageBuilder { return result; } - public static IEntityImage createEntityImageBlock(ILeaf leaf, ISkinParam skinParam, - boolean isHideEmptyDescriptionForState, PortionShower portionShower, Bibliotekon bibliotekon, - GraphvizVersion graphvizVersion, UmlDiagramType umlDiagramType, Collection<Link> links) { - if (leaf.isRemoved()) { - throw new IllegalStateException(); - } - if (leaf.getLeafType().isLikeClass()) { - final EntityImageClass entityImageClass = new EntityImageClass(graphvizVersion, (ILeaf) leaf, skinParam, - portionShower); - final Neighborhood neighborhood = leaf.getNeighborhood(); - if (neighborhood != null) { - return new EntityImageProtected(entityImageClass, 20, neighborhood, bibliotekon); - } - return entityImageClass; - } - if (leaf.getLeafType() == LeafType.NOTE) { - return new EntityImageNote(leaf, skinParam); - } - if (leaf.getLeafType() == LeafType.ACTIVITY) { - return new EntityImageActivity(leaf, skinParam, bibliotekon); - } - if (leaf.getLeafType() == LeafType.STATE) { - if (leaf.getEntityPosition() != EntityPosition.NORMAL) { - final Cluster stateParent = bibliotekon.getCluster(leaf.getParentContainer()); - return new EntityImageStateBorder(leaf, skinParam, stateParent, bibliotekon); - } - if (isHideEmptyDescriptionForState && leaf.getBodier().getFieldsToDisplay().size() == 0) { - return new EntityImageStateEmptyDescription(leaf, skinParam); - } - if (leaf.getStereotype() != null && "<<sdlreceive>>".equals(leaf.getStereotype().getLabel(false))) { - return new EntityImageState2(leaf, skinParam); - } - return new EntityImageState(leaf, skinParam); - - } - if (leaf.getLeafType() == LeafType.CIRCLE_START) { - ColorParam param = ColorParam.activityStart; - if (umlDiagramType == UmlDiagramType.STATE) { - param = ColorParam.stateStart; - } - return new EntityImageCircleStart(leaf, skinParam, param); - } - if (leaf.getLeafType() == LeafType.CIRCLE_END) { - ColorParam param = ColorParam.activityEnd; - if (umlDiagramType == UmlDiagramType.STATE) { - param = ColorParam.stateEnd; - } - return new EntityImageCircleEnd(leaf, skinParam, param); - } - if (leaf.getLeafType() == LeafType.BRANCH || leaf.getLeafType() == LeafType.STATE_CHOICE) { - return new EntityImageBranch(leaf, skinParam); - } - if (leaf.getLeafType() == LeafType.LOLLIPOP) { - return new EntityImageLollipopInterface(leaf, skinParam); - } - if (leaf.getLeafType() == LeafType.CIRCLE) { - return new EntityImageDescription(leaf, skinParam, portionShower, links); - } - - if (leaf.getLeafType() == LeafType.DESCRIPTION) { - if (OptionFlags.USE_INTERFACE_EYE1 && leaf.getUSymbol() instanceof USymbolInterface) { - return new EntityImageLollipopInterfaceEye1(leaf, skinParam, bibliotekon); - } else if (OptionFlags.USE_INTERFACE_EYE2 && leaf.getUSymbol() instanceof USymbolInterface) { - return new EntityImageLollipopInterfaceEye2(leaf, skinParam, portionShower); - } else { - return new EntityImageDescription(leaf, skinParam, portionShower, links); - } - } - if (leaf.getLeafType() == LeafType.USECASE) { - return new EntityImageUseCase(leaf, skinParam, portionShower); - } - // if (leaf.getEntityType() == LeafType.CIRCLE_INTERFACE) { - // return new EntityImageCircleInterface(leaf, skinParam); - // } - if (leaf.getLeafType() == LeafType.OBJECT) { - return new EntityImageObject(leaf, skinParam, portionShower); - } - if (leaf.getLeafType() == LeafType.SYNCHRO_BAR || leaf.getLeafType() == LeafType.STATE_FORK_JOIN) { - return new EntityImageSynchroBar(leaf, skinParam); - } - if (leaf.getLeafType() == LeafType.ARC_CIRCLE) { - return new EntityImageArcCircle(leaf, skinParam); - } - if (leaf.getLeafType() == LeafType.POINT_FOR_ASSOCIATION) { - return new EntityImageAssociationPoint(leaf, skinParam); - } - if (leaf.isGroup()) { - return new EntityImageGroup(leaf, skinParam); - } - if (leaf.getLeafType() == LeafType.EMPTY_PACKAGE) { - if (leaf.getUSymbol() != null) { - // final HtmlColor black = HtmlColorUtils.BLACK; - final HtmlColor black = SkinParamUtils.getColor(skinParam, leaf.getUSymbol().getColorParamBorder(), - leaf.getStereotype()); - return new EntityImageDescription(leaf, new SkinParamForecolored(skinParam, black), portionShower, - links); - } - return new EntityImageEmptyPackage(leaf, skinParam, portionShower); - } - if (leaf.getLeafType() == LeafType.ASSOCIATION) { - return new EntityImageAssociation(leaf, skinParam); - } - if (leaf.getLeafType() == LeafType.PSEUDO_STATE) { - return new EntityImagePseudoState(leaf, skinParam); - } - if (leaf.getLeafType() == LeafType.TIPS) { - return new EntityImageTips(leaf, skinParam, bibliotekon); - } - // TODO Clean - if (leaf.getLeafType() == LeafType.DOMAIN && leaf.getStereotype() != null - && leaf.getStereotype().isMachineOrSpecification()) { - return new EntityImageMachine(leaf, skinParam); - } else if (leaf.getLeafType() == LeafType.DOMAIN && leaf.getStereotype() != null - && leaf.getStereotype().isDesignedOrSolved()) { - return new EntityImageDesignedDomain(leaf, skinParam); - } else if (leaf.getLeafType() == LeafType.REQUIREMENT) { - return new EntityImageRequirement(leaf, skinParam); - } else if (leaf.getLeafType() == LeafType.DOMAIN && leaf.getStereotype() != null - && leaf.getStereotype().isLexicalOrGiven()) { - return new EntityImageDomain(leaf, skinParam, 'X'); - } else if (leaf.getLeafType() == LeafType.DOMAIN && leaf.getStereotype() != null - && leaf.getStereotype().isCausal()) { - return new EntityImageDomain(leaf, skinParam, 'C'); - } else if (leaf.getLeafType() == LeafType.DOMAIN && leaf.getStereotype() != null - && leaf.getStereotype().isBiddableOrUncertain()) { - return new EntityImageDomain(leaf, skinParam, 'B'); - } else if (leaf.getLeafType() == LeafType.DOMAIN) { - return new EntityImageDomain(leaf, skinParam, 'P'); - } else - throw new UnsupportedOperationException(leaf.getLeafType().toString()); - } - private Collection<ILeaf> getUnpackagedEntities() { final List<ILeaf> result = new ArrayList<ILeaf>(); for (ILeaf ent : dotData.getLeafs()) { @@ -468,28 +546,15 @@ public final class GeneralImageBuilder { } private void printGroups(DotStringFactory dotStringFactory, IGroup parent) { - for (IGroup g : dotData.getGroupHierarchy().getChildrenGroups(parent)) { + final Collection<IGroup> groups = dotData.getGroupHierarchy().getChildrenGroups(parent); + for (IGroup g : groups) { if (g.isRemoved()) { continue; } if (dotData.isEmpty(g) && g.getGroupType() == GroupType.PACKAGE) { - final ILeaf folder = entityFactory.createLeaf(g.getCode(), g.getDisplay(), LeafType.EMPTY_PACKAGE, - g.getParentContainer(), null, dotData.getNamespaceSeparator()); - final USymbol symbol = g.getUSymbol(); - folder.setUSymbol(symbol); - folder.setStereotype(g.getStereotype()); - if (g.getUrl99() != null) { - folder.addUrl(g.getUrl99()); - } - if (g.getColors(dotData.getSkinParam()).getColor(ColorType.BACK) == null) { - final ColorParam param = symbol == null ? ColorParam.packageBackground : symbol.getColorParamBack(); - final HtmlColor c1 = dotData.getSkinParam().getHtmlColor(param, g.getStereotype(), false); - folder.setSpecificColorTOBEREMOVED(ColorType.BACK, c1 == null ? dotData.getSkinParam() - .getBackgroundColor() : c1); - } else { - folder.setSpecificColorTOBEREMOVED(ColorType.BACK, - g.getColors(dotData.getSkinParam()).getColor(ColorType.BACK)); - } + final ISkinParam skinParam = dotData.getSkinParam(); + entityFactory.thisIsGoingToBeALeaf(g.getIdent()); + final ILeaf folder = entityFactory.createLeafForEmptyGroup(g, skinParam); printEntity(dotStringFactory, folder); } else { printGroup(dotStringFactory, g); @@ -501,6 +566,13 @@ public final class GeneralImageBuilder { if (g.getGroupType() == GroupType.CONCURRENT_STATE) { return; } + if (mergeIntricated) { + final IGroup intricated = dotData.getEntityFactory().isIntricated(g); + if (intricated != null) { + printGroup(dotStringFactory, intricated); + return; + } + } int titleAndAttributeWidth = 0; int titleAndAttributeHeight = 0; @@ -526,10 +598,11 @@ public final class GeneralImageBuilder { final int suppWidthBecauseOfShape = uSymbol == null ? 0 : uSymbol.suppWidthBecauseOfShape(); titleAndAttributeWidth = (int) Math.max(dimLabel.getWidth(), attributeWidth) + suppWidthBecauseOfShape; - titleAndAttributeHeight = (int) (dimLabel.getHeight() + attributeHeight + marginForFields + suppHeightBecauseOfShape); + titleAndAttributeHeight = (int) (dimLabel.getHeight() + attributeHeight + marginForFields + + suppHeightBecauseOfShape); } - dotStringFactory.openCluster(g, titleAndAttributeWidth, titleAndAttributeHeight, title, stereo); + dotStringFactory.openCluster(titleAndAttributeWidth, titleAndAttributeHeight, title, stereo, g); this.printEntities(dotStringFactory, g.getLeafsDirect()); printGroups(dotStringFactory, g); @@ -548,18 +621,32 @@ public final class GeneralImageBuilder { return label.create(fontConfiguration, HorizontalAlignment.CENTER, skinParam); } + private TextBlock addLegend(TextBlock original, DisplayPositionned legend) { + if (legend == null || legend.isNull()) { + return original; + } + final TextBlock legendBlock = EntityImageLegend.create(legend.getDisplay(), dotData.getSkinParam()); + return DecorateEntityImage.add(legendBlock, original, legend.getHorizontalAlignment(), + legend.getVerticalAlignment()); + } + private TextBlock getStereoBlock(IGroup g) { + final DisplayPositionned legend = g.getLegend(); + return addLegend(getStereoBlockWithoutLegend(g), legend); + } + + private TextBlock getStereoBlockWithoutLegend(IGroup g) { final Stereotype stereotype = g.getStereotype(); + // final DisplayPositionned legend = g.getLegend(); if (stereotype == null) { return TextBlockUtils.empty(0, 0); } - if (stereotype.getSprite() != null) { - final Sprite tmp = dotData.getSkinParam().getSprite(stereotype.getSprite()); - if (tmp != null) { - return tmp.asTextBlock(stereotype.getHtmlColor(), 1); - } + final TextBlock tmp = stereotype.getSprite(dotData.getSkinParam()); + if (tmp != null) { + return tmp; } - final List<String> stereos = stereotype.getLabels(dotData.getSkinParam().useGuillemet()); + + final List<String> stereos = stereotype.getLabels(dotData.getSkinParam().guillemet()); if (stereos == null) { return TextBlockUtils.empty(0, 0); } @@ -578,7 +665,7 @@ public final class GeneralImageBuilder { return ""; } final StringBuilder sb = new StringBuilder(); - for (Map.Entry<Code, Double> ent : maxX.entrySet()) { + for (Map.Entry<String, Double> ent : maxX.entrySet()) { if (ent.getValue() > warningOrError) { sb.append(ent.getKey() + " is overpassing the width limit."); sb.append("\n"); diff --git a/src/net/sourceforge/plantuml/svek/GraphvizCrash.java b/src/net/sourceforge/plantuml/svek/GraphvizCrash.java index d2d4500..70af558 100644 --- a/src/net/sourceforge/plantuml/svek/GraphvizCrash.java +++ b/src/net/sourceforge/plantuml/svek/GraphvizCrash.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -128,7 +128,7 @@ public class GraphvizCrash extends AbstractTextBlock implements IEntityImage { private List<String> init() { final List<String> strings = anErrorHasOccured(null, text); - strings.add("For some reason, dot/Graphviz has crashed."); + strings.add("For some reason, dot/GraphViz has crashed."); strings.add("This has been generated with PlantUML (" + Version.versionString() + ")."); checkOldVersionWarning(strings); strings.add(" "); @@ -196,5 +196,10 @@ public class GraphvizCrash extends AbstractTextBlock implements IEntityImage { public Margins getShield(StringBounder stringBounder) { return Margins.NONE; } + + public double getOverscanX(StringBounder stringBounder) { + return 0; + } + } diff --git a/src/net/sourceforge/plantuml/svek/GroupPngMakerActivity.java b/src/net/sourceforge/plantuml/svek/GroupPngMakerActivity.java index b60136e..4ac2451 100644 --- a/src/net/sourceforge/plantuml/svek/GroupPngMakerActivity.java +++ b/src/net/sourceforge/plantuml/svek/GroupPngMakerActivity.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -39,10 +39,11 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.Set; import net.sourceforge.plantuml.ColorParam; -import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.cucadiagram.CucaDiagram; import net.sourceforge.plantuml.cucadiagram.EntityUtils; import net.sourceforge.plantuml.cucadiagram.GroupHierarchy; @@ -51,13 +52,18 @@ import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.IGroup; import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.cucadiagram.Stereotype; +import net.sourceforge.plantuml.cucadiagram.SuperGroup; import net.sourceforge.plantuml.cucadiagram.dot.DotData; +import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.skin.rose.Rose; +import net.sourceforge.plantuml.style.PName; +import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.svek.image.EntityImageState; -import net.sourceforge.plantuml.ugraphic.UFont; public final class GroupPngMakerActivity { @@ -67,6 +73,18 @@ public final class GroupPngMakerActivity { class InnerGroupHierarchy implements GroupHierarchy { + public Set<SuperGroup> getAllSuperGroups() { + throw new UnsupportedOperationException(); + } + + public IGroup getRootGroup() { + throw new UnsupportedOperationException(); + } + + public SuperGroup getRootSuperGroup() { + throw new UnsupportedOperationException(); + } + public Collection<IGroup> getChildrenGroups(IGroup parent) { if (EntityUtils.groupRoot(parent)) { return diagram.getChildrenGroups(group); @@ -78,6 +96,8 @@ public final class GroupPngMakerActivity { return diagram.isEmpty(g); } + + } public GroupPngMakerActivity(CucaDiagram diagram, IGroup group, StringBounder stringBounder) { @@ -99,48 +119,48 @@ public final class GroupPngMakerActivity { return result; } - public IEntityImage getImage() throws IOException, InterruptedException { - // final List<? extends CharSequence> display = group.getDisplay(); - // final TextBlock title = Display.create(display, new FontConfiguration( - // getFont(FontParam.STATE), HtmlColorUtils.BLACK), HorizontalAlignment.CENTER, diagram.getSkinParam()); + final public StyleSignature getDefaultStyleDefinitionGroup() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.group); + } + public IEntityImage getImage() throws IOException, InterruptedException { if (group.size() == 0) { return new EntityImageState(group, diagram.getSkinParam()); } final List<Link> links = getPureInnerLinks(); final ISkinParam skinParam = diagram.getSkinParam(); - // if (OptionFlags.PBBACK && group.getSpecificBackColor() != null) { - // skinParam = new SkinParamBackcolored(skinParam, null, group.getSpecificBackColor()); - // } + final DotData dotData = new DotData(group, links, group.getLeafsDirect(), diagram.getUmlDiagramType(), skinParam, new InnerGroupHierarchy(), diagram.getColorMapper(), diagram.getEntityFactory(), false, DotMode.NORMAL, diagram.getNamespaceSeparator(), diagram.getPragma()); - final GeneralImageBuilder svek2 = new GeneralImageBuilder(dotData, diagram.getEntityFactory(), + final GeneralImageBuilder svek2 = new GeneralImageBuilder(false, dotData, diagram.getEntityFactory(), diagram.getSource(), diagram.getPragma(), stringBounder); if (group.getGroupType() == GroupType.INNER_ACTIVITY) { final Stereotype stereo = group.getStereotype(); final HtmlColor borderColor = getColor(ColorParam.activityBorder, stereo); - final HtmlColor backColor = group.getColors(skinParam).getColor(ColorType.BACK) == null ? getColor( - ColorParam.background, stereo) : group.getColors(skinParam).getColor(ColorType.BACK); - return new InnerActivity(svek2.buildImage(null, new String[0]), borderColor, backColor, - skinParam.shadowing(group.getStereotype())); + final HtmlColor backColor = group.getColors(skinParam).getColor(ColorType.BACK) == null + ? getColor(ColorParam.background, stereo) + : group.getColors(skinParam).getColor(ColorType.BACK); + final double shadowing; + if (SkinParam.USE_STYLES()) { + final Style style = getDefaultStyleDefinitionGroup().getMergedStyle(skinParam.getCurrentStyleBuilder()); + shadowing = style.value(PName.Shadowing).asDouble(); + } else { + shadowing = skinParam.shadowing(group.getStereotype()) ? 4 : 0; + } + return new InnerActivity(svek2.buildImage(null, new String[0]), borderColor, backColor, shadowing); } throw new UnsupportedOperationException(group.getGroupType().toString()); } - private UFont getFont(FontParam fontParam) { - final ISkinParam skinParam = diagram.getSkinParam(); - return skinParam.getFont(null, false, fontParam); - } - private final Rose rose = new Rose(); protected final HtmlColor getColor(ColorParam colorParam, Stereotype stereo) { final ISkinParam skinParam = diagram.getSkinParam(); - return rose.getHtmlColor(skinParam, colorParam, stereo); + return rose.getHtmlColor(skinParam, stereo, colorParam); } } diff --git a/src/net/sourceforge/plantuml/svek/GroupPngMakerState.java b/src/net/sourceforge/plantuml/svek/GroupPngMakerState.java index 82b6484..5368d1e 100644 --- a/src/net/sourceforge/plantuml/svek/GroupPngMakerState.java +++ b/src/net/sourceforge/plantuml/svek/GroupPngMakerState.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -38,6 +38,7 @@ package net.sourceforge.plantuml.svek; import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.Set; import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.FontParam; @@ -53,6 +54,7 @@ import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.cucadiagram.Stereotype; +import net.sourceforge.plantuml.cucadiagram.SuperGroup; import net.sourceforge.plantuml.cucadiagram.dot.DotData; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; @@ -75,6 +77,18 @@ public final class GroupPngMakerState { class InnerGroupHierarchy implements GroupHierarchy { + public Set<SuperGroup> getAllSuperGroups() { + throw new UnsupportedOperationException(); + } + + public IGroup getRootGroup() { + throw new UnsupportedOperationException(); + } + + public SuperGroup getRootSuperGroup() { + throw new UnsupportedOperationException(); + } + public Collection<IGroup> getChildrenGroups(IGroup parent) { if (EntityUtils.groupRoot(parent)) { return diagram.getChildrenGroups(group); @@ -110,9 +124,8 @@ public final class GroupPngMakerState { public IEntityImage getImage() { final Display display = group.getDisplay(); final ISkinParam skinParam = diagram.getSkinParam(); - final TextBlock title = display.create( - new FontConfiguration(skinParam, FontParam.STATE, group.getStereotype()), HorizontalAlignment.CENTER, - diagram.getSkinParam()); + final TextBlock title = display.create(new FontConfiguration(skinParam, FontParam.STATE, group.getStereotype()), + HorizontalAlignment.CENTER, diagram.getSkinParam()); if (group.size() == 0 && group.getChildren().size() == 0) { return new EntityImageState(group, diagram.getSkinParam()); @@ -124,7 +137,7 @@ public final class GroupPngMakerState { diagram.isHideEmptyDescriptionForState(), DotMode.NORMAL, diagram.getNamespaceSeparator(), diagram.getPragma()); - final GeneralImageBuilder svek2 = new GeneralImageBuilder(dotData, diagram.getEntityFactory(), + final GeneralImageBuilder svek2 = new GeneralImageBuilder(false, dotData, diagram.getEntityFactory(), diagram.getSource(), diagram.getPragma(), stringBounder); if (group.getGroupType() == GroupType.CONCURRENT_STATE) { @@ -141,22 +154,23 @@ public final class GroupPngMakerState { borderColor = getColor(ColorParam.stateBorder, group.getStereotype()); } final Stereotype stereo = group.getStereotype(); - final HtmlColor backColor = group.getColors(skinParam).getColor(ColorType.BACK) == null ? getColor( - ColorParam.stateBackground, stereo) : group.getColors(skinParam).getColor(ColorType.BACK); + final HtmlColor backColor = group.getColors(skinParam).getColor(ColorType.BACK) == null + ? getColor(ColorParam.stateBackground, stereo) + : group.getColors(skinParam).getColor(ColorType.BACK); final TextBlockWidth attribute = getAttributes(skinParam); final Stereotype stereotype = group.getStereotype(); final boolean withSymbol = stereotype != null && stereotype.isWithOOSymbol(); final boolean containsOnlyConcurrentStates = containsOnlyConcurrentStates(dotData); - final IEntityImage image = containsOnlyConcurrentStates ? buildImageForConcurrentState(dotData) : svek2 - .buildImage(null, new String[0]); + final IEntityImage image = containsOnlyConcurrentStates ? buildImageForConcurrentState(dotData) + : svek2.buildImage(null, new String[0]); UStroke stroke = group.getColors(skinParam).getSpecificLineStroke(); if (stroke == null) { stroke = new UStroke(1.5); } - return new InnerStateAutonom(image, title, attribute, borderColor, backColor, skinParam.shadowing(group - .getStereotype()), group.getUrl99(), withSymbol, stroke); + return new InnerStateAutonom(image, title, attribute, borderColor, backColor, + skinParam.shadowing(group.getStereotype()), group.getUrl99(), withSymbol, stroke); } @@ -207,6 +221,6 @@ public final class GroupPngMakerState { private HtmlColor getColor(ColorParam colorParam, Stereotype stereo) { final ISkinParam skinParam = diagram.getSkinParam(); - return rose.getHtmlColor(skinParam, colorParam, stereo); + return rose.getHtmlColor(skinParam, stereo, colorParam); } } diff --git a/src/net/sourceforge/plantuml/svek/HeaderLayout.java b/src/net/sourceforge/plantuml/svek/HeaderLayout.java index 218bd7c..d9eaf94 100644 --- a/src/net/sourceforge/plantuml/svek/HeaderLayout.java +++ b/src/net/sourceforge/plantuml/svek/HeaderLayout.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/IEntityImage.java b/src/net/sourceforge/plantuml/svek/IEntityImage.java index 251de5e..d9026f3 100644 --- a/src/net/sourceforge/plantuml/svek/IEntityImage.java +++ b/src/net/sourceforge/plantuml/svek/IEntityImage.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -44,8 +44,10 @@ public interface IEntityImage extends Hideable, TextBlockBackcolored { public static final int MARGIN = 5; public static final int MARGIN_LINE = 5; - ShapeType getShapeType(); + public ShapeType getShapeType(); - Margins getShield(StringBounder stringBounder); + public Margins getShield(StringBounder stringBounder); + + public double getOverscanX(StringBounder stringBounder); }
\ No newline at end of file diff --git a/src/net/sourceforge/plantuml/svek/IEntityImageMoved.java b/src/net/sourceforge/plantuml/svek/IEntityImageMoved.java new file mode 100644 index 0000000..db7f2f5 --- /dev/null +++ b/src/net/sourceforge/plantuml/svek/IEntityImageMoved.java @@ -0,0 +1,97 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * PlantUML is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PlantUML distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * + * Original Author: Arnaud Roques + * + * + */ +package net.sourceforge.plantuml.svek; + +import java.awt.geom.Dimension2D; +import java.awt.geom.Rectangle2D; + +import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.graphic.InnerStrategy; +import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.ugraphic.MinMax; +import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.UTranslate; + +public class IEntityImageMoved implements IEntityImage { + + private final IEntityImage orig; + private final double delta = 7; + + public IEntityImageMoved(IEntityImage orig) { + this.orig = orig; + } + + public boolean isHidden() { + return orig.isHidden(); + } + + public HtmlColor getBackcolor() { + return orig.getBackcolor(); + } + + public Dimension2D calculateDimension(StringBounder stringBounder) { + return Dimension2DDouble.delta(orig.calculateDimension(stringBounder), delta * 2, delta * 2); + } + + public MinMax getMinMax(StringBounder stringBounder) { + return orig.getMinMax(stringBounder); + // return orig.getMinMax(stringBounder).translate(new UTranslate(delta, delta)); + // return orig.getMinMax(stringBounder).appendToMax(delta, delta); + } + + public Rectangle2D getInnerPosition(String member, StringBounder stringBounder, InnerStrategy strategy) { + return orig.getInnerPosition(member, stringBounder, strategy); + } + + public void drawU(UGraphic ug) { + orig.drawU(ug.apply(new UTranslate(delta, delta))); + + } + + public ShapeType getShapeType() { + return orig.getShapeType(); + } + + public Margins getShield(StringBounder stringBounder) { + return orig.getShield(stringBounder); + } + + public double getOverscanX(StringBounder stringBounder) { + return orig.getOverscanX(stringBounder); + } + +}
\ No newline at end of file diff --git a/src/net/sourceforge/plantuml/svek/IShapePseudo.java b/src/net/sourceforge/plantuml/svek/IShapePseudo.java index 8a7d51f..7b900b2 100644 --- a/src/net/sourceforge/plantuml/svek/IShapePseudo.java +++ b/src/net/sourceforge/plantuml/svek/IShapePseudo.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/InnerActivity.java b/src/net/sourceforge/plantuml/svek/InnerActivity.java index 6b7e7e5..2517b73 100644 --- a/src/net/sourceforge/plantuml/svek/InnerActivity.java +++ b/src/net/sourceforge/plantuml/svek/InnerActivity.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -50,10 +50,10 @@ public final class InnerActivity extends AbstractTextBlock implements IEntityIma private final IEntityImage im; private final HtmlColor borderColor; - private final boolean shadowing; + private final double shadowing; private final HtmlColor backColor; - public InnerActivity(final IEntityImage im, HtmlColor borderColor, HtmlColor backColor, boolean shadowing) { + public InnerActivity(final IEntityImage im, HtmlColor borderColor, HtmlColor backColor, double shadowing) { this.im = im; this.backColor = backColor; this.borderColor = borderColor; @@ -69,9 +69,7 @@ public final class InnerActivity extends AbstractTextBlock implements IEntityIma .apply(new UStroke(THICKNESS_BORDER)); final URectangle rect = new URectangle(total.getWidth(), total.getHeight(), IEntityImage.CORNER, IEntityImage.CORNER); - if (shadowing) { - rect.setDeltaShadow(4); - } + rect.setDeltaShadow(shadowing); ug.draw(rect); ug = ug.apply(new UStroke()); im.drawU(ug); @@ -97,5 +95,10 @@ public final class InnerActivity extends AbstractTextBlock implements IEntityIma public boolean isHidden() { return im.isHidden(); } + + public double getOverscanX(StringBounder stringBounder) { + return 0; + } + } diff --git a/src/net/sourceforge/plantuml/svek/InnerStateAutonom.java b/src/net/sourceforge/plantuml/svek/InnerStateAutonom.java index 7dadf22..19f225d 100644 --- a/src/net/sourceforge/plantuml/svek/InnerStateAutonom.java +++ b/src/net/sourceforge/plantuml/svek/InnerStateAutonom.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -146,5 +146,10 @@ public final class InnerStateAutonom extends AbstractTextBlock implements IEntit public boolean isHidden() { return im.isHidden(); } + + public double getOverscanX(StringBounder stringBounder) { + return 0; + } + } diff --git a/src/net/sourceforge/plantuml/svek/Line.java b/src/net/sourceforge/plantuml/svek/Line.java index ba4fed8..9e321e7 100644 --- a/src/net/sourceforge/plantuml/svek/Line.java +++ b/src/net/sourceforge/plantuml/svek/Line.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -37,9 +37,12 @@ package net.sourceforge.plantuml.svek; import java.awt.geom.Dimension2D; import java.awt.geom.Point2D; +import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.Set; +import net.sourceforge.plantuml.AlignmentParam; import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.Direction; @@ -49,12 +52,14 @@ import net.sourceforge.plantuml.LineParam; import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.Pragma; import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.command.Position; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.EntityPort; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.IGroup; +import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.cucadiagram.LinkArrow; import net.sourceforge.plantuml.cucadiagram.LinkDecor; @@ -75,6 +80,7 @@ import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.USymbolFolder; import net.sourceforge.plantuml.graphic.VerticalAlignment; import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.posimo.BezierUtils; import net.sourceforge.plantuml.posimo.DotPath; import net.sourceforge.plantuml.posimo.Moveable; @@ -85,19 +91,20 @@ import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.svek.extremity.Extremity; import net.sourceforge.plantuml.svek.extremity.ExtremityFactory; import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryExtends; +import net.sourceforge.plantuml.svek.extremity.ExtremityOther; import net.sourceforge.plantuml.svek.image.EntityImageNoteLink; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; -import net.sourceforge.plantuml.ugraphic.UComment; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UPolygon; -import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; public class Line implements Moveable, Hideable { + private static final Dimension2DDouble CONSTRAINT_SPOT = new Dimension2DDouble(10, 10); private final Cluster ltail; private final Cluster lhead; private final Link link; @@ -138,6 +145,9 @@ public class Line implements Moveable, Hideable { private final boolean useRankSame; private final UStroke defaultThickness; private HtmlColor arrowLollipopColor; + private final ISkinParam skinParam; + + // private final UmlDiagramType umlType; @Override public String toString() { @@ -206,7 +216,7 @@ public class Line implements Moveable, Hideable { private Cluster getCluster2(Bibliotekon bibliotekon, IEntity entityMutable) { for (Cluster cl : bibliotekon.allCluster()) { - if (entityMutable == cl.getGroup()) { + if (cl.getGroups().contains(entityMutable)) { return cl; } } @@ -219,6 +229,8 @@ public class Line implements Moveable, Hideable { if (link == null) { throw new IllegalArgumentException(); } + this.skinParam = skinParam; + // this.umlType = link.getUmlDiagramType(); this.useRankSame = skinParam.useRankSame(); this.startUid = link.getEntityPort1(bibliotekon); this.endUid = link.getEntityPort2(bibliotekon); @@ -286,7 +298,7 @@ public class Line implements Moveable, Hideable { if (link.getNote() == null) { noteOnly = null; } else { - noteOnly = new EntityImageNoteLink(link.getNote(), link.getNoteColors(), skinParam); + noteOnly = new EntityImageNoteLink(link.getNote(), link.getNoteColors(), skinParam, link.getStyleBuilder()); if (link.getNoteLinkStrategy() == NoteLinkStrategy.HALF_NOT_PRINTED || link.getNoteLinkStrategy() == NoteLinkStrategy.HALF_PRINTED_FULL) { divideLabelWidthByTwo = true; @@ -329,12 +341,13 @@ public class Line implements Moveable, Hideable { private TextBlock getLineLabel(Link link, ISkinParam skinParam, FontConfiguration labelFont) { final double marginLabel = startUid.equalsId(endUid) ? 6 : 1; - TextBlock label = link.getLabel().create(labelFont, - skinParam.getDefaultTextAlignment(HorizontalAlignment.CENTER), skinParam, skinParam.maxMessageSize()); + final HorizontalAlignment alignment = getMessageTextAlignment(link.getUmlDiagramType(), skinParam); + TextBlock label = link.getLabel().create(labelFont, alignment, skinParam, skinParam.maxMessageSize()); final VisibilityModifier visibilityModifier = link.getVisibilityModifier(); if (visibilityModifier != null) { final Rose rose = new Rose(); - // final HtmlColor back = visibilityModifier.getBackground() == null ? null : rose.getHtmlColor(skinParam, + // final HtmlColor back = visibilityModifier.getBackground() == null ? null : + // rose.getHtmlColor(skinParam, // visibilityModifier.getBackground()); final HtmlColor fore = rose.getHtmlColor(skinParam, visibilityModifier.getForeground()); TextBlock visibility = visibilityModifier.getUBlock(skinParam.classAttributeIconSize(), fore, null, false); @@ -345,6 +358,13 @@ public class Line implements Moveable, Hideable { return label; } + private HorizontalAlignment getMessageTextAlignment(UmlDiagramType umlDiagramType, ISkinParam skinParam) { + if (umlDiagramType == UmlDiagramType.STATE) { + return skinParam.getHorizontalAlignment(AlignmentParam.stateMessageAlignment, null, false); + } + return skinParam.getDefaultTextAlignment(HorizontalAlignment.CENTER); + } + public boolean hasNoteLabelText() { return labelText != null; } @@ -388,17 +408,17 @@ public class Line implements Moveable, Hideable { sb.append(","); } sb.append("color=\"" + StringUtils.getAsHtml(lineColor) + "\""); - if (labelText != null) { + if (labelText != null || link.getLinkConstraint() != null) { sb.append(","); if (graphvizVersion.useXLabelInsteadOfLabel() || dotMode == DotMode.NO_LEFT_RIGHT_AND_XLABEL) { sb.append("xlabel=<"); } else { sb.append("label=<"); } - appendTable(sb, eventuallyDivideByTwo(labelText.calculateDimension(stringBounder)), noteLabelColor, - graphvizVersion); + final Dimension2D dimNote = labelText == null ? CONSTRAINT_SPOT + : labelText.calculateDimension(stringBounder); + appendTable(sb, eventuallyDivideByTwo(dimNote), noteLabelColor, graphvizVersion); sb.append(">"); - // sb.append(",labelfloat=true"); } if (startTailText != null) { @@ -406,14 +426,12 @@ public class Line implements Moveable, Hideable { sb.append("taillabel=<"); appendTable(sb, startTailText.calculateDimension(stringBounder), startTailColor, graphvizVersion); sb.append(">"); - // sb.append(",labelangle=0"); } if (endHeadText != null) { sb.append(","); sb.append("headlabel=<"); appendTable(sb, endHeadText.calculateDimension(stringBounder), endHeadColor, graphvizVersion); sb.append(">"); - // sb.append(",labelangle=0"); } if (link.isInvis()) { @@ -481,7 +499,7 @@ public class Line implements Moveable, Hideable { } private UDrawable getExtremity(LinkDecor decor, PointListIterator pointListIterator, final Point2D center, - double angle, Cluster cluster, Shape shapeContact) { + double angle, Cluster cluster, Node nodeContact) { final ExtremityFactory extremityFactory = decor.getExtremityFactory(backgroundColor); if (cluster != null) { @@ -504,8 +522,8 @@ public class Line implements Moveable, Hideable { final Point2D p1 = points.get(1); final Point2D p2 = points.get(2); Side side = null; - if (shapeContact != null) { - side = shapeContact.getClusterPosition().getClosestSide(p1); + if (nodeContact != null) { + side = nodeContact.getClusterPosition().getClosestSide(p1); } return extremityFactory.createUDrawable(p0, p1, p2, side); } else if (decor == LinkDecor.NONE) { @@ -521,12 +539,8 @@ public class Line implements Moveable, Hideable { }; } } else if (decor != LinkDecor.NONE) { - final UShape sh = new UPolygon(pointListIterator.next()); - return new UDrawable() { - public void drawU(UGraphic ug) { - ug.draw(sh); - } - }; + final UPolygon sh = new UPolygon(pointListIterator.next()); + return new ExtremityOther(sh); } return null; @@ -555,9 +569,11 @@ public class Line implements Moveable, Hideable { dotPath = new DotPath(path); if (projectionCluster != null) { - // System.err.println("Line::solveLine1 projectionCluster=" + projectionCluster.getClusterPosition()); + // System.err.println("Line::solveLine1 projectionCluster=" + + // projectionCluster.getClusterPosition()); projectionCluster.manageEntryExitPoint(stringBounder); - // System.err.println("Line::solveLine2 projectionCluster=" + projectionCluster.getClusterPosition()); + // System.err.println("Line::solveLine2 projectionCluster=" + + // projectionCluster.getClusterPosition()); // if (lhead != null) // System.err.println("Line::solveLine ltail=" + lhead.getClusterPosition()); // if (ltail != null) @@ -570,9 +586,17 @@ public class Line implements Moveable, Hideable { final LinkType linkType = link.getType(); this.extremity1 = getExtremity(linkType.getDecor2(), pointListIterator, dotPath.getStartPoint(), - dotPath.getStartAngle() + Math.PI, ltail, bibliotekon.getShape(link.getEntity1())); + dotPath.getStartAngle() + Math.PI, ltail, bibliotekon.getNode(link.getEntity1())); this.extremity2 = getExtremity(linkType.getDecor1(), pointListIterator, dotPath.getEndPoint(), - dotPath.getEndAngle(), lhead, bibliotekon.getShape(link.getEntity2())); + dotPath.getEndAngle(), lhead, bibliotekon.getNode(link.getEntity2())); + + if (link.getEntity1().getLeafType() == LeafType.LOLLIPOP_HALF) { + bibliotekon.getNode(link.getEntity1()).addImpact(dotPath.getStartAngle() + Math.PI); + } + if (link.getEntity2().getLeafType() == LeafType.LOLLIPOP_HALF) { + bibliotekon.getNode(link.getEntity2()).addImpact(dotPath.getEndAngle()); + } + if (extremity1 instanceof Extremity && extremity2 instanceof Extremity) { final Point2D p1 = ((Extremity) extremity1).somePoint(); final Point2D p2 = ((Extremity) extremity2).somePoint(); @@ -585,19 +609,20 @@ public class Line implements Moveable, Hideable { if (dist1start > dist1end && dist2end > dist2start) { pointListIterator = lineSvg.getPointsWithThisColor(lineColor); this.extremity2 = getExtremity(linkType.getDecor1(), pointListIterator, dotPath.getEndPoint(), - dotPath.getEndAngle(), lhead, bibliotekon.getShape(link.getEntity2())); + dotPath.getEndAngle(), lhead, bibliotekon.getNode(link.getEntity2())); this.extremity1 = getExtremity(linkType.getDecor2(), pointListIterator, dotPath.getStartPoint(), - dotPath.getStartAngle() + Math.PI, ltail, bibliotekon.getShape(link.getEntity1())); + dotPath.getStartAngle() + Math.PI, ltail, bibliotekon.getNode(link.getEntity1())); } } } - if (this.labelText != null) { + if (this.labelText != null || link.getLinkConstraint() != null) { final Point2D pos = getXY(fullSvg, this.noteLabelColor); if (pos != null) { corner1.manage(pos); - this.labelXY = TextBlockUtils.asPositionable(labelText, stringBounder, pos); + this.labelXY = labelText == null ? TextBlockUtils.asPositionable(CONSTRAINT_SPOT, stringBounder, pos) + : TextBlockUtils.asPositionable(labelText, stringBounder, pos); } } @@ -636,12 +661,11 @@ public class Line implements Moveable, Hideable { } - public void drawU(UGraphic ug, HtmlColor color) { + public void drawU(UGraphic ug, HtmlColor color, Set<String> ids) { if (opale) { return; } - ug.draw(new UComment("link " + link.getEntity1().getCode().getFullName() + " to " - + link.getEntity2().getCode().getFullName())); + ug.draw(link.commentForSvg()); double x = 0; double y = 0; final Url url = link.getUrl(); @@ -681,7 +705,7 @@ public class Line implements Moveable, Hideable { stroke = link.getColors().getSpecificLineStroke(); } ug = ug.apply(stroke); - double moveEndY = 0; + // double moveEndY = 0; if (dotPath == null) { Log.info("DotPath is null for " + this); @@ -691,51 +715,48 @@ public class Line implements Moveable, Hideable { if (link.getEntity2().isGroup() && link.getEntity2().getUSymbol() instanceof USymbolFolder) { final Cluster endCluster = bibliotekon.getCluster((IGroup) link.getEntity2()); if (endCluster != null) { - final double deltaFolderH = endCluster - .checkFolderPosition(dotPath.getEndPoint(), ug.getStringBounder()); + final double deltaFolderH = endCluster.checkFolderPosition(dotPath.getEndPoint(), + ug.getStringBounder()); todraw = new DotPath(dotPath); todraw.moveEndPoint(0, deltaFolderH); - moveEndY = deltaFolderH; + // moveEndY = deltaFolderH; } } - todraw.setComment(link.getEntity1().getCode().getFullName() + "-" + link.getEntity2().getCode().getFullName()); - ug.apply(new UTranslate(x, y)).draw(todraw); - - ug = ug.apply(new UStroke()).apply(new UChangeColor(color)); - - if (this.extremity2 != null) { - UGraphic ug2 = ug; - if (linkType.getDecor1().isFill()) { - ug2 = ug2.apply(new UChangeBackColor(color)); - } else { - ug2 = ug2.apply(new UChangeBackColor(null)); + if (extremity1 instanceof Extremity && extremity2 instanceof Extremity) { + // http://forum.plantuml.net/9421/arrow-inversion-with-skinparam-linetype-ortho-missing-arrow + final Point2D p1 = ((Extremity) extremity1).isTooSmallSoGiveThePointCloserToThisOne(todraw.getStartPoint()); + if (p1 != null) { + todraw.forceStartPoint(p1.getX(), p1.getY()); } - // System.err.println("Line::draw EXTREMITY1"); - this.extremity2.drawU(ug2.apply(new UTranslate(x, y))); - } - if (this.extremity1 != null) { - UGraphic ug2 = ug; - if (linkType.getDecor2().isFill()) { - ug2 = ug2.apply(new UChangeBackColor(color)); - } else { - ug2 = ug2.apply(new UChangeBackColor(null)); + final Point2D p2 = ((Extremity) extremity2).isTooSmallSoGiveThePointCloserToThisOne(todraw.getEndPoint()); + if (p2 != null) { + todraw.forceEndPoint(p2.getX(), p2.getY()); } - // System.err.println("Line::draw EXTREMITY2"); - this.extremity1.drawU(ug2.apply(new UTranslate(x, y))); + } + + final String comment = link.idCommentForSvg(); + final String tmp = uniq(ids, comment); + todraw.setComment(tmp); + + drawRainbow(ug.apply(new UTranslate(x, y)), color, todraw, link.getSupplementaryColors(), stroke); + + ug = ug.apply(new UStroke()).apply(new UChangeColor(color)); + if (this.labelText != null && 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(), y + this.labelXY.getPosition().getY()))); } - if (this.startTailText != null && this.startTailLabelXY != null && this.startTailLabelXY.getPosition() != null) { - this.startTailText.drawU(ug.apply(new UTranslate(x + this.startTailLabelXY.getPosition().getX(), y - + this.startTailLabelXY.getPosition().getY()))); + if (this.startTailText != null && this.startTailLabelXY != null + && this.startTailLabelXY.getPosition() != null) { + this.startTailText.drawU(ug.apply(new UTranslate(x + this.startTailLabelXY.getPosition().getX(), + y + this.startTailLabelXY.getPosition().getY()))); } if (this.endHeadText != null && this.endHeadLabelXY != null && this.endHeadLabelXY.getPosition() != null) { - this.endHeadText.drawU(ug.apply(new UTranslate(x + this.endHeadLabelXY.getPosition().getX(), y - + this.endHeadLabelXY.getPosition().getY()))); + this.endHeadText.drawU(ug.apply(new UTranslate(x + this.endHeadLabelXY.getPosition().getX(), + y + this.endHeadLabelXY.getPosition().getY()))); } if (linkType.getMiddleDecor() != LinkMiddleDecor.NONE) { @@ -750,6 +771,89 @@ public class Line implements Moveable, Hideable { if (url != null) { ug.closeAction(); } + + if (link.getLinkConstraint() != null) { + final double xConstraint = x + this.labelXY.getPosition().getX(); + final double yConstraint = y + this.labelXY.getPosition().getY(); +// ug.apply(new UTranslate(xConstraint, yConstraint)).draw(new URectangle(10, 10)); + final List<Point2D> square = getSquare(xConstraint, yConstraint); + final Set<Point2D> bez = dotPath.sample(); + Point2D minPt = null; + double minDist = Double.MAX_VALUE; + for (Point2D pt : square) { + for (Point2D pt2 : bez) { + final double distance = pt2.distance(pt); + if (minPt == null || distance < minDist) { + minPt = pt; + minDist = distance; + } + } + } + link.getLinkConstraint().setPosition(link, minPt); + link.getLinkConstraint().drawMe(ug, skinParam); + } + } + + private List<Point2D> getSquare(double x, double y) { + final List<Point2D> result = new ArrayList<Point2D>(); + result.add(new Point2D.Double(x, y)); + result.add(new Point2D.Double(x + 5, y)); + result.add(new Point2D.Double(x + 10, y)); + result.add(new Point2D.Double(x, y + 5)); + result.add(new Point2D.Double(x + 10, y + 5)); + result.add(new Point2D.Double(x, y + 10)); + result.add(new Point2D.Double(x + 5, y + 10)); + result.add(new Point2D.Double(x + 10, y + 10)); + return result; + } + + private String uniq(final Set<String> ids, final String comment) { + boolean changed = ids.add(comment); + if (changed) { + return comment; + } + int i = 1; + while (true) { + final String candidate = comment + "-" + i; + changed = ids.add(candidate); + if (changed) { + return candidate; + } + i++; + } + } + + private void drawRainbow(UGraphic ug, HtmlColor color, DotPath todraw, List<Colors> supplementaryColors, + UStroke stroke) { + ug.draw(todraw); + final LinkType linkType = link.getType(); + + if (this.extremity2 != null) { + UGraphic ug2 = ug.apply(new UChangeColor(color)).apply(stroke.onlyThickness()); + if (linkType.getDecor1().isFill()) { + ug2 = ug2.apply(new UChangeBackColor(color)); + } else { + ug2 = ug2.apply(new UChangeBackColor(null)); + } + // System.err.println("Line::draw EXTREMITY1"); + this.extremity2.drawU(ug2); + } + if (this.extremity1 != null) { + UGraphic ug2 = ug.apply(new UChangeColor(color)).apply(stroke.onlyThickness()); + if (linkType.getDecor2().isFill()) { + ug2 = ug2.apply(new UChangeBackColor(color)); + } else { + ug2 = ug2.apply(new UChangeBackColor(null)); + } + // System.err.println("Line::draw EXTREMITY2"); + this.extremity1.drawU(ug2); + } + int i = 0; + for (Colors colors : supplementaryColors) { + ug.apply(new UTranslate(2 * (i + 1), 2 * (i + 1))).apply(new UChangeColor(colors.getColor(ColorType.LINE))) + .draw(todraw); + i++; + } } public boolean isInverted() { @@ -809,11 +913,12 @@ public class Line implements Moveable, Hideable { return strategy.getResult() + getDecorDzeta(); } - public void manageCollision(Collection<Shape> allShapes) { + public void manageCollision(Collection<Node> allNodes) { - for (Shape sh : allShapes) { + for (Node sh : allNodes) { final Positionable cl = PositionableUtils.addMargin(sh, 8, 8); - if (startTailText != null && startTailLabelXY != null && PositionableUtils.intersect(cl, startTailLabelXY)) { + if (startTailText != null && startTailLabelXY != null + && PositionableUtils.intersect(cl, startTailLabelXY)) { startTailLabelXY = PositionableUtils.moveAwayFrom(cl, startTailLabelXY); } if (endHeadText != null && endHeadLabelXY != null && PositionableUtils.intersect(cl, endHeadLabelXY)) { @@ -841,7 +946,7 @@ public class Line implements Moveable, Hideable { } - private void avoid(Point2D.Double move, Positionable pos, Shape sh) { + private void avoid(Point2D.Double move, Positionable pos, Node sh) { final Oscillator oscillator = new Oscillator(); final Point2D.Double orig = new Point2D.Double(move.x, move.y); while (cut(pos, sh)) { @@ -850,7 +955,7 @@ public class Line implements Moveable, Hideable { } } - private boolean cut(Positionable pos, Shape sh) { + private boolean cut(Positionable pos, Node sh) { return BezierUtils.intersect(pos, sh) || tooClose(pos); } diff --git a/src/net/sourceforge/plantuml/svek/Margins.java b/src/net/sourceforge/plantuml/svek/Margins.java index 9684cdc..d1b44ad 100644 --- a/src/net/sourceforge/plantuml/svek/Margins.java +++ b/src/net/sourceforge/plantuml/svek/Margins.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/MinFinder.java b/src/net/sourceforge/plantuml/svek/MinFinder.java index 7e2d1f7..5674330 100644 --- a/src/net/sourceforge/plantuml/svek/MinFinder.java +++ b/src/net/sourceforge/plantuml/svek/MinFinder.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/Shape.java b/src/net/sourceforge/plantuml/svek/Node.java index 9cf1df4..06fc8ec 100644 --- a/src/net/sourceforge/plantuml/svek/Shape.java +++ b/src/net/sourceforge/plantuml/svek/Node.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -44,14 +44,18 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.Hideable; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.cucadiagram.EntityPosition; +import net.sourceforge.plantuml.cucadiagram.IGroup; +import net.sourceforge.plantuml.cucadiagram.ILeaf; +import net.sourceforge.plantuml.cucadiagram.entity.EntityImpl; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.posimo.Positionable; import net.sourceforge.plantuml.svek.image.EntityImageDescription; +import net.sourceforge.plantuml.svek.image.EntityImageLollipopInterface; import net.sourceforge.plantuml.svek.image.EntityImageStateBorder; import net.sourceforge.plantuml.ugraphic.Shadowable; import net.sourceforge.plantuml.ugraphic.UPolygon; -public class Shape implements Positionable, IShapePseudo, Hideable { +public class Node implements Positionable, IShapePseudo, Hideable { private final ShapeType type; private final double width; @@ -88,21 +92,32 @@ public class Shape implements Positionable, IShapePseudo, Hideable { return super.toString() + " " + image + " " + type; } - public Shape(IEntityImage image, ShapeType type, double width, double height, ColorSequence colorSequence, - boolean top, Margins shield, EntityPosition entityPosition) { - this.entityPosition = entityPosition; + private final ILeaf leaf; + private final IGroup group; + + Node(ILeaf ent, IEntityImage image, ColorSequence colorSequence, StringBounder stringBounder) { + final Dimension2D dim = image.calculateDimension(stringBounder); + this.entityPosition = ent.getEntityPosition(); this.image = image; - this.top = top; - this.type = type; - this.width = width; - this.height = height; + this.top = ent.isTop(); + this.type = image.getShapeType(); + this.width = dim.getWidth(); + this.height = dim.getHeight(); this.color = colorSequence.getValue(); this.uid = String.format("sh%04d", color); - this.shield = shield; + this.shield = image.getShield(stringBounder); if (shield.isZero() == false && type != ShapeType.RECTANGLE && type != ShapeType.RECTANGLE_HTML_FOR_PORTS && type != ShapeType.RECTANGLE_WITH_CIRCLE_INSIDE) { throw new IllegalArgumentException(); } + + if (((EntityImpl) ent).getOriginalGroup() == null) { + this.group = null; + this.leaf = ent; + } else { + this.group = ((EntityImpl) ent).getOriginalGroup(); + this.leaf = null; + } } public final ShapeType getType() { @@ -340,4 +355,12 @@ public class Shape implements Positionable, IShapePseudo, Hideable { } return pt; } + + public double getOverscanX(StringBounder stringBounder) { + return image.getOverscanX(stringBounder); + } + + public void addImpact(double angle) { + ((EntityImageLollipopInterface) image).addImpact(angle); + } } diff --git a/src/net/sourceforge/plantuml/svek/Oscillator.java b/src/net/sourceforge/plantuml/svek/Oscillator.java index 9ef4348..f562c18 100644 --- a/src/net/sourceforge/plantuml/svek/Oscillator.java +++ b/src/net/sourceforge/plantuml/svek/Oscillator.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/PackageStyle.java b/src/net/sourceforge/plantuml/svek/PackageStyle.java index 2b9b986..6282920 100644 --- a/src/net/sourceforge/plantuml/svek/PackageStyle.java +++ b/src/net/sourceforge/plantuml/svek/PackageStyle.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/Point2DFunction.java b/src/net/sourceforge/plantuml/svek/Point2DFunction.java index 792db20..04647ed 100644 --- a/src/net/sourceforge/plantuml/svek/Point2DFunction.java +++ b/src/net/sourceforge/plantuml/svek/Point2DFunction.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/PointAndAngle.java b/src/net/sourceforge/plantuml/svek/PointAndAngle.java index 02890bf..3afd3cc 100644 --- a/src/net/sourceforge/plantuml/svek/PointAndAngle.java +++ b/src/net/sourceforge/plantuml/svek/PointAndAngle.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/PointDirected.java b/src/net/sourceforge/plantuml/svek/PointDirected.java index cfc50de..9df0ab2 100644 --- a/src/net/sourceforge/plantuml/svek/PointDirected.java +++ b/src/net/sourceforge/plantuml/svek/PointDirected.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/PointListIterator.java b/src/net/sourceforge/plantuml/svek/PointListIterator.java index f7cc577..298009d 100644 --- a/src/net/sourceforge/plantuml/svek/PointListIterator.java +++ b/src/net/sourceforge/plantuml/svek/PointListIterator.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/PointListIteratorImpl.java b/src/net/sourceforge/plantuml/svek/PointListIteratorImpl.java index f834873..2fd15aa 100644 --- a/src/net/sourceforge/plantuml/svek/PointListIteratorImpl.java +++ b/src/net/sourceforge/plantuml/svek/PointListIteratorImpl.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/PortGeometry.java b/src/net/sourceforge/plantuml/svek/PortGeometry.java index 5e769c7..641643f 100644 --- a/src/net/sourceforge/plantuml/svek/PortGeometry.java +++ b/src/net/sourceforge/plantuml/svek/PortGeometry.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/Ports.java b/src/net/sourceforge/plantuml/svek/Ports.java index 3fc5502..63f9714 100644 --- a/src/net/sourceforge/plantuml/svek/Ports.java +++ b/src/net/sourceforge/plantuml/svek/Ports.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/RoundedContainer.java b/src/net/sourceforge/plantuml/svek/RoundedContainer.java index a82a972..96f8bc9 100644 --- a/src/net/sourceforge/plantuml/svek/RoundedContainer.java +++ b/src/net/sourceforge/plantuml/svek/RoundedContainer.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/ShapePseudoImpl.java b/src/net/sourceforge/plantuml/svek/ShapePseudoImpl.java index cfdc0cb..0792756 100644 --- a/src/net/sourceforge/plantuml/svek/ShapePseudoImpl.java +++ b/src/net/sourceforge/plantuml/svek/ShapePseudoImpl.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/ShapeType.java b/src/net/sourceforge/plantuml/svek/ShapeType.java index dec490f..9d7823b 100644 --- a/src/net/sourceforge/plantuml/svek/ShapeType.java +++ b/src/net/sourceforge/plantuml/svek/ShapeType.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/Side.java b/src/net/sourceforge/plantuml/svek/Side.java index 97e2026..d5b7c6b 100644 --- a/src/net/sourceforge/plantuml/svek/Side.java +++ b/src/net/sourceforge/plantuml/svek/Side.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/SingleStrategy.java b/src/net/sourceforge/plantuml/svek/SingleStrategy.java index ff1f5ed..98f6b90 100644 --- a/src/net/sourceforge/plantuml/svek/SingleStrategy.java +++ b/src/net/sourceforge/plantuml/svek/SingleStrategy.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -36,47 +36,36 @@ */ package net.sourceforge.plantuml.svek; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.cucadiagram.IEntity; -import net.sourceforge.plantuml.cucadiagram.ILeaf; -import net.sourceforge.plantuml.cucadiagram.Link; -import net.sourceforge.plantuml.cucadiagram.LinkDecor; -import net.sourceforge.plantuml.cucadiagram.LinkType; public enum SingleStrategy { SQUARRE, HLINE, VLINE; - public Collection<Link> generateLinks(List<ILeaf> standalones) { - return putInSquare(standalones); - } +// private Collection<Link> generateLinks(List<ILeaf> standalones) { +// return putInSquare(standalones); +// } - private Collection<Link> putInSquare(List<ILeaf> standalones) { - final List<Link> result = new ArrayList<Link>(); - final LinkType linkType = new LinkType(LinkDecor.NONE, LinkDecor.NONE).getInvisible(); - final int branch = computeBranch(standalones.size()); - int headBranch = 0; - for (int i = 1; i < standalones.size(); i++) { - final int dist = i - headBranch; - final IEntity ent2 = standalones.get(i); - final Link link; - if (dist == branch) { - final IEntity ent1 = standalones.get(headBranch); - link = new Link(ent1, ent2, linkType, Display.NULL, 2); - headBranch = i; - } else { - final IEntity ent1 = standalones.get(i - 1); - link = new Link(ent1, ent2, linkType, Display.NULL, 1); - } - result.add(link); - } - return Collections.unmodifiableCollection(result); - } +// private Collection<Link> putInSquare(List<ILeaf> standalones) { +// final List<Link> result = new ArrayList<Link>(); +// final LinkType linkType = new LinkType(LinkDecor.NONE, LinkDecor.NONE).getInvisible(); +// final int branch = computeBranch(standalones.size()); +// int headBranch = 0; +// for (int i = 1; i < standalones.size(); i++) { +// final int dist = i - headBranch; +// final IEntity ent2 = standalones.get(i); +// final Link link; +// if (dist == branch) { +// final IEntity ent1 = standalones.get(headBranch); +// link = new Link(ent1, ent2, linkType, Display.NULL, 2); +// headBranch = i; +// } else { +// final IEntity ent1 = standalones.get(i - 1); +// link = new Link(ent1, ent2, linkType, Display.NULL, 1); +// } +// result.add(link); +// } +// return Collections.unmodifiableCollection(result); +// } static int computeBranch(int size) { final double sqrt = Math.sqrt(size); diff --git a/src/net/sourceforge/plantuml/svek/SvekResult.java b/src/net/sourceforge/plantuml/svek/SvekResult.java index 524dee7..da89ae8 100644 --- a/src/net/sourceforge/plantuml/svek/SvekResult.java +++ b/src/net/sourceforge/plantuml/svek/SvekResult.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -36,8 +36,11 @@ package net.sourceforge.plantuml.svek; import java.awt.geom.Dimension2D; +import java.util.HashSet; +import java.util.Set; import net.sourceforge.plantuml.ColorParam; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.cucadiagram.dot.DotData; import net.sourceforge.plantuml.graphic.AbstractTextBlock; @@ -46,6 +49,10 @@ import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.posimo.Moveable; import net.sourceforge.plantuml.skin.rose.Rose; +import net.sourceforge.plantuml.style.PName; +import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UHidden; @@ -72,14 +79,18 @@ public final class SvekResult extends AbstractTextBlock implements IEntityImage, cluster.drawU(ug, new UStroke(1.5), dotData.getUmlDiagramType(), dotData.getSkinParam()); } - final HtmlColor color = HtmlColorUtils.noGradient(rose.getHtmlColor(dotData.getSkinParam(), - getArrowColorParam(), null)); + HtmlColor color = rose.getHtmlColor(dotData.getSkinParam(), null, getArrowColorParam()); + if (SkinParam.USE_STYLES()) { + final Style style = getDefaultStyleDefinition().getMergedStyle(dotData.getSkinParam().getCurrentStyleBuilder()); + color = style.value(PName.LineColor).asColor(dotData.getSkinParam().getIHtmlColorSet()); + } + color = HtmlColorUtils.noGradient(color); - for (Shape shape : dotStringFactory.getBibliotekon().allShapes()) { - final double minX = shape.getMinX(); - final double minY = shape.getMinY(); - final UGraphic ug2 = shape.isHidden() ? ug.apply(UHidden.HIDDEN) : ug; - final IEntityImage image = shape.getImage(); + for (Node node : dotStringFactory.getBibliotekon().allNodes()) { + final double minX = node.getMinX(); + final double minY = node.getMinY(); + final UGraphic ug2 = node.isHidden() ? ug.apply(UHidden.HIDDEN) : ug; + final IEntityImage image = node.getImage(); image.drawU(ug2.apply(new UTranslate(minX, minY))); if (image instanceof Untranslated) { ((Untranslated) image).drawUntranslated(ug.apply(new UChangeColor(color)), minX, minY); @@ -87,9 +98,11 @@ public final class SvekResult extends AbstractTextBlock implements IEntityImage, // shape.getImage().drawNeighborhood(ug2, minX, minY); } + final Set<String> ids = new HashSet<String>(); + for (Line line : dotStringFactory.getBibliotekon().allLines()) { final UGraphic ug2 = line.isHidden() ? ug.apply(UHidden.HIDDEN) : ug; - line.drawU(ug2, color); + line.drawU(ug2, color, ids); } } @@ -109,6 +122,21 @@ public final class SvekResult extends AbstractTextBlock implements IEntityImage, throw new IllegalStateException(); } + private StyleSignature getDefaultStyleDefinition() { + if (dotData.getUmlDiagramType() == UmlDiagramType.CLASS) { + return StyleSignature.of(SName.root, SName.element, SName.classDiagram, SName.arrow); + } else if (dotData.getUmlDiagramType() == UmlDiagramType.OBJECT) { + return StyleSignature.of(SName.root, SName.element, SName.objectDiagram, SName.arrow); + } else if (dotData.getUmlDiagramType() == UmlDiagramType.DESCRIPTION) { + return StyleSignature.of(SName.root, SName.element, SName.componentDiagram, SName.arrow); + } else if (dotData.getUmlDiagramType() == UmlDiagramType.ACTIVITY) { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.arrow); + } else if (dotData.getUmlDiagramType() == UmlDiagramType.STATE) { + return StyleSignature.of(SName.root, SName.element, SName.stateDiagram, SName.arrow); + } + throw new IllegalStateException(); + } + public HtmlColor getBackcolor() { return dotData.getSkinParam().getBackgroundColor(); } @@ -134,4 +162,8 @@ public final class SvekResult extends AbstractTextBlock implements IEntityImage, return false; } + public double getOverscanX(StringBounder stringBounder) { + return 0; + } + } diff --git a/src/net/sourceforge/plantuml/svek/SvekUtils.java b/src/net/sourceforge/plantuml/svek/SvekUtils.java index 8c51934..caadbbf 100644 --- a/src/net/sourceforge/plantuml/svek/SvekUtils.java +++ b/src/net/sourceforge/plantuml/svek/SvekUtils.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/SvgResult.java b/src/net/sourceforge/plantuml/svek/SvgResult.java index 3b0a729..561489b 100644 --- a/src/net/sourceforge/plantuml/svek/SvgResult.java +++ b/src/net/sourceforge/plantuml/svek/SvgResult.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/TextBlockBackcolored.java b/src/net/sourceforge/plantuml/svek/TextBlockBackcolored.java index e9cb848..1e01e8d 100644 --- a/src/net/sourceforge/plantuml/svek/TextBlockBackcolored.java +++ b/src/net/sourceforge/plantuml/svek/TextBlockBackcolored.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/UGraphicForSnake.java b/src/net/sourceforge/plantuml/svek/UGraphicForSnake.java index fe43822..b3cea8c 100644 --- a/src/net/sourceforge/plantuml/svek/UGraphicForSnake.java +++ b/src/net/sourceforge/plantuml/svek/UGraphicForSnake.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/Untranslated.java b/src/net/sourceforge/plantuml/svek/Untranslated.java index 3e58a5b..f98dba0 100644 --- a/src/net/sourceforge/plantuml/svek/Untranslated.java +++ b/src/net/sourceforge/plantuml/svek/Untranslated.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/WithPorts.java b/src/net/sourceforge/plantuml/svek/WithPorts.java index e17d34e..df28659 100644 --- a/src/net/sourceforge/plantuml/svek/WithPorts.java +++ b/src/net/sourceforge/plantuml/svek/WithPorts.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/YDelta.java b/src/net/sourceforge/plantuml/svek/YDelta.java index 8d0dc28..98201d8 100644 --- a/src/net/sourceforge/plantuml/svek/YDelta.java +++ b/src/net/sourceforge/plantuml/svek/YDelta.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/Extremity.java b/src/net/sourceforge/plantuml/svek/extremity/Extremity.java index 2f12ceb..23da0fd 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/Extremity.java +++ b/src/net/sourceforge/plantuml/svek/extremity/Extremity.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -44,25 +44,25 @@ public abstract class Extremity implements UDrawable { protected double manageround(double angle) { final double deg = angle * 180.0 / Math.PI; - if (isCloseToo(0, deg)) { + if (isCloseTo(0, deg)) { return 0; } - if (isCloseToo(90, deg)) { + if (isCloseTo(90, deg)) { return 90.0 * Math.PI / 180.0; } - if (isCloseToo(180, deg)) { + if (isCloseTo(180, deg)) { return 180.0 * Math.PI / 180.0; } - if (isCloseToo(270, deg)) { + if (isCloseTo(270, deg)) { return 270.0 * Math.PI / 180.0; } - if (isCloseToo(360, deg)) { + if (isCloseTo(360, deg)) { return 0; } return angle; } - private boolean isCloseToo(double value, double variable) { + private boolean isCloseTo(double value, double variable) { if (Math.abs(value - variable) < 0.05) { return true; } @@ -70,5 +70,9 @@ public abstract class Extremity implements UDrawable { } public abstract Point2D somePoint(); + + public Point2D isTooSmallSoGiveThePointCloserToThisOne(Point2D pt) { + return null; + } } diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityArrow.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityArrow.java index 5bbe8c9..08f6892 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityArrow.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityArrow.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityArrowAndCircle.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityArrowAndCircle.java index 588e8ce..9184082 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityArrowAndCircle.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityArrowAndCircle.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityCircle.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityCircle.java index c3aabf8..5b6cf33 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityCircle.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityCircle.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -47,32 +47,38 @@ import net.sourceforge.plantuml.ugraphic.UTranslate; class ExtremityCircle extends Extremity { - private final Point2D dest; private static final double radius = 6; + private final Point2D dest; + private final boolean fill; @Override public Point2D somePoint() { return dest; } - // public static UDrawable createContact(Point2D p1, double angle) { - // final double x = p1.getX() - radius + radius * Math.sin(angle); - // final double y = p1.getY() - radius - radius * Math.cos(angle); - // return new ExtremityCircle(x, y); - // } - - public static UDrawable create(Point2D center) { - return new ExtremityCircle(center.getX(), center.getY()); + public static UDrawable create(Point2D center, boolean fill, double angle) { + return new ExtremityCircle(center.getX(), center.getY(), fill, angle); } - private ExtremityCircle(double x, double y) { - this.dest = new Point2D.Double(x, y); + private ExtremityCircle(double x, double y, boolean fill, double angle) { + this.dest = new Point2D.Double(x - radius * Math.cos(angle + Math.PI / 2), y - radius + * Math.sin(angle + Math.PI / 2)); + this.fill = fill; + // contact = new Point2D.Double(p1.getX() - xContact * Math.cos(angle + Math.PI / 2), p1.getY() - xContact + // * Math.sin(angle + Math.PI / 2)); } public void drawU(UGraphic ug) { - ug.apply(new UStroke(1.5)).apply(new UChangeBackColor(HtmlColorUtils.WHITE)) - .apply(new UTranslate(dest.getX() - radius, dest.getY() - radius)) - .draw(new UEllipse(radius * 2, radius * 2)); + + ug = ug.apply(new UStroke(1.5)); + if (fill) { + ug = ug.apply(new UChangeBackColor(ug.getParam().getColor())); + } else { + ug = ug.apply(new UChangeBackColor(HtmlColorUtils.WHITE)); + } + + ug = ug.apply(new UTranslate(dest.getX() - radius, dest.getY() - radius)); + ug.draw(new UEllipse(radius * 2, radius * 2)); } } diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityCircleConnect.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityCircleConnect.java index f7696ee..87bf411 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityCircleConnect.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityCircleConnect.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityCircleCross.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityCircleCross.java index 56fd425..34a7cd0 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityCircleCross.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityCircleCross.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityCircleCrowfoot.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityCircleCrowfoot.java index b7860f4..ad9eae0 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityCircleCrowfoot.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityCircleCrowfoot.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityCircleLine.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityCircleLine.java index 68f737c..7b8b878 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityCircleLine.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityCircleLine.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -41,14 +41,13 @@ import java.awt.geom.Point2D; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; +import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; class ExtremityCircleLine extends Extremity { private final Point2D contact; private final double angle; - private final double radius = 4; - private final double lineHeight = 4; @Override public Point2D somePoint() { @@ -61,11 +60,14 @@ class ExtremityCircleLine extends Extremity { } public void drawU(UGraphic ug) { + final double thickness = ug.getParam().getStroke().getThickness(); + final double radius = 4 + thickness - 1; + final double lineHeight = 4 + thickness - 1; final int xWing = 4; final AffineTransform rotate = AffineTransform.getRotateInstance(this.angle); Point2D middle = new Point2D.Double(0, 0); - Point2D base = new Point2D.Double(-xWing-radius-3, 0); - Point2D circleBase = new Point2D.Double(-xWing-radius-3, 0); + Point2D base = new Point2D.Double(-xWing - radius - 3, 0); + Point2D circleBase = new Point2D.Double(-xWing - radius - 3, 0); Point2D lineTop = new Point2D.Double(-xWing, -lineHeight); Point2D lineBottom = new Point2D.Double(-xWing, lineHeight); @@ -76,8 +78,11 @@ class ExtremityCircleLine extends Extremity { rotate.transform(circleBase, circleBase); drawLine(ug, contact.getX(), contact.getY(), base, middle); - ug.apply(new UTranslate(contact.getX()+circleBase.getX()-radius, contact.getY()+circleBase.getY()-radius)).draw(new UEllipse(2*radius, 2*radius)); - drawLine(ug, contact.getX(), contact.getY(), lineTop, lineBottom); + final UStroke stroke = new UStroke(thickness); + ug.apply( + new UTranslate(contact.getX() + circleBase.getX() - radius, contact.getY() + circleBase.getY() - radius)) + .apply(stroke).draw(new UEllipse(2 * radius, 2 * radius)); + drawLine(ug.apply(stroke), contact.getX(), contact.getY(), lineTop, lineBottom); } static private void drawLine(UGraphic ug, double x, double y, Point2D p1, Point2D p2) { @@ -85,5 +90,5 @@ class ExtremityCircleLine extends Extremity { final double dy = p2.getY() - p1.getY(); ug.apply(new UTranslate(x + p1.getX(), y + p1.getY())).draw(new ULine(dx, dy)); } - + } diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityCrowfoot.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityCrowfoot.java index d903487..b634d1d 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityCrowfoot.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityCrowfoot.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityDiamond.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityDiamond.java index 42c6bc7..031ebe3 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityDiamond.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityDiamond.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -79,4 +79,15 @@ class ExtremityDiamond extends Extremity { ug.draw(polygon); } + @Override + public Point2D isTooSmallSoGiveThePointCloserToThisOne(Point2D pt) { + Point2D result = null; + for (Point2D p : polygon.getPoints()) { + if (result == null || p.distance(pt) < result.distance(pt)) { + result = p; + } + } + return result; + } + } diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityDoubleLine.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityDoubleLine.java index de006f0..7b8f348 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityDoubleLine.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityDoubleLine.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityExtends.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityExtends.java index 5701c0f..48005cf 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityExtends.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityExtends.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactory.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactory.java index da1314f..6699980 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactory.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactory.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryArrow.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryArrow.java index f624e36..bb82d63 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryArrow.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryArrow.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryArrowAndCircle.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryArrowAndCircle.java index 4049151..eea64ba 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryArrowAndCircle.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryArrowAndCircle.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryCircle.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryCircle.java index 686a8d9..569b3d6 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryCircle.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryCircle.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -43,14 +43,21 @@ import net.sourceforge.plantuml.svek.Side; public class ExtremityFactoryCircle extends AbstractExtremityFactory implements ExtremityFactory { + private final boolean fill; + + public ExtremityFactoryCircle(boolean fill) { + this.fill = fill; + } + @Override public UDrawable createUDrawable(Point2D center, double angle, Side side) { - // return ExtremityCircle.createContact(center, angle); - return ExtremityCircle.create(center); + angle -= Math.PI / 2; + return ExtremityCircle.create(center, fill, angle); } public UDrawable createUDrawable(Point2D p0, Point2D p1, Point2D p2, Side side) { - return ExtremityCircle.create(p1); + final double ortho = atan2(p0, p2); + return ExtremityCircle.create(p1, fill, ortho); } } diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryCircleConnect.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryCircleConnect.java index 4660df2..7d6f753 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryCircleConnect.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryCircleConnect.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryCircleCross.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryCircleCross.java index b63d2f4..e5b06b8 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryCircleCross.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryCircleCross.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryCircleCrowfoot.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryCircleCrowfoot.java index ab9902f..23315bb 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryCircleCrowfoot.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryCircleCrowfoot.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryCircleLine.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryCircleLine.java index 05b5493..d4ced91 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryCircleLine.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryCircleLine.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryCrowfoot.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryCrowfoot.java index f2050e8..0b49f39 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryCrowfoot.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryCrowfoot.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -50,7 +50,8 @@ public class ExtremityFactoryCrowfoot extends AbstractExtremityFactory implement @Override public UDrawable createUDrawable(Point2D p0, double angle, Side side) { - throw new UnsupportedOperationException(getClass().toString()); + angle -= Math.PI / 2; + return new ExtremityCrowfoot(p0, angle, side); } }
\ No newline at end of file diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryDiamond.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryDiamond.java index 47dfcee..8854969 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryDiamond.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryDiamond.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryDoubleLine.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryDoubleLine.java index 7d14c0f..99c7b47 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryDoubleLine.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryDoubleLine.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryExtends.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryExtends.java index 541fbba..e7318bb 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryExtends.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryExtends.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryHalfArrow.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryHalfArrow.java new file mode 100644 index 0000000..0c16384 --- /dev/null +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryHalfArrow.java @@ -0,0 +1,57 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * PlantUML is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PlantUML distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * + * Original Author: Arnaud Roques + * + * + */ +package net.sourceforge.plantuml.svek.extremity; + +import java.awt.geom.Point2D; + +import net.sourceforge.plantuml.graphic.UDrawable; +import net.sourceforge.plantuml.svek.AbstractExtremityFactory; +import net.sourceforge.plantuml.svek.Side; + +public class ExtremityFactoryHalfArrow extends AbstractExtremityFactory implements ExtremityFactory { + + @Override + public UDrawable createUDrawable(Point2D p0, double angle, Side side) { + return new ExtremityHalfArrow(p0, angle); + } + + public UDrawable createUDrawable(Point2D p0, Point2D p1, Point2D p2, Side side) { + final double ortho = atan2(p0, p2); + final Point2D center = new Point2D.Double((p0.getX() + p2.getX()) / 2, (p0.getY() + p2.getY()) / 2); + return new ExtremityHalfArrow(p1, ortho, center); + } + +} diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryLineCrowfoot.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryLineCrowfoot.java index 5c0108c..734af10 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryLineCrowfoot.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryLineCrowfoot.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryNotNavigable.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryNotNavigable.java index 644369b..c65cc1e 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryNotNavigable.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryNotNavigable.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryParenthesis.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryParenthesis.java index 41ecc2d..9638ab3 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryParenthesis.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryParenthesis.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryPlus.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryPlus.java index dfea855..13e2fa7 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryPlus.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryPlus.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactorySquarre.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactorySquarre.java index 711a80b..c337002 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactorySquarre.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactorySquarre.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryTriangle.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryTriangle.java index 846accc..e2a2d53 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryTriangle.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryTriangle.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityHalfArrow.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityHalfArrow.java new file mode 100644 index 0000000..3068b18 --- /dev/null +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityHalfArrow.java @@ -0,0 +1,81 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * PlantUML is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PlantUML distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * + * Original Author: Arnaud Roques + * + * + */ +package net.sourceforge.plantuml.svek.extremity; + +import java.awt.geom.AffineTransform; +import java.awt.geom.Point2D; + +import net.sourceforge.plantuml.ugraphic.UChangeBackColor; +import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.ULine; +import net.sourceforge.plantuml.ugraphic.UTranslate; + +class ExtremityHalfArrow extends Extremity { + + private final ULine line; + private final ULine otherLine; + private final Point2D contact; + + @Override + public Point2D somePoint() { + return contact; + } + + public ExtremityHalfArrow(Point2D p1, double angle, Point2D center) { + angle = manageround(angle); + final AffineTransform rotate = AffineTransform.getRotateInstance(angle + Math.PI / 2); + final int xWing = 9; + final int yAperture = 4; + final Point2D other = new Point2D.Double(-xWing, -yAperture); + rotate.transform(other, other); + this.contact = p1; + this.line = new ULine(center.getX() - contact.getX(), center.getY() - contact.getY()); + this.otherLine = new ULine(other.getX(), other.getY()); + } + + public ExtremityHalfArrow(Point2D p0, double angle) { + throw new UnsupportedOperationException(); + } + + public void drawU(UGraphic ug) { + ug = ug.apply(new UChangeBackColor(ug.getParam().getColor())); + if (line != null && line.getLength() > 2) { + ug.apply(new UTranslate(contact.getX(), contact.getY())).draw(line); + ug.apply(new UTranslate(contact.getX(), contact.getY())).draw(otherLine); + } + } + +} diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityLineCrowfoot.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityLineCrowfoot.java index 882a973..47c2a7a 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityLineCrowfoot.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityLineCrowfoot.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityNotNavigable.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityNotNavigable.java index e52de17..ad6a901 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityNotNavigable.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityNotNavigable.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityOther.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityOther.java new file mode 100644 index 0000000..4bd7b8c --- /dev/null +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityOther.java @@ -0,0 +1,60 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * PlantUML is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PlantUML distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * + * Original Author: Arnaud Roques + * + * + */ +package net.sourceforge.plantuml.svek.extremity; + +import java.awt.geom.Point2D; + +import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.UPolygon; + +public class ExtremityOther extends Extremity { + + final private UPolygon polygon; + + public ExtremityOther(UPolygon polygon) { + this.polygon = polygon; + } + + public void drawU(UGraphic ug) { + ug.draw(polygon); + + } + + @Override + public Point2D somePoint() { + return polygon.getPoints().get(0); + } +} diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityParenthesis.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityParenthesis.java index 7ed3eeb..4fbb5aa 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityParenthesis.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityParenthesis.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityParenthesis2.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityParenthesis2.java index 3633c34..f8aef28 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityParenthesis2.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityParenthesis2.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityPlus.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityPlus.java index d4d3a32..1bb1879 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityPlus.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityPlus.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremitySquarre.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremitySquarre.java index 1ca9303..6470466 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremitySquarre.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremitySquarre.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityStateLine1.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityStateLine1.java index 249f64e..7cdcd25 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityStateLine1.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityStateLine1.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityStateLine2.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityStateLine2.java index 24e6c1f..80e5942 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityStateLine2.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityStateLine2.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityTriangle.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityTriangle.java index 971eba3..6cc8ae3 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityTriangle.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityTriangle.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/MiddleCircle.java b/src/net/sourceforge/plantuml/svek/extremity/MiddleCircle.java index 6875452..0cf1299 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/MiddleCircle.java +++ b/src/net/sourceforge/plantuml/svek/extremity/MiddleCircle.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/MiddleCircleCircled.java b/src/net/sourceforge/plantuml/svek/extremity/MiddleCircleCircled.java index e38e561..78f87df 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/MiddleCircleCircled.java +++ b/src/net/sourceforge/plantuml/svek/extremity/MiddleCircleCircled.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/MiddleCircleCircledMode.java b/src/net/sourceforge/plantuml/svek/extremity/MiddleCircleCircledMode.java index d2140f6..8e3a000 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/MiddleCircleCircledMode.java +++ b/src/net/sourceforge/plantuml/svek/extremity/MiddleCircleCircledMode.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/MiddleFactory.java b/src/net/sourceforge/plantuml/svek/extremity/MiddleFactory.java index 66c67cb..cd2c69a 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/MiddleFactory.java +++ b/src/net/sourceforge/plantuml/svek/extremity/MiddleFactory.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/MiddleFactoryCircle.java b/src/net/sourceforge/plantuml/svek/extremity/MiddleFactoryCircle.java index ec66eb8..78663f3 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/MiddleFactoryCircle.java +++ b/src/net/sourceforge/plantuml/svek/extremity/MiddleFactoryCircle.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/extremity/MiddleFactoryCircleCircled.java b/src/net/sourceforge/plantuml/svek/extremity/MiddleFactoryCircleCircled.java index b9252d2..e14a5f6 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/MiddleFactoryCircleCircled.java +++ b/src/net/sourceforge/plantuml/svek/extremity/MiddleFactoryCircleCircled.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/image/Circle.java b/src/net/sourceforge/plantuml/svek/image/Circle.java index 3d4dd0b..386a600 100644 --- a/src/net/sourceforge/plantuml/svek/image/Circle.java +++ b/src/net/sourceforge/plantuml/svek/image/Circle.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/image/ConnectedCircle.java b/src/net/sourceforge/plantuml/svek/image/ConnectedCircle.java index 5575602..a49a78e 100644 --- a/src/net/sourceforge/plantuml/svek/image/ConnectedCircle.java +++ b/src/net/sourceforge/plantuml/svek/image/ConnectedCircle.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/image/ContainingEllipse.java b/src/net/sourceforge/plantuml/svek/image/ContainingEllipse.java index 66cd234..077ee88 100644 --- a/src/net/sourceforge/plantuml/svek/image/ContainingEllipse.java +++ b/src/net/sourceforge/plantuml/svek/image/ContainingEllipse.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageActivity.java b/src/net/sourceforge/plantuml/svek/image/EntityImageActivity.java index 3caec84..3fd49b0 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageActivity.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageActivity.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -41,6 +41,7 @@ import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.cucadiagram.ILeaf; @@ -51,9 +52,13 @@ import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.style.PName; +import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.Bibliotekon; -import net.sourceforge.plantuml.svek.Shape; +import net.sourceforge.plantuml.svek.Node; import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.ugraphic.Shadowable; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; @@ -65,6 +70,7 @@ import net.sourceforge.plantuml.ugraphic.UTranslate; public class EntityImageActivity extends AbstractEntityImage { + private double shadowing = 0; public static final int CORNER = 25; final private TextBlock desc; final private static int MARGIN = 10; @@ -76,8 +82,21 @@ public class EntityImageActivity extends AbstractEntityImage { this.bibliotekon = bibliotekon; final Stereotype stereotype = entity.getStereotype(); - this.desc = entity.getDisplay().create(new FontConfiguration(getSkinParam(), FontParam.ACTIVITY, stereotype), - HorizontalAlignment.CENTER, skinParam); + final FontConfiguration fontConfiguration; + final HorizontalAlignment horizontalAlignment; + if (SkinParam.USE_STYLES()) { + final Style style = getDefaultStyleDefinition().getMergedStyle(getSkinParam().getCurrentStyleBuilder()); + fontConfiguration = style.getFontConfiguration(skinParam.getIHtmlColorSet()); + horizontalAlignment = style.getHorizontalAlignment(); + shadowing = style.value(PName.Shadowing).asDouble(); + } else { + fontConfiguration = new FontConfiguration(getSkinParam(), FontParam.ACTIVITY, stereotype); + horizontalAlignment = HorizontalAlignment.CENTER; + if (getSkinParam().shadowing(getEntity().getStereotype())) { + shadowing = 4; + } + } + this.desc = entity.getDisplay().create(fontConfiguration, horizontalAlignment, skinParam); this.url = entity.getUrl99(); } @@ -103,11 +122,9 @@ public class EntityImageActivity extends AbstractEntityImage { } private UGraphic drawOctagon(UGraphic ug) { - final Shape shape = bibliotekon.getShape(getEntity()); - final Shadowable octagon = shape.getOctagon(); - if (getSkinParam().shadowing(getEntity().getStereotype())) { - octagon.setDeltaShadow(4); - } + final Node node = bibliotekon.getNode(getEntity()); + final Shadowable octagon = node.getOctagon(); + octagon.setDeltaShadow(shadowing); ug = applyColors(ug); ug.apply(new UStroke(1.5)).draw(octagon); desc.drawU(ug.apply(new UTranslate(MARGIN, MARGIN))); @@ -122,23 +139,40 @@ public class EntityImageActivity extends AbstractEntityImage { final double widthTotal = dimTotal.getWidth(); final double heightTotal = dimTotal.getHeight(); final Shadowable rect = new URectangle(widthTotal, heightTotal, CORNER, CORNER); - if (getSkinParam().shadowing(getEntity().getStereotype())) { - rect.setDeltaShadow(4); - } + rect.setDeltaShadow(shadowing); ug = applyColors(ug); - ug.apply(new UStroke(1.5)).draw(rect); + UStroke stroke = new UStroke(1.5); + if (SkinParam.USE_STYLES()) { + final Style style = getDefaultStyleDefinition().getMergedStyle(getSkinParam().getCurrentStyleBuilder()); + stroke = style.getStroke(); + } + ug.apply(stroke).draw(rect); desc.drawU(ug.apply(new UTranslate(MARGIN, MARGIN))); return ug; } + public StyleSignature getDefaultStyleDefinition() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activity).with(getStereo()); + } + private UGraphic applyColors(UGraphic ug) { - ug = ug.apply(new UChangeColor(SkinParamUtils.getColor(getSkinParam(), ColorParam.activityBorder, getStereo()))); + HtmlColor borderColor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.activityBorder); HtmlColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); if (backcolor == null) { - backcolor = SkinParamUtils.getColor(getSkinParam(), ColorParam.activityBackground, getStereo()); + backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.activityBackground); + } + + if (SkinParam.USE_STYLES()) { + final Style style = getDefaultStyleDefinition().getMergedStyle(getSkinParam().getCurrentStyleBuilder()); + borderColor = style.value(PName.LineColor).asColor(getSkinParam().getIHtmlColorSet()); + backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); + if (backcolor == null) { + backcolor = style.value(PName.BackGroundColor).asColor(getSkinParam().getIHtmlColorSet()); + } } + ug = ug.apply(new UChangeColor(borderColor)); ug = ug.apply(new UChangeBackColor(backcolor)); return ug; } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageArcCircle.java b/src/net/sourceforge/plantuml/svek/image/EntityImageArcCircle.java index 0e9dce4..f5b5d15 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageArcCircle.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageArcCircle.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -39,6 +39,7 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FontParam; +import net.sourceforge.plantuml.Guillemet; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.ILeaf; @@ -67,10 +68,10 @@ public class EntityImageArcCircle extends AbstractEntityImage { this.name = entity.getDisplay().create(new FontConfiguration(getSkinParam(), FontParam.COMPONENT, stereotype), HorizontalAlignment.CENTER, skinParam); - if (stereotype == null || stereotype.getLabel(false) == null) { + if (stereotype == null || stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR) == null) { this.stereo = null; } else { - this.stereo = Display.getWithNewlines(stereotype.getLabel(getSkinParam().useGuillemet())).create( + this.stereo = Display.getWithNewlines(stereotype.getLabel(getSkinParam().guillemet())).create( new FontConfiguration(getSkinParam(), FontParam.COMPONENT_STEREOTYPE, stereotype), HorizontalAlignment.CENTER, skinParam); } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageAssociation.java b/src/net/sourceforge/plantuml/svek/image/EntityImageAssociation.java index 7466c2a..5db1990 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageAssociation.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageAssociation.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -74,9 +74,9 @@ public class EntityImageAssociation extends AbstractEntityImage { diams.addPoint(0, SIZE); diams.addPoint(SIZE, 0); - ug.apply(new UChangeColor(SkinParamUtils.getColor(getSkinParam(), ColorParam.classBorder, getStereo()))) - .apply(new UChangeBackColor(SkinParamUtils.getColor(getSkinParam(), ColorParam.classBackground, - getStereo()))).apply(new UStroke(1.5)).draw(diams); + ug.apply(new UChangeColor(SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.classBorder))) + .apply(new UChangeBackColor(SkinParamUtils.getColor(getSkinParam(), getStereo(), + ColorParam.classBackground))).apply(new UStroke(1.5)).draw(diams); } public ShapeType getShapeType() { diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageAssociationPoint.java b/src/net/sourceforge/plantuml/svek/image/EntityImageAssociationPoint.java index 2954d21..f7f776b 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageAssociationPoint.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageAssociationPoint.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageBranch.java b/src/net/sourceforge/plantuml/svek/image/EntityImageBranch.java index b692f82..bee424b 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageBranch.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageBranch.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -40,9 +40,15 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.cucadiagram.ILeaf; +import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.style.PName; +import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; @@ -59,24 +65,43 @@ public class EntityImageBranch extends AbstractEntityImage { super(entity, skinParam); } + public StyleSignature getDefaultStyleDefinition() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activity, SName.diamond); + } + public Dimension2D calculateDimension(StringBounder stringBounder) { return new Dimension2DDouble(SIZE * 2, SIZE * 2); } final public void drawU(UGraphic ug) { final UPolygon diams = new UPolygon(); - if (getSkinParam().shadowing(getEntity().getStereotype())) { - diams.setDeltaShadow(5); - } + double shadowing = 0; diams.addPoint(SIZE, 0); diams.addPoint(SIZE * 2, SIZE); diams.addPoint(SIZE, SIZE * 2); diams.addPoint(0, SIZE); diams.addPoint(SIZE, 0); - ug.apply(new UChangeColor(SkinParamUtils.getColor(getSkinParam(), ColorParam.activityBorder, getStereo()))) - .apply(new UChangeBackColor(SkinParamUtils.getColor(getSkinParam(), ColorParam.activityBackground, - getStereo()))).apply(new UStroke(1.5)).draw(diams); + HtmlColor border = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.activityDiamondBorder, + ColorParam.activityBorder); + HtmlColor back = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.activityDiamondBackground, + ColorParam.activityBackground); + UStroke stroke = new UStroke(1.5); + if (SkinParam.USE_STYLES()) { + final Style style = getDefaultStyleDefinition().getMergedStyle(getSkinParam().getCurrentStyleBuilder()); + border = style.value(PName.LineColor).asColor(getSkinParam().getIHtmlColorSet()); + back = style.value(PName.BackGroundColor).asColor(getSkinParam().getIHtmlColorSet()); + stroke = style.getStroke(); + shadowing = style.value(PName.Shadowing).asDouble(); + } else { + if (getSkinParam().shadowing(getEntity().getStereotype())) { + shadowing = 5; + } + + } + diams.setDeltaShadow(shadowing); + + ug.apply(new UChangeColor(border)).apply(new UChangeBackColor(back)).apply(stroke).draw(diams); } public ShapeType getShapeType() { diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageCircleEnd.java b/src/net/sourceforge/plantuml/svek/image/EntityImageCircleEnd.java index 878ee38..ad97af3 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageCircleEnd.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageCircleEnd.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -40,9 +40,15 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.cucadiagram.ILeaf; +import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.style.PName; +import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; @@ -57,6 +63,10 @@ public class EntityImageCircleEnd extends AbstractEntityImage { private static final int SIZE = 20; private final ColorParam param; + public StyleSignature getDefaultStyleDefinitionCircle() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.circle); + } + public EntityImageCircleEnd(ILeaf entity, ISkinParam skinParam, ColorParam param) { super(entity, skinParam); this.param = param; @@ -68,17 +78,24 @@ public class EntityImageCircleEnd extends AbstractEntityImage { final public void drawU(UGraphic ug) { final UEllipse circle = new UEllipse(SIZE, SIZE); + double shadowing = 0; if (getSkinParam().shadowing(getEntity().getStereotype())) { - circle.setDeltaShadow(3); + shadowing = 3; + } + HtmlColor color = SkinParamUtils.getColor(getSkinParam(), getStereo(), param); + if (SkinParam.USE_STYLES()) { + final Style style = getDefaultStyleDefinitionCircle().getMergedStyle( + getSkinParam().getCurrentStyleBuilder()); + color = style.value(PName.LineColor).asColor(getSkinParam().getIHtmlColorSet()); + shadowing = style.value(PName.Shadowing).asDouble(); } - ug.apply(new UChangeBackColor(null)) - .apply(new UChangeColor(SkinParamUtils.getColor(getSkinParam(), param, getStereo()))) - .draw(circle); + circle.setDeltaShadow(shadowing); + ug.apply(new UChangeBackColor(null)).apply(new UChangeColor(color)).draw(circle); final double delta = 4; final UShape circleSmall = new UEllipse(SIZE - delta * 2, SIZE - delta * 2); - ug.apply(new UChangeBackColor(SkinParamUtils.getColor(getSkinParam(), param, getStereo()))) - .apply(new UChangeColor(null)).apply(new UTranslate(delta + 0.5, delta + 0.5)).draw(circleSmall); + ug.apply(new UChangeBackColor(color)).apply(new UChangeColor(null)) + .apply(new UTranslate(delta + 0.5, delta + 0.5)).draw(circleSmall); } public ShapeType getShapeType() { diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageCircleStart.java b/src/net/sourceforge/plantuml/svek/image/EntityImageCircleStart.java index 61fe293..672f32b 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageCircleStart.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageCircleStart.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -40,9 +40,15 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.cucadiagram.ILeaf; +import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.style.PName; +import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; @@ -55,6 +61,10 @@ public class EntityImageCircleStart extends AbstractEntityImage { private static final int SIZE = 20; private final ColorParam colorParam; // = ColorParam.activityStart; + public StyleSignature getDefaultStyleDefinitionCircle() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.circle); + } + public EntityImageCircleStart(ILeaf entity, ISkinParam skinParam, ColorParam colorParam) { super(entity, skinParam); this.colorParam = colorParam; @@ -66,11 +76,19 @@ public class EntityImageCircleStart extends AbstractEntityImage { final public void drawU(UGraphic ug) { final UEllipse circle = new UEllipse(SIZE, SIZE); + double shadowing = 0; if (getSkinParam().shadowing(getEntity().getStereotype())) { - circle.setDeltaShadow(3); + shadowing = 3; + } + HtmlColor color = SkinParamUtils.getColor(getSkinParam(), getStereo(), colorParam); + if (SkinParam.USE_STYLES()) { + final Style style = getDefaultStyleDefinitionCircle().getMergedStyle( + getSkinParam().getCurrentStyleBuilder()); + color = style.value(PName.LineColor).asColor(getSkinParam().getIHtmlColorSet()); + shadowing = style.value(PName.Shadowing).asDouble(); } - ug.apply(new UChangeBackColor(SkinParamUtils.getColor(getSkinParam(), colorParam, getStereo()))) - .apply(new UChangeColor(null)).draw(circle); + circle.setDeltaShadow(shadowing); + ug.apply(new UChangeBackColor(color)).apply(new UChangeColor(null)).draw(circle); } public ShapeType getShapeType() { diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageClass.java b/src/net/sourceforge/plantuml/svek/image/EntityImageClass.java index 9afccfb..f4e2724 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageClass.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageClass.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -39,17 +39,18 @@ import java.awt.geom.Dimension2D; import java.awt.geom.Rectangle2D; import net.sourceforge.plantuml.ColorParam; +import net.sourceforge.plantuml.CornerParam; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.LineConfigurable; import net.sourceforge.plantuml.LineParam; -import net.sourceforge.plantuml.CornerParam; import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.creole.Stencil; import net.sourceforge.plantuml.cucadiagram.EntityPortion; import net.sourceforge.plantuml.cucadiagram.ILeaf; +import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.PortionShower; import net.sourceforge.plantuml.cucadiagram.dot.GraphvizVersion; import net.sourceforge.plantuml.graphic.HtmlColor; @@ -79,11 +80,13 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil, Wi final private EntityImageClassHeader2 header; final private Url url; final private double roundCorner; + final private LeafType leafType; final private LineConfigurable lineConfig; public EntityImageClass(GraphvizVersion version, ILeaf entity, ISkinParam skinParam, PortionShower portionShower) { super(entity, entity.getColors(skinParam).mute(skinParam)); + this.leafType = entity.getLeafType(); this.lineConfig = entity; this.roundCorner = getSkinParam().getRoundCorner(CornerParam.DEFAULT, null); this.shield = version != null && version.useShield() && entity.hasNearDecoration() ? Margins.uniform(16) @@ -122,7 +125,7 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil, Wi } final public void drawU(UGraphic ug) { - ug.draw(new UComment("class " + getEntity().getCode().getFullName())); + ug.draw(new UComment("class " + getEntity().getCodeGetName())); if (url != null) { ug.startUrl(url); } @@ -140,20 +143,25 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil, Wi final double widthTotal = dimTotal.getWidth(); final double heightTotal = dimTotal.getHeight(); - final Shadowable rect = new URectangle(widthTotal, heightTotal, roundCorner, roundCorner, getEntity().getCode() - .getFullName()); + final Shadowable rect = new URectangle(widthTotal, heightTotal, roundCorner, roundCorner, getEntity() + .getCodeGetName()); if (getSkinParam().shadowing(getEntity().getStereotype())) { rect.setDeltaShadow(4); } HtmlColor classBorder = lineConfig.getColors(getSkinParam()).getColor(ColorType.LINE); if (classBorder == null) { - classBorder = SkinParamUtils.getColor(getSkinParam(), ColorParam.classBorder, getStereo()); + classBorder = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.classBorder); } ug = ug.apply(new UChangeColor(classBorder)); HtmlColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); if (backcolor == null) { - backcolor = SkinParamUtils.getColor(getSkinParam(), ColorParam.classBackground, getStereo()); + if (leafType == LeafType.ENUM) { + backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.enumBackground, + ColorParam.classBackground); + } else { + backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.classBackground); + } } ug = ug.apply(new UChangeBackColor(backcolor)); diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageClassHeader2.java b/src/net/sourceforge/plantuml/svek/image/EntityImageClassHeader2.java index ddc8051..47d10ff 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageClassHeader2.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageClassHeader2.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -35,12 +35,11 @@ */ package net.sourceforge.plantuml.svek.image; -import h.tedge_t; - import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.FontParam; +import net.sourceforge.plantuml.Guillemet; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.cucadiagram.Display; @@ -102,12 +101,12 @@ public class EntityImageClassHeader2 extends AbstractEntityImage { } final TextBlock stereo; - if (stereotype == null || stereotype.getLabel(false) == null + if (stereotype == null || stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR) == null || portionShower.showPortion(EntityPortion.STEREOTYPE, entity) == false) { stereo = null; } else { stereo = TextBlockUtils.withMargin( - Display.create(stereotype.getLabels(skinParam.useGuillemet())).create( + Display.create(stereotype.getLabels(skinParam.guillemet())).create( new FontConfiguration(getSkinParam(), FontParam.CLASS_STEREOTYPE, stereotype), HorizontalAlignment.CENTER, skinParam), 1, 0); } @@ -121,7 +120,7 @@ public class EntityImageClassHeader2 extends AbstractEntityImage { HorizontalAlignment.CENTER, skinParam); genericBlock = TextBlockUtils.withMargin(genericBlock, 1, 1); final HtmlColor classBackground = SkinParamUtils - .getColor(getSkinParam(), ColorParam.background, stereotype); + .getColor(getSkinParam(), stereotype, ColorParam.background); final HtmlColor classBorder = SkinParamUtils.getFontColor(getSkinParam(), FontParam.CLASS_STEREOTYPE, stereotype); @@ -140,19 +139,19 @@ public class EntityImageClassHeader2 extends AbstractEntityImage { private TextBlock getCircledCharacter(ILeaf entity, ISkinParam skinParam) { final Stereotype stereotype = entity.getStereotype(); - if (stereotype != null && stereotype.getSprite() != null) { - return skinParam.getSprite(stereotype.getSprite()).asTextBlock(stereotype.getHtmlColor(), 1); + if (stereotype != null && stereotype.getSprite(skinParam) != null) { + return stereotype.getSprite(skinParam); } final UFont font = SkinParamUtils.getFont(getSkinParam(), FontParam.CIRCLED_CHARACTER, null); - final HtmlColor classBorder = SkinParamUtils.getColor(getSkinParam(), ColorParam.classBorder, stereotype); + final HtmlColor classBorder = SkinParamUtils.getColor(getSkinParam(), stereotype, ColorParam.classBorder); final HtmlColor fontColor = SkinParamUtils.getFontColor(getSkinParam(), FontParam.CIRCLED_CHARACTER, null); if (stereotype != null && stereotype.getCharacter() != 0) { return new CircledCharacter(stereotype.getCharacter(), getSkinParam().getCircledCharacterRadius(), font, stereotype.getHtmlColor(), classBorder, fontColor); } final LeafType leafType = entity.getLeafType(); - final HtmlColor spotBackColor = SkinParamUtils.getColor(getSkinParam(), spotBackground(leafType), stereotype); - HtmlColor spotBorder = SkinParamUtils.getColor(getSkinParam(), spotBorder(leafType), stereotype); + final HtmlColor spotBackColor = SkinParamUtils.getColor(getSkinParam(), stereotype, spotBackground(leafType)); + HtmlColor spotBorder = SkinParamUtils.getColor(getSkinParam(), stereotype, spotBorder(leafType)); if (spotBorder == null) { spotBorder = classBorder; } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java b/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java index b0aec15..5ef8053 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -42,10 +42,13 @@ import java.util.HashSet; import java.util.Set; import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.Guillemet; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.LineBreakStrategy; import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.cucadiagram.BodyEnhanced; +import net.sourceforge.plantuml.cucadiagram.BodyEnhanced2; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.EntityPortion; import net.sourceforge.plantuml.cucadiagram.IEntity; @@ -62,7 +65,6 @@ import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.USymbol; -import net.sourceforge.plantuml.graphic.USymbolFolder; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.svek.AbstractEntityImage; @@ -111,39 +113,47 @@ public class EntityImageDescription extends AbstractEntityImage { } this.hideText = symbol == USymbol.INTERFACE; - final Display codeDisplay = Display.getWithNewlines(entity.getCode()); - desc = (entity.getDisplay().equals(codeDisplay) && symbol.getSkinParameter() == SkinParameter.PACKAGE) - || entity.getDisplay().isWhite() ? TextBlockUtils.empty(0, 0) : new BodyEnhanced(entity.getDisplay(), - symbol.getFontParam(), getSkinParam(), HorizontalAlignment.LEFT, stereotype, - symbol.manageHorizontalLine(), false, entity); + final Display codeDisplay = Display.getWithNewlines(entity.getCodeGetName()); + if ((entity.getDisplay().equals(codeDisplay) && symbol.getSkinParameter() == SkinParameter.PACKAGE) + || entity.getDisplay().isWhite()) { + desc = TextBlockUtils.empty(0, 0); + } else { + desc = new BodyEnhanced(entity.getDisplay(), symbol.getFontParam(), getSkinParam(), + HorizontalAlignment.LEFT, stereotype, symbol.manageHorizontalLine(), false, entity); + // Actor bug? + // desc = new BodyEnhanced2(entity.getDisplay(), symbol.getFontParam(), getSkinParam(), + // HorizontalAlignment.LEFT, new FontConfiguration(skinParam, symbol.getFontParam(), stereotype), + // LineBreakStrategy.NONE); + // desc = entity.getDisplay().create(new FontConfiguration(skinParam, symbol.getFontParam(), stereotype), + // HorizontalAlignment.LEFT, skinParam); + } this.url = entity.getUrl99(); final Colors colors = entity.getColors(skinParam); HtmlColor backcolor = colors.getColor(ColorType.BACK); if (backcolor == null) { - backcolor = SkinParamUtils.getColor(getSkinParam(), symbol.getColorParamBack(), getStereo()); + backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), symbol.getColorParamBack()); } assert getStereo() == stereotype; - final HtmlColor forecolor = SkinParamUtils.getColor(getSkinParam(), symbol.getColorParamBorder(), stereotype); + final HtmlColor forecolor = SkinParamUtils.getColor(getSkinParam(), stereotype, symbol.getColorParamBorder()); final double roundCorner = symbol.getSkinParameter().getRoundCorner(getSkinParam(), stereotype); final double diagonalCorner = symbol.getSkinParameter().getDiagonalCorner(getSkinParam(), stereotype); final UStroke stroke = colors.muteStroke(symbol.getSkinParameter().getStroke(getSkinParam(), stereotype)); final SymbolContext ctx = new SymbolContext(backcolor, forecolor).withStroke(stroke) - .withShadow(getSkinParam().shadowing2(getEntity().getStereotype(), symbol.getSkinParameter())) + .withShadow(getSkinParam().shadowing2(getEntity().getStereotype(), symbol.getSkinParameter()) ? 3 : 0) .withCorner(roundCorner, diagonalCorner); stereo = TextBlockUtils.empty(0, 0); - if (stereotype != null && stereotype.getSprite() != null - && getSkinParam().getSprite(stereotype.getSprite()) != null) { - symbol = symbol.withStereoAlignment(HorizontalAlignment.RIGHT); - stereo = getSkinParam().getSprite(stereotype.getSprite()).asTextBlock(stereotype.getHtmlColor(), 1); - } else if (stereotype != null && stereotype.getLabel(false) != null + if (stereotype != null && stereotype.getSprite(getSkinParam()) != null) { + // symbol = symbol.withStereoAlignment(HorizontalAlignment.RIGHT); + stereo = stereotype.getSprite(getSkinParam()); + } else if (stereotype != null && stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR) != null && portionShower.showPortion(EntityPortion.STEREOTYPE, entity)) { - stereo = Display.getWithNewlines(stereotype.getLabel(getSkinParam().useGuillemet())).create( + stereo = Display.getWithNewlines(stereotype.getLabel(getSkinParam().guillemet())).create( new FontConfiguration(getSkinParam(), symbol.getFontParamStereotype(), stereotype), HorizontalAlignment.CENTER, getSkinParam()); } @@ -153,9 +163,9 @@ public class EntityImageDescription extends AbstractEntityImage { if (hideText) { asSmall = symbol.asSmall(TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), - TextBlockUtils.empty(0, 0), ctx); + TextBlockUtils.empty(0, 0), ctx, skinParam.getStereotypeAlignment()); } else { - asSmall = symbol.asSmall(name, desc, stereo, ctx); + asSmall = symbol.asSmall(name, desc, stereo, ctx, skinParam.getStereotypeAlignment()); } } @@ -241,7 +251,7 @@ public class EntityImageDescription extends AbstractEntityImage { } final public void drawU(UGraphic ug) { - ug.draw(new UComment("entity " + getEntity().getCode().getFullName())); + ug.draw(new UComment("entity " + getEntity().getCodeGetName())); if (url != null) { ug.startUrl(url); } @@ -250,11 +260,11 @@ public class EntityImageDescription extends AbstractEntityImage { final double space = 8; final Dimension2D dimSmall = asSmall.calculateDimension(ug.getStringBounder()); final Dimension2D dimDesc = desc.calculateDimension(ug.getStringBounder()); - desc.drawU(ug.apply(new UTranslate((dimSmall.getWidth() - dimDesc.getWidth()) / 2, space - + dimSmall.getHeight()))); + final double posx1 = (dimSmall.getWidth() - dimDesc.getWidth()) / 2; + desc.drawU(ug.apply(new UTranslate(posx1, space + dimSmall.getHeight()))); final Dimension2D dimStereo = stereo.calculateDimension(ug.getStringBounder()); - stereo.drawU(ug.apply(new UTranslate((dimSmall.getWidth() - dimStereo.getWidth()) / 2, -space - - dimStereo.getHeight()))); + final double posx2 = (dimSmall.getWidth() - dimStereo.getWidth()) / 2; + stereo.drawU(ug.apply(new UTranslate(posx2, -space - dimStereo.getHeight()))); } if (url != null) { @@ -266,4 +276,16 @@ public class EntityImageDescription extends AbstractEntityImage { return shapeType; } + @Override + public double getOverscanX(StringBounder stringBounder) { + if (hideText) { + final Dimension2D dimSmall = asSmall.calculateDimension(stringBounder); + final Dimension2D dimDesc = desc.calculateDimension(stringBounder); + final Dimension2D dimStereo = stereo.calculateDimension(stringBounder); + final double posx1 = (dimSmall.getWidth() - dimDesc.getWidth()) / 2; + final double posx2 = (dimSmall.getWidth() - dimStereo.getWidth()) / 2; + return MathUtils.max(-posx1, -posx2, 0); + } + return 0; + } } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageEmptyPackage.java b/src/net/sourceforge/plantuml/svek/image/EntityImageEmptyPackage.java index 852564b..5ed5555 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageEmptyPackage.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageEmptyPackage.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -41,6 +41,7 @@ import net.sourceforge.plantuml.AlignmentParam; import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FontParam; +import net.sourceforge.plantuml.Guillemet; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.LineParam; import net.sourceforge.plantuml.SkinParamUtils; @@ -83,12 +84,12 @@ public class EntityImageEmptyPackage extends AbstractEntityImage { HorizontalAlignment.CENTER, skinParam); this.url = entity.getUrl99(); - if (stereotype == null || stereotype.getLabel(false) == null + if (stereotype == null || stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR) == null || portionShower.showPortion(EntityPortion.STEREOTYPE, entity) == false) { stereoBlock = TextBlockUtils.empty(0, 0); } else { stereoBlock = TextBlockUtils.withMargin( - Display.create(stereotype.getLabels(skinParam.useGuillemet())).create( + Display.create(stereotype.getLabels(skinParam.guillemet())).create( new FontConfiguration(getSkinParam(), FontParam.PACKAGE_STEREOTYPE, stereotype), HorizontalAlignment.CENTER, skinParam), 1, 0); } @@ -128,9 +129,11 @@ public class EntityImageEmptyPackage extends AbstractEntityImage { final ClusterDecoration decoration = new ClusterDecoration(getSkinParam().getPackageStyle(), null, desc, stereoBlock, 0, 0, widthTotal, heightTotal, getStroke()); - decoration.drawU(ug, back, SkinParamUtils.getColor(getSkinParam(), ColorParam.packageBorder, getStereo()), - getSkinParam().shadowing(getEntity().getStereotype()), roundCorner, - getSkinParam().getHorizontalAlignment(AlignmentParam.packageTitleAlignment, null, false)); + final double shadowing = getSkinParam().shadowing(getEntity().getStereotype()) ? 3 : 0; + decoration.drawU(ug, back, SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.packageBorder), + shadowing, roundCorner, + getSkinParam().getHorizontalAlignment(AlignmentParam.packageTitleAlignment, null, false), + getSkinParam().getStereotypeAlignment()); if (url != null) { ug.closeAction(); diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageGroup.java b/src/net/sourceforge/plantuml/svek/image/EntityImageGroup.java index eb40977..451b10a 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageGroup.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageGroup.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterface.java b/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterface.java index 06618fc..e64d787 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterface.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterface.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -44,6 +44,7 @@ import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.cucadiagram.ILeaf; +import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; @@ -78,13 +79,19 @@ public class EntityImageLollipopInterface extends AbstractEntityImage { } final public void drawU(UGraphic ug) { - final UEllipse circle = new UEllipse(SIZE, SIZE); - if (getSkinParam().shadowing(getEntity().getStereotype())) { - circle.setDeltaShadow(4); + final UEllipse circle; + if (getEntity().getLeafType() == LeafType.LOLLIPOP_HALF) { + // circle = new UEllipse(SIZE, SIZE, 0, 180); + circle = new UEllipse(SIZE, SIZE, angle - 90, 180); + } else { + circle = new UEllipse(SIZE, SIZE); + if (getSkinParam().shadowing(getEntity().getStereotype())) { + circle.setDeltaShadow(4); + } } ug = ug.apply( - new UChangeBackColor(SkinParamUtils.getColor(getSkinParam(), ColorParam.classBackground, getStereo()))) - .apply(new UChangeColor(SkinParamUtils.getColor(getSkinParam(), ColorParam.classBorder, getStereo()))); + new UChangeBackColor(SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.classBackground))) + .apply(new UChangeColor(SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.classBorder))); if (url != null) { ug.startUrl(url); } @@ -106,4 +113,10 @@ public class EntityImageLollipopInterface extends AbstractEntityImage { return ShapeType.CIRCLE_IN_RECT; } + private double angle; + + public void addImpact(double angle) { + this.angle = 180 - (angle * 180 / Math.PI); + } + } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterfaceEye1.java b/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterfaceEye1.java index b59cc0d..dfc5855 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterfaceEye1.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterfaceEye1.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -84,9 +84,9 @@ public class EntityImageLollipopInterfaceEye1 extends AbstractEntityImage { } final public void drawU(UGraphic ug) { - ug = ug.apply(new UChangeColor(SkinParamUtils.getColor(getSkinParam(), ColorParam.classBorder, getStereo()))); - ug = ug.apply(new UChangeBackColor(SkinParamUtils.getColor(getSkinParam(), ColorParam.classBackground, - getStereo()))); + ug = ug.apply(new UChangeColor(SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.classBorder))); + ug = ug.apply(new UChangeBackColor(SkinParamUtils.getColor(getSkinParam(), getStereo(), + ColorParam.classBackground))); if (url != null) { ug.startUrl(url); } @@ -99,7 +99,7 @@ public class EntityImageLollipopInterfaceEye1 extends AbstractEntityImage { ug.apply(new UStroke(1.5)).apply(new UTranslate(diff, diff)).draw(circle1); ug = ug.apply(new UChangeBackColor(null)); - Point2D pos = bibliotekon.getShape(getEntity()).getPosition(); + Point2D pos = bibliotekon.getNode(getEntity()).getPosition(); final List<Line> lines = bibliotekon.getAllLineConnectedTo(getEntity()); final UTranslate reverse = new UTranslate(pos).reverse(); diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterfaceEye2.java b/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterfaceEye2.java index a75c5b1..b66943e 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterfaceEye2.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterfaceEye2.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -38,6 +38,7 @@ package net.sourceforge.plantuml.svek.image; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.Guillemet; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.Url; @@ -88,16 +89,16 @@ public class EntityImageLollipopInterfaceEye2 extends AbstractEntityImage { HtmlColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); if (backcolor == null) { - backcolor = SkinParamUtils.getColor(getSkinParam(), symbol.getColorParamBack(), getStereo()); + backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), symbol.getColorParamBack()); } // backcolor = HtmlColorUtils.BLUE; - final HtmlColor forecolor = SkinParamUtils.getColor(getSkinParam(), symbol.getColorParamBorder(), getStereo()); + final HtmlColor forecolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), symbol.getColorParamBorder()); this.ctx = new SymbolContext(backcolor, forecolor).withStroke(new UStroke(1.5)).withShadow( - getSkinParam().shadowing(getEntity().getStereotype())); + getSkinParam().shadowing(getEntity().getStereotype()) ? 3 : 0); - if (stereotype != null && stereotype.getLabel(false) != null + if (stereotype != null && stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR) != null && portionShower.showPortion(EntityPortion.STEREOTYPE, entity)) { - stereo = Display.getWithNewlines(stereotype.getLabel(getSkinParam().useGuillemet())).create( + stereo = Display.getWithNewlines(stereotype.getLabel(getSkinParam().guillemet())).create( new FontConfiguration(getSkinParam(), symbol.getFontParamStereotype(), stereotype), HorizontalAlignment.CENTER, skinParam); } else { diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageNote.java b/src/net/sourceforge/plantuml/svek/image/EntityImageNote.java index 3888448..6ea5297 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageNote.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageNote.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -40,12 +40,13 @@ import java.awt.geom.Line2D; import java.awt.geom.Point2D; import net.sourceforge.plantuml.ColorParam; +import net.sourceforge.plantuml.CornerParam; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.Direction; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.LineParam; -import net.sourceforge.plantuml.CornerParam; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.SkinParamBackcolored; import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.Url; @@ -66,9 +67,13 @@ import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.posimo.DotPath; import net.sourceforge.plantuml.skin.rose.Rose; +import net.sourceforge.plantuml.style.PName; +import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.Line; -import net.sourceforge.plantuml.svek.Shape; +import net.sourceforge.plantuml.svek.Node; import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; @@ -82,6 +87,7 @@ public class EntityImageNote extends AbstractEntityImage implements Stencil { private final HtmlColor noteBackgroundColor; private final HtmlColor borderColor; + private final double shadowing; private final int marginX1 = 6; private final int marginX2 = 15; private final int marginY = 5; @@ -99,15 +105,24 @@ public class EntityImageNote extends AbstractEntityImage implements Stencil { final Rose rose = new Rose(); - if (entity.getColors(getSkinParam()).getColor(ColorType.BACK) == null) { - noteBackgroundColor = rose.getHtmlColor(getSkinParam(), ColorParam.noteBackground); + if (SkinParam.USE_STYLES()) { + final Style style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder()); + if (entity.getColors(getSkinParam()).getColor(ColorType.BACK) == null) { + this.noteBackgroundColor = style.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet()); + } else { + this.noteBackgroundColor = entity.getColors(getSkinParam()).getColor(ColorType.BACK); + } + this.borderColor = style.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet()); + this.shadowing = style.value(PName.Shadowing).asDouble(); } else { - noteBackgroundColor = entity.getColors(getSkinParam()).getColor(ColorType.BACK); + this.shadowing = skinParam.shadowing(getEntity().getStereotype()) ? 4 : 0; + if (entity.getColors(getSkinParam()).getColor(ColorType.BACK) == null) { + this.noteBackgroundColor = rose.getHtmlColor(getSkinParam(), ColorParam.noteBackground); + } else { + this.noteBackgroundColor = entity.getColors(getSkinParam()).getColor(ColorType.BACK); + } + this.borderColor = SkinParamUtils.getColor(getSkinParam(), null, ColorParam.noteBorder); } - // this.borderColor = rose.getHtmlColor(skinParam, ColorParam.noteBorder); - this.borderColor = SkinParamUtils.getColor(getSkinParam(), ColorParam.noteBorder, null); - // final HtmlColor fontColor = rose.getFontColor(getSkinParam(), FontParam.NOTE); - // final UFont fontNote = getSkinParam().getFont(FontParam.NOTE, null, false); if (strings.size() == 1 && strings.get(0).length() == 0) { textBlock = new TextBlockEmpty(); @@ -139,7 +154,7 @@ public class EntityImageNote extends AbstractEntityImage implements Stencil { private static HtmlColor getColorStatic(ISkinParam skinParam, ColorParam colorParam, Stereotype stereo) { final Rose rose = new Rose(); - return rose.getHtmlColor(skinParam, colorParam, stereo); + return rose.getHtmlColor(skinParam, stereo, colorParam); } final public double getPreferredWidth(StringBounder stringBounder) { @@ -181,6 +196,10 @@ public class EntityImageNote extends AbstractEntityImage implements Stencil { return new Dimension2DDouble(width, height); } + public StyleSignature getDefaultStyleDefinition() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.note); + } + final public void drawU(UGraphic ug) { final Url url = getEntity().getUrl99(); if (url != null) { @@ -192,7 +211,7 @@ public class EntityImageNote extends AbstractEntityImage implements Stencil { } else { final StringBounder stringBounder = ug.getStringBounder(); DotPath path = opaleLine.getDotPath(); - path.moveSvek(-shape.getMinX(), -shape.getMinY()); + path.moveSvek(-node.getMinX(), -node.getMinY()); Point2D p1 = path.getStartPoint(); Point2D p2 = path.getEndPoint(); final double textWidth = getTextWidth(stringBounder); @@ -206,10 +225,10 @@ public class EntityImageNote extends AbstractEntityImage implements Stencil { final Direction strategy = getOpaleStrategy(textWidth, textHeight, p1); final Point2D pp1 = path.getStartPoint(); final Point2D pp2 = path.getEndPoint(); - final Point2D newRefpp2 = move(pp2, shape.getMinX(), shape.getMinY()); - final Point2D projection = move(other.projection(newRefpp2, stringBounder), -shape.getMinX(), - -shape.getMinY()); - final Opale opale = new Opale(borderColor, noteBackgroundColor, textBlock, skinParam.shadowing(getEntity().getStereotype()), true); + final Point2D newRefpp2 = move(pp2, node.getMinX(), node.getMinY()); + final Point2D projection = move(other.projection(newRefpp2, stringBounder), -node.getMinX(), + -node.getMinY()); + final Opale opale = new Opale(shadowing, borderColor, noteBackgroundColor, textBlock, true); opale.setRoundCorner(getRoundCorner()); opale.setOpale(strategy, pp1, projection); final UGraphic stroked = applyStroke(ug2); @@ -277,15 +296,15 @@ public class EntityImageNote extends AbstractEntityImage implements Stencil { } private Line opaleLine; - private Shape shape; - private Shape other; + private Node node; + private Node other; - public void setOpaleLine(Line line, Shape shape, Shape other) { + public void setOpaleLine(Line line, Node node, Node other) { if (other == null) { throw new IllegalArgumentException(); } this.opaleLine = line; - this.shape = shape; + this.node = node; this.other = other; } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageNoteLink.java b/src/net/sourceforge/plantuml/svek/image/EntityImageNoteLink.java index 4c09459..0d226dd 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageNoteLink.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageNoteLink.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -49,6 +49,8 @@ import net.sourceforge.plantuml.skin.Component; import net.sourceforge.plantuml.skin.ComponentType; import net.sourceforge.plantuml.skin.SimpleContext2D; import net.sourceforge.plantuml.skin.rose.Rose; +import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.style.StyleBuilder; import net.sourceforge.plantuml.svek.IEntityImage; import net.sourceforge.plantuml.svek.Margins; import net.sourceforge.plantuml.svek.ShapeType; @@ -58,9 +60,11 @@ public class EntityImageNoteLink extends AbstractTextBlock implements IEntityIma private final Component comp; - public EntityImageNoteLink(Display note, Colors colors, ISkinParam skinParam) { + public EntityImageNoteLink(Display note, Colors colors, ISkinParam skinParam, StyleBuilder styleBuilder) { final Rose skin = new Rose(); - comp = skin.createComponent(ComponentType.NOTE, null, colors.mute(skinParam), note); + comp = skin.createComponent( + new Style[] { ComponentType.NOTE.getDefaultStyleDefinition().getMergedStyle(styleBuilder) }, + ComponentType.NOTE, null, colors.mute(skinParam), note); } public Dimension2D calculateDimension(StringBounder stringBounder) { @@ -89,4 +93,8 @@ public class EntityImageNoteLink extends AbstractTextBlock implements IEntityIma return false; } + public double getOverscanX(StringBounder stringBounder) { + return 0; + } + } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageObject.java b/src/net/sourceforge/plantuml/svek/image/EntityImageObject.java index 9700f84..01736a1 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageObject.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageObject.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -38,12 +38,13 @@ package net.sourceforge.plantuml.svek.image; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.ColorParam; +import net.sourceforge.plantuml.CornerParam; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FontParam; +import net.sourceforge.plantuml.Guillemet; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.LineConfigurable; import net.sourceforge.plantuml.LineParam; -import net.sourceforge.plantuml.CornerParam; import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.creole.Stencil; @@ -92,11 +93,11 @@ public class EntityImageObject extends AbstractEntityImage implements Stencil { this.name = TextBlockUtils.withMargin( entity.getDisplay().create(new FontConfiguration(getSkinParam(), FontParam.OBJECT, stereotype), HorizontalAlignment.CENTER, skinParam), 2, 2); - if (stereotype == null || stereotype.getLabel(false) == null + if (stereotype == null || stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR) == null || portionShower.showPortion(EntityPortion.STEREOTYPE, entity) == false) { this.stereo = null; } else { - this.stereo = Display.create(stereotype.getLabels(skinParam.useGuillemet())).create( + this.stereo = Display.create(stereotype.getLabels(skinParam.guillemet())).create( new FontConfiguration(getSkinParam(), FontParam.OBJECT_STEREOTYPE, stereotype), HorizontalAlignment.CENTER, skinParam); } @@ -119,7 +120,10 @@ public class EntityImageObject extends AbstractEntityImage implements Stencil { public Dimension2D calculateDimension(StringBounder stringBounder) { final Dimension2D dimTitle = getTitleDimension(stringBounder); final Dimension2D dimFields = fields.calculateDimension(stringBounder); - final double width = Math.max(dimFields.getWidth(), dimTitle.getWidth() + 2 * xMarginCircle); + double width = Math.max(dimFields.getWidth(), dimTitle.getWidth() + 2 * xMarginCircle); + if (width < getSkinParam().minClassWidth()) { + width = getSkinParam().minClassWidth(); + } final double height = getMethodOrFieldHeight(dimFields) + dimTitle.getHeight(); return new Dimension2DDouble(width, height); @@ -137,10 +141,10 @@ public class EntityImageObject extends AbstractEntityImage implements Stencil { rect.setDeltaShadow(4); } - ug = ug.apply(new UChangeColor(SkinParamUtils.getColor(getSkinParam(), ColorParam.objectBorder, getStereo()))); + ug = ug.apply(new UChangeColor(SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.objectBorder))); HtmlColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); if (backcolor == null) { - backcolor = SkinParamUtils.getColor(getSkinParam(), ColorParam.objectBackground, getStereo()); + backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.objectBackground); } ug = ug.apply(new UChangeBackColor(backcolor)); if (url != null) { diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImagePseudoState.java b/src/net/sourceforge/plantuml/svek/image/EntityImagePseudoState.java index fa3bb2f..e48c933 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImagePseudoState.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImagePseudoState.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -82,8 +82,8 @@ public class EntityImagePseudoState extends AbstractEntityImage { } ug = ug.apply(new UStroke(1.5)); ug = ug.apply( - new UChangeBackColor(SkinParamUtils.getColor(getSkinParam(), ColorParam.stateBackground, getStereo()))) - .apply(new UChangeColor(SkinParamUtils.getColor(getSkinParam(), ColorParam.stateBorder, getStereo()))); + new UChangeBackColor(SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.stateBackground))) + .apply(new UChangeColor(SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.stateBorder))); ug.draw(circle); ug = ug.apply(new UStroke()); diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageState.java b/src/net/sourceforge/plantuml/svek/image/EntityImageState.java index 6a9a64b..310929a 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageState.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageState.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -102,7 +102,7 @@ public class EntityImageState extends AbstractEntityImage { this.url = entity.getUrl99(); this.fields = list.create(new FontConfiguration(getSkinParam(), FontParam.STATE_ATTRIBUTE, stereotype), - HorizontalAlignment.LEFT, skinParam); + HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL, skinParam.wrapWidth()); } @@ -134,12 +134,12 @@ public class EntityImageState extends AbstractEntityImage { HtmlColor classBorder = lineConfig.getColors(getSkinParam()).getColor(ColorType.LINE); if (classBorder == null) { - classBorder = SkinParamUtils.getColor(getSkinParam(), ColorParam.stateBorder, getStereo()); + classBorder = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.stateBorder); } ug = ug.apply(getStroke()).apply(new UChangeColor(classBorder)); HtmlColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); if (backcolor == null) { - backcolor = SkinParamUtils.getColor(getSkinParam(), ColorParam.stateBackground, getStereo()); + backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.stateBackground); } ug = ug.apply(new UChangeBackColor(backcolor)); diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageState2.java b/src/net/sourceforge/plantuml/svek/image/EntityImageState2.java index 3508e73..9d41ddc 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageState2.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageState2.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -81,13 +81,13 @@ public class EntityImageState2 extends AbstractEntityImage { HtmlColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); if (backcolor == null) { - backcolor = SkinParamUtils.getColor(getSkinParam(), symbol.getColorParamBack(), getStereo()); + backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), symbol.getColorParamBack()); } // backcolor = HtmlColorUtils.BLUE; - final HtmlColor forecolor = SkinParamUtils.getColor(getSkinParam(), symbol.getColorParamBorder(), getStereo()); + final HtmlColor forecolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), symbol.getColorParamBorder()); final SymbolContext ctx = new SymbolContext(backcolor, forecolor).withStroke(new UStroke(1.5)).withShadow( - getSkinParam().shadowing(getEntity().getStereotype())); + getSkinParam().shadowing(getEntity().getStereotype()) ? 3 : 0); this.url = entity.getUrl99(); TextBlock stereo = TextBlockUtils.empty(0, 0); @@ -95,7 +95,7 @@ public class EntityImageState2 extends AbstractEntityImage { final TextBlock desc = new BodyEnhanced(entity.getDisplay(), symbol.getFontParam(), skinParam, HorizontalAlignment.CENTER, stereotype, symbol.manageHorizontalLine(), false, entity); - asSmall = symbol.asSmall(null, desc, stereo, ctx); + asSmall = symbol.asSmall(null, desc, stereo, ctx, skinParam.getStereotypeAlignment()); } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageStateBorder.java b/src/net/sourceforge/plantuml/svek/image/EntityImageStateBorder.java index fca40b1..e9b8fd3 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageStateBorder.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageStateBorder.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -55,7 +55,7 @@ import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.Bibliotekon; import net.sourceforge.plantuml.svek.Cluster; -import net.sourceforge.plantuml.svek.Shape; +import net.sourceforge.plantuml.svek.Node; import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; @@ -89,8 +89,8 @@ public class EntityImageStateBorder extends AbstractEntityImage { private boolean upPosition() { final Point2D clusterCenter = stateParent.getClusterPosition().getPointCenter(); - final Shape sh = bibliotekon.getShape(getEntity()); - return sh.getMinY() < clusterCenter.getY(); + final Node node = bibliotekon.getNode(getEntity()); + return node.getMinY() < clusterCenter.getY(); } public Dimension2D calculateDimension(StringBounder stringBounder) { @@ -115,10 +115,10 @@ public class EntityImageStateBorder extends AbstractEntityImage { desc.drawU(ug.apply(new UTranslate(x, y))); ug = ug.apply(new UStroke(1.5)).apply( - new UChangeColor(SkinParamUtils.getColor(getSkinParam(), ColorParam.stateBorder, getStereo()))); + new UChangeColor(SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.stateBorder))); HtmlColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); if (backcolor == null) { - backcolor = SkinParamUtils.getColor(getSkinParam(), ColorParam.stateBackground, getStereo()); + backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.stateBackground); } ug = ug.apply(new UChangeBackColor(backcolor)); diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageStateEmptyDescription.java b/src/net/sourceforge/plantuml/svek/image/EntityImageStateEmptyDescription.java index c7b0bfe..639c46b 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageStateEmptyDescription.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageStateEmptyDescription.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -110,10 +110,10 @@ public class EntityImageStateEmptyDescription extends AbstractEntityImage { } ug = ug.apply(new UStroke(1.5)).apply( - new UChangeColor(SkinParamUtils.getColor(getSkinParam(), ColorParam.stateBorder, getStereo()))); + new UChangeColor(SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.stateBorder))); HtmlColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); if (backcolor == null) { - backcolor = SkinParamUtils.getColor(getSkinParam(), ColorParam.stateBackground, getStereo()); + backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.stateBackground); } ug = ug.apply(new UChangeBackColor(backcolor)); ug.draw(rect); diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageSynchroBar.java b/src/net/sourceforge/plantuml/svek/image/EntityImageSynchroBar.java index 0c3540e..bbca8ce 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageSynchroBar.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageSynchroBar.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -40,10 +40,16 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.cucadiagram.Rankdir; +import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.style.PName; +import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.ugraphic.Shadowable; @@ -58,6 +64,10 @@ public class EntityImageSynchroBar extends AbstractEntityImage { super(entity, skinParam); } + public StyleSignature getDefaultStyleDefinitionBar() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activityBar); + } + public Dimension2D calculateDimension(StringBounder stringBounder) { if (getSkinParam().getRankdir() == Rankdir.LEFT_TO_RIGHT) { return new Dimension2DDouble(8, 80); @@ -68,12 +78,18 @@ public class EntityImageSynchroBar extends AbstractEntityImage { final public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); final Shadowable rect = new URectangle(dim.getWidth(), dim.getHeight()); + double shadowing = 0; if (getSkinParam().shadowing(getEntity().getStereotype())) { - rect.setDeltaShadow(4); + shadowing = 4; + } + HtmlColor color = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.activityBar); + if (SkinParam.USE_STYLES()) { + final Style style = getDefaultStyleDefinitionBar().getMergedStyle(getSkinParam().getCurrentStyleBuilder()); + color = style.value(PName.LineColor).asColor(getSkinParam().getIHtmlColorSet()); + shadowing = style.value(PName.Shadowing).asDouble(); } - ug.apply(new UChangeColor(null)) - .apply(new UChangeBackColor(SkinParamUtils - .getColor(getSkinParam(), ColorParam.activityBar, getStereo()))).draw(rect); + rect.setDeltaShadow(shadowing); + ug.apply(new UChangeColor(null)).apply(new UChangeBackColor(color)).draw(rect); } public ShapeType getShapeType() { diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageTips.java b/src/net/sourceforge/plantuml/svek/image/EntityImageTips.java index c92ba4b..60d17a2 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageTips.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageTips.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -61,7 +61,7 @@ import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.Bibliotekon; -import net.sourceforge.plantuml.svek.Shape; +import net.sourceforge.plantuml.svek.Node; import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; @@ -92,7 +92,7 @@ public class EntityImageTips extends AbstractEntityImage { } private Position getPosition() { - if (getEntity().getCode().getFullName().endsWith(Position.RIGHT.name())) { + if (getEntity().getCodeGetName().endsWith(Position.RIGHT.name())) { return Position.RIGHT; } return Position.LEFT; @@ -120,17 +120,17 @@ public class EntityImageTips extends AbstractEntityImage { final IEntity other = bibliotekon.getOnlyOther(getEntity()); - final Shape shapeMe = bibliotekon.getShape(getEntity()); - final Shape shapeOther = bibliotekon.getShape(other); - final Point2D positionMe = shapeMe.getPosition(); - final Point2D positionOther = shapeOther.getPosition(); - bibliotekon.getShape(getEntity()); + final Node nodeMe = bibliotekon.getNode(getEntity()); + final Node nodeOther = bibliotekon.getNode(other); + final Point2D positionMe = nodeMe.getPosition(); + final Point2D positionOther = nodeOther.getPosition(); + bibliotekon.getNode(getEntity()); final Position position = getPosition(); Direction direction = position.reverseDirection(); double height = 0; for (Map.Entry<String, Display> ent : getEntity().getTips().entrySet()) { final Display display = ent.getValue(); - final Rectangle2D memberPosition = shapeOther.getImage().getInnerPosition(ent.getKey(), stringBounder, + final Rectangle2D memberPosition = nodeOther.getImage().getInnerPosition(ent.getKey(), stringBounder, InnerStrategy.STRICT); if (memberPosition == null) { return; @@ -163,7 +163,8 @@ public class EntityImageTips extends AbstractEntityImage { // final UFont fontNote = skinParam.getFont(FontParam.NOTE, null, false); final TextBlock textBlock = new BodyEnhanced2(display, FontParam.NOTE, skinParam, HorizontalAlignment.LEFT, new FontConfiguration(skinParam, FontParam.NOTE, null), LineBreakStrategy.NONE); - final Opale opale = new Opale(borderColor, noteBackgroundColor, textBlock, skinParam.shadowing(getEntity().getStereotype()), true); + final double shadowing = skinParam.shadowing(getEntity().getStereotype())?4:0; + final Opale opale = new Opale(shadowing, borderColor, noteBackgroundColor, textBlock, true); return opale; } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageUseCase.java b/src/net/sourceforge/plantuml/svek/image/EntityImageUseCase.java index fb4a6a7..f62b3dd 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageUseCase.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageUseCase.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -39,6 +39,7 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.FontParam; +import net.sourceforge.plantuml.Guillemet; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.LineParam; import net.sourceforge.plantuml.SkinParamUtils; @@ -83,13 +84,18 @@ public class EntityImageUseCase extends AbstractEntityImage { final TextBlock tmp = new BodyEnhanced(entity.getDisplay(), FontParam.USECASE, skinParam, HorizontalAlignment.CENTER, stereotype, true, false, entity); - if (stereotype == null || stereotype.getLabel(false) == null + if (stereotype == null || stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR) == null || portionShower.showPortion(EntityPortion.STEREOTYPE, entity) == false) { this.desc = tmp; } else { - final TextBlock stereo = Display.getWithNewlines(stereotype.getLabel(getSkinParam().useGuillemet())) - .create(new FontConfiguration(getSkinParam(), FontParam.USECASE_STEREOTYPE, stereotype), - HorizontalAlignment.CENTER, skinParam); + final TextBlock stereo; + if (stereotype.getSprite(getSkinParam()) != null) { + stereo = stereotype.getSprite(getSkinParam()); + } else { + stereo = Display.getWithNewlines(stereotype.getLabel(getSkinParam().guillemet())).create( + new FontConfiguration(getSkinParam(), FontParam.USECASE_STEREOTYPE, stereotype), + HorizontalAlignment.CENTER, skinParam); + } this.desc = TextBlockUtils.mergeTB(stereo, tmp, HorizontalAlignment.CENTER); } this.url = entity.getUrl99(); @@ -123,12 +129,12 @@ public class EntityImageUseCase extends AbstractEntityImage { ug = ug.apply(getStroke()); HtmlColor linecolor = getEntity().getColors(getSkinParam()).getColor(ColorType.LINE); if (linecolor == null) { - linecolor = SkinParamUtils.getColor(getSkinParam(), ColorParam.usecaseBorder, getStereo()); + linecolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.usecaseBorder); } ug = ug.apply(new UChangeColor(linecolor)); HtmlColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); if (backcolor == null) { - backcolor = SkinParamUtils.getColor(getSkinParam(), ColorParam.usecaseBackground, getStereo()); + backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.usecaseBackground); } ug = ug.apply(new UChangeBackColor(backcolor)); final UGraphic ug2 = new MyUGraphicEllipse(ug, 0, 0, ellipse.getUEllipse()); diff --git a/src/net/sourceforge/plantuml/svek/image/Footprint.java b/src/net/sourceforge/plantuml/svek/image/Footprint.java index eb7c95b..cb2156f 100644 --- a/src/net/sourceforge/plantuml/svek/image/Footprint.java +++ b/src/net/sourceforge/plantuml/svek/image/Footprint.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/image/Opale.java b/src/net/sourceforge/plantuml/svek/image/Opale.java index 56bca93..17ee601 100644 --- a/src/net/sourceforge/plantuml/svek/image/Opale.java +++ b/src/net/sourceforge/plantuml/svek/image/Opale.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -59,7 +59,7 @@ public class Opale extends AbstractTextBlock implements TextBlock { private final int marginX1 = 6; private final int marginX2 = 15; private final int marginY = 5; - private final boolean withShadow; + private final double shadowing2; private Direction strategy; private Point2D pp1; private Point2D pp2; @@ -68,12 +68,11 @@ public class Opale extends AbstractTextBlock implements TextBlock { private final TextBlock textBlock; - public Opale(HtmlColor borderColor, HtmlColor noteBackgroundColor, TextBlock textBlock, boolean withShadow, + public Opale(double shadowing, HtmlColor borderColor, HtmlColor noteBackgroundColor, TextBlock textBlock, boolean withLink) { this.noteBackgroundColor = noteBackgroundColor; this.withLink = withLink; - - this.withShadow = withShadow; + this.shadowing2 = shadowing; this.borderColor = borderColor; this.textBlock = textBlock; } @@ -120,9 +119,7 @@ public class Opale extends AbstractTextBlock implements TextBlock { } else { throw new IllegalArgumentException(); } - if (withShadow) { - polygon.setDeltaShadow(4); - } + polygon.setDeltaShadow(shadowing2); ug.draw(polygon); ug.draw(getCorner(getWidth(stringBounder), roundCorner)); textBlock.drawU(ug.apply(new UTranslate(marginX1, marginY))); diff --git a/src/net/sourceforge/plantuml/svek/image/SmallestEnclosingCircle.java b/src/net/sourceforge/plantuml/svek/image/SmallestEnclosingCircle.java index a131028..7b562c0 100644 --- a/src/net/sourceforge/plantuml/svek/image/SmallestEnclosingCircle.java +++ b/src/net/sourceforge/plantuml/svek/image/SmallestEnclosingCircle.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * diff --git a/src/net/sourceforge/plantuml/svek/image/YTransformer.java b/src/net/sourceforge/plantuml/svek/image/YTransformer.java index 9380bf6..4d6e4f9 100644 --- a/src/net/sourceforge/plantuml/svek/image/YTransformer.java +++ b/src/net/sourceforge/plantuml/svek/image/YTransformer.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * |