diff --git a/pom.xml b/pom.xml
index 140bba6b8..5017a2e2f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -35,7 +35,7 @@
net.sourceforge.plantuml
plantuml
- 1.2020.13-SNAPSHOT
+ 1.2020.14-SNAPSHOT
jar
PlantUML
diff --git a/src/net/sourceforge/plantuml/ComponentStyle.java b/src/net/sourceforge/plantuml/ComponentStyle.java
new file mode 100644
index 000000000..3ce5ca7a3
--- /dev/null
+++ b/src/net/sourceforge/plantuml/ComponentStyle.java
@@ -0,0 +1,56 @@
+/* ========================================================================
+ * 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;
+
+import net.sourceforge.plantuml.graphic.USymbol;
+
+public enum ComponentStyle {
+
+ UML1, UML2, RECTANGLE;
+
+ public USymbol toSymbol() {
+ switch (this) {
+ case UML1:
+ return USymbol.COMPONENT1;
+ case UML2:
+ return USymbol.COMPONENT2;
+ case RECTANGLE:
+ return USymbol.RECTANGLE;
+ }
+ throw new AssertionError();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/ISkinParam.java b/src/net/sourceforge/plantuml/ISkinParam.java
index 2f1e2aff0..d7f451fe8 100644
--- a/src/net/sourceforge/plantuml/ISkinParam.java
+++ b/src/net/sourceforge/plantuml/ISkinParam.java
@@ -98,7 +98,7 @@ public interface ISkinParam extends ISkinSimple {
public PackageStyle getPackageStyle();
- public boolean useUml2ForComponent();
+ public ComponentStyle componentStyle();
public boolean stereotypePositionTop();
diff --git a/src/net/sourceforge/plantuml/SkinParam.java b/src/net/sourceforge/plantuml/SkinParam.java
index 536e1cbf0..a758a5a13 100644
--- a/src/net/sourceforge/plantuml/SkinParam.java
+++ b/src/net/sourceforge/plantuml/SkinParam.java
@@ -807,12 +807,16 @@ public class SkinParam implements ISkinParam {
return result;
}
- public boolean useUml2ForComponent() {
+ public ComponentStyle componentStyle() {
if (strictUmlStyle()) {
- return true;
+ return ComponentStyle.UML2;
}
final String value = getValue("componentstyle");
- return "uml2".equalsIgnoreCase(value);
+ if ("uml2".equalsIgnoreCase(value))
+ return ComponentStyle.UML2;
+ if ("rectangle".equalsIgnoreCase(value))
+ return ComponentStyle.RECTANGLE;
+ return ComponentStyle.UML1;
}
public boolean stereotypePositionTop() {
diff --git a/src/net/sourceforge/plantuml/SkinParamDelegator.java b/src/net/sourceforge/plantuml/SkinParamDelegator.java
index c93a070fd..1778bace1 100644
--- a/src/net/sourceforge/plantuml/SkinParamDelegator.java
+++ b/src/net/sourceforge/plantuml/SkinParamDelegator.java
@@ -132,8 +132,8 @@ public class SkinParamDelegator implements ISkinParam {
return skinParam.getSprite(name);
}
- public boolean useUml2ForComponent() {
- return skinParam.useUml2ForComponent();
+ public ComponentStyle componentStyle() {
+ return skinParam.componentStyle();
}
public boolean stereotypePositionTop() {
diff --git a/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java b/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java
index 6270f9575..5fcaba017 100644
--- a/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java
+++ b/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java
@@ -144,6 +144,7 @@ public class ClassDiagram extends AbstractClassOrObjectDiagram {
final Code namespace = buildCode(namespaceString);
final Display tmp = Display.getWithNewlines(namespaceString);
final Ident newIdLong = buildLeafIdentSpecial(namespaceString);
+ // final Ident newIdLong = buildLeafIdentSpecial2(namespaceString);
gotoGroupExternal(newIdLong, namespace, tmp, namespace, GroupType.PACKAGE, getRootGroup());
}
final Display tmpDisplay;
@@ -212,8 +213,8 @@ public class ClassDiagram extends AbstractClassOrObjectDiagram {
margin1 = 0;
margin2 = 10;
}
- final ImageBuilder imageBuilder = ImageBuilder.buildD(getSkinParam(), ClockwiseTopRightBottomLeft.margin1margin2((double) margin1, (double) margin2), null, null,
- null, (double) 1);
+ final ImageBuilder imageBuilder = ImageBuilder.buildD(getSkinParam(),
+ ClockwiseTopRightBottomLeft.margin1margin2(margin1, margin2), null, null, null, 1);
imageBuilder.setUDrawable(fullLayout);
return imageBuilder.writeImageTOBEMOVED(fileFormatOption, seed(), os);
}
diff --git a/src/net/sourceforge/plantuml/creole/atom/AtomImg.java b/src/net/sourceforge/plantuml/creole/atom/AtomImg.java
index df69da417..2192bb2b8 100644
--- a/src/net/sourceforge/plantuml/creole/atom/AtomImg.java
+++ b/src/net/sourceforge/plantuml/creole/atom/AtomImg.java
@@ -39,10 +39,7 @@ import java.awt.Color;
import java.awt.geom.Dimension2D;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import java.io.InputStream;
-import java.net.URLConnection;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.FileSystem;
@@ -88,8 +85,9 @@ public class AtomImg extends AbstractAtom implements Atom {
if (im == null) {
im = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB);
}
- return new AtomImg(new UImage(new PixelImage(im, AffineTransformType.TYPE_NEAREST_NEIGHBOR))
- .scale(scale).getImage(1), 1, null, null);
+ return new AtomImg(
+ new UImage(new PixelImage(im, AffineTransformType.TYPE_NEAREST_NEIGHBOR)).scale(scale).getImage(1), 1,
+ null, null);
}
public static Atom create(String src, ImgValign valign, int vspace, double scale, Url url) {
@@ -171,42 +169,13 @@ public class AtomImg extends AbstractAtom implements Atom {
if (source == null) {
return AtomText.create("(Cannot decode SVG: " + text + ")", fc);
}
- final byte[] read = getFile(source);
+ final byte[] read = source.getBytes();
if (read == null) {
return AtomText.create("(Cannot decode SVG: " + text + ")", fc);
}
return new AtomImgSvg(new TileImageSvg(new String(read, "UTF-8")));
}
- // Added by Alain Corbiere
- private static byte[] getFile(SURL url) {
- try {
- InputStream input = null;
- try {
- final URLConnection connection = url.openConnection();
- if (connection == null) {
- return null;
- }
- input = connection.getInputStream();
- final ByteArrayOutputStream image = new ByteArrayOutputStream();
- final byte[] buffer = new byte[1024];
- int read;
- while ((read = input.read(buffer)) > 0) {
- image.write(buffer, 0, read);
- }
- image.close();
- return image.toByteArray();
- } finally {
- if (input != null) {
- input.close();
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- return null;
- }
- }
-
// End
public Dimension2D calculateDimension(StringBounder stringBounder) {
@@ -221,8 +190,8 @@ public class AtomImg extends AbstractAtom implements Atom {
if (url != null) {
ug.startUrl(url);
}
- ug.draw(new UImage(new PixelImage(image, AffineTransformType.TYPE_BILINEAR))
- .withRawFileName(rawFileName).scale(scale));
+ ug.draw(new UImage(new PixelImage(image, AffineTransformType.TYPE_BILINEAR)).withRawFileName(rawFileName)
+ .scale(scale));
if (url != null) {
ug.closeUrl();
}
diff --git a/src/net/sourceforge/plantuml/cucadiagram/CucaDiagram.java b/src/net/sourceforge/plantuml/cucadiagram/CucaDiagram.java
index 9dc1cbd64..993401409 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/CucaDiagram.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/CucaDiagram.java
@@ -220,12 +220,15 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
final public Ident buildLeafIdentSpecial(String id) {
return buildFullyQualified(id);
- // if (namespaceSeparator != null) {
- // if (id.contains(namespaceSeparator)) {
- // return Ident.empty().add(id, namespaceSeparator);
- // }
- // }
- // return getLastID().add(id, namespaceSeparator);
+ }
+
+ private Ident buildLeafIdentSpecialUnused(String id) {
+// if (namespaceSeparator != null) {
+// if (id.contains(namespaceSeparator)) {
+ return Ident.empty().add(id, ".");
+// }
+// }
+// return getLastID().add(id, namespaceSeparator);
}
final public Ident buildFullyQualified(String id) {
diff --git a/src/net/sourceforge/plantuml/cucadiagram/GroupRoot.java b/src/net/sourceforge/plantuml/cucadiagram/GroupRoot.java
index 4ed8b28c8..0e85ce7ff 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/GroupRoot.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/GroupRoot.java
@@ -75,6 +75,11 @@ public class GroupRoot implements IGroup {
return Collections.unmodifiableCollection(result);
}
+
+ @Override
+ public String toString() {
+ return "ROOT";
+ }
public boolean isGroup() {
return true;
diff --git a/src/net/sourceforge/plantuml/cucadiagram/entity/EntityFactory.java b/src/net/sourceforge/plantuml/cucadiagram/entity/EntityFactory.java
index 48359fff3..d2a8744ff 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/entity/EntityFactory.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/entity/EntityFactory.java
@@ -237,6 +237,11 @@ public final class EntityFactory {
if (groupType == null) {
throw new IllegalArgumentException();
}
+ for (Entry ent : groups2.entrySet()) {
+ if (ent.getKey().equals(ident)) {
+ return ent.getValue();
+ }
+ }
final Bodier bodier = new BodierImpl(null, hides);
final EntityImpl result = new EntityImpl(ident, code, this, bodier, parentContainer, groupType, namespace,
namespaceSeparator, rawLayout);
diff --git a/src/net/sourceforge/plantuml/cucadiagram/entity/EntityImpl.java b/src/net/sourceforge/plantuml/cucadiagram/entity/EntityImpl.java
index f65174869..4a0ef172b 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/entity/EntityImpl.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/entity/EntityImpl.java
@@ -268,7 +268,7 @@ final public class EntityImpl implements ILeaf, IGroup {
// + getUid();
if (entityFactory.namespaceSeparator.V1972())
return getUid() + " " + ident + " " + display + "(" + leafType + ")[" + groupType + "]";
- return super.toString() + code + ident + " " + display + "(" + leafType + ")[" + groupType + "] " + getUid();
+ return "EntityImpl " + code + ident + " " + display + "(" + leafType + ")[" + groupType + "] " + getUid();
}
public final Url getUrl99() {
@@ -802,7 +802,7 @@ final public class EntityImpl implements ILeaf, IGroup {
public IGroup getOriginalGroup() {
return originalGroup;
}
-
+
private boolean together;
public void setThisIsTogether() {
diff --git a/src/net/sourceforge/plantuml/descdiagram/DescriptionDiagram.java b/src/net/sourceforge/plantuml/descdiagram/DescriptionDiagram.java
index e7ef99f5e..398575523 100644
--- a/src/net/sourceforge/plantuml/descdiagram/DescriptionDiagram.java
+++ b/src/net/sourceforge/plantuml/descdiagram/DescriptionDiagram.java
@@ -35,6 +35,7 @@
*/
package net.sourceforge.plantuml.descdiagram;
+import net.sourceforge.plantuml.ComponentStyle;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.UmlDiagramType;
@@ -74,14 +75,14 @@ public class DescriptionDiagram extends AbstractEntityDiagram {
if (type == null) {
String codeString = code.getName();
if (codeString.startsWith("[") && codeString.endsWith("]")) {
- final USymbol sym = getSkinParam().useUml2ForComponent() ? USymbol.COMPONENT2 : USymbol.COMPONENT1;
+ final USymbol sym = getSkinParam().componentStyle().toSymbol() ;
final Ident idNewLong = ident.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:");
return getOrCreateLeafDefault(idNewLong, idNewLong.toCode(this), LeafType.DESCRIPTION, sym);
}
if (codeString.startsWith(":") && codeString.endsWith(":")) {
final Ident idNewLong = ident.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:");
- return getOrCreateLeafDefault(idNewLong, idNewLong.toCode(this), LeafType.DESCRIPTION, getSkinParam()
- .getActorStyle().getUSymbol());
+ return getOrCreateLeafDefault(idNewLong, idNewLong.toCode(this), LeafType.DESCRIPTION,
+ getSkinParam().getActorStyle().getUSymbol());
}
if (codeString.startsWith("()")) {
codeString = StringUtils.trin(codeString.substring(2));
diff --git a/src/net/sourceforge/plantuml/descdiagram/command/CommandLinkElement.java b/src/net/sourceforge/plantuml/descdiagram/command/CommandLinkElement.java
index da955f567..cf59415c9 100644
--- a/src/net/sourceforge/plantuml/descdiagram/command/CommandLinkElement.java
+++ b/src/net/sourceforge/plantuml/descdiagram/command/CommandLinkElement.java
@@ -291,7 +291,7 @@ public class CommandLinkElement extends SingleLineCommand2 {
return getOrCreateLeaf1972(diagram, ident3, code3, LeafType.DESCRIPTION,
diagram.getSkinParam().getActorStyle().getUSymbol(), pure);
} else if (codeChar == '[') {
- final USymbol sym = diagram.getSkinParam().useUml2ForComponent() ? USymbol.COMPONENT2 : USymbol.COMPONENT1;
+ final USymbol sym = diagram.getSkinParam().componentStyle().toSymbol();
return getOrCreateLeaf1972(diagram, ident3, code3, LeafType.DESCRIPTION, sym, pure);
}
diff --git a/src/net/sourceforge/plantuml/donors/PSystemDonors.java b/src/net/sourceforge/plantuml/donors/PSystemDonors.java
index c82ffe7c4..796ff4d24 100644
--- a/src/net/sourceforge/plantuml/donors/PSystemDonors.java
+++ b/src/net/sourceforge/plantuml/donors/PSystemDonors.java
@@ -74,26 +74,26 @@ public class PSystemDonors extends AbstractPSystem {
private static final int COLS = 6;
private static final int FREE_LINES = 6;
- public static final String DONORS = "6vaB02mFUBXRGOc9nbfsvvsjZ9-86KqYM9ud58U1HJpT3OW_mBtJutuZ_KLqfNlVD2FQiZN5USOGiI3e"
- + "yJIvPjZctXu8Sw9y2FxT21uW0qH9r4QrBFUas6sRAaDAyEyxN_abw1tUiK6YkKgZnP5xPFSBxs-6ytpJ"
- + "-EYbPy0IgdwAxcl_Tqqhw_AcAWpfifenC-hqX2hcrgWHaIB-_rJhRgSsJgOw3IG1dSgvWflgLC2h4nu3"
- + "YpI3MyPvDMaoAYQ-YPHWQvGGD3epjEMazZco8OF4B_K3jDbSOQd8cL0SeoJHzVNSlcq3pI-NU15y8HPi"
- + "7fX3AOThWHBdHeo4JmGDBRFeZQqwikI97OPIQ64V_j18ZdYaCdCwMYJy7e62eATnGD8BjMd2sT75W2eZ"
- + "sQBFabHT6G_XpkkmFCLge-5EiF2pu2oWXY3_Woxuz5ZrqUGSLqCjgQT9tggjH_rAl9Us6T4t_MYIA9_j"
- + "JREYk0kKBLAThJx7UCqZ87TBhRpYowWZcoEuzzsx6jO_MY0_0jrM4vNapx8lB2GXhgtiWtIT6wyyUX6E"
- + "sP1fOXs_YosliHUwmfMDoR82BFHf-xhIX0osq9NBmz0JMfLfrlb4IrfQlr_qwB9ndt1DfTczW_G-okOY"
- + "_x_RlSmCnG4wLc8MT9sWQ5nDgzvY0n6S5hemv2OWLw2ykMx5pUiYl-e3WhUG4OZ2XgGTulMHSjT5YEbO"
- + "rKqfHW3pfvHpaGXO4A5Mkw1RKIKJAUlT7gUhP_goCNUVzC5rky4OnJ6Tr5Y4xzu5zp2iL8rcjbaxXJa5"
- + "B-Drd5VTQwHVnRAzXVUK3wdvHmRYJE-CY9GVqTYsye_2tJeAivXBRjRbkxeV73nqvu8pMBIC6MssGvQ0"
- + "mjbadAbV6NvQClmTWMp2xurDNa7eJbWFOMOqWjjRasjgSec4ptIMusONW6ArUCMkY719eMgMcSeMDiNa"
- + "6Qj78KD-ntm2I-LQUDgmrjoLUKRrAAZ3UNUiMjQlGytR0ghBOOACj51gf9eYVIsGWMjrUfPQ1zkV5bZG"
- + "j_6eYbM7ujicsgxSe68AJ1SHVj4W4cb1hKGlEKaCy3z_VgKUxUlWupkZV38EaZqaCL05hKu_SMeQF8zX"
- + "PQpNwFlrrdQluC-_rz4cf_PuvgS8ekSW6lys2k0e9p62fu6_BXybxoHODJgrKPGhroYz4KXOi1FlpA8U"
- + "6MRKxyHakHcvw1NRXwhyxUGAN2o6sB3Y8fEc6B7afBVTUb15RD_vnk8WXuQ_YoeJChdAPJKmGY6sGYzE"
- + "Ukmsod2NLGlme3ek4vZxrM-dMTuqvhnZgMvu3CWtH-HKqIEqiAQcjMCXi56C-Rsb_LIcntyoebz4QtRi"
- + "rKFlGVaziWiqV5k3z3D6Wk4YPST0kxdFoGZSVCCXRqpDYKmNYwrSTCMmymOhx3Vs4bb8U65Rgrp2N7ju"
- + "pUcNTtbMsv6ZRI7xM3MQNYYgY178XSKwNPrOAELu84LIC6TlcIWYxQ0tkAHd04vHSBo_sn2E5PeVqQnz"
- + "FADHp6MTUt4FOYgSt4zxKhQRdfK7";
+ public static final String DONORS = "6ySB02mFUBXRGOc9nbfsvvsjZ8zbDKqYM9ud58U1HJpT3OW_mBtJutuZ_KLqfNlVD2FQiZN5USOGiI3e"
+ + "yJIvPjZctXvupCdFe-IxmsY4GPYio__BbYQxT2r0gWmfmRDSR_uPnVYUEsbeodQv4793qY-yxupDizFu"
+ + "ujMZ2Te8_1ZOL_zlwf1nUQWAmz1iXJ4O5OrGdJ_q56ijjVR_KOqBfs3VeOeUIuxfrCLrE5JHYCwA5uhL"
+ + "E0UtZFFHfCMecD0cKefgeuGYEPYXhIRLvyWL6TpyKZz0cwxjcX8v4efzbaXqV-rftt60ziibFtJoGopO"
+ + "8h20Ye_i9oXvRSIuoHT1GyjSzCPM7Ldo90E6KkZ2tloXB8wufsJcChIuAN062ehSne78I6hJ0hC3Ym5L"
+ + "Ug95doOfkZ5kmftFOLcArKR3iy2YW2Nd06ioyZ_e4pxTTtraSioRefQKfqdUozQZSTMzbsipec_wqIHH"
+ + "lhPtoTBZIb4rJ-bizUdpjRf3xfgowl4leqOyUt2tqq8Q5XyfY1-6RXiJbUJFj8M558HhA_qWNUR6AsSl"
+ + "mZ4RifIjus-nPJNsyYvViJ6nB7SMUFTytMXAXbhAAkGqTBjMPIxjVAAbD3N-B_BeqVc_m9fAita7wJrB"
+ + "vpB_lnjMQiOI3Zesn2pNpGB5ucbIzIusBaBJJAU6t0J83QZk9hVYRdKHVzG7vDvICX65pRO4YVPKSfUB"
+ + "4APZfPjAZ02MJ2dd-XjR4FcgrS7eLaI9HSeYz35CUgRjgx1D-k1ckxanYQCwfNmIVbi8tCEmKYsQsQ5j"
+ + "6tCnNiR7SLvrh_v-bRJjBRodV4ZDAnZ8AoqOOIaveZoEie-4kmOAihXBNXhYUuHr3XwwSy4PB5h6Z3RR"
+ + "8Gj3SZmPP-bN31-Q37lxNJPihurDNi3xghCJmiZ8WzTBacjgSOcRV3DOJWxR08gDnIjs-PcB25LRRYgR"
+ + "wnAcHgmUXGhu7VC9p9LjuSfZlTsru0nO5DN1l3lMM1gtAStR0ghBgOAOTA6CcT8KQNix6NfMfsUf3R3z"
+ + "gUuBpZOVLTWqABsjeks63QPFeUaKwHSD8X4IhGgvrAGmm7Tz_4eywEiGupkzR24EaHQI5A02oZaVE9K6"
+ + "ppsrbFKQ_N-jjTFA-VFlTMI3KtlSyvD2w1a8ujz3WHpX539v6lXwymVW7G6hOfPs2h1oZTppG5A3dNXd"
+ + "5dN_CADp9nRApQX5hzW-LELltww0nNA83IikOccAwLkSidPg19LVzvrlB0voMFYxg38Xawkdh3P6mcVG"
+ + "YnCT-vgbk7FD116CZai5xdxrMJFDkumvNx6iRZWuyiqH6L9q3osg9MbjFZsmKPpvlPLjIARxNp8Ydrzg"
+ + "rlVgeRTJ_Xnf0is_jTJx6LbWcCWuCB2-tEV40pVU2AWBKpl-wMB1bOkk67PvmHRs6_iHMPxmmhPMcGXp"
+ + "dswLeoyByQnsUewr9UzZez7qGQ9IU23R5-lqsOd5iWoFP84KhjbR9ej8w_I6Ixg3S8Z2-VxU1dEilFaH"
+ + "cTNcqnk5NDhSYtiG-N1ycgIcNJOxSfCRwuxSRIC1-ge0";
/*
* Special thanks to our sponsors and donors:
diff --git a/src/net/sourceforge/plantuml/graphic/QuoteUtils.java b/src/net/sourceforge/plantuml/graphic/QuoteUtils.java
index cb541c2cb..73822ce5f 100644
--- a/src/net/sourceforge/plantuml/graphic/QuoteUtils.java
+++ b/src/net/sourceforge/plantuml/graphic/QuoteUtils.java
@@ -269,9 +269,10 @@ public class QuoteUtils {
"Jurarire V srry gur arrq gb rkrepvfr, V yvr qbja hagvy vg tbrf njnl", "Ernyvgl pbagvahrf gb ehva zl yvsr",
"Vs lbh gvpxyr hf, qb jr abg ynhtu?", "V xabj n HQC wbxr, ohg lbh zvtug abg trg vg",
"Chvfdhr prf zlfgrerf abhf qrcnffrag, srvtabaf q'ra rger y'betnavfngrhe.",
- "V qba'g gnxr nal erfcbafvovyvgl ng nyy",
+ "V qba'g gnxr erfcbafvovyvgl ng nyy",
"Gurer'f n jbeq sbe crbcyr jub guvax rirelbar vf pbafcvevat ntnvafg gurz: creprcgvir",
- "V'yy yrg gung cnff orpnhfr guvf vf tbbqolr");
+ "V'yy yrg gung cnff orpnhfr guvf vf tbbqolr", "V ybir vg jura n cyna pbzrf gbtrgure",
+ "Znxr hf nyy fnsr. Tb onpx gb lbhe ohaxre");
private QuoteUtils() {
}
diff --git a/src/net/sourceforge/plantuml/graphic/USymbol.java b/src/net/sourceforge/plantuml/graphic/USymbol.java
index d24f89812..c9930c39e 100644
--- a/src/net/sourceforge/plantuml/graphic/USymbol.java
+++ b/src/net/sourceforge/plantuml/graphic/USymbol.java
@@ -58,24 +58,24 @@ public abstract class USymbol {
public final static USymbol FRAME = record("FRAME", SkinParameter.FRAME, new USymbolFrame());
public final static USymbol NODE = record("NODE", SkinParameter.NODE, new USymbolNode());
public final static USymbol ARTIFACT = record("ARTIFACT", SkinParameter.ARTIFACT, new USymbolArtifact());
- public final static USymbol PACKAGE = record("PACKAGE", SkinParameter.PACKAGE, new USymbolFolder(
- SkinParameter.PACKAGE, true));
- public final static USymbol FOLDER = record("FOLDER", SkinParameter.FOLDER, new USymbolFolder(SkinParameter.FOLDER,
- false));
+ public final static USymbol PACKAGE = record("PACKAGE", SkinParameter.PACKAGE,
+ new USymbolFolder(SkinParameter.PACKAGE, true));
+ public final static USymbol FOLDER = record("FOLDER", SkinParameter.FOLDER,
+ new USymbolFolder(SkinParameter.FOLDER, false));
public final static USymbol FILE = record("FILE", SkinParameter.FILE, new USymbolFile());
- public final static USymbol RECTANGLE = record("RECTANGLE", SkinParameter.RECTANGLE, new USymbolRect(
- SkinParameter.RECTANGLE));
- public final static USymbol LABEL = record("LABEL", SkinParameter.RECTANGLE, new USymbolLabel(
- SkinParameter.RECTANGLE));
- public final static USymbol ARCHIMATE = record("ARCHIMATE", SkinParameter.ARCHIMATE, new USymbolRect(
- SkinParameter.ARCHIMATE));
- public final static USymbol COLLECTIONS = record("COLLECTIONS", SkinParameter.COLLECTIONS, new USymbolCollections(
- SkinParameter.RECTANGLE));
+ public final static USymbol RECTANGLE = record("RECTANGLE", SkinParameter.RECTANGLE,
+ new USymbolRect(SkinParameter.RECTANGLE));
+ public final static USymbol LABEL = record("LABEL", SkinParameter.RECTANGLE,
+ new USymbolLabel(SkinParameter.RECTANGLE));
+ public final static USymbol ARCHIMATE = record("ARCHIMATE", SkinParameter.ARCHIMATE,
+ new USymbolRect(SkinParameter.ARCHIMATE));
+ public final static USymbol COLLECTIONS = record("COLLECTIONS", SkinParameter.COLLECTIONS,
+ new USymbolCollections(SkinParameter.RECTANGLE));
public final static USymbol AGENT = record("AGENT", SkinParameter.AGENT, new USymbolRect(SkinParameter.AGENT));
- public final static USymbol ACTOR_STICKMAN = record("ACTOR_STICKMAN", SkinParameter.ACTOR, new USymbolActor(
- ActorStyle.STICKMAN));
- public final static USymbol ACTOR_AWESOME = record("ACTOR_AWESOME", SkinParameter.ACTOR, new USymbolActor(
- ActorStyle.AWESOME));
+ public final static USymbol ACTOR_STICKMAN = record("ACTOR_STICKMAN", SkinParameter.ACTOR,
+ new USymbolActor(ActorStyle.STICKMAN));
+ public final static USymbol ACTOR_AWESOME = record("ACTOR_AWESOME", SkinParameter.ACTOR,
+ new USymbolActor(ActorStyle.AWESOME));
public final static USymbol USECASE = null;
public final static USymbol COMPONENT1 = record("COMPONENT1", SkinParameter.COMPONENT1, new USymbolComponent1());
public final static USymbol COMPONENT2 = record("COMPONENT2", SkinParameter.COMPONENT2, new USymbolComponent2());
@@ -235,7 +235,7 @@ public abstract class USymbol {
} else if (symbol.equalsIgnoreCase("actor")) {
usymbol = skinParam.getActorStyle().getUSymbol();
} else if (symbol.equalsIgnoreCase("component")) {
- usymbol = skinParam.useUml2ForComponent() ? USymbol.COMPONENT2 : USymbol.COMPONENT1;
+ usymbol = skinParam.componentStyle().toSymbol();
} else if (symbol.equalsIgnoreCase("boundary")) {
usymbol = USymbol.BOUNDARY;
} else if (symbol.equalsIgnoreCase("control")) {
diff --git a/src/net/sourceforge/plantuml/math/LatexBuilder.java b/src/net/sourceforge/plantuml/math/LatexBuilder.java
index 05f5652d2..18f27b1c1 100644
--- a/src/net/sourceforge/plantuml/math/LatexBuilder.java
+++ b/src/net/sourceforge/plantuml/math/LatexBuilder.java
@@ -119,11 +119,11 @@ public class LatexBuilder implements ScientificEquation {
}
public MutableImage muteColor(Color newColor) {
- throw new UnsupportedOperationException();
+ return this;
}
public MutableImage muteTransparentColor(Color newColor) {
- throw new UnsupportedOperationException();
+ return this;
}
}
diff --git a/src/net/sourceforge/plantuml/project/lang/ComplementBeforeOrAfterOrAtTaskStartOrEnd.java b/src/net/sourceforge/plantuml/project/lang/ComplementBeforeOrAfterOrAtTaskStartOrEnd.java
index 4fb0bacaf..f08595b83 100644
--- a/src/net/sourceforge/plantuml/project/lang/ComplementBeforeOrAfterOrAtTaskStartOrEnd.java
+++ b/src/net/sourceforge/plantuml/project/lang/ComplementBeforeOrAfterOrAtTaskStartOrEnd.java
@@ -46,27 +46,50 @@ import net.sourceforge.plantuml.project.core.TaskInstant;
public class ComplementBeforeOrAfterOrAtTaskStartOrEnd implements ComplementPattern {
- public IRegex toRegex(String suffix) {
- return new RegexLeaf("COMPLEMENT" + suffix,
- "(?:at|with|after|(\\d+)[%s]+days?[%s]+(before|after))[%s]+\\[([^\\[\\]]+?)\\].?s[%s]+(start|end)");
+ private static final int POS_NB1 = 0;
+ private static final int POS_DAY_OR_WEEK1 = 1;
+ private static final int POS_NB2 = 2;
+ private static final int POS_DAY_OR_WEEK2 = 3;
+ private static final int POS_BEFORE_OR_AFTER = 4;
+ private static final int POS_CODE_OTHER = 5;
+ private static final int POS_START_OR_END = 6;
+
+ public IRegex toRegex(String suffix) { // "+"
+ return new RegexLeaf("COMPLEMENT" + suffix, "(?:at|with|after|" + //
+ "(\\d+)[%s]+(day|week)s?" + //
+ "(?:[%s]+and[%s]+(\\d+)[%s]+(day|week)s?)?" + //
+ "[%s]+(before|after))[%s]+\\[([^\\[\\]]+?)\\].?s[%s]+(start|end)");
}
public Failable getComplement(GanttDiagram system, RegexResult arg, String suffix) {
- final String code = arg.get("COMPLEMENT" + suffix, 2);
- final String position = arg.get("COMPLEMENT" + suffix, 3);
+ final String code = arg.get("COMPLEMENT" + suffix, POS_CODE_OTHER);
+ final String startOrEnd = arg.get("COMPLEMENT" + suffix, POS_START_OR_END);
final Moment task = system.getExistingMoment(code);
if (task == null) {
- return Failable. error("No such task " + code);
+ return Failable.error("No such task " + code);
}
- final String days = arg.get("COMPLEMENT" + suffix, 0);
- TaskInstant result = new TaskInstant(task, TaskAttribute.fromString(position));
- if (days != null) {
- int delta = Integer.parseInt(days);
- if ("before".equalsIgnoreCase(arg.get("COMPLEMENT" + suffix, 1))) {
+ TaskInstant result = new TaskInstant(task, TaskAttribute.fromString(startOrEnd));
+ final String nb1 = arg.get("COMPLEMENT" + suffix, POS_NB1);
+ if (nb1 != null) {
+ final int factor1 = arg.get("COMPLEMENT" + suffix, POS_DAY_OR_WEEK1).startsWith("w") ? system.daysInWeek()
+ : 1;
+ final int days1 = Integer.parseInt(nb1) * factor1;
+
+ final String nb2 = arg.get("COMPLEMENT" + suffix, POS_NB2);
+ int days2 = 0;
+ if (nb2 != null) {
+ final int factor2 = arg.get("COMPLEMENT" + suffix, POS_DAY_OR_WEEK2).startsWith("w")
+ ? system.daysInWeek()
+ : 1;
+ days2 = Integer.parseInt(nb2) * factor2;
+ }
+
+ int delta = days1 + days2;
+ if ("before".equalsIgnoreCase(arg.get("COMPLEMENT" + suffix, POS_BEFORE_OR_AFTER))) {
delta = -delta;
}
result = result.withDelta(delta);
}
- return Failable. ok(result);
+ return Failable.ok(result);
}
}
diff --git a/src/net/sourceforge/plantuml/project/lang/ComplementSeveralDays.java b/src/net/sourceforge/plantuml/project/lang/ComplementSeveralDays.java
index 41a35d4bb..3adeb6f10 100644
--- a/src/net/sourceforge/plantuml/project/lang/ComplementSeveralDays.java
+++ b/src/net/sourceforge/plantuml/project/lang/ComplementSeveralDays.java
@@ -47,15 +47,24 @@ public class ComplementSeveralDays implements ComplementPattern {
public IRegex toRegex(String suffix) {
return new RegexConcat( //
- new RegexLeaf("COMPLEMENT" + suffix, "(\\d+)[%s]+(days?|weeks?)")); //
+ new RegexLeaf("COMPLEMENT" + suffix, "(\\d+)[%s]+(day|week)s?" + //
+ "(?:[%s]+and[%s]+(\\d+)[%s]+(day|week)s?)?" //
+ )); //
}
public Failable getComplement(GanttDiagram system, RegexResult arg, String suffix) {
- final String number = arg.get("COMPLEMENT" + suffix, 0);
- final boolean inWeeks = arg.get("COMPLEMENT" + suffix, 1).startsWith("w");
- final int factor = inWeeks ? system.daysInWeek() : 1;
- final int days = Integer.parseInt(number) * factor;
- return Failable. ok(Load.inWinks(days));
+ final String nb1 = arg.get("COMPLEMENT" + suffix, 0);
+ final int factor1 = arg.get("COMPLEMENT" + suffix, 1).startsWith("w") ? system.daysInWeek() : 1;
+ final int days1 = Integer.parseInt(nb1) * factor1;
+
+ final String nb2 = arg.get("COMPLEMENT" + suffix, 2);
+ int days2 = 0;
+ if (nb2 != null) {
+ final int factor2 = arg.get("COMPLEMENT" + suffix, 3).startsWith("w") ? system.daysInWeek() : 1;
+ days2 = Integer.parseInt(nb2) * factor2;
+ }
+
+ return Failable.ok(Load.inWinks(days1 + days2));
}
}
diff --git a/src/net/sourceforge/plantuml/security/SFile.java b/src/net/sourceforge/plantuml/security/SFile.java
index 9f94ff61a..99247ab48 100644
--- a/src/net/sourceforge/plantuml/security/SFile.java
+++ b/src/net/sourceforge/plantuml/security/SFile.java
@@ -245,17 +245,17 @@ public class SFile implements Comparable {
// In SANDBOX, we cannot read any files
return false;
}
- // Files in "plantuml.include.path" and "plantuml.whitelist.path" are ok.
- if (isIn(SecurityUtils.getPath("plantuml.include.path"))) {
+ // Files in "plantuml.include.path" and "plantuml.allowlist.path" are ok.
+ if (isInAllowList(SecurityUtils.getPath("plantuml.include.path"))) {
return true;
}
- if (isIn(SecurityUtils.getPath("plantuml.whitelist.path"))) {
+ if (isInAllowList(SecurityUtils.getPath("plantuml.allowlist.path"))) {
return true;
}
if (SecurityUtils.getSecurityProfile() == SecurityProfile.INTERNET) {
return false;
}
- if (SecurityUtils.getSecurityProfile() == SecurityProfile.WHITELIST) {
+ if (SecurityUtils.getSecurityProfile() == SecurityProfile.ALLOWLIST) {
return false;
}
if (SecurityUtils.getSecurityProfile() != SecurityProfile.UNSECURE) {
@@ -272,11 +272,11 @@ public class SFile implements Comparable {
return true;
}
- private boolean isIn(List whiteList) {
+ private boolean isInAllowList(List allowlist) {
final String path = getCleanPathSecure();
- for (SFile white : whiteList) {
- if (path.startsWith(white.getCleanPathSecure())) {
- // File directory is in the whiteList
+ for (SFile allow : allowlist) {
+ if (path.startsWith(allow.getCleanPathSecure())) {
+ // File directory is in the allowlist
return true;
}
}
diff --git a/src/net/sourceforge/plantuml/security/SURL.java b/src/net/sourceforge/plantuml/security/SURL.java
index f38309667..53accecd8 100644
--- a/src/net/sourceforge/plantuml/security/SURL.java
+++ b/src/net/sourceforge/plantuml/security/SURL.java
@@ -36,7 +36,8 @@
package net.sourceforge.plantuml.security;
import java.awt.image.BufferedImage;
-import java.io.IOException;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
@@ -110,10 +111,13 @@ public class SURL {
// We are UNSECURE anyway
return true;
}
- if (isInWhiteList()) {
+ if (isInAllowList()) {
return true;
}
if (SecurityUtils.getSecurityProfile() == SecurityProfile.INTERNET) {
+ if (pureIP(cleanPath(internal.toString()))) {
+ return false;
+ }
final int port = internal.getPort();
// Using INTERNET profile, port 80 and 443 are ok
if (port == 80 || port == 443) {
@@ -123,10 +127,17 @@ public class SURL {
return false;
}
- private boolean isInWhiteList() {
+ private boolean pureIP(String full) {
+ if (full.matches("^https?://\\d+\\.\\d+\\.\\d+\\.\\d+\\/")) {
+ return false;
+ }
+ return true;
+ }
+
+ private boolean isInAllowList() {
final String full = cleanPath(internal.toString());
- for (String white : getWhiteList()) {
- if (full.startsWith(cleanPath(white))) {
+ for (String allow : getAllowList()) {
+ if (full.startsWith(cleanPath(allow))) {
return true;
}
}
@@ -141,31 +152,51 @@ public class SURL {
return path;
}
- private List getWhiteList() {
- final String env = SecurityUtils.getenv("plantuml.whitelist.url");
+ private List getAllowList() {
+ final String env = SecurityUtils.getenv("plantuml.allowlist.url");
if (env == null) {
return Collections.emptyList();
}
return Arrays.asList(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(env).split(";"));
}
- public URLConnection openConnection() {
+ // Added by Alain Corbiere
+ public byte[] getBytes() {
if (isUrlOk())
try {
- return internal.openConnection();
- } catch (IOException e) {
+ InputStream input = null;
+ try {
+ final URLConnection connection = internal.openConnection();
+ if (connection == null) {
+ return null;
+ }
+ input = connection.getInputStream();
+ final ByteArrayOutputStream image = new ByteArrayOutputStream();
+ final byte[] buffer = new byte[1024];
+ int read;
+ while ((read = input.read(buffer)) > 0) {
+ image.write(buffer, 0, read);
+ }
+ image.close();
+ return image.toByteArray();
+ } finally {
+ if (input != null) {
+ input.close();
+ }
+ }
+ } catch (Exception e) {
e.printStackTrace();
}
return null;
}
public InputStream openStream() {
- if (isUrlOk())
- try {
- return internal.openStream();
- } catch (IOException e) {
- e.printStackTrace();
+ if (isUrlOk()) {
+ final byte data[] = getBytes();
+ if (data != null) {
+ return new ByteArrayInputStream(data);
}
+ }
return null;
}
diff --git a/src/net/sourceforge/plantuml/security/SecurityProfile.java b/src/net/sourceforge/plantuml/security/SecurityProfile.java
index c1e80d3fd..ebb0ddda2 100644
--- a/src/net/sourceforge/plantuml/security/SecurityProfile.java
+++ b/src/net/sourceforge/plantuml/security/SecurityProfile.java
@@ -69,7 +69,7 @@ public enum SecurityProfile {
/**
*
*/
- WHITELIST,
+ ALLOWLIST,
/**
* This mode is designed for PlantUML running in a web server.
@@ -108,8 +108,8 @@ public enum SecurityProfile {
final String env = SecurityUtils.getenv("PLANTUML_SECURITY_PROFILE");
if ("SANDBOX".equalsIgnoreCase(env)) {
return SANDBOX;
- } else if ("WHITELIST".equalsIgnoreCase(env)) {
- return WHITELIST;
+ } else if ("ALLOWLIST".equalsIgnoreCase(env)) {
+ return ALLOWLIST;
} else if ("INTERNET".equalsIgnoreCase(env)) {
return INTERNET;
} else if ("UNSECURE".equalsIgnoreCase(env)) {
@@ -125,7 +125,7 @@ public enum SecurityProfile {
switch (this) {
case SANDBOX:
return "This is completely safe: no access to local files or to distant URL.";
- case WHITELIST:
+ case ALLOWLIST:
return "Some local ressource may be accessible.";
case INTERNET:
return "Mode designed for server connected to Internet.";
diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java
index f1bec2a55..5466f1e94 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java
@@ -66,7 +66,7 @@ import net.sourceforge.plantuml.ugraphic.color.HColorSet;
public class CommandArrow extends SingleLineCommand2 {
- private static final String ANCHOR = "(\\{([\\p{L}0-9_]+)\\}[%s]+)?";
+ static final String ANCHOR = "(\\{([\\p{L}0-9_]+)\\}[%s]+)?";
public CommandArrow() {
super(getRegexConcat());
@@ -77,44 +77,42 @@ public class CommandArrow extends SingleLineCommand2 {
}
static IRegex getRegexConcat() {
- return RegexConcat
- .build(CommandArrow.class.getName(),
- RegexLeaf.start(), //
- new RegexLeaf("PARALLEL", "(&[%s]*)?"), //
- new RegexLeaf("ANCHOR", ANCHOR), //
- new RegexOr("PART1", //
- new RegexLeaf("PART1CODE", "([\\p{L}0-9_.@]+)"), //
- new RegexLeaf("PART1LONG", "[%g]([^%g]+)[%g]"), //
- new RegexLeaf("PART1LONGCODE", "[%g]([^%g]+)[%g][%s]*as[%s]+([\\p{L}0-9_.@]+)"), //
- new RegexLeaf("PART1CODELONG", "([\\p{L}0-9_.@]+)[%s]+as[%s]*[%g]([^%g]+)[%g]")), //
- new RegexLeaf("PART1ANCHOR", ANCHOR), //
- RegexLeaf.spaceZeroOrMore(), //
- new RegexLeaf("ARROW_DRESSING1",
- "([%s][ox]|(?:[%s][ox])?<|(?:[%s][ox])?//?|(?:[%s][ox])?\\\\\\\\?)?"), //
- new RegexOr(new RegexConcat( //
- new RegexLeaf("ARROW_BODYA1", "(-+)"), //
- new RegexLeaf("ARROW_STYLE1", getColorOrStylePattern()), //
- new RegexLeaf("ARROW_BODYB1", "(-*)")), //
- new RegexConcat( //
- new RegexLeaf("ARROW_BODYA2", "(-*)"), //
- new RegexLeaf("ARROW_STYLE2", getColorOrStylePattern()), //
- new RegexLeaf("ARROW_BODYB2", "(-+)"))), //
- new RegexLeaf("ARROW_DRESSING2",
- "(>>?(?:[ox][%s])?|//?(?:[ox][%s])?|\\\\\\\\?(?:[ox][%s])?|[ox][%s])?"), //
- RegexLeaf.spaceZeroOrMore(), //
- new RegexOr("PART2", //
- new RegexLeaf("PART2CODE", "([\\p{L}0-9_.@]+)"), //
- new RegexLeaf("PART2LONG", "[%g]([^%g]+)[%g]"), //
- new RegexLeaf("PART2LONGCODE", "[%g]([^%g]+)[%g][%s]*as[%s]+([\\p{L}0-9_.@]+)"), //
- new RegexLeaf("PART2CODELONG", "([\\p{L}0-9_.@]+)[%s]+as[%s]*[%g]([^%g]+)[%g]")), //
- new RegexLeaf("PART2ANCHOR", ANCHOR), //
- RegexLeaf.spaceZeroOrMore(), //
- new RegexLeaf("ACTIVATION", "(?:([+*!-]+)?)"), //
- RegexLeaf.spaceZeroOrMore(), //
- new RegexLeaf("LIFECOLOR", "(?:(#\\w+)?)"), //
- RegexLeaf.spaceZeroOrMore(), //
- new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
- RegexLeaf.spaceZeroOrMore(), new RegexLeaf("MESSAGE", "(?::[%s]*(.*))?"), RegexLeaf.end());
+ return RegexConcat.build(CommandArrow.class.getName(), RegexLeaf.start(), //
+ new RegexLeaf("PARALLEL", "(&[%s]*)?"), //
+ new RegexLeaf("ANCHOR", ANCHOR), //
+ new RegexOr("PART1", //
+ new RegexLeaf("PART1CODE", "([\\p{L}0-9_.@]+)"), //
+ new RegexLeaf("PART1LONG", "[%g]([^%g]+)[%g]"), //
+ new RegexLeaf("PART1LONGCODE", "[%g]([^%g]+)[%g][%s]*as[%s]+([\\p{L}0-9_.@]+)"), //
+ new RegexLeaf("PART1CODELONG", "([\\p{L}0-9_.@]+)[%s]+as[%s]*[%g]([^%g]+)[%g]")), //
+ new RegexLeaf("PART1ANCHOR", ANCHOR), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("ARROW_DRESSING1",
+ "([%s][ox]|(?:[%s][ox])?<|(?:[%s][ox])?//?|(?:[%s][ox])?\\\\\\\\?)?"), //
+ new RegexOr(new RegexConcat( //
+ new RegexLeaf("ARROW_BODYA1", "(-+)"), //
+ new RegexLeaf("ARROW_STYLE1", getColorOrStylePattern()), //
+ new RegexLeaf("ARROW_BODYB1", "(-*)")), //
+ new RegexConcat( //
+ new RegexLeaf("ARROW_BODYA2", "(-*)"), //
+ new RegexLeaf("ARROW_STYLE2", getColorOrStylePattern()), //
+ new RegexLeaf("ARROW_BODYB2", "(-+)"))), //
+ new RegexLeaf("ARROW_DRESSING2",
+ "(>>?(?:[ox][%s])?|//?(?:[ox][%s])?|\\\\\\\\?(?:[ox][%s])?|[ox][%s])?"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexOr("PART2", //
+ new RegexLeaf("PART2CODE", "([\\p{L}0-9_.@]+)"), //
+ new RegexLeaf("PART2LONG", "[%g]([^%g]+)[%g]"), //
+ new RegexLeaf("PART2LONGCODE", "[%g]([^%g]+)[%g][%s]*as[%s]+([\\p{L}0-9_.@]+)"), //
+ new RegexLeaf("PART2CODELONG", "([\\p{L}0-9_.@]+)[%s]+as[%s]*[%g]([^%g]+)[%g]")), //
+ new RegexLeaf("PART2ANCHOR", ANCHOR), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("ACTIVATION", "(?:([+*!-]+)?)"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("LIFECOLOR", "(?:(#\\w+)?)"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
+ RegexLeaf.spaceZeroOrMore(), new RegexLeaf("MESSAGE", "(?::[%s]*(.*))?"), RegexLeaf.end());
}
private Participant getOrCreateParticipant(SequenceDiagram system, RegexResult arg2, String n) {
diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowAny.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowAny.java
index 016a76e61..d701c470f 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowAny.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowAny.java
@@ -142,6 +142,9 @@ abstract class CommandExoArrowAny extends SingleLineCommand2 {
if (parallel) {
msg.goParallel();
}
+ msg.setAnchor(arg.get("ANCHOR", 1));
+ msg.setPart1Anchor(arg.get("PART1ANCHOR", 1));
+ msg.setPart2Anchor(arg.get("PART2ANCHOR", 1));
final String error = diagram.addMessage(msg);
if (error != null) {
diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowLeft.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowLeft.java
index 1de4230ec..44407946d 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowLeft.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowLeft.java
@@ -53,6 +53,7 @@ public class CommandExoArrowLeft extends CommandExoArrowAny {
static IRegex getRegexConcat() {
return RegexConcat.build(CommandExoArrowLeft.class.getName(), RegexLeaf.start(), //
new RegexLeaf("PARALLEL", "(&[%s]*)?"), //
+ new RegexLeaf("ANCHOR", CommandArrow.ANCHOR), //
new RegexLeaf("SHORT", "([?\\[\\]][ox]?)?"), //
new RegexOr( //
new RegexConcat( //
diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowRight.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowRight.java
index 791936e82..86a03b925 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowRight.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowRight.java
@@ -53,6 +53,7 @@ public class CommandExoArrowRight extends CommandExoArrowAny {
static IRegex getRegexConcat() {
return RegexConcat.build(CommandExoArrowRight.class.getName(), RegexLeaf.start(), //
new RegexLeaf("PARALLEL", "(&[%s]*)?"), //
+ new RegexLeaf("ANCHOR", CommandArrow.ANCHOR), //
new RegexLeaf("PARTICIPANT", "([\\p{L}0-9_.@]+|[%g][^%g]+[%g])"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("ARROW_SUPPCIRCLE", "([%s]+[ox])?"), //
diff --git a/src/net/sourceforge/plantuml/style/StyleLoader.java b/src/net/sourceforge/plantuml/style/StyleLoader.java
index b13de0ad5..c2aa99db6 100644
--- a/src/net/sourceforge/plantuml/style/StyleLoader.java
+++ b/src/net/sourceforge/plantuml/style/StyleLoader.java
@@ -144,7 +144,7 @@ public class StyleLoader {
if (mPropertyAndValue.find()) {
final PName key = PName.getFromName(mPropertyAndValue.group(1));
final String value = mPropertyAndValue.group(2);
- if (key != null) {
+ if (key != null && maps.size() > 0) {
maps.get(maps.size() - 1).put(key, new ValueImpl(value, counter));
}
continue;
diff --git a/src/net/sourceforge/plantuml/svek/Cluster.java b/src/net/sourceforge/plantuml/svek/Cluster.java
index f58932784..fd11613f0 100644
--- a/src/net/sourceforge/plantuml/svek/Cluster.java
+++ b/src/net/sourceforge/plantuml/svek/Cluster.java
@@ -54,7 +54,6 @@ import net.sourceforge.plantuml.ColorParam;
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.UmlDiagramType;
@@ -305,7 +304,7 @@ public class Cluster implements Moveable {
return StyleSignature.of(SName.root, SName.element, styleName, SName.group);
}
- public void drawU(UGraphic ug, UStroke stroke, UmlDiagramType umlDiagramType, ISkinParam skinParam2) {
+ public void drawU(UGraphic ug, UStroke strokeForState, UmlDiagramType umlDiagramType, ISkinParam skinParam2) {
if (group.isHidden()) {
return;
}
@@ -345,12 +344,12 @@ public class Cluster implements Moveable {
final boolean isState = umlDiagramType == UmlDiagramType.STATE;
if (isState) {
if (group.getColors(skinParam).getSpecificLineStroke() != null) {
- stroke = group.getColors(skinParam).getSpecificLineStroke();
+ strokeForState = group.getColors(skinParam).getSpecificLineStroke();
}
if (group.getColors(skinParam).getColor(ColorType.LINE) != null) {
borderColor = group.getColors(skinParam).getColor(ColorType.LINE);
}
- drawUState(ug, borderColor, skinParam2, stroke, umlDiagramType);
+ drawUState(ug, borderColor, skinParam2, strokeForState, umlDiagramType);
return;
}
PackageStyle packageStyle = group.getPackageStyle();
@@ -365,10 +364,12 @@ public class Cluster implements Moveable {
}
final double shadowing;
+ final UStroke stroke;
if (SkinParam.USE_STYLES()) {
final Style style = getDefaultStyleDefinition(umlDiagramType.getStyleName())
.getMergedStyle(skinParam.getCurrentStyleBuilder());
shadowing = style.value(PName.Shadowing).asDouble();
+ stroke = style.getStroke();
} else {
if (group.getUSymbol() == null) {
shadowing = skinParam2.shadowing2(group.getStereotype(), USymbol.PACKAGE.getSkinParameter()) ? 3
@@ -377,6 +378,7 @@ public class Cluster implements Moveable {
shadowing = skinParam2.shadowing2(group.getStereotype(), group.getUSymbol().getSkinParameter()) ? 3
: 0;
}
+ stroke = getStrokeInternal(skinParam2);
}
HColor backColor = getBackColor(umlDiagramType);
backColor = getBackColor(backColor, skinParam2, group.getStereotype(), umlDiagramType.getStyleName());
@@ -384,9 +386,8 @@ public class Cluster implements Moveable {
final double roundCorner = group.getUSymbol() == null ? 0
: group.getUSymbol().getSkinParameter().getRoundCorner(skinParam, stereotype);
- final UStroke stroke2 = getStrokeInternal(skinParam2);
final ClusterDecoration decoration = new ClusterDecoration(packageStyle, group.getUSymbol(), ztitle,
- zstereo, minX, minY, maxX, maxY, stroke2);
+ zstereo, minX, minY, maxX, maxY, stroke);
decoration.drawU(ug, backColor, borderColor, shadowing, roundCorner,
skinParam2.getHorizontalAlignment(AlignmentParam.packageTitleAlignment, null, false),
skinParam2.getStereotypeAlignment());
@@ -410,14 +411,15 @@ public class Cluster implements Moveable {
if (colors.getSpecificLineStroke() != null) {
return colors.getSpecificLineStroke();
}
- if (group.getUSymbol() != null) {
+ if (group.getUSymbol() != null && group.getUSymbol() != USymbol.PACKAGE) {
return group.getUSymbol().getSkinParameter().getStroke(skinParam, group.getStereotype());
}
- UStroke stroke = skinParam.getThickness(LineParam.packageBorder, group.getStereotype());
- if (stroke == null) {
- stroke = new UStroke(1.5);
- }
- return stroke;
+ return GeneralImageBuilder.getForcedStroke(group.getStereotype(), skinParam);
+// UStroke stroke = skinParam.getThickness(LineParam.packageBorder, group.getStereotype());
+// if (stroke == null) {
+// stroke = new UStroke(1.5);
+// }
+// return stroke;
}
public void manageEntryExitPoint(StringBounder stringBounder) {
diff --git a/src/net/sourceforge/plantuml/svek/GeneralImageBuilder.java b/src/net/sourceforge/plantuml/svek/GeneralImageBuilder.java
index 03533e51f..b3979ff7f 100644
--- a/src/net/sourceforge/plantuml/svek/GeneralImageBuilder.java
+++ b/src/net/sourceforge/plantuml/svek/GeneralImageBuilder.java
@@ -54,6 +54,7 @@ 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.Log;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.Pragma;
@@ -134,6 +135,7 @@ import net.sourceforge.plantuml.svek.image.EntityImageTips;
import net.sourceforge.plantuml.svek.image.EntityImageUseCase;
import net.sourceforge.plantuml.ugraphic.MinMax;
import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.color.HColor;
public final class GeneralImageBuilder {
@@ -200,7 +202,8 @@ public final class GeneralImageBuilder {
return new EntityImageLollipopInterface(leaf, skinParam);
}
if (leaf.getLeafType() == LeafType.CIRCLE) {
- return new EntityImageDescription(leaf, skinParam, portionShower, links, umlDiagramType.getStyleName());
+ return new EntityImageDescription(leaf, skinParam, portionShower, links, umlDiagramType.getStyleName(),
+ null);
}
if (leaf.getLeafType() == LeafType.DESCRIPTION) {
@@ -209,7 +212,11 @@ public final class GeneralImageBuilder {
} else if (OptionFlags.USE_INTERFACE_EYE2 && leaf.getUSymbol() instanceof USymbolInterface) {
return new EntityImageLollipopInterfaceEye2(leaf, skinParam, portionShower);
} else {
- return new EntityImageDescription(leaf, skinParam, portionShower, links, umlDiagramType.getStyleName());
+ final UStroke forced = leaf.getUSymbol() == USymbol.PACKAGE
+ ? getForcedStroke(leaf.getStereotype(), skinParam)
+ : null;
+ return new EntityImageDescription(leaf, skinParam, portionShower, links, umlDiagramType.getStyleName(),
+ forced);
}
}
if (leaf.getLeafType() == LeafType.USECASE) {
@@ -242,7 +249,7 @@ public final class GeneralImageBuilder {
final HColor black = SkinParamUtils.getColor(skinParam, leaf.getStereotype(),
leaf.getUSymbol().getColorParamBorder());
return new EntityImageDescription(leaf, new SkinParamForecolored(skinParam, black), portionShower,
- links, umlDiagramType.getStyleName());
+ links, umlDiagramType.getStyleName(), getForcedStroke(leaf.getStereotype(), skinParam));
}
return new EntityImageEmptyPackage(leaf, skinParam, portionShower, umlDiagramType.getStyleName());
}
@@ -283,6 +290,14 @@ public final class GeneralImageBuilder {
throw new UnsupportedOperationException(leaf.getLeafType().toString());
}
+ public static UStroke getForcedStroke(Stereotype stereotype, ISkinParam skinParam) {
+ UStroke stroke = skinParam.getThickness(LineParam.packageBorder, stereotype);
+ if (stroke == null) {
+ stroke = new UStroke(1.5);
+ }
+ return stroke;
+ }
+
private final DotData dotData;
private final EntityFactory entityFactory;
private final UmlSource source;
@@ -371,7 +386,7 @@ public final class GeneralImageBuilder {
}
return dotData.getSkinParam().getBackgroundColor(false);
}
-
+
public IEntityImage buildImage(BaseFile basefile, String dotStrings[]) {
if (dotData.isDegeneratedWithFewEntities(0)) {
return new EntityImageSimpleEmpty(dotData.getSkinParam().getBackgroundColor(false));
diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java b/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java
index 71b56d67d..721edb737 100644
--- a/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java
+++ b/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java
@@ -98,7 +98,7 @@ public class EntityImageDescription extends AbstractEntityImage {
private final boolean fixCircleLabelOverlapping;
public EntityImageDescription(ILeaf entity, ISkinParam skinParam, PortionShower portionShower,
- Collection links, SName styleName) {
+ Collection links, SName styleName, UStroke forceStroke) {
super(entity, entity.getColors(skinParam).mute(skinParam));
this.useRankSame = skinParam.useRankSame();
this.fixCircleLabelOverlapping = skinParam.fixCircleLabelOverlapping();
@@ -133,6 +133,8 @@ public class EntityImageDescription extends AbstractEntityImage {
final HColor forecolor;
final double roundCorner;
final double diagonalCorner;
+ final double deltaShadow;
+ final UStroke stroke;
if (SkinParam.USE_STYLES()) {
final Style style = StyleSignature
.of(SName.root, SName.element, styleName, symbol.getSkinParameter().getStyleName())
@@ -143,6 +145,8 @@ public class EntityImageDescription extends AbstractEntityImage {
}
roundCorner = style.value(PName.RoundCorner).asDouble();
diagonalCorner = style.value(PName.DiagonalCorner).asDouble();
+ deltaShadow = style.value(PName.Shadowing).asDouble();
+ stroke = style.getStroke();
} else {
forecolor = SkinParamUtils.getColor(getSkinParam(), stereotype, symbol.getColorParamBorder());
if (backcolor == null) {
@@ -150,13 +154,17 @@ public class EntityImageDescription extends AbstractEntityImage {
}
roundCorner = symbol.getSkinParameter().getRoundCorner(getSkinParam(), stereotype);
diagonalCorner = symbol.getSkinParameter().getDiagonalCorner(getSkinParam(), stereotype);
+ deltaShadow = getSkinParam().shadowing2(getEntity().getStereotype(), symbol.getSkinParameter()) ? 3 : 0;
+ if (forceStroke == null) {
+ stroke = colors.muteStroke(symbol.getSkinParameter().getStroke(getSkinParam(), stereotype));
+ } else {
+ stroke = forceStroke;
+ }
}
assert getStereo() == 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()) ? 3 : 0)
+ final SymbolContext ctx = new SymbolContext(backcolor, forecolor).withStroke(stroke).withShadow(deltaShadow)
.withCorner(roundCorner, diagonalCorner);
stereo = TextBlockUtils.empty(0, 0);
@@ -183,8 +191,7 @@ public class EntityImageDescription extends AbstractEntityImage {
}
private USymbol getUSymbol(ILeaf entity) {
- final USymbol result = entity.getUSymbol() == null
- ? (getSkinParam().useUml2ForComponent() ? USymbol.COMPONENT2 : USymbol.COMPONENT1)
+ final USymbol result = entity.getUSymbol() == null ? getSkinParam().componentStyle().toSymbol()
: entity.getUSymbol();
if (result == null) {
throw new IllegalArgumentException();
diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageEmptyPackage.java b/src/net/sourceforge/plantuml/svek/image/EntityImageEmptyPackage.java
index c8456d28d..c17496198 100644
--- a/src/net/sourceforge/plantuml/svek/image/EntityImageEmptyPackage.java
+++ b/src/net/sourceforge/plantuml/svek/image/EntityImageEmptyPackage.java
@@ -43,7 +43,6 @@ 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;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.cucadiagram.Display;
@@ -61,6 +60,7 @@ import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.svek.AbstractEntityImage;
import net.sourceforge.plantuml.svek.Cluster;
import net.sourceforge.plantuml.svek.ClusterDecoration;
+import net.sourceforge.plantuml.svek.GeneralImageBuilder;
import net.sourceforge.plantuml.svek.ShapeType;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UStroke;
@@ -106,14 +106,6 @@ public class EntityImageEmptyPackage extends AbstractEntityImage {
return Dimension2DDouble.delta(dim, MARGIN * 2, MARGIN * 2);
}
- private UStroke getStroke() {
- UStroke stroke = getSkinParam().getThickness(LineParam.packageBorder, getStereo());
- if (stroke == null) {
- stroke = new UStroke(1.5);
- }
- return stroke;
- }
-
final public void drawU(UGraphic ug) {
if (url != null) {
ug.startUrl(url);
@@ -128,8 +120,9 @@ public class EntityImageEmptyPackage extends AbstractEntityImage {
final HColor back = Cluster.getBackColor(specificBackColor, skinParam, stereotype, styleName);
final double roundCorner = 0;
+ final UStroke stroke = GeneralImageBuilder.getForcedStroke(getEntity().getStereotype(), getSkinParam());
final ClusterDecoration decoration = new ClusterDecoration(getSkinParam().getPackageStyle(), null, desc,
- stereoBlock, 0, 0, widthTotal, heightTotal, getStroke());
+ stereoBlock, 0, 0, widthTotal, heightTotal, stroke);
final double shadowing = getSkinParam().shadowing(getEntity().getStereotype()) ? 3 : 0;
decoration.drawU(ug, back, SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.packageBorder),
diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterfaceEye2.java b/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterfaceEye2.java
index 0ed037036..8377080e7 100644
--- a/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterfaceEye2.java
+++ b/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterfaceEye2.java
@@ -76,8 +76,8 @@ public class EntityImageLollipopInterfaceEye2 extends AbstractEntityImage {
super(entity, skinParam);
final Stereotype stereotype = entity.getStereotype();
- final USymbol symbol = entity.getUSymbol() == null ? (skinParam.useUml2ForComponent() ? USymbol.COMPONENT2
- : USymbol.COMPONENT1) : entity.getUSymbol();
+ final USymbol symbol = entity.getUSymbol() == null ? skinParam.componentStyle().toSymbol()
+ : entity.getUSymbol();
if (symbol == null) {
throw new IllegalArgumentException();
}
@@ -93,8 +93,8 @@ public class EntityImageLollipopInterfaceEye2 extends AbstractEntityImage {
}
// backcolor = HtmlColorUtils.BLUE;
final HColor forecolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), symbol.getColorParamBorder());
- this.ctx = new SymbolContext(backcolor, forecolor).withStroke(new UStroke(1.5)).withShadow(
- getSkinParam().shadowing(getEntity().getStereotype()) ? 3 : 0);
+ this.ctx = new SymbolContext(backcolor, forecolor).withStroke(new UStroke(1.5))
+ .withShadow(getSkinParam().shadowing(getEntity().getStereotype()) ? 3 : 0);
if (stereotype != null && stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR) != null
&& portionShower.showPortion(EntityPortion.STEREOTYPE, entity)) {
diff --git a/src/net/sourceforge/plantuml/ugraphic/LimitFinder.java b/src/net/sourceforge/plantuml/ugraphic/LimitFinder.java
index 7242c9702..b63b3929b 100644
--- a/src/net/sourceforge/plantuml/ugraphic/LimitFinder.java
+++ b/src/net/sourceforge/plantuml/ugraphic/LimitFinder.java
@@ -180,8 +180,9 @@ public class LimitFinder extends UGraphicNo implements UGraphic {
}
private void drawRectangle(double x, double y, URectangle shape) {
- addPoint(x, y);
- addPoint(x + shape.getWidth() - 1, y + shape.getHeight() - 1);
+ addPoint(x - 1, y - 1);
+ addPoint(x + shape.getWidth() - 1 + shape.getDeltaShadow() * 2,
+ y + shape.getHeight() - 1 + shape.getDeltaShadow() * 2);
}
private void drawDotPath(double x, double y, DotPath shape) {
@@ -202,7 +203,8 @@ public class LimitFinder extends UGraphicNo implements UGraphic {
private void drawEllipse(double x, double y, UEllipse shape) {
addPoint(x, y);
- addPoint(x + shape.getWidth() - 1, y + shape.getHeight() - 1);
+ addPoint(x + shape.getWidth() - 1 + shape.getDeltaShadow() * 2,
+ y + shape.getHeight() - 1 + shape.getDeltaShadow() * 2);
}
private void drawText(double x, double y, UText text) {
diff --git a/src/net/sourceforge/plantuml/ugraphic/g2d/DriverPathG2d.java b/src/net/sourceforge/plantuml/ugraphic/g2d/DriverPathG2d.java
index 77f3bb12f..0d8623043 100644
--- a/src/net/sourceforge/plantuml/ugraphic/g2d/DriverPathG2d.java
+++ b/src/net/sourceforge/plantuml/ugraphic/g2d/DriverPathG2d.java
@@ -37,10 +37,8 @@ package net.sourceforge.plantuml.ugraphic.g2d;
import java.awt.GradientPaint;
import java.awt.Graphics2D;
-import java.awt.Shape;
-import java.awt.geom.Line2D;
-import net.sourceforge.plantuml.golem.MinMaxDouble;
+import net.sourceforge.plantuml.ugraphic.MinMax;
import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UPath;
@@ -65,23 +63,23 @@ public class DriverPathG2d extends DriverShadowedG2d implements UDriver {
-
- private final double dpiFactor;
-
- public DriverPathG2dLegacy(double dpiFactor) {
- this.dpiFactor = dpiFactor;
- }
-
- public void draw(UShape ushape, final double x, final double y, ColorMapper mapper, UParam param, Graphics2D g2d) {
- final UPath shape = (UPath) ushape;
- DriverLineG2d.manageStroke(param, g2d);
-
- final Path2D.Double p = new Path2D.Double();
- boolean hasBezier = false;
- final MinMaxDouble minMax = new MinMaxDouble();
- minMax.manage(x, y);
- for (USegment seg : shape) {
- final USegmentType type = seg.getSegmentType();
- final double coord[] = seg.getCoord();
- if (type == USegmentType.SEG_MOVETO) {
- p.moveTo(x + coord[0], y + coord[1]);
- minMax.manage(x + coord[0], y + coord[1]);
- } else if (type == USegmentType.SEG_LINETO) {
- p.lineTo(x + coord[0], y + coord[1]);
- minMax.manage(x + coord[0], y + coord[1]);
- } else if (type == USegmentType.SEG_CUBICTO) {
- p.curveTo(x + coord[0], y + coord[1], x + coord[2], y + coord[3], x + coord[4], y + coord[5]);
- minMax.manage(x + coord[4], y + coord[5]);
- hasBezier = true;
- } else {
- throw new UnsupportedOperationException();
- }
- }
-
- if (shape.isOpenIconic()) {
- p.closePath();
- g2d.setColor(mapper.toColor(param.getColor()));
- g2d.fill(p);
- return;
- }
-
- // Shadow
- if (shape.getDeltaShadow() != 0) {
- if (hasBezier) {
- drawShadow(g2d, p, shape.getDeltaShadow(), dpiFactor);
- } else {
- double lastX = 0;
- double lastY = 0;
- for (USegment seg : shape) {
- final USegmentType type = seg.getSegmentType();
- final double coord[] = seg.getCoord();
- // Cast float for Java 1.5
- if (type == USegmentType.SEG_MOVETO) {
- lastX = x + coord[0];
- lastY = y + coord[1];
- } else if (type == USegmentType.SEG_LINETO) {
- final Shape line = new Line2D.Double(lastX, lastY, x + coord[0], y + coord[1]);
- drawShadow(g2d, line, shape.getDeltaShadow(), dpiFactor);
- lastX = x + coord[0];
- lastY = y + coord[1];
- } else {
- throw new UnsupportedOperationException();
- }
- }
- }
- }
-
- final HColor back = param.getBackcolor();
- if (back instanceof HColorGradient) {
- final HColorGradient gr = (HColorGradient) back;
- final char policy = gr.getPolicy();
- final GradientPaint paint;
- if (policy == '|') {
- paint = new GradientPaint((float) minMax.getMinX(), (float) minMax.getMaxY() / 2,
- mapper.toColor(gr.getColor1()), (float) minMax.getMaxX(), (float) minMax.getMaxY() / 2,
- mapper.toColor(gr.getColor2()));
- } else if (policy == '\\') {
- paint = new GradientPaint((float) minMax.getMinX(), (float) minMax.getMaxY(), mapper.toColor(gr
- .getColor1()), (float) minMax.getMaxX(), (float) minMax.getMinY(), mapper.toColor(gr
- .getColor2()));
- } else if (policy == '-') {
- paint = new GradientPaint((float) minMax.getMaxX() / 2, (float) minMax.getMinY(),
- mapper.toColor(gr.getColor1()), (float) minMax.getMaxX() / 2, (float) minMax.getMaxY(),
- mapper.toColor(gr.getColor2()));
- } else {
- // for /
- paint = new GradientPaint((float) x, (float) y, mapper.toColor(gr.getColor1()),
- (float) minMax.getMaxX(), (float) minMax.getMaxY(), mapper.toColor(gr.getColor2()));
- }
- g2d.setPaint(paint);
- g2d.fill(p);
- } else if (back != null) {
- g2d.setColor(mapper.toColor(back));
- g2d.fill(p);
- }
-
- if (param.getColor() != null) {
- g2d.setColor(mapper.toColor(param.getColor()));
- g2d.draw(p);
- }
- }
-
-}
diff --git a/src/net/sourceforge/plantuml/ugraphic/g2d/DriverPathOldG2d.java b/src/net/sourceforge/plantuml/ugraphic/g2d/DriverPathOldG2d.java
deleted file mode 100644
index 620969b23..000000000
--- a/src/net/sourceforge/plantuml/ugraphic/g2d/DriverPathOldG2d.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/* ========================================================================
- * 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.ugraphic.g2d;
-
-import java.awt.GradientPaint;
-import java.awt.Graphics2D;
-import java.awt.Shape;
-import java.awt.geom.GeneralPath;
-import java.awt.geom.Line2D;
-
-import net.sourceforge.plantuml.golem.MinMaxDouble;
-import net.sourceforge.plantuml.ugraphic.UDriver;
-import net.sourceforge.plantuml.ugraphic.UParam;
-import net.sourceforge.plantuml.ugraphic.UPath;
-import net.sourceforge.plantuml.ugraphic.USegment;
-import net.sourceforge.plantuml.ugraphic.USegmentType;
-import net.sourceforge.plantuml.ugraphic.UShape;
-import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
-import net.sourceforge.plantuml.ugraphic.color.HColor;
-import net.sourceforge.plantuml.ugraphic.color.HColorGradient;
-
-public class DriverPathOldG2d extends DriverShadowedG2d implements UDriver {
-
- private final double dpiFactor;
-
- public DriverPathOldG2d(double dpiFactor) {
- this.dpiFactor = dpiFactor;
- }
-
- public void draw(UShape ushape, final double x, final double y, ColorMapper mapper, UParam param, Graphics2D g2d) {
- final UPath shape = (UPath) ushape;
- DriverLineG2d.manageStroke(param, g2d);
-
- final GeneralPath p = new GeneralPath();
- boolean hasBezier = false;
- final MinMaxDouble minMax = new MinMaxDouble();
- minMax.manage(x, y);
- for (USegment seg : shape) {
- final USegmentType type = seg.getSegmentType();
- final double coord[] = seg.getCoord();
- // Cast float for Java 1.5
- if (type == USegmentType.SEG_MOVETO) {
- p.moveTo((float) (x + coord[0]), (float) (y + coord[1]));
- minMax.manage(x + coord[0], y + coord[1]);
- } else if (type == USegmentType.SEG_LINETO) {
- p.lineTo((float) (x + coord[0]), (float) (y + coord[1]));
- minMax.manage(x + coord[0], y + coord[1]);
- } else if (type == USegmentType.SEG_CUBICTO) {
- p.curveTo((float) (x + coord[0]), (float) (y + coord[1]), (float) (x + coord[2]),
- (float) (y + coord[3]), (float) (x + coord[4]), (float) (y + coord[5]));
- minMax.manage(x + coord[4], y + coord[5]);
- hasBezier = true;
- } else {
- throw new UnsupportedOperationException();
- }
- // bez = new CubicCurve2D.Double(x + bez.x1, y + bez.y1, x +
- // bez.ctrlx1, y + bez.ctrly1, x + bez.ctrlx2, y
- // + bez.ctrly2, x + bez.x2, y + bez.y2);
- // p.append(bez, true);
- }
- // p.closePath();
-
- // Shadow
- if (shape.getDeltaShadow() != 0) {
- if (hasBezier) {
- drawShadow(g2d, p, shape.getDeltaShadow(), dpiFactor);
- } else {
- double lastX = 0;
- double lastY = 0;
- for (USegment seg : shape) {
- final USegmentType type = seg.getSegmentType();
- final double coord[] = seg.getCoord();
- // Cast float for Java 1.5
- if (type == USegmentType.SEG_MOVETO) {
- lastX = x + coord[0];
- lastY = y + coord[1];
- } else if (type == USegmentType.SEG_LINETO) {
- final Shape line = new Line2D.Double(lastX, lastY, x + coord[0], y + coord[1]);
- drawShadow(g2d, line, shape.getDeltaShadow(), dpiFactor);
- lastX = x + coord[0];
- lastY = y + coord[1];
- } else {
- throw new UnsupportedOperationException();
- }
- }
- }
- }
-
- final HColor back = param.getBackcolor();
- if (back instanceof HColorGradient) {
- final HColorGradient gr = (HColorGradient) back;
- final char policy = gr.getPolicy();
- final GradientPaint paint;
- if (policy == '|') {
- paint = new GradientPaint((float) minMax.getMinX(), (float) minMax.getMaxY() / 2,
- mapper.toColor(gr.getColor1()), (float) minMax.getMaxX(), (float) minMax.getMaxY() / 2,
- mapper.toColor(gr.getColor2()));
- } else if (policy == '\\') {
- paint = new GradientPaint((float) minMax.getMinX(), (float) minMax.getMaxY(), mapper.toColor(gr
- .getColor1()), (float) minMax.getMaxX(), (float) minMax.getMinY(), mapper.toColor(gr
- .getColor2()));
- } else if (policy == '-') {
- paint = new GradientPaint((float) minMax.getMaxX() / 2, (float) minMax.getMinY(),
- mapper.toColor(gr.getColor1()), (float) minMax.getMaxX() / 2, (float) minMax.getMaxY(),
- mapper.toColor(gr.getColor2()));
- } else {
- // for /
- paint = new GradientPaint((float) x, (float) y, mapper.toColor(gr.getColor1()),
- (float) minMax.getMaxX(), (float) minMax.getMaxY(), mapper.toColor(gr.getColor2()));
- }
- g2d.setPaint(paint);
- g2d.fill(p);
- } else if (back != null) {
- g2d.setColor(mapper.toColor(back));
- g2d.fill(p);
- }
-
- if (param.getColor() != null) {
- g2d.setColor(mapper.toColor(param.getColor()));
- g2d.draw(p);
- }
- }
-
-}
diff --git a/src/net/sourceforge/plantuml/ugraphic/g2d/DriverPolygonG2d.java b/src/net/sourceforge/plantuml/ugraphic/g2d/DriverPolygonG2d.java
index ec0b3686f..c13b4dae0 100644
--- a/src/net/sourceforge/plantuml/ugraphic/g2d/DriverPolygonG2d.java
+++ b/src/net/sourceforge/plantuml/ugraphic/g2d/DriverPolygonG2d.java
@@ -39,13 +39,9 @@ import java.awt.BasicStroke;
import java.awt.GradientPaint;
import java.awt.Graphics2D;
import java.awt.geom.GeneralPath;
-import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
-import java.util.ArrayList;
-import java.util.List;
import net.sourceforge.plantuml.EnsureVisible;
-import net.sourceforge.plantuml.ugraphic.MinMax;
import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UPolygon;
@@ -73,9 +69,6 @@ public class DriverPolygonG2d extends DriverShadowedG2d implements UDriver shadows = shape.getDeltaShadow() != 0 && HColorUtils.isTransparent(back)
- ? new ArrayList()
- : null;
Point2D.Double last = null;
for (Point2D pt : shape.getPoints()) {
@@ -85,9 +78,6 @@ public class DriverPolygonG2d extends DriverShadowedG2d implements UDriver keepSome(List shadows) {
- final List result = new ArrayList();
- MinMax minMax = MinMax.getEmpty(true);
- for (Line2D.Double line : shadows) {
- minMax = minMax.addPoint(line.x1, line.y1);
- minMax = minMax.addPoint(line.y2, line.y2);
- }
- for (Line2D.Double line : shadows) {
- if (keepMe(line, minMax.getMaxX(), minMax.getMaxY()))
- result.add(line);
- }
- return result;
- }
-
- private boolean keepMe(Line2D.Double line, double maxX, double maxY) {
- if (line.x1 >= maxX && line.x2 >= maxX) {
- return true;
- }
- if (line.y1 >= maxY && line.y2 >= maxY) {
- return true;
- }
- final double margin = 10;
- if (line.x1 >= maxX - margin && line.x2 >= maxX - margin && line.y1 >= maxY - margin
- && line.y2 >= maxY - margin) {
- return true;
- }
- return false;
- }
}
diff --git a/src/net/sourceforge/plantuml/ugraphic/g2d/DriverRectangleG2d.java b/src/net/sourceforge/plantuml/ugraphic/g2d/DriverRectangleG2d.java
index decb894fd..8cf7ba6f0 100644
--- a/src/net/sourceforge/plantuml/ugraphic/g2d/DriverRectangleG2d.java
+++ b/src/net/sourceforge/plantuml/ugraphic/g2d/DriverRectangleG2d.java
@@ -41,7 +41,6 @@ import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.TexturePaint;
-import java.awt.geom.Line2D;
import java.awt.geom.Rectangle2D;
import java.awt.geom.RoundRectangle2D;
import java.awt.image.BufferedImage;
@@ -89,10 +88,7 @@ public class DriverRectangleG2d extends DriverShadowedG2d implements UDriver