1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-05 21:17:52 +00:00

version 1.2017.13

This commit is contained in:
Arnaud Roques 2017-05-10 21:51:15 +02:00
parent dc9d5327b7
commit 2202502f2f
52 changed files with 867 additions and 446 deletions

View File

@ -35,7 +35,7 @@
<groupId>net.sourceforge.plantuml</groupId>
<artifactId>plantuml</artifactId>
<version>1.2017.13-SNAPSHOT</version>
<version>1.2017.14-SNAPSHOT</version>
<packaging>jar</packaging>
<name>PlantUML</name>

View File

@ -126,8 +126,8 @@ public enum ColorParam {
cloudBorder(HtmlColorUtils.BLACK, ColorType.LINE),
queueBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK),
queueBorder(HtmlColorUtils.MY_RED, ColorType.LINE),
pipeBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK),
pipeBorder(HtmlColorUtils.MY_RED, ColorType.LINE),
stackBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK),
stackBorder(HtmlColorUtils.MY_RED, ColorType.LINE),
databaseBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK),
databaseBorder(HtmlColorUtils.BLACK, ColorType.LINE),
folderBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK),

View File

@ -79,7 +79,7 @@ public enum FontParam {
NODE(14, Font.PLAIN), //
DATABASE(14, Font.PLAIN), //
QUEUE(14, Font.PLAIN), //
PIPE(14, Font.PLAIN), //
STACK(14, Font.PLAIN), //
// SEQUENCE_ARROW(13, Font.PLAIN), //
SEQUENCE_BOX(13, Font.BOLD), //
SEQUENCE_DIVIDER(13, Font.BOLD), //
@ -113,7 +113,7 @@ public enum FontParam {
FRAME_STEREOTYPE(14, Font.ITALIC), //
DATABASE_STEREOTYPE(14, Font.ITALIC), //
QUEUE_STEREOTYPE(14, Font.ITALIC), //
PIPE_STEREOTYPE(14, Font.ITALIC), //
STACK_STEREOTYPE(14, Font.ITALIC), //
ACTOR_STEREOTYPE(14, Font.ITALIC), //
SEQUENCE_STEREOTYPE(14, Font.ITALIC), //
PARTITION(14, Font.PLAIN); //

View File

@ -47,6 +47,8 @@ import net.sourceforge.plantuml.ugraphic.ImageBuilder;
public class OptionFlags {
private static final OptionFlags singleton = new OptionFlags();
// static public final boolean PBBACK = false;
// static public boolean GRAPHVIZCACHE = false;
// static public final boolean TRACE_DOT = false;
@ -74,19 +76,23 @@ public class OptionFlags {
public void reset() {
reset(false);
GraphvizUtils.setDotExecutable(null);
}
public final void setDotExecutable(String dotExecutable) {
GraphvizUtils.setDotExecutable(dotExecutable);
}
private OptionFlags() {
reset(true);
}
private void reset(boolean exit) {
// keepTmpFiles = false;
verbose = false;
extractFromMetadata = false;
word = false;
systemExit = exit;
GraphvizUtils.setDotExecutable(null);
gui = false;
quiet = false;
checkDotError = false;
@ -101,8 +107,6 @@ public class OptionFlags {
return false;
}
private static final OptionFlags singleton = new OptionFlags();
// private boolean keepTmpFiles;
private boolean verbose;
private boolean extractFromMetadata;
@ -123,10 +127,6 @@ public class OptionFlags {
private long timeoutMs = 15 * 60 * 1000L; // 15 minutes
private File logData;
private OptionFlags() {
reset(true);
}
public static OptionFlags getInstance() {
return singleton;
}

View File

@ -86,6 +86,7 @@ public class SkinParam implements ISkinParam {
}
public void setDotExecutable(String dotExecutable) {
Log.info("Overwritting dot in skinparam " + dotExecutable);
this.dotExecutable = dotExecutable;
}

View File

@ -48,6 +48,7 @@ import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlanes;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.core.DiagramDescription;
@ -437,7 +438,7 @@ public class ActivityDiagram3 extends UmlDiagram {
}
public CommandExecutionResult addNote(Display note, NotePosition position, NoteType type, Colors colors) {
final boolean ok = current().addNote(note, position, type, colors);
final boolean ok = current().addNote(note, position, type, colors, swinlanes.getCurrentSwimlane());
if (ok == false) {
return CommandExecutionResult.error("Cannot add note here");
}

View File

@ -90,8 +90,8 @@ public class Branch {
return list.kill();
}
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors) {
return list.addNote(note, position, type, colors);
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors, Swimlane swimlaneNote) {
return list.addNote(note, position, type, colors, swimlaneNote);
}
public final void setInlinkRendering(LinkRendering inlinkRendering) {

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.activitydiagram3;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimable;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
@ -53,6 +54,6 @@ public interface Instruction extends Swimable {
public LinkRendering getInLinkRendering();
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors);
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors, Swimlane swimlaneNote);
}

View File

@ -106,14 +106,14 @@ public class InstructionFork extends WithNote implements Instruction {
}
@Override
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors) {
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors, Swimlane swimlaneNote) {
if (finished) {
return super.addNote(note, position, type, colors);
return super.addNote(note, position, type, colors, swimlaneNote);
}
if (getLastList().getLast() == null) {
return getLastList().addNote(note, position, type, colors);
return getLastList().addNote(note, position, type, colors, swimlaneNote);
}
return getLastList().addNote(note, position, type, colors);
return getLastList().addNote(note, position, type, colors, swimlaneNote);
}
public Set<Swimlane> getSwimlanes() {

View File

@ -35,11 +35,13 @@
*/
package net.sourceforge.plantuml.activitydiagram3;
import java.util.Collections;
import java.util.Set;
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.vcompact.FtileWithNotes;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.color.Colors;
@ -74,7 +76,11 @@ public class InstructionGroup implements Instruction, InstructionCollection {
}
public Ftile createFtile(FtileFactory factory) {
return factory.createGroup(list.createFtile(factory), test, backColor, titleColor, note, borderColor);
Ftile tmp = list.createFtile(factory);
if (note != null) {
tmp = new FtileWithNotes(tmp, Collections.singleton(note), factory.skinParam());
}
return factory.createGroup(tmp, test, backColor, titleColor, null, borderColor);
}
public Instruction getParent() {
@ -89,12 +95,12 @@ public class InstructionGroup implements Instruction, InstructionCollection {
return linkRendering;
}
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors) {
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors, Swimlane swimlaneNote) {
if (list.isEmpty()) {
this.note = new PositionedNote(note, position, type, colors);
this.note = new PositionedNote(note, position, type, colors, swimlaneNote);
return true;
}
return list.addNote(note, position, type, colors);
return list.addNote(note, position, type, colors, swimlaneNote);
}
public Set<Swimlane> getSwimlanes() {

View File

@ -163,11 +163,11 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
}
@Override
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors) {
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors, Swimlane swimlaneNote) {
if (endifCalled || current.isEmpty()) {
return super.addNote(note, position, type, colors);
return super.addNote(note, position, type, colors, swimlaneNote);
} else {
return current.addNote(note, position, type, colors);
return current.addNote(note, position, type, colors, swimlaneNote);
}
}

View File

@ -128,11 +128,11 @@ public class InstructionList extends WithNote implements Instruction, Instructio
return all.get(all.size() - 1);
}
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors) {
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors, Swimlane swimlaneNote) {
if (getLast() == null) {
return super.addNote(note, position, type, colors);
return super.addNote(note, position, type, colors, swimlaneNote);
}
return getLast().addNote(note, position, type, colors);
return getLast().addNote(note, position, type, colors, swimlaneNote);
}
public Set<Swimlane> getSwimlanes() {

View File

@ -86,7 +86,7 @@ public class InstructionPartition implements Instruction {
return list.getInLinkRendering();
}
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors) {
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors, Swimlane swimlaneNote) {
throw new UnsupportedOperationException();
}

View File

@ -133,8 +133,8 @@ public class InstructionRepeat implements Instruction {
return nextLinkRenderer;
}
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors) {
return repeatList.addNote(note, position, type, colors);
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors, Swimlane swimlaneNote) {
return repeatList.addNote(note, position, type, colors, swimlaneNote);
}
public Set<Swimlane> getSwimlanes() {

View File

@ -105,8 +105,8 @@ public class InstructionSplit implements Instruction {
return inlinkRendering;
}
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors) {
return getLast().addNote(note, position, type, colors);
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors, Swimlane swimlaneNote) {
return getLast().addNote(note, position, type, colors, swimlaneNote);
}
public Set<Swimlane> getSwimlanes() {

View File

@ -138,11 +138,11 @@ public class InstructionWhile extends WithNote implements Instruction, Instructi
}
@Override
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors) {
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors, Swimlane swimlaneNote) {
if (repeatList.isEmpty()) {
return super.addNote(note, position, type, colors);
return super.addNote(note, position, type, colors, swimlaneNote);
} else {
return repeatList.addNote(note, position, type, colors);
return repeatList.addNote(note, position, type, colors, swimlaneNote);
}
}

