1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-12-22 10:59:01 +00:00

version 1.2019.2

This commit is contained in:
Arnaud Roques 2019-03-01 23:16:29 +01:00
parent d7535d8027
commit 120fb859b2
163 changed files with 4265 additions and 3369 deletions

View File

@ -30,7 +30,8 @@
Script Author: Julien Eluard
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.sourceforge.plantuml</groupId>

View File

@ -56,9 +56,10 @@ public class BlockUml {
private final List<CharSequence2> data;
private Diagram system;
private final Defines localDefines;
private final ISkinSimple skinParam;
BlockUml(String... strings) {
this(convert(strings), Defines.createEmpty());
this(convert(strings), Defines.createEmpty(), null);
}
public String getEncodedUrl() throws IOException {
@ -92,8 +93,9 @@ public class BlockUml {
return result;
}
public BlockUml(List<CharSequence2> strings, Defines defines) {
public BlockUml(List<CharSequence2> strings, Defines defines, ISkinSimple skinParam) {
this.localDefines = defines;
this.skinParam = skinParam;
final CharSequence2 s0 = strings.get(0).trin();
if (StartUtils.startsWithSymbolAnd("start", s0) == false) {
throw new IllegalArgumentException();
@ -130,7 +132,7 @@ public class BlockUml {
public Diagram getDiagram() {
if (system == null) {
system = new PSystemBuilder().createPSystem(data);
system = new PSystemBuilder().createPSystem(skinParam, data);
}
return system;
}

View File

@ -117,21 +117,13 @@ public final class BlockUmlBuilder implements DefinitionsContainer {
if (paused) {
current2.add(s);
}
blocks.add(new BlockUml(current2, defines.cloneMe()));
blocks.add(new BlockUml(current2, defines.cloneMe(), null));
current2 = null;
reader2.setPaused(false);
}
}
}
// private Collection<CharSequence2> convert(List<String> config, LineLocation location) {
// final List<CharSequence2> result = new ArrayList<CharSequence2>();
// for (String s : config) {
// result.add(new CharSequence2Impl(s, location));
// }
// return result;
// }
public List<BlockUml> getBlockUmls() {
return Collections.unmodifiableList(blocks);
}

View File

@ -0,0 +1,164 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml;
import java.awt.geom.Dimension2D;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import javax.imageio.ImageIO;
import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.creole.Atom;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.Line;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.preproc.Defines;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UImage;
import net.sourceforge.plantuml.ugraphic.UImageSvg;
import net.sourceforge.plantuml.ugraphic.UShape;
public class EmbeddedDiagram implements CharSequence {
private final Display system;
public EmbeddedDiagram(Display system) {
this.system = system;
}
public int length() {
return toString().length();
}
public char charAt(int index) {
return toString().charAt(index);
}
public CharSequence subSequence(int start, int end) {
return toString().subSequence(start, end);
}
public Draw asDraw(ISkinSimple skinParam) {
return new Draw(skinParam);
}
public class Draw extends AbstractTextBlock implements Line, Atom {
private BufferedImage image;
private final ISkinSimple skinParam;
private Draw(ISkinSimple skinParam) {
this.skinParam = skinParam;
}
public double getStartingAltitude(StringBounder stringBounder) {
return 0;
}
public Dimension2D calculateDimension(StringBounder stringBounder) {
try {
final BufferedImage im = getImage();
return new Dimension2DDouble(im.getWidth(), im.getHeight());
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
return new Dimension2DDouble(42, 42);
}
public void drawU(UGraphic ug) {
try {
final boolean isSvg = ug.matchesProperty("SVG");
if (isSvg) {
final String imageSvg = getImageSvg();
final SvgString svg = new SvgString(imageSvg, 1);
ug.draw(new UImageSvg(svg));
return;
}
final BufferedImage im = getImage();
final UShape image = new UImage(im);
ug.draw(image);
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
private String getImageSvg() throws IOException, InterruptedException {
final Diagram system = getSystem();
final ByteArrayOutputStream os = new ByteArrayOutputStream();
system.exportDiagram(os, 0, new FileFormatOption(FileFormat.SVG));
os.close();
return new String(os.toByteArray());
}
private BufferedImage getImage() throws IOException, InterruptedException {
if (image == null) {
image = getImageSlow();
}
return image;
}
private BufferedImage getImageSlow() throws IOException, InterruptedException {
final Diagram system = getSystem();
final ByteArrayOutputStream os = new ByteArrayOutputStream();
system.exportDiagram(os, 0, new FileFormatOption(FileFormat.PNG));
os.close();
final ByteArrayInputStream is = new ByteArrayInputStream(os.toByteArray());
final BufferedImage im = ImageIO.read(is);
is.close();
return im;
}
public HorizontalAlignment getHorizontalAlignment() {
return HorizontalAlignment.LEFT;
}
private Diagram getSystem() throws IOException, InterruptedException {
final BlockUml blockUml = new BlockUml(system.as2(), Defines.createEmpty(), skinParam);
return blockUml.getDiagram();
}
}
}

View File

@ -35,6 +35,8 @@
*/
package net.sourceforge.plantuml;
import java.util.Map;
import net.sourceforge.plantuml.graphic.IHtmlColorSet;
import net.sourceforge.plantuml.ugraphic.ColorMapper;
@ -42,6 +44,8 @@ public interface ISkinSimple extends SpriteContainer {
public String getValue(String key);
public Map<String, String> values();
public double getPadding();
public String getMonospacedFamily();
@ -56,4 +60,6 @@ public interface ISkinSimple extends SpriteContainer {
public ColorMapper getColorMapper();
public void copyAllFrom(ISkinSimple other);
}

View File

@ -68,17 +68,18 @@ import net.sourceforge.plantuml.eggs.PSystemRIPFactory;
import net.sourceforge.plantuml.eggs.PSystemWelcomeFactory;
import net.sourceforge.plantuml.flowdiagram.FlowDiagramFactory;
import net.sourceforge.plantuml.font.PSystemListFontsFactory;
import net.sourceforge.plantuml.help.HelpFactory;
import net.sourceforge.plantuml.jcckit.PSystemJcckitFactory;
import net.sourceforge.plantuml.jungle.PSystemTreeFactory;
import net.sourceforge.plantuml.logo.PSystemLogoFactory;
import net.sourceforge.plantuml.math.PSystemLatexFactory;
import net.sourceforge.plantuml.math.PSystemMathFactory;
import net.sourceforge.plantuml.mindmap.MindMapDiagramFactory;
import net.sourceforge.plantuml.nwdiag.NwDiagramFactory;
import net.sourceforge.plantuml.openiconic.PSystemListOpenIconicFactory;
import net.sourceforge.plantuml.openiconic.PSystemOpenIconicFactory;
import net.sourceforge.plantuml.oregon.PSystemOregonFactory;
import net.sourceforge.plantuml.postit.PostIdDiagramFactory;
import net.sourceforge.plantuml.printskin.PrintSkinFactory;
import net.sourceforge.plantuml.project3.GanttDiagramFactory;
import net.sourceforge.plantuml.salt.PSystemSaltFactory;
import net.sourceforge.plantuml.sequencediagram.SequenceDiagramFactory;
@ -95,7 +96,7 @@ public class PSystemBuilder {
public static final long startTime = System.currentTimeMillis();
final public Diagram createPSystem(final List<CharSequence2> strings2) {
final public Diagram createPSystem(ISkinSimple skinParam, final List<CharSequence2> strings2) {
final long now = System.currentTimeMillis();
@ -117,7 +118,7 @@ public class PSystemBuilder {
final DiagramType diagramType = umlSource.getDiagramType();
final List<PSystemError> errors = new ArrayList<PSystemError>();
final List<PSystemFactory> factories = getAllFactories();
final List<PSystemFactory> factories = getAllFactories(skinParam);
for (PSystemFactory systemFactory : factories) {
if (diagramType != systemFactory.getDiagramType()) {
continue;
@ -141,11 +142,11 @@ public class PSystemBuilder {
}
private List<PSystemFactory> getAllFactories() {
private List<PSystemFactory> getAllFactories(ISkinSimple skinParam) {
final List<PSystemFactory> factories = new ArrayList<PSystemFactory>();
factories.add(new PSystemWelcomeFactory());
factories.add(new PSystemColorsFactory());
factories.add(new SequenceDiagramFactory());
factories.add(new SequenceDiagramFactory(skinParam));
factories.add(new ClassDiagramFactory());
factories.add(new ActivityDiagramFactory());
factories.add(new DescriptionDiagramFactory());
@ -155,7 +156,7 @@ public class PSystemBuilder {
// factories.add(new ObjectDiagramFactory());
factories.add(new BpmDiagramFactory(DiagramType.BPM));
factories.add(new PostIdDiagramFactory());
factories.add(new PrintSkinFactory());
// factories.add(new PrintSkinFactory());
factories.add(new PSystemLicenseFactory());
factories.add(new PSystemVersionFactory());
factories.add(new PSystemDonorsFactory());
@ -169,6 +170,7 @@ public class PSystemBuilder {
factories.add(new PSystemDotFactory(DiagramType.DOT));
factories.add(new PSystemDotFactory(DiagramType.UML));
factories.add(new NwDiagramFactory());
factories.add(new MindMapDiagramFactory());
if (License.getCurrent() == License.GPL || License.getCurrent() == License.GPLV2) {
factories.add(new PSystemDitaaFactory(DiagramType.DITAA));
factories.add(new PSystemDitaaFactory(DiagramType.UML));
@ -199,6 +201,7 @@ public class PSystemBuilder {
factories.add(new PSystemCuteFactory(DiagramType.CUTE));
factories.add(new PSystemDedicationFactory());
factories.add(new TimingDiagramFactory());
factories.add(new HelpFactory());
return factories;
}

View File

@ -336,7 +336,7 @@ public class Run {
}
private static void managePattern() {
printPattern(new SequenceDiagramFactory());
printPattern(new SequenceDiagramFactory(null));
printPattern(new ClassDiagramFactory());
printPattern(new ActivityDiagramFactory());
printPattern(new DescriptionDiagramFactory());

View File

@ -84,6 +84,14 @@ public class SkinParam implements ISkinParam {
private final UmlDiagramType type;
private boolean useVizJs;
public void copyAllFrom(ISkinSimple other) {
this.params.putAll(other.values());
}
public Map<String, String> values() {
return Collections.unmodifiableMap(params);
}
public void setParam(String key, String value) {
for (String key2 : cleanForKey(key)) {
params.put(key2, StringUtils.trin(value));
@ -425,6 +433,7 @@ public class SkinParam implements ISkinParam {
result.add("SwimlaneWidth");
result.add("SwimlaneWrapTitleWidth");
result.add("FixCircleLabelOverlapping");
result.add("LifelineStrategy");
for (FontParam p : EnumSet.allOf(FontParam.class)) {
final String h = humanName(p.name());

View File

@ -35,6 +35,8 @@
*/
package net.sourceforge.plantuml;
import java.util.Map;
import net.sourceforge.plantuml.cucadiagram.Rankdir;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.cucadiagram.dot.DotSplines;
@ -308,4 +310,12 @@ public class SkinParamDelegator implements ISkinParam {
return skinParam.isUseVizJs();
}
public void copyAllFrom(ISkinSimple other) {
skinParam.copyAllFrom(other);
}
public Map<String, String> values() {
return skinParam.values();
}
}

View File

@ -35,6 +35,8 @@
*/
package net.sourceforge.plantuml;
import java.util.Map;
import net.sourceforge.plantuml.creole.CommandCreoleMonospaced;
import net.sourceforge.plantuml.graphic.HtmlColorSetSimple;
import net.sourceforge.plantuml.graphic.IHtmlColorSet;
@ -85,4 +87,14 @@ public class SpriteContainerEmpty implements SpriteContainer, ISkinSimple {
return new ColorMapperIdentity();
}
public void copyAllFrom(ISkinSimple other) {
throw new UnsupportedOperationException();
}
public Map<String, String> values() {
throw new UnsupportedOperationException();
}
}

View File

@ -80,7 +80,6 @@ import net.sourceforge.plantuml.graphic.UDrawable;
import net.sourceforge.plantuml.graphic.VerticalAlignment;
import net.sourceforge.plantuml.mjpeg.MJPEGGenerator;
import net.sourceforge.plantuml.pdf.PdfConverter;
import net.sourceforge.plantuml.sequencediagram.command.CommandSkin;
import net.sourceforge.plantuml.svek.EmptySvgException;
import net.sourceforge.plantuml.svek.GraphvizCrash;
import net.sourceforge.plantuml.svek.TextBlockBackcolored;
@ -109,7 +108,18 @@ public abstract class UmlDiagram extends AbstractPSystem implements Diagram, Ann
private final Pragma pragma = new Pragma();
private Animation animation;
private final SkinParam skinParam = SkinParam.create(getUmlDiagramType());
private final SkinParam skinParam;
public UmlDiagram() {
this.skinParam = SkinParam.create(getUmlDiagramType());
}
public UmlDiagram(ISkinSimple orig) {
this();
if (orig != null) {
this.skinParam.copyAllFrom(orig);
}
}
final public void setTitle(DisplayPositionned title) {
if (title.isNull() || title.getDisplay().isWhite()) {

View File

@ -36,5 +36,5 @@
package net.sourceforge.plantuml;
public enum UmlDiagramType {
SEQUENCE, STATE, CLASS, OBJECT, ACTIVITY, DESCRIPTION, COMPOSITE, FLOW, TIMING, BPM, NWDIAG
SEQUENCE, STATE, CLASS, OBJECT, ACTIVITY, DESCRIPTION, COMPOSITE, FLOW, TIMING, BPM, NWDIAG, MINDMAP, HELP
}

View File

@ -59,6 +59,7 @@ import net.sourceforge.plantuml.ugraphic.comp.CompressionTransform;
public class Snake implements UShape {
private final Worm worm = new Worm();
private UPolygon startDecoration;
private UPolygon endDecoration;
private final Rainbow color;
private TextBlock textBlock;
@ -67,7 +68,7 @@ public class Snake implements UShape {
private final HorizontalAlignment horizontalAlignment;
public Snake transformX(CompressionTransform compressionTransform) {
final Snake result = new Snake(horizontalAlignment, color, endDecoration);
final Snake result = new Snake(startDecoration, horizontalAlignment, color, endDecoration);
result.textBlock = this.textBlock;
result.mergeable = this.mergeable;
result.emphasizeDirection = this.emphasizeDirection;
@ -84,19 +85,25 @@ public class Snake implements UShape {
}
public Snake(HorizontalAlignment horizontalAlignment, Rainbow color, UPolygon endDecoration) {
this(null, horizontalAlignment, color, endDecoration);
}
public Snake(UPolygon startDecoration, HorizontalAlignment horizontalAlignment, Rainbow color,
UPolygon endDecoration) {
if (color == null) {
throw new IllegalArgumentException();
}
if (color.size() == 0) {
throw new IllegalArgumentException();
}
this.startDecoration = startDecoration;
this.endDecoration = endDecoration;
this.color = color;
this.horizontalAlignment = horizontalAlignment;
}
public Snake(HorizontalAlignment horizontalAlignment, Rainbow color) {
this(horizontalAlignment, color, null);
this(null, horizontalAlignment, color, null);
}
public void setLabel(TextBlock label) {
@ -104,7 +111,7 @@ public class Snake implements UShape {
}
public Snake move(double dx, double dy) {
final Snake result = new Snake(horizontalAlignment, color, endDecoration);
final Snake result = new Snake(startDecoration, horizontalAlignment, color, endDecoration);
for (Point2D pt : worm) {
result.addPoint(pt.getX() + dx, pt.getY() + dy);
}
@ -135,7 +142,8 @@ public class Snake implements UShape {
if (color.size() > 1) {
drawRainbow(ug);
} else {
worm.drawInternalOneColor(ug, color.getColors().get(0), 1.5, emphasizeDirection, endDecoration);
worm.drawInternalOneColor(startDecoration, ug, color.getColors().get(0), 1.5, emphasizeDirection,
endDecoration);
drawInternalLabel(ug);
}
@ -160,7 +168,7 @@ public class Snake implements UShape {
if (colorArrowSeparationSpace == 0) {
stroke = i == colors.size() - 1 ? 2.0 : 3.0;
}
current.drawInternalOneColor(ug, colors.get(i), stroke, emphasizeDirection, endDecoration);
current.drawInternalOneColor(startDecoration, ug, colors.get(i), stroke, emphasizeDirection, endDecoration);
current = mutation.mute(current);
}
final UTranslate textTranslate = mutation.getTextTranslate(colors.size());
@ -243,7 +251,10 @@ public class Snake implements UShape {
}
if (same(this.getLast(), other.getFirst())) {
final UPolygon oneOf = other.endDecoration == null ? endDecoration : other.endDecoration;
final Snake result = new Snake(horizontalAlignment, color, oneOf);
if (this.startDecoration != null || other.startDecoration != null) {
throw new UnsupportedOperationException("Not yet coded: to be done");
}
final Snake result = new Snake(null, horizontalAlignment, color, oneOf);
// result.textBlock = oneOf(this.textBlock, other.textBlock, stringBounder);
result.emphasizeDirection = emphasizeDirection == null ? other.emphasizeDirection : emphasizeDirection;
result.worm.addAll(this.worm.merge(other.worm, strategy));

View File

@ -64,8 +64,8 @@ public class Worm implements Iterable<Point2D.Double> {
return points.size() == 2 && points.get(0).getY() == points.get(1).getY();
}
public void drawInternalOneColor(UGraphic ug, HtmlColorAndStyle color, double stroke, Direction emphasizeDirection,
UPolygon endDecoration) {
public void drawInternalOneColor(UPolygon startDecoration, UGraphic ug, HtmlColorAndStyle color, double stroke,
Direction emphasizeDirection, UPolygon endDecoration) {
final HtmlColor color2 = color.getColor();
if (color2 == null) {
throw new IllegalArgumentException();
@ -93,6 +93,11 @@ public class Worm implements Iterable<Point2D.Double> {
drawLine(ug, line, null);
}
}
if (startDecoration != null) {
ug = ug.apply(new UStroke(1.5));
final Point2D start = points.get(0);
ug.apply(new UTranslate(start)).apply(new UStroke()).draw(startDecoration);
}
if (endDecoration != null) {
ug = ug.apply(new UStroke(1.5));
final Point2D end = points.get(points.size() - 1);

View File

@ -69,9 +69,9 @@ public class WormTexted implements Iterable<Point2D.Double> {
worm.addPoint(x, y);
}
public void drawInternalOneColor(UGraphic ug, HtmlColorAndStyle color, double stroke, Direction emphasizeDirection,
UPolygon endDecoration) {
worm.drawInternalOneColor(ug, color, stroke, emphasizeDirection, endDecoration);
public void drawInternalOneColor(UPolygon startDecoration, UGraphic ug, HtmlColorAndStyle color, double stroke,
Direction emphasizeDirection, UPolygon endDecoration) {
worm.drawInternalOneColor(startDecoration, ug, color, stroke, emphasizeDirection, endDecoration);
}
public Worm getWorm() {

View File

@ -36,6 +36,7 @@
package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact;
import java.awt.geom.Dimension2D;
import java.util.Collection;
import java.util.Set;
import net.sourceforge.plantuml.AlignmentParam;
@ -108,6 +109,11 @@ public class FtileGroup extends AbstractFtile {
this.stroke = thickness == null ? new UStroke(2) : thickness;
}
@Override
public Collection<Ftile> getMyChildren() {
return inner.getMyChildren();
}
@Override
public LinkRendering getInLinkRendering() {
return inner.getInLinkRendering();

View File

@ -42,10 +42,10 @@ import net.sourceforge.plantuml.skin.ArrowConfiguration;
import net.sourceforge.plantuml.skin.ArrowDirection;
import net.sourceforge.plantuml.skin.Component;
import net.sourceforge.plantuml.skin.ComponentType;
import net.sourceforge.plantuml.skin.Skin;
import net.sourceforge.plantuml.skin.rose.ComponentRoseGroupingSpace;
import net.sourceforge.plantuml.skin.rose.Rose;
public class TextSkin implements Skin {
public class TextSkin extends Rose {
private final FileFormat fileFormat;
@ -125,8 +125,4 @@ public class TextSkin implements Skin {
throw new UnsupportedOperationException(type.toString());
}
public Object getProtocolVersion() {
return 1;
}
}

View File

@ -44,8 +44,14 @@ import net.sourceforge.plantuml.core.Diagram;
public abstract class SingleLineCommand2<S extends Diagram> implements Command<S> {
private final RegexConcat pattern;
private final boolean doTrim;
public SingleLineCommand2(RegexConcat pattern) {
this(true, pattern);
}
public SingleLineCommand2(boolean doTrim, RegexConcat pattern) {
this.doTrim = doTrim;
if (pattern == null) {
throw new IllegalArgumentException();
}
@ -64,6 +70,13 @@ public abstract class SingleLineCommand2<S extends Diagram> implements Command<S
return new String[] { pattern.getPattern() };
}
private String myTrim(CharSequence s) {
if (doTrim) {
return StringUtils.trin(s);
}
return s.toString();
}
final public CommandControl isValid(BlocLines lines) {
if (lines.size() == 2 && syntaxWithFinalBracket()) {
return isValidBracket(lines);
@ -74,7 +87,7 @@ public abstract class SingleLineCommand2<S extends Diagram> implements Command<S
if (isCommandForbidden()) {
return CommandControl.NOT_OK;
}
final String line = StringUtils.trin(lines.getFirst499());
final String line = myTrim(lines.getFirst499());
if (syntaxWithFinalBracket() && line.endsWith("{") == false) {
final String vline = lines.get499(0).toString() + " {";
if (isValid(BlocLines.single(vline)) == CommandControl.OK) {
@ -92,7 +105,7 @@ public abstract class SingleLineCommand2<S extends Diagram> implements Command<S
private CommandControl isValidBracket(BlocLines lines) {
assert lines.size() == 2;
assert syntaxWithFinalBracket();
if (StringUtils.trin(lines.get499(1)).equals("{") == false) {
if (myTrim(lines.get499(1)).equals("{") == false) {
return CommandControl.NOT_OK;
}
final String vline = lines.get499(0).toString() + " {";
@ -108,13 +121,13 @@ public abstract class SingleLineCommand2<S extends Diagram> implements Command<S
public final CommandExecutionResult execute(S system, BlocLines lines) {
if (syntaxWithFinalBracket() && lines.size() == 2) {
assert StringUtils.trin(lines.get499(1)).equals("{");
assert myTrim(lines.get499(1)).equals("{");
lines = BlocLines.single(lines.getFirst499() + " {");
}
if (lines.size() != 1) {
throw new IllegalArgumentException();
}
final String line = StringUtils.trin(lines.getFirst499());
final String line = myTrim(lines.getFirst499());
if (isForbidden(line)) {
return CommandExecutionResult.error("Syntax error: " + line);
}

View File

@ -74,7 +74,7 @@ public abstract class RegexComposed implements IRegex {
public RegexResult matcher(String s) {
final Matcher2 matcher = getFull().matcher(s);
if (matcher.find() == false) {
throw new IllegalArgumentException(getClass()+" "+s);
return null;
}
final Iterator<String> it = new MatcherIterator(matcher);

View File

@ -38,7 +38,7 @@ package net.sourceforge.plantuml.core;
import net.sourceforge.plantuml.utils.StartUtils;
public enum DiagramType {
UML, BPM, DITAA, DOT, PROJECT, JCCKIT, SALT, FLOW, CREOLE, JUNGLE, CUTE, MATH, LATEX, DEFINITION, GANTT, NW, UNKNOWN;
UML, BPM, DITAA, DOT, PROJECT, JCCKIT, SALT, FLOW, CREOLE, JUNGLE, CUTE, MATH, LATEX, DEFINITION, GANTT, NW, MINDMAP, UNKNOWN;
static public DiagramType getTypeFromArobaseStart(String s) {
s = s.toLowerCase();
@ -93,6 +93,9 @@ public enum DiagramType {
if (StartUtils.startsWithSymbolAnd("startnwdiag", s)) {
return NW;
}
if (StartUtils.startsWithSymbolAnd("startmindmap", s)) {
return MINDMAP;
}
return UNKNOWN;
}
}

View File

@ -41,7 +41,7 @@ import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UShape;
interface Atom extends UShape {
public interface Atom extends UShape {
public Dimension2D calculateDimension(StringBounder stringBounder);

View File

@ -1,134 +0,0 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.creole;
import java.awt.geom.Dimension2D;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.List;
import javax.imageio.ImageIO;
import net.sourceforge.plantuml.BlockUml;
import net.sourceforge.plantuml.CharSequence2;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.EmbededDiagram;
import net.sourceforge.plantuml.FileFormat;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.SvgString;
import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.preproc.Defines;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UImage;
import net.sourceforge.plantuml.ugraphic.UImageSvg;
import net.sourceforge.plantuml.ugraphic.UShape;
class AtomEmbededSystem implements Atom {
final private List<CharSequence2> lines2;
public AtomEmbededSystem(EmbededDiagram sys) {
this.lines2 = sys.getLines().as2();
}
public double getStartingAltitude(StringBounder stringBounder) {
return 0;
}
public Dimension2D calculateDimension(StringBounder stringBounder) {
try {
final BufferedImage im = getImage();
return new Dimension2DDouble(im.getWidth(), im.getHeight());
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
return new Dimension2DDouble(42, 42);
}
public void drawU(UGraphic ug) {
try {
final boolean isSvg = ug.matchesProperty("SVG");
if (isSvg) {
final String imageSvg = getImageSvg();
final SvgString svg = new SvgString(imageSvg, 1);
ug.draw(new UImageSvg(svg));
return;
}
final BufferedImage im = getImage();
final UShape image = new UImage(im);
ug.draw(image);
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
private String getImageSvg() throws IOException, InterruptedException {
final Diagram system = getSystem();
final ByteArrayOutputStream os = new ByteArrayOutputStream();
system.exportDiagram(os, 0, new FileFormatOption(FileFormat.SVG));
os.close();
return new String(os.toByteArray());
}
private BufferedImage getImage() throws IOException, InterruptedException {
final Diagram system = getSystem();
final ByteArrayOutputStream os = new ByteArrayOutputStream();
system.exportDiagram(os, 0, new FileFormatOption(FileFormat.PNG));
os.close();
final ByteArrayInputStream is = new ByteArrayInputStream(os.toByteArray());
final BufferedImage im = ImageIO.read(is);
is.close();
return im;
}
// public HorizontalAlignment getHorizontalAlignment() {
// return HorizontalAlignment.LEFT;
// }
//
private Diagram getSystem() throws IOException, InterruptedException {
final BlockUml blockUml = new BlockUml(lines2, Defines.createEmpty());
return blockUml.getDiagram();
}
}

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.creole;
import java.awt.font.LineMetrics;
import java.awt.geom.Dimension2D;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.StringTokenizer;
@ -305,20 +306,25 @@ public class AtomText implements Atom {
public List<AtomText> getSplitted(StringBounder stringBounder, LineBreakStrategy maxWidthAsString) {
final double maxWidth = maxWidthAsString.getMaxWidth();
if (maxWidth == 0) {
throw new IllegalStateException();
}
final List<AtomText> result = new ArrayList<AtomText>();
final StringTokenizer st = new StringTokenizer(text, " ", true);
final StringBuilder currentLine = new StringBuilder();
while (st.hasMoreTokens()) {
final String token = st.nextToken();
final double w = getWidth(stringBounder, currentLine + token);
final String token1 = st.nextToken();
for (String tmp : splitLong1(stringBounder, maxWidth, token1)) {
final double w = getWidth(stringBounder, currentLine + tmp);
if (w > maxWidth) {
result.add(new AtomText(currentLine.toString(), fontConfiguration, url, marginLeft, marginRight));
currentLine.setLength(0);
if (token.startsWith(" ") == false) {
currentLine.append(token);
if (tmp.startsWith(" ") == false) {
currentLine.append(tmp);
}
} else {
currentLine.append(token);
currentLine.append(tmp);
}
}
}
result.add(new AtomText(currentLine.toString(), fontConfiguration, url, marginLeft, marginRight));
@ -326,6 +332,31 @@ public class AtomText implements Atom {
}
private List<String> splitLong1(StringBounder stringBounder, double maxWidth, String add) {
return Arrays.asList(add);
}
private List<String> splitLong2(StringBounder stringBounder, double maxWidth, String add) {
final List<String> result = new ArrayList<String>();
if (getWidth(stringBounder, add) <= maxWidth) {
result.add(add);
return result;
}
final StringBuilder current = new StringBuilder();
for (int i = 0; i < add.length(); i++) {
final char c = add.charAt(i);
if (getWidth(stringBounder, current.toString() + c) > maxWidth) {
result.add(current.toString());
current.setLength(0);
}
current.append(c);
}
if (current.length() > 0) {
result.add(current.toString());
}
return result;
}
public final String getText() {
return text;
}

View File

@ -38,7 +38,7 @@ package net.sourceforge.plantuml.creole;
import java.util.Arrays;
import java.util.List;
import net.sourceforge.plantuml.EmbededDiagram;
import net.sourceforge.plantuml.EmbeddedDiagram;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.cucadiagram.Display;
@ -100,12 +100,13 @@ public class CreoleParser {
final CreoleContext context = new CreoleContext();
for (CharSequence cs : display) {
final Stripe stripe;
if (cs instanceof EmbededDiagram) {
final Atom atom = new AtomEmbededSystem((EmbededDiagram) cs);
if (cs instanceof EmbeddedDiagram) {
final Atom atom = ((EmbeddedDiagram) cs).asDraw(skinParam);
stripe = new Stripe() {
public Atom getHeader() {
return null;
}
public List<Atom> getAtoms() {
return Arrays.asList(atom);
}

View File

@ -42,10 +42,10 @@ import java.util.Collections;
import java.util.List;
import java.util.ListIterator;
import net.sourceforge.plantuml.EmbeddedDiagram;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.creole.CreoleMode;
@ -67,7 +67,7 @@ public class BodyEnhanced extends AbstractTextBlock implements TextBlock, WithPo
private TextBlock area2;
private final FontConfiguration titleConfig;
private final List<String> rawBody;
private final List<CharSequence> rawBody;
private final FontParam fontParam;
private final ISkinParam skinParam;
private final boolean lineFirst;
@ -81,7 +81,7 @@ public class BodyEnhanced extends AbstractTextBlock implements TextBlock, WithPo
public BodyEnhanced(List<String> rawBody, FontParam fontParam, ISkinParam skinParam, boolean manageModifier,
Stereotype stereotype, ILeaf entity) {
this.rawBody = new ArrayList<String>(rawBody);
this.rawBody = new ArrayList<CharSequence>(rawBody);
this.stereotype = stereotype;
this.fontParam = fontParam;
this.skinParam = skinParam;
@ -99,7 +99,7 @@ public class BodyEnhanced extends AbstractTextBlock implements TextBlock, WithPo
Stereotype stereotype, boolean manageHorizontalLine, boolean manageModifier, ILeaf entity) {
this.entity = entity;
this.stereotype = stereotype;
this.rawBody = new ArrayList<String>();
this.rawBody = new ArrayList<CharSequence>();
this.fontParam = fontParam;
this.skinParam = skinParam;
@ -114,7 +114,7 @@ public class BodyEnhanced extends AbstractTextBlock implements TextBlock, WithPo
this.rawBody.add("");
}
for (CharSequence s : display) {
this.rawBody.add(s.toString());
this.rawBody.add(s);
}
}
@ -147,8 +147,12 @@ public class BodyEnhanced extends AbstractTextBlock implements TextBlock, WithPo
TextBlock title = null;
List<Member> members = new ArrayList<Member>();
// final LineBreakStrategy lineBreakStrategy = skinParam.wrapWidth();
for (ListIterator<String> it = rawBody.listIterator(); it.hasNext();) {
final String s = it.next();
for (ListIterator<CharSequence> it = rawBody.listIterator(); it.hasNext();) {
final CharSequence s2 = it.next();
if (s2 instanceof EmbeddedDiagram) {
blocks.add(((EmbeddedDiagram) s2).asDraw(skinParam));
} else {
final String s = s2.toString();
if (manageHorizontalLine && isBlockSeparator(s)) {
blocks.add(decorate(stringBounder, new MethodsOrFieldsArea(members, fontParam, skinParam, align,
stereotype, entity), separator, title));
@ -157,13 +161,13 @@ public class BodyEnhanced extends AbstractTextBlock implements TextBlock, WithPo
members = new ArrayList<Member>();
} else if (CreoleParser.isTreeStart(s)) {
if (members.size() > 0) {
blocks.add(decorate(stringBounder, new MethodsOrFieldsArea(members, fontParam, skinParam, align,
stereotype, entity), separator, title));
blocks.add(decorate(stringBounder, new MethodsOrFieldsArea(members, fontParam, skinParam,
align, stereotype, entity), separator, title));
}
members = new ArrayList<Member>();
final List<String> allTree = buildAllTree(s, it);
final TextBlock bloc = Display.create(allTree).create(fontParam.getFontConfiguration(skinParam), align,
skinParam, CreoleMode.FULL);
final List<CharSequence> allTree = buildAllTree(s, it);
final TextBlock bloc = Display.create(allTree).create(fontParam.getFontConfiguration(skinParam),
align, skinParam, CreoleMode.FULL);
blocks.add(bloc);
} else {
final Member m = new MemberImpl(s, MemberImpl.isMethod(s), manageModifier);
@ -173,6 +177,7 @@ public class BodyEnhanced extends AbstractTextBlock implements TextBlock, WithPo
}
}
}
}
if (inEllipse && members.size() == 0) {
members.add(new MemberImpl("", false, false));
}
@ -188,11 +193,11 @@ public class BodyEnhanced extends AbstractTextBlock implements TextBlock, WithPo
return area2;
}
private static List<String> buildAllTree(String init, ListIterator<String> it) {
final List<String> result = new ArrayList<String>();
private static List<CharSequence> buildAllTree(String init, ListIterator<CharSequence> it) {
final List<CharSequence> result = new ArrayList<CharSequence>();
result.add(init);
while (it.hasNext()) {
final String s = it.next();
final CharSequence s = it.next();
if (CreoleParser.isTreeStart(StringUtils.trinNoTrace(s))) {
result.add(s);
} else {

View File

@ -45,7 +45,7 @@ import java.util.List;
import net.sourceforge.plantuml.BackSlash;
import net.sourceforge.plantuml.CharSequence2;
import net.sourceforge.plantuml.CharSequence2Impl;
import net.sourceforge.plantuml.EmbededDiagram;
import net.sourceforge.plantuml.EmbeddedDiagram;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.LineLocationImpl;
@ -190,11 +190,11 @@ public class Display implements Iterable<CharSequence> {
boolean isNull, CreoleMode defaultCreoleMode) {
this(naturalHorizontalAlignment, isNull, defaultCreoleMode);
if (isNull == false) {
this.display.addAll(manageEmbededDiagrams2(other));
this.display.addAll(manageEmbeddedDiagrams(other));
}
}
private static List<CharSequence> manageEmbededDiagrams2(final Collection<? extends CharSequence> strings) {
private static List<CharSequence> manageEmbeddedDiagrams(final Collection<? extends CharSequence> strings) {
final List<CharSequence> result = new ArrayList<CharSequence>();
final Iterator<? extends CharSequence> it = strings.iterator();
while (it.hasNext()) {
@ -210,7 +210,7 @@ public class Display implements Iterable<CharSequence> {
other.add(s2);
}
other.add("@enduml");
s = new EmbededDiagram(Display.create(other));
s = new EmbeddedDiagram(Display.create(other));
}
result.add(s);
}
@ -480,11 +480,8 @@ public class Display implements Iterable<CharSequence> {
if (stereotype.isSpotted()) {
circledCharacter = new CircledCharacter(stereotype.getCharacter(), stereotype.getRadius(),
stereotype.getCircledFont(), stereotype.getHtmlColor(), null, fontConfiguration.getColor());
} else if (stereotype.getSprite() != null) {
final Sprite tmp = spriteContainer.getSprite(stereotype.getSprite());
if (tmp != null) {
circledCharacter = tmp.asTextBlock(stereotype.getHtmlColor(), 1);
}
} else {
circledCharacter = stereotype.getSprite(spriteContainer);
}
if (circledCharacter != null) {
if (stereotype.getLabel(false) == null) {

View File

@ -211,6 +211,11 @@ public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlockW
public void drawU(UGraphic ug) {
}
@Override
public Rectangle2D getInnerPosition(String member, StringBounder stringBounder, InnerStrategy strategy) {
return null;
}
public Dimension2D calculateDimension(StringBounder stringBounder) {
return new Dimension2DDouble(1, 1);
}

View File

@ -42,22 +42,48 @@ import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.sourceforge.plantuml.SpriteContainer;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.command.regex.MyPattern;
import net.sourceforge.plantuml.command.regex.Pattern2;
import net.sourceforge.plantuml.command.regex.RegexComposed;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.creole.CommandCreoleImg;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.IHtmlColorSet;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.svek.PackageStyle;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.sprite.Sprite;
import net.sourceforge.plantuml.ugraphic.sprite.SpriteUtils;
public class Stereotype implements CharSequence {
private final static Pattern2 circleChar = MyPattern
.cmpile("\\<\\<[%s]*\\(?(\\S)[%s]*,[%s]*(#[0-9a-fA-F]{6}|\\w+)[%s]*(?:[),](.*?))?\\>\\>");
private final static Pattern2 circleSprite = MyPattern.cmpile("\\<\\<[%s]*\\(?\\$(" + SpriteUtils.SPRITE_NAME
+ ")[%s]*(?:,[%s]*(#[0-9a-fA-F]{6}|\\w+))?[%s]*(?:[),](.*?))?\\>\\>");
private final static RegexComposed circleChar = new RegexConcat( //
new RegexLeaf("\\<\\<[%s]*"), //
new RegexLeaf("\\(?"), //
new RegexLeaf("CHAR", "(\\S)"), //
new RegexLeaf("[%s]*,[%s]*"), //
new RegexLeaf("COLOR", "(#[0-9a-fA-F]{6}|\\w+)"), //
new RegexLeaf("[%s]*"), //
new RegexLeaf("LABEL", "(?:[),](.*?))?"), //
new RegexLeaf("\\>\\>") //
);
private final static RegexComposed circleSprite = new RegexConcat( //
new RegexLeaf("\\<\\<[%s]*"), //
new RegexLeaf("\\(?\\$"), //
new RegexLeaf("NAME", "(" + SpriteUtils.SPRITE_NAME + ")"), //
new RegexLeaf("SCALE", "((?:\\{scale=|\\*)([0-9.]+)\\}?)?"), //
new RegexLeaf("[%s]*"), //
new RegexLeaf("COLOR", "(?:,[%s]*(#[0-9a-fA-F]{6}|\\w+))?"), //
new RegexLeaf("[%s]*"), //
new RegexLeaf("LABEL", "(?:[),](.*?))?"), //
new RegexLeaf("\\>\\>") //
);
private final double radius;
private final UFont circledFont;
@ -66,12 +92,29 @@ public class Stereotype implements CharSequence {
private String label;
private HtmlColor htmlColor;
private char character;
private String sprite;
private String spriteName;
private double spriteScale;
public Stereotype(String label, double radius, UFont circledFont, IHtmlColorSet htmlColorSet) {
this(label, radius, circledFont, true, htmlColorSet);
}
public Stereotype(String label, boolean automaticPackageStyle) {
this.automaticPackageStyle = automaticPackageStyle;
this.label = label;
this.htmlColor = null;
this.character = '\0';
this.radius = 0;
this.circledFont = null;
if (label.startsWith("<<$") && label.endsWith(">>")) {
final RegexResult mCircleSprite = circleSprite.matcher(label);
this.spriteName = mCircleSprite.get("NAME", 0);
this.spriteScale = CommandCreoleImg.getScale(mCircleSprite.get("SCALE", 0), 1);
} else {
this.spriteName = null;
}
}
public Stereotype(String label, double radius, UFont circledFont, boolean automaticPackageStyle,
IHtmlColorSet htmlColorSet) {
if (label == null) {
@ -88,29 +131,30 @@ public class Stereotype implements CharSequence {
final List<String> list = cutLabels(label, false);
for (String local : list) {
final Matcher2 mCircleChar = circleChar.matcher(local);
final Matcher2 mCircleSprite = circleSprite.matcher(local);
if (mCircleSprite.find()) {
if (StringUtils.isNotEmpty(mCircleSprite.group(3))) {
local = "<<" + mCircleSprite.group(3) + ">>";
final RegexResult mCircleChar = circleChar.matcher(local);
final RegexResult mCircleSprite = circleSprite.matcher(local);
if (mCircleSprite != null) {
if (StringUtils.isNotEmpty(mCircleSprite.get("LABEL", 0))) {
local = "<<" + mCircleSprite.get("LABEL", 0) + ">>";
} else {
local = null;
}
final String colName = mCircleSprite.group(2);
final String colName = mCircleSprite.get("COLOR", 0);
final HtmlColor col = htmlColorSet.getColorIfValid(colName);
this.htmlColor = col == null ? HtmlColorUtils.BLACK : col;
this.sprite = mCircleSprite.group(1);
this.spriteName = mCircleSprite.get("NAME", 0);
this.character = '\0';
} else if (mCircleChar.find()) {
if (StringUtils.isNotEmpty(mCircleChar.group(3))) {
local = "<<" + mCircleChar.group(3) + ">>";
this.spriteScale = CommandCreoleImg.getScale(mCircleSprite.get("SCALE", 0), 1);
} else if (mCircleChar != null) {
if (StringUtils.isNotEmpty(mCircleChar.get("LABEL", 0))) {
local = "<<" + mCircleChar.get("LABEL", 0) + ">>";
} else {
local = null;
}
final String colName = mCircleChar.group(2);
final String colName = mCircleChar.get("COLOR", 0);
this.htmlColor = htmlColorSet.getColorIfValid(colName);
this.character = mCircleChar.group(1).charAt(0);
this.sprite = null;
this.character = mCircleChar.get("CHAR", 0).charAt(0);
this.spriteName = null;
}
if (local != null) {
tmpLabel.append(local);
@ -125,19 +169,6 @@ public class Stereotype implements CharSequence {
this(label, true);
}
public Stereotype(String label, boolean automaticPackageStyle) {
this.automaticPackageStyle = automaticPackageStyle;
this.label = label;
this.htmlColor = null;
this.character = '\0';
this.radius = 0;
this.circledFont = null;
if (label.startsWith("<<$") && label.endsWith(">>")) {
this.sprite = label.substring(3, label.length() - 2).trim();
} else {
this.sprite = null;
}
}
public HtmlColor getHtmlColor() {
return htmlColor;
@ -147,8 +178,15 @@ public class Stereotype implements CharSequence {
return character;
}
public final String getSprite() {
return sprite;
public final TextBlock getSprite(SpriteContainer container) {
if (spriteName == null || container == null) {
return null;
}
final Sprite tmp = container.getSprite(spriteName);
if (tmp == null) {
return null;
}
return tmp.asTextBlock(getHtmlColor(), spriteScale);
}
public boolean isWithOOSymbol() {

View File

@ -36,7 +36,9 @@
package net.sourceforge.plantuml.descdiagram.command;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlBuilder.ModeUrl;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.classdiagram.command.CommandCreateClassMultilines;
import net.sourceforge.plantuml.command.CommandExecutionResult;
@ -134,6 +136,12 @@ public class CommandPackageWithUSymbol extends SingleLineCommand2<AbstractEntity
if (stereotype != null) {
p.setStereotype(new Stereotype(stereotype, false));
}
final String urlString = arg.get("URL", 0);
if (urlString != null) {
final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT);
final Url url = urlBuilder.getUrl(urlString);
p.addUrl(url);
}
CommandCreateClassMultilines.addTags(p, arg.get("TAGS", 0));
final Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
p.setColors(colors);

View File

@ -71,22 +71,22 @@ public class PSystemDonors extends AbstractPSystem {
private static final int COLS = 6;
private static final int FREE_LINES = 6;
public static final String DONORS = "6zm80AmEEBmtNeGqQ-xME_ioXj6A6CylpxzGd5Z4qzs0-0MuTthSRwI_YAvqxvjcH5klBSmPH700wedp"
+ "RuQMT_qrVlFrLJB6LIrTOG84tZ4kxHj_ULk8gMBxBHFQ-zkF2tL8QuNW2jnKJiZyTAy2XmAoE9jY_ZbW"
+ "O-FQkxLxdrgxbYvsFw0jq9X6FxQibADsTU1heSR1aN5yGqfcnPWFaQAfZIr0moTkn6gZEi4dKhF_g4Lg"
+ "qffTGxfB0B6C5B7cRT7SlfFjKnWuuQXaXm94E91mI2zo752VIC1HIgD6P1IZiQxYBKz44A632hlmZvmK"
+ "dpraUPIX0uxARY2WyHi40NWcnPJOREDcGCuUrYAdmKATcHizalt5u9GZ3nek8JjK8gW5L078cw0BUbrz"
+ "vX9d6PkYX2TlORpAOe2SPLq0ZYSp-jfBOQ3ytpym4-Hoezfw27FATOnV7HtmKqD6zdxJQfopc8ZvRIx8"
+ "y8K5E5y0lTGQAiRVD-UDXNW8ZIbr8IVEmUDz586mobAmo4rCSStnaovziPgORrrOB1_XrvcXBCC8NAdO"
+ "0_Y8bjC7TRw0hXhgduTSTHsVmjOuBTXRX4ydpRdY_rst93DA5z1Q4pv4LqAKBBrWbIqcHGIk0Fesu259"
+ "RgJgo-HHlYmV4k_xao3Ud70WKfi5x4_A6OrB3bE85rOwLCKCOBfBr0kEserqmwiJqBj0vHGPuQxVquGz"
+ "RDAOEZUuud4_n1ZaYtIyVD5ZCvUCImsTCcrsxDH-n560s_0bUTLz68vL04jHxvR5qdWQ0-uQvZI3T1sH"
+ "zprjIOzB7QLbEMvnLPTuDhU3YuTEBZYJHMFCQ7CSCZiadvEfgLkCvwb1uxT1PEts2gBE0dU3TJYGOHcV"
+ "0zOLamEL7C5H6ivmoCGa2QtMUSLk0t0FechhcEsfQmcndhhw5AWsViJPo81AsWd744UxA-oCXQF8Vjcy"
+ "LqRTrBSX6CS2yiKWmKagb6s4e39iJY53UX_qZCP9FizBkonas_XcuGM6mYT8TDziWrMc48yKwOsw1i3r"
+ "Owl4YnyJ8u2VyVORw5d6EkZvDtfQMHp0ff8GC1MMSlYNOALYtQn9hBVeTLjhRylEdt-l8zCunVisLWgW"
+ "no2B_WiXY9EeSmMte1yNV2P7RI4ZiA-3RLkvDlGumA2WHIsJNBLDC-BJMLQketPuvF6XdFykao2mdqz8"
+ "Ud4AAaUV4gpMtkfAPQ1zyet5IGuM_nHL6hAuYZfgOiGH";
public static final String DONORS = "6-i802mER3hSGmjfrjohVvkCORGYHh0yJoWE0ujukXiGVu1xfyVzHlgBw4htlcb6jFNQmfn110UWdZZ_"
+ "PcXvrr_ZDrzV9MDSrT8L9a3W7UFIll6NjuMOAhRVCg6zl_suK8UqLWYkm4tb_F_tAc1EA22BiodcdmEq"
+ "1guzkkpTJwszbbxi_OAsG6CQ_TYoKfRQXf6lQs0DFOsDunrHiYh6wY95MnjRW9PFt4ZKHky4dqYj_gCM"
+ "gKbhTWtfBW74CbB4chTb2_jE3f_2m8b0BJiK8CA1X4DsaOExFf400fKqQiH6CHlhAJxoH0mHUgYm2__8"
+ "IV7PGvP76JeGgEq60bg_GH20Pr52YSqs7mRaxc4j2Xeir9cvqIFTNmnEkT9fk9JiK8kW5b0586-2BkXr"
+ "zPbBd6LiYXAUl8NnQei1SfRr0JYUhEZhBeM1ydltm4oOouLgwo7CATSnVdLqm4yD6TdxJUlZcCL4p6zp"
+ "GOOlBC3v0kYbrb0n_huv7op4GsXCgGivSGuVxxC8X5MMWaLkOefhhfzq6Pirn7phmc9xYRxE36KPHk1A"
+ "nHx0HxJSFgZp1NJLKFyyvAhh-1Isnct1tZ9yEcdE5V_lkYMPKRg0Dfhm8RfIecJf1QjyCIaYS0NGbm4F"
+ "IN8ZLLycZ_9b-P1utvy4yUQ40v7Qh61_KCveN7AOGhomrf4gLW3JNQ9U23Hkf1j-dO3U1Yg7o0Xt_Puc"
+ "x66JnjIvmHMtko7685-au-MB7fkvP5ngw9PfiskdzWEE0jo1Dychxitagm2MejuTYwNnD0RSDSnf1kay"
+ "8kzxsf8UbpfAoxBVugekyMnk1tyUEhtWB1PDCQED7p8d51-JKLEt6CzJWyPlayWwxH56dGqC3m7XG8Pb"
+ "V0fOLqoUgUG8WSfmXaCk9adejCuhTfc0knUgOUspFNKj8TPJLny3rSQFE1iPKCawuGJY6Eu6EsFZAB9V"
+ "Dk-LKJVrRGY6Bw10318Sf4BPHWWgm-OKCgJtISzadEJplBJBGhwDRpPUOIXyWaHtpJROPGhnA97Tg1i0"
+ "N1-sIhpuCJ42-1bllu6URQw3dd-ZfvN50Mmg2G5JOMk7VmdsLAwRDOdr5hrkQ-rjsVdpxtLa6gTatyOg"
+ "0VGOPDD_4GHn4dMjy1RquuBF4cWiP0HsTR1jAxU67WSO5BIfPPghjcL6V3hBolNK3e_q3-N-xv194DZD"
+ "9oIzE0ILeqy9LcjlTQKoqJxznk8Y1ul_4rLQChdAkieP2IHU0000";
@Override
final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed)

View File

@ -1,112 +0,0 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.graphic;
import java.awt.geom.Dimension2D;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.List;
import javax.imageio.ImageIO;
import net.sourceforge.plantuml.BlockUml;
import net.sourceforge.plantuml.CharSequence2;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.EmbededDiagram;
import net.sourceforge.plantuml.FileFormat;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.preproc.Defines;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UImage;
import net.sourceforge.plantuml.ugraphic.UShape;
class EmbededSystemLine extends AbstractTextBlock implements Line {
final private List<CharSequence2> lines2;
public EmbededSystemLine(EmbededDiagram sys) {
this.lines2 = sys.getLines().as2();
}
public Dimension2D calculateDimension(StringBounder stringBounder) {
try {
final BufferedImage im = getImage();
return new Dimension2DDouble(im.getWidth(), im.getHeight());
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
return new Dimension2DDouble(42, 42);
}
public void drawU(UGraphic ug) {
try {
final BufferedImage im = getImage();
final UShape image = new UImage(im);
ug.draw(image);
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
private BufferedImage getImage() throws IOException, InterruptedException {
final Diagram system = getSystem();
final ByteArrayOutputStream os = new ByteArrayOutputStream();
system.exportDiagram(os, 0, new FileFormatOption(FileFormat.PNG));
os.close();
final ByteArrayInputStream is = new ByteArrayInputStream(os.toByteArray());
final BufferedImage im = ImageIO.read(is);
is.close();
return im;
}
public HorizontalAlignment getHorizontalAlignment() {
return HorizontalAlignment.LEFT;
}
private Diagram getSystem() throws IOException, InterruptedException {
final BlockUml blockUml = new BlockUml(lines2, Defines.createEmpty());
return blockUml.getDiagram();
}
}

View File

@ -36,7 +36,7 @@
package net.sourceforge.plantuml.graphic;
interface Line extends TextBlock {
public interface Line extends TextBlock {
HorizontalAlignment getHorizontalAlignment();
}

View File

@ -300,7 +300,11 @@ public class QuoteUtils {
"P unf gur fcrrq naq rssvpvrapl bs nffrzoyl ynathntr pbzovarq jvgu ernqnovyvgl bs nffrzoyl ynathntr",
"Crey vf gur bayl ynathntr gung ybbxf gur fnzr orsber naq nsgre EFN rapelcgvba",
"Gur zber vg snvyf, gur zber yvxryl vg vf gung vg jvyy jbex",
"V ubcr V qvqa'g gnxr hc gbb zhpu bs lbhe gvzr", "Lbh'er tbaan arrq n ovttre obng");
"V ubcr V qvqa'g gnxr hc gbb zhpu bs lbhe gvzr", "Lbh'er tbaan arrq n ovttre obng",
"Dhnaq ibhf rgrf rzorgrf, rzoebhvyyrm gbhg", "Gurer nva'g ab phevat jung'f jebat jvgu gung guvat",
"Vs lbh cevpx hf, qb jr abg oyrrq?", "V qvq lbhe wbo bapr - V jnf tbbq ng vg.",
"Vyf cbheenvrag snver har fryrpgvba nh fgnaqneq...", "Gung'f ab jnl gb gerng n sevraq.",
"Ubjrire ornhgvshy gur fgengrtl, lbh fubhyq bppnfvbanyyl ybbx ng gur erfhygf");
private QuoteUtils() {
}

View File

@ -42,7 +42,7 @@ import java.util.List;
import java.util.StringTokenizer;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.EmbededDiagram;
import net.sourceforge.plantuml.EmbeddedDiagram;
import net.sourceforge.plantuml.SpriteContainer;
import net.sourceforge.plantuml.command.regex.MyPattern;
import net.sourceforge.plantuml.cucadiagram.Display;
@ -91,8 +91,8 @@ public class TextBlockSimple extends AbstractTextBlock implements TextBlock {
lines2.addAll(createLinesForStereotype(
fontConfiguration.forceFont(fontForStereotype, htmlColorForStereotype), (Stereotype) s,
horizontalAlignment, spriteContainer));
} else if (s instanceof EmbededDiagram) {
lines2.add(new EmbededSystemLine((EmbededDiagram) s));
} else if (s instanceof EmbeddedDiagram) {
lines2.add(((EmbeddedDiagram) s).asDraw(null));
} else {
addInLines(stringBounder, s.toString());
}

View File

@ -0,0 +1,73 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.help;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
public class CommandHelp extends SingleLineCommand2<Help> {
public CommandHelp() {
super(getRegexConcat());
}
static RegexConcat getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), //
new RegexLeaf("help"), //
new RegexLeaf("$"));
}
@Override
protected CommandExecutionResult executeArg(Help diagram, RegexResult arg) {
diagram.add("<b>General help");
diagram.add(" ");
diagram.add("The code of this command is located in <i>net.sourceforge.plantuml.help</i> package.");
diagram.add("You may improve it on <i>https://github.com/plantuml/plantuml/tree/master/src/net/sourceforge/plantuml/help</i>");
diagram.add(" ");
diagram.add(" There are some other help command:");
diagram.add("* help types");
diagram.add("* help keywords");
diagram.add("* help preprocessors");
diagram.add("* help colors");
diagram.add("* help font");
diagram.add("* help skinparams");
return CommandExecutionResult.ok();
}
}

View File

@ -0,0 +1,74 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.help;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.graphic.HtmlColorSetSimple;
import net.sourceforge.plantuml.syntax.LanguageDescriptor;
public class CommandHelpColor extends SingleLineCommand2<Help> {
public CommandHelpColor() {
super(getRegexConcat());
}
static RegexConcat getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), //
new RegexLeaf("help"), //
new RegexLeaf("[%s]+"), //
new RegexLeaf("colors?"), //
new RegexLeaf("$"));
}
@Override
protected CommandExecutionResult executeArg(Help diagram, RegexResult arg) {
diagram.add("<b>Help on colors");
diagram.add(" ");
diagram.add("The code of this command is located in <i>net.sourceforge.plantuml.help</i> package.");
diagram.add("You may improve it on <i>https://github.com/plantuml/plantuml/tree/master/src/net/sourceforge/plantuml/help</i>");
diagram.add(" ");
diagram.add(" The possible colors are :");
for (String type : new HtmlColorSetSimple().names()) {
diagram.add("* " + type);
}
return CommandExecutionResult.ok();
}
}

View File

@ -0,0 +1,76 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.help;
import java.awt.GraphicsEnvironment;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.syntax.LanguageDescriptor;
public class CommandHelpFont extends SingleLineCommand2<Help> {
public CommandHelpFont() {
super(getRegexConcat());
}
static RegexConcat getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), //
new RegexLeaf("help"), //
new RegexLeaf("[%s]+"), //
new RegexLeaf("fonts?"), //
new RegexLeaf("$"));
}
@Override
protected CommandExecutionResult executeArg(Help diagram, RegexResult arg) {
diagram.add("<b>Help on font");
diagram.add(" ");
diagram.add("The code of this command is located in <i>net.sourceforge.plantuml.help</i> package.");
diagram.add("You may improve it on <i>https://github.com/plantuml/plantuml/tree/master/src/net/sourceforge/plantuml/help</i>");
diagram.add(" ");
diagram.add(" The possible font on your system are :");
final String name[] = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
for (String n : name) {
diagram.add("* " + n);
}
return CommandExecutionResult.ok();
}
}

View File

@ -0,0 +1,73 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.help;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.syntax.LanguageDescriptor;
public class CommandHelpKeyword extends SingleLineCommand2<Help> {
public CommandHelpKeyword() {
super(getRegexConcat());
}
static RegexConcat getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), //
new RegexLeaf("help"), //
new RegexLeaf("[%s]+"), //
new RegexLeaf("keywords?"), //
new RegexLeaf("$"));
}
@Override
protected CommandExecutionResult executeArg(Help diagram, RegexResult arg) {
diagram.add("<b>Help on keywords");
diagram.add(" ");
diagram.add("The code of this command is located in <i>net.sourceforge.plantuml.help</i> package.");
diagram.add("You may improve it on <i>https://github.com/plantuml/plantuml/tree/master/src/net/sourceforge/plantuml/help</i>");
diagram.add(" ");
diagram.add(" The possible keywords are :");
for (String type : new LanguageDescriptor().getKeyword()) {
diagram.add("* " + type);
}
return CommandExecutionResult.ok();
}
}

View File

@ -0,0 +1,74 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.help;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.syntax.LanguageDescriptor;
public class CommandHelpSkinparam extends SingleLineCommand2<Help> {
public CommandHelpSkinparam() {
super(getRegexConcat());
}
static RegexConcat getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), //
new RegexLeaf("help"), //
new RegexLeaf("[%s]+"), //
new RegexLeaf("skinparams?"), //
new RegexLeaf("$"));
}
@Override
protected CommandExecutionResult executeArg(Help diagram, RegexResult arg) {
diagram.add("<b>Help on skinparam");
diagram.add(" ");
diagram.add("The code of this command is located in <i>net.sourceforge.plantuml.help</i> package.");
diagram.add("You may improve it on <i>https://github.com/plantuml/plantuml/tree/master/src/net/sourceforge/plantuml/help</i>");
diagram.add(" ");
diagram.add(" The possible skinparam are :");
for (String type : SkinParam.getPossibleValues()) {
diagram.add("* " + type);
}
return CommandExecutionResult.ok();
}
}

View File

@ -0,0 +1,73 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.help;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.syntax.LanguageDescriptor;
public class CommandHelpType extends SingleLineCommand2<Help> {
public CommandHelpType() {
super(getRegexConcat());
}
static RegexConcat getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), //
new RegexLeaf("help"), //
new RegexLeaf("[%s]+"), //
new RegexLeaf("types?"), //
new RegexLeaf("$"));
}
@Override
protected CommandExecutionResult executeArg(Help diagram, RegexResult arg) {
diagram.add("<b>Help on types");
diagram.add(" ");
diagram.add("The code of this command is located in <i>net.sourceforge.plantuml.help</i> package.");
diagram.add("You may improve it on <i>https://github.com/plantuml/plantuml/tree/master/src/net/sourceforge/plantuml/help</i>");
diagram.add(" ");
diagram.add(" The possible types are :");
for (String type : new LanguageDescriptor().getType()) {
diagram.add("* " + type);
}
return CommandExecutionResult.ok();
}
}

View File

@ -0,0 +1,92 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*/
package net.sourceforge.plantuml.help;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.creole.CreoleParser;
import net.sourceforge.plantuml.creole.Sheet;
import net.sourceforge.plantuml.creole.SheetBlock1;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity;
import net.sourceforge.plantuml.ugraphic.ImageBuilder;
import net.sourceforge.plantuml.ugraphic.UFont;
public class Help extends UmlDiagram {
private final List<CharSequence> lines = new ArrayList<CharSequence>();
public DiagramDescription getDescription() {
return new DiagramDescription("(Help)");
}
@Override
public UmlDiagramType getUmlDiagramType() {
return UmlDiagramType.HELP;
}
@Override
protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormat)
throws IOException {
final Display display = Display.create(lines);
final UFont font = UFont.serif(16);
final FontConfiguration fontConfiguration = FontConfiguration.blackBlueTrue(font);
final Sheet sheet = new CreoleParser(fontConfiguration, HorizontalAlignment.LEFT, getSkinParam(),
CreoleMode.FULL).createSheet(display);
final SheetBlock1 sheetBlock = new SheetBlock1(sheet, LineBreakStrategy.NONE, 0);
final ImageBuilder builder = new ImageBuilder(new ColorMapperIdentity(), 1.0, null, null, null, 0, 0, null,
false);
builder.setUDrawable(sheetBlock);
return builder.writeImageTOBEMOVED(fileFormat, 0, os);
}
public void add(CharSequence line) {
this.lines.add(line);
}
}

View File

@ -33,27 +33,34 @@
*
*
*/
package net.sourceforge.plantuml.printskin;
package net.sourceforge.plantuml.help;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
import net.sourceforge.plantuml.AbstractPSystem;
import net.sourceforge.plantuml.command.PSystemSingleLineFactory;
import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.command.regex.MyPattern;
import net.sourceforge.plantuml.command.regex.Pattern2;
import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.UmlDiagramFactory;
public class PrintSkinFactory extends PSystemSingleLineFactory {
static final Pattern2 p = MyPattern.cmpile("(?i)^testskin[%s]+([\\w.]+)[%s]*(.*)$");
public class HelpFactory extends UmlDiagramFactory {
@Override
protected AbstractPSystem executeLine(String line) {
final Matcher2 m = p.matcher(line);
if (m.find() == false) {
return null;
public Help createEmptyDiagram() {
return new Help();
}
return new PrintSkin(m.group(1), Arrays.asList(m.group(2)));
@Override
protected List<Command> createCommands() {
final List<Command> cmds = new ArrayList<Command>();
cmds.add(new CommandHelp());
cmds.add(new CommandHelpColor());
cmds.add(new CommandHelpFont());
cmds.add(new CommandHelpKeyword());
cmds.add(new CommandHelpSkinparam());
cmds.add(new CommandHelpType());
return cmds;
}
}

View File

@ -42,11 +42,10 @@ import static gen.lib.cgraph.node__c.agnode;
import static gen.lib.cgraph.subg__c.agsubg;
import static gen.lib.gvc.gvc__c.gvContext;
import static gen.lib.gvc.gvlayout__c.gvLayoutJobs;
import h.ST_Agraph_s;
import h.ST_Agraphinfo_t;
import h.ST_Agedge_s;
import h.ST_Agnode_s;
import h.ST_Agnodeinfo_t;
import h.ST_Agraph_s;
import h.ST_Agraphinfo_t;
import h.ST_GVC_s;
import h.ST_boxf;
@ -108,7 +107,6 @@ import net.sourceforge.plantuml.ugraphic.ImageBuilder;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.sprite.Sprite;
import smetana.core.CString;
import smetana.core.JUtils;
import smetana.core.JUtilsDebug;
@ -154,7 +152,8 @@ public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker {
for (Map.Entry<Link, ST_Agedge_s> ent : edges.entrySet()) {
final Link link = ent.getKey();
final ST_Agedge_s edge = ent.getValue();
new JDotPath(link, edge, ymirror, diagram, getLabel(link), getQualifier(link, 1), getQualifier(link, 2)).drawU(ug);
new JDotPath(link, edge, ymirror, diagram, getLabel(link), getQualifier(link, 1), getQualifier(link, 2))
.drawU(ug);
}
}
@ -333,11 +332,9 @@ public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker {
if (stereotype == null) {
return TextBlockUtils.empty(0, 0);
}
if (stereotype.getSprite() != null) {
final Sprite tmp = diagram.getSkinParam().getSprite(stereotype.getSprite());
final TextBlock tmp = stereotype.getSprite(diagram.getSkinParam());
if (tmp != null) {
return tmp.asTextBlock(stereotype.getHtmlColor(), 1);
}
return tmp;
}
final List<String> stereos = stereotype.getLabels(diagram.getSkinParam().useGuillemet());
if (stereos == null) {

View File

@ -0,0 +1,67 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.mindmap;
import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
public class CommandMindMapLeft extends SingleLineCommand2<MindMapDiagram> {
public CommandMindMapLeft() {
super(getRegexConcat());
}
static RegexConcat getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), //
new RegexLeaf("TYPE", "([*][<]*)"), //
new RegexLeaf("SHAPE", "(_)?"), //
new RegexLeaf("[%s]+"), //
new RegexLeaf("LABEL", "([^%s].*)"), //
new RegexLeaf("$"));
}
@Override
protected CommandExecutionResult executeArg(MindMapDiagram diagram, RegexResult arg) {
final String type = arg.get("TYPE", 0);
final String label = arg.get("LABEL", 0);
return diagram.addIdea(type.length() - 1, label, IdeaShape.fromDesc(arg.get("SHAPE", 0)), Direction.LEFT);
}
}

View File

@ -0,0 +1,67 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.mindmap;
import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
public class CommandMindMapLeftNumber extends SingleLineCommand2<MindMapDiagram> {
public CommandMindMapLeftNumber() {
super(getRegexConcat());
}
static RegexConcat getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), //
new RegexLeaf("TYPE", "([1-9][0-9]?)[<]"), //
new RegexLeaf("SHAPE", "(_)?"), //
new RegexLeaf("[%s]+"), //
new RegexLeaf("LABEL", "([^%s].*)"), //
new RegexLeaf("$"));
}
@Override
protected CommandExecutionResult executeArg(MindMapDiagram diagram, RegexResult arg) {
final String label = arg.get("LABEL", 0);
return diagram.addIdea(Integer.parseInt(arg.get("TYPE", 0)), label, IdeaShape.fromDesc(arg.get("SHAPE", 0)),
Direction.LEFT);
}
}

View File

@ -0,0 +1,67 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.mindmap;
import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
public class CommandMindMapOrgmode extends SingleLineCommand2<MindMapDiagram> {
public CommandMindMapOrgmode() {
super(false, getRegexConcat());
}
static RegexConcat getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), //
new RegexLeaf("TYPE", "([*]+)"), //
new RegexLeaf("SHAPE", "(_)?"), //
new RegexLeaf("[%s]+"), //
new RegexLeaf("LABEL", "([^%s].*)"), //
new RegexLeaf("$"));
}
@Override
protected CommandExecutionResult executeArg(MindMapDiagram diagram, RegexResult arg) {
final String type = arg.get("TYPE", 0);
final String label = arg.get("LABEL", 0);
return diagram.addIdea(type.length() - 1, label, IdeaShape.fromDesc(arg.get("SHAPE", 0)), Direction.RIGHT);
}
}

View File

@ -0,0 +1,67 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.mindmap;
import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
public class CommandMindMapRight extends SingleLineCommand2<MindMapDiagram> {
public CommandMindMapRight() {
super(getRegexConcat());
}
static RegexConcat getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), //
new RegexLeaf("TYPE", "([*][>]*)"), //
new RegexLeaf("SHAPE", "(_)?"), //
new RegexLeaf("[%s]+"), //
new RegexLeaf("LABEL", "([^%s].*)"), //
new RegexLeaf("$"));
}
@Override
protected CommandExecutionResult executeArg(MindMapDiagram diagram, RegexResult arg) {
final String type = arg.get("TYPE", 0);
final String label = arg.get("LABEL", 0);
return diagram.addIdea(type.length() - 1, label, IdeaShape.fromDesc(arg.get("SHAPE", 0)), Direction.RIGHT);
}
}

View File

@ -0,0 +1,67 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.mindmap;
import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
public class CommandMindMapRightNumber extends SingleLineCommand2<MindMapDiagram> {
public CommandMindMapRightNumber() {
super(getRegexConcat());
}
static RegexConcat getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), //
new RegexLeaf("TYPE", "([1-9][0-9]?)[>]"), //
new RegexLeaf("SHAPE", "(_)?"), //
new RegexLeaf("[%s]+"), //
new RegexLeaf("LABEL", "([^%s].*)"), //
new RegexLeaf("$"));
}
@Override
protected CommandExecutionResult executeArg(MindMapDiagram diagram, RegexResult arg) {
final String label = arg.get("LABEL", 0);
return diagram.addIdea(Integer.parseInt(arg.get("TYPE", 0)), label, IdeaShape.fromDesc(arg.get("SHAPE", 0)),
Direction.RIGHT);
}
}

View File

@ -0,0 +1,64 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.mindmap;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
public class CommandMindMapRoot extends SingleLineCommand2<MindMapDiagram> {
public CommandMindMapRoot() {
super(getRegexConcat());
}
static RegexConcat getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), //
new RegexLeaf("TYPE", "(0)"), //
new RegexLeaf("[%s]+"), //
new RegexLeaf("LABEL", "([^%s].*)"), //
new RegexLeaf("$"));
}
@Override
protected CommandExecutionResult executeArg(MindMapDiagram diagram, RegexResult arg) {
final String label = arg.get("LABEL", 0);
return diagram.addIdea(0, label, IdeaShape.BOX, null);
}
}

View File

@ -0,0 +1,69 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.mindmap;
import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.command.BlocLines;
import net.sourceforge.plantuml.command.CommandControl;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
public class CommandMindMapTabulation extends SingleLineCommand2<MindMapDiagram> {
public CommandMindMapTabulation() {
super(false, getRegexConcat());
}
static RegexConcat getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), //
new RegexLeaf("TYPE", "([ \t]*[*])"), //
new RegexLeaf("SHAPE", "(_)?"), //
new RegexLeaf("[%s]+"), //
new RegexLeaf("LABEL", "([^%s].*)"), //
new RegexLeaf("$"));
}
@Override
protected CommandExecutionResult executeArg(MindMapDiagram diagram, RegexResult arg) {
final String type = arg.get("TYPE", 0);
final String label = arg.get("LABEL", 0);
return diagram.addIdea(type.length() - 1, label, IdeaShape.fromDesc(arg.get("SHAPE", 0)), Direction.RIGHT);
}
}

View File

@ -0,0 +1,57 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.mindmap;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.UDrawable;
public interface Finger extends UDrawable {
public double getPhalanxThickness(StringBounder stringBounder);
public double getNailThickness(StringBounder stringBounder);
public double getFullThickness(StringBounder stringBounder);
public double getPhalanxElongation(StringBounder stringBounder);
public double getNailElongation(StringBounder stringBounder);
public double getFullElongation(StringBounder stringBounder);
public void doNotDrawFirstPhalanx();
}

View File

@ -0,0 +1,187 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.mindmap;
import java.awt.geom.Dimension2D;
import java.awt.geom.Point2D;
import java.util.ArrayList;
import java.util.List;
import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle;
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileBox;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.UDrawable;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UPath;
import net.sourceforge.plantuml.ugraphic.UTranslate;
public class FingerImpl implements Finger, UDrawable {
private final Display label;
private final ISkinParam skinParam;
private final IdeaShape shape;
private final Direction direction;
private boolean drawPhalanx = true;
private final List<FingerImpl> nail = new ArrayList<FingerImpl>();
public static FingerImpl build(Idea idea, ISkinParam skinParam, Direction direction) {
final FingerImpl result = new FingerImpl(idea.getLabel(), skinParam, idea.getShape(), direction);
for (Idea child : idea.getChildren()) {
result.addInNail(build(child, skinParam, direction));
}
return result;
}
public void addInNail(FingerImpl child) {
nail.add(child);
}
private FingerImpl(Display label, ISkinParam skinParam, IdeaShape shape, Direction direction) {
this.label = label;
this.skinParam = skinParam;
this.shape = shape;
this.direction = direction;
}
public double getPhalanxThickness(StringBounder stringBounder) {
return getPhalanx().calculateDimension(stringBounder).getHeight();
}
public double getPhalanxElongation(StringBounder stringBounder) {
return getPhalanx().calculateDimension(stringBounder).getWidth();
}
public double getNailThickness(StringBounder stringBounder) {
double result = 0;
for (FingerImpl child : nail) {
result += child.getFullThickness(stringBounder);
}
return result;
}
public double getNailElongation(StringBounder stringBounder) {
double result = 0;
for (FingerImpl child : nail) {
result = Math.max(result, child.getFullElongation(stringBounder));
}
return result;
}
public double getFullElongation(StringBounder stringBounder) {
return getPhalanxElongation(stringBounder) + marginX1 + getNailElongation(stringBounder);
}
public double getFullThickness(StringBounder stringBounder) {
return Math.max(getPhalanxThickness(stringBounder), getNailThickness(stringBounder));
}
public void doNotDrawFirstPhalanx() {
this.drawPhalanx = false;
}
public void drawU(final UGraphic ug) {
final StringBounder stringBounder = ug.getStringBounder();
final TextBlock phalanx = getPhalanx();
final Dimension2D dimPhalanx = phalanx.calculateDimension(stringBounder);
if (drawPhalanx) {
final double posY = -getPhalanxThickness(stringBounder) / 2;
final double posX = direction == Direction.RIGHT ? 0 : -dimPhalanx.getWidth();
phalanx.drawU(ug.apply(new UTranslate(posX, posY)));
}
final Point2D p1 = new Point2D.Double(direction == Direction.RIGHT ? dimPhalanx.getWidth()
: -dimPhalanx.getWidth(), 0);
double y = -getFullThickness(stringBounder) / 2;
for (FingerImpl child : nail) {
final double childThickness = child.getFullThickness(stringBounder);
final double x = direction == Direction.RIGHT ? dimPhalanx.getWidth() + marginX1 : -dimPhalanx.getWidth()
- marginX1;
child.drawU(ug.apply(new UTranslate(x, y + childThickness / 2)));
final Point2D p2 = new Point2D.Double(x, y + childThickness / 2);
drawLine(ug.apply(new UChangeColor(getLinkColor())), p1, p2);
y += childThickness;
}
}
private HtmlColor getLinkColor() {
// return skinParam.getColors(ColorParam.activityBorder, null).getColor(ColorType.ARROW);
return ColorParam.activityBorder.getDefaultValue();
// return HtmlColorUtils.BLACK;
}
final private double marginX1 = 50;
private void drawLine(UGraphic ug, Point2D p1, Point2D p2) {
// final ULine line = new ULine(p1, p2);
// ug.apply(new UTranslate(p1)).draw(line);
final UPath path = new UPath();
final double delta1 = direction == Direction.RIGHT ? 10 : -10;
final double delta2 = direction == Direction.RIGHT ? 25 : -25;
path.moveTo(p1);
path.lineTo(p1.getX() + delta1, p1.getY());
path.cubicTo(p1.getX() + delta2, p1.getY(), p2.getX() - delta2, p2.getY(), p2.getX() - delta1, p2.getY());
path.lineTo(p2);
ug.draw(path);
}
private TextBlock getPhalanx() {
if (drawPhalanx == false) {
return TextBlockUtils.empty(0, 0);
}
final UFont font = skinParam.getFont(null, false, FontParam.ACTIVITY);
if (shape == IdeaShape.BOX) {
final FtileBox box = new FtileBox(Colors.empty().mute(skinParam), label, font, null, BoxStyle.PLAIN);
return TextBlockUtils.withMargin(box, 0, 10);
}
return TextBlockUtils.withMargin(
label.create(FontConfiguration.blackBlueTrue(font), HorizontalAlignment.LEFT, skinParam), 5, 5);
}
}

View File

@ -0,0 +1,215 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.mindmap;
import java.awt.geom.Dimension2D;
import java.awt.geom.Point2D;
import java.util.ArrayList;
import java.util.List;
import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle;
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileBox;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.UDrawable;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UPath;
import net.sourceforge.plantuml.ugraphic.UTranslate;
public class FingerImpl2 implements Finger, UDrawable {
// private final double xmargin = 50;
private final Display label;
private final ISkinParam skinParam;
private final IdeaShape shape;
private final Direction direction;
private boolean drawPhalanx = true;
private final List<FingerImpl2> nail = new ArrayList<FingerImpl2>();
private Tetris tetris = null;
public static FingerImpl2 build(Idea idea, ISkinParam skinParam, Direction direction) {
final FingerImpl2 result = new FingerImpl2(idea.getLabel(), skinParam, idea.getShape(), direction);
for (Idea child : idea.getChildren()) {
result.addInNail(build(child, skinParam, direction));
}
return result;
}
public void addInNail(FingerImpl2 child) {
nail.add(child);
}
private FingerImpl2(Display label, ISkinParam skinParam, IdeaShape shape, Direction direction) {
this.label = label;
this.skinParam = skinParam;
this.shape = shape;
this.direction = direction;
}
public void drawU(final UGraphic ug) {
final StringBounder stringBounder = ug.getStringBounder();
final TextBlock phalanx = getPhalanx();
final Dimension2D dimPhalanx = phalanx.calculateDimension(stringBounder);
if (drawPhalanx) {
final double posY = -getPhalanxThickness(stringBounder) / 2;
final double posX = direction == Direction.RIGHT ? 0 : -dimPhalanx.getWidth();
phalanx.drawU(ug.apply(new UTranslate(posX, posY)));
}
final Point2D p1 = new Point2D.Double(direction == Direction.RIGHT ? dimPhalanx.getWidth()
: -dimPhalanx.getWidth(), 0);
for (int i = 0; i < nail.size(); i++) {
final FingerImpl2 child = nail.get(i);
final SymetricalTeePositioned stp = tetris(stringBounder).getElements().get(i);
final double x = direction == Direction.RIGHT ? dimPhalanx.getWidth() + getX12() : -dimPhalanx.getWidth()
- getX12();
final Point2D p2 = new Point2D.Double(x, stp.getY());
child.drawU(ug.apply(new UTranslate(p2)));
drawLine(ug.apply(new UChangeColor(getLinkColor())), p1, p2);
}
}
private HtmlColor getLinkColor() {
return ColorParam.activityBorder.getDefaultValue();
}
private void drawLine(UGraphic ug, Point2D p1, Point2D p2) {
// final ULine line = new ULine(p1, p2);
// ug.apply(new UTranslate(p1)).draw(line);
final UPath path = new UPath();
final double delta1 = direction == Direction.RIGHT ? 10 : -10;
final double delta2 = direction == Direction.RIGHT ? 25 : -25;
path.moveTo(p1);
path.lineTo(p1.getX() + delta1, p1.getY());
path.cubicTo(p1.getX() + delta2, p1.getY(), p2.getX() - delta2, p2.getY(), p2.getX() - delta1, p2.getY());
path.lineTo(p2);
ug.draw(path);
}
private Tetris tetris(StringBounder stringBounder) {
if (tetris == null) {
tetris = new Tetris();
for (FingerImpl2 child : nail) {
tetris.add(child.asSymetricalTee(stringBounder));
}
tetris.balance();
}
return tetris;
}
private SymetricalTee asSymetricalTee(StringBounder stringBounder) {
final double thickness1 = getPhalanxThickness(stringBounder);
final double elongation1 = getPhalanxElongation(stringBounder);
if (nail.size() == 0) {
return new SymetricalTee(thickness1, elongation1, 0, 0);
}
final double thickness2 = getNailThickness(stringBounder);
final double elongation2 = getNailElongation(stringBounder);
return new SymetricalTee(thickness1, elongation1 + getX1(), thickness2, getX2() + elongation2);
}
private double getX1() {
return 10;
}
private double getX2() {
return 40;
}
public double getX12() {
return getX1() + getX2();
}
public double getPhalanxThickness(StringBounder stringBounder) {
return getPhalanx().calculateDimension(stringBounder).getHeight();
}
public double getPhalanxElongation(StringBounder stringBounder) {
return getPhalanx().calculateDimension(stringBounder).getWidth();
}
private TextBlock getPhalanx() {
if (drawPhalanx == false) {
return TextBlockUtils.empty(0, 0);
}
final UFont font = skinParam.getFont(null, false, FontParam.ACTIVITY);
if (shape == IdeaShape.BOX) {
final FtileBox box = new FtileBox(Colors.empty().mute(skinParam), label, font, null, BoxStyle.PLAIN);
return TextBlockUtils.withMargin(box, 0, 0, 10, 10);
}
final TextBlock text = label.create(FontConfiguration.blackBlueTrue(font), HorizontalAlignment.LEFT, skinParam);
if (direction == Direction.RIGHT) {
return TextBlockUtils.withMargin(text, 3, 0, 1, 1);
}
return TextBlockUtils.withMargin(text, 0, 3, 1, 1);
}
public double getNailThickness(StringBounder stringBounder) {
return tetris(stringBounder).getHeight();
}
public double getNailElongation(StringBounder stringBounder) {
return tetris(stringBounder).getWidth();
}
public double getFullThickness(StringBounder stringBounder) {
return Math.max(getPhalanxThickness(stringBounder), getNailThickness(stringBounder));
}
public double getFullElongation(StringBounder stringBounder) {
return getPhalanxElongation(stringBounder) + getNailElongation(stringBounder);
}
public void doNotDrawFirstPhalanx() {
this.drawPhalanx = false;
}
}

View File

@ -0,0 +1,87 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.mindmap;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import net.sourceforge.plantuml.cucadiagram.Display;
public class Idea {
private final Display label;
private final int level;
private final Idea parent;
private final List<Idea> children = new ArrayList<Idea>();
private final IdeaShape shape;
public Idea(int level, Idea parent, Display label, IdeaShape shape) {
this.label = label;
this.level = level;
this.parent = parent;
this.shape = shape;
if (parent != null) {
this.parent.children.add(this);
}
}
public final int getLevel() {
return level;
}
public final Display getLabel() {
return label;
}
public Collection<Idea> getChildren() {
return Collections.unmodifiableList(children);
}
public boolean hasChildren() {
return children.size() > 0;
}
public Idea getParent() {
return parent;
}
public final IdeaShape getShape() {
return shape;
}
}

View File

@ -33,15 +33,15 @@
*
*
*/
package net.sourceforge.plantuml.skin;
package net.sourceforge.plantuml.mindmap;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.cucadiagram.Display;
public interface Skin {
Object getProtocolVersion();
Component createComponent(ComponentType type, ArrowConfiguration config, ISkinParam param, Display stringsToDisplay);
public enum IdeaShape {
BOX, NONE;
public static IdeaShape fromDesc(String s) {
if ("_".equals(s)) {
return NONE;
}
return BOX;
}
}

View File

@ -0,0 +1,216 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.mindmap;
import java.awt.geom.Dimension2D;
import java.awt.geom.Rectangle2D;
import java.io.IOException;
import java.io.OutputStream;
import net.sourceforge.plantuml.AnnotatedWorker;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.Scale;
import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.InnerStrategy;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.svek.TextBlockBackcolored;
import net.sourceforge.plantuml.ugraphic.ImageBuilder;
import net.sourceforge.plantuml.ugraphic.MinMax;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
public class MindMapDiagram extends UmlDiagram {
public DiagramDescription getDescription() {
return new DiagramDescription("MindMap");
}
@Override
public UmlDiagramType getUmlDiagramType() {
return UmlDiagramType.MINDMAP;
}
@Override
protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption)
throws IOException {
final Scale scale = getScale();
final double dpiFactor = scale == null ? 1 : scale.getScale(100, 100);
final ISkinParam skinParam = getSkinParam();
final ImageBuilder imageBuilder = new ImageBuilder(skinParam.getColorMapper(), dpiFactor,
skinParam.getBackgroundColor(), "", "", 10, 10, null, skinParam.handwritten());
TextBlock result = getTextBlock();
result = new AnnotatedWorker(this, skinParam, fileFormatOption.getDefaultStringBounder()).addAdd(result);
imageBuilder.setUDrawable(result);
return imageBuilder.writeImageTOBEMOVED(fileFormatOption, seed(), os);
}
private TextBlockBackcolored getTextBlock() {
return new TextBlockBackcolored() {
public void drawU(UGraphic ug) {
drawMe(ug);
}
public Rectangle2D getInnerPosition(String member, StringBounder stringBounder, InnerStrategy strategy) {
return null;
}
public Dimension2D calculateDimension(StringBounder stringBounder) {
computeFinger();
final double y1 = right.finger == null ? 0 : right.finger.getFullThickness(stringBounder) / 2;
final double y2 = left.finger == null ? 0 : left.finger.getFullThickness(stringBounder) / 2;
final double y = Math.max(y1, y2);
final double x = left.finger == null ? 0 : left.finger.getFullElongation(stringBounder);
final double width = right.finger == null ? x : x + right.finger.getFullElongation(stringBounder);
final double height = y
+ Math.max(left.finger == null ? 0 : left.finger.getFullThickness(stringBounder) / 2,
right.finger == null ? 0 : right.finger.getFullThickness(stringBounder) / 2);
return new Dimension2DDouble(width, height);
}
public MinMax getMinMax(StringBounder stringBounder) {
throw new UnsupportedOperationException();
}
public HtmlColor getBackcolor() {
return null;
}
};
}
private void drawMe(UGraphic ug) {
computeFinger();
final StringBounder stringBounder = ug.getStringBounder();
final double y1 = right.finger == null ? 0 : right.finger.getFullThickness(stringBounder) / 2;
final double y2 = left.finger == null ? 0 : left.finger.getFullThickness(stringBounder) / 2;
final double y = Math.max(y1, y2);
final double x = left.finger == null ? 0 : left.finger.getFullElongation(stringBounder)
+ ((FingerImpl2) left.finger).getX12();
if (right.finger != null) {
right.finger.drawU(ug.apply(new UTranslate(x, y)));
}
if (left.finger != null) {
left.finger.drawU(ug.apply(new UTranslate(x, y)));
}
}
private void computeFinger() {
if (left.finger == null && right.finger == null) {
if (left.root.hasChildren()) {
left.finger = FingerImpl2.build(left.root, getSkinParam(), Direction.LEFT);
}
if (left.finger == null || right.root.hasChildren()) {
right.finger = FingerImpl2.build(right.root, getSkinParam(), Direction.RIGHT);
}
if (left.finger != null && right.finger != null) {
left.finger.doNotDrawFirstPhalanx();
}
}
}
private Branch left = new Branch();
private Branch right = new Branch();
public CommandExecutionResult addIdea(int level, String label, IdeaShape shape, Direction direction) {
if (level == 0) {
if (this.right.root != null) {
return CommandExecutionResult
.error("I don't know how to draw multi-root diagram. You should suggest an image so that the PlantUML team implements it :-)");
}
right.initRoot(label, shape);
left.initRoot(label, shape);
return CommandExecutionResult.ok();
}
if (direction == Direction.LEFT) {
return left.add(level, label, shape);
}
return right.add(level, label, shape);
}
static class Branch {
private Idea root;
private Idea last;
private Finger finger;
private void initRoot(String label, IdeaShape shape) {
root = new Idea(0, null, Display.getWithNewlines(label), shape);
last = root;
}
private Idea getParentOfLast(int nb) {
Idea result = last;
for (int i = 0; i < nb; i++) {
result = result.getParent();
}
return result;
}
private CommandExecutionResult add(int level, String label, IdeaShape shape) {
if (level == last.getLevel() + 1) {
final Idea newIdea = new Idea(level, last, Display.getWithNewlines(label), shape);
last = newIdea;
return CommandExecutionResult.ok();
}
if (level <= last.getLevel()) {
final int diff = last.getLevel() - level + 1;
final Idea newIdea = new Idea(level, getParentOfLast(diff), Display.getWithNewlines(label), shape);
last = newIdea;
return CommandExecutionResult.ok();
}
return CommandExecutionResult.error("error42L");
}
}
}

View File

@ -0,0 +1,72 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.mindmap;
import java.util.ArrayList;
import java.util.List;
import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.UmlDiagramFactory;
import net.sourceforge.plantuml.core.DiagramType;
public class MindMapDiagramFactory extends UmlDiagramFactory {
public MindMapDiagramFactory() {
super(DiagramType.MINDMAP);
}
@Override
protected List<Command> createCommands() {
final List<Command> cmds = new ArrayList<Command>();
addCommonCommands(cmds);
cmds.add(new CommandMindMapTabulation());
cmds.add(new CommandMindMapOrgmode());
cmds.add(new CommandMindMapRoot());
cmds.add(new CommandMindMapRight());
cmds.add(new CommandMindMapRightNumber());
cmds.add(new CommandMindMapLeft());
cmds.add(new CommandMindMapLeftNumber());
return cmds;
}
@Override
public MindMapDiagram createEmptyDiagram() {
return new MindMapDiagram();
}
}

View File

@ -0,0 +1,80 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.mindmap;
public class Stripe implements Comparable<Stripe> {
private final double x1;
private final double x2;
private final double value;
@Override
public String toString() {
return "" + (int) x1 + "->" + (int) x2 + " (" + (int) value + ")";
}
public Stripe(double x1, double x2, double value) {
if (x2 <= x1) {
System.err.println("x1=" + x1);
System.err.println("x2=" + x2);
throw new IllegalArgumentException();
}
this.x1 = x1;
this.x2 = x2;
this.value = value;
}
public boolean contains(double x) {
return x >= x1 && x <= x2;
}
public int compareTo(Stripe other) {
return (int) Math.signum(this.x1 - other.x1);
}
public double getValue() {
return value;
}
public final double getStart() {
return x1;
}
public final double getEnd() {
return x2;
}
}

View File

@ -0,0 +1,153 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.mindmap;
import java.util.Iterator;
import java.util.SortedSet;
import java.util.TreeSet;
public class StripeFrontier {
private final SortedSet<Stripe> stripes = new TreeSet<Stripe>();
public StripeFrontier() {
this.stripes.add(new Stripe(-Double.MAX_VALUE, Double.MAX_VALUE, -Double.MAX_VALUE));
}
public boolean isEmpty() {
return stripes.size() == 1;
}
@Override
public String toString() {
return stripes.toString();
}
public boolean contains(double x, double y) {
for (Stripe stripe : stripes) {
if (stripe.contains(x)) {
return y <= stripe.getValue();
}
}
throw new UnsupportedOperationException();
}
public double getContact(double x1, double x2) {
final SortedSet<Stripe> collisions = collisionning(x1, x2);
double result = -Double.MAX_VALUE;
for (Stripe strip : collisions) {
result = Math.max(result, strip.getValue());
}
return result;
}
public void addSegment(double x1, double x2, double value) {
if (x2 <= x1) {
System.err.println("x1=" + x1);
System.err.println("x2=" + x2);
throw new IllegalArgumentException();
}
final SortedSet<Stripe> collisions = collisionning(x1, x2);
if (collisions.size() > 1) {
final Iterator<Stripe> it = collisions.iterator();
it.next();
double x = x1;
while (it.hasNext()) {
final Stripe tmp = it.next();
addSegment(x, tmp.getStart(), value);
x = tmp.getStart();
}
addSegment(x, x2, value);
// System.err.println("x1=" + x1);
// System.err.println("x2=" + x2);
// System.err.println("All=" + stripes);
// System.err.println("collisions" + collisions);
// throw new UnsupportedOperationException();
} else {
final Stripe touch = collisions.iterator().next();
addSingleInternal(x1, x2, value, touch);
}
}
private void addSingleInternal(double x1, double x2, double value, final Stripe touch) {
if (value <= touch.getValue()) {
return;
}
final boolean ok = this.stripes.remove(touch);
assert ok;
if (touch.getStart() != x1) {
this.stripes.add(new Stripe(touch.getStart(), x1, touch.getValue()));
}
this.stripes.add(new Stripe(x1, x2, value));
if (x2 != touch.getEnd()) {
this.stripes.add(new Stripe(x2, touch.getEnd(), touch.getValue()));
}
assert checkConsistent();
}
private boolean checkConsistent() {
Stripe last = null;
for (Stripe stripe : stripes) {
if (last == null && stripe.getStart() != -Double.MAX_VALUE) {
return false;
}
if (last != null && last.getEnd() != stripe.getStart()) {
return false;
}
last = stripe;
}
if (last.getEnd() != Double.MAX_VALUE) {
return false;
}
return true;
}
private SortedSet<Stripe> collisionning(double x1, double x2) {
final SortedSet<Stripe> result = new TreeSet<Stripe>();
for (Iterator<Stripe> it = stripes.iterator(); it.hasNext();) {
Stripe stripe = it.next();
if (x1 >= stripe.getEnd()) {
continue;
}
result.add(stripe);
if (x2 <= stripe.getEnd()) {
return result;
}
}
throw new UnsupportedOperationException();
}
}

View File

@ -0,0 +1,76 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.mindmap;
public class SymetricalTee {
private final double thickness1;
private final double elongation1;
private final double thickness2;
private final double elongation2;
public SymetricalTee(double thickness1, double elongation1, double thickness2, double elongation2) {
this.thickness1 = thickness1;
this.elongation1 = elongation1;
this.thickness2 = thickness2;
this.elongation2 = elongation2;
}
public double getThickness1() {
return thickness1;
}
public double getElongation1() {
return elongation1;
}
public double getThickness2() {
return thickness2;
}
public double getElongation2() {
return elongation2;
}
public double getFullElongation() {
return elongation1 + elongation2;
}
public double getFullThickness() {
return Math.max(thickness1, thickness2);
}
}

View File

@ -0,0 +1,112 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.mindmap;
import java.awt.geom.Line2D;
public class SymetricalTeePositioned {
private final SymetricalTee tee;
private double y;
public SymetricalTeePositioned(SymetricalTee tee) {
this(tee, 0);
}
private SymetricalTeePositioned(SymetricalTee tee, double y) {
this.tee = tee;
this.y = y;
}
public void moveSoThatSegmentA1isOn(double newY) {
final double current = getSegmentA1().getY1();
y += newY - current;
}
public void moveSoThatSegmentA2isOn(double newY) {
final double current = getSegmentA2().getY1();
y += newY - current;
}
public void move(double delta) {
y += delta;
}
public Line2D getSegmentA1() {
return new Line2D.Double(0, y - tee.getThickness1() / 2, tee.getElongation1(), y - tee.getThickness1() / 2);
}
public Line2D getSegmentB1() {
return new Line2D.Double(0, y + tee.getThickness1() / 2, tee.getElongation1(), y + tee.getThickness1() / 2);
}
public Line2D getSegmentA2() {
return new Line2D.Double(tee.getElongation1(), y - tee.getThickness2() / 2, tee.getElongation1()
+ tee.getElongation2(), y - tee.getThickness2() / 2);
}
public Line2D getSegmentB2() {
return new Line2D.Double(tee.getElongation1(), y + tee.getThickness2() / 2, tee.getElongation1()
+ tee.getElongation2(), y + tee.getThickness2() / 2);
}
public double getMaxX() {
return tee.getElongation1() + tee.getElongation2();
}
public double getMaxY() {
return y + Math.max(tee.getThickness1() / 2, tee.getThickness2() / 2);
}
public double getMinY() {
return y - Math.max(tee.getThickness1() / 2, tee.getThickness2() / 2);
}
public final double getY() {
return y;
}
public SymetricalTeePositioned getMax(SymetricalTeePositioned other) {
if (this.tee != other.tee) {
throw new IllegalArgumentException();
}
if (other.y > this.y) {
return other;
}
return this;
}
}

View File

@ -0,0 +1,125 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.mindmap;
import java.awt.geom.Line2D;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class Tetris {
private final StripeFrontier frontier = new StripeFrontier();
private final List<SymetricalTeePositioned> elements = new ArrayList<SymetricalTeePositioned>();
private double minY = Double.MAX_VALUE;
private double maxY = -Double.MAX_VALUE;
public void balance() {
if (elements.size() == 0) {
return;
}
if (minY != Double.MAX_VALUE) {
throw new IllegalStateException();
}
for (SymetricalTeePositioned element : elements) {
minY = Math.min(minY, element.getMinY());
maxY = Math.max(maxY, element.getMaxY());
}
final double mean = (minY + maxY) / 2;
for (SymetricalTeePositioned stp : elements) {
stp.move(-mean);
}
}
public double getHeight() {
if (elements.size() == 0) {
return 0;
}
return maxY - minY;
}
public double getWidth() {
double result = 0;
for (SymetricalTeePositioned tee : elements) {
result = Math.max(result, tee.getMaxX());
}
return result;
}
public void add(SymetricalTee tee) {
if (frontier.isEmpty()) {
final SymetricalTeePositioned p1 = new SymetricalTeePositioned(tee);
addInternal(p1);
return;
}
final double c1 = frontier.getContact(0, tee.getElongation1());
final double c2 = frontier.getContact(tee.getElongation1(), tee.getElongation2());
// System.err.println("c1=" + c1 + " c2=" + c2);
final SymetricalTeePositioned p1 = new SymetricalTeePositioned(tee);
p1.moveSoThatSegmentA1isOn(c1);
final SymetricalTeePositioned p2 = new SymetricalTeePositioned(tee);
p2.moveSoThatSegmentA2isOn(c2);
final SymetricalTeePositioned result = p1.getMax(p2);
// System.err.println("p1=" + p1.getY() + " p2=" + p2.getY());
// System.err.println("result=" + result.getY());
addInternal(result);
}
private void addInternal(SymetricalTeePositioned result) {
this.elements.add(result);
final Line2D b1 = result.getSegmentB1();
frontier.addSegment(b1.getX1(), b1.getX2(), b1.getY1());
assert b1.getY1() == b1.getY2();
final Line2D b2 = result.getSegmentB2();
if (b2.getX1() != b2.getX2()) {
frontier.addSegment(b2.getX1(), b2.getX2(), b2.getY1());
}
assert b2.getY1() == b2.getY2();
}
public List<SymetricalTeePositioned> getElements() {
return Collections.unmodifiableList(elements);
}
}

View File

@ -1,171 +0,0 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.printskin;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.OutputStream;
import java.util.List;
import net.sourceforge.plantuml.AbstractPSystem;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.EmptyImageBuilder;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.SpriteContainerEmpty;
import net.sourceforge.plantuml.api.ImageDataSimple;
import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.png.PngIO;
import net.sourceforge.plantuml.skin.Area;
import net.sourceforge.plantuml.skin.ArrowConfiguration;
import net.sourceforge.plantuml.skin.Component;
import net.sourceforge.plantuml.skin.ComponentType;
import net.sourceforge.plantuml.skin.SimpleContext2D;
import net.sourceforge.plantuml.skin.Skin;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.URectangle;
import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.g2d.UGraphicG2d;
class PrintSkin extends AbstractPSystem {
private static final UFont FONT1 = UFont.sansSerif(10);
final private Skin skin;
final private List<String> toPrint;
private UGraphic ug;
private float xpos = 10;
private float ypos = 0;
private float maxYpos = 0;
// public List<File> createFiles(File suggestedFile, FileFormatOption fileFormat) throws IOException,
// InterruptedException {
// final List<File> result = Arrays.asList(suggestedFile);
// final BufferedImage im = createImage();
//
// PngIO.write(im.getSubimage(0, 0, im.getWidth(), (int) maxYpos), suggestedFile, 96);
// return result;
//
// }
@Override
final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormatOption, long seed)
throws IOException {
final BufferedImage im = createImage();
final ImageData imageData = new ImageDataSimple(im.getWidth(), (int) maxYpos);
PngIO.write(im.getSubimage(0, 0, imageData.getWidth(), imageData.getHeight()), os, 96);
return imageData;
}
private BufferedImage createImage() {
final EmptyImageBuilder builder = new EmptyImageBuilder(2000, 830, Color.WHITE);
final BufferedImage im = builder.getBufferedImage();
final Graphics2D g2d = builder.getGraphics2D();
ug = new UGraphicG2d(new ColorMapperIdentity(), g2d, 1.0);
for (ComponentType type : ComponentType.values()) {
printComponent(type);
ypos += 10;
maxYpos = Math.max(maxYpos, ypos);
if (ypos > 620) {
ypos = 0;
xpos += 200;
}
}
g2d.dispose();
return im;
}
private void printComponent(ComponentType type) {
println(type.name());
final Component comp = skin.createComponent(type, ArrowConfiguration.withDirectionNormal(),
SkinParam.noShadowing(null), Display.create(toPrint));
if (comp == null) {
println("null");
return;
}
double height = comp.getPreferredHeight(ug.getStringBounder());
double width = comp.getPreferredWidth(ug.getStringBounder());
println("height = " + String.format("%4.2f", height));
println("width = " + width);
if (height == 0) {
height = 42;
}
if (width == 0) {
width = 42;
}
ug.apply(new UChangeBackColor(HtmlColorUtils.LIGHT_GRAY)).apply(new UChangeColor(HtmlColorUtils.LIGHT_GRAY))
.apply(new UTranslate((double) (xpos - 1), (double) (ypos - 1)))
.draw(new URectangle(width + 2, height + 2));
comp.drawU(ug.apply(new UTranslate(xpos, ypos)), new Area(new Dimension2DDouble(width, height)),
new SimpleContext2D(false));
ypos += height;
}
private void println(String s) {
final TextBlock textBlock = Display.create(s).create(FontConfiguration.blackBlueTrue(FONT1),
HorizontalAlignment.LEFT, new SpriteContainerEmpty());
textBlock.drawU(ug.apply(new UTranslate(xpos, ypos)));
ypos += textBlock.calculateDimension(ug.getStringBounder()).getHeight();
}
public DiagramDescription getDescription() {
return new DiagramDescription("Printing of " + skin.getClass().getName());
}
public PrintSkin(String className, List<String> toPrint) {
this.skin = new Rose();
this.toPrint = toPrint;
}
}

View File

@ -113,4 +113,12 @@ public class Dictionary implements SpriteContainer, ISkinSimple {
return new ColorMapperIdentity();
}
public void copyAllFrom(ISkinSimple other) {
throw new UnsupportedOperationException();
}
public Map<String, String> values() {
throw new UnsupportedOperationException();
}
}

View File

@ -51,7 +51,7 @@ import net.sourceforge.plantuml.skin.Area;
import net.sourceforge.plantuml.skin.Component;
import net.sourceforge.plantuml.skin.ComponentType;
import net.sourceforge.plantuml.skin.Context2D;
import net.sourceforge.plantuml.skin.Skin;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
@ -65,7 +65,7 @@ public class Englober {
final private boolean isTeoz;
private double marginX = 0;
public static Englober createPuma(ParticipantEnglober englober, Participant first, ISkinParam skinParam, Skin skin,
public static Englober createPuma(ParticipantEnglober englober, Participant first, ISkinParam skinParam, Rose skin,
StringBounder stringBounder) {
return new Englober(englober, first, convertFunctionToBeRemoved(skinParam, skin, stringBounder), false);
}
@ -75,7 +75,7 @@ public class Englober {
return new Englober(participantEnglober, first, tileArguments, true);
}
private static TileArguments convertFunctionToBeRemoved(ISkinParam skinParam, Skin skin, StringBounder stringBounder) {
private static TileArguments convertFunctionToBeRemoved(ISkinParam skinParam, Rose skin, StringBounder stringBounder) {
final TileArguments result = new TileArguments(stringBounder, null, skin, skinParam, null);
return result;
}

View File

@ -35,6 +35,24 @@
*/
package net.sourceforge.plantuml.sequencediagram;
import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorAndStyle;
import net.sourceforge.plantuml.graphic.Rainbow;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.sequencediagram.teoz.YPositionedTile;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.UGraphic;
public class LinkAnchor {
private final String anchor1;
@ -64,4 +82,29 @@ public class LinkAnchor {
return message;
}
public void drawAnchor(UGraphic ug, YPositionedTile tile1, YPositionedTile tile2, ISkinParam param) {
final StringBounder stringBounder = ug.getStringBounder();
final double y1 = tile1.getY(stringBounder);
final double y2 = tile2.getY(stringBounder);
final double xx1 = tile1.getMiddleX(stringBounder);
final double xx2 = tile2.getMiddleX(stringBounder);
final double x = (xx1 + xx2) / 2;
final double ymin = Math.min(y1, y2);
final double ymax = Math.max(y1, y2);
final HtmlColor color = new Rose().getHtmlColor(param, ColorParam.arrow);
final Rainbow rainbow = HtmlColorAndStyle.fromColor(color);
final Snake snake = new Snake(Arrows.asToUp(), HorizontalAlignment.CENTER, rainbow, Arrows.asToDown());
final Display display = Display.getWithNewlines(message);
final TextBlock title = display.create(new FontConfiguration(param, FontParam.ARROW, null),
HorizontalAlignment.CENTER, param);
snake.setLabel(title);
snake.addPoint(x, ymin + 2);
snake.addPoint(x, ymax - 2);
snake.drawInternal(ug);
}
}

View File

@ -51,6 +51,7 @@ import java.util.Stack;
import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.FileFormat;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.Scale;
import net.sourceforge.plantuml.UmlDiagram;
@ -66,20 +67,21 @@ import net.sourceforge.plantuml.sequencediagram.graphic.FileMaker;
import net.sourceforge.plantuml.sequencediagram.graphic.SequenceDiagramFileMakerPuma2;
import net.sourceforge.plantuml.sequencediagram.graphic.SequenceDiagramTxtMaker;
import net.sourceforge.plantuml.sequencediagram.teoz.SequenceDiagramFileMakerTeoz;
import net.sourceforge.plantuml.skin.ProtectedSkin;
import net.sourceforge.plantuml.skin.Skin;
import net.sourceforge.plantuml.skin.rose.Rose;
public class SequenceDiagram extends UmlDiagram {
// private final Map<String, Participant> participants = new LinkedHashMap<String, Participant>();
private final List<Participant> participantsList = new ArrayList<Participant>();
private final List<Event> events = new ArrayList<Event>();
private final Map<Participant, ParticipantEnglober> participantEnglobers2 = new HashMap<Participant, ParticipantEnglober>();
private final Skin skin2 = new ProtectedSkin(new Rose());
private final Rose skin2 = new Rose();
public SequenceDiagram(ISkinSimple skinParam) {
super(skinParam);
}
@Deprecated
public Participant getOrCreateParticipant(String code) {

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.sequencediagram;
import java.util.ArrayList;
import java.util.List;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.UmlDiagramFactory;
import net.sourceforge.plantuml.command.note.sequence.FactorySequenceNoteCommand;
@ -78,9 +79,15 @@ import net.sourceforge.plantuml.sequencediagram.command.CommandUrl;
public class SequenceDiagramFactory extends UmlDiagramFactory {
private final ISkinSimple skinParam;
public SequenceDiagramFactory(ISkinSimple skinParam) {
this.skinParam = skinParam;
}
@Override
public SequenceDiagram createEmptyDiagram() {
return new SequenceDiagram();
return new SequenceDiagram(skinParam);
}
@Override

View File

@ -44,6 +44,9 @@ import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
public class CommandBoxStart extends SingleLineCommand2<SequenceDiagram> {
@ -59,10 +62,15 @@ public class CommandBoxStart extends SingleLineCommand2<SequenceDiagram> {
new RegexLeaf("NAME1", "[%s]+[%g]([^%g]+)[%g]"), //
new RegexLeaf("NAME2", "[%s]+([^#]+)"))), //
new RegexLeaf("[%s]*"), //
new RegexLeaf("COLOR", "(#\\w+)?"), //
color().getRegex(), //
new RegexLeaf("$"));
}
private static ColorParser color() {
return ColorParser.simpleColor(ColorType.BACK);
}
@Override
protected CommandExecutionResult executeArg(SequenceDiagram diagram, RegexResult arg2) {
if (diagram.isBoxPending()) {
@ -70,9 +78,10 @@ public class CommandBoxStart extends SingleLineCommand2<SequenceDiagram> {
}
final String argTitle = arg2.getLazzy("NAME", 0);
final String argColor = arg2.get("COLOR", 0);
final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(argColor);
// final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(argColor);
Colors colors = color().getColor(arg2, diagram.getSkinParam().getIHtmlColorSet());
final String title = argTitle == null ? "" : argTitle;
diagram.boxStart(Display.getWithNewlines(title), color);
diagram.boxStart(Display.getWithNewlines(title), colors.getColor(ColorType.BACK));
return CommandExecutionResult.ok();
}

View File

@ -41,6 +41,7 @@ import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HtmlColorSet;
import net.sourceforge.plantuml.sequencediagram.EventWithDeactivate;
import net.sourceforge.plantuml.sequencediagram.LifeEventType;
import net.sourceforge.plantuml.sequencediagram.Message;
@ -59,6 +60,7 @@ public class CommandReturn extends SingleLineCommand2<SequenceDiagram> {
new RegexLeaf("PARALLEL", "(&%s*)?"), //
new RegexLeaf("[%s]*"), //
new RegexLeaf("return[%s]*"), //
new RegexLeaf("COLOR", "(?:(#\\w+)[%s]+)?"), //
new RegexLeaf("MESSAGE", "(.*)"), //
new RegexLeaf("$"));
}
@ -77,7 +79,11 @@ public class CommandReturn extends SingleLineCommand2<SequenceDiagram> {
doDeactivation = false;
}
final ArrowConfiguration arrow = message1.getArrowConfiguration().withBody(ArrowBody.DOTTED);
ArrowConfiguration arrow = message1.getArrowConfiguration().withBody(ArrowBody.DOTTED);
final String color = arg.get("COLOR", 0);
if (color != null) {
arrow = arrow.withColor(HtmlColorSet.getInstance().getColorIfValid(color));
}
final Display display = Display.getWithNewlines(arg.get("MESSAGE", 0));
final Message message2 = new Message(message1.getParticipant2(), message1.getParticipant1(), display, arrow,

View File

@ -40,12 +40,12 @@ import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.sequencediagram.InGroupable;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.skin.Component;
import net.sourceforge.plantuml.skin.Skin;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.UGraphic;
abstract class Arrow extends GraphicalElement implements InGroupable {
private final Skin skin;
private final Rose skin;
private final Component arrowComponent;
private double paddingArrowHead;
private double maxX;
@ -67,7 +67,7 @@ abstract class Arrow extends GraphicalElement implements InGroupable {
public abstract double getActualWidth(StringBounder stringBounder);
Arrow(double startingY, Skin skin, Component arrowComponent, Url url) {
Arrow(double startingY, Rose skin, Component arrowComponent, Url url) {
super(startingY);
this.skin = skin;
this.arrowComponent = arrowComponent;
@ -92,7 +92,7 @@ abstract class Arrow extends GraphicalElement implements InGroupable {
public abstract int getDirection(StringBounder stringBounder);
protected Skin getSkin() {
protected Rose getSkin() {
return skin;
}

View File

@ -64,7 +64,7 @@ import net.sourceforge.plantuml.skin.Component;
import net.sourceforge.plantuml.skin.ComponentType;
import net.sourceforge.plantuml.skin.Context2D;
import net.sourceforge.plantuml.skin.SimpleContext2D;
import net.sourceforge.plantuml.skin.Skin;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.MinMax;
import net.sourceforge.plantuml.ugraphic.UClip;
import net.sourceforge.plantuml.ugraphic.UGraphic;
@ -79,12 +79,12 @@ public class DrawableSet {
private final Map<Participant, ParticipantEnglober> participantEnglobers2 = new LinkedHashMap<Participant, ParticipantEnglober>();
private final List<Event> eventsList = new ArrayList<Event>();
private final Skin skin;
private final Rose skin;
private final ISkinParam skinParam;
private Dimension2D dimension;
private double topStartingY;
DrawableSet(Skin skin, ISkinParam skinParam) {
DrawableSet(Rose skin, ISkinParam skinParam) {
if (skin == null) {
throw new IllegalArgumentException();
}
@ -99,7 +99,7 @@ public class DrawableSet {
return participants.values().iterator().next().getParticipantBox();
}
public final Skin getSkin() {
public final Rose getSkin() {
return skin;
}

View File

@ -69,7 +69,7 @@ import net.sourceforge.plantuml.sequencediagram.ParticipantType;
import net.sourceforge.plantuml.sequencediagram.Reference;
import net.sourceforge.plantuml.skin.Component;
import net.sourceforge.plantuml.skin.ComponentType;
import net.sourceforge.plantuml.skin.Skin;
import net.sourceforge.plantuml.skin.rose.Rose;
class DrawableSetInitializer {
@ -85,7 +85,7 @@ class DrawableSetInitializer {
private ConstraintSet constraintSet;
public DrawableSetInitializer(Skin skin, ISkinParam skinParam, boolean showTail, double autonewpage) {
public DrawableSetInitializer(Rose skin, ISkinParam skinParam, boolean showTail, double autonewpage) {
this.drawableSet = new DrawableSet(skin, skinParam);
this.showTail = showTail;
this.autonewpage = autonewpage;

View File

@ -50,7 +50,7 @@ import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.SymbolContext;
import net.sourceforge.plantuml.skin.Component;
import net.sourceforge.plantuml.skin.ComponentType;
import net.sourceforge.plantuml.skin.Skin;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
@ -198,7 +198,7 @@ public class LifeLine {
return Collections.emptyList();
}
public void drawU(UGraphic ug, Skin skin, ISkinParam skinParam) {
public void drawU(UGraphic ug, Rose skin, ISkinParam skinParam) {
final StringBounder stringBounder = ug.getStringBounder();
ug = ug.apply(new UTranslate(getStartingX(stringBounder), 0));

View File

@ -45,7 +45,7 @@ import net.sourceforge.plantuml.skin.Area;
import net.sourceforge.plantuml.skin.ArrowComponent;
import net.sourceforge.plantuml.skin.Component;
import net.sourceforge.plantuml.skin.Context2D;
import net.sourceforge.plantuml.skin.Skin;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
@ -55,7 +55,7 @@ class MessageArrow extends Arrow {
private final LivingParticipantBox p2;
private final Component compAliveBox;
public MessageArrow(double startingY, Skin skin, Component arrow, LivingParticipantBox p1, LivingParticipantBox p2,
public MessageArrow(double startingY, Rose skin, Component arrow, LivingParticipantBox p1, LivingParticipantBox p2,
Url url, Component compAliveBox) {
super(startingY, skin, arrow, url);

View File

@ -48,8 +48,8 @@ import net.sourceforge.plantuml.skin.ArrowConfiguration;
import net.sourceforge.plantuml.skin.ArrowDecoration;
import net.sourceforge.plantuml.skin.Component;
import net.sourceforge.plantuml.skin.Context2D;
import net.sourceforge.plantuml.skin.Skin;
import net.sourceforge.plantuml.skin.rose.ComponentRoseArrow;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
@ -60,7 +60,7 @@ public class MessageExoArrow extends Arrow {
private final boolean shortArrow;
private final ArrowConfiguration arrowConfiguration;
public MessageExoArrow(double startingY, Skin skin, Component arrow, LivingParticipantBox p, MessageExoType type,
public MessageExoArrow(double startingY, Rose skin, Component arrow, LivingParticipantBox p, MessageExoType type,
Url url, boolean shortArrow, ArrowConfiguration arrowConfiguration) {
super(startingY, skin, arrow, url);
this.p = p;

View File

@ -45,7 +45,7 @@ import net.sourceforge.plantuml.skin.Area;
import net.sourceforge.plantuml.skin.ArrowComponent;
import net.sourceforge.plantuml.skin.Component;
import net.sourceforge.plantuml.skin.Context2D;
import net.sourceforge.plantuml.skin.Skin;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
@ -55,7 +55,7 @@ class MessageSelfArrow extends Arrow {
private final double deltaX;
private final double deltaY;
public MessageSelfArrow(double startingY, Skin skin, Component arrow, LivingParticipantBox p1, double deltaY,
public MessageSelfArrow(double startingY, Rose skin, Component arrow, LivingParticipantBox p1, double deltaY,
Url url, double deltaX) {
super(startingY, skin, arrow, url);
this.p1 = p1;

View File

@ -65,7 +65,7 @@ import net.sourceforge.plantuml.sequencediagram.Newpage;
import net.sourceforge.plantuml.sequencediagram.Participant;
import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
import net.sourceforge.plantuml.skin.ComponentType;
import net.sourceforge.plantuml.skin.Skin;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.ImageBuilder;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
@ -81,7 +81,7 @@ public class SequenceDiagramFileMakerPuma2 implements FileMaker {
private double scale;
public SequenceDiagramFileMakerPuma2(SequenceDiagram sequenceDiagram, Skin skin, FileFormatOption fileFormatOption) {
public SequenceDiagramFileMakerPuma2(SequenceDiagram sequenceDiagram, Rose skin, FileFormatOption fileFormatOption) {
this.diagram = sequenceDiagram;
this.stringBounder = fileFormatOption.getDefaultStringBounder();
this.fileFormatOption = fileFormatOption;

View File

@ -52,7 +52,6 @@ import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.sequencediagram.Event;
import net.sourceforge.plantuml.sequencediagram.Participant;
import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
import net.sourceforge.plantuml.skin.Skin;
import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.txt.UGraphicTxt;
@ -64,7 +63,7 @@ public class SequenceDiagramTxtMaker implements FileMaker {
private final StringBounder dummyStringBounder = new TextStringBounder();
private final UGraphicTxt ug = new UGraphicTxt();
private final FileFormat fileFormat;
private final Skin skin;
private final TextSkin skin;
public SequenceDiagramTxtMaker(SequenceDiagram sequenceDiagram, FileFormat fileFormat) {
this.fileFormat = fileFormat;

View File

@ -33,31 +33,20 @@
*
*
*/
package net.sourceforge.plantuml;
package net.sourceforge.plantuml.sequencediagram.teoz;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.StringBounder;
public class EmbededDiagram implements CharSequence {
public abstract class AbstractTile implements Tile {
private final Display system;
public EmbededDiagram(Display system) {
this.system = system;
public double getYPoint(StringBounder stringBounder) {
throw new UnsupportedOperationException(getClass().toString());
}
public int length() {
return toString().length();
final public double getZ(StringBounder stringBounder) {
final double result = getPreferredHeight(stringBounder) - getYPoint(stringBounder);
assert result >= 0;
return result;
}
public char charAt(int index) {
return toString().charAt(index);
}
public CharSequence subSequence(int start, int end) {
return toString().subSequence(start, end);
}
public final Display getLines() {
return system;
}
}

View File

@ -48,18 +48,17 @@ import net.sourceforge.plantuml.skin.ArrowComponent;
import net.sourceforge.plantuml.skin.ArrowConfiguration;
import net.sourceforge.plantuml.skin.ArrowDecoration;
import net.sourceforge.plantuml.skin.Component;
import net.sourceforge.plantuml.skin.ComponentType;
import net.sourceforge.plantuml.skin.Context2D;
import net.sourceforge.plantuml.skin.Skin;
import net.sourceforge.plantuml.skin.rose.ComponentRoseArrow;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
public class CommunicationExoTile implements TileWithUpdateStairs {
public class CommunicationExoTile extends AbstractTile implements TileWithUpdateStairs {
private final LivingSpace livingSpace;
private final MessageExo message;
private final Skin skin;
private final Rose skin;
private final ISkinParam skinParam;
private final TileArguments tileArguments;
@ -67,7 +66,7 @@ public class CommunicationExoTile implements TileWithUpdateStairs {
return message;
}
public CommunicationExoTile(LivingSpace livingSpace, MessageExo message, Skin skin, ISkinParam skinParam,
public CommunicationExoTile(LivingSpace livingSpace, MessageExo message, Rose skin, ISkinParam skinParam,
TileArguments tileArguments) {
this.tileArguments = tileArguments;
this.livingSpace = livingSpace;
@ -76,13 +75,19 @@ public class CommunicationExoTile implements TileWithUpdateStairs {
this.skinParam = skinParam;
}
private Component getComponent(StringBounder stringBounder) {
@Override
public double getYPoint(StringBounder stringBounder) {
return getComponent(stringBounder).getYPoint(stringBounder);
}
private ArrowComponent getComponent(StringBounder stringBounder) {
ArrowConfiguration arrowConfiguration = message.getArrowConfiguration();
if (message.getType().getDirection() == -1) {
arrowConfiguration = arrowConfiguration.reverse();
}
final Component comp = skin.createComponent(ComponentType.ARROW, arrowConfiguration, skinParam,
message.getLabelNumbered());
final ArrowComponent comp = skin
.createComponentArrow(arrowConfiguration, skinParam, message.getLabelNumbered());
return comp;
}

View File

@ -39,7 +39,6 @@ import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.VerticalAlignment;
import net.sourceforge.plantuml.real.Real;
@ -49,27 +48,29 @@ import net.sourceforge.plantuml.skin.Area;
import net.sourceforge.plantuml.skin.ArrowComponent;
import net.sourceforge.plantuml.skin.ArrowConfiguration;
import net.sourceforge.plantuml.skin.Component;
import net.sourceforge.plantuml.skin.ComponentType;
import net.sourceforge.plantuml.skin.Context2D;
import net.sourceforge.plantuml.skin.Skin;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UEllipse;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
public class CommunicationTile implements TileWithUpdateStairs, TileWithCallbackY {
public class CommunicationTile extends AbstractTile implements TileWithUpdateStairs, TileWithCallbackY {
private final LivingSpace livingSpace1;
private final LivingSpace livingSpace2;
private final Message message;
private final Skin skin;
private final Rose skin;
private final ISkinParam skinParam;
public Event getEvent() {
return message;
}
public CommunicationTile(LivingSpace livingSpace1, LivingSpace livingSpace2, Message message, Skin skin,
@Override
public String toString() {
return super.toString() + " " + message;
}
public CommunicationTile(LivingSpace livingSpace1, LivingSpace livingSpace2, Message message, Rose skin,
ISkinParam skinParam) {
if (livingSpace1 == livingSpace2) {
throw new IllegalArgumentException();
@ -103,7 +104,7 @@ public class CommunicationTile implements TileWithUpdateStairs, TileWithCallback
return message.isCreate();
}
private Component getComponent(StringBounder stringBounder) {
private ArrowComponent getComponent(StringBounder stringBounder) {
ArrowConfiguration arrowConfiguration = message.getArrowConfiguration();
/*
* if (isSelf()) { arrowConfiguration = arrowConfiguration.self(); } else
@ -111,11 +112,17 @@ public class CommunicationTile implements TileWithUpdateStairs, TileWithCallback
if (isReverse(stringBounder)) {
arrowConfiguration = arrowConfiguration.reverse();
}
final Component comp = skin.createComponent(ComponentType.ARROW, arrowConfiguration, skinParam,
message.getLabelNumbered());
final ArrowComponent comp = skin
.createComponentArrow(arrowConfiguration, skinParam, message.getLabelNumbered());
return comp;
}
@Override
public double getYPoint(StringBounder stringBounder) {
return getComponent(stringBounder).getYPoint(stringBounder);
}
public static final double LIVE_DELTA_SIZE = 5;
public void updateStairs(StringBounder stringBounder, double y) {
@ -167,18 +174,6 @@ public class CommunicationTile implements TileWithUpdateStairs, TileWithCallback
}
}
comp.drawU(ug, area, (Context2D) ug);
if (message.getAnchor() != null) {
drawAnchor(ug);
}
// ug.draw(new ULine(x2 - x1, 0));
}
private void drawAnchor(UGraphic ug) {
ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK));
ug.draw(new UEllipse(10, 10));
}
public double getPreferredHeight(StringBounder stringBounder) {

View File

@ -47,15 +47,15 @@ import net.sourceforge.plantuml.skin.Area;
import net.sourceforge.plantuml.skin.Component;
import net.sourceforge.plantuml.skin.ComponentType;
import net.sourceforge.plantuml.skin.Context2D;
import net.sourceforge.plantuml.skin.Skin;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
public class CommunicationTileNoteLeft implements TileWithUpdateStairs, TileWithCallbackY {
public class CommunicationTileNoteLeft extends AbstractTile implements TileWithUpdateStairs, TileWithCallbackY {
private final TileWithUpdateStairs tile;
private final AbstractMessage message;
private final Skin skin;
private final Rose skin;
private final ISkinParam skinParam;
private final LivingSpace livingSpace;
private final Note noteOnMessage;
@ -64,7 +64,12 @@ public class CommunicationTileNoteLeft implements TileWithUpdateStairs, TileWith
return message;
}
public CommunicationTileNoteLeft(TileWithUpdateStairs tile, AbstractMessage message, Skin skin,
@Override
public double getYPoint(StringBounder stringBounder) {
return tile.getYPoint(stringBounder);
}
public CommunicationTileNoteLeft(TileWithUpdateStairs tile, AbstractMessage message, Rose skin,
ISkinParam skinParam, LivingSpace livingSpace, Note noteOnMessage) {
this.tile = tile;
this.message = message;

View File

@ -47,15 +47,15 @@ import net.sourceforge.plantuml.skin.Area;
import net.sourceforge.plantuml.skin.Component;
import net.sourceforge.plantuml.skin.ComponentType;
import net.sourceforge.plantuml.skin.Context2D;
import net.sourceforge.plantuml.skin.Skin;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
public class CommunicationTileNoteRight implements TileWithUpdateStairs, TileWithCallbackY {
public class CommunicationTileNoteRight extends AbstractTile implements TileWithUpdateStairs, TileWithCallbackY {
private final TileWithUpdateStairs tile;
private final AbstractMessage message;
private final Skin skin;
private final Rose skin;
private final ISkinParam skinParam;
private final LivingSpace livingSpace;
private final Note noteOnMessage;
@ -68,7 +68,12 @@ public class CommunicationTileNoteRight implements TileWithUpdateStairs, TileWit
return message.isCreate();
}
public CommunicationTileNoteRight(TileWithUpdateStairs tile, AbstractMessage message, Skin skin,
@Override
public double getYPoint(StringBounder stringBounder) {
return tile.getYPoint(stringBounder);
}
public CommunicationTileNoteRight(TileWithUpdateStairs tile, AbstractMessage message, Rose skin,
ISkinParam skinParam, LivingSpace livingSpace, Note noteOnMessage) {
this.tile = tile;
this.message = message;

View File

@ -51,15 +51,15 @@ import net.sourceforge.plantuml.skin.ArrowConfiguration;
import net.sourceforge.plantuml.skin.Component;
import net.sourceforge.plantuml.skin.ComponentType;
import net.sourceforge.plantuml.skin.Context2D;
import net.sourceforge.plantuml.skin.Skin;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
public class CommunicationTileSelf implements TileWithUpdateStairs {
public class CommunicationTileSelf extends AbstractTile implements TileWithUpdateStairs {
private final LivingSpace livingSpace1;
private final Message message;
private final Skin skin;
private final Rose skin;
private final ISkinParam skinParam;
private final LivingSpaces livingSpaces;
@ -67,7 +67,7 @@ public class CommunicationTileSelf implements TileWithUpdateStairs {
return message;
}
public CommunicationTileSelf(LivingSpace livingSpace1, Message message, Skin skin, ISkinParam skinParam,
public CommunicationTileSelf(LivingSpace livingSpace1, Message message, Rose skin, ISkinParam skinParam,
LivingSpaces livingSpaces) {
this.livingSpace1 = livingSpace1;
this.livingSpaces = livingSpaces;

View File

@ -47,15 +47,15 @@ import net.sourceforge.plantuml.skin.Area;
import net.sourceforge.plantuml.skin.Component;
import net.sourceforge.plantuml.skin.ComponentType;
import net.sourceforge.plantuml.skin.Context2D;
import net.sourceforge.plantuml.skin.Skin;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
public class CommunicationTileSelfNoteRight implements TileWithUpdateStairs {
public class CommunicationTileSelfNoteRight extends AbstractTile implements TileWithUpdateStairs {
private final CommunicationTileSelf tile;
private final Message message;
private final Skin skin;
private final Rose skin;
private final ISkinParam skinParam;
private final Note noteOnMessage;
@ -63,7 +63,7 @@ public class CommunicationTileSelfNoteRight implements TileWithUpdateStairs {
return message;
}
public CommunicationTileSelfNoteRight(CommunicationTileSelf tile, Message message, Skin skin, ISkinParam skinParam,
public CommunicationTileSelfNoteRight(CommunicationTileSelf tile, Message message, Rose skin, ISkinParam skinParam,
Note noteOnMessage) {
this.tile = tile;
this.message = message;

View File

@ -49,7 +49,7 @@ import net.sourceforge.plantuml.skin.Context2D;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
public class DelayTile implements Tile, TileWithCallbackY {
public class DelayTile extends AbstractTile implements Tile, TileWithCallbackY {
private final Delay delay;
private final TileArguments tileArguments;

View File

@ -46,13 +46,13 @@ import net.sourceforge.plantuml.skin.Area;
import net.sourceforge.plantuml.skin.Component;
import net.sourceforge.plantuml.skin.ComponentType;
import net.sourceforge.plantuml.skin.Context2D;
import net.sourceforge.plantuml.skin.Skin;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
public class DividerTile implements Tile {
public class DividerTile extends AbstractTile implements Tile {
private final Skin skin;
private final Rose skin;
private final ISkinParam skinParam;
private final Divider divider;
private final Real origin;

View File

@ -46,12 +46,12 @@ import net.sourceforge.plantuml.sequencediagram.Event;
import net.sourceforge.plantuml.sequencediagram.GroupingLeaf;
import net.sourceforge.plantuml.skin.Component;
import net.sourceforge.plantuml.skin.ComponentType;
import net.sourceforge.plantuml.skin.Skin;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.UGraphic;
public class ElseTile implements TileWithCallbackY {
public class ElseTile extends AbstractTile implements TileWithCallbackY {
private final Skin skin;
private final Rose skin;
private final ISkinParam skinParam;
private final GroupingLeaf anElse;
private final Tile parent;
@ -60,7 +60,12 @@ public class ElseTile implements TileWithCallbackY {
return anElse;
}
public ElseTile(GroupingLeaf anElse, Skin skin, ISkinParam skinParam, Tile parent) {
@Override
public double getYPoint(StringBounder stringBounder) {
return 0;
}
public ElseTile(GroupingLeaf anElse, Rose skin, ISkinParam skinParam, Tile parent) {
this.anElse = anElse;
this.skin = skin;
this.skinParam = skinParam;

View File

@ -42,7 +42,7 @@ import net.sourceforge.plantuml.sequencediagram.Event;
import net.sourceforge.plantuml.sequencediagram.Participant;
import net.sourceforge.plantuml.ugraphic.UGraphic;
public class EmptyTile implements Tile {
public class EmptyTile extends AbstractTile implements Tile {
private final double height;
private final Tile position;

View File

@ -54,11 +54,11 @@ import net.sourceforge.plantuml.skin.Area;
import net.sourceforge.plantuml.skin.Component;
import net.sourceforge.plantuml.skin.ComponentType;
import net.sourceforge.plantuml.skin.Context2D;
import net.sourceforge.plantuml.skin.Skin;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
public class GroupingTile implements TileWithCallbackY {
public class GroupingTile extends AbstractTile implements TileWithCallbackY {
private static final int EXTERNAL_MARGINX1 = 3;
private static final int EXTERNAL_MARGINX2 = 9;
@ -71,7 +71,7 @@ public class GroupingTile implements TileWithCallbackY {
// private final double marginX = 20;
private final Skin skin;
private final Rose skin;
private final ISkinParam skinParam;
private final Display display;
@ -81,6 +81,11 @@ public class GroupingTile implements TileWithCallbackY {
return start;
}
@Override
public double getYPoint(StringBounder stringBounder) {
return 0;
}
public GroupingTile(Iterator<Event> it, GroupingStart start, TileArguments tileArgumentsBachColorChanged,
TileArguments tileArgumentsOriginal) {
final StringBounder stringBounder = tileArgumentsOriginal.getStringBounder();
@ -239,9 +244,18 @@ public class GroupingTile implements TileWithCallbackY {
if (isParallel(tile)) {
if (pending == null) {
pending = new TileParallel();
pending.add(result.get(result.size() - 1));
final Tile tmp = result.get(result.size() - 1);
if (tmp instanceof LifeEventTile) {
pending.add(result.get(result.size() - 2));
pending.add(tmp);
// result.set(result.size() - 1, pending);
result.set(result.size() - 2, pending);
result.remove(result.size() - 1);
} else {
pending.add(tmp);
result.set(result.size() - 1, pending);
}
}
pending.add(tile);
} else {
result.add(tile);

View File

@ -41,7 +41,7 @@ import net.sourceforge.plantuml.sequencediagram.Event;
import net.sourceforge.plantuml.sequencediagram.HSpace;
import net.sourceforge.plantuml.ugraphic.UGraphic;
public class HSpaceTile implements Tile {
public class HSpaceTile extends AbstractTile implements Tile {
private final HSpace hspace;
private final Real origin;

View File

@ -47,16 +47,16 @@ import net.sourceforge.plantuml.sequencediagram.LifeEventType;
import net.sourceforge.plantuml.skin.Component;
import net.sourceforge.plantuml.skin.ComponentType;
import net.sourceforge.plantuml.skin.Context2D;
import net.sourceforge.plantuml.skin.Skin;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
public class LifeEventTile implements TileWithUpdateStairs {
public class LifeEventTile extends AbstractTile implements TileWithUpdateStairs {
private final LifeEvent lifeEvent;
private final TileArguments tileArguments;
private final LivingSpace livingSpace;
private final Skin skin;
private final Rose skin;
private final ISkinParam skinParam;
public void updateStairs(StringBounder stringBounder, double y) {
@ -68,7 +68,12 @@ public class LifeEventTile implements TileWithUpdateStairs {
return lifeEvent;
}
public LifeEventTile(LifeEvent lifeEvent, TileArguments tileArguments, LivingSpace livingSpace, Skin skin,
@Override
public double getYPoint(StringBounder stringBounder) {
return 0;
}
public LifeEventTile(LifeEvent lifeEvent, TileArguments tileArguments, LivingSpace livingSpace, Rose skin,
ISkinParam skinParam) {
this.lifeEvent = lifeEvent;
this.tileArguments = tileArguments;

View File

@ -43,6 +43,7 @@ import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity;
import net.sourceforge.plantuml.ugraphic.UChange;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UEllipse;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UParamNull;
@ -60,7 +61,6 @@ public class LiveBoxFinder implements UGraphic {
return 1;
}
public UGraphic apply(UChange change) {
if (change instanceof UTranslate) {
return new LiveBoxFinder(stringBounder, translate.compose((UTranslate) change));
@ -105,16 +105,17 @@ public class LiveBoxFinder implements UGraphic {
((GroupingTile) shape).drawU(this);
} else if (shape instanceof TileWithUpdateStairs) {
((TileWithUpdateStairs) shape).updateStairs(stringBounder, y);
} else if (shape instanceof EmptyTile) {
// Nothing ?
} else if (shape instanceof TileParallel) {
// Nothing ?
} else if (shape instanceof NotesTile) {
// Nothing ?
} else if (shape instanceof Tile) {
Log.info("OtherTile " + shape);
// } else if (shape instanceof EmptyTile) {
// // Nothing ?
// } else if (shape instanceof TileParallel) {
// // Nothing ?
// } else if (shape instanceof NotesTile) {
// // Nothing ?
// } else if (shape instanceof Tile) {
// Log.info("OtherTile " + shape);
} else {
throw new UnsupportedOperationException(shape.getClass().getName());
// Nothing ?
// throw new UnsupportedOperationException(shape.getClass().getName());
}
}

View File

@ -44,18 +44,18 @@ import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.sequencediagram.Participant;
import net.sourceforge.plantuml.skin.Context2D;
import net.sourceforge.plantuml.skin.SimpleContext2D;
import net.sourceforge.plantuml.skin.Skin;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
public class LiveBoxes {
private final EventsHistory eventsHistory;
private final Skin skin;
private final Rose skin;
private final ISkinParam skinParam;
private final Map<Double, Double> delays = new TreeMap<Double, Double>();
public LiveBoxes(EventsHistory eventsHistory, Skin skin, ISkinParam skinParam, Participant participant) {
public LiveBoxes(EventsHistory eventsHistory, Rose skin, ISkinParam skinParam, Participant participant) {
this.eventsHistory = eventsHistory;
this.skin = skin;
this.skinParam = skinParam;

View File

@ -50,7 +50,7 @@ import net.sourceforge.plantuml.skin.Area;
import net.sourceforge.plantuml.skin.Component;
import net.sourceforge.plantuml.skin.ComponentType;
import net.sourceforge.plantuml.skin.Context2D;
import net.sourceforge.plantuml.skin.Skin;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
@ -61,12 +61,12 @@ public class LiveBoxesDrawer {
private final Component cross;
private final Context2D context;
private final Skin skin;
private final Rose skin;
private final ISkinParam skinParam;
private final Component compForWidth;
private final Collection<Segment> delays;
public LiveBoxesDrawer(Context2D context, Skin skin, ISkinParam skinParam, Map<Double, Double> delays) {
public LiveBoxesDrawer(Context2D context, Rose skin, ISkinParam skinParam, Map<Double, Double> delays) {
this.cross = skin.createComponent(ComponentType.DESTROY, null, skinParam, null);
this.compForWidth = skin.createComponent(ComponentType.ALIVE_BOX_CLOSE_CLOSE, null, skinParam, null);
this.context = context;

View File

@ -53,7 +53,6 @@ import net.sourceforge.plantuml.skin.Area;
import net.sourceforge.plantuml.skin.Component;
import net.sourceforge.plantuml.skin.ComponentType;
import net.sourceforge.plantuml.skin.Context2D;
import net.sourceforge.plantuml.skin.Skin;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
@ -61,7 +60,7 @@ import net.sourceforge.plantuml.ugraphic.UTranslate;
public class LivingSpace {
private final Participant p;
private final Skin skin;
private final Rose skin;
private final ISkinParam skinParam;
private final ComponentType headType;
private final ComponentType tailType;
@ -104,7 +103,7 @@ public class LivingSpace {
return "" + pos.getCurrentValue();
}
public LivingSpace(Participant p, ParticipantEnglober englober, Skin skin, ISkinParam skinParam, Real position,
public LivingSpace(Participant p, ParticipantEnglober englober, Rose skin, ISkinParam skinParam, Real position,
List<Event> events) {
this.eventsHistory = new EventsHistory(p, events);
this.p = p;
@ -195,7 +194,8 @@ public class LivingSpace {
}
public Dimension2D getHeadPreferredDimension(StringBounder stringBounder) {
final Component comp = rose.createComponent(headType, null, skinParam, p.getDisplay(skinParam.forceSequenceParticipantUnderlined()));
final Component comp = rose.createComponent(headType, null, skinParam,
p.getDisplay(skinParam.forceSequenceParticipantUnderlined()));
final Dimension2D dim = comp.getPreferredDimension(stringBounder);
return dim;
}

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.sequencediagram.teoz;
import java.util.ArrayList;
import java.util.List;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.real.Real;
import net.sourceforge.plantuml.real.RealUtils;
@ -47,7 +48,7 @@ import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
import net.sourceforge.plantuml.ugraphic.LimitFinder;
import net.sourceforge.plantuml.ugraphic.UGraphic;
public class MainTile implements Tile, Bordered {
public class MainTile extends AbstractTile implements Tile, Bordered {
private final double startingY = 8;
private final Real min;
@ -57,11 +58,13 @@ public class MainTile implements Tile, Bordered {
private final List<Tile> tiles = new ArrayList<Tile>();
private final LivingSpaces livingSpaces;
private final List<LinkAnchor> linkAnchors;
private final ISkinParam skinParam;
public MainTile(SequenceDiagram diagram, Englobers englobers, TileArguments tileArguments) {
this.livingSpaces = tileArguments.getLivingSpaces();
this.linkAnchors = diagram.getLinkAnchors();
this.skinParam = diagram.getSkinParam();
final List<Real> min2 = new ArrayList<Real>();
final List<Real> max2 = new ArrayList<Real>();
@ -116,11 +119,9 @@ public class MainTile implements Tile, Bordered {
tile.drawU(ug);
}
for (LinkAnchor linkAnchor : linkAnchors) {
System.err.println("linkAnchor=" + linkAnchor);
final YPositionedTile tile1 = getFromAnchor(positionedTiles, linkAnchor.getAnchor1());
final YPositionedTile tile2 = getFromAnchor(positionedTiles, linkAnchor.getAnchor2());
System.err.println("tile1=" + tile1);
System.err.println("tile2=" + tile2);
linkAnchor.drawAnchor(ug, tile1, tile2, skinParam);
}
// System.err.println("MainTile::drawUInternal finalY=" + y);
return y;

View File

@ -47,18 +47,18 @@ import net.sourceforge.plantuml.skin.Area;
import net.sourceforge.plantuml.skin.Component;
import net.sourceforge.plantuml.skin.ComponentType;
import net.sourceforge.plantuml.skin.Context2D;
import net.sourceforge.plantuml.skin.Skin;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
public class MutingLine {
private final Skin skin;
private final Rose skin;
private final ISkinParam skinParam;
private final boolean useContinueLineBecauseOfDelay;
private final Map<Double, Double> delays = new TreeMap<Double, Double>();
public MutingLine(Skin skin, ISkinParam skinParam, List<Event> events) {
public MutingLine(Rose skin, ISkinParam skinParam, List<Event> events) {
this.skin = skin;
this.skinParam = skinParam;
this.useContinueLineBecauseOfDelay = useContinueLineBecauseOfDelay(events);

View File

@ -49,15 +49,15 @@ import net.sourceforge.plantuml.skin.Area;
import net.sourceforge.plantuml.skin.Component;
import net.sourceforge.plantuml.skin.ComponentType;
import net.sourceforge.plantuml.skin.Context2D;
import net.sourceforge.plantuml.skin.Skin;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
public class NoteTile implements Tile {
public class NoteTile extends AbstractTile implements Tile {
private final LivingSpace livingSpace1;
private final LivingSpace livingSpace2;
private final Skin skin;
private final Rose skin;
private final ISkinParam skinParam;
private final Note note;
@ -65,7 +65,12 @@ public class NoteTile implements Tile {
return note;
}
public NoteTile(LivingSpace livingSpace1, LivingSpace livingSpace2, Note note, Skin skin, ISkinParam skinParam) {
@Override
public double getYPoint(StringBounder stringBounder) {
return 0;
}
public NoteTile(LivingSpace livingSpace1, LivingSpace livingSpace2, Note note, Rose skin, ISkinParam skinParam) {
this.livingSpace1 = livingSpace1;
this.livingSpace2 = livingSpace2;
this.note = note;

Some files were not shown because too many files have changed in this diff Show More