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

version 8041

This commit is contained in:
Arnaud Roques 2016-05-19 20:41:37 +02:00
parent d2bb8f328c
commit c1f657b42e
42 changed files with 501 additions and 163 deletions

View File

@ -61,6 +61,7 @@ import net.sourceforge.plantuml.graphic.TextBlockRecentred;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.sequencediagram.NoteType;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.ImageBuilder;
@ -404,8 +405,8 @@ public class ActivityDiagram3 extends UmlDiagram {
setNextLink(link);
}
public CommandExecutionResult addNote(Display note, NotePosition position) {
final boolean ok = current().addNote(note, position);
public CommandExecutionResult addNote(Display note, NotePosition position, NoteType type) {
final boolean ok = current().addNote(note, position, type);
if (ok == false) {
return CommandExecutionResult.error("Cannot add note here");
}

View File

@ -42,6 +42,7 @@ import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.Rainbow;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.sequencediagram.NoteType;
public class Branch {
@ -78,8 +79,8 @@ public class Branch {
return list.kill();
}
public boolean addNote(Display note, NotePosition position) {
return list.addNote(note, position);
public boolean addNote(Display note, NotePosition position, NoteType type) {
return list.addNote(note, position, type);
}
public final void setInlinkRendering(LinkRendering inlinkRendering) {

View File

@ -38,6 +38,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimable;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.sequencediagram.NoteType;
public interface Instruction extends Swimable {
@ -49,6 +50,6 @@ public interface Instruction extends Swimable {
public LinkRendering getInLinkRendering();
public boolean addNote(Display note, NotePosition position);
public boolean addNote(Display note, NotePosition position, NoteType type);
}

View File

@ -67,8 +67,4 @@ public class InstructionEnd extends MonoSwimable implements Instruction {
return inlinkRendering;
}
public boolean addNote(Display note, NotePosition position) {
throw new UnsupportedOperationException();
}
}

View File

@ -42,6 +42,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.sequencediagram.NoteType;
public class InstructionFork implements Instruction {
@ -58,12 +59,12 @@ public class InstructionFork implements Instruction {
}
}
private InstructionList getLast() {
private InstructionList getLastList() {
return forks.get(forks.size() - 1);
}
public void add(Instruction ins) {
getLast().add(ins);
getLastList().add(ins);
}
public Ftile createFtile(FtileFactory factory) {
@ -83,15 +84,18 @@ public class InstructionFork implements Instruction {
}
final public boolean kill() {
return getLast().kill();
return getLastList().kill();
}
public LinkRendering getInLinkRendering() {
return inlinkRendering;
}
public boolean addNote(Display note, NotePosition position) {
return getLast().addNote(note, position);
public boolean addNote(Display note, NotePosition position, NoteType type) {
if (getLastList().getLast() == null) {
return getLastList().addNote(note, position, type);
}
return getLastList().addNote(note, position, type);
}
public Set<Swimlane> getSwimlanes() {
@ -104,14 +108,14 @@ public class InstructionFork implements Instruction {
}
public Swimlane getSwimlaneOut() {
return getLast().getSwimlaneOut();
return getLastList().getSwimlaneOut();
}
public void manageOutRendering(LinkRendering nextLinkRenderer) {
if (nextLinkRenderer == null) {
return;
}
getLast().setOutRendering(nextLinkRenderer);
getLastList().setOutRendering(nextLinkRenderer);
}
}

View File

@ -65,8 +65,4 @@ public class InstructionGoto extends MonoSwimable implements Instruction {
return LinkRendering.none();
}
public boolean addNote(Display note, NotePosition position) {
throw new UnsupportedOperationException();
}
}

View File

@ -41,6 +41,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.sequencediagram.NoteType;
public class InstructionGroup implements Instruction, InstructionCollection {
@ -83,12 +84,12 @@ public class InstructionGroup implements Instruction, InstructionCollection {
return LinkRendering.none();
}
public boolean addNote(Display note, NotePosition position) {
public boolean addNote(Display note, NotePosition position, NoteType type) {
if (list.isEmpty()) {
this.headerNote = note;
return true;
}
return list.addNote(note, position);
return list.addNote(note, position, type);
}
public Set<Swimlane> getSwimlanes() {

View File

@ -47,6 +47,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileWithNoteOpa
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.sequencediagram.NoteType;
public class InstructionIf implements Instruction, InstructionCollection {
@ -82,6 +83,7 @@ public class InstructionIf implements Instruction, InstructionCollection {
private Display note;
private NotePosition position;
private NoteType type;
public Ftile createFtile(FtileFactory factory) {
for (Branch branch : thens) {
@ -93,7 +95,7 @@ public class InstructionIf implements Instruction, InstructionCollection {
elseBranch.updateFtile(factory);
Ftile result = factory.createIf(swimlane, thens, elseBranch, afterEndwhile, topInlinkRendering);
if (note != null) {
result = new FtileWithNoteOpale(result, note, position, skinParam, false);
result = new FtileWithNoteOpale(result, note, position, type, skinParam, false);
}
return result;
}
@ -150,13 +152,14 @@ public class InstructionIf implements Instruction, InstructionCollection {
return topInlinkRendering;
}
public boolean addNote(Display note, NotePosition position) {
public boolean addNote(Display note, NotePosition position, NoteType type) {
if (current.isEmpty()) {
this.note = note;
this.position = position;
this.type = type;
return true;
} else {
return current.addNote(note, position);
return current.addNote(note, position, type);
}
}
@ -168,7 +171,9 @@ public class InstructionIf implements Instruction, InstructionCollection {
for (Branch branch : thens) {
result.addAll(branch.getSwimlanes());
}
if (elseBranch != null) {
result.addAll(elseBranch.getSwimlanes());
}
return Collections.unmodifiableSet(result);
}

View File

@ -65,8 +65,4 @@ public class InstructionLabel extends MonoSwimable implements Instruction {
return LinkRendering.none();
}
public boolean addNote(Display note, NotePosition position) {
throw new UnsupportedOperationException();
}
}

View File

@ -45,8 +45,9 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.sequencediagram.NoteType;
public class InstructionList implements Instruction, InstructionCollection {
public class InstructionList extends WithNote implements Instruction, InstructionCollection {
private final List<Instruction> all = new ArrayList<Instruction>();
private final Swimlane defaultSwimlane;
@ -79,7 +80,7 @@ public class InstructionList implements Instruction, InstructionCollection {
if (all.size() == 0) {
return new FtileEmpty(factory.shadowing(), defaultSwimlane);
}
Ftile result = null;
Ftile result = eventuallyAddNote(factory, null, getSwimlaneIn());
for (Instruction ins : all) {
Ftile cur = ins.createFtile(factory);
if (ins.getInLinkRendering().isNone() == false) {
@ -119,11 +120,11 @@ public class InstructionList implements Instruction, InstructionCollection {
return all.get(all.size() - 1);
}
public boolean addNote(Display note, NotePosition position) {
public boolean addNote(Display note, NotePosition position, NoteType type) {
if (getLast() == null) {
return false;
return super.addNote(note, position, type);
}
return getLast().addNote(note, position);
return getLast().addNote(note, position, type);
}
public Set<Swimlane> getSwimlanes() {

View File

@ -40,6 +40,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.sequencediagram.NoteType;
public class InstructionPartition implements Instruction {
@ -82,7 +83,7 @@ public class InstructionPartition implements Instruction {
return list.getInLinkRendering();
}
public boolean addNote(Display note, NotePosition position) {
public boolean addNote(Display note, NotePosition position, NoteType type) {
throw new UnsupportedOperationException();
}

View File

@ -42,6 +42,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.sequencediagram.NoteType;
public class InstructionRepeat implements Instruction {
@ -118,8 +119,8 @@ public class InstructionRepeat implements Instruction {
return nextLinkRenderer;
}
public boolean addNote(Display note, NotePosition position) {
return repeatList.addNote(note, position);
public boolean addNote(Display note, NotePosition position, NoteType type) {
return repeatList.addNote(note, position, type);
}
public Set<Swimlane> getSwimlanes() {

View File

@ -41,7 +41,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileKilled;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
public class InstructionSimple extends MonoSwimable implements Instruction {
@ -49,8 +48,6 @@ public class InstructionSimple extends MonoSwimable implements Instruction {
private final Display label;
private final Colors colors;
private final LinkRendering inlinkRendering;
private Display note;
private NotePosition notePosition;
private final BoxStyle style;
private final Url url;
@ -75,9 +72,7 @@ public class InstructionSimple extends MonoSwimable implements Instruction {
if (url != null) {
result = factory.addUrl(result, url);
}
if (note != null) {
result = factory.addNote(result, note, notePosition);
}
result = eventuallyAddNote(factory, result, result.getSwimlaneIn());
if (killed) {
return new FtileKilled(result);
}
@ -97,10 +92,4 @@ public class InstructionSimple extends MonoSwimable implements Instruction {
return inlinkRendering;
}
public boolean addNote(Display note, NotePosition position) {
this.note = note;
this.notePosition = position;
return true;
}
}

View File

@ -42,6 +42,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.sequencediagram.NoteType;
public class InstructionSplit implements Instruction {
@ -101,8 +102,8 @@ public class InstructionSplit implements Instruction {
return inlinkRendering;
}
public boolean addNote(Display note, NotePosition position) {
return getLast().addNote(note, position);
public boolean addNote(Display note, NotePosition position, NoteType type) {
return getLast().addNote(note, position, type);
}
public Set<Swimlane> getSwimlanes() {

View File

@ -36,8 +36,6 @@ package net.sourceforge.plantuml.activitydiagram3;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
public class InstructionStart extends MonoSwimable implements Instruction {
@ -46,7 +44,9 @@ public class InstructionStart extends MonoSwimable implements Instruction {
}
public Ftile createFtile(FtileFactory factory) {
return factory.start(getSwimlaneIn());
Ftile result = factory.start(getSwimlaneIn());
result = eventuallyAddNote(factory, result, result.getSwimlaneIn());
return result;
}
public void add(Instruction other) {
@ -61,8 +61,4 @@ public class InstructionStart extends MonoSwimable implements Instruction {
return LinkRendering.none();
}
public boolean addNote(Display note, NotePosition position) {
throw new UnsupportedOperationException();
}
}

View File

@ -36,14 +36,10 @@ package net.sourceforge.plantuml.activitydiagram3;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
public class InstructionStop extends MonoSwimable implements Instruction {
private final LinkRendering inlinkRendering;
private Display note;
private NotePosition notePosition;
public InstructionStop(Swimlane swimlane, LinkRendering inlinkRendering) {
super(swimlane);
@ -55,9 +51,7 @@ public class InstructionStop extends MonoSwimable implements Instruction {
public Ftile createFtile(FtileFactory factory) {
Ftile result = factory.stop(getSwimlaneIn());
if (note != null) {
result = factory.addNote(result, note, notePosition);
}
result = eventuallyAddNote(factory, result, result.getSwimlaneIn());
return result;
}
@ -73,10 +67,4 @@ public class InstructionStop extends MonoSwimable implements Instruction {
return inlinkRendering;
}
public boolean addNote(Display note, NotePosition position) {
this.note = note;
this.notePosition = position;
return true;
}
}

View File

@ -44,6 +44,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileWithNoteOpa
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.sequencediagram.NoteType;
public class InstructionWhile implements Instruction, InstructionCollection {
@ -92,12 +93,13 @@ public class InstructionWhile implements Instruction, InstructionCollection {
private Display note;
private NotePosition position;
private NoteType type;
public Ftile createFtile(FtileFactory factory) {
Ftile tmp = factory.decorateOut(repeatList.createFtile(factory), endInlinkRendering);
tmp = factory.createWhile(swimlane, tmp, test, yes, out, afterEndwhile, color);
if (note != null) {
tmp = new FtileWithNoteOpale(tmp, note, position, skinParam, false);
tmp = new FtileWithNoteOpale(tmp, note, position, type, skinParam, false);
}
if (killed) {
return new FtileKilled(tmp);
@ -134,13 +136,14 @@ public class InstructionWhile implements Instruction, InstructionCollection {
this.afterEndwhile = linkRenderer;
}
public boolean addNote(Display note, NotePosition position) {
public boolean addNote(Display note, NotePosition position, NoteType type) {
if (repeatList.isEmpty()) {
this.note = note;
this.position = position;
this.type = type;
return true;
} else {
return repeatList.addNote(note, position);
return repeatList.addNote(note, position, type);
}
}

View File

@ -39,7 +39,7 @@ import java.util.Set;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimable;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
public class MonoSwimable implements Swimable {
public class MonoSwimable extends WithNote implements Swimable {
private final Swimlane swimlane;

View File

@ -0,0 +1,63 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2017, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* 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.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 9786 $
*
*/
package net.sourceforge.plantuml.activitydiagram3;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.sequencediagram.NoteType;
public class WithNote {
private Display note;
private NotePosition notePosition;
private NoteType type;
public boolean addNote(Display note, NotePosition position, NoteType type) {
this.note = note;
this.notePosition = position;
this.type = type;
return true;
}
final protected Ftile eventuallyAddNote(FtileFactory factory, Ftile ftile, Swimlane swimlane) {
if (note != null) {
return factory.addNote(ftile, note, notePosition, type, swimlane);
}
return ftile;
}
}

View File

@ -45,6 +45,8 @@ import net.sourceforge.plantuml.graphic.Rainbow;
public class CommandArrow3 extends SingleLineCommand2<ActivityDiagram3> {
public static final String STYLE_COLORS = "-\\[((?:#\\w+|dotted|dashed|plain|bold|hidden)(?:,#\\w+|,dotted|,dashed|,plain|,bold|,hidden)*(?:;(?:#\\w+|dotted|dashed|plain|bold|hidden)(?:,#\\w+|,dotted|,dashed|,plain|,bold|,hidden)*)*)\\]->";
public CommandArrow3() {
super(getRegexConcat());
}
@ -53,9 +55,7 @@ public class CommandArrow3 extends SingleLineCommand2<ActivityDiagram3> {
return new RegexConcat(new RegexLeaf("^"), //
new RegexOr(//
new RegexLeaf("->"), //
new RegexLeaf(
"COLOR",
"-\\[((?:#\\w+|dotted|dashed|plain|bold|hidden)(?:,#\\w+|,dotted|,dashed|,plain|,bold|,hidden)*(?:;(?:#\\w+|dotted|dashed|plain|bold|hidden)(?:,#\\w+|,dotted|,dashed|,plain|,bold|,hidden)*)*)\\]->")), //
new RegexLeaf("COLOR", STYLE_COLORS)), //
new RegexLeaf("[%s]*"), //
new RegexOr(//
new RegexLeaf("LABEL", "(.*);"), //

View File

@ -47,6 +47,7 @@ import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorAndStyle;
import net.sourceforge.plantuml.graphic.Rainbow;
public class CommandArrowLong3 extends CommandMultilines2<ActivityDiagram3> {
@ -63,7 +64,7 @@ public class CommandArrowLong3 extends CommandMultilines2<ActivityDiagram3> {
return new RegexConcat(new RegexLeaf("^"), //
new RegexOr(//
new RegexLeaf("->"), //
new RegexLeaf("COLOR", "-\\[(#\\w+)\\]->")), //
new RegexLeaf("COLOR", CommandArrow3.STYLE_COLORS)), //
new RegexLeaf("[%s]*"), //
new RegexLeaf("LABEL", "(.*)"), //
new RegexLeaf("$"));
@ -72,8 +73,14 @@ public class CommandArrowLong3 extends CommandMultilines2<ActivityDiagram3> {
public CommandExecutionResult executeNow(ActivityDiagram3 diagram, BlocLines lines) {
lines = lines.removeEmptyColumns();
final RegexResult line0 = getStartingPattern().matcher(StringUtils.trin(lines.getFirst499()));
final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0));
diagram.setColorNextArrow(HtmlColorAndStyle.fromColor(color));
// final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0));
// diagram.setColorNextArrow(HtmlColorAndStyle.fromColor(color));
final String colorString = line0.get("COLOR", 0);
if (colorString != null) {
Rainbow rainbow = Rainbow.build(diagram.getSkinParam(), colorString, diagram.getSkinParam()
.colorArrowSeparationSpace());
diagram.setColorNextArrow(rainbow);
}
lines = lines.removeStartingAndEnding2(line0.get("LABEL", 0));
diagram.setLabelNextArrow(lines.toDisplay());
return CommandExecutionResult.ok();

View File

@ -33,7 +33,6 @@
*/
package net.sourceforge.plantuml.activitydiagram3.command;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
@ -42,6 +41,7 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.sequencediagram.NoteType;
public class CommandNote3 extends SingleLineCommand2<ActivityDiagram3> {
@ -51,7 +51,7 @@ public class CommandNote3 extends SingleLineCommand2<ActivityDiagram3> {
static RegexConcat getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), //
new RegexLeaf("note"), //
new RegexLeaf("TYPE", "(note|floating note)"), //
new RegexLeaf("POSITION", "[%s]*(left|right)?"), //
new RegexLeaf("[%s]*:[%s]*"), //
new RegexLeaf("NOTE", "(.*)"), //
@ -61,15 +61,9 @@ public class CommandNote3 extends SingleLineCommand2<ActivityDiagram3> {
@Override
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
final Display note = Display.getWithNewlines(arg.get("NOTE", 0));
final NotePosition position = getPosition(arg.get("POSITION", 0));
return diagram.addNote(note, position);
}
private NotePosition getPosition(String s) {
if (s == null) {
return NotePosition.LEFT;
}
return NotePosition.valueOf(StringUtils.goUpperCase(s));
final NotePosition position = NotePosition.defaultLeft(arg.get("POSITION", 0));
final NoteType type = NoteType.defaultType(arg.get("TYPE", 0));
return diagram.addNote(note, position, type);
}
}

View File

@ -33,8 +33,6 @@
*/
package net.sourceforge.plantuml.activitydiagram3.command;
import java.util.List;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.BlocLines;
@ -46,6 +44,7 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.sequencediagram.NoteType;
public class CommandNoteLong3 extends CommandMultilines2<ActivityDiagram3> {
@ -62,21 +61,15 @@ public class CommandNoteLong3 extends CommandMultilines2<ActivityDiagram3> {
final RegexResult line0 = getStartingPattern().matcher(StringUtils.trin(lines.getFirst499()));
lines = lines.subExtract(1, 1);
lines = lines.removeEmptyColumns();
final NotePosition position = getPosition(line0.get("POSITION", 0));
final NotePosition position = NotePosition.defaultLeft(line0.get("POSITION", 0));
final NoteType type = NoteType.defaultType(line0.get("TYPE", 0));
final Display note = lines.toDisplay();
return diagram.addNote(note, position);
}
private NotePosition getPosition(String s) {
if (s == null) {
return NotePosition.LEFT;
}
return NotePosition.valueOf(StringUtils.goUpperCase(s));
return diagram.addNote(note, position, type);
}
static RegexConcat getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), //
new RegexLeaf("note"), //
new RegexLeaf("TYPE", "(note|floating note)"), //
new RegexLeaf("POSITION", "[%s]*(left|right)?"), //
new RegexLeaf("$"));
}

View File

@ -44,6 +44,7 @@ import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.sequencediagram.NoteType;
public interface FtileFactory extends ISkinSimple {
@ -59,7 +60,7 @@ public interface FtileFactory extends ISkinSimple {
public Ftile activity(Display label, Swimlane swimlane, BoxStyle style, Colors colors);
public Ftile addNote(Ftile ftile, Display note, NotePosition notePosition);
public Ftile addNote(Ftile ftile, Display note, NotePosition notePosition, NoteType type, Swimlane swimlane);
public Ftile addUrl(Ftile ftile, Url url);

View File

@ -35,7 +35,6 @@ package net.sourceforge.plantuml.activitydiagram3.ftile;
import java.util.List;
import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.Url;
@ -53,6 +52,7 @@ import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.sequencediagram.NoteType;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.sprite.Sprite;
@ -114,8 +114,8 @@ public class FtileFactoryDelegator implements FtileFactory {
return factory.activity(label, swimlane, style, colors);
}
public Ftile addNote(Ftile ftile, Display note, NotePosition notePosition) {
return factory.addNote(ftile, note, notePosition);
public Ftile addNote(Ftile ftile, Display note, NotePosition notePosition, NoteType type, Swimlane swimlane) {
return factory.addNote(ftile, note, notePosition, type, swimlane);
}
public Ftile addUrl(Ftile ftile, Url url) {

View File

@ -135,6 +135,7 @@ public class Snake implements UShape {
final int colorArrowSeparationSpace = color.getColorArrowSeparationSpace();
final double move = 2 + colorArrowSeparationSpace;
final WormMutation mutation = WormMutation.create(worm, move);
ug = ug.apply(mutation.getGlobalTranslate(colors.size()));
Worm current = worm;
for (int i = 0; i < colors.size(); i++) {
double stroke = 1.5;
@ -144,7 +145,8 @@ public class Snake implements UShape {
current.drawInternalOneColor(ug, colors.get(i), stroke, emphasizeDirection, endDecoration);
current = mutation.mute(current);
}
drawInternalLabel(ug.apply(new UTranslate(0, 0)));
final UTranslate textTranslate = mutation.getTextTranslate(colors.size());
drawInternalLabel(ug.apply(textTranslate));
}
// private void drawRainbowOld(UGraphic ug) {

View File

@ -36,6 +36,7 @@ package net.sourceforge.plantuml.activitydiagram3.ftile;
import java.util.ArrayList;
import java.util.List;
import net.sourceforge.plantuml.ugraphic.UChange;
import net.sourceforge.plantuml.ugraphic.UTranslate;
public class WormMutation {
@ -48,6 +49,45 @@ public class WormMutation {
public static WormMutation create(Worm worm, double delta) {
final String signature = worm.getDirectionsCode();
if (signature.length() > 2) {
return createFromLongSignature(signature, delta);
}
return createFromSimpleSignature(signature, delta);
}
private static WormMutation createFromLongSignature(final String signature, final double delta) {
final WormMutation result = new WormMutation();
for (int i = 0; i < signature.length() - 1; i++) {
WormMutation tmp = createFromSimpleSignature(signature.substring(i, i + 2), delta);
if (i == 0) {
result.translations.add(tmp.translations.get(0));
} else {
UTranslate last = result.getLast();
if (last.isAlmostSame(tmp.translations.get(0)) == false) {
tmp = tmp.reverse();
}
}
result.translations.add(tmp.translations.get(1));
if (i == signature.length() - 2) {
result.translations.add(tmp.translations.get(2));
}
}
return result;
}
private WormMutation reverse() {
final WormMutation result = new WormMutation();
for (UTranslate tr : translations) {
result.translations.add(tr.reverse());
}
return result;
}
private UTranslate getLast() {
return translations.get(translations.size() - 1);
}
private static WormMutation createFromSimpleSignature(final String signature, final double delta) {
final WormMutation result = new WormMutation();
if (signature.equals("D") || signature.equals("U")) {
final UTranslate translate = new UTranslate(delta, 0);
@ -67,6 +107,12 @@ public class WormMutation {
result.translations.add(new UTranslate(delta, 0));
return result;
}
if (signature.equals("RU")) {
result.translations.add(new UTranslate(0, delta));
result.translations.add(new UTranslate(delta, delta));
result.translations.add(new UTranslate(delta, 0));
return result;
}
if (signature.equals("LD")) {
result.translations.add(new UTranslate(0, -delta));
result.translations.add(new UTranslate(-delta, -delta));
@ -98,7 +144,45 @@ public class WormMutation {
return result;
}
throw new UnsupportedOperationException(signature);
}
static private class MinMax {
private double min = Double.MAX_VALUE;
private double max = Double.MIN_VALUE;
private void append(double v) {
if (v > max) {
max = v;
}
if (v < min) {
min = v;
}
}
private double getExtreme() {
if (Math.abs(max) > Math.abs(min)) {
return max;
}
return min;
}
}
public UTranslate getTextTranslate(int size) {
final MinMax result = new MinMax();
for (UTranslate tr : translations) {
result.append(tr.getDx());
}
return new UTranslate(result.getExtreme() * (size - 1), 0);
}
public UChange getGlobalTranslate(int size) {
final MinMax result = new MinMax();
for (UTranslate tr : translations) {
result.append(tr.getDx());
}
return new UTranslate(-result.getExtreme() * (size - 1) / 2.0, 0);
}
public Worm mute(Worm original) {

View File

@ -37,29 +37,25 @@ import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.sequencediagram.NoteType;
public class FtileFactoryDelegatorAddNote extends FtileFactoryDelegator {
// private final Rose rose = new Rose();
public FtileFactoryDelegatorAddNote(FtileFactory factory, ISkinParam skinParam) {
super(factory, skinParam);
}
@Override
public Ftile addNote(Ftile ftile, Display note, NotePosition notePosition) {
public Ftile addNote(Ftile ftile, Display note, NotePosition notePosition, NoteType type, Swimlane swimlane) {
if (note == null) {
throw new IllegalArgumentException();
}
// final HtmlColor colorlink;
// final LinkRendering inlinkRendering = ftile.getInLinkRendering();
// if (inlinkRendering == null || inlinkRendering.getColor() == null) {
// colorlink = rose.getHtmlColor(getSkinParam(), ColorParam.activityArrow);
// } else {
// colorlink = inlinkRendering.getColor();
// }
return new FtileWithNoteOpale(ftile, note, notePosition, getSkinParam(), true);
if (ftile == null) {
return new FtileNoteAlone(getSkinParam().shadowing(), note, getSkinParam(), type == NoteType.NOTE, swimlane);
}
return new FtileWithNoteOpale(ftile, note, notePosition, type, getSkinParam(), true);
}
}

View File

@ -0,0 +1,126 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2017, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* 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.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 8475 $
*
*/
package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact;
import java.awt.geom.Dimension2D;
import java.util.Collections;
import java.util.Set;
import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.creole.CreoleParser;
import net.sourceforge.plantuml.creole.Sheet;
import net.sourceforge.plantuml.creole.SheetBlock1;
import net.sourceforge.plantuml.creole.SheetBlock2;
import net.sourceforge.plantuml.creole.Stencil;
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.skin.rose.Rose;
import net.sourceforge.plantuml.svek.image.Opale;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UStroke;
public class FtileNoteAlone extends AbstractFtile implements Stencil {
private final Opale opale;
private final boolean withOutPoint;
private final Swimlane swimlane;
public Set<Swimlane> getSwimlanes() {
if (swimlane == null) {
return Collections.emptySet();
}
return Collections.singleton(swimlane);
}
public Swimlane getSwimlaneIn() {
return swimlane;
}
public Swimlane getSwimlaneOut() {
return swimlane;
}
public FtileNoteAlone(boolean shadow, Display note, ISkinParam skinParam, boolean withOutPoint, Swimlane swimlane) {
super(shadow);
this.swimlane = swimlane;
this.withOutPoint = withOutPoint;
final Rose rose = new Rose();
final HtmlColor noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.noteBackground);
final HtmlColor borderColor = rose.getHtmlColor(skinParam, ColorParam.noteBorder);
final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.NOTE, null);
final Sheet sheet = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL)
.createSheet(note);
final TextBlock text = new SheetBlock2(new SheetBlock1(sheet, 0, skinParam.getPadding()), this, new UStroke(1));
opale = new Opale(borderColor, noteBackgroundColor, text, skinParam.shadowing(), false);
}
public void drawU(UGraphic ug) {
opale.drawU(ug);
}
public FtileGeometry calculateDimension(StringBounder stringBounder) {
final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
if (withOutPoint) {
return new FtileGeometry(dimTotal, dimTotal.getWidth() / 2, 0, dimTotal.getHeight());
}
return new FtileGeometry(dimTotal, dimTotal.getWidth() / 2, 0);
}
private Dimension2D calculateDimensionInternal(StringBounder stringBounder) {
return opale.calculateDimension(stringBounder);
}
public double getStartingX(StringBounder stringBounder, double y) {
return -opale.getMarginX1();
}
public double getEndingX(StringBounder stringBounder, double y) {
return opale.calculateDimension(stringBounder).getWidth() - opale.getMarginX1();
}
}

View File

@ -59,9 +59,9 @@ import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.sequencediagram.NoteType;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.svek.image.Opale;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.UTranslate;
@ -87,22 +87,20 @@ public class FtileWithNoteOpale extends AbstractFtile implements Stencil {
return tile.getSwimlaneOut();
}
public FtileWithNoteOpale(Ftile tile, Display note, NotePosition notePosition, ISkinParam skinParam,
public FtileWithNoteOpale(Ftile tile, Display note, NotePosition notePosition, NoteType type, ISkinParam skinParam,
boolean withLink) {
super(tile.shadowing());
this.tile = tile;
this.notePosition = notePosition;
// this.arrowColor = arrowColor;
if (type == NoteType.FLOATING_NOTE) {
withLink = false;
}
final Rose rose = new Rose();
// final HtmlColor fontColor = rose.getFontColor(skinParam, FontParam.NOTE);
// final UFont fontNote = skinParam.getFont(FontParam.NOTE, null, false);
final HtmlColor noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.noteBackground);
final HtmlColor borderColor = rose.getHtmlColor(skinParam, ColorParam.noteBorder);
// final FontConfiguration fc = new FontConfiguration(fontNote, fontColor, skinParam.getHyperlinkColor(),
// skinParam.useUnderlineForHyperlink());
final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.NOTE, null);
final Sheet sheet = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL)

View File

@ -59,6 +59,7 @@ import net.sourceforge.plantuml.graphic.IHtmlColorSet;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.sequencediagram.NoteType;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.sprite.Sprite;
@ -101,7 +102,7 @@ public class VCompactFactory implements FtileFactory {
return new FtileBox(shadowing(), label, font, swimlane, style, colors.mute(skinParam));
}
public Ftile addNote(Ftile ftile, Display note, NotePosition notePosition) {
public Ftile addNote(Ftile ftile, Display note, NotePosition notePosition, NoteType type, Swimlane swimlane) {
return ftile;
}

View File

@ -60,7 +60,10 @@ public class CommandPackage extends SingleLineCommand2<AbstractEntityDiagram> {
}
private static RegexConcat getRegexConcat() {
return new RegexConcat(new RegexLeaf("^package[%s]+"), //
return new RegexConcat(//
new RegexLeaf("^"), //
new RegexLeaf("TYPE", "(package|together)"), //
new RegexLeaf("[%s]+"), //
new RegexLeaf("NAME", "([%g][^%g]+[%g]|[^#%s{}]*)"), //
new RegexLeaf("AS", "(?:[%s]+as[%s]+([\\p{L}0-9_.]+))?"), //
new RegexLeaf("[%s]*"), //
@ -97,7 +100,10 @@ public class CommandPackage extends SingleLineCommand2<AbstractEntityDiagram> {
final IEntity p = diagram.getOrCreateGroup(code, Display.getWithNewlines(display), GroupType.PACKAGE,
currentPackage);
final String stereotype = arg.get("STEREOTYPE", 0);
if (stereotype != null) {
final USymbol type = USymbol.getFromString(arg.get("TYPE", 0));
if (type == USymbol.TOGETHER) {
p.setUSymbol(type);
} else if (stereotype != null) {
final USymbol usymbol = USymbol.getFromString(stereotype);
if (usymbol == null) {
p.setStereotype(new Stereotype(stereotype));
@ -116,10 +122,6 @@ public class CommandPackage extends SingleLineCommand2<AbstractEntityDiagram> {
final Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
p.setColors(colors);
// final String color = arg.get("COLOR", 0);
// if (color != null) {
// p.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(color));
// }
return CommandExecutionResult.ok();
}

View File

@ -34,6 +34,7 @@
package net.sourceforge.plantuml.cucadiagram;
import java.awt.geom.Dimension2D;
import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@ -72,7 +73,8 @@ public class BodyEnhanced extends AbstractTextBlock implements TextBlock {
private final boolean manageUrl;
private final Stereotype stereotype;
public BodyEnhanced(List<String> rawBody, FontParam fontParam, ISkinParam skinParam, boolean manageModifier, Stereotype stereotype) {
public BodyEnhanced(List<String> rawBody, FontParam fontParam, ISkinParam skinParam, boolean manageModifier,
Stereotype stereotype) {
this.rawBody = new ArrayList<String>(rawBody);
this.stereotype = stereotype;
this.fontParam = fontParam;
@ -135,15 +137,15 @@ public class BodyEnhanced extends AbstractTextBlock implements TextBlock {
for (ListIterator<String> it = rawBody.listIterator(); it.hasNext();) {
final String s = it.next();
if (manageHorizontalLine && isBlockSeparator(s)) {
blocks.add(decorate(stringBounder, new MethodsOrFieldsArea(members, fontParam, skinParam, align, stereotype),
separator, title));
blocks.add(decorate(stringBounder, new MethodsOrFieldsArea(members, fontParam, skinParam, align,
stereotype), separator, title));
separator = s.charAt(0);
title = getTitle(s, skinParam);
members = new ArrayList<Member>();
} else if (CreoleParser.isTreeStart(s)) {
if (members.size() > 0) {
blocks.add(decorate(stringBounder, new MethodsOrFieldsArea(members, fontParam, skinParam, align, stereotype),
separator, title));
blocks.add(decorate(stringBounder, new MethodsOrFieldsArea(members, fontParam, skinParam, align,
stereotype), separator, title));
}
members = new ArrayList<Member>();
final List<String> allTree = buildAllTree(s, it);
@ -158,8 +160,8 @@ public class BodyEnhanced extends AbstractTextBlock implements TextBlock {
}
}
}
blocks.add(decorate(stringBounder, new MethodsOrFieldsArea(members, fontParam, skinParam, align, stereotype), separator,
title));
blocks.add(decorate(stringBounder, new MethodsOrFieldsArea(members, fontParam, skinParam, align, stereotype),
separator, title));
if (blocks.size() == 1) {
this.area2 = blocks.get(0);
@ -217,4 +219,9 @@ public class BodyEnhanced extends AbstractTextBlock implements TextBlock {
public List<Url> getUrls() {
return Collections.unmodifiableList(urls);
}
public Rectangle2D getInnerPosition(String member, StringBounder stringBounder) {
return getArea(stringBounder).getInnerPosition(member, stringBounder);
}
}

View File

@ -175,10 +175,15 @@ public class QuoteUtils {
"I wanna try even though I could fail", //
"Sometimes we come last but we did our best", //
"If you see something, say something", //
"In theory there is no difference between theory and practice. But, in practice, there is.");
"In theory there is no difference between theory and practice. But, in practice, there is.", //
"Daylight, I must wait for the sunrise. I must think of a new life. And I mustn't give in.", //
"If I cannot bring you comfort then at least I bring you hope", //
"We all must learn from small misfortune, count the blessings that are real", //
"Prepare Three Sealed Envelopes...",
"You know that thing you just did? Don't do that"
// Well I never, was there ever, A cat so clever, as magical Mr Mistoffelees
// Daylight, I must wait for the sunrise. I must think of a new life. And I mustn't give in.
// Do you like your morning tea weak or strong ?
);
private QuoteUtils() {
}

View File

@ -57,8 +57,10 @@ public abstract class USymbol {
public final static USymbol PACKAGE = record("PACKAGE", SkinParameter.PACKAGE, new USymbolFolder(
SkinParameter.PACKAGE));
public final static USymbol FOLDER = record("FOLDER", SkinParameter.FOLDER, new USymbolFolder(SkinParameter.FOLDER));
public final static USymbol RECTANGLE = record("RECTANGLE", SkinParameter.CARD, new USymbolRect(SkinParameter.CARD, HorizontalAlignment.CENTER));
public final static USymbol AGENT = record("AGENT", SkinParameter.AGENT, new USymbolRect(SkinParameter.AGENT, HorizontalAlignment.CENTER));
public final static USymbol RECTANGLE = record("RECTANGLE", SkinParameter.CARD, new USymbolRect(SkinParameter.CARD,
HorizontalAlignment.CENTER));
public final static USymbol AGENT = record("AGENT", SkinParameter.AGENT, new USymbolRect(SkinParameter.AGENT,
HorizontalAlignment.CENTER));
public final static USymbol ACTOR = record("ACTOR", SkinParameter.ACTOR, new USymbolActor());
public final static USymbol USECASE = null;
public final static USymbol COMPONENT1 = record("COMPONENT1", SkinParameter.COMPONENT1, new USymbolComponent1());
@ -95,6 +97,9 @@ public abstract class USymbol {
}
public static USymbol getFromString(String s) {
if (s == null) {
return null;
}
final USymbol result = all.get(StringUtils.goUpperCase(s.replaceAll("\\W", "")));
if (result == null) {
if (s.equalsIgnoreCase("component")) {
@ -173,6 +178,4 @@ public abstract class USymbol {
};
}
}

View File

@ -128,7 +128,7 @@ public class DotPath implements UShape, Moveable {
}
public DotPath(String init, double deltaY) {
if (init.startsWith("M") == false) {
if (isPathConsistent(init) == false) {
throw new IllegalArgumentException();
}
final int posC = init.indexOf("C");
@ -158,6 +158,13 @@ public class DotPath implements UShape, Moveable {
// this.print = triPoints.toString();
}
public static boolean isPathConsistent(String init) {
if (init.startsWith("M") == false) {
return false;
}
return true;
}
// private final String print;
public Point2D getStartPoint() {
@ -551,9 +558,9 @@ public class DotPath implements UShape, Moveable {
}
public DotPath simulateCompound(Cluster head, Cluster tail) {
// if (OptionFlags.USE_COMPOUND) {
// throw new IllegalStateException();
// }
// if (OptionFlags.USE_COMPOUND) {
// throw new IllegalStateException();
// }
if (head == null && tail == null) {
return this;
}

View File

@ -28,11 +28,22 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 19109 $
* Revision $Revision: 19813 $
*
*/
package net.sourceforge.plantuml.sequencediagram;
import net.sourceforge.plantuml.StringUtils;
public enum NotePosition {
LEFT, RIGHT, OVER, OVER_SEVERAL
LEFT, RIGHT, OVER, OVER_SEVERAL;
public static NotePosition defaultLeft(String s) {
if (s == null) {
return NotePosition.LEFT;
}
return NotePosition.valueOf(StringUtils.goUpperCase(s));
}
}

View File

@ -0,0 +1,48 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2017, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* 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.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 19109 $
*
*/
package net.sourceforge.plantuml.sequencediagram;
import net.sourceforge.plantuml.StringUtils;
public enum NoteType {
NOTE, FLOATING_NOTE;
public static NoteType defaultType(String s) {
if (s == null) {
return NoteType.NOTE;
}
return NoteType.valueOf(StringUtils.goUpperCase(s).replace(' ', '_'));
}
}

View File

@ -468,6 +468,9 @@ public class Line implements Moveable, Hideable {
final int end = svg.indexOf("\"", idx + 3);
final String path = svg.substring(idx + 3, end);
if (DotPath.isPathConsistent(path) == false) {
return;
}
dotPath = new DotPath(path, fullHeight);
if (projectionCluster != null) {

View File

@ -43,7 +43,9 @@ public class SmallestEnclosingCircle {
private Circle lastSolution;
public void append(Point2D pt) {
if (all.contains(pt) == false) {
all.add(pt);
}
this.lastSolution = null;
}

View File

@ -67,6 +67,10 @@ public class UTranslate implements UChange {
return dy;
}
public boolean isAlmostSame(UTranslate other) {
return this.dx == other.dx || this.dy == other.dy;
}
public Point2D getTranslated(Point2D p) {
if (p == null) {
return null;

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 19807 $
* Revision $Revision: 19848 $
*
*/
package net.sourceforge.plantuml.version;
@ -39,7 +39,7 @@ import java.util.Date;
public class Version {
public static int version() {
return 8040;
return 8041;
}
public static String versionString() {
@ -63,7 +63,7 @@ public class Version {
}
public static long compileTime() {
return 1462989948158L;
return 1463677540151L;
}
public static String compileTimeString() {