diff --git a/src/net/sourceforge/plantuml/OptionFlags.java b/src/net/sourceforge/plantuml/OptionFlags.java index 6a8c1ee76..c8b362f00 100644 --- a/src/net/sourceforge/plantuml/OptionFlags.java +++ b/src/net/sourceforge/plantuml/OptionFlags.java @@ -71,7 +71,7 @@ public class OptionFlags { static public final boolean USE_INTERFACE_EYE2 = false; // static public final boolean SWI2 = false; // static public final boolean USE_COMPOUND = false; - static public final boolean OMEGA_CROSSING = false; + // static public final boolean OMEGA_CROSSING = false; // static public final boolean LINK_BETWEEN_FIELDS = true; diff --git a/src/net/sourceforge/plantuml/UmlDiagramType.java b/src/net/sourceforge/plantuml/UmlDiagramType.java index 3311a9d73..231b8fdc4 100644 --- a/src/net/sourceforge/plantuml/UmlDiagramType.java +++ b/src/net/sourceforge/plantuml/UmlDiagramType.java @@ -75,6 +75,12 @@ public enum UmlDiagramType { if (this == SALT) { return SName.saltDiagram; } + if (this == YAML) { + return SName.yamlDiagram; + } + if (this == JSON) { + return SName.jsonDiagram; + } return SName.activityDiagram; } } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FloatingNote.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FloatingNote.java index 33c7962e9..eebac6f2c 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FloatingNote.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FloatingNote.java @@ -41,6 +41,7 @@ import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.LineBreakStrategy; +import net.sourceforge.plantuml.UseStyle; import net.sourceforge.plantuml.creole.CreoleMode; import net.sourceforge.plantuml.creole.Parser; import net.sourceforge.plantuml.creole.Sheet; @@ -54,6 +55,7 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.skin.rose.Rose; +import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.svek.image.Opale; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; @@ -63,7 +65,7 @@ public class FloatingNote extends AbstractTextBlock implements Stencil, TextBloc private final Opale opale; - public FloatingNote(Display note, ISkinParam skinParam) { + public FloatingNote(Display note, ISkinParam skinParam, Style style) { final Rose rose = new Rose(); @@ -72,11 +74,19 @@ public class FloatingNote extends AbstractTextBlock implements Stencil, TextBloc final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.NOTE, null); + final LineBreakStrategy wrapWidth; + + if (UseStyle.useBetaStyle()) { + wrapWidth = style.wrapWidth(); + } else { + wrapWidth = skinParam.wrapWidth(); + + } final Sheet sheet = Parser .build(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), skinParam, CreoleMode.FULL) .createSheet(note); - final SheetBlock2 sheetBlock2 = new SheetBlock2( - new SheetBlock1(sheet, LineBreakStrategy.NONE, skinParam.getPadding()), this, new UStroke(1)); + final SheetBlock2 sheetBlock2 = new SheetBlock2(new SheetBlock1(sheet, wrapWidth, skinParam.getPadding()), this, + new UStroke(1)); final double shadowing; shadowing = skinParam.shadowing(null) ? 4 : 0; this.opale = new Opale(shadowing, borderColor, noteBackgroundColor, sheetBlock2, false); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileGroup.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileGroup.java index 46f5923f1..ddff9e6ff 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileGroup.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileGroup.java @@ -101,11 +101,13 @@ public class FtileGroup extends AbstractFtile { this.borderColor = borderColor == null ? HColorUtils.BLACK : borderColor; final FontConfiguration fc; + final Style style; if (UseStyle.useBetaStyle()) { - final Style style = getDefaultStyleDefinitionPartition().getMergedStyle(skinParam.getCurrentStyleBuilder()); + style = getDefaultStyleDefinitionPartition().getMergedStyle(skinParam.getCurrentStyleBuilder()); fc = style.getFontConfiguration(getIHtmlColorSet()); this.shadowing = style.value(PName.Shadowing).asDouble(); } else { + style = null; final UFont font = skinParam.getFont(null, false, FontParam.PARTITION); final HColor fontColor = skinParam.getFontHtmlColor(null, FontParam.PARTITION); fc = new FontConfiguration(font, fontColor, skinParam.getHyperlinkColor(), @@ -120,7 +122,7 @@ public class FtileGroup extends AbstractFtile { if (Display.isNull(displayNote)) { this.headerNote = TextBlockUtils.empty(0, 0); } else { - this.headerNote = new FloatingNote(displayNote, skinParam); + this.headerNote = new FloatingNote(displayNote, skinParam, style); } final UStroke thickness = skinParam.getThickness(LineParam.partitionBorder, null); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileNoteAlone.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileNoteAlone.java index 83ed6a488..f83e567e4 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileNoteAlone.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileNoteAlone.java @@ -110,15 +110,18 @@ public class FtileNoteAlone extends AbstractFtile implements Stencil, Styleable final HColor noteBackgroundColor; final HColor borderColor; final double shadowing; + final LineBreakStrategy wrapWidth; if (UseStyle.useBetaStyle()) { final Style style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder()); noteBackgroundColor = style.value(PName.BackGroundColor).asColor(getIHtmlColorSet()); borderColor = style.value(PName.LineColor).asColor(getIHtmlColorSet()); shadowing = style.value(PName.Shadowing).asDouble(); + wrapWidth = style.wrapWidth(); } else { noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.noteBackground); borderColor = rose.getHtmlColor(skinParam, ColorParam.noteBorder); shadowing = skinParam.shadowing(null) ? 4 : 0; + wrapWidth = skinParam.wrapWidth(); } final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.NOTE, null); @@ -126,7 +129,7 @@ public class FtileNoteAlone extends AbstractFtile implements Stencil, Styleable final Sheet sheet = Parser .build(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), skinParam, CreoleMode.FULL) .createSheet(note); - final TextBlock text = new SheetBlock2(new SheetBlock1(sheet, LineBreakStrategy.NONE, skinParam.getPadding()), + final TextBlock text = new SheetBlock2(new SheetBlock1(sheet, wrapWidth, skinParam.getPadding()), this, new UStroke(1)); opale = new Opale(shadowing, borderColor, noteBackgroundColor, text, false); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNotes.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNotes.java index 322012560..5d5faec10 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNotes.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNotes.java @@ -115,6 +115,7 @@ public class FtileWithNotes extends AbstractFtile { final FontConfiguration fc; final double shadowing; + final LineBreakStrategy wrapWidth; if (UseStyle.useBetaStyle()) { final Style style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder()) .eventuallyOverride(note.getColors()); @@ -122,17 +123,19 @@ public class FtileWithNotes extends AbstractFtile { borderColor = style.value(PName.LineColor).asColor(getIHtmlColorSet()); fc = style.getFontConfiguration(getIHtmlColorSet()); shadowing = style.value(PName.Shadowing).asDouble(); + wrapWidth = style.wrapWidth(); } else { noteBackgroundColor = rose.getHtmlColor(skinParam2, ColorParam.noteBackground); borderColor = rose.getHtmlColor(skinParam2, ColorParam.noteBorder); fc = new FontConfiguration(skinParam, FontParam.NOTE, null); shadowing = skinParam.shadowing(null) ? 4 : 0; + wrapWidth = skinParam.wrapWidth(); } final Sheet sheet = Parser .build(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), skinParam, CreoleMode.FULL) .createSheet(note.getDisplay()); - final SheetBlock1 sheet1 = new SheetBlock1(sheet, LineBreakStrategy.NONE, skinParam.getPadding()); + final SheetBlock1 sheet1 = new SheetBlock1(sheet, wrapWidth, skinParam.getPadding()); final SheetBlock2 sheet2 = new SheetBlock2(sheet1, new Stencil() { // -6 and 15 value comes from Opale: this is very ugly! public double getStartingX(StringBounder stringBounder, double y) { diff --git a/src/net/sourceforge/plantuml/cute/ApolloniusSolver.java b/src/net/sourceforge/plantuml/cute/ApolloniusSolver.java deleted file mode 100644 index dd30517f4..000000000 --- a/src/net/sourceforge/plantuml/cute/ApolloniusSolver.java +++ /dev/null @@ -1,97 +0,0 @@ -package net.sourceforge.plantuml.cute; - -// http://rosettacode.org/wiki/Problem_of_Apollonius#Java -public class ApolloniusSolver { - - static class Circle { - public double[] center; - public double radius; - - public Circle(double[] center, double radius) { - this.center = center; - this.radius = radius; - } - - public String toString() { - return String.format("Circle[x=%.2f,y=%.2f,r=%.2f]", center[0], center[1], radius); - } - } - - /** - * Solves the Problem of Apollonius (finding a circle tangent to three other circles in the plane). The method uses - * approximately 68 heavy operations (multiplication, division, square-roots). - * - * @param c1 - * One of the circles in the problem - * @param c2 - * One of the circles in the problem - * @param c3 - * One of the circles in the problem - * @param s1 - * An indication if the solution should be externally or internally tangent (+1/-1) to c1 - * @param s2 - * An indication if the solution should be externally or internally tangent (+1/-1) to c2 - * @param s3 - * An indication if the solution should be externally or internally tangent (+1/-1) to c3 - * @return The circle that is tangent to c1, c2 and c3. - */ - public static Circle solveApollonius(Circle c1, Circle c2, Circle c3, int s1, int s2, int s3) { - double x1 = c1.center[0]; - double y1 = c1.center[1]; - double r1 = c1.radius; - double x2 = c2.center[0]; - double y2 = c2.center[1]; - double r2 = c2.radius; - double x3 = c3.center[0]; - double y3 = c3.center[1]; - double r3 = c3.radius; - - // Currently optimized for fewest multiplications. Should be optimized for - // readability - double v11 = 2 * x2 - 2 * x1; - double v12 = 2 * y2 - 2 * y1; - double v13 = x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2 - r1 * r1 + r2 * r2; - double v14 = 2 * s2 * r2 - 2 * s1 * r1; - - double v21 = 2 * x3 - 2 * x2; - double v22 = 2 * y3 - 2 * y2; - double v23 = x2 * x2 - x3 * x3 + y2 * y2 - y3 * y3 - r2 * r2 + r3 * r3; - double v24 = 2 * s3 * r3 - 2 * s2 * r2; - - double w12 = v12 / v11; - double w13 = v13 / v11; - double w14 = v14 / v11; - - double w22 = v22 / v21 - w12; - double w23 = v23 / v21 - w13; - double w24 = v24 / v21 - w14; - - double P = -w23 / w22; - double Q = w24 / w22; - double M = -w12 * P - w13; - double N = w14 - w12 * Q; - - double a = N * N + Q * Q - 1; - double b = 2 * M * N - 2 * N * x1 + 2 * P * Q - 2 * Q * y1 + 2 * s1 * r1; - double c = x1 * x1 + M * M - 2 * M * x1 + P * P + y1 * y1 - 2 * P * y1 - r1 * r1; - - // Find a root of a quadratic equation. This requires the circle centers not - // to be e.g. colinear - double D = b * b - 4 * a * c; - double rs = (-b - Math.sqrt(D)) / (2 * a); - double xs = M + N * rs; - double ys = P + Q * rs; - return new Circle(new double[] { xs, ys }, rs); - } - - public static void main(final String[] args) { - Circle c1 = new Circle(new double[] { 0, 0 }, 1); - Circle c2 = new Circle(new double[] { 4, 0 }, 1); - Circle c3 = new Circle(new double[] { 2, 4 }, 2); - // Expects "Circle[x=2.00,y=2.10,r=3.90]" (green circle in image) - System.out.println(solveApollonius(c1, c2, c3, 1, 1, 1)); - // Expects "Circle[x=2.00,y=0.83,r=1.17]" (red circle in image) - System.out.println(solveApollonius(c1, c2, c3, -1, -1, -1)); - } - -} diff --git a/src/net/sourceforge/plantuml/cute/ApolloniusSolver2.java b/src/net/sourceforge/plantuml/cute/ApolloniusSolver2.java deleted file mode 100644 index 2eca4cf14..000000000 --- a/src/net/sourceforge/plantuml/cute/ApolloniusSolver2.java +++ /dev/null @@ -1,76 +0,0 @@ -package net.sourceforge.plantuml.cute; - -import java.awt.geom.Point2D; - -// http://rosettacode.org/wiki/Problem_of_Apollonius#Java -public class ApolloniusSolver2 { - - /** - * Solves the Problem of Apollonius (finding a circle tangent to three other circles in the plane). The method uses - * approximately 68 heavy operations (multiplication, division, square-roots). - * - * @param c1 - * One of the circles in the problem - * @param c2 - * One of the circles in the problem - * @param c3 - * One of the circles in the problem - * @param s1 - * An indication if the solution should be externally or internally tangent (+1/-1) to c1 - * @param s2 - * An indication if the solution should be externally or internally tangent (+1/-1) to c2 - * @param s3 - * An indication if the solution should be externally or internally tangent (+1/-1) to c3 - * @return The circle that is tangent to c1, c2 and c3. - */ - public static Balloon solveApollonius(Balloon c1, Balloon c2, Balloon c3, int s1, int s2, int s3) { - double x1 = c1.getCenter().getX(); - double y1 = c1.getCenter().getY(); - double r1 = c1.getRadius(); - double x2 = c2.getCenter().getX(); - double y2 = c2.getCenter().getY(); - double r2 = c2.getRadius(); - double x3 = c3.getCenter().getX(); - double y3 = c3.getCenter().getY(); - double r3 = c3.getRadius(); - - // Currently optimized for fewest multiplications. Should be optimized for - // readability - double v11 = 2 * x2 - 2 * x1; - double v12 = 2 * y2 - 2 * y1; - double v13 = x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2 - r1 * r1 + r2 * r2; - double v14 = 2 * s2 * r2 - 2 * s1 * r1; - - double v21 = 2 * x3 - 2 * x2; - double v22 = 2 * y3 - 2 * y2; - double v23 = x2 * x2 - x3 * x3 + y2 * y2 - y3 * y3 - r2 * r2 + r3 * r3; - double v24 = 2 * s3 * r3 - 2 * s2 * r2; - - double w12 = v12 / v11; - double w13 = v13 / v11; - double w14 = v14 / v11; - - double w22 = v22 / v21 - w12; - double w23 = v23 / v21 - w13; - double w24 = v24 / v21 - w14; - - double P = -w23 / w22; - double Q = w24 / w22; - double M = -w12 * P - w13; - double N = w14 - w12 * Q; - - double a = N * N + Q * Q - 1; - double b = 2 * M * N - 2 * N * x1 + 2 * P * Q - 2 * Q * y1 + 2 * s1 * r1; - double c = x1 * x1 + M * M - 2 * M * x1 + P * P + y1 * y1 - 2 * P * y1 - r1 * r1; - - // Find a root of a quadratic equation. This requires the circle centers not - // to be e.g. colinear - double D = b * b - 4 * a * c; - double rs = (-b - Math.sqrt(D)) / (2 * a); - double xs = M + N * rs; - double ys = P + Q * rs; - return new Balloon(new Point2D.Double(xs, ys), rs); - } - - -} diff --git a/src/net/sourceforge/plantuml/cute/Arc.java b/src/net/sourceforge/plantuml/cute/Arc.java deleted file mode 100644 index 589f728ff..000000000 --- a/src/net/sourceforge/plantuml/cute/Arc.java +++ /dev/null @@ -1,113 +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.cute; - -import java.awt.geom.Point2D; - -public class Arc { - - private final Segment segment; - private final Tension tension; - - public Tension getTension() { - return tension; - } - - public Arc(final MyPoint2D a, final MyPoint2D b) { - this(a, b, Tension.none()); - } - - private Arc(final MyPoint2D a, final MyPoint2D b, Tension tension) { - this.segment = new Segment(a, b); - this.tension = tension; - } - - public MyPoint2D getA() { - return (MyPoint2D) segment.getA(); - } - - public MyPoint2D getB() { - return (MyPoint2D) segment.getB(); - } - - public Arc withNoTension() { - return new Arc(getA(), getB(), Tension.none()); - } - - public Arc withTension(String tensionString) { - if (tensionString == null) { - return this; - } - final double newTension = Double.parseDouble(tensionString); - return new Arc(getA(), getB(), new Tension(newTension)); - } - - public Arc rotateZoom(RotationZoom rotationZoom) { - return new Arc(getA().rotateZoom(rotationZoom), getB().rotateZoom(rotationZoom), - tension.rotateZoom(rotationZoom)); - } - -// public void appendTo(UPath path) { -// if (tension.isNone()) { -// path.lineTo(getB()); -// } else { -// final double a = segment.getLength() / 2; -// final double b = getTension().getValue(); -// final double radius = (a * a + b * b) / 2 / b; -// final int sweep_flag = 1; -// path.arcTo(getB(), radius, 0, sweep_flag); -// } -// } - - public Point2D getTensionPoint() { - if (tension.isNone()) { - throw new IllegalArgumentException(); - } - return segment.getOrthoPoint(-tension.getValue()); - } - - // public void appendTo(UPath path) { - // if (path.isEmpty()) { - // path.moveTo(getA()); - // } - // path.lineTo(getB()); - // } - - public double getLength() { - return segment.getLength(); - } - -} diff --git a/src/net/sourceforge/plantuml/cute/Balloon.java b/src/net/sourceforge/plantuml/cute/Balloon.java deleted file mode 100644 index be33794ca..000000000 --- a/src/net/sourceforge/plantuml/cute/Balloon.java +++ /dev/null @@ -1,125 +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.cute; - -import java.awt.geom.Point2D; - -import net.sourceforge.plantuml.graphic.UDrawable; -import net.sourceforge.plantuml.ugraphic.UEllipse; -import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.UTranslate; - -public class Balloon implements UDrawable { - - private final Point2D center; - private final double radius; - - public Balloon(Point2D center, double radius) { - if (radius < 0) { - throw new IllegalArgumentException(); - } - this.center = center; - this.radius = radius; - } - - public static Balloon fromRadiusSegment(Segment centerToContact) { - throw new UnsupportedOperationException(); - } - - public Point2D getPointOnCircle(double a) { - return new Point2D.Double(center.getX() + radius * Math.cos(a), center.getY() + radius * Math.sin(a)); - } - - public Segment getSegmentCenterToPointOnCircle(double a) { - return new Segment(center, getPointOnCircle(a)); - } - - public Balloon translate(UTranslate translate) { - return new Balloon(translate.getTranslated(center), radius); - } - - public Balloon rotate(RotationZoom rotationZoom) { - return new Balloon(rotationZoom.getPoint(center), rotationZoom.applyZoom(radius)); - } - - @Override - public String toString() { - return "Balloon(" + center + "," + radius + ")"; - } - - public Point2D getCenter() { - return center; - } - - public double getRadius() { - return radius; - } - - public void drawU(UGraphic ug) { - UEllipse circle = new UEllipse(2 * radius, 2 * radius); - ug.apply(new UTranslate(center.getX() - circle.getWidth() / 2, center.getY() - circle.getHeight() / 2)).draw( - circle); - } - - public Balloon getInsideTangentBalloon1(double angle, double curvation) { - final double f = radius - curvation; - final double e = (radius * radius - f * f) / 2 / radius; - final RotationZoom rotation = RotationZoom.rotationInRadians(angle); - final Point2D p1 = rotation.getPoint(f, e); - final Point2D newCenter = new Point2D.Double(center.getX() + p1.getX(), center.getY() + p1.getY()); - return new Balloon(newCenter, e); - } - - public Balloon getInsideTangentBalloon2(double angle, double curvation) { - final double f = radius - curvation; - final double e = (radius * radius - f * f) / 2 / radius; - final RotationZoom rotation = RotationZoom.rotationInRadians(angle); - final Point2D p1 = rotation.getPoint(f, -e); - final Point2D newCenter = new Point2D.Double(center.getX() + p1.getX(), center.getY() + p1.getY()); - return new Balloon(newCenter, e); - } - - public Point2D getPointOnCirclePassingByThisPoint(Point2D passingBy) { - final Segment seg = new Segment(center, passingBy); - return seg.getFromAtoB(radius); - } - - public Point2D getPointOnCircleOppositeToThisPoint(Point2D passingBy) { - final Segment seg = new Segment(center, passingBy); - return seg.getFromAtoB(-radius); - } - -} diff --git a/src/net/sourceforge/plantuml/cute/BetweenCorners.java b/src/net/sourceforge/plantuml/cute/BetweenCorners.java deleted file mode 100644 index f090f7b36..000000000 --- a/src/net/sourceforge/plantuml/cute/BetweenCorners.java +++ /dev/null @@ -1,195 +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.cute; - -import java.awt.geom.Point2D; - -import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.UPath; - -public class BetweenCorners { - - private final TriangleCorner corner1; - private final TriangleCorner corner2; - private final Tension tension; - - private Balloon inside1; - private Balloon inside2; - private Balloon contact; - private Balloon apo; - private Point2D apopt1; - private Point2D apopt2; - - public BetweenCorners(TriangleCorner corner1, TriangleCorner corner2, Tension tension) { - this.corner1 = corner1; - this.corner2 = corner2; - this.tension = tension; - - if (corner1.hasCurvation()) { - inside1 = corner1.getBalloonInside(); - } - if (corner2.hasCurvation()) { - inside2 = corner2.getBalloonInside(); - } - if (tension.isNone() == false) { - contact = new Balloon(getTensionPoint(), getLength() / 1000.0); - } - - if (inside1 != null && inside2 != null && contact != null) { - apo = ApolloniusSolver2.solveApollonius(inside1, inside2, contact, 1, 1, 1); - apopt1 = apo.getPointOnCirclePassingByThisPoint(inside1.getCenter()); - apopt2 = apo.getPointOnCirclePassingByThisPoint(inside2.getCenter()); - } - - } - - public Point2D getPointJ() { - if (getCorner1().hasCurvation() == false) { - return getCorner1().getO(); - } - if (tension.isNone()) { - return getCorner1().getOnSegmentA(getCorner1().getCurvation()); - } - throw new UnsupportedOperationException(); - } - - public Point2D getPointK() { - if (getCorner1().hasCurvation() == false) { - return getCorner1().getO(); - } - if (tension.isNone()) { - return getCorner1().getOnSegmentB(getCorner1().getCurvation()); - } - throw new UnsupportedOperationException(); - } - - private double getBalloonRadius() { - return getCorner1().getBalloonInside().getRadius(); - } - - public void initPath(UPath path) { - if (apo != null) { - path.moveTo(apopt2); - } else { - path.moveTo(getPointK()); - } - } - - public void addToPath(UPath path, int swepFlag) { - if (apo != null) { - path.arcTo(apopt1, getCorner1().getBalloonInside().getRadius(), 0, 1); - path.arcTo(apopt2, apo.getRadius(), 0, 1); - // } else if (getTension().isNone()) { - // path.lineTo(getPointJ()); - // if (getCorner2().hasCurvation()) { - // path.arcTo(getPointK(), getBalloonRadius(), 0, swepFlag); - // } - // } else { - // // final int sweep_flag = 1; - // path.arcTo(getPointJ(), getRadiusFuzzy1(), 0, swepFlag); - // if (getCorner2().hasCurvation()) { - // path.arcTo(getPointK(), getBalloonRadius(), 0, swepFlag); - // } - // } - } else { - path.lineTo(getPointJ()); - if (getCorner1().hasCurvation()) { - path.arcTo(getPointK(), getBalloonRadius(), 0, swepFlag); - } - } - } - - public void debugMe(UGraphic ug) { - if (getCorner2().hasCurvation() == false) { - return; - } - if (tension.isNone()) { - return; - } - inside1.drawU(ug); - inside2.drawU(ug); - // getSegment().debugMe(ug); - contact.drawU(ug); - - new Balloon(apopt1, 5).drawU(ug); - new Balloon(apopt2, 5).drawU(ug); - - // getSegmentCross().debugMe(ug); - - apo.drawU(ug); - // - // final Point2D newCenter = getSegmentCross().getOrthoPoint(-50); - // new Segment(newCenter, getCorner1().getBalloonInside().getCenter()).debugMe(ug); - // new Segment(newCenter, getCorner2().getBalloonInside().getCenter()).debugMe(ug); - - } - - private double getRadiusFuzzy1() { - final double a = getLength() / 2; - final double b = getTension().getValue(); - final double radius = (a * a + b * b) / 2 / b; - return radius; - } - - private Segment getSegment() { - return new Segment(getCorner1().getO(), getCorner2().getO()); - } - - private Point2D getTensionPoint() { - return getSegment().getOrthoPoint(getTension().getValue()); - } - - private Segment getSegmentCross() { - return new Segment(getCorner1().getCornerOrBalloonCenter(), getCorner2().getCornerOrBalloonCenter()); - } - - public Tension getTension() { - return tension; - } - - public TriangleCorner getCorner1() { - return corner1; - } - - public TriangleCorner getCorner2() { - return corner2; - } - - public double getLength() { - return getSegment().getLength(); - } - -} diff --git a/src/net/sourceforge/plantuml/cute/Cheese.java b/src/net/sourceforge/plantuml/cute/Cheese.java deleted file mode 100644 index 480f41817..000000000 --- a/src/net/sourceforge/plantuml/cute/Cheese.java +++ /dev/null @@ -1,124 +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.cute; - -import java.awt.geom.Point2D; - -import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.UPath; - -public class Cheese implements CuteShape { - - private final MyDouble radius; - private final MyDouble startAngle; - private final MyDouble endAngle; - private final RotationZoom rotationZoom; - - public Cheese(VarArgs varArgs) { - this.radius = varArgs.getAsMyDouble("radius"); - this.startAngle = varArgs.getAsMyDouble("start").toRadians(); - this.endAngle = varArgs.getAsMyDouble("end").toRadians(); - this.rotationZoom = RotationZoom.none(); - } - - public Cheese(MyDouble radius, MyDouble startAngle, MyDouble endAngle, RotationZoom rotation) { - this.radius = radius; - this.startAngle = startAngle; - this.endAngle = endAngle; - this.rotationZoom = rotation; - } - - public void drawU(UGraphic ug) { - final Balloon balloon = new Balloon(new Point2D.Double(), radius.getValue()) - .rotate(rotationZoom); - - final double angle1 = rotationZoom.applyRotation(startAngle.getValue()); - final double angle2 = rotationZoom.applyRotation(endAngle.getValue()); - - final Point2D ptA = balloon.getPointOnCircle(angle1); - final Point2D ptB = balloon.getPointOnCircle(angle2); - - final UPath path = new UPath(); - final Point2D ptA0; - if (radius.hasCurvation()) { - ptA0 = balloon.getSegmentCenterToPointOnCircle(angle1).getFromAtoB(radius.getCurvation(0)); - path.moveTo(ptA0); - } else { - ptA0 = null; - path.moveTo(balloon.getCenter()); - } - final Balloon insideA; - if (startAngle.hasCurvation()) { - insideA = balloon.getInsideTangentBalloon1(angle1, startAngle.getCurvation(0)); - final Point2D ptA1 = balloon.getSegmentCenterToPointOnCircle(angle1).getFromAtoB( - radius.getValue() - startAngle.getCurvation(0)); - final Point2D ptA2 = balloon.getPointOnCirclePassingByThisPoint(insideA.getCenter()); - path.lineTo(ptA1); - path.arcTo(ptA2, insideA.getRadius(), 0, 1); - } else { - insideA = null; - path.lineTo(ptA); - } - final Balloon insideB; - if (endAngle.hasCurvation()) { - insideB = balloon.getInsideTangentBalloon2(angle2, endAngle.getCurvation(0)); - final Point2D ptB1 = balloon.getPointOnCirclePassingByThisPoint(insideB.getCenter()); - final Point2D ptB2 = balloon.getSegmentCenterToPointOnCircle(angle2).getFromAtoB( - radius.getValue() - endAngle.getCurvation(0)); - - path.arcTo(ptB1, balloon.getRadius(), 0, 1); - path.arcTo(ptB2, insideB.getRadius(), 0, 1); - } else { - insideB = null; - path.arcTo(ptB, balloon.getRadius(), 0, 1); - } - if (radius.hasCurvation()) { - final Point2D ptB0 = balloon.getSegmentCenterToPointOnCircle(angle2).getFromAtoB(radius.getCurvation(0)); - path.lineTo(ptB0); - path.arcTo(ptA0, radius.getCurvation(0), 0, 1); - } else { - path.lineTo(balloon.getCenter()); - } - path.closePath(); - ug.draw(path); - - } - - public CuteShape rotateZoom(RotationZoom other) { - return new Cheese(radius, startAngle, endAngle, rotationZoom.compose(other)); - } - -} diff --git a/src/net/sourceforge/plantuml/cute/Circle.java b/src/net/sourceforge/plantuml/cute/Circle.java deleted file mode 100644 index de53d4b73..000000000 --- a/src/net/sourceforge/plantuml/cute/Circle.java +++ /dev/null @@ -1,66 +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.cute; - -import net.sourceforge.plantuml.ugraphic.UEllipse; -import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.UTranslate; - -public class Circle implements CuteShape { - - private final double radius; - - public Circle(VarArgs varArgs) { - this.radius = varArgs.getAsDouble("radius"); - } - - private Circle(double radius) { - this.radius = radius; - } - - public void drawU(UGraphic ug) { - ug = ug.apply(new UTranslate(-radius, -radius)); - ug.draw(new UEllipse(2 * radius, 2 * radius)); - } - - public Circle rotateZoom(RotationZoom rotationZoom) { - if (rotationZoom.isNone()) { - return this; - } - return new Circle(rotationZoom.applyZoom(radius)); - } - -} diff --git a/src/net/sourceforge/plantuml/cute/Corner.java b/src/net/sourceforge/plantuml/cute/Corner.java deleted file mode 100644 index f471fb132..000000000 --- a/src/net/sourceforge/plantuml/cute/Corner.java +++ /dev/null @@ -1,46 +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.cute; - -public class Corner { - - private final double curvation; - - public Corner(double curvation) { - this.curvation = curvation; - } - -} diff --git a/src/net/sourceforge/plantuml/cute/Crossing.java b/src/net/sourceforge/plantuml/cute/Crossing.java deleted file mode 100644 index 1b472df84..000000000 --- a/src/net/sourceforge/plantuml/cute/Crossing.java +++ /dev/null @@ -1,68 +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.cute; - -import java.awt.geom.Point2D; -import java.util.ArrayList; -import java.util.List; - -import net.sourceforge.plantuml.ugraphic.UTranslate; - -public class Crossing { - - private final Balloon balloon; - private final InfiniteLine line; - - public Crossing(Balloon balloon, InfiniteLine line) { - this.balloon = balloon; - this.line = line; - } - - public List intersection() { - final List result = new ArrayList(); - - final UTranslate tr = new UTranslate(balloon.getCenter()); - final UTranslate trInverse = tr.reverse(); - - final CrossingSimple simple = new CrossingSimple(balloon.getRadius(), line.translate(trInverse)); - for (Point2D pt : simple.intersection()) { - result.add(tr.getTranslated(pt)); - } - - return result; - } - -} diff --git a/src/net/sourceforge/plantuml/cute/CrossingSegment.java b/src/net/sourceforge/plantuml/cute/CrossingSegment.java deleted file mode 100644 index ce3fd1ccf..000000000 --- a/src/net/sourceforge/plantuml/cute/CrossingSegment.java +++ /dev/null @@ -1,73 +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.cute; - -import java.awt.geom.Point2D; -import java.util.ArrayList; -import java.util.List; - -import net.sourceforge.plantuml.geom.LineSegmentDouble; -import net.sourceforge.plantuml.ugraphic.UTranslate; - -public class CrossingSegment { - - private final Balloon balloon; - private final LineSegmentDouble segment; - - public CrossingSegment(Balloon balloon, LineSegmentDouble segment) { - this.balloon = balloon; - this.segment = segment; - } - - public List intersection() { - final List result = new ArrayList(); - - final UTranslate tr = new UTranslate(balloon.getCenter()); - final UTranslate trInverse = tr.reverse(); - - final CrossingSimple simple = new CrossingSimple(balloon.getRadius(), - new InfiniteLine(segment).translate(trInverse)); - for (Point2D pt : simple.intersection()) { - pt = tr.getTranslated(pt); - if (segment.isPointOnSegment(pt)) { - result.add(pt); - } - } - - return result; - } - -} diff --git a/src/net/sourceforge/plantuml/cute/CrossingSimple.java b/src/net/sourceforge/plantuml/cute/CrossingSimple.java deleted file mode 100644 index 5c0b22723..000000000 --- a/src/net/sourceforge/plantuml/cute/CrossingSimple.java +++ /dev/null @@ -1,91 +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.cute; - -import java.awt.geom.Point2D; -import java.util.ArrayList; -import java.util.List; - -public class CrossingSimple { - - // http://mathworld.wolfram.com/Circle-LineIntersection.html - - private final double radius; - private final InfiniteLine line; - - public CrossingSimple(double radius, InfiniteLine line) { - this.radius = radius; - this.line = line; - } - - private double pow2(double x) { - return x * x; - } - - private double sgn(double x) { - if (x < 0) { - return -1; - } - return 1; - } - - public List intersection() { - final List result = new ArrayList(); - final double delta = pow2(radius * line.getDr()) - pow2(line.getDiscriminant()); - - if (delta < 0) { - return result; - } - - double x; - double y; - - x = (line.getDiscriminant() * line.getDeltaY() + sgn(line.getDeltaY()) * line.getDeltaX() * Math.sqrt(delta)) - / pow2(line.getDr()); - y = (-line.getDiscriminant() * line.getDeltaX() + Math.abs(line.getDeltaY()) * Math.sqrt(delta)) - / pow2(line.getDr()); - result.add(new Point2D.Double(x, y)); - - x = (line.getDiscriminant() * line.getDeltaY() - sgn(line.getDeltaY()) * line.getDeltaX() * Math.sqrt(delta)) - / pow2(line.getDr()); - y = (-line.getDiscriminant() * line.getDeltaX() - Math.abs(line.getDeltaY()) * Math.sqrt(delta)) - / pow2(line.getDr()); - result.add(new Point2D.Double(x, y)); - - return result; - } - -} diff --git a/src/net/sourceforge/plantuml/cute/CutePath.java b/src/net/sourceforge/plantuml/cute/CutePath.java deleted file mode 100644 index c2d314364..000000000 --- a/src/net/sourceforge/plantuml/cute/CutePath.java +++ /dev/null @@ -1,179 +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.cute; - -import java.awt.geom.Point2D; -import java.util.ArrayList; -import java.util.List; -import java.util.StringTokenizer; - -import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.UPath; -import net.sourceforge.plantuml.ugraphic.color.HColorNone; -import net.sourceforge.plantuml.ugraphic.color.HColorUtils; - -public class CutePath { - - private final List arcs = new ArrayList(); - - public CutePath(String value) { - - MyPoint2D lastAdded = null; - String tension = null; - - final StringTokenizer spl = new StringTokenizer(value, "~:", true); - while (spl.hasMoreTokens()) { - final String token = spl.nextToken(); - if (token.equals(":")) { - continue; - } else if (token.equals("~")) { - tension = spl.nextToken(); - final String next = spl.nextToken(); - if (next.equals("~") == false) { - throw new IllegalArgumentException(); - } - } else { - final StringTokenizer st = new StringTokenizer(token.replaceAll("[()]", ""), ",^"); - final MyPoint2D current = new MyPoint2D(st); - if (lastAdded != null) { - add(new Arc(lastAdded, current).withTension(tension)); - } - lastAdded = current; - tension = null; - } - } - add(new Arc(lastAdded, arcs.get(0).getA()).withTension(tension)); - - } - - public CutePath() { - } - - public void add(Arc arc) { - if (arcs.size() > 0) { - final Arc last = arcs.get(arcs.size() - 1); - if (last.getB().equals(arc.getA()) == false) { - throw new IllegalArgumentException("last=" + last.getB() + " arc=" + arc.getA()); - } - } - this.arcs.add(arc); - } - - private final MyPoint2D getMyPoint2D(int i) { - return getArc(i).getA(); - } - - private Arc getArc(int i) { - if (i == -1) { - return arcs.get(arcs.size() - 1); - } - if (i == arcs.size()) { - return arcs.get(0); - } - if (i == arcs.size() + 1) { - return arcs.get(1); - } - return arcs.get(i); - } - - private UPath toUPath() { - final TriangleCorner corner0 = new TriangleCorner(getMyPoint2D(0), getMyPoint2D(1), getMyPoint2D(2)); - final int swepFlag = corner0.determinant() < 0 ? 0 : 1; - - final UPath path = new UPath(); - final BetweenCorners betweenCornersLast = new BetweenCorners(getCorner(arcs.size() - 1), - getCorner(arcs.size()), arcs.get(arcs.size() - 1).getTension()); - betweenCornersLast.initPath(path); - for (int i = 0; i < arcs.size(); i++) { - - // if (i == 0) { - // if (getMyPoint2D(i).hasCurvation()) { - // path.moveTo(getPointK(i)); - // } else { - // path.moveTo(arcs.get(i).getA()); - // } - // } - - final BetweenCorners betweenCorners = new BetweenCorners(getCorner(i), getCorner(i + 1), arcs.get(i) - .getTension()); - betweenCorners.addToPath(path, swepFlag); - - } - path.closePath(); - return path; - } - - private void debugMe(UGraphic ug) { - for (int i = 0; i < arcs.size(); i++) { - final BetweenCorners betweenCorners = new BetweenCorners(getCorner(i), getCorner(i + 1), arcs.get(i) - .getTension()); - betweenCorners.debugMe(ug.apply(HColorUtils.BLACK).apply(new HColorNone().bg())); - } - } - - private Point2D getPointK(final int j) { - if (getMyPoint2D(j).hasCurvation()) { - return getCorner(j).getOnSegmentB(getMyPoint2D(j).getCurvation(0)); - } - return arcs.get(j - 1).getB(); - } - - private TriangleCorner getCorner(int i) { - return new TriangleCorner(getMyPoint2D(i), getMyPoint2D(i - 1), getMyPoint2D(i + 1)); - } - - public void drawU(UGraphic ug) { - final UPath path = toUPath(); - ug.draw(path); -// debugMe(ug); - } - - public CutePath rotateZoom(RotationZoom rotationZoom) { - final CutePath result = new CutePath(); - for (Arc arc : arcs) { - result.arcs.add(arc.rotateZoom(rotationZoom)); - } - return result; - } - - public CutePath withNoTension() { - final CutePath result = new CutePath(); - for (Arc arc : arcs) { - result.arcs.add(arc.withNoTension()); - } - return result; - } -} diff --git a/src/net/sourceforge/plantuml/cute/CuteShape.java b/src/net/sourceforge/plantuml/cute/CuteShape.java deleted file mode 100644 index dff2d8a9f..000000000 --- a/src/net/sourceforge/plantuml/cute/CuteShape.java +++ /dev/null @@ -1,44 +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.cute; - -import net.sourceforge.plantuml.graphic.UDrawable; - -public interface CuteShape extends UDrawable { - - public UDrawable rotateZoom(RotationZoom other); - -} diff --git a/src/net/sourceforge/plantuml/cute/CuteShapeFactory.java b/src/net/sourceforge/plantuml/cute/CuteShapeFactory.java deleted file mode 100644 index 20f93328d..000000000 --- a/src/net/sourceforge/plantuml/cute/CuteShapeFactory.java +++ /dev/null @@ -1,84 +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.cute; - -import java.util.Map; - -import net.sourceforge.plantuml.StringUtils; - -public class CuteShapeFactory { - - private final Map groups; - - public CuteShapeFactory(Map groups) { - this.groups = groups; - - } - - public Positionned createCuteShapePositionned(String data) { - final VarArgs varArgs = new VarArgs(data); - return new PositionnedImpl(createCuteShape(data), varArgs); - } - - private CuteShape createCuteShape(String data) { - data = StringUtils.trin(data.toLowerCase()); - final VarArgs varArgs = new VarArgs(data); - if (data.startsWith("circle ")) { - return new Circle(varArgs); - } - if (data.startsWith("cheese ")) { - return new Cheese(varArgs); - } - if (data.startsWith("stick ")) { - return new Stick(varArgs); - } - if (data.startsWith("rectangle ") || data.startsWith("rect ")) { - return new Rectangle(varArgs); - } - if (data.startsWith("triangle ")) { - return new Triangle(varArgs); - } - final String first = data.split(" ")[0]; - // System.err.println("Looking for group " + first + " in " + groups.keySet()); - final Group group = groups.get(first); - if (group == null) { - throw new IllegalArgumentException("Cannot find group " + first + " in " + groups.keySet()); - } - // System.err.println("Found group " + first + " in " + groups.keySet()); - return group; - } - -} diff --git a/src/net/sourceforge/plantuml/cute/Group.java b/src/net/sourceforge/plantuml/cute/Group.java deleted file mode 100644 index 883a33517..000000000 --- a/src/net/sourceforge/plantuml/cute/Group.java +++ /dev/null @@ -1,126 +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.cute; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.UTranslate; - -public class Group implements Positionned { - - private final String groupName; - private final List shapes; - private final Group parent; - private final Map children; - - // private final List children = new ArrayList(); - - @Override - public String toString() { - return "Group " + groupName + " (" + shapes.size() + ") "; - } - - // public static Group fromList(List shapes) { - // return new Group("Automatic", shapes); - // } - - public static Group createRoot() { - return new Group(null, "ROOT"); - } - - private Group(Group parent, String groupName) { - this.parent = parent; - this.groupName = groupName; - this.shapes = new ArrayList(); - this.children = new HashMap(); - } - - private Group(Group parent, String groupName, List shapes) { - this.parent = parent; - this.groupName = groupName; - this.shapes = shapes; - this.children = null; - } - - public Group createChild(String childName) { - final Group result = new Group(this, childName); - this.children.put(childName, result); - return result; - } - - public void drawU(UGraphic ug) { - for (Positionned shape : shapes) { - shape.drawU(ug); - } - } - - public void add(Positionned shape) { - shapes.add(shape); - } - - public String getName() { - return groupName; - } - - public Positionned rotateZoom(RotationZoom rotationZoom) { - if (rotationZoom.isNone()) { - return this; - } - final List result = new ArrayList(); - for (Positionned shape : shapes) { - result.add(shape.rotateZoom(rotationZoom)); - } - return new Group(parent, groupName + "->" + rotationZoom, result); - } - - public Positionned translate(UTranslate translation) { - throw new UnsupportedOperationException(); - } - - public Group getParent() { - return parent; - } - - public Map getChildren() { - return Collections.unmodifiableMap(children); - } - -} diff --git a/src/net/sourceforge/plantuml/cute/InfiniteLine.java b/src/net/sourceforge/plantuml/cute/InfiniteLine.java deleted file mode 100644 index aa7f06d8f..000000000 --- a/src/net/sourceforge/plantuml/cute/InfiniteLine.java +++ /dev/null @@ -1,82 +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.cute; - -import java.awt.geom.Point2D; - -import net.sourceforge.plantuml.geom.AbstractLineSegment; -import net.sourceforge.plantuml.ugraphic.UTranslate; - -public class InfiniteLine { - - private final Point2D a; - private final Point2D b; - - public InfiniteLine(Point2D a, Point2D b) { - this.a = a; - this.b = b; - } - - public InfiniteLine(AbstractLineSegment segment) { - this(segment.getP1(), segment.getP2()); - } - - @Override - public String toString() { - return "{" + a + ";" + b + "}"; - } - - public double getDeltaX() { - return b.getX() - a.getX(); - } - - public double getDeltaY() { - return b.getY() - a.getY(); - } - - public double getDr() { - return a.distance(b); - } - - public double getDiscriminant() { - return a.getX() * b.getY() - b.getX() * a.getY(); - } - - public InfiniteLine translate(UTranslate translate) { - return new InfiniteLine(translate.getTranslated(a), translate.getTranslated(b)); - } - -} diff --git a/src/net/sourceforge/plantuml/cute/MyDouble.java b/src/net/sourceforge/plantuml/cute/MyDouble.java deleted file mode 100644 index 8595ca2d2..000000000 --- a/src/net/sourceforge/plantuml/cute/MyDouble.java +++ /dev/null @@ -1,91 +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.cute; - -import java.util.StringTokenizer; - -public class MyDouble { - - private static final double NO_CURVE = java.lang.Double.MIN_VALUE; - private final double value; - private final double curvation; - - public MyDouble(String s) { - final StringTokenizer st = new StringTokenizer(s, ","); - this.value = java.lang.Double.parseDouble(st.nextToken()); - if (st.hasMoreTokens()) { - this.curvation = java.lang.Double.parseDouble(st.nextToken()); - } else { - this.curvation = NO_CURVE; - } - } - - @Override - public String toString() { - return value + "[" + curvation + "]"; - } - - private MyDouble(double value, double curvation) { - this.value = value; - this.curvation = curvation; - } - - public double getCurvation(double def) { - if (curvation == NO_CURVE) { - return def; - } - return curvation; - } - - public double getValue() { - return value; - } - - public boolean hasCurvation() { - return curvation != NO_CURVE; - } - - public MyDouble rotateZoom(RotationZoom rotationZoom) { - final double newValue = rotationZoom.applyZoom(value); - final double curvation = this.curvation == NO_CURVE ? NO_CURVE : rotationZoom.applyZoom(this.curvation); - return new MyDouble(newValue, curvation); - } - - public MyDouble toRadians() { - return new MyDouble(Math.toRadians(value), curvation); - } - -} diff --git a/src/net/sourceforge/plantuml/cute/MyPoint2D.java b/src/net/sourceforge/plantuml/cute/MyPoint2D.java deleted file mode 100644 index b48707fed..000000000 --- a/src/net/sourceforge/plantuml/cute/MyPoint2D.java +++ /dev/null @@ -1,121 +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.cute; - -import java.awt.geom.Point2D; -import java.util.StringTokenizer; - -public class MyPoint2D extends Point2D { - - public static final double NO_CURVE = 0; - private final double x; - private final double y; - private final double curvation; - - public MyPoint2D(StringTokenizer st) { - this.x = java.lang.Double.parseDouble(st.nextToken()); - this.y = java.lang.Double.parseDouble(st.nextToken()); - if (st.hasMoreTokens()) { - this.curvation = java.lang.Double.parseDouble(st.nextToken()); - } else { - this.curvation = NO_CURVE; - } - } - - @Override - public boolean equals(Object arg0) { - final MyPoint2D other = (MyPoint2D) arg0; - return this.x == other.x && this.y == other.y && this.curvation == other.curvation; - } - - public static MyPoint2D from(double x, double y) { - return new MyPoint2D(x, y, NO_CURVE); - } - - public MyPoint2D withCurvation(double curvation) { - if (curvation == NO_CURVE) { - return this; - } - return new MyPoint2D(x, y, curvation); - } - - private MyPoint2D(Point2D p, double curvation) { - this.x = p.getX(); - this.y = p.getY(); - this.curvation = curvation; - } - - private MyPoint2D(double x, double y, double curvation) { - this.x = x; - this.y = y; - this.curvation = curvation; - } - - @Override - public String toString() { - return "(" + x + "," + y + ")"; - } - - public double getCurvation(double def) { - if (curvation == NO_CURVE) { - return def; - } - return curvation; - } - - public double getX() { - return x; - } - - public double getY() { - return y; - } - - public void setLocation(double arg0, double arg1) { - throw new UnsupportedOperationException(); - } - - public MyPoint2D rotateZoom(RotationZoom rotationZoom) { - final Point2D p = rotationZoom.getPoint(x, y); - final double curvation = this.curvation == NO_CURVE ? NO_CURVE : rotationZoom.applyZoom(this.curvation); - return new MyPoint2D(p, curvation); - } - - public boolean hasCurvation() { - return curvation != NO_CURVE; - } - -} diff --git a/src/net/sourceforge/plantuml/cute/PSystemCute.java b/src/net/sourceforge/plantuml/cute/PSystemCute.java deleted file mode 100644 index b9beedd4a..000000000 --- a/src/net/sourceforge/plantuml/cute/PSystemCute.java +++ /dev/null @@ -1,109 +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.cute; - -import java.io.IOException; -import java.io.OutputStream; -import java.util.StringTokenizer; - -import net.sourceforge.plantuml.AbstractPSystem; -import net.sourceforge.plantuml.FileFormatOption; -import net.sourceforge.plantuml.SkinParam; -import net.sourceforge.plantuml.StringUtils; -import net.sourceforge.plantuml.UseStyle; -import net.sourceforge.plantuml.core.DiagramDescription; -import net.sourceforge.plantuml.core.ImageData; -import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft; -import net.sourceforge.plantuml.ugraphic.ImageBuilder; -import net.sourceforge.plantuml.ugraphic.ImageParameter; -import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; - -public class PSystemCute extends AbstractPSystem { - - // private final List shapes = new ArrayList(); - // private final Map groups = new HashMap(); - private final Group root = Group.createRoot(); - private Group currentGroup = root; - - public PSystemCute() { - } - - public DiagramDescription getDescription() { - return new DiagramDescription("(Cute)"); - } - - public void doCommandLine(String line) { - line = StringUtils.trin(line); - if (line.length() == 0 || line.startsWith("'")) { - return; - } - if (line.startsWith("group ")) { - final StringTokenizer st = new StringTokenizer(line); - st.nextToken(); - final String groupName = st.nextToken(); - currentGroup = currentGroup.createChild(groupName); - } else if (line.startsWith("}")) { - currentGroup = currentGroup.getParent(); - } else { - final Positionned shape = new CuteShapeFactory(currentGroup.getChildren()).createCuteShapePositionned(line); - // if (currentGroup == null) { - // shapes.add(shape); - // } else { - currentGroup.add(shape); - // } - } - } - - @Override - final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) - throws IOException { - final int margin1; - final int margin2; - if (UseStyle.useBetaStyle()) { - margin1 = SkinParam.zeroMargin(10); - margin2 = SkinParam.zeroMargin(10); - } else { - margin1 = 10; - margin2 = 10; - } - final ClockwiseTopRightBottomLeft margins = ClockwiseTopRightBottomLeft.margin1margin2(margin1, margin2); - final ImageParameter imageParameter = new ImageParameter(new ColorMapperIdentity(), false, null, null, - null, margins, null); - final ImageBuilder builder = ImageBuilder.build(imageParameter); - builder.setUDrawable(root); - return builder.writeImageTOBEMOVED(fileFormat, seed, os); - } -} diff --git a/src/net/sourceforge/plantuml/cute/PSystemCuteFactory.java b/src/net/sourceforge/plantuml/cute/PSystemCuteFactory.java deleted file mode 100644 index 3da894135..000000000 --- a/src/net/sourceforge/plantuml/cute/PSystemCuteFactory.java +++ /dev/null @@ -1,61 +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.cute; - -import net.sourceforge.plantuml.command.PSystemBasicFactory; -import net.sourceforge.plantuml.core.DiagramType; - -public class PSystemCuteFactory extends PSystemBasicFactory { - - public PSystemCuteFactory(DiagramType type) { - super(type); - } - - public PSystemCute init(String startLine) { - if (getDiagramType() == DiagramType.CUTE) { - return new PSystemCute(); - } - - return null; - } - - @Override - public PSystemCute executeLine(PSystemCute system, String line) { - system.doCommandLine(line); - return system; - } - -} diff --git a/src/net/sourceforge/plantuml/cute/Positionned.java b/src/net/sourceforge/plantuml/cute/Positionned.java deleted file mode 100644 index cda27eb70..000000000 --- a/src/net/sourceforge/plantuml/cute/Positionned.java +++ /dev/null @@ -1,46 +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.cute; - -import net.sourceforge.plantuml.ugraphic.UTranslate; - -public interface Positionned extends CuteShape { - - public Positionned rotateZoom(RotationZoom rotation); - - public Positionned translate(UTranslate translation); - -} diff --git a/src/net/sourceforge/plantuml/cute/PositionnedImpl.java b/src/net/sourceforge/plantuml/cute/PositionnedImpl.java deleted file mode 100644 index aa7b1febe..000000000 --- a/src/net/sourceforge/plantuml/cute/PositionnedImpl.java +++ /dev/null @@ -1,105 +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.cute; - -import net.sourceforge.plantuml.graphic.UDrawable; -import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.UTranslate; -import net.sourceforge.plantuml.ugraphic.color.HColor; -import net.sourceforge.plantuml.ugraphic.color.HColorUtils; - -public class PositionnedImpl implements Positionned { - - private final CuteShape cuteShape; - private final HColor color; - private final UTranslate position; - private final RotationZoom rotationZoom; - - @Override - public String toString() { - return "Positionned " + position + " " + cuteShape; - } - - public PositionnedImpl(CuteShape cuteShape, VarArgs args) { - this.cuteShape = cuteShape; - this.color = args.getAsColor("color"); - this.position = args.getPosition(); - this.rotationZoom = RotationZoom.fromVarArgs(args); - } - - private PositionnedImpl(CuteShape cuteShape, HColor color, UTranslate position, RotationZoom rotationZoom) { - this.cuteShape = cuteShape; - this.color = color; - this.position = position; - this.rotationZoom = rotationZoom; - } - - public PositionnedImpl(Group group, RotationZoom rotation) { - this.cuteShape = group; - this.color = HColorUtils.BLACK; - this.position = new UTranslate(); - this.rotationZoom = rotation; - } - - public PositionnedImpl(Group group, UTranslate translation) { - this.cuteShape = group; - this.color = HColorUtils.BLACK; - this.position = translation; - this.rotationZoom = RotationZoom.none(); - } - - private UGraphic applyColor(UGraphic ug) { - return ug.apply(color.bg()).apply(color); - - } - - public void drawU(UGraphic ug) { - ug = applyColor(ug); - ug = ug.apply(position); - final UDrawable tmp = rotationZoom.isNone() ? cuteShape : cuteShape.rotateZoom(rotationZoom); - // System.err.println("rotationZoom=" + rotationZoom + " tmp=" + tmp); - tmp.drawU(ug); - } - - public Positionned rotateZoom(RotationZoom other) { - return new PositionnedImpl(cuteShape, color, other.getUTranslate(position), rotationZoom.compose(other)); - } - - public Positionned translate(UTranslate other) { - return new PositionnedImpl(cuteShape, color, position.compose(other), rotationZoom); - } - -} diff --git a/src/net/sourceforge/plantuml/cute/Rectangle.java b/src/net/sourceforge/plantuml/cute/Rectangle.java deleted file mode 100644 index e5aa37451..000000000 --- a/src/net/sourceforge/plantuml/cute/Rectangle.java +++ /dev/null @@ -1,106 +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.cute; - -import java.awt.geom.Point2D; - -import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.UPath; - -public class Rectangle implements CuteShape { - - private final double width; - private final double height; - private final RotationZoom rotationZoom; - private final double curvation; - - public Rectangle(VarArgs varArgs) { - final Point2D dim = varArgs.getAsPoint("dimension"); - this.width = dim.getX(); - this.height = dim.getY(); - this.rotationZoom = RotationZoom.none(); - this.curvation = varArgs.getAsDouble("curve", MyPoint2D.NO_CURVE); - } - - private Rectangle(double width, double height, RotationZoom rotationZoom, double curvation) { - this.width = width; - this.height = height; - this.rotationZoom = rotationZoom; - this.curvation = curvation; - } - - public void drawU(UGraphic ug) { - CutePath cutePath = new CutePath(); - cutePath.add(new Arc(MyPoint2D.from(0, 0).withCurvation(curvation), MyPoint2D.from(width, 0).withCurvation( - curvation))); - cutePath.add(new Arc(MyPoint2D.from(width, 0).withCurvation(curvation), MyPoint2D.from(width, height) - .withCurvation(curvation))); - cutePath.add(new Arc(MyPoint2D.from(width, height).withCurvation(curvation), MyPoint2D.from(0, height) - .withCurvation(curvation))); - cutePath.add(new Arc(MyPoint2D.from(0, height).withCurvation(curvation), MyPoint2D.from(0, 0).withCurvation( - curvation))); - cutePath = cutePath.rotateZoom(rotationZoom); - cutePath.drawU(ug); - } - - public void drawUOld(UGraphic ug) { - final UPath path = new UPath(); - if (curvation == MyPoint2D.NO_CURVE) { - path.moveTo(rotationZoom.getPoint(0, 0)); - path.lineTo(rotationZoom.getPoint(width, 0)); - path.lineTo(rotationZoom.getPoint(width, height)); - path.lineTo(rotationZoom.getPoint(0, height)); - path.lineTo(rotationZoom.getPoint(0, 0)); - } else { - path.moveTo(rotationZoom.getPoint(width, curvation)); - path.lineTo(rotationZoom.getPoint(width, height - curvation)); - path.arcTo(rotationZoom.getPoint(width - curvation, height), curvation, 0, 1); - path.lineTo(rotationZoom.getPoint(curvation, height)); - path.arcTo(rotationZoom.getPoint(0, height - curvation), curvation, 0, 1); - path.lineTo(rotationZoom.getPoint(0, curvation)); - path.arcTo(rotationZoom.getPoint(curvation, 0), curvation, 0, 1); - path.lineTo(rotationZoom.getPoint(width - curvation, 0)); - path.arcTo(rotationZoom.getPoint(width, curvation), curvation, 0, 1); - } - path.closePath(); - ug.draw(path); - } - - public Rectangle rotateZoom(RotationZoom other) { - return new Rectangle(width, height, rotationZoom.compose(other), curvation); - } - -} diff --git a/src/net/sourceforge/plantuml/cute/RotationZoom.java b/src/net/sourceforge/plantuml/cute/RotationZoom.java deleted file mode 100644 index 6f905538a..000000000 --- a/src/net/sourceforge/plantuml/cute/RotationZoom.java +++ /dev/null @@ -1,129 +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.cute; - -import java.awt.geom.Point2D; - -import net.sourceforge.plantuml.ugraphic.UTranslate; - -public class RotationZoom { - - private final double angle; - private final double zoom; - - private RotationZoom(double angle, double zoom) { - if (zoom < 0) { - throw new IllegalArgumentException(); - } - this.angle = angle; - this.zoom = zoom; - } - - public RotationZoom compose(RotationZoom other) { - return new RotationZoom(this.angle + other.angle, this.zoom * other.zoom); - } - - @Override - public String toString() { - return "Rotation=" + Math.toDegrees(angle) + " Zoom=" + zoom; - } - - public static RotationZoom fromVarArgs(VarArgs varArgs) { - final double radians = Math.toRadians(varArgs.getAsDouble("rotation", 0)); - final double scale = varArgs.getAsDouble("scale", 1); - return new RotationZoom(radians, scale); - } - - public static RotationZoom rotationInDegrees(double angle) { - return new RotationZoom(Math.toRadians(angle), 1); - } - - public static RotationZoom rotationInRadians(double angle) { - return new RotationZoom(angle, 1); - } - - public static RotationZoom zoom(double zoom) { - return new RotationZoom(0, zoom); - } - - public RotationZoom inverse() { - return new RotationZoom(-angle, 1 / zoom); - } - - public double getAngleDegree() { - return Math.toDegrees(angle); - } - - static public RotationZoom builtRotationOnYaxis(Point2D toRotate) { - final double a = Math.atan2(toRotate.getX(), toRotate.getY()); - return new RotationZoom(a, 1); - } - - public Point2D.Double getPoint(double x, double y) { - if (angle == 0) { - return new Point2D.Double(x * zoom, y * zoom); - } - final double x1 = Math.cos(angle) * x - Math.sin(angle) * y; - final double y1 = Math.sin(angle) * x + Math.cos(angle) * y; - return new Point2D.Double(x1 * zoom, y1 * zoom); - } - - public Point2D getPoint(Point2D p) { - return getPoint(p.getX(), p.getY()); - } - - public UTranslate getUTranslate(UTranslate translate) { - return new UTranslate(getPoint(translate.getDx(), translate.getDy())); - - } - - public static RotationZoom none() { - return new RotationZoom(0, 1); - } - - public boolean isNone() { - return angle == 0 && zoom == 1; - } - - public double applyZoom(double value) { - return value * zoom; - } - - public double applyRotation(double alpha) { - return angle + alpha; - } - -} diff --git a/src/net/sourceforge/plantuml/cute/Segment.java b/src/net/sourceforge/plantuml/cute/Segment.java deleted file mode 100644 index 475920ff3..000000000 --- a/src/net/sourceforge/plantuml/cute/Segment.java +++ /dev/null @@ -1,110 +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.cute; - -import java.awt.geom.Point2D; - -import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.ULine; -import net.sourceforge.plantuml.ugraphic.UTranslate; - -public class Segment { - - private final Point2D a; - private final Point2D b; - private final double length; - - public Segment(Point2D a, Point2D b) { - this.a = a; - this.b = b; - this.length = a.distance(b); - if (length < 0.0001) { - throw new IllegalArgumentException(); - } - } - - public Point2D getFromAtoB(double dist) { - final double dx = b.getX() - a.getX(); - final double dy = b.getY() - a.getY(); - final double coef = dist / length; - final double x = dx * coef; - final double y = dy * coef; - return new Point2D.Double(a.getX() + x, a.getY() + y); - } - - public Point2D getA() { - return a; - } - - public Point2D getB() { - return b; - } - - public Point2D getMiddle() { - return new Point2D.Double((a.getX() + b.getX()) / 2, (a.getY() + b.getY()) / 2); - } - - private Point2D orthoDirection() { - final double dx = b.getX() - a.getX(); - final double dy = b.getY() - a.getY(); - return new Point2D.Double(-dy / length, dx / length); - } - - public Point2D getOrthoPoint(double value) { - final Point2D ortho = orthoDirection(); - final double dx = -ortho.getX() * value; - final double dy = -ortho.getY() * value; - return new Point2D.Double((a.getX() + b.getX()) / 2 + dx, (a.getY() + b.getY()) / 2 + dy); - } - - - private boolean isLeft(Point2D point) { - return ((b.getX() - a.getX()) * (point.getY() - a.getY()) - (b.getY() - a.getY()) * (point.getX() - a.getX())) > 0; - } - - public double getLength() { - return length; - } - - public void debugMe(UGraphic ug) { - final double dx = b.getX() - a.getX(); - final double dy = b.getY() - a.getY(); - ug = ug.apply(new UTranslate(a)); - ug.draw(new ULine(dx, dy)); - - } - -} diff --git a/src/net/sourceforge/plantuml/cute/Stick.java b/src/net/sourceforge/plantuml/cute/Stick.java deleted file mode 100644 index 0da331f89..000000000 --- a/src/net/sourceforge/plantuml/cute/Stick.java +++ /dev/null @@ -1,100 +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.cute; - -import java.awt.geom.Point2D; - -import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.UPath; - -public class Stick implements CuteShape { - - private final double width; - private final double height; - private final RotationZoom rotationZoom; - - public Stick(VarArgs varArgs) { - final Point2D dim = varArgs.getAsPoint("dimension"); - this.width = dim.getX(); - this.height = dim.getY(); - this.rotationZoom = RotationZoom.none(); - } - - private Stick(double width, double height, RotationZoom rotation) { - this.width = width; - this.height = height; - this.rotationZoom = rotation; - } - - public void drawU(UGraphic ug) { - if (width > height) { - drawRotate1(ug); - } else { - drawRotate2(ug); - } - } - - private void drawRotate1(UGraphic ug) { - assert width > height; - final UPath path = new UPath(); - final double small = height / 2; - path.moveTo(rotationZoom.getPoint(small, 0)); - path.lineTo(rotationZoom.getPoint(width - small, 0)); - path.arcTo(rotationZoom.getPoint(width - small, height), small, 0, 1); - path.lineTo(rotationZoom.getPoint(small, height)); - path.arcTo(rotationZoom.getPoint(small, 0), small, 0, 1); - path.closePath(); - ug.draw(path); - } - - private void drawRotate2(UGraphic ug) { - assert height > width; - final UPath path = new UPath(); - final double small = width / 2; - path.moveTo(rotationZoom.getPoint(width, small)); - path.lineTo(rotationZoom.getPoint(width, height - small)); - path.arcTo(rotationZoom.getPoint(0, height - small), small, 0, 1); - path.lineTo(rotationZoom.getPoint(0, small)); - path.arcTo(rotationZoom.getPoint(width, small), small, 0, 1); - path.closePath(); - ug.draw(path); - } - - public Stick rotateZoom(RotationZoom other) { - return new Stick(width, height, this.rotationZoom.compose(other)); - } - -} diff --git a/src/net/sourceforge/plantuml/cute/Tension.java b/src/net/sourceforge/plantuml/cute/Tension.java deleted file mode 100644 index 41ad9da45..000000000 --- a/src/net/sourceforge/plantuml/cute/Tension.java +++ /dev/null @@ -1,62 +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.cute; - -public class Tension { - - private final double tension; - - public Tension(double tension) { - this.tension = tension; - } - - public static Tension none() { - return new Tension(0); - } - - public Tension rotateZoom(RotationZoom rotationZoom) { - return new Tension(rotationZoom.applyZoom(tension)); - } - - public boolean isNone() { - return tension == 0; - } - - public double getValue() { - return tension; - } - -} diff --git a/src/net/sourceforge/plantuml/cute/Triangle.java b/src/net/sourceforge/plantuml/cute/Triangle.java deleted file mode 100644 index c25a95dee..000000000 --- a/src/net/sourceforge/plantuml/cute/Triangle.java +++ /dev/null @@ -1,62 +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.cute; - -import net.sourceforge.plantuml.ugraphic.UGraphic; - -public class Triangle implements CuteShape { - - private final CutePath cutePath; - - public Triangle(VarArgs varArgs) { - this(varArgs.getPointList("points")); - } - - private Triangle(CutePath cutePath) { - this.cutePath = cutePath; - } - - public Triangle rotateZoom(final RotationZoom angle) { - if (angle.isNone()) { - return this; - } - return new Triangle(cutePath.rotateZoom(angle)); - } - - public void drawU(UGraphic ug) { - cutePath.drawU(ug); - } -} diff --git a/src/net/sourceforge/plantuml/cute/TriangleCorner.java b/src/net/sourceforge/plantuml/cute/TriangleCorner.java deleted file mode 100644 index 7e5441ccd..000000000 --- a/src/net/sourceforge/plantuml/cute/TriangleCorner.java +++ /dev/null @@ -1,143 +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.cute; - -import java.awt.geom.Point2D; - -import net.sourceforge.plantuml.ugraphic.UTranslate; - -public class TriangleCorner { - - private final Point2D o; - private final Point2D a; - private final Point2D b; - private final TriangleCornerSimple simple; - private final UTranslate translateO; - private final UTranslate translateOreverse; - - private final RotationZoom rotation; - private final RotationZoom rotationInverse; - - @Override - public String toString() { - return "Corner " + o + " a=" + a + " b=" + b; - } - - public boolean hasCurvation() { - return ((MyPoint2D) o).hasCurvation(); - } - - public double getCurvation() { - if (hasCurvation() == false) { - throw new IllegalStateException(); - } - return ((MyPoint2D) o).getCurvation(0); - } - - public TriangleCorner(Point2D o, Point2D a, Point2D b) { - this.o = o; - this.a = a; - this.b = b; - this.translateO = new UTranslate(o); - this.translateOreverse = translateO.reverse(); - final Point2D a2 = translateOreverse.getTranslated(a); - final Point2D b2 = translateOreverse.getTranslated((b)); - - final Point2D a3, b3; - if (a2.getX() == 0) { - a3 = a2; - b3 = b2; - this.rotation = RotationZoom.none(); - this.rotationInverse = RotationZoom.none(); - } else { - this.rotation = RotationZoom.builtRotationOnYaxis(a2); - this.rotationInverse = rotation.inverse(); - a3 = rotation.getPoint(a2); - b3 = rotation.getPoint(b2); - } - - this.simple = new TriangleCornerSimple(a3, b3); - } - - public Point2D getOnSegmentA(double dist) { - final Segment seg = new Segment(o, a); - return seg.getFromAtoB(dist); - } - - public Point2D getOnSegmentB(double dist) { - final Segment seg = new Segment(o, b); - return seg.getFromAtoB(dist); - } - - public Balloon getCenterWithFixedRadius(double radius) { - final Point2D centerSimple = simple.getCenterWithFixedRadius(radius); - return new Balloon(rotationInverse.getPoint(translateO.getTranslated(centerSimple)), radius); - } - - private Balloon getBalloonWithFixedY(double y) { - Balloon result = simple.getBalloonWithFixedY(y); - result = result.rotate(rotationInverse); - result = result.translate(translateO); - return result; - } - - public Point2D getCornerOrBalloonCenter() { - if (hasCurvation()) { - return getBalloonInside().getCenter(); - } - return getO(); - } - - public double determinant() { - final double ux = a.getX() - o.getX(); - final double uy = a.getY() - o.getY(); - final double vx = b.getX() - o.getX(); - final double vy = b.getY() - o.getY(); - return ux * vy - uy * vx; - } - - public Point2D getO() { - return o; - } - - public Balloon getBalloonInside() { - if (hasCurvation() == false) { - throw new IllegalStateException(); - } - return getBalloonWithFixedY(getCurvation()); - } - -} diff --git a/src/net/sourceforge/plantuml/cute/TriangleCornerSimple.java b/src/net/sourceforge/plantuml/cute/TriangleCornerSimple.java deleted file mode 100644 index f0ac7cd90..000000000 --- a/src/net/sourceforge/plantuml/cute/TriangleCornerSimple.java +++ /dev/null @@ -1,117 +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.cute; - -import java.awt.geom.Point2D; - -public class TriangleCornerSimple { - - private final Point2D a; - private final Point2D b; - - @Override - public String toString() { - return "TriangleCornerSimple a=" + a + " " + Math.toDegrees(getAngleA()) + " b=" + b + " " - + Math.toDegrees(getAngleB()); - } - - public TriangleCornerSimple(Point2D a, Point2D b) { - if (isZero(a.getX()) == false) { - throw new IllegalArgumentException("a=" + a); - } - this.a = a; - this.b = b; - } - - private static boolean isZero(double v) { - return Math.abs(v) < 0.0001; - } - - double getAngleA() { - return getAngle(a); - } - - double getAngleB() { - return getAngle(b); - } - - double getAngle(Point2D pt) { - final double dx = pt.getX(); - final double dy = pt.getY(); - return Math.atan2(dy, dx); - - } - - static double solveY(double alpha, double x) { - if (alpha < 0 || alpha > Math.PI / 2) { - throw new IllegalArgumentException(); - } - return x * Math.tan(alpha); - } - - static double solveX(double alpha, double y) { - if (alpha < -Math.PI / 2 || alpha > Math.PI / 2) { - // throw new IllegalArgumentException("y=" + y + " alpha=" + Math.toDegrees(alpha)); - } - final double beta = Math.PI / 2 - alpha; - // System.err.println("alpha1=" + Math.toDegrees(alpha)); - // System.err.println("beta11=" + Math.toDegrees(beta)); - // System.err.println("XX=" + y * Math.tan(beta)); - return y * Math.tan(beta); - - } - - public Point2D getCenterWithFixedRadius(double radius) { - final double alpha = (getAngleA() + getAngleB()) / 2; - final double y = solveY(alpha, radius); - return new Point2D.Double(radius, y); - } - - public Balloon getBalloonWithFixedY(double y) { - // System.err.println("TriangleCornerSimple::getCenterWithFixedY y=" + y); - // System.err.println("a=" + a + " " + Math.toDegrees(getAngleA())); - // System.err.println("b=" + b + " " + Math.toDegrees(getAngleB())); - final double alpha = (getAngleA() + getAngleB()) / 2; - // System.err.println("alpha=" + Math.toDegrees(alpha)); - final double sign = Math.signum(a.getY()); - // System.err.println("sgn=" + sign); - final double x = solveX(alpha, y); - final Balloon result = new Balloon(new Point2D.Double(x * sign, y * sign), Math.abs(x)); - // System.err.println("result=" + result); - return result; - } - -} diff --git a/src/net/sourceforge/plantuml/cute/VarArgs.java b/src/net/sourceforge/plantuml/cute/VarArgs.java deleted file mode 100644 index 55222f1c6..000000000 --- a/src/net/sourceforge/plantuml/cute/VarArgs.java +++ /dev/null @@ -1,132 +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.cute; - -import java.awt.geom.Point2D; -import java.util.HashMap; -import java.util.Map; -import java.util.StringTokenizer; - -import net.sourceforge.plantuml.ugraphic.UTranslate; -import net.sourceforge.plantuml.ugraphic.color.HColor; -import net.sourceforge.plantuml.ugraphic.color.HColorSet; -import net.sourceforge.plantuml.ugraphic.color.HColorUtils; - -public class VarArgs { - - private final Map args = new HashMap(); - - public VarArgs(String data) { - for (String s : data.split("\\s")) { - if (s.contains("=")) { - final StringTokenizer st = new StringTokenizer(s, "="); - final String key = st.nextToken(); - final String value = st.nextToken(); - args.put(key, value); - } - } - // System.err.println("arg=" + args); - } - - @Override - public String toString() { - return args.toString(); - } - - public double getAsDouble(String k, double def) { - if (args.containsKey(k)) { - return getAsDouble(k); - } - return def; - } - - public double getAsDouble(String k) { - final String value = args.get(k); - if (value == null) { - throw new IllegalArgumentException("no key " + k); - } - return Double.parseDouble(value); - } - - public MyDouble getAsMyDouble(String k) { - final String value = args.get(k); - if (value == null) { - throw new IllegalArgumentException("no key " + k); - } - return new MyDouble(value); - } - - public HColor getAsColor(String k) { - final String value = args.get(k); - if (value == null) { - return HColorUtils.BLACK; - } - final HColor result = HColorSet.instance().getColorOrWhite(value); - if (result == null) { - return HColorUtils.BLACK; - } - return result; - } - - public Point2D getAsPoint(String k) { - final String value = args.get(k); - if (value == null) { - throw new IllegalArgumentException("no key " + k); - } - final StringTokenizer st = new StringTokenizer(value.replaceAll("[()]", ""), ","); - return new Point2D.Double(Double.parseDouble(st.nextToken()), Double.parseDouble(st.nextToken())); - } - - public Point2D getAsPoint(String k, Point2D def) { - if (args.containsKey(k)) { - return getAsPoint(k); - } - return def; - } - - public CutePath getPointList(String k) { - final String value = args.get(k); - if (value == null) { - throw new IllegalArgumentException("no key " + k); - } - return new CutePath(value); - } - - public UTranslate getPosition() { - return new UTranslate(getAsPoint("position", new Point2D.Double())); - } - -} diff --git a/src/net/sourceforge/plantuml/jungle/CommandAddLevel.java b/src/net/sourceforge/plantuml/jungle/CommandAddLevel.java deleted file mode 100644 index 6a2f640f1..000000000 --- a/src/net/sourceforge/plantuml/jungle/CommandAddLevel.java +++ /dev/null @@ -1,66 +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.jungle; - -import net.sourceforge.plantuml.LineLocation; -import net.sourceforge.plantuml.command.CommandExecutionResult; -import net.sourceforge.plantuml.command.SingleLineCommand2; -import net.sourceforge.plantuml.command.regex.IRegex; -import net.sourceforge.plantuml.command.regex.RegexConcat; -import net.sourceforge.plantuml.command.regex.RegexLeaf; -import net.sourceforge.plantuml.command.regex.RegexResult; - -public class CommandAddLevel extends SingleLineCommand2 { - - public CommandAddLevel() { - super(getRegexConcat()); - } - - static IRegex getRegexConcat() { - return RegexConcat.build(CommandAddLevel.class.getName(), RegexLeaf.start(), // - new RegexLeaf("LEVEL", "(=+)"), // - RegexLeaf.spaceOneOrMore(), // - new RegexLeaf("LABEL", "(.+)"), RegexLeaf.end()); - } - - @Override - protected CommandExecutionResult executeArg(PSystemTree diagram, LineLocation location, RegexResult arg) { - final String level = arg.get("LEVEL", 0); - final String label = arg.get("LABEL", 0); - return diagram.addParagraph(level.length(), label); - } - -} diff --git a/src/net/sourceforge/plantuml/jungle/CommandEmpty.java b/src/net/sourceforge/plantuml/jungle/CommandEmpty.java deleted file mode 100644 index fcda3a8b6..000000000 --- a/src/net/sourceforge/plantuml/jungle/CommandEmpty.java +++ /dev/null @@ -1,62 +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.jungle; - -import net.sourceforge.plantuml.LineLocation; -import net.sourceforge.plantuml.command.CommandExecutionResult; -import net.sourceforge.plantuml.command.SingleLineCommand2; -import net.sourceforge.plantuml.command.regex.IRegex; -import net.sourceforge.plantuml.command.regex.RegexConcat; -import net.sourceforge.plantuml.command.regex.RegexLeaf; -import net.sourceforge.plantuml.command.regex.RegexResult; - -public class CommandEmpty extends SingleLineCommand2 { - - public CommandEmpty() { - super(getRegexConcat()); - } - - static IRegex getRegexConcat() { - return RegexConcat.build(CommandEmpty.class.getName(), RegexLeaf.start(), // - RegexLeaf.spaceZeroOrMore(), RegexLeaf.end()); - } - - @Override - protected CommandExecutionResult executeArg(PSystemTree diagram, LineLocation location, RegexResult arg) { - return CommandExecutionResult.ok(); - } - -} diff --git a/src/net/sourceforge/plantuml/jungle/GNode.java b/src/net/sourceforge/plantuml/jungle/GNode.java deleted file mode 100644 index a3beed52c..000000000 --- a/src/net/sourceforge/plantuml/jungle/GNode.java +++ /dev/null @@ -1,67 +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.jungle; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import net.sourceforge.plantuml.cucadiagram.Display; - -public class GNode { - - private final Display display; - private final List children = new ArrayList(); - - public GNode(Display display) { - this.display = display; - } - - public Display getDisplay() { - return display; - } - - public List getChildren() { - return Collections.unmodifiableList(children); - } - - public GNode addChild(Display display) { - final GNode child = new GNode(display); - children.add(child); - return child; - } - -} \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/jungle/GNodeUtils.java b/src/net/sourceforge/plantuml/jungle/GNodeUtils.java deleted file mode 100644 index e83843f48..000000000 --- a/src/net/sourceforge/plantuml/jungle/GNodeUtils.java +++ /dev/null @@ -1,56 +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.jungle; - -public class GNodeUtils { - -// public static GNode getIndirectChild(GNode root, String id) { -// if (root.getId().equals(id)) { -// return root; -// } -// for (GNode n : root.getChildren()) { -// if (n.getId().equals(id)) { -// return n; -// } -// final GNode result = getIndirectChild(n, id); -// if (result != null) { -// return result; -// } -// } -// return null; -// } - -} \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/jungle/GTile.java b/src/net/sourceforge/plantuml/jungle/GTile.java deleted file mode 100644 index 3b781cbd8..000000000 --- a/src/net/sourceforge/plantuml/jungle/GTile.java +++ /dev/null @@ -1,44 +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.jungle; - -import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.graphic.TextBlock; - -public interface GTile extends TextBlock { - - public GTileGeometry calculateDimension(StringBounder stringBounder); -} diff --git a/src/net/sourceforge/plantuml/jungle/GTileGeometry.java b/src/net/sourceforge/plantuml/jungle/GTileGeometry.java deleted file mode 100644 index e3005770e..000000000 --- a/src/net/sourceforge/plantuml/jungle/GTileGeometry.java +++ /dev/null @@ -1,76 +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.jungle; - -import java.awt.geom.Dimension2D; -import java.util.Collections; -import java.util.List; - -public class GTileGeometry extends Dimension2D { - - private final double width; - private final double height; - private final List westPositions; - - public GTileGeometry(Dimension2D dim, List westPositions) { - this(dim.getWidth(), dim.getHeight(), westPositions); - } - - @Override - public void setSize(double width, double height) { - throw new UnsupportedOperationException(); - } - - public GTileGeometry(double width, double height, List westPositions) { - this.width = width; - this.height = height; - this.westPositions = westPositions; - } - - @Override - public final double getWidth() { - return width; - } - - @Override - public final double getHeight() { - return height; - } - - public List getWestPositions() { - return Collections.unmodifiableList(westPositions); - } -} diff --git a/src/net/sourceforge/plantuml/jungle/GTileLeftRight.java b/src/net/sourceforge/plantuml/jungle/GTileLeftRight.java deleted file mode 100644 index e899c63c2..000000000 --- a/src/net/sourceforge/plantuml/jungle/GTileLeftRight.java +++ /dev/null @@ -1,103 +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.jungle; - -import java.awt.geom.Dimension2D; -import java.util.Arrays; - -import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.UPath; -import net.sourceforge.plantuml.ugraphic.UTranslate; -import net.sourceforge.plantuml.ugraphic.color.HColorUtils; - -public class GTileLeftRight extends AbstractTextBlock implements GTile { - - private final GTile left; - private final GTile right; - private final double space; - private final double step = 5; - - public GTileLeftRight(GTile left, GTile right, double space) { - this.left = left; - this.right = right; - this.space = space; - } - - public void drawU(UGraphic ug) { - final StringBounder stringBounder = ug.getStringBounder(); - final GTileGeometry dimLeft = left.calculateDimension(stringBounder); - final GTileGeometry dimRight = right.calculateDimension(stringBounder); - final Dimension2D dimTotal = calculateDimension(stringBounder); - final double deltaH1 = dimTotal.getHeight() - dimLeft.getHeight(); - final double deltaH2 = dimTotal.getHeight() - dimRight.getHeight(); - left.drawU(ug.apply(UTranslate.dy(deltaH1 / 2))); - final double dx2 = dimLeft.getWidth() + space; - right.drawU(ug.apply(new UTranslate(dx2, deltaH2 / 2))); - - ug = ug.apply(HColorUtils.BLACK); - final double step = dimLeft.getHeight() / (dimRight.getWestPositions().size() + 1); - double ystart = step + deltaH1 / 2; - for (Double w2 : dimRight.getWestPositions()) { - line(ug, dimLeft.getWidth(), ystart, dx2, w2 + deltaH2 / 2); - ystart += step; - } - - } - - private void line(UGraphic ug, double x1, double y1, double x2, double y2) { - // final ULine line = new ULine(x2 - x1, y2 - y1); - // ug.apply(new UTranslate(x1, y1)).draw(line); - final UPath path = new UPath(); - path.moveTo(x1, y1); - path.lineTo(x1 + step, y1); - path.lineTo(x2 - step, y2); - path.lineTo(x2, y2); - ug.apply(UTranslate.dy(0)).draw(path); - } - - public GTileGeometry calculateDimension(StringBounder stringBounder) { - final GTileGeometry dimLeft = left.calculateDimension(stringBounder); - final Dimension2D dimRight = right.calculateDimension(stringBounder); - final Dimension2D dimTotal = new Dimension2DDouble(dimLeft.getWidth() + space + dimRight.getHeight(), Math.max( - dimLeft.getHeight(), dimRight.getHeight())); - final double deltaH1 = dimTotal.getHeight() - dimLeft.getHeight(); - final double west = dimLeft.getWestPositions().get(0) + deltaH1 / 2; - return new GTileGeometry(dimTotal, Arrays.asList(west)); - } -} diff --git a/src/net/sourceforge/plantuml/jungle/GTileNode.java b/src/net/sourceforge/plantuml/jungle/GTileNode.java deleted file mode 100644 index d706525b6..000000000 --- a/src/net/sourceforge/plantuml/jungle/GTileNode.java +++ /dev/null @@ -1,99 +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.jungle; - -import java.awt.geom.Dimension2D; -import java.util.Arrays; - -import net.sourceforge.plantuml.FontParam; -import net.sourceforge.plantuml.LineBreakStrategy; -import net.sourceforge.plantuml.SkinParam; -import net.sourceforge.plantuml.creole.CreoleMode; -import net.sourceforge.plantuml.creole.Parser; -import net.sourceforge.plantuml.creole.Sheet; -import net.sourceforge.plantuml.creole.SheetBlock1; -import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.graphic.SymbolContext; -import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.graphic.TextBlockUtils; -import net.sourceforge.plantuml.graphic.USymbol; -import net.sourceforge.plantuml.skin.rose.Rose; -import net.sourceforge.plantuml.ugraphic.UFont; -import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.color.HColor; -import net.sourceforge.plantuml.ugraphic.color.HColorUtils; - -public class GTileNode extends AbstractTextBlock implements GTile { - - private final TextBlock tb; - - public GTileNode(GNode node) { - final Display display = node.getDisplay(); - final SheetBlock1 sheetBlock1 = getTextBlock(display); - - final SymbolContext symbolContext = new SymbolContext(HColorUtils.MY_YELLOW, HColorUtils.BLACK); - tb = USymbol.RECTANGLE.asSmall(null, sheetBlock1, TextBlockUtils.empty(0, 0), symbolContext, - HorizontalAlignment.CENTER); - } - - public static SheetBlock1 getTextBlock(final Display display) { - final Rose rose = new Rose(); - final SkinParam skinParam = SkinParam.create(null); - final HColor fontColor = rose.getFontColor(skinParam, FontParam.NOTE); - final UFont fontNote = skinParam.getFont(null, false, FontParam.NOTE); - - final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.NOTE, null); - - final Sheet sheet9 = Parser.build(fc, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL) - .createSheet(display); - final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet9, LineBreakStrategy.NONE, 0); - return sheetBlock1; - } - - public void drawU(UGraphic ug) { - tb.drawU(ug); - } - - public GTileGeometry calculateDimension(StringBounder stringBounder) { - final Dimension2D dim = tb.calculateDimension(stringBounder); - return new GTileGeometry(dim, Arrays.asList(dim.getHeight() / 2)); - } - -} diff --git a/src/net/sourceforge/plantuml/jungle/GTileOneLevelFactory.java b/src/net/sourceforge/plantuml/jungle/GTileOneLevelFactory.java deleted file mode 100644 index 34d164c16..000000000 --- a/src/net/sourceforge/plantuml/jungle/GTileOneLevelFactory.java +++ /dev/null @@ -1,57 +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.jungle; - -import java.util.ArrayList; -import java.util.List; - -public class GTileOneLevelFactory { - - public GTile createGTile(GNode root) { - final GTileNode left = new GTileNode(root); - if (root.getChildren().size() == 0) { - return left; - } - final List all = new ArrayList(); - for (GNode n : root.getChildren()) { - all.add(createGTile(n)); - } - final GTileStack right = new GTileStack(all, 20); - return new GTileLeftRight(left, right, 30); - - } - -} diff --git a/src/net/sourceforge/plantuml/jungle/GTileStack.java b/src/net/sourceforge/plantuml/jungle/GTileStack.java deleted file mode 100644 index 3528cf53a..000000000 --- a/src/net/sourceforge/plantuml/jungle/GTileStack.java +++ /dev/null @@ -1,84 +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.jungle; - -import java.awt.geom.Dimension2D; -import java.util.ArrayList; -import java.util.List; - -import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.UTranslate; - -public class GTileStack extends AbstractTextBlock implements GTile { - - private final List tiles; - private final double space; - - public GTileStack(List tiles, double space) { - this.tiles = tiles; - this.space = space; - if (tiles.size() == 0) { - throw new IllegalArgumentException(); - } - } - - public void drawU(UGraphic ug) { - for (GTile tile : tiles) { - tile.drawU(ug); - final Dimension2D dim = tile.calculateDimension(ug.getStringBounder()); - ug = ug.apply(UTranslate.dy(dim.getHeight() + space)); - } - } - - public GTileGeometry calculateDimension(StringBounder stringBounder) { - double width = 0; - double height = 0; - double delta = 0; - final List wests = new ArrayList(); - for (GTile tile : tiles) { - final GTileGeometry dim = tile.calculateDimension(stringBounder); - wests.add(delta + dim.getWestPositions().get(0)); - height += dim.getHeight(); - delta += dim.getHeight() + space; - width = Math.max(width, dim.getWidth()); - } - height += (tiles.size() - 1) * space; - return new GTileGeometry(width, height, wests); - } - -} diff --git a/src/net/sourceforge/plantuml/jungle/Needle.java b/src/net/sourceforge/plantuml/jungle/Needle.java deleted file mode 100644 index 7ed85372b..000000000 --- a/src/net/sourceforge/plantuml/jungle/Needle.java +++ /dev/null @@ -1,114 +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.jungle; - -import java.util.List; - -import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.UDrawable; -import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.ULine; -import net.sourceforge.plantuml.ugraphic.UTranslate; -import net.sourceforge.plantuml.ugraphic.color.HColorUtils; - -public class Needle implements UDrawable { - - private final double length; - private final Display display; - private final double degreePosition; - private final double degreeOperture; - - private Needle(Display display, double length, double degreePosition, double degreeOperture) { - this.display = display; - this.degreePosition = degreePosition; - this.degreeOperture = degreeOperture; - this.length = length; - } - - public void drawU(UGraphic ug) { - GTileNode.getTextBlock(display); - ug.draw(getLine()); - - ug = ug.apply(getTranslate(length)); - GTileNode.getTextBlock(display).drawU(ug); - } - - private ULine getLine() { - final UTranslate translate = getTranslate(length); - return new ULine(translate.getDx(), translate.getDy()); - } - - public UTranslate getTranslate(double dist) { - final double angle = degreePosition * Math.PI / 180.0; - final double dx = dist * Math.cos(angle); - final double dy = dist * Math.sin(angle); - return new UTranslate(dx, dy); - } - - public UDrawable addChildren(final List children) { - return new UDrawable() { - public void drawU(UGraphic ug) { - Needle.this.drawU(ug); - if (children.size() == 0) { - return; - } - ug = ug.apply(getTranslate(length / 2)); - final UDrawable child1 = getNeedle(children.get(0), length / 2, degreePosition + degreeOperture, - degreeOperture / 2); - child1.drawU(ug); - if (children.size() == 1) { - return; - } - final UDrawable child2 = getNeedle(children.get(1), length / 2, degreePosition - degreeOperture, - degreeOperture / 2); - child2.drawU(ug); - - } - }; - } - - public static UDrawable getNeedle(GNode root, double length, double degree, double degreeOperture) { - final Needle needle0 = new Needle(root.getDisplay(), length, degree, degreeOperture); - final UDrawable n1 = needle0.addChildren(root.getChildren()); - return new UDrawable() { - public void drawU(UGraphic ug) { - ug = ug.apply(HColorUtils.BLACK); - n1.drawU(ug); - } - }; - } - -} \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/jungle/PSystemTree.java b/src/net/sourceforge/plantuml/jungle/PSystemTree.java deleted file mode 100644 index 97f233c29..000000000 --- a/src/net/sourceforge/plantuml/jungle/PSystemTree.java +++ /dev/null @@ -1,127 +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.jungle; - -import java.io.IOException; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.List; - -import net.sourceforge.plantuml.AbstractPSystem; -import net.sourceforge.plantuml.FileFormatOption; -import net.sourceforge.plantuml.SkinParam; -import net.sourceforge.plantuml.SvgCharSizeHack; -import net.sourceforge.plantuml.UseStyle; -import net.sourceforge.plantuml.command.CommandExecutionResult; -import net.sourceforge.plantuml.core.DiagramDescription; -import net.sourceforge.plantuml.core.ImageData; -import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.UDrawable; -import net.sourceforge.plantuml.graphic.UDrawableUtils; -import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft; -import net.sourceforge.plantuml.ugraphic.ImageBuilder; -import net.sourceforge.plantuml.ugraphic.ImageParameter; -import net.sourceforge.plantuml.ugraphic.LimitFinder; -import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; -import net.sourceforge.plantuml.ugraphic.color.HColor; -import net.sourceforge.plantuml.ugraphic.color.HColorUtils; - -public class PSystemTree extends AbstractPSystem { - - private GNode root; - private List stack = new ArrayList(); - private final Rendering rendering = Rendering.NEEDLE; - - public DiagramDescription getDescription() { - return new DiagramDescription("(Tree)"); - } - - @Override - final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) - throws IOException { - final int margin1; - final int margin2; - if (UseStyle.useBetaStyle()) { - margin1 = SkinParam.zeroMargin(5); - margin2 = SkinParam.zeroMargin(5); - } else { - margin1 = 5; - margin2 = 5; - } - HColor backcolor = HColorUtils.WHITE; - - final ClockwiseTopRightBottomLeft margins = ClockwiseTopRightBottomLeft.margin1margin2(margin1, margin2); - final ImageParameter imageParameter = new ImageParameter(new ColorMapperIdentity(), false, null, null, - null, margins, backcolor); - final ImageBuilder builder = ImageBuilder.build(imageParameter); - - if (rendering == Rendering.NEEDLE) { - final UDrawable tmp = Needle.getNeedle(root, 200, 0, 60); - final LimitFinder limitFinder = new LimitFinder(fileFormat.getDefaultStringBounder(SvgCharSizeHack.NO_HACK), - true); - tmp.drawU(limitFinder); - final double minY = limitFinder.getMinY(); - builder.setUDrawable(UDrawableUtils.move(tmp, 0, -minY)); - } else { - builder.setUDrawable(new GTileOneLevelFactory().createGTile(root)); - } - return builder.writeImageTOBEMOVED(fileFormat, seed, os); - } - - public CommandExecutionResult addParagraph(int level, String label) { - - if (level == 1 && root == null) { - root = new GNode(Display.create(label)); - stack.add(root); - return CommandExecutionResult.ok(); - } else if (level == 1 && root != null) { - return CommandExecutionResult.error("Not allowed 1"); - } - - final GNode parent = stack.get(level - 2); - final GNode newNode = parent.addChild(Display.create(label)); - - if (level > stack.size() + 1) { - return CommandExecutionResult.error("Not allowed 2"); - } else if (level - 1 == stack.size()) { - stack.add(newNode); - } else { - stack.set(level - 1, newNode); - } - - return CommandExecutionResult.ok(); - } - -} diff --git a/src/net/sourceforge/plantuml/jungle/PSystemTreeFactory.java b/src/net/sourceforge/plantuml/jungle/PSystemTreeFactory.java deleted file mode 100644 index 8cb3e7653..000000000 --- a/src/net/sourceforge/plantuml/jungle/PSystemTreeFactory.java +++ /dev/null @@ -1,63 +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.jungle; - -import java.util.ArrayList; -import java.util.List; - -import net.sourceforge.plantuml.command.Command; -import net.sourceforge.plantuml.command.PSystemCommandFactory; -import net.sourceforge.plantuml.core.DiagramType; - -public class PSystemTreeFactory extends PSystemCommandFactory { - - public PSystemTreeFactory(DiagramType type) { - super(type); - } - - @Override - protected List createCommands() { - final List cmds = new ArrayList(); - cmds.add(new CommandEmpty()); - cmds.add(new CommandAddLevel()); - return cmds; - } - - @Override - public PSystemTree createEmptyDiagram() { - return new PSystemTree(); - } - -} diff --git a/src/net/sourceforge/plantuml/jungle/Rendering.java b/src/net/sourceforge/plantuml/jungle/Rendering.java deleted file mode 100644 index 7b12a2a5b..000000000 --- a/src/net/sourceforge/plantuml/jungle/Rendering.java +++ /dev/null @@ -1,42 +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.jungle; - -public enum Rendering { - - BASIC, NEEDLE - -} \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageEmptyPackage.java b/src/net/sourceforge/plantuml/svek/image/EntityImageEmptyPackage.java index 270cc6ff5..29e362227 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageEmptyPackage.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageEmptyPackage.java @@ -45,6 +45,7 @@ import net.sourceforge.plantuml.Guillemet; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.Url; +import net.sourceforge.plantuml.UseStyle; import net.sourceforge.plantuml.activitydiagram3.ftile.EntityImageLegend; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.DisplayPositionned; @@ -59,7 +60,10 @@ import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; 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.Cluster; import net.sourceforge.plantuml.svek.ClusterDecoration; @@ -73,23 +77,54 @@ public class EntityImageEmptyPackage extends AbstractEntityImage { private final TextBlock desc; private final static int MARGIN = 10; - private final HColor specificBackColor; - private final ISkinParam skinParam; + private final Stereotype stereotype; private final TextBlock stereoBlock; private final Url url; private final SName styleName; + private final double shadowing; + private final HColor borderColor; + private final UStroke stroke; + private final double roundCorner; + private final HColor back; + + private Style getStyle() { + return getDefaultStyleDefinition().getMergedStyle(getSkinParam().getCurrentStyleBuilder()); + } + + private StyleSignature getDefaultStyleDefinition() { + return StyleSignature.of(SName.root, SName.element, styleName, SName.package_); + } public EntityImageEmptyPackage(ILeaf entity, ISkinParam skinParam, PortionShower portionShower, SName styleName) { super(entity, skinParam); this.styleName = styleName; - this.skinParam = skinParam; - this.specificBackColor = entity.getColors(skinParam).getColor(ColorType.BACK); + + final HColor specificBackColor = entity.getColors(skinParam).getColor(ColorType.BACK); this.stereotype = entity.getStereotype(); this.desc = entity.getDisplay().create(new FontConfiguration(getSkinParam(), FontParam.PACKAGE, stereotype), HorizontalAlignment.CENTER, skinParam); this.url = entity.getUrl99(); + if (UseStyle.useBetaStyle()) { + final Style style = getStyle(); + this.borderColor = style.value(PName.LineColor).asColor(getSkinParam().getIHtmlColorSet()); + this.shadowing = style.value(PName.Shadowing).asDouble(); + this.stroke = style.getStroke(); + this.roundCorner = style.value(PName.RoundCorner).asDouble(); + if (specificBackColor == null) { + this.back = style.value(PName.BackGroundColor).asColor(getSkinParam().getIHtmlColorSet()); + } else { + this.back = specificBackColor; + } + } else { + this.borderColor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.packageBorder); + this.shadowing = getSkinParam().shadowing(getEntity().getStereotype()) ? 3 : 0; + this.stroke = GeneralImageBuilder.getForcedStroke(getEntity().getStereotype(), getSkinParam()); + this.roundCorner = 0; + this.back = Cluster.getBackColor(specificBackColor, skinParam, stereotype, styleName); + } + final DisplayPositionned legend = ((EntityImpl) entity).getLegend(); if (legend != null) { final TextBlock legendBlock = EntityImageLegend.create(legend.getDisplay(), skinParam); @@ -127,18 +162,14 @@ public class EntityImageEmptyPackage extends AbstractEntityImage { final double widthTotal = dimTotal.getWidth(); final double heightTotal = dimTotal.getHeight(); - 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().packageStyle(), null, desc, 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), - shadowing, roundCorner, - getSkinParam().getHorizontalAlignment(AlignmentParam.packageTitleAlignment, null, false), - getSkinParam().getStereotypeAlignment()); + final HorizontalAlignment horizontalAlignment = getSkinParam() + .getHorizontalAlignment(AlignmentParam.packageTitleAlignment, null, false); + final HorizontalAlignment stereotypeAlignment = getSkinParam().getStereotypeAlignment(); + + decoration.drawU(ug, back, borderColor, shadowing, roundCorner, horizontalAlignment, stereotypeAlignment); if (url != null) { ug.closeUrl(); diff --git a/src/net/sourceforge/plantuml/timingdiagram/TimeConstraint.java b/src/net/sourceforge/plantuml/timingdiagram/TimeConstraint.java index 8100e86ad..2729d4615 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/TimeConstraint.java +++ b/src/net/sourceforge/plantuml/timingdiagram/TimeConstraint.java @@ -60,6 +60,9 @@ public class TimeConstraint { private final ISkinParam skinParam; public TimeConstraint(TimeTick tick1, TimeTick tick2, String label, ISkinParam skinParam) { + if (tick1 == null || tick2 == null) { + throw new IllegalArgumentException(); + } this.tick1 = tick1; this.tick2 = tick2; this.label = Display.getWithNewlines(label); diff --git a/src/net/sourceforge/plantuml/timingdiagram/command/CommandConstraint.java b/src/net/sourceforge/plantuml/timingdiagram/command/CommandConstraint.java index 264aba858..4edf7328d 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/command/CommandConstraint.java +++ b/src/net/sourceforge/plantuml/timingdiagram/command/CommandConstraint.java @@ -89,8 +89,14 @@ public class CommandConstraint extends SingleLineCommand2 { } } final TimeTick tick1 = TimeTickBuilder.parseTimeTick("TIME1", arg, diagram); + if (tick1 == null) { + return CommandExecutionResult.error("Unknown time label"); + } diagram.updateNow(tick1); final TimeTick tick2 = TimeTickBuilder.parseTimeTick("TIME2", arg, diagram); + if (tick2 == null) { + return CommandExecutionResult.error("Unknown time label"); + } player1.createConstraint(tick1, tick2, arg.get("MESSAGE", 0)); return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/ugraphic/ImageBuilder.java b/src/net/sourceforge/plantuml/ugraphic/ImageBuilder.java index edcca6ba6..658bc5fc9 100644 --- a/src/net/sourceforge/plantuml/ugraphic/ImageBuilder.java +++ b/src/net/sourceforge/plantuml/ugraphic/ImageBuilder.java @@ -57,7 +57,6 @@ import net.sourceforge.plantuml.EmptyImageBuilder; import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.FileUtils; -import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.anim.AffineTransformation; import net.sourceforge.plantuml.anim.Animation; @@ -78,7 +77,6 @@ import net.sourceforge.plantuml.ugraphic.color.HColorBackground; import net.sourceforge.plantuml.ugraphic.color.HColorGradient; import net.sourceforge.plantuml.ugraphic.color.HColorSimple; import net.sourceforge.plantuml.ugraphic.color.HColorUtils; -import net.sourceforge.plantuml.ugraphic.crossing.UGraphicCrossing; import net.sourceforge.plantuml.ugraphic.debug.UGraphicDebug; import net.sourceforge.plantuml.ugraphic.eps.UGraphicEps; import net.sourceforge.plantuml.ugraphic.g2d.UGraphicG2d; @@ -203,11 +201,11 @@ public class ImageBuilder { if (param.isUseHandwritten()) { return new UGraphicHandwritten(ug); } - if (OptionFlags.OMEGA_CROSSING) { - return new UGraphicCrossing(ug); - } else { - return ug; - } +// if (OptionFlags.OMEGA_CROSSING) { +// return new UGraphicCrossing(ug); +// } else { + return ug; +// } } private ImageData writeImageMjpeg(OutputStream os, StringBounder stringBounder) throws IOException { diff --git a/src/net/sourceforge/plantuml/ugraphic/crossing/UGraphicCrossing.java b/src/net/sourceforge/plantuml/ugraphic/crossing/UGraphicCrossing.java deleted file mode 100644 index d466331e6..000000000 --- a/src/net/sourceforge/plantuml/ugraphic/crossing/UGraphicCrossing.java +++ /dev/null @@ -1,163 +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: Adrian Vogt - * - */ -package net.sourceforge.plantuml.ugraphic.crossing; - -import java.awt.geom.Point2D; -import java.util.ArrayList; -import java.util.List; - -import net.sourceforge.plantuml.cute.Balloon; -import net.sourceforge.plantuml.cute.CrossingSegment; -import net.sourceforge.plantuml.geom.LineSegmentDouble; -import net.sourceforge.plantuml.graphic.UGraphicDelegator; -import net.sourceforge.plantuml.posimo.DotPath; -import net.sourceforge.plantuml.ugraphic.UChange; -import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.UShape; -import net.sourceforge.plantuml.ugraphic.UTranslate; -import net.sourceforge.plantuml.ugraphic.color.HColor; -import net.sourceforge.plantuml.ugraphic.color.HColorUtils; - -public class UGraphicCrossing extends UGraphicDelegator implements UGraphic { - - private final List lines; - private final UTranslate translate; - - static class Pending { - final UGraphic ug; - final LineSegmentDouble segment; - final UTranslate translate; - - Pending(UGraphic ug, UTranslate translate, LineSegmentDouble segment) { - this.ug = ug; - this.segment = segment; - this.translate = translate; - } - - void drawNow(HColor color) { - if (color == null) { - segment.draw(ug); - } else { - segment.draw(ug.apply(color)); - } - } - - List getCollisionsWith(List others) { - final List result = new ArrayList(); - for (Pending other : others) { - if (isClose(segment.getP1(), other.segment.getP1()) || isClose(segment.getP1(), other.segment.getP2()) - || isClose(segment.getP2(), other.segment.getP1()) - || isClose(segment.getP2(), other.segment.getP2())) { - continue; - } - final Point2D inter = segment.getSegIntersection(other.segment); - if (inter != null) { - result.add(inter); - } - } - return result; - } - } - - public UGraphicCrossing(UGraphic ug) { - this(ug, new UTranslate(), new ArrayList()); - } - - private static boolean isClose(Point2D p1, Point2D p2) { - return p1.distance(p2) < 0.1; - } - - private UGraphicCrossing(UGraphic ug, UTranslate translate, List lines) { - super(ug); - this.translate = translate; - this.lines = lines; - } - - public void draw(UShape shape) { - if (shape instanceof DotPath) { - drawDotPath((DotPath) shape); - } else { - getUg().draw(shape); - } - } - - private void drawDotPath(DotPath dotPath) { - if (dotPath.isLine()) { - for (LineSegmentDouble seg : dotPath.getLineSegments()) { - lines.add(new Pending(getUg().apply(translate.reverse()), translate, seg.translate(translate))); - } - } else { - getUg().draw(dotPath); - } - } - - public UGraphic apply(UChange change) { - if (change instanceof UTranslate) { - return new UGraphicCrossing(getUg().apply(change), translate.compose((UTranslate) change), lines); - } else { - return new UGraphicCrossing(getUg().apply(change), translate, lines); - } - } - - public void flushUg() { - final List pendings = new ArrayList(); - final List balloons = new ArrayList(); - for (Pending p : lines) { - final List tmp = p.getCollisionsWith(lines); - for (Point2D pt : tmp) { - balloons.add(new Balloon(pt, 5)); - } - // if (tmp.size() == 0) { - // p.drawNow(null); - // } else { - // pendings.add(p); - // } - } - for (Balloon b : balloons) { - b.drawU(getUg().apply(HColorUtils.GREEN.bg()).apply(HColorUtils.GREEN)); - } - for (Pending p : lines) { - for (Balloon b : balloons) { - List pts = new CrossingSegment(b, p.segment).intersection(); - for (Point2D pt : pts) { - final Balloon s2 = new Balloon(pt, 2); - s2.drawU(getUg().apply(HColorUtils.BLUE.bg()).apply(HColorUtils.BLUE)); - } - } - } - getUg().flushUg(); - } - -} diff --git a/src/net/sourceforge/plantuml/version/Version.java b/src/net/sourceforge/plantuml/version/Version.java index 38320775f..178f98cbb 100644 --- a/src/net/sourceforge/plantuml/version/Version.java +++ b/src/net/sourceforge/plantuml/version/Version.java @@ -44,7 +44,7 @@ public class Version { private static final int MAJOR_SEPARATOR = 1000000; public static int version() { - return 1202102; + return 1202103; } public static int versionPatched() { @@ -80,7 +80,7 @@ public class Version { } public static int beta() { - final int beta = 7; + final int beta = 0; return beta; } @@ -93,7 +93,7 @@ public class Version { } public static long compileTime() { - return 1615115427842L; + return 1616431999785L; } public static String compileTimeString() { diff --git a/stdlib/archimate-abx.repx b/stdlib/archimate-abx.repx index 1d7dd96c2..c09ca9c6c 100644 Binary files a/stdlib/archimate-abx.repx and b/stdlib/archimate-abx.repx differ diff --git a/stdlib/c4-abx.repx b/stdlib/c4-abx.repx index 91d855d1e..b24257075 100644 Binary files a/stdlib/c4-abx.repx and b/stdlib/c4-abx.repx differ diff --git a/stdlib/c4-dex.repx b/stdlib/c4-dex.repx index 82d2be92e..d9b833048 100644 Binary files a/stdlib/c4-dex.repx and b/stdlib/c4-dex.repx differ