1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-25 22:37:33 +00:00
This commit is contained in:
Arnaud Roques 2021-12-15 18:40:12 +01:00
parent 5a1147b92e
commit 180b8eddd1
19 changed files with 203 additions and 107 deletions

View File

@ -44,6 +44,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileWithNotes;
import net.sourceforge.plantuml.activitydiagram3.gtile.Gtile;
import net.sourceforge.plantuml.activitydiagram3.gtile.GtileGroup;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.StringBounder;
@ -52,6 +53,7 @@ import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.sequencediagram.NoteType;
import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
public class InstructionGroup extends AbstractInstruction implements Instruction, InstructionCollection {
@ -63,7 +65,7 @@ public class InstructionGroup extends AbstractInstruction implements Instruction
private final LinkRendering linkRendering;
private final USymbol type;
private final Display test;
private final Display title;
private final double roundCorner;
private PositionedNote note = null;
@ -72,13 +74,13 @@ public class InstructionGroup extends AbstractInstruction implements Instruction
return list.containsBreak();
}
public InstructionGroup(Instruction parent, Display test, HColor backColor, HColor titleColor, Swimlane swimlane,
public InstructionGroup(Instruction parent, Display title, HColor backColor, HColor titleColor, Swimlane swimlane,
HColor borderColor, LinkRendering linkRendering, USymbol type, double roundCorner) {
this.list = new InstructionList(swimlane);
this.type = type;
this.linkRendering = linkRendering;
this.parent = parent;
this.test = test;
this.title = title;
this.borderColor = borderColor;
this.backColor = backColor;
this.titleColor = titleColor;
@ -93,7 +95,8 @@ public class InstructionGroup extends AbstractInstruction implements Instruction
@Override
public Gtile createGtile(ISkinParam skinParam, StringBounder stringBounder) {
Gtile tmp = list.createGtile(skinParam, stringBounder);
return tmp;
return new GtileGroup(tmp, title, null, HColorUtils.BLUE, backColor, titleColor, tmp.skinParam(), borderColor,
type, roundCorner);
}
@Override
@ -102,7 +105,7 @@ public class InstructionGroup extends AbstractInstruction implements Instruction
if (note != null) {
tmp = new FtileWithNotes(tmp, Collections.singleton(note), factory.skinParam());
}
return factory.createGroup(tmp, test, backColor, titleColor, null, borderColor, type, roundCorner);
return factory.createGroup(tmp, title, backColor, titleColor, null, borderColor, type, roundCorner);
}
public Instruction getParent() {

View File

@ -48,6 +48,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileKilled;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlanes;
import net.sourceforge.plantuml.activitydiagram3.gtile.Gtile;
import net.sourceforge.plantuml.activitydiagram3.gtile.GtileBox;
import net.sourceforge.plantuml.activitydiagram3.gtile.GtileRepeat;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.cucadiagram.Display;
@ -100,9 +101,9 @@ public class InstructionRepeat extends AbstractInstruction implements Instructio
}
private boolean isLastOfTheParent() {
if (parent instanceof InstructionList) {
if (parent instanceof InstructionList)
return ((InstructionList) parent).getLast() == this;
}
return false;
}
@ -123,35 +124,48 @@ public class InstructionRepeat extends AbstractInstruction implements Instructio
public CommandExecutionResult add(Instruction ins) {
return repeatList.add(ins);
}
@Override
public Gtile createGtile(ISkinParam skinParam, StringBounder stringBounder) {
final Gtile tile = repeatList.createGtile(skinParam, stringBounder);
return new GtileRepeat(swimlane, tile, null, test);
final Gtile backward = getGtileBackward(skinParam, stringBounder);
return new GtileRepeat(swimlane, tile, null, test, backward);
}
private Gtile getGtileBackward(ISkinParam skinParam, StringBounder stringBounder) {
if (Display.isNull(backward))
return null;
GtileBox result = GtileBox.create(stringBounder, skinParam, backward, getSwimlaneIn(), boxStyle, null);
// if (backwardNotes.size() > 0) {
// result = factory.addNote(result, swimlaneOut, backwardNotes);
// }
return result;
}
public Ftile createFtile(FtileFactory factory) {
final Ftile back = getBackward(factory);
final Ftile back = getFtileBackward(factory);
final Ftile decorateOut = factory.decorateOut(repeatList.createFtile(factory), endRepeatLinkRendering);
if (this.testCalled == false && incoming1.isNone())
incoming1 = swimlanes.nextLinkRenderer();
final Ftile result = factory.repeat(boxStyleIn, swimlane, swimlaneOut, startLabel, decorateOut, test, yes, out,
colors, back, isLastOfTheParent(), incoming1, incoming2);
if (killed) {
if (killed)
return new FtileKilled(result);
}
return result;
}
private Ftile getBackward(FtileFactory factory) {
if (Display.isNull(backward)) {
private Ftile getFtileBackward(FtileFactory factory) {
if (Display.isNull(backward))
return null;
}
Ftile result = factory.activity(backward, swimlaneOut, boxStyle, Colors.empty(), null);
if (backwardNotes.size() > 0) {
if (backwardNotes.size() > 0)
result = factory.addNote(result, swimlaneOut, backwardNotes);
}
return result;
}
@ -186,9 +200,9 @@ public class InstructionRepeat extends AbstractInstruction implements Instructio
@Override
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors, Swimlane swimlaneNote) {
if (Display.isNull(backward)) {
if (Display.isNull(backward))
return repeatList.addNote(note, position, type, colors, swimlaneNote);
}
this.backwardNotes.add(new PositionedNote(note, position, type, colors, swimlaneNote));
return true;

View File

@ -40,16 +40,12 @@ import java.awt.geom.Point2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.UseStyle;
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
import net.sourceforge.plantuml.activitydiagram3.ftile.Hexagon;
import net.sourceforge.plantuml.activitydiagram3.ftile.MergeStrategy;
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.style.Style;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UPolygon;
import net.sourceforge.plantuml.ugraphic.UTranslate;

View File

@ -41,32 +41,32 @@ import net.sourceforge.plantuml.Direction;
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 GConnectionLeftThenVerticalThenRight extends GAbstractConnection {
public class GConnectionSideThenVerticalThenSide extends GAbstractConnection {
private final TextBlock textBlock;
private final UTranslate pos1;
private final UTranslate pos2;
private final double xright;
private final double xpos;
public GConnectionLeftThenVerticalThenRight(UTranslate pos1, GPoint gpoint1, UTranslate pos2, GPoint gpoint2,
double xright, TextBlock textBlock) {
public GConnectionSideThenVerticalThenSide(UTranslate pos1, GPoint gpoint1, UTranslate pos2, GPoint gpoint2,
double xpos, TextBlock textBlock) {
super(gpoint1, gpoint2);
this.textBlock = textBlock;
this.pos1 = pos1;
this.pos2 = pos2;
this.xright = xright;
this.xpos = xpos;
// See FtileFactoryDelegatorAssembly
}
@Override
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
throw new UnsupportedOperationException();
throw new UnsupportedOperationException("wip3");
}
@ -75,10 +75,11 @@ public class GConnectionLeftThenVerticalThenRight extends GAbstractConnection {
final Point2D p1 = pos1.getTranslated(gpoint1.getPoint2D());
final Point2D p2 = pos2.getTranslated(gpoint2.getPoint2D());
final Direction direction = p1.getY() < p2.getY() ? Direction.DOWN : Direction.UP;
final Snake snake = Snake.create(getInLinkRenderingColor(), Arrows.asToLeft()).emphasizeDirection(direction)
final UPolygon tmp = p1.getX() < p2.getX() ? Arrows.asToRight() : Arrows.asToLeft();
final Snake snake = Snake.create(getInLinkRenderingColor(), tmp).emphasizeDirection(direction)
.withLabel(textBlock, HorizontalAlignment.LEFT);
// final double maxX = Math.max(p1.getX(), p2.getX());
final double maxX = xright;
final double maxX = xpos;
snake.addPoint(p1);
snake.addPoint(new Point2D.Double(maxX, p1.getY()));
snake.addPoint(new Point2D.Double(maxX, p2.getY()));

View File

@ -37,14 +37,10 @@ package net.sourceforge.plantuml.activitydiagram3.gtile;
import java.awt.geom.Point2D;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.UseStyle;
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.style.Style;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;

View File

@ -38,16 +38,10 @@ package net.sourceforge.plantuml.activitydiagram3.gtile;
import java.awt.geom.Point2D;
import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.UseStyle;
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
import net.sourceforge.plantuml.activitydiagram3.ftile.Hexagon;
import net.sourceforge.plantuml.activitydiagram3.ftile.MergeStrategy;
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.style.Style;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UPolygon;
import net.sourceforge.plantuml.ugraphic.UTranslate;
@ -57,26 +51,60 @@ public class GConnectionVerticalDownThenBack extends GAbstractConnection {
private final TextBlock textBlock;
private final UTranslate pos1;
private final UTranslate pos2;
private final double xpos;
public GConnectionVerticalDownThenBack(UTranslate pos1, GPoint gpoint1, UTranslate pos2, GPoint gpoint2,
TextBlock textBlock) {
TextBlock textBlock, double xpos) {
super(gpoint1, gpoint2);
this.textBlock = textBlock;
this.pos1 = pos1;
this.pos2 = pos2;
this.xpos = xpos;
// See FtileFactoryDelegatorAssembly
}
@Override
public void drawU(UGraphic ug) {
final Point2D p1 = pos1.getTranslated(gpoint1.getPoint2D());
final Point2D p2 = pos2.getTranslated(gpoint2.getPoint2D());
final UPolygon arrow = Arrows.asToLeft();
final Snake snake = Snake.create(getInLinkRenderingColor(), arrow)
.withLabel(textBlock, HorizontalAlignment.LEFT).emphasizeDirection(Direction.UP);
snake.addPoint(p1);
final Point2D p1bis = UTranslate.dy(10).getTranslated(p1);
snake.addPoint(p1bis);
final double border = xpos;
snake.addPoint(new Point2D.Double(border, p1bis.getY()));
snake.addPoint(new Point2D.Double(border, p2.getY()));
snake.addPoint(p2);
ug.draw(snake);
}
@Override
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
throw new UnsupportedOperationException("wip");
// Point2D p1 = pos1.getTranslated(gpoint1.getPoint2D());
// Point2D p2 = pos2.getTranslated(gpoint2.getPoint2D());
//
// throw new UnsupportedOperationException("wip");
Point2D p1 = pos1.getTranslated(gpoint1.getPoint2D());
Point2D p2 = pos2.getTranslated(gpoint2.getPoint2D());
// final Direction originalDirection = Direction.leftOrRight(p1, p2);
//
//// p1 = translate1.getTranslated(p1);
//// p2 = translate2.getTranslated(p2);
p1 = translate1.getTranslated(p1);
p2 = translate2.getTranslated(p2);
final UPolygon arrow = Arrows.asToLeft();
final Snake snake = Snake.create(getInLinkRenderingColor(), arrow)
.withLabel(textBlock, HorizontalAlignment.LEFT).emphasizeDirection(Direction.UP);
snake.addPoint(p1);
final Point2D p1bis = UTranslate.dy(10).getTranslated(p1);
snake.addPoint(p1bis);
snake.addPoint(new Point2D.Double(p2.getX() + 20, p1bis.getY()));
snake.addPoint(new Point2D.Double(p2.getX() + 20, p2.getY()));
snake.addPoint(p2);
ug.draw(snake);
//
// final double x1 = p1.getX();
// final double x2 = p2.getX();
@ -117,23 +145,6 @@ public class GConnectionVerticalDownThenBack extends GAbstractConnection {
}
@Override
public void drawU(UGraphic ug) {
final Point2D p1 = pos1.getTranslated(gpoint1.getPoint2D());
final Point2D p2 = pos2.getTranslated(gpoint2.getPoint2D());
final UPolygon arrow = Arrows.asToLeft();
final Snake snake = Snake.create(getInLinkRenderingColor(), arrow).withLabel(textBlock,
HorizontalAlignment.LEFT).emphasizeDirection(Direction.UP);
snake.addPoint(p1);
final Point2D p1bis = UTranslate.dy(10).getTranslated(p1);
snake.addPoint(p1bis);
snake.addPoint(new Point2D.Double(p2.getX() + 20, p1bis.getY()));
snake.addPoint(new Point2D.Double(p2.getX() + 20, p2.getY()));
snake.addPoint(p2);
ug.draw(snake);
}
// public double getMaxX(StringBounder stringBounder) {
// return getSimpleSnake().getMaxX(stringBounder);
// }

View File

@ -38,16 +38,12 @@ package net.sourceforge.plantuml.activitydiagram3.gtile;
import java.awt.geom.Point2D;
import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.UseStyle;
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
import net.sourceforge.plantuml.activitydiagram3.ftile.Hexagon;
import net.sourceforge.plantuml.activitydiagram3.ftile.MergeStrategy;
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.style.Style;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UPolygon;
import net.sourceforge.plantuml.ugraphic.UTranslate;

View File

@ -36,11 +36,9 @@
package net.sourceforge.plantuml.activitydiagram3.gtile;
import java.awt.geom.Dimension2D;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.ListIterator;
import java.util.Set;
import net.sourceforge.plantuml.Dimension2DDouble;

View File

@ -40,16 +40,20 @@ import java.util.Collection;
import java.util.Collections;
import java.util.Set;
import net.sourceforge.plantuml.AlignmentParam;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.LineParam;
import net.sourceforge.plantuml.UseStyle;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FloatingNote;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.SymbolContext;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.USymbol;
@ -63,6 +67,7 @@ import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
import net.sourceforge.plantuml.utils.MathUtils;
public class GtileGroup extends AbstractGtileRoot {
@ -81,6 +86,15 @@ public class GtileGroup extends AbstractGtileRoot {
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.partition);
}
private double suppWidth(StringBounder stringBounder) {
final Dimension2D orig = inner.calculateDimension(stringBounder);
final Dimension2D dimTitle = name.calculateDimension(stringBounder);
final Dimension2D dimHeaderNote = headerNote.calculateDimension(stringBounder);
final double suppWidth = MathUtils.max(orig.getWidth(), dimTitle.getWidth() + 20, dimHeaderNote.getWidth() + 20)
- orig.getWidth();
return suppWidth;
}
public GtileGroup(Gtile inner, Display title, Display displayNote, HColor arrowColor, HColor backColor,
HColor titleColor, ISkinParam skinParam, HColor borderColor, USymbol type, double roundCorner) {
super(inner.getStringBounder(), skinParam);
@ -136,20 +150,38 @@ public class GtileGroup extends AbstractGtileRoot {
@Override
public Dimension2D calculateDimension(StringBounder stringBounder) {
// TODO Auto-generated method stub
return null;
final Dimension2D orig = inner.calculateDimension(stringBounder);
return Dimension2DDouble.delta(orig, 18, suppHeight(stringBounder));
}
private double suppHeight(StringBounder stringBounder) {
final Dimension2D dimTitle = name.calculateDimension(stringBounder);
return dimTitle.getHeight() + 30;
}
private UTranslate getTranslate() {
return new UTranslate(9, suppHeight(getStringBounder()) - 10);
}
@Override
protected UTranslate getCoordImpl(String name) {
// TODO Auto-generated method stub
return null;
return inner.getCoord(name).compose(getTranslate());
}
@Override
protected void drawUInternal(UGraphic ug) {
// TODO Auto-generated method stub
final Dimension2D dimTotal = calculateDimension(stringBounder);
final SymbolContext symbolContext = new SymbolContext(backColor, borderColor).withShadow(shadowing)
.withStroke(stroke).withCorner(roundCorner, 0);
final HorizontalAlignment align = inner.skinParam().getHorizontalAlignment(AlignmentParam.packageTitleAlignment,
null, false, null);
type.asBig(name, align, TextBlockUtils.empty(0, 0), dimTotal.getWidth(), dimTotal.getHeight(), symbolContext,
skinParam().getStereotypeAlignment()).drawU(ug);
inner.drawU(ug.apply(getTranslate()));
}
// @Override

View File

@ -101,7 +101,7 @@ public class GtileIfAlone extends GtileTopDown3 {
final double xright = calculateDimension(stringBounder).getWidth();
final GConnection arrow3 = new GConnectionLeftThenVerticalThenRight(getPos1(), tile1.getGPoint(GPoint.EAST_HOOK),
final GConnection arrow3 = new GConnectionSideThenVerticalThenSide(getPos1(), tile1.getGPoint(GPoint.EAST_HOOK),
getPos3(), tile3.getGPoint(GPoint.EAST_HOOK), xright, TextBlockUtils.EMPTY_TEXT_BLOCK);
return Arrays.asList(arrow1, arrow2, arrow3);

View File

@ -50,7 +50,6 @@ import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.utils.MathUtils;
public class GtileIfHexagon extends GtileColumns {

View File

@ -36,8 +36,11 @@
package net.sourceforge.plantuml.activitydiagram3.gtile;
import java.awt.geom.Dimension2D;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.ISkinParam;
@ -47,15 +50,19 @@ import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.color.HColor;
public class GtileRepeat extends GtileTopDown3 {
private static final double SUPP_WIDTH = 15;
public GtileRepeat(Swimlane swimlane, Gtile gtile, HColor color, Display test) {
private final Gtile backward;
public GtileRepeat(Swimlane swimlane, Gtile gtile, HColor color, Display test, Gtile backward) {
super(getShape1(swimlane, color, gtile.getStringBounder(), gtile.skinParam()), gtile,
getShape2(swimlane, color, gtile.getStringBounder(), gtile.skinParam(), test));
this.backward = backward;
}
@ -93,20 +100,37 @@ public class GtileRepeat extends GtileTopDown3 {
return Dimension2DDouble.delta(super.calculateDimension(stringBounder), SUPP_WIDTH, 0);
}
@Override
protected void drawUInternal(UGraphic ug) {
super.drawUInternal(ug);
if (backward != null) {
backward.drawU(ug);
}
}
@Override
public Collection<GConnection> getInnerConnections() {
final List<GConnection> result = new ArrayList<GConnection>();
final GConnection arrow1 = new GConnectionVerticalDown(getPos1(), tile1.getGPoint(GPoint.SOUTH_HOOK), getPos2(),
tile2.getGPoint(GPoint.NORTH_HOOK), TextBlockUtils.EMPTY_TEXT_BLOCK);
final GConnection arrow2 = new GConnectionVerticalDown(getPos2(), tile2.getGPoint(GPoint.SOUTH_HOOK), getPos3(),
tile3.getGPoint(GPoint.NORTH_HOOK), TextBlockUtils.EMPTY_TEXT_BLOCK);
result.add(arrow1);
result.add(arrow2);
final double xright = calculateDimension(stringBounder).getWidth();
final GConnection arrow3 = new GConnectionLeftThenVerticalThenRight(getPos3(), tile3.getGPoint(GPoint.EAST_HOOK),
getPos1(), tile1.getGPoint(GPoint.EAST_HOOK), xright, TextBlockUtils.EMPTY_TEXT_BLOCK);
if (backward == null) {
final GConnection arrow3 = new GConnectionSideThenVerticalThenSide(getPos3(),
tile3.getGPoint(GPoint.EAST_HOOK), getPos1(), tile1.getGPoint(GPoint.EAST_HOOK), xright,
TextBlockUtils.EMPTY_TEXT_BLOCK);
result.add(arrow3);
}
return Arrays.asList(arrow1, arrow2, arrow3);
// final List<GConnection> result = Arrays.asList(arrow1, arrow2, arrow3);
return Collections.unmodifiableList(result);
}
}

View File

@ -76,10 +76,18 @@ public class GtileWhile extends GtileTopDown3 {
public Collection<GConnection> getInnerConnections() {
final GConnection arrow1 = new GConnectionVerticalDown(getPos1(), tile1.getGPoint(GPoint.SOUTH_HOOK), getPos2(),
tile2.getGPoint(GPoint.NORTH_HOOK), TextBlockUtils.EMPTY_TEXT_BLOCK);
final GConnection arrow2 = new GConnectionVerticalDownThenBack(getPos2(), tile2.getGPoint(GPoint.SOUTH_HOOK),
getPos1(), tile1.getGPoint(GPoint.EAST_HOOK), TextBlockUtils.EMPTY_TEXT_BLOCK);
return Arrays.asList(arrow1, arrow2);
final double xright = calculateDimension(stringBounder).getWidth();
final GConnection arrow2 = new GConnectionVerticalDownThenBack(getPos2(), tile2.getGPoint(GPoint.SOUTH_HOOK),
getPos1(), tile1.getGPoint(GPoint.EAST_HOOK), TextBlockUtils.EMPTY_TEXT_BLOCK, xright);
final double xleft = 0;
final GConnection arrow3 = new GConnectionSideThenVerticalThenSide(getPos1(), tile1.getGPoint(GPoint.WEST_HOOK),
getPos3(), tile3.getGPoint(GPoint.SOUTH_HOOK), xleft, TextBlockUtils.EMPTY_TEXT_BLOCK);
return Arrays.asList(arrow1, arrow2, arrow3);
}
// private final Ftile whileBlock;

View File

@ -46,8 +46,6 @@ import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.UseStyle;
import net.sourceforge.plantuml.activitydiagram3.PositionedNote;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.creole.Parser;

View File

@ -233,7 +233,7 @@ public class SURL {
return true;
if (SecurityUtils.getSecurityProfile() == SecurityProfile.INTERNET) {
if (pureIP(cleanPath(internal.toString())))
if (forbiddenURL(cleanPath(internal.toString())))
return false;
final int port = internal.getPort();
@ -243,8 +243,12 @@ public class SURL {
return false;
}
private boolean pureIP(String full) {
return full.matches("^https?://\\d+\\.\\d+\\.\\d+\\.\\d+.*");
private boolean forbiddenURL(String full) {
if (full.matches("^https?://\\d+\\.\\d+\\.\\d+\\.\\d+.*"))
return true;
if (full.matches("^https?://[^.]+/.*"))
return true;
return false;
}
private boolean isInAllowList() {

View File

@ -35,25 +35,27 @@
*/
package net.sourceforge.plantuml.svek;
public class PortGeometry {
public final class PortGeometry implements Comparable<PortGeometry> {
private final String id;
private final double position;
private final double height;
private final int score;
public PortGeometry(double position, double height, int score) {
public PortGeometry(String id, double position, double height, int score) {
this.id = id;
this.position = position;
this.height = height;
this.score = score;
}
public PortGeometry translateY(double deltaY) {
return new PortGeometry(position + deltaY, height, score);
return new PortGeometry(id, position + deltaY, height, score);
}
@Override
public String toString() {
return "pos=" + position + " height=" + height;
return "pos=" + position + " height=" + height + " (" + score + ")";
}
public double getHeight() {
@ -68,8 +70,17 @@ public class PortGeometry {
return position + height;
}
public final int getScore() {
public int getScore() {
return score;
}
public String getId() {
return id;
}
@Override
public int compareTo(PortGeometry other) {
return Double.compare(this.position, other.position);
}
}

View File

@ -35,7 +35,11 @@
*/
package net.sourceforge.plantuml.svek;
import java.util.LinkedHashMap;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
@ -44,7 +48,7 @@ import net.sourceforge.plantuml.SignatureUtils;
public class Ports {
private final Map<String, PortGeometry> ids = new LinkedHashMap<String, PortGeometry>();
private final Map<String, PortGeometry> ids = new HashMap<String, PortGeometry>();
public static String encodePortNameToId(String portName) {
return "p" + SignatureUtils.getMD5Hex(portName);
@ -57,9 +61,9 @@ public class Ports {
public Ports translateY(double deltaY) {
final Ports result = new Ports();
for (Map.Entry<String, PortGeometry> ent : ids.entrySet()) {
for (Map.Entry<String, PortGeometry> ent : ids.entrySet())
result.ids.put(ent.getKey(), ent.getValue().translateY(deltaY));
}
return result;
}
@ -67,7 +71,7 @@ public class Ports {
final String id = encodePortNameToId(Objects.requireNonNull(portName));
final PortGeometry already = ids.get(id);
if (already == null || already.getScore() < score)
ids.put(id, new PortGeometry(position, height, score));
ids.put(id, new PortGeometry(id, position, height, score));
}
public void addThis(Ports other) {
@ -79,8 +83,10 @@ public class Ports {
}
}
public Map<String, PortGeometry> getAllWithEncodedPortId() {
return ids;
public Collection<PortGeometry> getAllPortGeometry() {
final List<PortGeometry> result = new ArrayList<PortGeometry>(ids.values());
Collections.sort(result);
return Collections.unmodifiableCollection(result);
}
}

View File

@ -206,9 +206,8 @@ public class SvekNode implements Positionable, IShapePseudo, Hideable {
sb.append("<TABLE BGCOLOR=\"" + DotStringFactory.sharp000000(color)
+ "\" BORDER=\"0\" CELLBORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"0\">");
double position = 0;
for (Map.Entry<String, PortGeometry> ent : ports.getAllWithEncodedPortId().entrySet()) {
final String portId = ent.getKey();
final PortGeometry geom = ent.getValue();
for (PortGeometry geom : ports.getAllPortGeometry()) {
final String portId = geom.getId();
final double missing = geom.getPosition() - position;
appendTr(sb, null, missing);
appendTr(sb, portId, geom.getHeight());

View File

@ -80,7 +80,7 @@ public class Version {
}
public static int beta() {
final int beta = 2;
final int beta = 3;
return beta;
}