View File

@ -35,6 +35,7 @@
*/
package net.sourceforge.plantuml.activitydiagram3;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
@ -46,12 +47,14 @@ public class PositionedNote {
private final NotePosition notePosition;
private final NoteType type;
private final Colors colors;
private final Swimlane swimlaneNote;
public PositionedNote(Display display, NotePosition position, NoteType type, Colors colors) {
public PositionedNote(Display display, NotePosition position, NoteType type, Colors colors, Swimlane swimlaneNote) {
this.display = display;
this.notePosition = position;
this.type = type;
this.colors = colors;
this.swimlaneNote = swimlaneNote;
}
@Override
@ -59,8 +62,8 @@ public class PositionedNote {
return "type=" + type + " notePosition=" + notePosition + " " + display;
}
public PositionedNote(Display note, NotePosition position, NoteType type) {
this(note, position, type, null);
public PositionedNote(Display note, NotePosition position, NoteType type, Swimlane swimlaneNote) {
this(note, position, type, null, swimlaneNote);
}
public Display getDisplay() {
@ -79,4 +82,8 @@ public class PositionedNote {
return colors;
}
public final Swimlane getSwimlaneNote() {
return swimlaneNote;
}
}

View File

@ -51,8 +51,8 @@ public class WithNote {
private final Collection<PositionedNote> notes = new ArrayList<PositionedNote>();
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors) {
this.notes.add(new PositionedNote(note, position, type, colors));
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors, Swimlane swimlaneNote) {
this.notes.add(new PositionedNote(note, position, type, colors, swimlaneNote));
return true;
}

View File

@ -185,18 +185,15 @@ public class Snake implements UShape {
final Point2D pt1 = worm.get(0);
final Point2D pt2 = worm.get(1);
final Dimension2D dim = textBlock.calculateDimension(stringBounder);
double x = Math.max(pt1.getX(), pt2.getX());
if (horizontalAlignment == HorizontalAlignment.CENTER
&& (worm.getDirectionsCode().startsWith("DLD") || worm.getDirectionsCode().startsWith("DRD"))) {
double x = Math.max(pt1.getX(), pt2.getX()) + 4;
final boolean zigzag = worm.getDirectionsCode().startsWith("DLD") || worm.getDirectionsCode().startsWith("DRD");
if (horizontalAlignment == HorizontalAlignment.CENTER && zigzag) {
final Point2D pt3 = worm.get(2);
x = (pt2.getX() + pt3.getX()) / 2 - dim.getWidth() / 2;
} else {
x += 4;
} else if (horizontalAlignment == HorizontalAlignment.RIGHT && zigzag) {
// final Point2D pt3 = worm.get(2);
x = Math.max(pt1.getX(), pt2.getX()) - dim.getWidth() - 4;
}
// if (worm.getDirectionsCode().startsWith("LD")) {
// final double y = pt1.getY() - dim.getHeight();
// return new Point2D.Double(Math.max(pt1.getX(), pt2.getX()) - dim.getWidth(), y);
// }
final double y = (pt1.getY() + pt2.getY()) / 2 - dim.getHeight() / 2;
return new Point2D.Double(x, y);
}

View File

@ -523,9 +523,9 @@ class FtileRepeat extends AbstractFtile {
final Dimension2D dimDiamond2 = diamond2.calculateDimension(stringBounder);
final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
final Dimension2D dimRepeat = repeat.calculateDimension(stringBounder);
final double y = (dimTotal.getHeight() - dimDiamond1.getHeight() - dimDiamond2.getHeight() - dimRepeat
.getHeight()) / 2;
final double space = dimTotal.getHeight() - dimDiamond1.getHeight() - dimDiamond2.getHeight()
- dimRepeat.getHeight();
final double y = dimDiamond1.getHeight() + space / 2;
final double left = getLeft(stringBounder);
return new UTranslate(left - repeat.calculateDimension(stringBounder).getLeft(), y);

View File

@ -39,6 +39,7 @@ import java.awt.geom.Dimension2D;
import java.awt.geom.Point2D;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import net.sourceforge.plantuml.ColorParam;
@ -79,8 +80,14 @@ public class FtileWithNoteOpale extends AbstractFtile implements Stencil {
// private final HtmlColor arrowColor;
private final NotePosition notePosition;
private final double suppSpace = 20;
private final Swimlane swimlaneNote;
public Set<Swimlane> getSwimlanes() {
if (swimlaneNote != null) {
final Set<Swimlane> result = new HashSet<Swimlane>(tile.getSwimlanes());
result.add(swimlaneNote);
return Collections.unmodifiableSet(result);
}
return tile.getSwimlanes();
}
@ -91,7 +98,7 @@ public class FtileWithNoteOpale extends AbstractFtile implements Stencil {
public Swimlane getSwimlaneOut() {
return tile.getSwimlaneOut();
}
@Override
public Collection<Ftile> getMyChildren() {
return Collections.singleton(tile);
@ -109,6 +116,7 @@ public class FtileWithNoteOpale extends AbstractFtile implements Stencil {
private FtileWithNoteOpale(Ftile tile, PositionedNote note, ISkinParam skinParam, boolean withLink) {
super(tile.skinParam());
this.swimlaneNote = note.getSwimlaneNote();
if (note.getColors() != null) {
skinParam = note.getColors().mute(skinParam);
}
@ -127,7 +135,8 @@ public class FtileWithNoteOpale extends AbstractFtile implements Stencil {
final Sheet sheet = new CreoleParser(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT),
skinParam, CreoleMode.FULL).createSheet(note.getDisplay());
final TextBlock text = new SheetBlock2(new SheetBlock1(sheet, LineBreakStrategy.NONE, skinParam.getPadding()), this, new UStroke(1));
final TextBlock text = new SheetBlock2(new SheetBlock1(sheet, LineBreakStrategy.NONE, skinParam.getPadding()),
this, new UStroke(1));
opale = new Opale(borderColor, noteBackgroundColor, text, skinParam.shadowing(), withLink);
}
@ -163,6 +172,13 @@ public class FtileWithNoteOpale extends AbstractFtile implements Stencil {
}
public void drawU(UGraphic ug) {
final Swimlane intoSw;
if (ug instanceof UGraphicInterceptorOneSwimlane) {
intoSw = ((UGraphicInterceptorOneSwimlane) ug).getSwimlane();
} else {
intoSw = null;
}
final StringBounder stringBounder = ug.getStringBounder();
final Dimension2D dimNote = opale.calculateDimension(stringBounder);
@ -177,7 +193,9 @@ public class FtileWithNoteOpale extends AbstractFtile implements Stencil {
final Point2D pp2 = new Point2D.Double(-suppSpace, dimNote.getHeight() / 2);
opale.setOpale(strategy, pp1, pp2);
}
opale.drawU(ug.apply(getTranslateForOpale(ug)));
if (swimlaneNote == null || intoSw == swimlaneNote) {
opale.drawU(ug.apply(getTranslateForOpale(ug)));
}
ug.apply(getTranslate(stringBounder)).draw(tile);
}

View File

@ -0,0 +1,68 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2017, 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.bpm;
import java.util.EnumSet;
import java.util.Set;
abstract class AbstractConnectorPuzzle implements ConnectorPuzzle {
private final EnumSet<Where> connections = EnumSet.noneOf(Where.class);
public final boolean have(Where where) {
return connections.contains(where);
}
public final void append(Where where) {
this.connections.add(where);
}
public final void remove(Where where) {
final boolean ok = connections.remove(where);
if (ok == false) {
throw new IllegalArgumentException();
}
}
public final void append(ConnectorPuzzle other) {
this.connections.addAll(((AbstractConnectorPuzzle) other).connections);
}
protected final Set<Where> connections() {
return connections;
}
}

View File

@ -57,7 +57,8 @@ public class BpmDiagram extends UmlDiagram {
while (true) {
final boolean v1 = new CleanerEmptyLine().clean(grid);
final boolean v2 = new CleanerInterleavingLines().clean(grid);
if (v1 == false && v2 == false) {
final boolean v3 = new CleanerMoveBlock().clean(grid);
if (v1 == false && v2 == false && v3 == false) {
return;
}
}

View File

@ -34,8 +34,8 @@
*/
package net.sourceforge.plantuml.bpm;
import java.awt.Font;
import java.awt.geom.Dimension2D;
import java.awt.geom.Rectangle2D;
import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.ISkinParam;
@ -49,11 +49,16 @@ import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.InnerStrategy;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.ULine;
import net.sourceforge.plantuml.ugraphic.UTranslate;
public class BpmElement implements Placeable {
public class BpmElement extends AbstractConnectorPuzzle implements ConnectorPuzzle {
private final String id;
private final BpmElementType type;
@ -86,6 +91,47 @@ public class BpmElement implements Placeable {
}
public TextBlock toTextBlock(ISkinParam skinParam) {
final TextBlock raw = toTextBlockInternal(skinParam);
return new TextBlock() {
public void drawU(UGraphic ug) {
raw.drawU(ug);
ug = ug.apply(new UChangeColor(HtmlColorUtils.RED));
for (Where w : Where.values()) {
if (have(w)) {
drawLine(ug, w, raw.calculateDimension(ug.getStringBounder()));
}
}
}
public Rectangle2D getInnerPosition(String member, StringBounder stringBounder, InnerStrategy strategy) {
return raw.getInnerPosition(member, stringBounder, strategy);
}
public Dimension2D calculateDimension(StringBounder stringBounder) {
return raw.calculateDimension(stringBounder);
}
};
}
private void drawLine(UGraphic ug, Where w, Dimension2D total) {
final double width = total.getWidth();
final double height = total.getHeight();
if (w == Where.WEST) {
ug.apply(new UTranslate(-10, height / 2)).draw(new ULine(10, 0));
}
if (w == Where.EAST) {
ug.apply(new UTranslate(width, height / 2)).draw(new ULine(10, 0));
}
if (w == Where.NORTH) {
ug.apply(new UTranslate(width / 2, -10)).draw(new ULine(0, 10));
}
if (w == Where.SOUTH) {
ug.apply(new UTranslate(width / 2, height)).draw(new ULine(0, 10));
}
}
public TextBlock toTextBlockInternal(ISkinParam skinParam) {
if (type == BpmElementType.START) {
return new FtileCircleStart(skinParam, HtmlColorUtils.BLACK, null);
}
@ -118,4 +164,5 @@ public class BpmElement implements Placeable {
public final String getId() {
return id;
}
}

View File

@ -55,6 +55,14 @@ public class ChainImpl<O> implements Chain<O> {
return result;
}
public ChainImpl<O> cloneMe() {
final ChainImpl<O> result = new ChainImpl<O>();
result.currentVersion = this.currentVersion;
result.positive.addAll(this.positive);
result.negative.addAll(this.negative);
return result;
}
public int compare(O a, O b) {
if (a.equals(b)) {
return 0;
@ -93,6 +101,9 @@ public class ChainImpl<O> implements Chain<O> {
return Collections.unmodifiableList(result);
}
private ChainImpl() {
}
public ChainImpl(O root) {
if (root == null) {
throw new IllegalArgumentException();

View File

@ -35,26 +35,24 @@
*/
package net.sourceforge.plantuml.bpm;
import net.sourceforge.plantuml.bpm.ConnectorPuzzle.Where;
public class CleanerInterleavingLines implements GridCleaner {
public boolean clean(Grid grid) {
System.err.println("running CleanerInterleavingLines");
// System.err.println("running CleanerInterleavingLines");
boolean result = false;
Line previous = null;
// int i = 0;
for (Line line : grid.lines().toList()) {
// System.err.println("--------- LINE i=" + i);
// i++;
if (previous != null) {
if (mergeable(grid, previous, line)) {
System.err.println("MERGEABLE! " + previous + " " + line);
// System.err.println("MERGEABLE! " + previous + " " + line);
mergeLines(grid, previous, line);
return true;
}
}
previous = line;
}
// }
return result;
}
@ -96,11 +94,16 @@ public class CleanerInterleavingLines implements GridCleaner {
return data1;
}
if (data2 instanceof BpmElement) {
final ConnectorPuzzleEmpty puz1 = (ConnectorPuzzleEmpty) data1;
if (puz1.checkDirections("SW")) {
((BpmElement) data2).remove(Where.NORTH);
((BpmElement) data2).append(Where.WEST);
}
return data2;
}
assert data1 instanceof ConnectorPuzzle && data2 instanceof ConnectorPuzzle;
final ConnectorPuzzle puz1 = (ConnectorPuzzle) data1;
final ConnectorPuzzle puz2 = (ConnectorPuzzle) data2;
assert data1 instanceof ConnectorPuzzleEmpty && data2 instanceof ConnectorPuzzleEmpty;
final ConnectorPuzzleEmpty puz1 = (ConnectorPuzzleEmpty) data1;
final ConnectorPuzzleEmpty puz2 = (ConnectorPuzzleEmpty) data2;
return puz2;
}
@ -109,43 +112,47 @@ public class CleanerInterleavingLines implements GridCleaner {
return true;
}
assert data1 != null && data2 != null;
if (data1 instanceof ConnectorPuzzle && data2 instanceof ConnectorPuzzle) {
return mergeableCC((ConnectorPuzzle) data1, (ConnectorPuzzle) data2);
if (data1 instanceof ConnectorPuzzleEmpty && data2 instanceof ConnectorPuzzleEmpty) {
return mergeableCC((ConnectorPuzzleEmpty) data1, (ConnectorPuzzleEmpty) data2);
}
if (data1 instanceof ConnectorPuzzle && data2 instanceof BpmElement) {
final boolean result = mergeablePuzzleSingle((ConnectorPuzzle) data1);
System.err.println("OTHER2=" + data2 + " " + data1 + " " + result);
if (data1 instanceof ConnectorPuzzleEmpty && data2 instanceof BpmElement) {
final boolean result = mergeablePuzzleSingle((ConnectorPuzzleEmpty) data1, (BpmElement) data2);
// System.err.println("OTHER2=" + data2 + " " + data1 + " " + result);
return result;
}
if (data2 instanceof ConnectorPuzzle && data1 instanceof BpmElement) {
final boolean result = mergeablePuzzleSingle((ConnectorPuzzle) data2);
System.err.println("OTHER1=" + data1 + " " + data2 + " " + result);
if (data2 instanceof ConnectorPuzzleEmpty && data1 instanceof BpmElement) {
final boolean result = mergeablePuzzleSingle((BpmElement) data1, (ConnectorPuzzleEmpty) data2);
// System.err.println("OTHER1=" + data1 + " " + data2 + " " + result);
return result;
}
return false;
}
private boolean mergeablePuzzleSingle(ConnectorPuzzle puz) {
if (puz == ConnectorPuzzle.get("NS")) {
private boolean mergeablePuzzleSingle(ConnectorPuzzleEmpty data1, BpmElement data2) {
if (data1.checkDirections("NS")) {
return true;
}
if (puz == ConnectorPuzzle.get("NE")) {
return true;
}
if (puz == ConnectorPuzzle.get("NW")) {
if (data1.checkDirections("SW")) {
return true;
}
return false;
}
private boolean mergeableCC(ConnectorPuzzle puz1, ConnectorPuzzle puz2) {
if (puz1 == ConnectorPuzzle.get("NS") && puz2 == ConnectorPuzzle.get("NS")) {
private boolean mergeablePuzzleSingle(BpmElement data1, ConnectorPuzzleEmpty data2) {
if (data2.checkDirections("NS")) {
return true;
}
if (puz1 == ConnectorPuzzle.get("NS") && puz2 == ConnectorPuzzle.get("NE")) {
return false;
}
private boolean mergeableCC(ConnectorPuzzleEmpty puz1, ConnectorPuzzleEmpty puz2) {
if (puz1.checkDirections("NS") && puz2.checkDirections("NS")) {
return true;
}
if (puz1 == ConnectorPuzzle.get("NS") && puz2 == ConnectorPuzzle.get("NW")) {
if (puz1.checkDirections("NS") && puz2.checkDirections("NE")) {
return true;
}
if (puz1.checkDirections("NS") && puz2.checkDirections("NW")) {
return true;
}
return false;

View File

@ -0,0 +1,94 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2017, 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.bpm;
public class CleanerMoveBlock implements GridCleaner {
public boolean clean(Grid grid) {
System.err.println("CleanerMoveBlock");
for (Line line : grid.lines().toList()) {
tryGrid(grid, line);
}
return false;
}
private void tryGrid(Grid grid, Line line) {
// System.err.println("TRYING LINE " + line);
for (Col col1 : grid.cols().toList()) {
final Placeable cell1 = grid.getCell(line, col1).getData();
if (cell1 instanceof ConnectorPuzzleEmpty == false) {
continue;
}
final ConnectorPuzzleEmpty puzzle1 = (ConnectorPuzzleEmpty) cell1;
if (puzzle1.checkDirections("NS") == false) {
continue;
}
final Navigator<Col> it2 = grid.cols().navigator(col1);
int cpt = 0;
while (true) {
final Col col2 = it2.next();
cpt++;
if (col2 == null) {
break;
}
if (col1 == col2) {
continue;
}
final Placeable cell2 = grid.getCell(line, col2).getData();
if (cell2 == null) {
continue;
}
if (cell2 instanceof ConnectorPuzzleEmpty == false) {
break;
}
final ConnectorPuzzleEmpty puzzle2 = (ConnectorPuzzleEmpty) cell2;
if (puzzle2.checkDirections("NS") == false) {
continue;
}
if (cpt > 1) {
tryBridge(line, col1, col2);
}
break;
}
}
}
private void tryBridge(Line line, Col col1, final Col col2) {
System.err.println("LINE=" + line + " " + col1 + " " + col2 + " ");
}
}

View File

@ -35,21 +35,7 @@
*/
package net.sourceforge.plantuml.bpm;
import java.awt.geom.Dimension2D;
import java.awt.geom.Rectangle2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.InnerStrategy;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.ULine;
import net.sourceforge.plantuml.ugraphic.UTranslate;
public class ConnectorPuzzle implements Placeable, TextBlock {
public interface ConnectorPuzzle extends Placeable {
public static enum Where {
NORTH(1), EAST(2), SOUTH(4), WEST(8);
@ -63,98 +49,16 @@ public class ConnectorPuzzle implements Placeable, TextBlock {
String toShortString() {
return name().substring(0, 1);
}
}
private static final ConnectorPuzzle all[] = new ConnectorPuzzle[16];
private final int type;
static {
for (int i = 0; i < all.length; i++) {
all[i] = new ConnectorPuzzle(i);
int getCoding() {
return coding;
}
}
public ConnectorPuzzle append(ConnectorPuzzle before) {
return all[this.type | before.type];
}
public void append(Where where);
public static ConnectorPuzzle get(String value) {
int num = 0;
for (Where w : Where.values()) {
if (value.contains(w.toShortString())) {
num += w.coding;
}
}
return all[num];
}
public void remove(Where where);
public boolean have(Where where) {
return (type & where.coding) != 0;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
for (Where w : Where.values()) {
if (have(w)) {
sb.append(w.toShortString());
}
}
if (sb.length() == 0) {
sb.append("NONE");
}
return sb.toString();
}
private ConnectorPuzzle(int type) {
this.type = type;
}
public Dimension2D getDimension(StringBounder stringBounder, ISkinParam skinParam) {
return new Dimension2DDouble(20, 20);
}
public TextBlock toTextBlock(ISkinParam skinParam) {
return this;
}
public String getId() {
throw new UnsupportedOperationException();
}
public void drawU(UGraphic ug) {
// System.err.println("DRAWING " + toString());
ug = ug.apply(new UChangeColor(HtmlColorUtils.BLUE));
for (Where w : Where.values()) {
if (have(w)) {
drawLine(ug, w);
}
}
}
private void drawLine(UGraphic ug, Where w) {
if (w == Where.WEST) {
ug.apply(new UTranslate(0, 10)).draw(new ULine(10, 0));
}
if (w == Where.EAST) {
ug.apply(new UTranslate(10, 10)).draw(new ULine(10, 0));
}
if (w == Where.NORTH) {
ug.apply(new UTranslate(10, 0)).draw(new ULine(0, 10));
}
if (w == Where.SOUTH) {
ug.apply(new UTranslate(10, 10)).draw(new ULine(0, 10));
}
}
public Dimension2D calculateDimension(StringBounder stringBounder) {
return new Dimension2DDouble(20, 20);
}
public Rectangle2D getInnerPosition(String member, StringBounder stringBounder, InnerStrategy strategy) {
return null;
}
public boolean have(Where where);
}

View File

@ -0,0 +1,123 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2017, 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.bpm;
import java.awt.geom.Dimension2D;
import java.awt.geom.Rectangle2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.InnerStrategy;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.ULine;
import net.sourceforge.plantuml.ugraphic.UTranslate;
public class ConnectorPuzzleEmpty extends AbstractConnectorPuzzle implements Placeable, TextBlock, ConnectorPuzzle {
public static ConnectorPuzzleEmpty get(String value) {
final ConnectorPuzzleEmpty result = new ConnectorPuzzleEmpty();
for (Where w : Where.values()) {
if (value.contains(w.toShortString())) {
result.append(w);
}
}
return result;
}
public boolean checkDirections(String directions) {
return connections().equals(get(directions).connections());
}
@Override
public String toString() {
if (connections().size() == 0) {
return "NONE";
}
return connections().toString();
}
public Dimension2D getDimension(StringBounder stringBounder, ISkinParam skinParam) {
return new Dimension2DDouble(20, 20);
}
public TextBlock toTextBlock(ISkinParam skinParam) {
return this;
}
public String getId() {
throw new UnsupportedOperationException();
}
public void drawU(UGraphic ug) {
// System.err.println("DRAWING " + toString());
ug = ug.apply(new UChangeColor(HtmlColorUtils.BLUE));
for (Where w : Where.values()) {
if (have(w)) {
drawLine(ug, w);
}
}
}
private void drawLine(UGraphic ug, Where w) {
if (w == Where.WEST) {
ug.apply(new UTranslate(0, 10)).draw(new ULine(10, 0));
}
if (w == Where.EAST) {
ug.apply(new UTranslate(10, 10)).draw(new ULine(10, 0));
}
if (w == Where.NORTH) {
ug.apply(new UTranslate(10, 0)).draw(new ULine(0, 10));
}
if (w == Where.SOUTH) {
ug.apply(new UTranslate(10, 10)).draw(new ULine(0, 10));
}
}
public Dimension2D calculateDimension(StringBounder stringBounder) {
return new Dimension2DDouble(20, 20);
}
public Rectangle2D getInnerPosition(String member, StringBounder stringBounder, InnerStrategy strategy) {
return null;
}
}

View File

@ -0,0 +1,45 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2017, 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.bpm;
import java.util.HashSet;
import java.util.Set;
public class FootPrint {
private final Set<Coord> cells = new HashSet<Coord>();
}

View File

@ -44,6 +44,7 @@ import java.util.Map;
import java.util.Set;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.bpm.ConnectorPuzzle.Where;
public class Grid {
@ -59,6 +60,17 @@ public class Grid {
this.cells.put(root, new Cell());
}
private Grid(Grid other) {
this.lines = ((ChainImpl<Line>) other.lines).cloneMe();
this.cols = ((ChainImpl<Col>) other.cols).cloneMe();
this.root = other.root;
this.cells.putAll(other.cells);
}
public Grid cloneMe() {
return new Grid(this);
}
public Cell getCell(Coord coord) {
return getCell(coord.getLine(), coord.getCol());
}
@ -256,7 +268,6 @@ public class Grid {
}
public void removeLine(Line line) {
System.err.println("REMOVING " + line);
assert usedColsOf(line).isEmpty();
for (final Iterator<Map.Entry<Coord, Cell>> it = cells.entrySet().iterator(); it.hasNext();) {
final Map.Entry<Coord, Cell> ent = it.next();
@ -308,15 +319,25 @@ public class Grid {
final boolean startHorizontal = i == 0;
if (startHorizontal) {
// System.err.println("DrawingHorizontal " + ent.getValue() + " --> " + dests.get(i) + " " + i);
drawHorizontal(src, dest);
drawStartHorizontal(src, dest);
} else {
drawVertical(src, dest);
drawStartVertical(src, dest);
}
}
}
}
private void drawVertical(final Coord src, final Coord dest) {
private void drawStartVertical(final Coord src, final Coord dest) {
if (src.getLine() == dest.getLine() && src.getCol() == dest.getCol()) {
throw new IllegalStateException();
}
final BpmElement start = (BpmElement) getCell(src).getData();
final int compare = lines.compare(src.getLine(), dest.getLine());
if (compare == 0) {
throw new IllegalStateException();
}
start.append(compare < 0 ? Where.SOUTH : Where.NORTH);
for (Navigator<Line> itLine = Navigators.iterate(lines, src.getLine(), dest.getLine()); itLine.get() != dest
.getLine();) {
final Line cur = itLine.next();
@ -330,6 +351,10 @@ public class Grid {
addPuzzle(dest.getLine(), cur, "EW");
}
}
final BpmElement end = (BpmElement) getCell(dest).getData();
if (src.getLine() == dest.getLine()) {
end.append(compare < 0 ? Where.NORTH : Where.SOUTH);
}
if (src.getLine() != dest.getLine() && src.getCol() != dest.getCol()) {
if (lines.compare(dest.getLine(), src.getLine()) > 0) {
addPuzzle(dest.getLine(), src.getCol(), "N");
@ -341,11 +366,22 @@ public class Grid {
} else {
addPuzzle(dest.getLine(), src.getCol(), "W");
}
end.append(cols.compare(src.getCol(), dest.getCol()) > 0 ? Where.EAST : Where.WEST);
}
}
private void drawHorizontal(final Coord src, final Coord dest) {
private void drawStartHorizontal(final Coord src, final Coord dest) {
if (src.getLine() == dest.getLine() && src.getCol() == dest.getCol()) {
throw new IllegalStateException();
}
final BpmElement start = (BpmElement) getCell(src).getData();
final int compare = cols.compare(src.getCol(), dest.getCol());
if (compare == 0) {
throw new IllegalStateException();
}
start.append(compare < 0 ? Where.EAST : Where.WEST);
for (Navigator<Col> itCol = Navigators.iterate(cols, src.getCol(), dest.getCol()); itCol.get() != dest.getCol();) {
final Col cur = itCol.next();
if (cur != dest.getCol()) {
@ -359,6 +395,10 @@ public class Grid {
addPuzzle(cur, dest.getCol(), "NS");
}
}
final BpmElement end = (BpmElement) getCell(dest).getData();
if (src.getLine() == dest.getLine()) {
end.append(compare < 0 ? Where.WEST : Where.EAST);
}
if (src.getLine() != dest.getLine() && src.getCol() != dest.getCol()) {
if (cols.compare(dest.getCol(), src.getCol()) > 0) {
addPuzzle(src.getLine(), dest.getCol(), "W");
@ -370,17 +410,18 @@ public class Grid {
} else {
addPuzzle(src.getLine(), dest.getCol(), "N");
}
end.append(lines.compare(src.getLine(), dest.getLine()) > 0 ? Where.SOUTH : Where.NORTH);
}
}
private void addPuzzle(Line line, Col col, String direction) {
final Cell cell = getCell(line, col);
ConnectorPuzzle after = ConnectorPuzzle.get(direction);
final ConnectorPuzzle before = (ConnectorPuzzle) cell.getData();
if (before != null) {
after = after.append(before);
ConnectorPuzzleEmpty connector = (ConnectorPuzzleEmpty) cell.getData();
if (connector == null) {
connector = new ConnectorPuzzleEmpty();
cell.setData(connector);
}
cell.setData(after);
connector.append(ConnectorPuzzleEmpty.get(direction));
}
}

View File

@ -61,7 +61,7 @@ import net.sourceforge.plantuml.graphic.color.Colors;
public class CommandCreateElementFull extends SingleLineCommand2<DescriptionDiagram> {
public static final String ALL_TYPES = "artifact|actor|folder|card|file|package|rectangle|node|frame|cloud|database|queue|pipe|storage|agent|usecase|component|boundary|control|entity|interface";
public static final String ALL_TYPES = "artifact|actor|folder|card|file|package|rectangle|node|frame|cloud|database|queue|stack|storage|agent|usecase|component|boundary|control|entity|interface";
public CommandCreateElementFull() {
super(getRegexConcat());

View File

@ -64,18 +64,18 @@ import net.sourceforge.plantuml.version.PSystemVersion;
public class PSystemDonors extends AbstractPSystem {
public static final String DONORS = "UDfbL4jksp0GtSyfk1RIGoXsxDI_17QQ0jcDfR75c29TKd8ghOAUeK3NlKABB8eMsVG2oeqwSYkJIWaO"
+ "CCNXp7lptZ1MqRz55gwf82jYNHWjCO4RYlmoESoCtre7SNSLrp2s_eWgMD4QNI5HYuN9DCGwDLQC3HKr"
+ "jNyt6uxemb7338D2ke2Xx3PIGUnJcmEiIW-XWh6C-aiRc7GeImUhWlOPQJ4mPi_yXbqTSZ3DNrqr5WP6"
+ "IIsMfdG4a_BLUNHlc4YtsKkO1wWn3xTSAbRq4NNAxHnaahDkqLRCT7cYhRUm2D4NDLmfUU0BGvdi6Fdf"
+ "H6guSAVKEW0HqG66TIuBMuaPPYP5cBHDlykGqmTn4Ial5wzTnMtIM70SusDSax_WQTTZfLFUseHxCiAr"
+ "hNRcmUqa9r9yxSeMiePB7vqQcCia8oNEKQegPA3g48npC27KRoQOV2Z9YM6vjiXQAi_trjmNb6HYQj6X"
+ "XxGbjcYWs4FhB0uHKtEGeL6ELddd2Kk4PM3UjaJ8Cxhds_l0LcRNTkRSMDIezcVYZWeqUmTB9eWs5LFP"
+ "IWiZPMpRx_dlNqeTHVU6K84vsKwpavqiTjrkLS_wZ1nSOsUFfUm1ZfKKAyIKHyTkIRmdlILx9kRnpTjL"
+ "xAqT6GrZwerCo5mdR95St3Bg8PjswYCjjShoiCo8uE8GEl-0iF19AEz0HW6DSIdP5sLEOcHAAdn_4mUZ"
+ "K9aZ5-y6NOTjOxWBkMKFhMJkHv01yIHlsauZJtK0Eb8Aci_DKv2-UMf-m23hZNR5WrUkZm-1rJmBbwO7"
+ "Pqncix5KYONCMRW9_l-gB763IimhftX6cg_DqyjZyxqj9PelpNFpitb--SI_H_xq3IuirMAAAkV9kWor"
+ "RkrAxDTpKksX3cJZAZ9u5QE87ya-2pROBRr-bA9ImH_rNe_d";
public static final String DONORS = "UDfbL4jksp0GtSyfk1RIGoXsujI_17QQ0jcDvR75c29Tad8ghuBUe421hdk3eaKMHOjiUW7bHXsvbKcb"
+ "10oOudpUctapgKh-7R9mHPwiIBKtMc86rvI4OmeOct2r3jBM5HSmiE69AfZJ0fsNgCNKv1fIlJHM30pv"
+ "FJL_LoksQCrHmnYZHDf3NxONgI0DeSqEvcM0KC509jsZ3GnRbAM3kQTjJbhqZDaoltwRXnoCYXUknaBF"
+ "AAd5p9IEO5Y-U4_k31DfBri9amWr5l6LKwMAtgDUSZbxkUIeQxGLCvqTQUirJ6FqVW-NIkxOeI-p3IC_"
+ "laWDP-uOMaSW4jf1Vrz8Roinnjmi4OPDqMzpvF2HNK8gj8lFfk8oQVHin_WOr_0lUDfqMEabNst6DJd7"
+ "XQqsvjvj90TIx7PflTp3HR1U6fZ8B2SbJb6gAcQWzZ4Ovs18g5yDCNjNaXFzSc6HUwa2tnjpvodBnSYY"
+ "mm1fJIpHg6FtZRBOH8pCJiP2EKZbJI0i4MQHU9iKCS_aZhstaQpCfgdCgR6eKMrFn2rvD5i7CoQ8TYb6"
+ "icajd2jZctfFVlzIwj3q80WLYPFbD3xAoM9RxQRhUPUHWojivJ6J7S2facAEkEJHiMiIRqcloPw8INhz"
+ "Ufu6QIT6mu0w8nCprnbBf10tZBhFeXq5IqjDPtbOnaHmjekLlqEOXY1Kj22JYCQWbAoBiY1nRahoeRwP"
+ "W_EuCmSkGGrw7vUDuKxbcZKqbqKOGGR4axngAeqyrH7eH2ceFzMFKVZwiVu1lRmpsXKFNhauB0AhUHOk"
+ "J0VEWCngPQaIKrbmuuRu_rQPuGgLc5HEyOpKN-h7vuVwUvDAr9_hf_fd_VJyWNyF_EaRd5dQYn6gWYVh"
+ "8kvr8rTYlPwIQXvrr3RE8gEjc2Iy9BiiM60tz78f9QNYlT5IyJ0_17GUwe_rrsD961Zy0II4d1O0";
@Override
final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed)

View File

@ -232,7 +232,7 @@ public class QuoteUtils {
"V'z fbeel, ner lbh sebz gur cnfg ?", "Unir lbh gevrq gheavat vg bss naq ba ntnva ?",
"Vs lbh qba'g xabj jurer lbh ner tbvat nal ebnq pna gnxr lbh gurer",
"Ortva ng gur ortvaavat, naq tb ba gvyy lbh pbzr gb gur raq: gura fgbc",
"Xrrc pnyz naq cerff Pgey-Nyg-Qry");
"Xrrc pnyz naq cerff Pgey-Nyg-Qry", "Vs lbh glcr Tbbtyr vagb Tbbtyr, lbh pna oernx gur Vagrearg.");
private QuoteUtils() {
}

View File

@ -62,8 +62,8 @@ public class SkinParameter {
public static final SkinParameter QUEUE = new SkinParameter("QUEUE", ColorParam.queueBackground,
ColorParam.queueBorder, FontParam.QUEUE, FontParam.QUEUE_STEREOTYPE);
public static final SkinParameter PIPE = new SkinParameter("PIPE", ColorParam.pipeBackground,
ColorParam.pipeBorder, FontParam.PIPE, FontParam.PIPE_STEREOTYPE);
public static final SkinParameter STACK = new SkinParameter("STACK", ColorParam.stackBackground,
ColorParam.stackBorder, FontParam.STACK, FontParam.STACK_STEREOTYPE);
public static final SkinParameter CLOUD = new SkinParameter("CLOUD", ColorParam.cloudBackground,
ColorParam.cloudBorder, FontParam.CLOUD, FontParam.CLOUD_STEREOTYPE);

View File

@ -74,7 +74,7 @@ public abstract class USymbol {
public final static USymbol CONTROL = record("CONTROL", SkinParameter.CONTROL, new USymbolControl(2));
public final static USymbol INTERFACE = record("INTERFACE", SkinParameter.INTERFACE, new USymbolInterface());
public final static USymbol QUEUE = record("QUEUE", SkinParameter.QUEUE, new USymbolQueue());
public final static USymbol PIPE = record("PIPE", SkinParameter.PIPE, new USymbolPipe());
public final static USymbol STACK = record("STACK", SkinParameter.STACK, new USymbolStack());
public final static USymbol TOGETHER = record("TOGETHER", SkinParameter.QUEUE, new USymbolTogether());
abstract public SkinParameter getSkinParameter();
@ -109,6 +109,9 @@ public abstract class USymbol {
if (s.equalsIgnoreCase("component")) {
return COMPONENT2;
}
if (s.equalsIgnoreCase("entity")) {
return ENTITY_DOMAIN;
}
return null;
}
return result;
@ -204,8 +207,8 @@ public abstract class USymbol {
usymbol = USymbol.DATABASE;
} else if (symbol.equalsIgnoreCase("queue")) {
usymbol = USymbol.QUEUE;
} else if (symbol.equalsIgnoreCase("pipe")) {
usymbol = USymbol.PIPE;
} else if (symbol.equalsIgnoreCase("stack")) {
usymbol = USymbol.STACK;
} else if (symbol.equalsIgnoreCase("storage")) {
usymbol = USymbol.STORAGE;
} else if (symbol.equalsIgnoreCase("agent")) {

View File

@ -1,181 +0,0 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2017, 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.graphic;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.creole.Stencil;
import net.sourceforge.plantuml.ugraphic.AbstractUGraphicHorizontalLine;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UHorizontalLine;
import net.sourceforge.plantuml.ugraphic.UPath;
import net.sourceforge.plantuml.ugraphic.UTranslate;
class USymbolPipe extends USymbol {
@Override
public SkinParameter getSkinParameter() {
return SkinParameter.PIPE;
}
private final double dx = 5;
private void drawQueue(UGraphic ug, double width, double height, boolean shadowing) {
final UPath shape = new UPath();
if (shadowing) {
shape.setDeltaShadow(3.0);
}
shape.moveTo(dx, 0);
shape.lineTo(width - dx, 0);
shape.cubicTo(width, 0, width, height / 2, width, height / 2);
shape.cubicTo(width, height / 2, width, height, width - dx, height);
shape.lineTo(dx, height);
shape.cubicTo(0, height, 0, height / 2, 0, height / 2);
shape.cubicTo(0, height / 2, 0, 0, dx, 0);
ug.draw(shape);
final UPath closing = getClosingPath(width, height);
ug.apply(new UChangeBackColor(null)).draw(closing);
}
private UPath getClosingPath(double width, double height) {
final UPath closing = new UPath();
closing.moveTo(width - dx, 0);
closing.cubicTo(width - dx * 2, 0, width - dx * 2, height / 2, width - dx * 2, height / 2);
closing.cubicTo(width - dx * 2, height, width - dx, height, width - dx, height);
return closing;
}
class MyUGraphicQueue extends AbstractUGraphicHorizontalLine implements Stencil {
private final double x1;
private final double x2;
private final double fullHeight;
@Override
protected AbstractUGraphicHorizontalLine copy(UGraphic ug) {
return new MyUGraphicQueue(ug, x1, x2, fullHeight);
}
public MyUGraphicQueue(UGraphic ug, double x1, double x2, double fullHeight) {
super(ug);
this.x1 = x1;
this.x2 = x2;
this.fullHeight = fullHeight;
}
@Override
protected void drawHline(UGraphic ug, UHorizontalLine line, UTranslate translate) {
line.drawLineInternal(ug, this, translate.getDy(), line.getStroke());
}
public double getStartingX(StringBounder stringBounder, double y) {
return 0;
}
public double getEndingX(StringBounder stringBounder, double y) {
final double factor2;
final double halfHeight = fullHeight / 2;
if (y <= halfHeight) {
factor2 = 1 - (y / halfHeight);
} else {
factor2 = (y - halfHeight) / halfHeight;
}
return (x2 - x1) * factor2 + x1;
}
}
private Margin getMargin() {
return new Margin(5, 15, 5, 5);
}
public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype,
final SymbolContext symbolContext) {
return new AbstractTextBlock() {
public void drawU(UGraphic ug) {
final Dimension2D dim = calculateDimension(ug.getStringBounder());
ug = symbolContext.apply(ug);
drawQueue(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing());
final Margin margin = getMargin();
final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, HorizontalAlignment.CENTER);
final UGraphic ug2 = new MyUGraphicQueue(ug, dim.getWidth() - 2 * dx, dim.getWidth() - dx,
dim.getHeight());
tb.drawU(ug2.apply(new UTranslate(margin.getX1(), margin.getY1())));
}
public Dimension2D calculateDimension(StringBounder stringBounder) {
final Dimension2D dimLabel = label.calculateDimension(stringBounder);
final Dimension2D dimStereo = stereotype.calculateDimension(stringBounder);
return getMargin().addDimension(Dimension2DDouble.mergeTB(dimStereo, dimLabel));
}
};
}
public TextBlock asBig(final TextBlock title, final TextBlock stereotype, final double width, final double height,
final SymbolContext symbolContext) {
throw new UnsupportedOperationException();
// return new TextBlock() {
//
// public void drawU(UGraphic ug) {
// final Dimension2D dim = calculateDimension(ug.getStringBounder());
// ug = symbolContext.apply(ug);
// drawDatabase(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing());
// final Dimension2D dimStereo = stereotype.calculateDimension(ug.getStringBounder());
// final double posStereo = (width - dimStereo.getWidth()) / 2;
// stereotype.drawU(ug.apply(new UTranslate(posStereo, 0)));
//
// final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder());
// final double posTitle = (width - dimTitle.getWidth()) / 2;
// title.drawU(ug.apply(new UTranslate(posTitle, 21)));
// }
//
// public Dimension2D calculateDimension(StringBounder stringBounder) {
// return new Dimension2DDouble(width, height);
// }
// };
}
public boolean manageHorizontalLine() {
return true;
}
}

View File

@ -38,13 +38,12 @@ package net.sourceforge.plantuml.graphic;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.creole.Stencil;
import net.sourceforge.plantuml.ugraphic.AbstractUGraphicHorizontalLine;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
import net.sourceforge.plantuml.ugraphic.UHorizontalLine;
import net.sourceforge.plantuml.ugraphic.UPath;
import net.sourceforge.plantuml.ugraphic.URectangle;
import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.UTranslate;
class USymbolQueue extends USymbol {
@ -54,25 +53,78 @@ class USymbolQueue extends USymbol {
return SkinParameter.QUEUE;
}
private void drawQueue(UGraphic ug, double width, double height, boolean shadowing, double roundCorner) {
final double border = 15;
final URectangle rect = new URectangle(width - 2 * border, height, roundCorner, roundCorner);
private final double dx = 5;
private void drawQueue(UGraphic ug, double width, double height, boolean shadowing) {
final UPath shape = new UPath();
if (shadowing) {
rect.setDeltaShadow(3.0);
shape.setDeltaShadow(3.0);
}
shape.moveTo(dx, 0);
shape.lineTo(width - dx, 0);
shape.cubicTo(width, 0, width, height / 2, width, height / 2);
shape.cubicTo(width, height / 2, width, height, width - dx, height);
shape.lineTo(dx, height);
shape.cubicTo(0, height, 0, height / 2, 0, height / 2);
shape.cubicTo(0, height / 2, 0, 0, dx, 0);
ug.draw(shape);
final UPath closing = getClosingPath(width, height);
ug.apply(new UChangeBackColor(null)).draw(closing);
}
private UPath getClosingPath(double width, double height) {
final UPath closing = new UPath();
closing.moveTo(width - dx, 0);
closing.cubicTo(width - dx * 2, 0, width - dx * 2, height / 2, width - dx * 2, height / 2);
closing.cubicTo(width - dx * 2, height, width - dx, height, width - dx, height);
return closing;
}
class MyUGraphicQueue extends AbstractUGraphicHorizontalLine implements Stencil {
private final double x1;
private final double x2;
private final double fullHeight;
@Override
protected AbstractUGraphicHorizontalLine copy(UGraphic ug) {
return new MyUGraphicQueue(ug, x1, x2, fullHeight);
}
public MyUGraphicQueue(UGraphic ug, double x1, double x2, double fullHeight) {
super(ug);
this.x1 = x1;
this.x2 = x2;
this.fullHeight = fullHeight;
}
@Override
protected void drawHline(UGraphic ug, UHorizontalLine line, UTranslate translate) {
line.drawLineInternal(ug, this, translate.getDy(), line.getStroke());
}
public double getStartingX(StringBounder stringBounder, double y) {
return 0;
}
public double getEndingX(StringBounder stringBounder, double y) {
final double factor2;
final double halfHeight = fullHeight / 2;
if (y <= halfHeight) {
factor2 = 1 - (y / halfHeight);
} else {
factor2 = (y - halfHeight) / halfHeight;
}
return (x2 - x1) * factor2 + x1;
}
ug.apply(new UChangeColor(null)).apply(new UTranslate(border, 0)).draw(rect);
final UPath path = new UPath();
path.moveTo(0, 0);
path.lineTo(border, 0);
path.lineTo(border, height);
path.lineTo(width - border, height);
path.lineTo(width - border, 0);
path.lineTo(width, 0);
ug.apply(new UChangeBackColor(null)).draw(path);
}
private Margin getMargin() {
return new Margin(25, 25, 10, 10);
return new Margin(5, 15, 5, 5);
}
public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype,
@ -81,13 +133,13 @@ class USymbolQueue extends USymbol {
public void drawU(UGraphic ug) {
final Dimension2D dim = calculateDimension(ug.getStringBounder());
ug = UGraphicStencil.create(ug, getRectangleStencil(dim), new UStroke());
ug = symbolContext.apply(ug);
drawQueue(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(),
symbolContext.getRoundCorner());
drawQueue(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing());
final Margin margin = getMargin();
final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, HorizontalAlignment.CENTER);
tb.drawU(ug.apply(new UTranslate(margin.getX1(), margin.getY1())));
final UGraphic ug2 = new MyUGraphicQueue(ug, dim.getWidth() - 2 * dx, dim.getWidth() - dx,
dim.getHeight());
tb.drawU(ug2.apply(new UTranslate(margin.getX1(), margin.getY1())));
}
public Dimension2D calculateDimension(StringBounder stringBounder) {
@ -101,9 +153,27 @@ class USymbolQueue extends USymbol {
public TextBlock asBig(final TextBlock title, final TextBlock stereotype, final double width, final double height,
final SymbolContext symbolContext) {
throw new UnsupportedOperationException();
// return new TextBlock() {
//
// public void drawU(UGraphic ug) {
// final Dimension2D dim = calculateDimension(ug.getStringBounder());
// ug = symbolContext.apply(ug);
// drawDatabase(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing());
// final Dimension2D dimStereo = stereotype.calculateDimension(ug.getStringBounder());
// final double posStereo = (width - dimStereo.getWidth()) / 2;
// stereotype.drawU(ug.apply(new UTranslate(posStereo, 0)));
//
// final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder());
// final double posTitle = (width - dimTitle.getWidth()) / 2;
// title.drawU(ug.apply(new UTranslate(posTitle, 21)));
// }
//
// public Dimension2D calculateDimension(StringBounder stringBounder) {
// return new Dimension2DDouble(width, height);
// }
// };
}
@Override
public boolean manageHorizontalLine() {
return true;
}

View File

@ -0,0 +1,111 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2017, 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.graphic;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
import net.sourceforge.plantuml.ugraphic.UPath;
import net.sourceforge.plantuml.ugraphic.URectangle;
import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.UTranslate;
class USymbolStack extends USymbol {
@Override
public SkinParameter getSkinParameter() {
return SkinParameter.STACK;
}
private void drawQueue(UGraphic ug, double width, double height, boolean shadowing, double roundCorner) {
final double border = 15;
final URectangle rect = new URectangle(width - 2 * border, height, roundCorner, roundCorner);
if (shadowing) {
rect.setDeltaShadow(3.0);
}
ug.apply(new UChangeColor(null)).apply(new UTranslate(border, 0)).draw(rect);
final UPath path = new UPath();
path.moveTo(0, 0);
path.lineTo(border, 0);
path.lineTo(border, height);
path.lineTo(width - border, height);
path.lineTo(width - border, 0);
path.lineTo(width, 0);
ug.apply(new UChangeBackColor(null)).draw(path);
}
private Margin getMargin() {
return new Margin(25, 25, 10, 10);
}
public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype,
final SymbolContext symbolContext) {
return new AbstractTextBlock() {
public void drawU(UGraphic ug) {
final Dimension2D dim = calculateDimension(ug.getStringBounder());
ug = UGraphicStencil.create(ug, getRectangleStencil(dim), new UStroke());
ug = symbolContext.apply(ug);
drawQueue(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(),
symbolContext.getRoundCorner());
final Margin margin = getMargin();
final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, HorizontalAlignment.CENTER);
tb.drawU(ug.apply(new UTranslate(margin.getX1(), margin.getY1())));
}
public Dimension2D calculateDimension(StringBounder stringBounder) {
final Dimension2D dimLabel = label.calculateDimension(stringBounder);
final Dimension2D dimStereo = stereotype.calculateDimension(stringBounder);
return getMargin().addDimension(Dimension2DDouble.mergeTB(dimStereo, dimLabel));
}
};
}
public TextBlock asBig(final TextBlock title, final TextBlock stereotype, final double width, final double height,
final SymbolContext symbolContext) {
throw new UnsupportedOperationException();
}
@Override
public boolean manageHorizontalLine() {
return true;
}
}

View File

@ -163,7 +163,7 @@ public class CucaDiagramFileMakerHectorB1 implements CucaDiagramFileMaker {
private IEntityImage computeImage(final ILeaf leaf) {
final IEntityImage image = DotDataImageBuilder.createEntityImageBlock(leaf, diagram.getSkinParam(),
false, diagram, null, null, null);
false, diagram, null, null, null, diagram.getLinks());
return image;
}
}

View File

@ -60,7 +60,7 @@ public class Foo1 {
private static IEntityImage computeImage(final ILeaf leaf, CucaDiagram diagram) {
final IEntityImage image = DotDataImageBuilder.createEntityImageBlock(leaf, diagram.getSkinParam(),
false, diagram, null, null, null);
false, diagram, null, null, null, diagram.getLinks());
return image;
}

View File

@ -101,7 +101,7 @@ public class Foo2 extends AbstractTextBlock implements TextBlock {
private IEntityImage computeImage(final ILeaf leaf) {
final IEntityImage image = DotDataImageBuilder.createEntityImageBlock(leaf, diagram.getSkinParam(),
false, diagram, null, null, null);
false, diagram, null, null, null, diagram.getLinks());
return image;
}

View File

@ -592,7 +592,7 @@ public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker {
}
return DotDataImageBuilder.createEntityImageBlock(ent, skinParam, diagram.isHideEmptyDescriptionForState(),
diagram, getBibliotekon(), null, diagram.getUmlDiagramType());
diagram, getBibliotekon(), null, diagram.getUmlDiagramType(), diagram.getLinks());
}
return ent.getSvekImage();
}

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.preproc;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Set;
@ -53,6 +54,7 @@ import net.sourceforge.plantuml.utils.StartUtils;
public class Preprocessor implements ReadLine {
private static final String END_DEFINE_LONG = "!enddefinelong";
private static final String ID = "[A-Za-z_][A-Za-z_0-9]*";
private static final String ID_ARG = "\\s*[A-Za-z_][A-Za-z_0-9]*\\s*(?:=\\s*(?:\"[^\"]*\"|'[^']*')\\s*)?";
private static final String ARG = "(?:\\(" + ID_ARG + "(?:," + ID_ARG + ")*?\\))?";
@ -60,7 +62,7 @@ public class Preprocessor implements ReadLine {
+ "(?:[%s]+(.*))?$");
private static final Pattern2 undefPattern = MyPattern.cmpile("^[%s]*!undef[%s]+(" + ID + ")$");
private static final Pattern2 definelongPattern = MyPattern.cmpile("^[%s]*!definelong[%s]+(" + ID + ARG + ")");
private static final Pattern2 enddefinelongPattern = MyPattern.cmpile("^[%s]*!enddefinelong[%s]*$");
private static final Pattern2 enddefinelongPattern = MyPattern.cmpile("^[%s]*" + END_DEFINE_LONG + "[%s]*$");
private final Defines defines;
private final PreprocessorInclude rawSource;
@ -105,8 +107,15 @@ public class Preprocessor implements ReadLine {
final List<String> result = defines.applyDefines(s.toString2());
if (result.size() > 1) {
ignoreDefineDuringSeveralLines = result.size() - 2;
source.insert(result.subList(1, result.size() - 1), s.getLocation());
final String last = result.get(result.size() - 1);
final List<String> inserted = result.subList(1, result.size() - 1);
assert last.startsWith(END_DEFINE_LONG);
ignoreDefineDuringSeveralLines = inserted.size();
source.insert(inserted, s.getLocation());
if (last.length() > END_DEFINE_LONG.length()) {
source.insert(last.substring(END_DEFINE_LONG.length()), s.getLocation());
ignoreDefineDuringSeveralLines++;
}
}
return new CharSequence2Impl(result.get(0), s.getLocation(), s.getPreprocessorError());
}

View File

@ -69,8 +69,12 @@ class ReadLineInsertable implements ReadLine {
public void insert(List<? extends CharSequence> data, LineLocation location) {
for (CharSequence s : data) {
inserted.add(new CharSequence2Impl(s, location));
insert(s, location);
}
}
public void insert(CharSequence s, LineLocation location) {
inserted.add(new CharSequence2Impl(s, location));
}
}

View File

@ -48,6 +48,7 @@ import net.sourceforge.plantuml.skin.ComponentType;
import net.sourceforge.plantuml.skin.Context2D;
import net.sourceforge.plantuml.skin.Skin;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
public class DividerTile implements Tile {
@ -78,9 +79,10 @@ public class DividerTile implements Tile {
final StringBounder stringBounder = ug.getStringBounder();
final Component comp = getComponent(stringBounder);
final Dimension2D dim = comp.getPreferredDimension(stringBounder);
final Area area = new Area(tileArguments.getBorder2() - origin.getCurrentValue(), dim.getHeight());
final Area area = new Area(tileArguments.getBorder2() - tileArguments.getBorder1() - origin.getCurrentValue(),
dim.getHeight());
// ug = ug.apply(new UTranslate(x, 0));
ug = ug.apply(new UTranslate(tileArguments.getBorder1(), 0));
comp.drawU(ug, area, (Context2D) ug);
}

View File

@ -149,11 +149,21 @@ public class NoteTile implements Tile {
}
public Real getMinX(StringBounder stringBounder) {
return getX(stringBounder);
final Real result = getX(stringBounder);
if (note.getPosition() == NotePosition.OVER_SEVERAL) {
final Real x1 = livingSpace1.getPosB();
return RealUtils.min(result, x1);
}
return result;
}
public Real getMaxX(StringBounder stringBounder) {
return getX(stringBounder).addFixed(getUsedWidth(stringBounder));
final Real result = getX(stringBounder).addFixed(getUsedWidth(stringBounder));
if (note.getPosition() == NotePosition.OVER_SEVERAL) {
final Real x2 = livingSpace2.getPosD(stringBounder);
return RealUtils.max(result, x2);
}
return result;
}
}

View File

@ -299,7 +299,7 @@ public final class DotDataImageBuilder {
return createEntityImageBlock(ent, skinParam, dotData.isHideEmptyDescriptionForState(), dotData,
dotStringFactory.getBibliotekon(), dotStringFactory.getGraphvizVersion(),
dotData.getUmlDiagramType());
dotData.getUmlDiagramType(), dotData.getLinks());
}
return ent.getSvekImage();
}
@ -322,7 +322,7 @@ public final class DotDataImageBuilder {
public static IEntityImage createEntityImageBlock(ILeaf leaf, ISkinParam skinParam,
boolean isHideEmptyDescriptionForState, PortionShower portionShower, Bibliotekon bibliotekon,
GraphvizVersion graphvizVersion, UmlDiagramType umlDiagramType) {
GraphvizVersion graphvizVersion, UmlDiagramType umlDiagramType, Collection<Link> links) {
if (leaf.isRemoved()) {
throw new IllegalStateException();
}
@ -376,7 +376,7 @@ public final class DotDataImageBuilder {
return new EntityImageLollipopInterface(leaf, skinParam);
}
if (leaf.getLeafType() == LeafType.CIRCLE) {
return new EntityImageDescription(leaf, skinParam, portionShower);
return new EntityImageDescription(leaf, skinParam, portionShower, links);
}
if (leaf.getLeafType() == LeafType.DESCRIPTION) {
@ -385,7 +385,7 @@ public final class DotDataImageBuilder {
} else if (OptionFlags.USE_INTERFACE_EYE2 && leaf.getUSymbol() instanceof USymbolInterface) {
return new EntityImageLollipopInterfaceEye2(leaf, skinParam, portionShower);
} else {
return new EntityImageDescription(leaf, skinParam, portionShower);
return new EntityImageDescription(leaf, skinParam, portionShower, links);
}
}
if (leaf.getLeafType() == LeafType.USECASE) {
@ -412,7 +412,7 @@ public final class DotDataImageBuilder {
if (leaf.getLeafType() == LeafType.EMPTY_PACKAGE) {
if (leaf.getUSymbol() != null) {
return new EntityImageDescription(leaf, new SkinParamForecolored(skinParam, HtmlColorUtils.BLACK),
portionShower);
portionShower, links);
}
return new EntityImageEmptyPackage(leaf, skinParam, portionShower);
}

View File

@ -48,6 +48,11 @@ public class Margins {
return new Margins(value, value, value, value);
}
@Override
public String toString() {
return "MARGIN[" + x1 + "," + x2 + "," + y1 + "," + y2 + "]";
}
public Margins(double x1, double x2, double y1, double y2) {
this.x1 = x1;
this.x2 = x2;

View File

@ -37,6 +37,7 @@
package net.sourceforge.plantuml.svek.image;
import java.awt.geom.Dimension2D;
import java.util.Collection;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.ISkinParam;
@ -46,6 +47,7 @@ import net.sourceforge.plantuml.cucadiagram.BodyEnhanced;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.EntityPortion;
import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.PortionShower;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.FontConfiguration;
@ -59,6 +61,7 @@ import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.graphic.USymbolFolder;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.svek.AbstractEntityImage;
import net.sourceforge.plantuml.svek.Bibliotekon;
import net.sourceforge.plantuml.svek.Margins;
import net.sourceforge.plantuml.svek.ShapeType;
import net.sourceforge.plantuml.ugraphic.UComment;
@ -81,9 +84,12 @@ public class EntityImageDescription extends AbstractEntityImage {
private TextBlock stereo;
private final boolean hideText;
private final Collection<Link> links;
public EntityImageDescription(ILeaf entity, ISkinParam skinParam, PortionShower portionShower) {
public EntityImageDescription(ILeaf entity, ISkinParam skinParam, PortionShower portionShower,
Collection<Link> links) {
super(entity, entity.getColors(skinParam).mute(skinParam));
this.links = links;
final Stereotype stereotype = entity.getStereotype();
USymbol symbol = getUSymbol(entity);
this.shapeType = symbol == USymbol.FOLDER ? ShapeType.FOLDER : ShapeType.RECTANGLE;
@ -155,7 +161,7 @@ public class EntityImageDescription extends AbstractEntityImage {
@Override
public Margins getShield(StringBounder stringBounder) {
if (hideText) {
if (hideText && hasSomeHorizontalLink((ILeaf) getEntity(), links) == false) {
final Dimension2D dimStereo = stereo.calculateDimension(stringBounder);
final Dimension2D dimDesc = desc.calculateDimension(stringBounder);
final Dimension2D dimSmall = asSmall.calculateDimension(stringBounder);
@ -166,10 +172,20 @@ public class EntityImageDescription extends AbstractEntityImage {
}
final double y = MathUtils.max(1, dimDesc.getHeight(), dimStereo.getHeight());
return new Margins(suppX / 2, suppX / 2, y, y);
}
return Margins.NONE;
}
private boolean hasSomeHorizontalLink(ILeaf leaf, Collection<Link> links) {
for (Link link : links) {
if (link.getLength() == 1 && link.contains(leaf)) {
return true;
}
}
return false;
}
final public void drawU(UGraphic ug) {
ug.draw(new UComment("entity " + getEntity().getCode().getFullName()));

View File

@ -70,7 +70,7 @@ public class LanguageDescriptor {
type.add("database");
type.add("storage");
type.add("agent");
type.add("pipe");
type.add("stack");
type.add("boundary");
type.add("control");
type.add("entity");

View File

@ -43,7 +43,7 @@ public class Version {
private static final int MAJOR_SEPARATOR = 1000000;
public static int version() {
return 1201712;
return 1201713;
}
public static String versionString() {
@ -81,7 +81,7 @@ public class Version {
}
public static long compileTime() {
return 1493222796077L;
return 1494435153042L;
}
public static String compileTimeString() {