From 4f46b6726efe1937b6edefaf62e6b4a88c534217 Mon Sep 17 00:00:00 2001 From: Arnaud Roques Date: Sat, 11 Nov 2023 20:23:35 +0100 Subject: [PATCH] refactor: remove dead code --- attic.md | 1 + .../plantuml/posimo/IEntityImageBlock.java | 48 --------- .../plantuml/posimo/LineRectIntersection.java | 82 -------------- .../posimo/LineSegmentIntersection.java | 81 -------------- .../plantuml/posimo/MargedBlock.java | 91 ---------------- .../sourceforge/plantuml/posimo/Mirror.java | 54 ---------- .../sourceforge/plantuml/posimo/Racorder.java | 47 -------- .../plantuml/posimo/RacorderAbstract.java | 59 ----------- .../posimo/RacorderFollowTangeante.java | 67 ------------ .../posimo/RacorderFollowTangeanteOld.java | 60 ----------- .../plantuml/posimo/RacorderInToCenter.java | 60 ----------- .../plantuml/posimo/RacorderOrthogonal.java | 85 --------------- .../plantuml/posimo/SimpleDrawer.java | 100 ------------------ .../plantuml/posimo/TwoLinesIntersection.java | 74 ------------- 14 files changed, 1 insertion(+), 908 deletions(-) delete mode 100644 src/net/sourceforge/plantuml/posimo/IEntityImageBlock.java delete mode 100644 src/net/sourceforge/plantuml/posimo/LineRectIntersection.java delete mode 100644 src/net/sourceforge/plantuml/posimo/LineSegmentIntersection.java delete mode 100644 src/net/sourceforge/plantuml/posimo/MargedBlock.java delete mode 100644 src/net/sourceforge/plantuml/posimo/Mirror.java delete mode 100644 src/net/sourceforge/plantuml/posimo/Racorder.java delete mode 100644 src/net/sourceforge/plantuml/posimo/RacorderAbstract.java delete mode 100644 src/net/sourceforge/plantuml/posimo/RacorderFollowTangeante.java delete mode 100644 src/net/sourceforge/plantuml/posimo/RacorderFollowTangeanteOld.java delete mode 100644 src/net/sourceforge/plantuml/posimo/RacorderInToCenter.java delete mode 100644 src/net/sourceforge/plantuml/posimo/RacorderOrthogonal.java delete mode 100644 src/net/sourceforge/plantuml/posimo/SimpleDrawer.java delete mode 100644 src/net/sourceforge/plantuml/posimo/TwoLinesIntersection.java diff --git a/attic.md b/attic.md index 6db8f86a0..2dae29f1c 100644 --- a/attic.md +++ b/attic.md @@ -9,3 +9,4 @@ It serves as a historical reference to ensure we remember and understand past de - [animation](https://github.com/plantuml/plantuml/tree/v1.2023.12/src/net/sourceforge/plantuml/anim) - [ditherer quantization](https://github.com/plantuml/plantuml/tree/v1.2023.12/src/net/sourceforge/plantuml/quantization) - [syntax suggestion](https://github.com/plantuml/plantuml/blob/v1.2023.12/src/net/sourceforge/plantuml/syntax/SyntaxChecker.java) +- [a first try of GraphViz abstraction](https://github.com/plantuml/plantuml/blob/v1.2023.12/src/net/sourceforge/plantuml/posimo) diff --git a/src/net/sourceforge/plantuml/posimo/IEntityImageBlock.java b/src/net/sourceforge/plantuml/posimo/IEntityImageBlock.java deleted file mode 100644 index c9e0cf009..000000000 --- a/src/net/sourceforge/plantuml/posimo/IEntityImageBlock.java +++ /dev/null @@ -1,48 +0,0 @@ -/* ======================================================================== - * PlantUML : a free UML diagram generator - * ======================================================================== - * - * (C) Copyright 2009-2024, Arnaud Roques - * - * Project Info: https://plantuml.com - * - * If you like this project or if you find it useful, you can support us at: - * - * https://plantuml.com/patreon (only 1$ per month!) - * https://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.posimo; - -import net.sourceforge.plantuml.klimt.drawing.UGraphic; -import net.sourceforge.plantuml.klimt.font.StringBounder; -import net.sourceforge.plantuml.klimt.geom.XDimension2D; - -public interface IEntityImageBlock { - - XDimension2D getDimension(StringBounder stringBounder); - - void drawU(UGraphic ug, double xTheoricalPosition, double yTheoricalPosition, double marginWidth, - double marginHeight); -} \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/posimo/LineRectIntersection.java b/src/net/sourceforge/plantuml/posimo/LineRectIntersection.java deleted file mode 100644 index 18db7ad58..000000000 --- a/src/net/sourceforge/plantuml/posimo/LineRectIntersection.java +++ /dev/null @@ -1,82 +0,0 @@ -/* ======================================================================== - * PlantUML : a free UML diagram generator - * ======================================================================== - * - * (C) Copyright 2009-2024, Arnaud Roques - * - * Project Info: https://plantuml.com - * - * If you like this project or if you find it useful, you can support us at: - * - * https://plantuml.com/patreon (only 1$ per month!) - * https://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.posimo; - -import net.sourceforge.plantuml.klimt.geom.XLine2D; -import net.sourceforge.plantuml.klimt.geom.XPoint2D; -import net.sourceforge.plantuml.klimt.geom.XRectangle2D; - -public class LineRectIntersection { - - private final XPoint2D inter; - - public LineRectIntersection(XLine2D line, XRectangle2D rect) { - final XPoint2D p1 = new XPoint2D(rect.getMinX(), rect.getMinY()); - final XPoint2D p2 = new XPoint2D(rect.getMaxX(), rect.getMinY()); - final XPoint2D p3 = new XPoint2D(rect.getMaxX(), rect.getMaxY()); - final XPoint2D p4 = new XPoint2D(rect.getMinX(), rect.getMaxY()); - - final XPoint2D inter1 = new LineSegmentIntersection(XLine2D.line(p1, p2), line).getIntersection(); - final XPoint2D inter2 = new LineSegmentIntersection(XLine2D.line(p2, p3), line).getIntersection(); - final XPoint2D inter3 = new LineSegmentIntersection(XLine2D.line(p3, p4), line).getIntersection(); - final XPoint2D inter4 = new LineSegmentIntersection(XLine2D.line(p4, p1), line).getIntersection(); - - final XPoint2D o = line.getP1(); - inter = getCloser(o, inter1, inter2, inter3, inter4); - - } - - public static XPoint2D getCloser(final XPoint2D o, final XPoint2D... other) { - double minDist = Double.MAX_VALUE; - XPoint2D result = null; - - for (XPoint2D pt : other) - if (pt != null) { - final double dist = pt.distanceSq(o); - if (dist < minDist) { - minDist = dist; - result = pt; - } - } - - return result; - } - - public final XPoint2D getIntersection() { - return inter; - } - -} diff --git a/src/net/sourceforge/plantuml/posimo/LineSegmentIntersection.java b/src/net/sourceforge/plantuml/posimo/LineSegmentIntersection.java deleted file mode 100644 index 6d830c68f..000000000 --- a/src/net/sourceforge/plantuml/posimo/LineSegmentIntersection.java +++ /dev/null @@ -1,81 +0,0 @@ -/* ======================================================================== - * PlantUML : a free UML diagram generator - * ======================================================================== - * - * (C) Copyright 2009-2024, Arnaud Roques - * - * Project Info: https://plantuml.com - * - * If you like this project or if you find it useful, you can support us at: - * - * https://plantuml.com/patreon (only 1$ per month!) - * https://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.posimo; - -import net.sourceforge.plantuml.klimt.geom.XLine2D; -import net.sourceforge.plantuml.klimt.geom.XPoint2D; - -public class LineSegmentIntersection { - - private final XPoint2D inter; - - // http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/ - - public LineSegmentIntersection(XLine2D segment, XLine2D lineB) { - final double x1 = segment.getX1(); - final double y1 = segment.getY1(); - final double x2 = segment.getX2(); - final double y2 = segment.getY2(); - final double x3 = lineB.getX1(); - final double y3 = lineB.getY1(); - final double x4 = lineB.getX2(); - final double y4 = lineB.getY2(); - - final double den = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1); - - if (den == 0) { - inter = null; - } else { - - final double uA1 = (x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3); - final double uA = uA1 / den; - - final double x = x1 + uA * (x2 - x1); - final double y = y1 + uA * (y2 - y1); - - if (uA >= 0 && uA <= 1) { - inter = new XPoint2D(x, y); - } else { - inter = null; - } - } - } - - public final XPoint2D getIntersection() { - return inter; - } - -} diff --git a/src/net/sourceforge/plantuml/posimo/MargedBlock.java b/src/net/sourceforge/plantuml/posimo/MargedBlock.java deleted file mode 100644 index ab4bdfb4c..000000000 --- a/src/net/sourceforge/plantuml/posimo/MargedBlock.java +++ /dev/null @@ -1,91 +0,0 @@ -/* ======================================================================== - * PlantUML : a free UML diagram generator - * ======================================================================== - * - * (C) Copyright 2009-2024, Arnaud Roques - * - * Project Info: https://plantuml.com - * - * If you like this project or if you find it useful, you can support us at: - * - * https://plantuml.com/patreon (only 1$ per month!) - * https://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.posimo; - -import net.sourceforge.plantuml.klimt.font.StringBounder; -import net.sourceforge.plantuml.klimt.geom.Positionable; -import net.sourceforge.plantuml.klimt.geom.XDimension2D; -import net.sourceforge.plantuml.klimt.geom.XPoint2D; - -public class MargedBlock { - - private final Block block; - private final IEntityImageBlock imageBlock; - private final double marginDecorator; - private final XDimension2D imageDimension; - - static private int uid = 1; - - public MargedBlock(StringBounder stringBounder, IEntityImageBlock imageBlock, double marginDecorator, - Cluster parent) { - this.imageBlock = imageBlock; - this.marginDecorator = marginDecorator; - this.imageDimension = imageBlock.getDimension(stringBounder); - this.block = new Block(uid++, imageDimension.getWidth() + 2 * marginDecorator, - imageDimension.getHeight() + 2 * marginDecorator, parent); - } - - public Block getBlock() { - return block; - } - - public double getMarginDecorator() { - return marginDecorator; - } - - public IEntityImageBlock getImageBlock() { - return imageBlock; - } - - public Positionable getImagePosition() { - return new Positionable() { - - public XDimension2D getSize() { - return imageDimension; - } - - public XPoint2D getPosition() { - final XPoint2D pos = block.getPosition(); - return new XPoint2D(pos.getX() + marginDecorator, pos.getY() + marginDecorator); - } - - public void moveSvek(double deltaX, double deltaY) { - throw new UnsupportedOperationException(); - } - }; - } - -} diff --git a/src/net/sourceforge/plantuml/posimo/Mirror.java b/src/net/sourceforge/plantuml/posimo/Mirror.java deleted file mode 100644 index 16b7d0a2a..000000000 --- a/src/net/sourceforge/plantuml/posimo/Mirror.java +++ /dev/null @@ -1,54 +0,0 @@ -/* ======================================================================== - * PlantUML : a free UML diagram generator - * ======================================================================== - * - * (C) Copyright 2009-2024, Arnaud Roques - * - * Project Info: https://plantuml.com - * - * If you like this project or if you find it useful, you can support us at: - * - * https://plantuml.com/patreon (only 1$ per month!) - * https://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.posimo; - -public class Mirror { - - private final double max; - - public Mirror(double max) { - this.max = max; - } - - public double getMirrored(double v) { - if (v < 0 || v > max) { - throw new IllegalArgumentException(); - } - // return v; - return max - v; - } - -} diff --git a/src/net/sourceforge/plantuml/posimo/Racorder.java b/src/net/sourceforge/plantuml/posimo/Racorder.java deleted file mode 100644 index faa2835c2..000000000 --- a/src/net/sourceforge/plantuml/posimo/Racorder.java +++ /dev/null @@ -1,47 +0,0 @@ -/* ======================================================================== - * PlantUML : a free UML diagram generator - * ======================================================================== - * - * (C) Copyright 2009-2024, Arnaud Roques - * - * Project Info: https://plantuml.com - * - * If you like this project or if you find it useful, you can support us at: - * - * https://plantuml.com/patreon (only 1$ per month!) - * https://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.posimo; - -import net.sourceforge.plantuml.klimt.geom.XLine2D; -import net.sourceforge.plantuml.klimt.geom.XRectangle2D; -import net.sourceforge.plantuml.klimt.shape.DotPath; - -public interface Racorder { - // ::remove folder when __HAXE__ - public DotPath getRacordIn(XRectangle2D rect, XLine2D tangeante); - - public DotPath getRacordOut(XRectangle2D rect, XLine2D tangeante); -} diff --git a/src/net/sourceforge/plantuml/posimo/RacorderAbstract.java b/src/net/sourceforge/plantuml/posimo/RacorderAbstract.java deleted file mode 100644 index 8f0d2f887..000000000 --- a/src/net/sourceforge/plantuml/posimo/RacorderAbstract.java +++ /dev/null @@ -1,59 +0,0 @@ -/* ======================================================================== - * PlantUML : a free UML diagram generator - * ======================================================================== - * - * (C) Copyright 2009-2024, Arnaud Roques - * - * Project Info: https://plantuml.com - * - * If you like this project or if you find it useful, you can support us at: - * - * https://plantuml.com/patreon (only 1$ per month!) - * https://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.posimo; - -import net.sourceforge.plantuml.klimt.geom.XLine2D; -import net.sourceforge.plantuml.klimt.geom.XRectangle2D; -import net.sourceforge.plantuml.klimt.shape.DotPath; - -public abstract class RacorderAbstract implements Racorder { - - public final DotPath getRacordOut(XRectangle2D rect, XLine2D tangeante) { - tangeante = symetric(tangeante); - return getRacordIn(rect, tangeante).reverse(); - } - - private static XLine2D symetric(XLine2D line) { - final double x1 = line.getX1(); - final double y1 = line.getY1(); - final double x2 = line.getX2(); - final double y2 = line.getY2(); - final double dx = x2 - x1; - final double dy = y2 - y1; - return new XLine2D(x1, y1, x1 - dx, y1 - dy); - } - -} diff --git a/src/net/sourceforge/plantuml/posimo/RacorderFollowTangeante.java b/src/net/sourceforge/plantuml/posimo/RacorderFollowTangeante.java deleted file mode 100644 index db4faa9b8..000000000 --- a/src/net/sourceforge/plantuml/posimo/RacorderFollowTangeante.java +++ /dev/null @@ -1,67 +0,0 @@ -/* ======================================================================== - * PlantUML : a free UML diagram generator - * ======================================================================== - * - * (C) Copyright 2009-2024, Arnaud Roques - * - * Project Info: https://plantuml.com - * - * If you like this project or if you find it useful, you can support us at: - * - * https://plantuml.com/patreon (only 1$ per month!) - * https://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.posimo; - -import net.sourceforge.plantuml.klimt.geom.XCubicCurve2D; -import net.sourceforge.plantuml.klimt.geom.XLine2D; -import net.sourceforge.plantuml.klimt.geom.XPoint2D; -import net.sourceforge.plantuml.klimt.geom.XRectangle2D; -import net.sourceforge.plantuml.klimt.shape.DotPath; - -public class RacorderFollowTangeante extends RacorderAbstract implements Racorder { - - @Override - public DotPath getRacordIn(XRectangle2D rect, XLine2D tangeante) { - - final DotPath result = new DotPath(); - - XPoint2D inter = new LineRectIntersection(tangeante, rect).getIntersection(); - - if (inter == null) { - final XPoint2D p1 = new XPoint2D(rect.getMinX(), rect.getMinY()); - final XPoint2D p2 = new XPoint2D(rect.getMaxX(), rect.getMinY()); - final XPoint2D p3 = new XPoint2D(rect.getMaxX(), rect.getMaxY()); - final XPoint2D p4 = new XPoint2D(rect.getMinX(), rect.getMaxY()); - - inter = LineRectIntersection.getCloser(tangeante.getP1(), p1, p2, p3, p4); - } - - final XCubicCurve2D curv = new XCubicCurve2D(tangeante.getX1(), tangeante.getY1(), tangeante.getX1(), - tangeante.getY1(), inter.getX(), inter.getY(), inter.getX(), inter.getY()); - return result.addAfter(curv); - } - -} diff --git a/src/net/sourceforge/plantuml/posimo/RacorderFollowTangeanteOld.java b/src/net/sourceforge/plantuml/posimo/RacorderFollowTangeanteOld.java deleted file mode 100644 index df5891681..000000000 --- a/src/net/sourceforge/plantuml/posimo/RacorderFollowTangeanteOld.java +++ /dev/null @@ -1,60 +0,0 @@ -/* ======================================================================== - * PlantUML : a free UML diagram generator - * ======================================================================== - * - * (C) Copyright 2009-2024, Arnaud Roques - * - * Project Info: https://plantuml.com - * - * If you like this project or if you find it useful, you can support us at: - * - * https://plantuml.com/patreon (only 1$ per month!) - * https://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.posimo; - -import net.sourceforge.plantuml.klimt.geom.BezierUtils; -import net.sourceforge.plantuml.klimt.geom.XCubicCurve2D; -import net.sourceforge.plantuml.klimt.geom.XLine2D; -import net.sourceforge.plantuml.klimt.geom.XPoint2D; -import net.sourceforge.plantuml.klimt.geom.XRectangle2D; -import net.sourceforge.plantuml.klimt.shape.DotPath; - -public class RacorderFollowTangeanteOld extends RacorderAbstract implements Racorder { - - public DotPath getRacordIn(XRectangle2D rect, XLine2D tangeante) { - - final DotPath result = new DotPath(); - - final XPoint2D center = new XPoint2D(rect.getCenterX(), rect.getCenterY()); - final XLine2D line = XLine2D.line(tangeante.getP1(), center); - final XPoint2D inter = BezierUtils.intersect(line, rect); - - final XCubicCurve2D curv = new XCubicCurve2D(tangeante.getX1(), tangeante.getY1(), tangeante.getX2(), - tangeante.getY2(), tangeante.getX2(), tangeante.getY2(), inter.getX(), inter.getY()); - return result.addAfter(curv); - } - -} diff --git a/src/net/sourceforge/plantuml/posimo/RacorderInToCenter.java b/src/net/sourceforge/plantuml/posimo/RacorderInToCenter.java deleted file mode 100644 index 732a19467..000000000 --- a/src/net/sourceforge/plantuml/posimo/RacorderInToCenter.java +++ /dev/null @@ -1,60 +0,0 @@ -/* ======================================================================== - * PlantUML : a free UML diagram generator - * ======================================================================== - * - * (C) Copyright 2009-2024, Arnaud Roques - * - * Project Info: https://plantuml.com - * - * If you like this project or if you find it useful, you can support us at: - * - * https://plantuml.com/patreon (only 1$ per month!) - * https://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.posimo; - -import net.sourceforge.plantuml.klimt.geom.BezierUtils; -import net.sourceforge.plantuml.klimt.geom.XCubicCurve2D; -import net.sourceforge.plantuml.klimt.geom.XLine2D; -import net.sourceforge.plantuml.klimt.geom.XPoint2D; -import net.sourceforge.plantuml.klimt.geom.XRectangle2D; -import net.sourceforge.plantuml.klimt.shape.DotPath; - -public class RacorderInToCenter extends RacorderAbstract implements Racorder { - - @Override - public DotPath getRacordIn(XRectangle2D rect, XLine2D tangeante) { - final DotPath result = new DotPath(); - - final XPoint2D center = new XPoint2D(rect.getCenterX(), rect.getCenterY()); - final XLine2D line = XLine2D.line(tangeante.getP1(), center); - final XPoint2D inter = BezierUtils.intersect(line, rect); - - final XCubicCurve2D curv = new XCubicCurve2D(line.getX1(), line.getY1(), line.getX1(), line.getY1(), - inter.getX(), inter.getY(), inter.getX(), inter.getY()); - return result.addAfter(curv); - } - -} diff --git a/src/net/sourceforge/plantuml/posimo/RacorderOrthogonal.java b/src/net/sourceforge/plantuml/posimo/RacorderOrthogonal.java deleted file mode 100644 index daf802cf5..000000000 --- a/src/net/sourceforge/plantuml/posimo/RacorderOrthogonal.java +++ /dev/null @@ -1,85 +0,0 @@ -/* ======================================================================== - * PlantUML : a free UML diagram generator - * ======================================================================== - * - * (C) Copyright 2009-2024, Arnaud Roques - * - * Project Info: https://plantuml.com - * - * If you like this project or if you find it useful, you can support us at: - * - * https://plantuml.com/patreon (only 1$ per month!) - * https://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.posimo; - -import net.sourceforge.plantuml.klimt.geom.XCubicCurve2D; -import net.sourceforge.plantuml.klimt.geom.XLine2D; -import net.sourceforge.plantuml.klimt.geom.XPoint2D; -import net.sourceforge.plantuml.klimt.geom.XRectangle2D; -import net.sourceforge.plantuml.klimt.shape.DotPath; - -public class RacorderOrthogonal extends RacorderAbstract implements Racorder { - - @Override - public DotPath getRacordIn(XRectangle2D rect, XLine2D tangeante) { - - final XPoint2D in = tangeante.getP1(); - - final DotPath result = new DotPath(); - XPoint2D inter = null; - - if (in.getX() > rect.getMinX() && in.getX() < rect.getMaxX()) { - if (in.getY() < rect.getMinY()) - inter = new XPoint2D(in.getX(), rect.getMinY()); - else if (in.getY() > rect.getMaxY()) - inter = new XPoint2D(in.getX(), rect.getMaxY()); - else - throw new IllegalArgumentException(); - - } else if (in.getY() > rect.getMinY() && in.getY() < rect.getMaxY()) { - if (in.getX() < rect.getMinX()) - inter = new XPoint2D(rect.getMinX(), in.getY()); - else if (in.getX() > rect.getMaxX()) - inter = new XPoint2D(rect.getMaxX(), in.getY()); - else - throw new IllegalArgumentException(); - - } else { - final XPoint2D p1 = new XPoint2D(rect.getMinX(), rect.getMinY()); - final XPoint2D p2 = new XPoint2D(rect.getMaxX(), rect.getMinY()); - final XPoint2D p3 = new XPoint2D(rect.getMaxX(), rect.getMaxY()); - final XPoint2D p4 = new XPoint2D(rect.getMinX(), rect.getMaxY()); - - inter = LineRectIntersection.getCloser(tangeante.getP1(), p1, p2, p3, p4); - - } - - final XCubicCurve2D curv = new XCubicCurve2D(tangeante.getX1(), tangeante.getY1(), tangeante.getX1(), - tangeante.getY1(), inter.getX(), inter.getY(), inter.getX(), inter.getY()); - return result.addAfter(curv); - } - -} diff --git a/src/net/sourceforge/plantuml/posimo/SimpleDrawer.java b/src/net/sourceforge/plantuml/posimo/SimpleDrawer.java deleted file mode 100644 index 434a6527b..000000000 --- a/src/net/sourceforge/plantuml/posimo/SimpleDrawer.java +++ /dev/null @@ -1,100 +0,0 @@ -/* ======================================================================== - * PlantUML : a free UML diagram generator - * ======================================================================== - * - * (C) Copyright 2009-2024, Arnaud Roques - * - * Project Info: https://plantuml.com - * - * If you like this project or if you find it useful, you can support us at: - * - * https://plantuml.com/patreon (only 1$ per month!) - * https://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.posimo; - -import java.awt.Color; -import java.awt.Graphics2D; -import java.awt.geom.Rectangle2D; -import java.util.ArrayList; -import java.util.Collection; - -import net.sourceforge.plantuml.klimt.geom.XDimension2D; -import net.sourceforge.plantuml.klimt.geom.XPoint2D; - -public class SimpleDrawer { - - private final Cluster root; - private final Collection paths; - - public SimpleDrawer(Cluster root, Collection paths) { - this.root = root; - this.paths = paths; - } - - public void draw(Graphics2D g2d) { - g2d.setColor(Color.BLACK); - for (Clusterable cl : root.getContents()) { - final Block b = (Block) cl; - final XPoint2D pos = b.getPosition(); - final XDimension2D dim = b.getSize(); - // drawRectCentered(g2d, pos, dim); - drawRect(g2d, pos, dim); - } - - g2d.setColor(Color.GREEN); - for (Path p : paths) { - final Label label = p.getLabel(); - final XPoint2D labelPos = label.getPosition(); - final XDimension2D labelDim = label.getSize(); - // final double x1 = labelPos.getX(); - // final double y1 = labelPos.getY(); - // g2d.draw(new Ellipse2D.Double(x1 - 1, y1 - 1, 3, 3)); - // drawRectCentered(g2d, labelPos, labelDim); - drawRect(g2d, labelPos, labelDim); - } - - g2d.setColor(Color.RED); - for (Path p : paths) { - p.getDotPath().draw(g2d, 0, 0); - } - - for (Cluster sub : root.getSubClusters()) { - new SimpleDrawer(sub, new ArrayList()).draw(g2d); - } - - } - - private void drawRectCentered(Graphics2D g2d, final XPoint2D pos, final XDimension2D dim) { - final Rectangle2D rect = new Rectangle2D.Double(pos.getX() - dim.getWidth() / 2, - pos.getY() - dim.getHeight() / 2, dim.getWidth(), dim.getHeight()); - g2d.draw(rect); - } - - private void drawRect(Graphics2D g2d, final XPoint2D pos, final XDimension2D dim) { - final Rectangle2D rect = new Rectangle2D.Double(pos.getX(), pos.getY(), dim.getWidth(), dim.getHeight()); - g2d.draw(rect); - } -} diff --git a/src/net/sourceforge/plantuml/posimo/TwoLinesIntersection.java b/src/net/sourceforge/plantuml/posimo/TwoLinesIntersection.java deleted file mode 100644 index 069eb5825..000000000 --- a/src/net/sourceforge/plantuml/posimo/TwoLinesIntersection.java +++ /dev/null @@ -1,74 +0,0 @@ -/* ======================================================================== - * PlantUML : a free UML diagram generator - * ======================================================================== - * - * (C) Copyright 2009-2024, Arnaud Roques - * - * Project Info: https://plantuml.com - * - * If you like this project or if you find it useful, you can support us at: - * - * https://plantuml.com/patreon (only 1$ per month!) - * https://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.posimo; - -import java.awt.geom.Line2D; - -import net.sourceforge.plantuml.klimt.geom.XPoint2D; - -public class TwoLinesIntersection { - - private final XPoint2D inter; - - public TwoLinesIntersection(Line2D lineA, Line2D lineB) { - final double x1 = lineA.getX1(); - final double y1 = lineA.getY1(); - final double x2 = lineA.getX2(); - final double y2 = lineA.getY2(); - final double x3 = lineB.getX1(); - final double y3 = lineB.getY1(); - final double x4 = lineB.getX2(); - final double y4 = lineB.getY2(); - - final double den = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1); - - final double uA1 = (x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3); - final double uA = uA1 / den; - - // final double uB1 = (x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3); - // uB = uB1 / den; - - final double x = x1 + uA * (x2 - x1); - final double y = y1 + uA * (y2 - y1); - - inter = new XPoint2D(x, y); - } - - public final XPoint2D getIntersection() { - return inter; - } - -}