mirror of
https://github.com/octoleo/plantuml.git
synced 2024-11-22 21:15:09 +00:00
WIP on gtile
This commit is contained in:
parent
7a30afc9be
commit
5908de8966
@ -36,6 +36,7 @@
|
||||
package net.sourceforge.plantuml;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
import net.sourceforge.plantuml.utils.MathUtils;
|
||||
|
||||
@ -52,6 +53,10 @@ public class Dimension2DDouble extends Dimension2D {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public Dimension2DDouble(Point2D point) {
|
||||
this(point.getX(), point.getY());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[" + width + "," + height + "]";
|
||||
|
@ -46,12 +46,14 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.WeldingPoint;
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.Gtile;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
import net.sourceforge.plantuml.creole.CreoleMode;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.Rainbow;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
@ -78,6 +80,7 @@ public class Branch {
|
||||
private final HColor color;
|
||||
|
||||
private Ftile ftile;
|
||||
private Gtile gtile;
|
||||
|
||||
public StyleSignature getDefaultStyleDefinitionArrow() {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.arrow);
|
||||
@ -134,6 +137,10 @@ public class Branch {
|
||||
this.ftile = factory.decorateOut(list.createFtile(factory), inlinkRendering);
|
||||
}
|
||||
|
||||
public void updateGtile(ISkinParam skinParam, StringBounder stringBounder) {
|
||||
this.gtile = list.createGtile(skinParam, stringBounder);
|
||||
}
|
||||
|
||||
public Collection<? extends Swimlane> getSwimlanes() {
|
||||
return list.getSwimlanes();
|
||||
}
|
||||
@ -186,6 +193,10 @@ public class Branch {
|
||||
return ftile;
|
||||
}
|
||||
|
||||
public Gtile getGtile() {
|
||||
return gtile;
|
||||
}
|
||||
|
||||
public ISkinParam skinParam() {
|
||||
return ftile.skinParam();
|
||||
}
|
||||
|
@ -50,8 +50,11 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.WeldingPoint;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileWithNoteOpale;
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.Gtile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.GtileIfHexagon;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||
@ -73,6 +76,7 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
|
||||
|
||||
private final Swimlane swimlane;
|
||||
|
||||
@Override
|
||||
public boolean containsBreak() {
|
||||
for (Branch branch : thens) {
|
||||
if (branch.containsBreak()) {
|
||||
@ -97,18 +101,40 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
|
||||
this.current = this.thens.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandExecutionResult add(Instruction ins) {
|
||||
return current.add(ins);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Gtile createGtile(ISkinParam skinParam, StringBounder stringBounder) {
|
||||
for (Branch branch : thens)
|
||||
branch.updateGtile(skinParam, stringBounder);
|
||||
|
||||
final List<Gtile> gtiles = new ArrayList<>();
|
||||
final List<Branch> branches = new ArrayList<>();
|
||||
for (Branch branch : thens) {
|
||||
gtiles.add(branch.getGtile());
|
||||
branches.add(branch);
|
||||
}
|
||||
if (elseBranch != null && elseBranch.isEmpty() == false) {
|
||||
elseBranch.updateGtile(skinParam, stringBounder);
|
||||
gtiles.add(elseBranch.getGtile());
|
||||
branches.add(elseBranch);
|
||||
}
|
||||
|
||||
return new GtileIfHexagon(swimlane, gtiles, branches);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ftile createFtile(FtileFactory factory) {
|
||||
for (Branch branch : thens) {
|
||||
branch.updateFtile(factory);
|
||||
}
|
||||
if (elseBranch == null) {
|
||||
if (elseBranch == null)
|
||||
this.elseBranch = new Branch(skinParam.getCurrentStyleBuilder(), swimlane, LinkRendering.none(),
|
||||
Display.NULL, null, LinkRendering.none());
|
||||
}
|
||||
|
||||
elseBranch.updateFtile(factory);
|
||||
Ftile result = factory.createIf(swimlane, thens, elseBranch, outColor, topInlinkRendering, url);
|
||||
if (getPositionedNotes().size() > 0) {
|
||||
@ -163,6 +189,7 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
|
||||
this.current.setInlinkRendering(nextLinkRenderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
final public boolean kill() {
|
||||
if (endifCalled) {
|
||||
for (Branch branch : thens) {
|
||||
@ -178,6 +205,7 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
|
||||
return current.kill();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinkRendering getInLinkRendering() {
|
||||
return topInlinkRendering;
|
||||
}
|
||||
@ -191,6 +219,7 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Swimlane> getSwimlanes() {
|
||||
final Set<Swimlane> result = new HashSet<>();
|
||||
if (swimlane != null) {
|
||||
@ -205,14 +234,17 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
|
||||
return Collections.unmodifiableSet(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Swimlane getSwimlaneIn() {
|
||||
return swimlane;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Swimlane getSwimlaneOut() {
|
||||
return swimlane;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Instruction getLast() {
|
||||
if (elseBranch == null) {
|
||||
return thens.get(thens.size() - 1).getLast();
|
||||
|
@ -48,8 +48,8 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileEmpty;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.WeldingPoint;
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.GConnectionVerticalDown;
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.Gtile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.GtileAssembly;
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.GtileEmpty;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
@ -113,7 +113,7 @@ public class InstructionList extends WithNote implements Instruction, Instructio
|
||||
if (result == null) {
|
||||
result = cur;
|
||||
} else {
|
||||
result = new GConnectionVerticalDown(result, cur, ins.getInLinkRendering());
|
||||
result = new GtileAssembly(result, cur, ins.getInLinkRendering());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
@ -53,12 +53,11 @@ public class TextBlockInterceptorUDrawable extends AbstractTextBlock implements
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
textBlock.drawU(new UGraphicInterceptorUDrawable2(ug, new HashMap<String, UTranslate>()));
|
||||
new UGraphicInterceptorUDrawable2(ug, new HashMap<String, UTranslate>()).draw(textBlock);
|
||||
ug.flushUg();
|
||||
}
|
||||
|
||||
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
||||
// return TextBlockUtils.getMinMax(this, stringBounder).getDimension();
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,7 @@ package net.sourceforge.plantuml.activitydiagram3.ftile;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.GConnection;
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.Gtile;
|
||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||
import net.sourceforge.plantuml.graphic.UGraphicDelegator;
|
||||
@ -63,8 +64,12 @@ public class UGraphicInterceptorUDrawable2 extends UGraphicDelegator {
|
||||
public void draw(UShape shape) {
|
||||
if (shape instanceof Gtile) {
|
||||
final Gtile gtile = (Gtile) shape;
|
||||
System.err.println("gtile=" + gtile);
|
||||
// System.err.println("gtile=" + gtile);
|
||||
gtile.drawU(this);
|
||||
// FtileWithConnection
|
||||
for (GConnection c : gtile.getInnerConnections()) {
|
||||
this.draw(c);
|
||||
}
|
||||
} else if (shape instanceof Ftile) {
|
||||
final Ftile ftile = (Ftile) shape;
|
||||
// System.err.println("ftile=" + ftile);
|
||||
|
@ -36,15 +36,16 @@
|
||||
package net.sourceforge.plantuml.activitydiagram3.gtile;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.LineParam;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.skin.rose.Rose;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorSet;
|
||||
@ -97,15 +98,18 @@ public abstract class AbstractGtile extends AbstractTextBlock implements Gtile {
|
||||
return new UTranslate(dim.getWidth() / 2, 0);
|
||||
if (name.equals(GPoint.SOUTH))
|
||||
return new UTranslate(dim.getWidth() / 2, dim.getHeight());
|
||||
if (name.equals(GPoint.WEST))
|
||||
return new UTranslate(0, dim.getHeight() / 2);
|
||||
if (name.equals(GPoint.EAST))
|
||||
return new UTranslate(dim.getWidth(), dim.getHeight() / 2);
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public GPoint getGPoint(String name) {
|
||||
if (name.equals(GPoint.NORTH))
|
||||
return new GPoint(this, GPoint.NORTH);
|
||||
if (name.equals(GPoint.SOUTH))
|
||||
return new GPoint(this, GPoint.SOUTH);
|
||||
if (name.equals(GPoint.NORTH) || name.equals(GPoint.SOUTH) || name.equals(GPoint.WEST)
|
||||
|| name.equals(GPoint.EAST))
|
||||
return new GPoint(this, name);
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@ -128,11 +132,11 @@ public abstract class AbstractGtile extends AbstractTextBlock implements Gtile {
|
||||
// public LinkRendering getOutLinkRendering() {
|
||||
// return LinkRendering.none();
|
||||
// }
|
||||
//
|
||||
// public Collection<Connection> getInnerConnections() {
|
||||
// return Collections.emptyList();
|
||||
// }
|
||||
//
|
||||
|
||||
public Collection<GConnection> getInnerConnections() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// public UTranslate getTranslateFor(Ftile child, StringBounder stringBounder) {
|
||||
// throw new UnsupportedOperationException("" + getClass());
|
||||
// }
|
||||
@ -144,18 +148,13 @@ public abstract class AbstractGtile extends AbstractTextBlock implements Gtile {
|
||||
}
|
||||
return thickness;
|
||||
}
|
||||
|
||||
|
||||
final public Ftile getFtile1() {
|
||||
throw new UnsupportedOperationException("WIP1");
|
||||
|
||||
private final Rose rose = new Rose();
|
||||
|
||||
protected final Rose getRose() {
|
||||
return rose;
|
||||
}
|
||||
|
||||
final public Ftile getFtile2() {
|
||||
throw new UnsupportedOperationException("WIP2");
|
||||
}
|
||||
|
||||
|
||||
|
||||
// public List<WeldingPoint> getWeldingPoints() {
|
||||
// return Collections.emptyList();
|
||||
// }
|
||||
|
@ -0,0 +1,61 @@
|
||||
/* ========================================================================
|
||||
* 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.activitydiagram3.gtile;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class GAbstractConnection implements GConnection {
|
||||
|
||||
protected final GPoint gpoint1;
|
||||
protected final GPoint gpoint2;
|
||||
|
||||
public GAbstractConnection(GPoint gpoint1, GPoint gpoint2) {
|
||||
this.gpoint1 = gpoint1;
|
||||
this.gpoint2 = gpoint2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[" + gpoint1 + "]->[" + gpoint2 + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
final public List<GPoint> getHooks() {
|
||||
return Arrays.asList(gpoint1, gpoint2);
|
||||
}
|
||||
|
||||
}
|
@ -37,7 +37,10 @@ package net.sourceforge.plantuml.activitydiagram3.gtile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface GConnection extends Gtile {
|
||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
|
||||
public interface GConnection extends UDrawable, UShape {
|
||||
|
||||
public List<GPoint> getHooks();
|
||||
|
||||
|
@ -0,0 +1,130 @@
|
||||
/* ========================================================================
|
||||
* 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.activitydiagram3.gtile;
|
||||
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.Rainbow;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class GConnectionHorizontalThenVerticalDown extends GAbstractConnection implements GConnectionTranslatable {
|
||||
|
||||
private final TextBlock textBlock;
|
||||
private final UTranslate pos1;
|
||||
private final UTranslate pos2;
|
||||
|
||||
public GConnectionHorizontalThenVerticalDown(UTranslate pos1, GPoint gpoint1, UTranslate pos2, GPoint gpoint2,
|
||||
TextBlock textBlock) {
|
||||
super(gpoint1, gpoint2);
|
||||
this.textBlock = textBlock;
|
||||
this.pos1 = pos1;
|
||||
this.pos2 = pos2;
|
||||
// See FtileFactoryDelegatorAssembly
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawU(UGraphic ug) {
|
||||
ug.draw(getSimpleSnake());
|
||||
}
|
||||
|
||||
// public double getMaxX(StringBounder stringBounder) {
|
||||
// return getSimpleSnake().getMaxX(stringBounder);
|
||||
// }
|
||||
|
||||
private Rainbow getInLinkRenderingColor() {
|
||||
Rainbow color;
|
||||
color = Rainbow.build(gpoint1.getGtile().skinParam());
|
||||
// final LinkRendering linkRendering = tile.getInLinkRendering();
|
||||
// if (linkRendering == null) {
|
||||
// if (UseStyle.useBetaStyle()) {
|
||||
// final Style style = getDefaultStyleDefinitionArrow()
|
||||
// .getMergedStyle(skinParam().getCurrentStyleBuilder());
|
||||
// return Rainbow.build(style, skinParam().getIHtmlColorSet(), skinParam().getThemeStyle());
|
||||
// } else {
|
||||
// color = Rainbow.build(skinParam());
|
||||
// }
|
||||
// } else {
|
||||
// color = linkRendering.getRainbow();
|
||||
// }
|
||||
// if (color.size() == 0) {
|
||||
// if (UseStyle.useBetaStyle()) {
|
||||
// final Style style = getDefaultStyleDefinitionArrow()
|
||||
// .getMergedStyle(skinParam().getCurrentStyleBuilder());
|
||||
// return Rainbow.build(style, skinParam().getIHtmlColorSet(), skinParam().getThemeStyle());
|
||||
// } else {
|
||||
// color = Rainbow.build(skinParam());
|
||||
// }
|
||||
// }
|
||||
return color;
|
||||
}
|
||||
|
||||
private Snake getSimpleSnake() {
|
||||
final Snake snake = Snake.create(getInLinkRenderingColor(), Arrows.asToDown()).withLabel(textBlock,
|
||||
HorizontalAlignment.LEFT);
|
||||
final Point2D p1 = pos1.getTranslated(gpoint1.getPoint2D());
|
||||
final Point2D p2 = pos2.getTranslated(gpoint2.getPoint2D());
|
||||
snake.addPoint(p1);
|
||||
snake.addPoint(new Point2D.Double(p2.getX(), p1.getY()));
|
||||
snake.addPoint(p2);
|
||||
return snake;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
// final Snake snake = Snake.create(color, Arrows.asToDown()).withLabel(textBlock, HorizontalAlignment.LEFT);
|
||||
// final Point2D mp1a = translate1.getTranslated(p1);
|
||||
// final Point2D mp2b = translate2.getTranslated(p2);
|
||||
// final double middle = (mp1a.getY() + mp2b.getY()) / 2.0;
|
||||
// snake.addPoint(mp1a);
|
||||
// snake.addPoint(mp1a.getX(), middle);
|
||||
// snake.addPoint(mp2b.getX(), middle);
|
||||
// snake.addPoint(mp2b);
|
||||
// ug.draw(snake);
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
/* ========================================================================
|
||||
* 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.activitydiagram3.gtile;
|
||||
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public interface GConnectionTranslatable extends GConnection {
|
||||
|
||||
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2);
|
||||
|
||||
}
|
@ -35,79 +35,83 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram3.gtile;
|
||||
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.UseStyle;
|
||||
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.ConnectionTranslatable;
|
||||
import net.sourceforge.plantuml.creole.CreoleMode;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.Rainbow;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
import net.sourceforge.plantuml.style.SName;
|
||||
import net.sourceforge.plantuml.style.Style;
|
||||
import net.sourceforge.plantuml.style.StyleSignature;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class GConnectionVerticalDown extends GtileAssemblySimple implements ConnectionTranslatable {
|
||||
public class GConnectionVerticalDown extends GAbstractConnection implements GConnectionTranslatable {
|
||||
|
||||
private final TextBlock textBlock;
|
||||
private final UTranslate pos1;
|
||||
private final UTranslate pos2;
|
||||
|
||||
public GConnectionVerticalDown(Gtile tile1, Gtile tile2, LinkRendering linkRendering) {
|
||||
super(tile1, tile2);
|
||||
this.textBlock = getTextBlock(linkRendering.getDisplay());
|
||||
public GConnectionVerticalDown(UTranslate pos1, GPoint gpoint1, UTranslate pos2, GPoint gpoint2,
|
||||
TextBlock textBlock) {
|
||||
super(gpoint1, gpoint2);
|
||||
this.textBlock = textBlock;
|
||||
this.pos1 = pos1;
|
||||
this.pos2 = pos2;
|
||||
// See FtileFactoryDelegatorAssembly
|
||||
}
|
||||
|
||||
@Override
|
||||
protected UTranslate supplementaryMove() {
|
||||
final double height = 30 + textBlock.calculateDimension(stringBounder).getHeight();
|
||||
System.err.println("height=" + height);
|
||||
return new UTranslate(0, height);
|
||||
}
|
||||
|
||||
final public StyleSignature getDefaultStyleDefinitionArrow() {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.arrow);
|
||||
}
|
||||
|
||||
protected final TextBlock getTextBlock(Display display) {
|
||||
// DUP3945
|
||||
if (Display.isNull(display)) {
|
||||
return TextBlockUtils.EMPTY_TEXT_BLOCK;
|
||||
}
|
||||
final FontConfiguration fontConfiguration;
|
||||
if (UseStyle.useBetaStyle()) {
|
||||
final Style style = getDefaultStyleDefinitionArrow().getMergedStyle(skinParam().getCurrentStyleBuilder());
|
||||
fontConfiguration = style.getFontConfiguration(skinParam().getThemeStyle(), skinParam().getIHtmlColorSet());
|
||||
} else {
|
||||
fontConfiguration = new FontConfiguration(skinParam(), FontParam.ARROW, null);
|
||||
}
|
||||
return display.create7(fontConfiguration, HorizontalAlignment.LEFT, skinParam(), CreoleMode.SIMPLE_LINE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
}
|
||||
|
||||
// public void drawU(UGraphic ug) {
|
||||
// ug.draw(getSimpleSnake());
|
||||
// }
|
||||
//
|
||||
@Override
|
||||
public void drawU(UGraphic ug) {
|
||||
ug.draw(getSimpleSnake());
|
||||
}
|
||||
|
||||
// public double getMaxX(StringBounder stringBounder) {
|
||||
// return getSimpleSnake().getMaxX(stringBounder);
|
||||
// }
|
||||
//
|
||||
// private Snake getSimpleSnake() {
|
||||
// final Snake snake = Snake.create(color, Arrows.asToDown()).withLabel(textBlock, HorizontalAlignment.LEFT);
|
||||
//// snake.addPoint(p1);
|
||||
//// snake.addPoint(p2);
|
||||
// return snake;
|
||||
// }
|
||||
//
|
||||
|
||||
private Rainbow getInLinkRenderingColor() {
|
||||
Rainbow color;
|
||||
color = Rainbow.build(gpoint1.getGtile().skinParam());
|
||||
// final LinkRendering linkRendering = tile.getInLinkRendering();
|
||||
// if (linkRendering == null) {
|
||||
// if (UseStyle.useBetaStyle()) {
|
||||
// final Style style = getDefaultStyleDefinitionArrow()
|
||||
// .getMergedStyle(skinParam().getCurrentStyleBuilder());
|
||||
// return Rainbow.build(style, skinParam().getIHtmlColorSet(), skinParam().getThemeStyle());
|
||||
// } else {
|
||||
// color = Rainbow.build(skinParam());
|
||||
// }
|
||||
// } else {
|
||||
// color = linkRendering.getRainbow();
|
||||
// }
|
||||
// if (color.size() == 0) {
|
||||
// if (UseStyle.useBetaStyle()) {
|
||||
// final Style style = getDefaultStyleDefinitionArrow()
|
||||
// .getMergedStyle(skinParam().getCurrentStyleBuilder());
|
||||
// return Rainbow.build(style, skinParam().getIHtmlColorSet(), skinParam().getThemeStyle());
|
||||
// } else {
|
||||
// color = Rainbow.build(skinParam());
|
||||
// }
|
||||
// }
|
||||
return color;
|
||||
}
|
||||
|
||||
private Snake getSimpleSnake() {
|
||||
final Snake snake = Snake.create(getInLinkRenderingColor(), Arrows.asToDown()).withLabel(textBlock,
|
||||
HorizontalAlignment.LEFT);
|
||||
final Point2D p1 = pos1.getTranslated(gpoint1.getPoint2D());
|
||||
final Point2D p2 = pos2.getTranslated(gpoint2.getPoint2D());
|
||||
snake.addPoint(p1);
|
||||
snake.addPoint(p2);
|
||||
return snake;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
// final Snake snake = Snake.create(color, Arrows.asToDown()).withLabel(textBlock, HorizontalAlignment.LEFT);
|
||||
|
@ -0,0 +1,132 @@
|
||||
/* ========================================================================
|
||||
* 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.activitydiagram3.gtile;
|
||||
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.Rainbow;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UPolygon;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class GConnectionVerticalDownThenHorizontal extends GAbstractConnection implements GConnectionTranslatable {
|
||||
|
||||
private final TextBlock textBlock;
|
||||
private final UTranslate pos1;
|
||||
private final UTranslate pos2;
|
||||
|
||||
public GConnectionVerticalDownThenHorizontal(UTranslate pos1, GPoint gpoint1, UTranslate pos2, GPoint gpoint2,
|
||||
TextBlock textBlock) {
|
||||
super(gpoint1, gpoint2);
|
||||
this.textBlock = textBlock;
|
||||
this.pos1 = pos1;
|
||||
this.pos2 = pos2;
|
||||
// See FtileFactoryDelegatorAssembly
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawU(UGraphic ug) {
|
||||
ug.draw(getSimpleSnake());
|
||||
}
|
||||
|
||||
// public double getMaxX(StringBounder stringBounder) {
|
||||
// return getSimpleSnake().getMaxX(stringBounder);
|
||||
// }
|
||||
|
||||
private Rainbow getInLinkRenderingColor() {
|
||||
Rainbow color;
|
||||
color = Rainbow.build(gpoint1.getGtile().skinParam());
|
||||
// final LinkRendering linkRendering = tile.getInLinkRendering();
|
||||
// if (linkRendering == null) {
|
||||
// if (UseStyle.useBetaStyle()) {
|
||||
// final Style style = getDefaultStyleDefinitionArrow()
|
||||
// .getMergedStyle(skinParam().getCurrentStyleBuilder());
|
||||
// return Rainbow.build(style, skinParam().getIHtmlColorSet(), skinParam().getThemeStyle());
|
||||
// } else {
|
||||
// color = Rainbow.build(skinParam());
|
||||
// }
|
||||
// } else {
|
||||
// color = linkRendering.getRainbow();
|
||||
// }
|
||||
// if (color.size() == 0) {
|
||||
// if (UseStyle.useBetaStyle()) {
|
||||
// final Style style = getDefaultStyleDefinitionArrow()
|
||||
// .getMergedStyle(skinParam().getCurrentStyleBuilder());
|
||||
// return Rainbow.build(style, skinParam().getIHtmlColorSet(), skinParam().getThemeStyle());
|
||||
// } else {
|
||||
// color = Rainbow.build(skinParam());
|
||||
// }
|
||||
// }
|
||||
return color;
|
||||
}
|
||||
|
||||
private Snake getSimpleSnake() {
|
||||
final Point2D p1 = pos1.getTranslated(gpoint1.getPoint2D());
|
||||
final Point2D p2 = pos2.getTranslated(gpoint2.getPoint2D());
|
||||
final UPolygon arrow = p1.getX() < p2.getX() ? Arrows.asToRight() : Arrows.asToLeft();
|
||||
final Snake snake = Snake.create(getInLinkRenderingColor(), arrow).withLabel(textBlock,
|
||||
HorizontalAlignment.LEFT);
|
||||
snake.addPoint(p1);
|
||||
snake.addPoint(new Point2D.Double(p1.getX(), p2.getY()));
|
||||
snake.addPoint(p2);
|
||||
return snake;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
// final Snake snake = Snake.create(color, Arrows.asToDown()).withLabel(textBlock, HorizontalAlignment.LEFT);
|
||||
// final Point2D mp1a = translate1.getTranslated(p1);
|
||||
// final Point2D mp2b = translate2.getTranslated(p2);
|
||||
// final double middle = (mp1a.getY() + mp2b.getY()) / 2.0;
|
||||
// snake.addPoint(mp1a);
|
||||
// snake.addPoint(mp1a.getX(), middle);
|
||||
// snake.addPoint(mp2b.getX(), middle);
|
||||
// snake.addPoint(mp2b);
|
||||
// ug.draw(snake);
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
@ -35,6 +35,8 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram3.gtile;
|
||||
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
@ -42,6 +44,8 @@ public class GPoint {
|
||||
|
||||
public static final String NORTH = "NORTH";
|
||||
public static final String SOUTH = "SOUTH";
|
||||
public static final String WEST = "WEST";
|
||||
public static final String EAST = "EAST";
|
||||
|
||||
private final Gtile gtile;
|
||||
private final String name;
|
||||
@ -69,6 +73,10 @@ public class GPoint {
|
||||
return gtile.getCoord(name);
|
||||
}
|
||||
|
||||
public Point2D getPoint2D() {
|
||||
return getCoord().getPosition();
|
||||
}
|
||||
|
||||
public LinkRendering getLinkRendering() {
|
||||
return linkRendering;
|
||||
}
|
||||
|
@ -35,6 +35,8 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram3.gtile;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
@ -56,8 +58,8 @@ public interface Gtile extends Swimable2, TextBlock {
|
||||
|
||||
public GPoint getGPoint(String name);
|
||||
|
||||
// public Collection<Connection> getInnerConnections();
|
||||
//
|
||||
public Collection<GConnection> getInnerConnections();
|
||||
|
||||
// public List<WeldingPoint> getWeldingPoints();
|
||||
//
|
||||
// public HorizontalAlignment arrowHorizontalAlignment();
|
||||
|
@ -0,0 +1,97 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2020, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* If you like this project or if you find it useful, you can support us at:
|
||||
*
|
||||
* http://plantuml.com/patreon (only 1$ per month!)
|
||||
* http://plantuml.com/paypal
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram3.gtile;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.UseStyle;
|
||||
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
|
||||
import net.sourceforge.plantuml.creole.CreoleMode;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
import net.sourceforge.plantuml.style.SName;
|
||||
import net.sourceforge.plantuml.style.Style;
|
||||
import net.sourceforge.plantuml.style.StyleSignature;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class GtileAssembly extends GtileAssemblySimple {
|
||||
|
||||
private final TextBlock textBlock;
|
||||
|
||||
public GtileAssembly(Gtile tile1, Gtile tile2, LinkRendering linkRendering) {
|
||||
super(tile1, tile2);
|
||||
this.textBlock = getTextBlock(linkRendering.getDisplay());
|
||||
// See FtileFactoryDelegatorAssembly
|
||||
}
|
||||
|
||||
@Override
|
||||
protected UTranslate supplementaryMove() {
|
||||
final double height = 30 + textBlock.calculateDimension(stringBounder).getHeight();
|
||||
return new UTranslate(0, height);
|
||||
}
|
||||
|
||||
final public StyleSignature getDefaultStyleDefinitionArrow() {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.arrow);
|
||||
}
|
||||
|
||||
protected final TextBlock getTextBlock(Display display) {
|
||||
// DUP3945
|
||||
if (Display.isNull(display)) {
|
||||
return TextBlockUtils.EMPTY_TEXT_BLOCK;
|
||||
}
|
||||
final FontConfiguration fontConfiguration;
|
||||
if (UseStyle.useBetaStyle()) {
|
||||
final Style style = getDefaultStyleDefinitionArrow().getMergedStyle(skinParam().getCurrentStyleBuilder());
|
||||
fontConfiguration = style.getFontConfiguration(skinParam().getThemeStyle(), skinParam().getIHtmlColorSet());
|
||||
} else {
|
||||
fontConfiguration = new FontConfiguration(skinParam(), FontParam.ARROW, null);
|
||||
}
|
||||
return display.create7(fontConfiguration, HorizontalAlignment.LEFT, skinParam(), CreoleMode.SIMPLE_LINE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<GConnection> getInnerConnections() {
|
||||
final GConnection arrow = new GConnectionVerticalDown(getPos1(), tile1.getGPoint(GPoint.SOUTH), getPos2(),
|
||||
tile2.getGPoint(GPoint.NORTH), textBlock);
|
||||
return Collections.singletonList(arrow);
|
||||
}
|
||||
|
||||
}
|
@ -41,7 +41,6 @@ import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
@ -49,17 +48,18 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
import net.sourceforge.plantuml.utils.MathUtils;
|
||||
|
||||
public class GtileAssemblySimple extends AbstractGtile implements GConnection {
|
||||
public class GtileAssemblySimple extends AbstractGtile {
|
||||
|
||||
protected final Gtile tile1;
|
||||
protected final Gtile tile2;
|
||||
|
||||
protected final Dimension2D dim1;
|
||||
protected final Dimension2D dim2;
|
||||
private final Dimension2D dim1;
|
||||
private final Dimension2D dim2;
|
||||
|
||||
protected final UTranslate pos1;
|
||||
protected final UTranslate pos2;
|
||||
private final UTranslate pos1;
|
||||
private final UTranslate pos2;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
@ -77,20 +77,23 @@ public class GtileAssemblySimple extends AbstractGtile implements GConnection {
|
||||
final UTranslate vector1 = tile1.getCoord(GPoint.SOUTH);
|
||||
final UTranslate vector2 = tile2.getCoord(GPoint.NORTH);
|
||||
|
||||
final UTranslate diff = vector1.compose(vector2.reverse());
|
||||
// final UTranslate diff = vector1.compose(vector2.reverse());
|
||||
// this.pos1 = diff.getDx() > 0 ? UTranslate.none() : UTranslate.dx(-diff.getDx());
|
||||
// this.pos2 = diff.compose(this.pos1);
|
||||
|
||||
this.pos1 = diff.getDx() > 0 ? UTranslate.none() : UTranslate.dx(-diff.getDx());
|
||||
this.pos2 = diff.compose(this.pos1);
|
||||
final double maxDx = Math.max(vector1.getDx(), vector2.getDx());
|
||||
this.pos1 = UTranslate.dx(maxDx - vector1.getDx());
|
||||
this.pos2 = new UTranslate(maxDx - vector2.getDx(), dim1.getHeight());
|
||||
}
|
||||
|
||||
protected UTranslate supplementaryMove() {
|
||||
return new UTranslate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GPoint> getHooks() {
|
||||
return Arrays.asList(tile1.getGPoint(GPoint.SOUTH), tile2.getGPoint(GPoint.SOUTH));
|
||||
}
|
||||
// @Override
|
||||
// public List<GPoint> getHooks() {
|
||||
// return Arrays.asList(tile1.getGPoint(GPoint.SOUTH), tile2.getGPoint(GPoint.NORTH));
|
||||
// }
|
||||
|
||||
@Override
|
||||
public UTranslate getCoord(String name) {
|
||||
@ -101,11 +104,11 @@ public class GtileAssemblySimple extends AbstractGtile implements GConnection {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
private UTranslate getPos1() {
|
||||
protected UTranslate getPos1() {
|
||||
return pos1;
|
||||
}
|
||||
|
||||
private UTranslate getPos2() {
|
||||
protected UTranslate getPos2() {
|
||||
return pos2.compose(supplementaryMove());
|
||||
}
|
||||
|
||||
@ -118,9 +121,7 @@ public class GtileAssemblySimple extends AbstractGtile implements GConnection {
|
||||
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
||||
final Point2D corner1 = getPos1().getTranslated(dim1);
|
||||
final Point2D corner2 = getPos2().getTranslated(dim2);
|
||||
final double width = Math.max(corner1.getX(), corner2.getX());
|
||||
final double height = Math.max(corner1.getY(), corner2.getY());
|
||||
return new Dimension2DDouble(width, height);
|
||||
return new Dimension2DDouble(MathUtils.max(corner1, corner2));
|
||||
}
|
||||
|
||||
public Set<Swimlane> getSwimlanes() {
|
||||
|
@ -0,0 +1,115 @@
|
||||
/* ========================================================================
|
||||
* 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.activitydiagram3.gtile;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.UseStyle;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Hexagon;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.style.PName;
|
||||
import net.sourceforge.plantuml.style.SName;
|
||||
import net.sourceforge.plantuml.style.Style;
|
||||
import net.sourceforge.plantuml.style.StyleSignature;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
|
||||
public class GtileDiamondInside extends AbstractGtile {
|
||||
|
||||
protected final HColor backColor;
|
||||
protected final HColor borderColor;
|
||||
|
||||
protected final TextBlock label;
|
||||
protected final Dimension2D dimLabel;
|
||||
|
||||
protected final double shadowing;
|
||||
|
||||
final public StyleSignature getDefaultStyleDefinition() {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activity, SName.diamond);
|
||||
}
|
||||
|
||||
// FtileDiamondInside
|
||||
public GtileDiamondInside(StringBounder stringBounder, TextBlock label, ISkinParam skinParam, HColor backColor,
|
||||
HColor borderColor, Swimlane swimlane) {
|
||||
super(stringBounder, skinParam, swimlane);
|
||||
if (UseStyle.useBetaStyle()) {
|
||||
Style style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder());
|
||||
this.borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet());
|
||||
this.backColor = style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet());
|
||||
this.shadowing = style.value(PName.Shadowing).asDouble();
|
||||
} else {
|
||||
this.backColor = backColor;
|
||||
this.borderColor = borderColor;
|
||||
this.shadowing = skinParam().shadowing(null) ? 3 : 0;
|
||||
}
|
||||
|
||||
this.label = label;
|
||||
this.dimLabel = label.calculateDimension(stringBounder);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
||||
final Dimension2D dim;
|
||||
if (dimLabel.getWidth() == 0 || dimLabel.getHeight() == 0) {
|
||||
dim = new Dimension2DDouble(Hexagon.hexagonHalfSize * 2, Hexagon.hexagonHalfSize * 2);
|
||||
} else {
|
||||
dim = Dimension2DDouble.delta(
|
||||
Dimension2DDouble.atLeast(dimLabel, Hexagon.hexagonHalfSize * 2, Hexagon.hexagonHalfSize * 2),
|
||||
Hexagon.hexagonHalfSize * 2, 0);
|
||||
}
|
||||
return dim;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawU(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final Dimension2D dimTotal = calculateDimension(stringBounder);
|
||||
ug = ug.apply(borderColor).apply(getThickness()).apply(backColor.bg());
|
||||
ug.draw(Hexagon.asPolygon(shadowing, dimTotal.getWidth(), dimTotal.getHeight()));
|
||||
|
||||
final double lx = (dimTotal.getWidth() - dimLabel.getWidth()) / 2;
|
||||
final double ly = (dimTotal.getHeight() - dimLabel.getHeight()) / 2;
|
||||
label.drawU(ug.apply(new UTranslate(lx, ly)));
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,221 @@
|
||||
/* ========================================================================
|
||||
* 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.activitydiagram3.gtile;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
|
||||
import net.sourceforge.plantuml.ColorParam;
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.LineBreakStrategy;
|
||||
import net.sourceforge.plantuml.UseStyle;
|
||||
import net.sourceforge.plantuml.activitydiagram3.Branch;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Hexagon;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
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.creole.SheetBlock2;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
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.ConditionEndStyle;
|
||||
import net.sourceforge.plantuml.svek.ConditionStyle;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
|
||||
public class GtileIfHexagon extends GtileIfSimple {
|
||||
|
||||
private final List<Branch> branches;
|
||||
private final Gtile shape1;
|
||||
private final Gtile shape2;
|
||||
|
||||
private final UTranslate positionShape1;
|
||||
private final UTranslate positionShape2;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GtileIfHexagon " + gtiles;
|
||||
}
|
||||
|
||||
// ConditionalBuilder
|
||||
// FtileFactoryDelegatorIf
|
||||
|
||||
public GtileIfHexagon(Swimlane swimlane, List<Gtile> gtiles, List<Branch> branches) {
|
||||
super(gtiles);
|
||||
|
||||
final ConditionStyle conditionStyle = skinParam().getConditionStyle();
|
||||
final ConditionEndStyle conditionEndStyle = skinParam().getConditionEndStyle();
|
||||
|
||||
this.branches = branches;
|
||||
|
||||
final Branch branch0 = branches.get(0);
|
||||
|
||||
final HColor borderColor;
|
||||
final HColor backColor;
|
||||
final FontConfiguration fcTest;
|
||||
|
||||
if (UseStyle.useBetaStyle()) {
|
||||
final Style styleArrow = getDefaultStyleDefinitionArrow()
|
||||
.getMergedStyle(skinParam().getCurrentStyleBuilder());
|
||||
final Style styleDiamond = getDefaultStyleDefinitionDiamond()
|
||||
.getMergedStyle(skinParam().getCurrentStyleBuilder());
|
||||
borderColor = styleDiamond.value(PName.LineColor).asColor(skinParam().getThemeStyle(),
|
||||
skinParam().getIHtmlColorSet());
|
||||
backColor = branch0.getColor() == null ? styleDiamond.value(PName.BackGroundColor)
|
||||
.asColor(skinParam().getThemeStyle(), skinParam().getIHtmlColorSet()) : branch0.getColor();
|
||||
// arrowColor = Rainbow.build(styleArrow, skinParam().getIHtmlColorSet(), skinParam().getThemeStyle());
|
||||
fcTest = styleDiamond.getFontConfiguration(skinParam().getThemeStyle(), skinParam().getIHtmlColorSet());
|
||||
// fcArrow = styleArrow.getFontConfiguration(skinParam().getThemeStyle(), skinParam().getIHtmlColorSet());
|
||||
} else {
|
||||
final FontParam testParam = conditionStyle == ConditionStyle.INSIDE_HEXAGON ? FontParam.ACTIVITY_DIAMOND
|
||||
: FontParam.ARROW;
|
||||
|
||||
borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder);
|
||||
backColor = branch0.getColor() == null
|
||||
? getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBackground)
|
||||
: branch0.getColor();
|
||||
// arrowColor = Rainbow.build(skinParam());
|
||||
fcTest = new FontConfiguration(skinParam(), testParam, null)
|
||||
.changeColor(fontColor(FontParam.ACTIVITY_DIAMOND));
|
||||
// fcArrow = new FontConfiguration(skinParam(), FontParam.ARROW, null);
|
||||
}
|
||||
|
||||
final Sheet sheet = Parser.build(fcTest, skinParam().getDefaultTextAlignment(HorizontalAlignment.LEFT),
|
||||
skinParam(), CreoleMode.FULL).createSheet(branch0.getLabelTest());
|
||||
final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, LineBreakStrategy.NONE, skinParam().getPadding());
|
||||
final TextBlock tbTest = new SheetBlock2(sheetBlock1, Hexagon.asStencil(sheetBlock1), new UStroke());
|
||||
|
||||
this.shape1 = new GtileDiamondInside(getStringBounder(), tbTest, skinParam(), backColor, borderColor, swimlane);
|
||||
this.shape2 = new GtileDiamondInside(getStringBounder(), TextBlockUtils.EMPTY_TEXT_BLOCK, skinParam(),
|
||||
backColor, borderColor, swimlane);
|
||||
|
||||
final double height1 = shape1.calculateDimension(stringBounder).getHeight() + getSuppHeightMargin();
|
||||
|
||||
// public GtileDiamondInside(StringBounder stringBounder, TextBlock label, ISkinParam skinParam, HColor backColor,
|
||||
// HColor borderColor, Swimlane swimlane) {
|
||||
|
||||
for (ListIterator<UTranslate> it = positions.listIterator(); it.hasNext();) {
|
||||
final UTranslate tmp = it.next();
|
||||
it.set(tmp.compose(UTranslate.dy(height1)));
|
||||
}
|
||||
|
||||
this.positionShape1 = this.getCoord(GPoint.NORTH).compose(shape1.getCoord(GPoint.NORTH).reverse());
|
||||
this.positionShape2 = this.getCoord(GPoint.SOUTH).compose(shape2.getCoord(GPoint.SOUTH).reverse());
|
||||
|
||||
}
|
||||
|
||||
private double getSuppHeightMargin() {
|
||||
if (branches.size() == 1)
|
||||
return 30;
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
||||
final double height2 = shape2.calculateDimension(stringBounder).getHeight() + getSuppHeightMargin();
|
||||
final Dimension2D result = super.calculateDimension(stringBounder);
|
||||
return Dimension2DDouble.delta(result, 0, height2);
|
||||
}
|
||||
|
||||
private HColor fontColor(FontParam param) {
|
||||
return skinParam().getFontHtmlColor(null, param);
|
||||
}
|
||||
|
||||
final public StyleSignature getDefaultStyleDefinitionActivity() {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activity);
|
||||
}
|
||||
|
||||
final public StyleSignature getDefaultStyleDefinitionDiamond() {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activity, SName.diamond);
|
||||
}
|
||||
|
||||
final public StyleSignature getDefaultStyleDefinitionArrow() {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.arrow);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawU(UGraphic ug) {
|
||||
super.drawU(ug);
|
||||
|
||||
shape1.drawU(ug.apply(positionShape1));
|
||||
shape2.drawU(ug.apply(positionShape2));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<GConnection> getInnerConnections() {
|
||||
if (branches.size() == 1) {
|
||||
final GConnection arrow1 = new GConnectionVerticalDown(positionShape1, shape1.getGPoint(GPoint.SOUTH),
|
||||
positions.get(0), gtiles.get(0).getGPoint(GPoint.NORTH), TextBlockUtils.EMPTY_TEXT_BLOCK);
|
||||
final GConnection arrow2 = new GConnectionVerticalDown(positions.get(0),
|
||||
gtiles.get(0).getGPoint(GPoint.SOUTH), positionShape2, shape2.getGPoint(GPoint.NORTH),
|
||||
TextBlockUtils.EMPTY_TEXT_BLOCK);
|
||||
return Arrays.asList(arrow1, arrow2);
|
||||
} else if (branches.size() == 2) {
|
||||
final GConnection arrow1 = new GConnectionHorizontalThenVerticalDown(positionShape1,
|
||||
shape1.getGPoint(GPoint.WEST), positions.get(0), gtiles.get(0).getGPoint(GPoint.NORTH),
|
||||
TextBlockUtils.EMPTY_TEXT_BLOCK);
|
||||
final GConnection arrow2 = new GConnectionHorizontalThenVerticalDown(positionShape1,
|
||||
shape1.getGPoint(GPoint.EAST), positions.get(1), gtiles.get(1).getGPoint(GPoint.NORTH),
|
||||
TextBlockUtils.EMPTY_TEXT_BLOCK);
|
||||
|
||||
final GConnection arrow3 = new GConnectionVerticalDownThenHorizontal(positions.get(0),
|
||||
gtiles.get(0).getGPoint(GPoint.SOUTH), positionShape2, shape2.getGPoint(GPoint.WEST),
|
||||
TextBlockUtils.EMPTY_TEXT_BLOCK);
|
||||
final GConnection arrow4 = new GConnectionVerticalDownThenHorizontal(positions.get(1),
|
||||
gtiles.get(1).getGPoint(GPoint.SOUTH), positionShape2, shape2.getGPoint(GPoint.EAST),
|
||||
TextBlockUtils.EMPTY_TEXT_BLOCK);
|
||||
|
||||
return Arrays.asList(arrow1, arrow2, arrow3, arrow4);
|
||||
}
|
||||
return super.getInnerConnections();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,114 @@
|
||||
/* ========================================================================
|
||||
* 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.activitydiagram3.gtile;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
import net.sourceforge.plantuml.utils.MathUtils;
|
||||
|
||||
public class GtileIfSimple extends AbstractGtile {
|
||||
|
||||
protected final List<Gtile> gtiles;
|
||||
private final List<Dimension2D> dims = new ArrayList<>();
|
||||
protected final List<UTranslate> positions = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GtileIfSimple " + gtiles;
|
||||
}
|
||||
|
||||
public GtileIfSimple(List<Gtile> gtiles) {
|
||||
super(gtiles.get(0).getStringBounder(), gtiles.get(0).skinParam());
|
||||
this.gtiles = gtiles;
|
||||
|
||||
double dx = 0;
|
||||
for (Gtile tile : gtiles) {
|
||||
final Dimension2D dim = tile.calculateDimension(getStringBounder());
|
||||
final UTranslate pos = UTranslate.dx(dx);
|
||||
dx += dim.getWidth() + getMargin();
|
||||
dims.add(dim);
|
||||
positions.add(pos);
|
||||
}
|
||||
}
|
||||
|
||||
private double getMargin() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
for (int i = 0; i < gtiles.size(); i++) {
|
||||
final Gtile tile = gtiles.get(i);
|
||||
final UTranslate pos = positions.get(i);
|
||||
ug.apply(pos).draw(tile);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
||||
Point2D result = new Point2D.Double();
|
||||
for (int i = 0; i < dims.size(); i++) {
|
||||
final Dimension2D dim = dims.get(i);
|
||||
final UTranslate pos = positions.get(i);
|
||||
final Point2D corner = pos.getTranslated(dim);
|
||||
result = MathUtils.max(result, corner);
|
||||
}
|
||||
return new Dimension2DDouble(result);
|
||||
}
|
||||
|
||||
public Set<Swimlane> getSwimlanes() {
|
||||
final Set<Swimlane> result = new HashSet<>();
|
||||
for (Gtile tile : gtiles)
|
||||
result.addAll(tile.getSwimlanes());
|
||||
return Collections.unmodifiableSet(result);
|
||||
}
|
||||
|
||||
public Collection<Gtile> getMyChildren() {
|
||||
return Collections.unmodifiableCollection(gtiles);
|
||||
}
|
||||
|
||||
}
|
@ -291,11 +291,13 @@ public final class AtomText extends AbstractAtom implements Atom {
|
||||
|
||||
private boolean isSeparator(char ch) {
|
||||
return Character.isWhitespace(ch) //
|
||||
|| ch == '\uFF0C' // U+FF0C FULLWIDTH COMMA (,)
|
||||
|| ch == '\uFF01' // U+FF01 FULLWIDTH EXCLAMATION MARK (!)
|
||||
|| ch == '\uFF1F' // U+FF1F FULLWIDTH QUESTION MARK (?)
|
||||
|| ch == '\uFF1B' // U+FF1B FULLWIDTH SEMICOLON (;)
|
||||
|| ch == '\uFF08' // U+FF08 FULLWIDTH LEFT PARENTHESIS
|
||||
|| ch == '\uFF09' // U+FF09 FULLWIDTH RIGHT PARENTHESIS
|
||||
|| ch == '\uFF0C' // U+FF0C FULLWIDTH COMMA
|
||||
|| ch == '\uFF1A' // U+FF1A FULLWIDTH COLON (:)
|
||||
|| ch == '\uFF1B' // U+FF1B FULLWIDTH SEMICOLON (;)
|
||||
|| ch == '\uFF1F' // U+FF1F FULLWIDTH QUESTION MARK (?)
|
||||
|| ch == '\u3002'; // U+3002 IDEOGRAPHIC FULL STOP (.)
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,11 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.utils;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
|
||||
public class MathUtils {
|
||||
|
||||
public static double max(double a, double b) {
|
||||
@ -84,4 +89,13 @@ public class MathUtils {
|
||||
return v;
|
||||
}
|
||||
|
||||
public static Dimension2D max(Dimension2D dim1, Dimension2D dim2) {
|
||||
return new Dimension2DDouble(Math.max(dim1.getWidth(), dim2.getWidth()),
|
||||
Math.max(dim1.getHeight(), dim2.getHeight()));
|
||||
}
|
||||
|
||||
public static Point2D max(Point2D pt1, Point2D pt2) {
|
||||
return new Point2D.Double(Math.max(pt1.getX(), pt2.getX()), Math.max(pt1.getY(), pt2.getY()));
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user