mirror of
https://github.com/octoleo/plantuml.git
synced 2024-11-21 20:45:10 +00:00
refactor: remove dead code
This commit is contained in:
parent
137d84101f
commit
4f46b6726e
1
attic.md
1
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)
|
- [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)
|
- [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)
|
- [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)
|
||||||
|
@ -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);
|
|
||||||
}
|
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -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();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -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);
|
|
||||||
}
|
|
@ -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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -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<Path> paths;
|
|
||||||
|
|
||||||
public SimpleDrawer(Cluster root, Collection<Path> 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<Path>()).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);
|
|
||||||
}
|
|
||||||
}
|
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user