mirror of
https://github.com/octoleo/plantuml.git
synced 2024-11-22 21:15:09 +00:00
WIP
This commit is contained in:
parent
03c34c18c3
commit
7a30afc9be
@ -0,0 +1,48 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2020, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* If you like this project or if you find it useful, you can support us at:
|
||||
*
|
||||
* http://plantuml.com/patreon (only 1$ per month!)
|
||||
* http://plantuml.com/paypal
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram3;
|
||||
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.Gtile;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
|
||||
abstract class AbstractInstruction {
|
||||
|
||||
public Gtile createGtile(ISkinParam skinParam, StringBounder stringBounder) {
|
||||
throw new UnsupportedOperationException("" + getClass());
|
||||
}
|
||||
|
||||
}
|
@ -35,12 +35,15 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram3;
|
||||
|
||||
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.Swimable;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.Gtile;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||
@ -49,6 +52,8 @@ public interface Instruction extends Swimable {
|
||||
|
||||
public Ftile createFtile(FtileFactory factory);
|
||||
|
||||
public Gtile createGtile(ISkinParam skinParam, StringBounder stringBounder);
|
||||
|
||||
public CommandExecutionResult add(Instruction other);
|
||||
|
||||
public boolean kill();
|
||||
@ -56,7 +61,7 @@ public interface Instruction extends Swimable {
|
||||
public LinkRendering getInLinkRendering();
|
||||
|
||||
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors, Swimlane swimlaneNote);
|
||||
|
||||
|
||||
public boolean containsBreak();
|
||||
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
|
||||
public class InstructionGroup implements Instruction, InstructionCollection {
|
||||
public class InstructionGroup extends AbstractInstruction implements Instruction, InstructionCollection {
|
||||
|
||||
private final InstructionList list;
|
||||
private final Instruction parent;
|
||||
@ -68,8 +68,8 @@ public class InstructionGroup implements Instruction, InstructionCollection {
|
||||
return list.containsBreak();
|
||||
}
|
||||
|
||||
public InstructionGroup(Instruction parent, Display test, HColor backColor, HColor titleColor,
|
||||
Swimlane swimlane, HColor borderColor, LinkRendering linkRendering, USymbol type, double roundCorner) {
|
||||
public InstructionGroup(Instruction parent, Display test, HColor backColor, HColor titleColor, Swimlane swimlane,
|
||||
HColor borderColor, LinkRendering linkRendering, USymbol type, double roundCorner) {
|
||||
this.list = new InstructionList(swimlane);
|
||||
this.type = type;
|
||||
this.linkRendering = linkRendering;
|
||||
|
@ -41,14 +41,19 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileDecorateWelding;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileEmpty;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.WeldingPoint;
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.GConnectionVerticalDown;
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.Gtile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.GtileEmpty;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||
@ -58,6 +63,7 @@ public class InstructionList extends WithNote implements Instruction, Instructio
|
||||
private final List<Instruction> all = new ArrayList<>();
|
||||
private final Swimlane defaultSwimlane;
|
||||
|
||||
@Override
|
||||
public boolean containsBreak() {
|
||||
for (Instruction ins : all) {
|
||||
if (ins.containsBreak()) {
|
||||
@ -89,11 +95,31 @@ public class InstructionList extends WithNote implements Instruction, Instructio
|
||||
this.defaultSwimlane = defaultSwimlane;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandExecutionResult add(Instruction ins) {
|
||||
all.add(ins);
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Gtile createGtile(ISkinParam skinParam, StringBounder stringBounder) {
|
||||
if (all.size() == 0) {
|
||||
return new GtileEmpty(stringBounder, skinParam, defaultSwimlane);
|
||||
}
|
||||
Gtile result = null;
|
||||
for (Instruction ins : all) {
|
||||
final Gtile cur = ins.createGtile(skinParam, stringBounder);
|
||||
|
||||
if (result == null) {
|
||||
result = cur;
|
||||
} else {
|
||||
result = new GConnectionVerticalDown(result, cur, ins.getInLinkRendering());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ftile createFtile(FtileFactory factory) {
|
||||
if (all.size() == 0) {
|
||||
return new FtileEmpty(factory.skinParam(), defaultSwimlane);
|
||||
@ -126,6 +152,7 @@ public class InstructionList extends WithNote implements Instruction, Instructio
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
final public boolean kill() {
|
||||
if (all.size() == 0) {
|
||||
return false;
|
||||
@ -133,10 +160,12 @@ public class InstructionList extends WithNote implements Instruction, Instructio
|
||||
return getLast().kill();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinkRendering getInLinkRendering() {
|
||||
return all.iterator().next().getInLinkRendering();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Instruction getLast() {
|
||||
if (all.size() == 0) {
|
||||
return null;
|
||||
@ -144,6 +173,7 @@ public class InstructionList extends WithNote implements Instruction, Instructio
|
||||
return all.get(all.size() - 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors, Swimlane swimlaneNote) {
|
||||
if (getLast() == null) {
|
||||
return super.addNote(note, position, type, colors, swimlaneNote);
|
||||
@ -151,14 +181,17 @@ public class InstructionList extends WithNote implements Instruction, Instructio
|
||||
return getLast().addNote(note, position, type, colors, swimlaneNote);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Swimlane> getSwimlanes() {
|
||||
return getSwimlanes2(all);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Swimlane getSwimlaneIn() {
|
||||
return defaultSwimlane;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Swimlane getSwimlaneOut() {
|
||||
final Set<Swimlane> swimlanes = getSwimlanes();
|
||||
if (swimlanes.size() == 0) {
|
||||
|
@ -46,7 +46,7 @@ import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||
|
||||
public class InstructionPartition implements Instruction {
|
||||
public class InstructionPartition extends AbstractInstruction implements Instruction {
|
||||
|
||||
private final InstructionList list = new InstructionList();
|
||||
private final Instruction parent;
|
||||
@ -54,7 +54,7 @@ public class InstructionPartition implements Instruction {
|
||||
public InstructionPartition(Instruction parent, String partitionTitle) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
|
||||
public Instruction getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
|
||||
public class InstructionRepeat implements Instruction {
|
||||
public class InstructionRepeat extends AbstractInstruction implements Instruction {
|
||||
|
||||
private final InstructionList repeatList;
|
||||
private final Instruction parent;
|
||||
|
@ -37,15 +37,19 @@ package net.sourceforge.plantuml.activitydiagram3;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.Url;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileKilled;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.Gtile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.GtileBox;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
|
||||
public class InstructionSimple extends MonoSwimable implements Instruction {
|
||||
@ -58,6 +62,7 @@ public class InstructionSimple extends MonoSwimable implements Instruction {
|
||||
private final Url url;
|
||||
private final Stereotype stereotype;
|
||||
|
||||
@Override
|
||||
public boolean containsBreak() {
|
||||
return false;
|
||||
}
|
||||
@ -73,6 +78,12 @@ public class InstructionSimple extends MonoSwimable implements Instruction {
|
||||
this.colors = Objects.requireNonNull(colors);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Gtile createGtile(ISkinParam skinParam, StringBounder stringBounder) {
|
||||
return GtileBox.create(stringBounder, colors.mute(skinParam), label, getSwimlaneIn(), style, stereotype);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ftile createFtile(FtileFactory factory) {
|
||||
Ftile result = factory.activity(label, getSwimlaneIn(), style, colors, stereotype);
|
||||
if (url != null) {
|
||||
@ -85,15 +96,18 @@ public class InstructionSimple extends MonoSwimable implements Instruction {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandExecutionResult add(Instruction other) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
final public boolean kill() {
|
||||
this.killed = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinkRendering getInLinkRendering() {
|
||||
return inlinkRendering;
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||
|
||||
public class InstructionSplit implements Instruction {
|
||||
public class InstructionSplit extends AbstractInstruction implements Instruction {
|
||||
|
||||
private final List<InstructionList> splits = new ArrayList<>();
|
||||
private final Instruction parent;
|
||||
|
@ -37,10 +37,15 @@ package net.sourceforge.plantuml.activitydiagram3;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
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.Swimlane;
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.Gtile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.GtileCircleStart;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
|
||||
|
||||
public class InstructionStart extends MonoSwimable implements Instruction {
|
||||
|
||||
@ -50,26 +55,35 @@ public class InstructionStart extends MonoSwimable implements Instruction {
|
||||
super(swimlane);
|
||||
this.inlinkRendering = Objects.requireNonNull(inlinkRendering);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean containsBreak() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Gtile createGtile(ISkinParam skinParam, StringBounder stringBounder) {
|
||||
return new GtileCircleStart(stringBounder, skinParam, HColorUtils.BLACK, getSwimlaneIn(), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ftile createFtile(FtileFactory factory) {
|
||||
Ftile result = factory.start(getSwimlaneIn());
|
||||
result = eventuallyAddNote(factory, result, result.getSwimlaneIn());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandExecutionResult add(Instruction other) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
final public boolean kill() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinkRendering getInLinkRendering() {
|
||||
return inlinkRendering;
|
||||
}
|
||||
|
@ -37,10 +37,15 @@ package net.sourceforge.plantuml.activitydiagram3;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
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.Swimlane;
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.Gtile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.GtileCircleStart;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
|
||||
|
||||
public class InstructionStop extends MonoSwimable implements Instruction {
|
||||
|
||||
@ -50,26 +55,35 @@ public class InstructionStop extends MonoSwimable implements Instruction {
|
||||
super(swimlane);
|
||||
this.inlinkRendering = Objects.requireNonNull(inlinkRendering);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean containsBreak() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Gtile createGtile(ISkinParam skinParam, StringBounder stringBounder) {
|
||||
return new GtileCircleStart(stringBounder, skinParam, HColorUtils.BLACK, getSwimlaneIn(), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ftile createFtile(FtileFactory factory) {
|
||||
Ftile result = factory.stop(getSwimlaneIn());
|
||||
result = eventuallyAddNote(factory, result, result.getSwimlaneIn());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandExecutionResult add(Instruction other) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
final public boolean kill() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinkRendering getInLinkRendering() {
|
||||
return inlinkRendering;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ import java.util.Set;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimable;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
|
||||
public class MonoSwimable extends WithNote implements Swimable {
|
||||
abstract class MonoSwimable extends WithNote implements Swimable {
|
||||
|
||||
private final Swimlane swimlane;
|
||||
|
||||
@ -50,7 +50,7 @@ public class MonoSwimable extends WithNote implements Swimable {
|
||||
}
|
||||
|
||||
final public Set<Swimlane> getSwimlanes() {
|
||||
return swimlane == null ? Collections.<Swimlane> emptySet() : Collections.<Swimlane> singleton(swimlane);
|
||||
return swimlane == null ? Collections.<Swimlane>emptySet() : Collections.<Swimlane>singleton(swimlane);
|
||||
}
|
||||
|
||||
final public Swimlane getSwimlaneIn() {
|
||||
|
@ -47,7 +47,7 @@ import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||
|
||||
public class WithNote {
|
||||
abstract class WithNote extends AbstractInstruction {
|
||||
|
||||
private final Collection<PositionedNote> notes = new ArrayList<>();
|
||||
|
||||
|
@ -48,8 +48,7 @@ public class FtileEmpty extends AbstractFtile {
|
||||
|
||||
private final double width;
|
||||
private final double height;
|
||||
private final Swimlane swimlaneIn;
|
||||
private final Swimlane swimlaneOut;
|
||||
private final Swimlane swimlane;
|
||||
|
||||
@Override
|
||||
public Collection<Ftile> getMyChildren() {
|
||||
@ -57,24 +56,23 @@ public class FtileEmpty extends AbstractFtile {
|
||||
}
|
||||
|
||||
public FtileEmpty(ISkinParam skinParam, double width, double height) {
|
||||
this(skinParam, width, height, null, null);
|
||||
this(skinParam, width, height, null);
|
||||
}
|
||||
|
||||
public FtileEmpty(ISkinParam skinParam, double width, double height, Swimlane swimlaneIn, Swimlane swimlaneOut) {
|
||||
public FtileEmpty(ISkinParam skinParam, double width, double height, Swimlane swimlane) {
|
||||
super(skinParam);
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.swimlaneIn = swimlaneIn;
|
||||
this.swimlaneOut = swimlaneOut;
|
||||
this.swimlane = swimlane;
|
||||
|
||||
}
|
||||
|
||||
public FtileEmpty(ISkinParam skinParam) {
|
||||
this(skinParam, 0, 0, null, null);
|
||||
this(skinParam, 0, 0, null);
|
||||
}
|
||||
|
||||
public FtileEmpty(ISkinParam skinParam, Swimlane swimlane) {
|
||||
this(skinParam, 0, 0, swimlane, swimlane);
|
||||
this(skinParam, 0, 0, swimlane);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -95,20 +93,17 @@ public class FtileEmpty extends AbstractFtile {
|
||||
}
|
||||
|
||||
public Swimlane getSwimlaneIn() {
|
||||
return swimlaneIn;
|
||||
return swimlane;
|
||||
}
|
||||
|
||||
public Swimlane getSwimlaneOut() {
|
||||
return swimlaneOut;
|
||||
return swimlane;
|
||||
}
|
||||
|
||||
public Set<Swimlane> getSwimlanes() {
|
||||
final Set<Swimlane> result = new HashSet<>();
|
||||
if (swimlaneIn != null) {
|
||||
result.add(swimlaneIn);
|
||||
}
|
||||
if (swimlaneOut != null) {
|
||||
result.add(swimlaneOut);
|
||||
if (swimlane != null) {
|
||||
result.add(swimlane);
|
||||
}
|
||||
return Collections.unmodifiableSet(result);
|
||||
}
|
||||
|
@ -61,6 +61,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileFactoryDele
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileFactoryDelegatorWhile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.UGraphicInterceptorOneSwimlane;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.VCompactFactory;
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.Gtile;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
@ -213,6 +214,11 @@ public class Swimlanes extends AbstractTextBlock implements TextBlock, Styleable
|
||||
}
|
||||
|
||||
public final void drawU(UGraphic ug) {
|
||||
if (Gtile.USE_GTILE) {
|
||||
drawGtile(ug);
|
||||
return;
|
||||
}
|
||||
|
||||
TextBlock full = root.createFtile(getFtileFactory(ug.getStringBounder()));
|
||||
|
||||
ug = new UGraphicForSnake(ug);
|
||||
@ -226,6 +232,16 @@ public class Swimlanes extends AbstractTextBlock implements TextBlock, Styleable
|
||||
}
|
||||
}
|
||||
|
||||
private void drawGtile(UGraphic ug) {
|
||||
TextBlock full = root.createGtile(skinParam, ug.getStringBounder());
|
||||
|
||||
ug = new UGraphicForSnake(ug);
|
||||
full = new TextBlockInterceptorUDrawable(full);
|
||||
full.drawU(ug);
|
||||
ug.flushUg();
|
||||
|
||||
}
|
||||
|
||||
private TextBlock getTitle(Swimlane swimlane) {
|
||||
final HorizontalAlignment horizontalAlignment = HorizontalAlignment.LEFT;
|
||||
FontConfiguration fontConfiguration = new FontConfiguration(skinParam, FontParam.SWIMLANE_TITLE, null);
|
||||
|
@ -38,6 +38,7 @@ package net.sourceforge.plantuml.activitydiagram3.ftile;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sourceforge.plantuml.activitydiagram3.gtile.Gtile;
|
||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||
import net.sourceforge.plantuml.graphic.UGraphicDelegator;
|
||||
import net.sourceforge.plantuml.svek.UGraphicForSnake;
|
||||
@ -60,7 +61,11 @@ public class UGraphicInterceptorUDrawable2 extends UGraphicDelegator {
|
||||
}
|
||||
|
||||
public void draw(UShape shape) {
|
||||
if (shape instanceof Ftile) {
|
||||
if (shape instanceof Gtile) {
|
||||
final Gtile gtile = (Gtile) shape;
|
||||
System.err.println("gtile=" + gtile);
|
||||
gtile.drawU(this);
|
||||
} else if (shape instanceof Ftile) {
|
||||
final Ftile ftile = (Ftile) shape;
|
||||
// System.err.println("ftile=" + ftile);
|
||||
ftile.drawU(this);
|
||||
|
@ -36,6 +36,7 @@
|
||||
package net.sourceforge.plantuml.activitydiagram3.ftile;
|
||||
|
||||
import static net.sourceforge.plantuml.utils.ObjectUtils.instanceOfAny;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.ugraphic.MinMax;
|
||||
import net.sourceforge.plantuml.ugraphic.UBackground;
|
||||
|
@ -290,7 +290,7 @@ public class ConditionalBuilder {
|
||||
private Ftile getShape2(Branch branch1, Branch branch2, boolean useNorth) {
|
||||
final Ftile shape2;
|
||||
if (conditionEndStyle == ConditionEndStyle.HLINE) {
|
||||
return new FtileEmpty(tile1.skinParam(), 0, Hexagon.hexagonHalfSize, swimlane, swimlane);
|
||||
return new FtileEmpty(tile1.skinParam(), 0, Hexagon.hexagonHalfSize, swimlane);
|
||||
}
|
||||
// else use default ConditionEndStyle.DIAMOND
|
||||
if (hasTwoBranches()) {
|
||||
@ -307,7 +307,7 @@ public class ConditionalBuilder {
|
||||
tmp = tmp.withEast(tbout2);
|
||||
shape2 = tmp;
|
||||
} else {
|
||||
shape2 = new FtileEmpty(tile1.skinParam(), 0, Hexagon.hexagonHalfSize / 2, swimlane, swimlane);
|
||||
shape2 = new FtileEmpty(tile1.skinParam(), 0, Hexagon.hexagonHalfSize / 2, swimlane);
|
||||
}
|
||||
return shape2;
|
||||
}
|
||||
|
@ -151,32 +151,6 @@ public class FtileBox extends AbstractFtile {
|
||||
return new FtileBox(skinParam, label, swimlane, boxStyle, style, styleArrow);
|
||||
}
|
||||
|
||||
// public static TextBlock createWbs(StyleBuilder styleBuilder, ISkinParam skinParam, Display label,
|
||||
// StyleSignature styleDefinition) {
|
||||
// Style style = null;
|
||||
// Style styleArrow = null;
|
||||
// if (UseStyle.useBetaStyle()) {
|
||||
// style = styleDefinition.getMergedStyle(styleBuilder);
|
||||
// styleArrow = style;
|
||||
// }
|
||||
// return new FtileBox(skinParam, label, null, BoxStyle.PLAIN, style, styleArrow);
|
||||
// }
|
||||
//
|
||||
// public static TextBlock createWbs(Style style, ISkinParam skinParam, Display label) {
|
||||
// Style styleArrow = null;
|
||||
// if (UseStyle.useBetaStyle()) {
|
||||
// styleArrow = style;
|
||||
// }
|
||||
// return new FtileBox(skinParam, label, null, BoxStyle.PLAIN, style, styleArrow);
|
||||
// }
|
||||
//
|
||||
// public static TextBlock createMindMap(StyleBuilder styleBuilder, ISkinParam skinParam, Display label,
|
||||
// StyleSignature styleDefinition) {
|
||||
// final Style style = styleDefinition.getMergedStyle(styleBuilder);
|
||||
// final Style styleArrow = style;
|
||||
// return new FtileBox(skinParam, label, null, BoxStyle.PLAIN, style, styleArrow);
|
||||
// }
|
||||
|
||||
private FtileBox(ISkinParam skinParam, Display label, Swimlane swimlane, BoxStyle boxStyle, Style style,
|
||||
Style styleArrow) {
|
||||
super(skinParam);
|
||||
|
@ -0,0 +1,192 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2020, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* If you like this project or if you find it useful, you can support us at:
|
||||
*
|
||||
* http://plantuml.com/patreon (only 1$ per month!)
|
||||
* http://plantuml.com/paypal
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram3.gtile;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.LineParam;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorSet;
|
||||
|
||||
public abstract class AbstractGtile extends AbstractTextBlock implements Gtile {
|
||||
|
||||
protected final StringBounder stringBounder;
|
||||
private final ISkinParam skinParam;
|
||||
private final Swimlane singleSwimlane;
|
||||
|
||||
public AbstractGtile(StringBounder stringBounder, ISkinParam skinParam, Swimlane singleSwimlane) {
|
||||
this.stringBounder = stringBounder;
|
||||
this.skinParam = skinParam;
|
||||
this.singleSwimlane = singleSwimlane;
|
||||
}
|
||||
|
||||
public StringBounder getStringBounder() {
|
||||
return stringBounder;
|
||||
}
|
||||
|
||||
public AbstractGtile(StringBounder stringBounder, ISkinParam skinParam) {
|
||||
this(stringBounder, skinParam, null);
|
||||
}
|
||||
|
||||
final public ISkinParam skinParam() {
|
||||
if (skinParam == null) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
return skinParam;
|
||||
}
|
||||
|
||||
final public HColorSet getIHtmlColorSet() {
|
||||
return skinParam.getIHtmlColorSet();
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public UTranslate getTranslateFor(Gtile child) {
|
||||
// throw new UnsupportedOperationException();
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// public Collection<Gtile> getMyChildren() {
|
||||
// return Collections.emptySet();
|
||||
// }
|
||||
|
||||
@Override
|
||||
public UTranslate getCoord(String name) {
|
||||
final Dimension2D dim = calculateDimension(stringBounder);
|
||||
if (name.equals(GPoint.NORTH))
|
||||
return new UTranslate(dim.getWidth() / 2, 0);
|
||||
if (name.equals(GPoint.SOUTH))
|
||||
return new UTranslate(dim.getWidth() / 2, dim.getHeight());
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public GPoint getGPoint(String name) {
|
||||
if (name.equals(GPoint.NORTH))
|
||||
return new GPoint(this, GPoint.NORTH);
|
||||
if (name.equals(GPoint.SOUTH))
|
||||
return new GPoint(this, GPoint.SOUTH);
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Swimlane> getSwimlanes() {
|
||||
if (singleSwimlane == null)
|
||||
return Collections.emptySet();
|
||||
return Collections.singleton(singleSwimlane);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Swimlane getSwimlane(String point) {
|
||||
return singleSwimlane;
|
||||
}
|
||||
|
||||
// public LinkRendering getInLinkRendering() {
|
||||
// return LinkRendering.none();
|
||||
// }
|
||||
//
|
||||
// public LinkRendering getOutLinkRendering() {
|
||||
// return LinkRendering.none();
|
||||
// }
|
||||
//
|
||||
// public Collection<Connection> getInnerConnections() {
|
||||
// return Collections.emptyList();
|
||||
// }
|
||||
//
|
||||
// public UTranslate getTranslateFor(Ftile child, StringBounder stringBounder) {
|
||||
// throw new UnsupportedOperationException("" + getClass());
|
||||
// }
|
||||
|
||||
public final UStroke getThickness() {
|
||||
UStroke thickness = skinParam.getThickness(LineParam.activityBorder, null);
|
||||
if (thickness == null) {
|
||||
thickness = new UStroke(1.5);
|
||||
}
|
||||
return thickness;
|
||||
}
|
||||
|
||||
|
||||
final public Ftile getFtile1() {
|
||||
throw new UnsupportedOperationException("WIP1");
|
||||
}
|
||||
|
||||
final public Ftile getFtile2() {
|
||||
throw new UnsupportedOperationException("WIP2");
|
||||
}
|
||||
|
||||
|
||||
|
||||
// public List<WeldingPoint> getWeldingPoints() {
|
||||
// return Collections.emptyList();
|
||||
// }
|
||||
//
|
||||
// public Collection<Ftile> getMyChildren() {
|
||||
// throw new UnsupportedOperationException("" + getClass());
|
||||
// }
|
||||
//
|
||||
// public HorizontalAlignment arrowHorizontalAlignment() {
|
||||
// return skinParam.getHorizontalAlignment(AlignmentParam.arrowMessageAlignment, null, false, null);
|
||||
// }
|
||||
//
|
||||
// private FtileGeometry cachedGeometry;
|
||||
//
|
||||
// final public FtileGeometry calculateDimension(StringBounder stringBounder) {
|
||||
// if (cachedGeometry == null) {
|
||||
// cachedGeometry = calculateDimensionFtile(stringBounder);
|
||||
// }
|
||||
// return cachedGeometry;
|
||||
// }
|
||||
//
|
||||
// abstract protected FtileGeometry calculateDimensionFtile(StringBounder stringBounder);
|
||||
//
|
||||
// @Override
|
||||
// final public MinMax getMinMax(StringBounder stringBounder) {
|
||||
// throw new UnsupportedOperationException();
|
||||
// // return getMinMaxFtile(stringBounder);
|
||||
// }
|
||||
//
|
||||
// // protected MinMax getMinMaxFtile(StringBounder stringBounder) {
|
||||
// // throw new UnsupportedOperationException();
|
||||
// // }
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2020, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* If you like this project or if you find it useful, you can support us at:
|
||||
*
|
||||
* http://plantuml.com/patreon (only 1$ per month!)
|
||||
* http://plantuml.com/paypal
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram3.gtile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface GConnection extends Gtile {
|
||||
|
||||
public List<GPoint> getHooks();
|
||||
|
||||
}
|
@ -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.activitydiagram3.gtile;
|
||||
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.UseStyle;
|
||||
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.ConnectionTranslatable;
|
||||
import net.sourceforge.plantuml.creole.CreoleMode;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
import net.sourceforge.plantuml.style.SName;
|
||||
import net.sourceforge.plantuml.style.Style;
|
||||
import net.sourceforge.plantuml.style.StyleSignature;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class GConnectionVerticalDown extends GtileAssemblySimple implements ConnectionTranslatable {
|
||||
|
||||
private final TextBlock textBlock;
|
||||
|
||||
public GConnectionVerticalDown(Gtile tile1, Gtile tile2, LinkRendering linkRendering) {
|
||||
super(tile1, tile2);
|
||||
this.textBlock = getTextBlock(linkRendering.getDisplay());
|
||||
// See FtileFactoryDelegatorAssembly
|
||||
}
|
||||
|
||||
@Override
|
||||
protected UTranslate supplementaryMove() {
|
||||
final double height = 30 + textBlock.calculateDimension(stringBounder).getHeight();
|
||||
System.err.println("height=" + height);
|
||||
return new UTranslate(0, height);
|
||||
}
|
||||
|
||||
final public StyleSignature getDefaultStyleDefinitionArrow() {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.arrow);
|
||||
}
|
||||
|
||||
protected final TextBlock getTextBlock(Display display) {
|
||||
// DUP3945
|
||||
if (Display.isNull(display)) {
|
||||
return TextBlockUtils.EMPTY_TEXT_BLOCK;
|
||||
}
|
||||
final FontConfiguration fontConfiguration;
|
||||
if (UseStyle.useBetaStyle()) {
|
||||
final Style style = getDefaultStyleDefinitionArrow().getMergedStyle(skinParam().getCurrentStyleBuilder());
|
||||
fontConfiguration = style.getFontConfiguration(skinParam().getThemeStyle(), skinParam().getIHtmlColorSet());
|
||||
} else {
|
||||
fontConfiguration = new FontConfiguration(skinParam(), FontParam.ARROW, null);
|
||||
}
|
||||
return display.create7(fontConfiguration, HorizontalAlignment.LEFT, skinParam(), CreoleMode.SIMPLE_LINE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
}
|
||||
|
||||
// public void drawU(UGraphic ug) {
|
||||
// ug.draw(getSimpleSnake());
|
||||
// }
|
||||
//
|
||||
// public double getMaxX(StringBounder stringBounder) {
|
||||
// return getSimpleSnake().getMaxX(stringBounder);
|
||||
// }
|
||||
//
|
||||
// private Snake getSimpleSnake() {
|
||||
// final Snake snake = Snake.create(color, Arrows.asToDown()).withLabel(textBlock, HorizontalAlignment.LEFT);
|
||||
//// snake.addPoint(p1);
|
||||
//// snake.addPoint(p2);
|
||||
// return snake;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
// final Snake snake = Snake.create(color, Arrows.asToDown()).withLabel(textBlock, HorizontalAlignment.LEFT);
|
||||
// final Point2D mp1a = translate1.getTranslated(p1);
|
||||
// final Point2D mp2b = translate2.getTranslated(p2);
|
||||
// final double middle = (mp1a.getY() + mp2b.getY()) / 2.0;
|
||||
// snake.addPoint(mp1a);
|
||||
// snake.addPoint(mp1a.getX(), middle);
|
||||
// snake.addPoint(mp2b.getX(), middle);
|
||||
// snake.addPoint(mp2b);
|
||||
// ug.draw(snake);
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
@ -0,0 +1,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.activitydiagram3.gtile;
|
||||
|
||||
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class GPoint {
|
||||
|
||||
public static final String NORTH = "NORTH";
|
||||
public static final String SOUTH = "SOUTH";
|
||||
|
||||
private final Gtile gtile;
|
||||
private final String name;
|
||||
private final LinkRendering linkRendering;
|
||||
|
||||
public GPoint(Gtile gtile, String name, LinkRendering linkRendering) {
|
||||
this.gtile = gtile;
|
||||
this.name = name;
|
||||
this.linkRendering = linkRendering;
|
||||
}
|
||||
|
||||
public GPoint(Gtile gtile, String name) {
|
||||
this(gtile, name, LinkRendering.none());
|
||||
}
|
||||
|
||||
public Gtile getGtile() {
|
||||
return gtile;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public UTranslate getCoord() {
|
||||
return gtile.getCoord(name);
|
||||
}
|
||||
|
||||
public LinkRendering getLinkRendering() {
|
||||
return linkRendering;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2020, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* If you like this project or if you find it useful, you can support us at:
|
||||
*
|
||||
* http://plantuml.com/patreon (only 1$ per month!)
|
||||
* http://plantuml.com/paypal
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram3.gtile;
|
||||
|
||||
public interface Gluon {
|
||||
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2020, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* If you like this project or if you find it useful, you can support us at:
|
||||
*
|
||||
* http://plantuml.com/patreon (only 1$ per month!)
|
||||
* http://plantuml.com/paypal
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram3.gtile;
|
||||
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public interface Gtile extends Swimable2, TextBlock {
|
||||
|
||||
public static final boolean USE_GTILE = false;
|
||||
|
||||
public ISkinParam skinParam();
|
||||
|
||||
public StringBounder getStringBounder();
|
||||
|
||||
// public UTranslate getTranslateFor(Gtile child);
|
||||
|
||||
// public Collection<Gtile> getMyChildren();
|
||||
|
||||
public UTranslate getCoord(String name);
|
||||
|
||||
public GPoint getGPoint(String name);
|
||||
|
||||
// public Collection<Connection> getInnerConnections();
|
||||
//
|
||||
// public List<WeldingPoint> getWeldingPoints();
|
||||
//
|
||||
// public HorizontalAlignment arrowHorizontalAlignment();
|
||||
|
||||
}
|
@ -0,0 +1,137 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2020, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* If you like this project or if you find it useful, you can support us at:
|
||||
*
|
||||
* http://plantuml.com/patreon (only 1$ per month!)
|
||||
* http://plantuml.com/paypal
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram3.gtile;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class GtileAssemblySimple extends AbstractGtile implements GConnection {
|
||||
|
||||
protected final Gtile tile1;
|
||||
protected final Gtile tile2;
|
||||
|
||||
protected final Dimension2D dim1;
|
||||
protected final Dimension2D dim2;
|
||||
|
||||
protected final UTranslate pos1;
|
||||
protected final UTranslate pos2;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GtileAssemblySimple " + tile1 + " && " + tile2;
|
||||
}
|
||||
|
||||
public GtileAssemblySimple(Gtile tile1, Gtile tile2) {
|
||||
super(tile1.getStringBounder(), tile1.skinParam());
|
||||
this.tile1 = tile1;
|
||||
this.tile2 = tile2;
|
||||
|
||||
this.dim1 = tile1.calculateDimension(stringBounder);
|
||||
this.dim2 = tile2.calculateDimension(stringBounder);
|
||||
|
||||
final UTranslate vector1 = tile1.getCoord(GPoint.SOUTH);
|
||||
final UTranslate vector2 = tile2.getCoord(GPoint.NORTH);
|
||||
|
||||
final UTranslate diff = vector1.compose(vector2.reverse());
|
||||
|
||||
this.pos1 = diff.getDx() > 0 ? UTranslate.none() : UTranslate.dx(-diff.getDx());
|
||||
this.pos2 = diff.compose(this.pos1);
|
||||
}
|
||||
|
||||
protected UTranslate supplementaryMove() {
|
||||
return new UTranslate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GPoint> getHooks() {
|
||||
return Arrays.asList(tile1.getGPoint(GPoint.SOUTH), tile2.getGPoint(GPoint.SOUTH));
|
||||
}
|
||||
|
||||
@Override
|
||||
public UTranslate getCoord(String name) {
|
||||
if (name.equals(GPoint.NORTH))
|
||||
return getPos1().compose(tile1.getCoord(name));
|
||||
if (name.equals(GPoint.SOUTH))
|
||||
return getPos2().compose(tile2.getCoord(name));
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
private UTranslate getPos1() {
|
||||
return pos1;
|
||||
}
|
||||
|
||||
private UTranslate getPos2() {
|
||||
return pos2.compose(supplementaryMove());
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
ug.apply(getPos1()).draw(tile1);
|
||||
ug.apply(getPos2()).draw(tile2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
||||
final Point2D corner1 = getPos1().getTranslated(dim1);
|
||||
final Point2D corner2 = getPos2().getTranslated(dim2);
|
||||
final double width = Math.max(corner1.getX(), corner2.getX());
|
||||
final double height = Math.max(corner1.getY(), corner2.getY());
|
||||
return new Dimension2DDouble(width, height);
|
||||
}
|
||||
|
||||
public Set<Swimlane> getSwimlanes() {
|
||||
final Set<Swimlane> result = new HashSet<>();
|
||||
result.addAll(tile1.getSwimlanes());
|
||||
result.addAll(tile2.getSwimlanes());
|
||||
return Collections.unmodifiableSet(result);
|
||||
}
|
||||
|
||||
public Collection<Gtile> getMyChildren() {
|
||||
return Arrays.asList(tile1, tile2);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,237 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2020, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* If you like this project or if you find it useful, you can support us at:
|
||||
*
|
||||
* http://plantuml.com/patreon (only 1$ per month!)
|
||||
* http://plantuml.com/paypal
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram3.gtile;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
|
||||
import net.sourceforge.plantuml.ColorParam;
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.LineBreakStrategy;
|
||||
import net.sourceforge.plantuml.SkinParamColors;
|
||||
import net.sourceforge.plantuml.SkinParamUtils;
|
||||
import net.sourceforge.plantuml.UseStyle;
|
||||
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.creole.CreoleMode;
|
||||
import net.sourceforge.plantuml.creole.Parser;
|
||||
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.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.Rainbow;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft;
|
||||
import net.sourceforge.plantuml.style.PName;
|
||||
import net.sourceforge.plantuml.style.SName;
|
||||
import net.sourceforge.plantuml.style.Style;
|
||||
import net.sourceforge.plantuml.style.StyleSignature;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorNone;
|
||||
|
||||
public class GtileBox extends AbstractGtile {
|
||||
|
||||
private final ClockwiseTopRightBottomLeft padding;
|
||||
private final ClockwiseTopRightBottomLeft margin;
|
||||
|
||||
private final TextBlock tb;
|
||||
private double roundCorner = 25;
|
||||
private final double shadowing;
|
||||
private final HorizontalAlignment horizontalAlignment;
|
||||
private double minimumWidth = 0;
|
||||
|
||||
private final LinkRendering inRendering;
|
||||
private final Swimlane swimlane;
|
||||
private final BoxStyle boxStyle;
|
||||
|
||||
private final HColor borderColor;
|
||||
private final HColor backColor;
|
||||
private final Style style;
|
||||
|
||||
static public StyleSignature getDefaultStyleDefinitionActivity() {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activity);
|
||||
}
|
||||
|
||||
static public StyleSignature getDefaultStyleDefinitionArrow() {
|
||||
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.arrow);
|
||||
}
|
||||
|
||||
final public LinkRendering getInLinkRendering() {
|
||||
return inRendering;
|
||||
}
|
||||
|
||||
class MyStencil implements Stencil {
|
||||
|
||||
public double getStartingX(StringBounder stringBounder, double y) {
|
||||
return -padding.getLeft();
|
||||
}
|
||||
|
||||
public double getEndingX(StringBounder stringBounder, double y) {
|
||||
final Dimension2D dim = calculateDimension(stringBounder);
|
||||
return dim.getWidth() - padding.getRight();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static GtileBox create(StringBounder stringBounder, ISkinParam skinParam, Display label, Swimlane swimlane,
|
||||
BoxStyle boxStyle, Stereotype stereotype) {
|
||||
Style style = null;
|
||||
Style styleArrow = null;
|
||||
if (UseStyle.useBetaStyle()) {
|
||||
style = getDefaultStyleDefinitionActivity().with(stereotype)
|
||||
.getMergedStyle(skinParam.getCurrentStyleBuilder());
|
||||
styleArrow = getDefaultStyleDefinitionArrow().getMergedStyle(skinParam.getCurrentStyleBuilder());
|
||||
}
|
||||
return new GtileBox(stringBounder, skinParam, label, swimlane, boxStyle, style, styleArrow);
|
||||
}
|
||||
|
||||
private GtileBox(StringBounder stringBounder, ISkinParam skinParam, Display label, Swimlane swimlane,
|
||||
BoxStyle boxStyle, Style style, Style styleArrow) {
|
||||
super(stringBounder, skinParam);
|
||||
this.style = style;
|
||||
this.boxStyle = boxStyle;
|
||||
this.swimlane = swimlane;
|
||||
final FontConfiguration fc;
|
||||
final LineBreakStrategy wrapWidth;
|
||||
if (UseStyle.useBetaStyle()) {
|
||||
this.inRendering = new LinkRendering(
|
||||
Rainbow.build(styleArrow, getIHtmlColorSet(), skinParam.getThemeStyle()));
|
||||
Colors specBack = null;
|
||||
if (skinParam instanceof SkinParamColors) {
|
||||
specBack = ((SkinParamColors) skinParam).getColors();
|
||||
}
|
||||
style = style.eventuallyOverride(specBack);
|
||||
this.borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet());
|
||||
this.backColor = style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet());
|
||||
fc = style.getFontConfiguration(skinParam.getThemeStyle(), getIHtmlColorSet());
|
||||
this.horizontalAlignment = style.getHorizontalAlignment();
|
||||
this.padding = style.getPadding();
|
||||
this.margin = style.getMargin();
|
||||
this.roundCorner = style.value(PName.RoundCorner).asDouble();
|
||||
this.shadowing = style.value(PName.Shadowing).asDouble();
|
||||
wrapWidth = style.wrapWidth();
|
||||
this.minimumWidth = style.value(PName.MinimumWidth).asDouble();
|
||||
} else {
|
||||
this.padding = ClockwiseTopRightBottomLeft.same(10);
|
||||
this.margin = ClockwiseTopRightBottomLeft.same(0);
|
||||
this.inRendering = new LinkRendering(Rainbow.build(skinParam));
|
||||
this.borderColor = SkinParamUtils.getColor(skinParam(), null, ColorParam.activityBorder);
|
||||
this.backColor = SkinParamUtils.getColor(skinParam(), null, ColorParam.activityBackground);
|
||||
fc = new FontConfiguration(skinParam, FontParam.ACTIVITY, null);
|
||||
this.horizontalAlignment = HorizontalAlignment.LEFT;
|
||||
this.shadowing = skinParam().shadowing(null) ? 3.0 : 0.0;
|
||||
wrapWidth = skinParam.wrapWidth();
|
||||
|
||||
}
|
||||
final Sheet sheet = Parser
|
||||
.build(fc, skinParam.getDefaultTextAlignment(horizontalAlignment), skinParam, CreoleMode.FULL)
|
||||
.createSheet(label);
|
||||
this.tb = new SheetBlock2(new SheetBlock1(sheet, wrapWidth, skinParam.getPadding()), new MyStencil(),
|
||||
new UStroke(1));
|
||||
this.print = label.toString();
|
||||
|
||||
}
|
||||
|
||||
final private String print;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return print;
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
final Dimension2D dimTotal = calculateDimension(ug.getStringBounder());
|
||||
final double widthTotal = dimTotal.getWidth();
|
||||
final double heightTotal = dimTotal.getHeight();
|
||||
final UDrawable shape = boxStyle.getUDrawable(widthTotal, heightTotal, shadowing, roundCorner);
|
||||
|
||||
final UStroke thickness;
|
||||
if (UseStyle.useBetaStyle()) {
|
||||
thickness = style.getStroke();
|
||||
} else {
|
||||
thickness = getThickness();
|
||||
}
|
||||
|
||||
if (borderColor == null) {
|
||||
ug = ug.apply(new HColorNone());
|
||||
} else {
|
||||
ug = ug.apply(borderColor);
|
||||
}
|
||||
if (backColor == null) {
|
||||
ug = ug.apply(new HColorNone().bg());
|
||||
} else {
|
||||
ug = ug.apply(backColor.bg());
|
||||
}
|
||||
|
||||
ug = ug.apply(thickness);
|
||||
shape.drawU(ug);
|
||||
|
||||
if (horizontalAlignment == HorizontalAlignment.LEFT) {
|
||||
tb.drawU(ug.apply(new UTranslate(padding.getLeft(), padding.getTop())));
|
||||
} else if (horizontalAlignment == HorizontalAlignment.RIGHT) {
|
||||
final Dimension2D dimTb = tb.calculateDimension(ug.getStringBounder());
|
||||
tb.drawU(ug.apply(
|
||||
new UTranslate(dimTotal.getWidth() - dimTb.getWidth() - padding.getRight(), padding.getBottom())));
|
||||
} else if (horizontalAlignment == HorizontalAlignment.CENTER) {
|
||||
final Dimension2D dimTb = tb.calculateDimension(ug.getStringBounder());
|
||||
tb.drawU(ug.apply(new UTranslate((dimTotal.getWidth() - dimTb.getWidth()) / 2, padding.getBottom())));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Dimension2D calculateDimension(StringBounder stringBounder) {
|
||||
Dimension2D dimRaw = tb.calculateDimension(stringBounder);
|
||||
dimRaw = Dimension2DDouble.delta(dimRaw, padding.getLeft() + padding.getRight(),
|
||||
padding.getBottom() + padding.getTop());
|
||||
dimRaw = Dimension2DDouble.atLeast(dimRaw, minimumWidth, 0);
|
||||
return new FtileGeometry(dimRaw.getWidth() + boxStyle.getShield(), dimRaw.getHeight(), dimRaw.getWidth() / 2, 0,
|
||||
dimRaw.getHeight());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2020, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* If you like this project or if you find it useful, you can support us at:
|
||||
*
|
||||
* http://plantuml.com/patreon (only 1$ per month!)
|
||||
* http://plantuml.com/paypal
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram3.gtile;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.UseStyle;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.style.PName;
|
||||
import net.sourceforge.plantuml.style.Style;
|
||||
import net.sourceforge.plantuml.ugraphic.UEllipse;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorNone;
|
||||
|
||||
public class GtileCircleStart extends AbstractGtile {
|
||||
|
||||
private static final int SIZE = 20;
|
||||
|
||||
private final HColor backColor;
|
||||
private double shadowing;
|
||||
|
||||
public GtileCircleStart(StringBounder stringBounder, ISkinParam skinParam, HColor backColor, Swimlane swimlane,
|
||||
Style style) {
|
||||
super(stringBounder, skinParam, swimlane);
|
||||
this.backColor = backColor;
|
||||
if (UseStyle.useBetaStyle()) {
|
||||
this.shadowing = style.value(PName.Shadowing).asDouble();
|
||||
} else {
|
||||
if (skinParam().shadowing(null)) {
|
||||
this.shadowing = 3;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
final UEllipse circle = new UEllipse(SIZE, SIZE);
|
||||
circle.setDeltaShadow(shadowing);
|
||||
ug.apply(new HColorNone()).apply(backColor.bg()).draw(circle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
||||
return new Dimension2DDouble(SIZE, SIZE);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,107 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2020, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* If you like this project or if you find it useful, you can support us at:
|
||||
*
|
||||
* http://plantuml.com/patreon (only 1$ per month!)
|
||||
* http://plantuml.com/paypal
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram3.gtile;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
|
||||
public class GtileEmpty extends AbstractGtile {
|
||||
|
||||
private final double width;
|
||||
private final double height;
|
||||
|
||||
public GtileEmpty(StringBounder stringBounder, ISkinParam skinParam, double width, double height) {
|
||||
this(stringBounder, skinParam, width, height, null);
|
||||
}
|
||||
|
||||
public GtileEmpty(StringBounder stringBounder, ISkinParam skinParam) {
|
||||
this(stringBounder, skinParam, 0, 0, null);
|
||||
}
|
||||
|
||||
public GtileEmpty(StringBounder stringBounder, ISkinParam skinParam, Swimlane swimlane) {
|
||||
this(stringBounder, skinParam, 0, 0, swimlane);
|
||||
}
|
||||
|
||||
public GtileEmpty(StringBounder stringBounder, ISkinParam skinParam, double width, double height, Swimlane swimlane) {
|
||||
super(stringBounder, skinParam, swimlane);
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "FtileEmpty";
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
||||
return new Dimension2DDouble(width, height);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// protected FtileGeometry calculateDimensionFtile(StringBounder stringBounder) {
|
||||
// return calculateDimensionEmpty();
|
||||
// }
|
||||
//
|
||||
// final protected FtileGeometry calculateDimensionEmpty() {
|
||||
// return new FtileGeometry(width, height, width / 2, 0, height);
|
||||
// }
|
||||
//
|
||||
// public Swimlane getSwimlaneIn() {
|
||||
// return swimlane;
|
||||
// }
|
||||
//
|
||||
// public Swimlane getSwimlaneOut() {
|
||||
// return swimlane;
|
||||
// }
|
||||
//
|
||||
// public Set<Swimlane> getSwimlanes() {
|
||||
// final Set<Swimlane> result = new HashSet<>();
|
||||
// if (swimlane != null) {
|
||||
// result.add(swimlane);
|
||||
// }
|
||||
// return Collections.unmodifiableSet(result);
|
||||
// }
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2020, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* If you like this project or if you find it useful, you can support us at:
|
||||
*
|
||||
* http://plantuml.com/patreon (only 1$ per month!)
|
||||
* http://plantuml.com/paypal
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram3.gtile;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
|
||||
public interface Swimable2 {
|
||||
|
||||
public Set<Swimlane> getSwimlanes();
|
||||
|
||||
public Swimlane getSwimlane(String point);
|
||||
|
||||
}
|
@ -228,16 +228,16 @@ public final class AtomText extends AbstractAtom implements Atom {
|
||||
final List<String> result = new ArrayList<>();
|
||||
for (int i = 0; i < text.length(); i++) {
|
||||
final char ch = text.charAt(i);
|
||||
if (isOfWord(ch)) {
|
||||
if (isSeparator(ch)) {
|
||||
result.add("" + text.charAt(i));
|
||||
} else {
|
||||
final StringBuilder tmp = new StringBuilder();
|
||||
tmp.append(ch);
|
||||
while (i + 1 < text.length() && isOfWord(text.charAt(i + 1))) {
|
||||
while (i + 1 < text.length() && isSeparator(text.charAt(i + 1)) == false) {
|
||||
i++;
|
||||
tmp.append(text.charAt(i));
|
||||
}
|
||||
result.add(tmp.toString());
|
||||
} else {
|
||||
result.add("" + text.charAt(i));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@ -289,8 +289,14 @@ public final class AtomText extends AbstractAtom implements Atom {
|
||||
return Collections.singletonList((Atom) this);
|
||||
}
|
||||
|
||||
private boolean isOfWord(char ch) {
|
||||
return Character.isWhitespace(ch) == false;
|
||||
private boolean isSeparator(char ch) {
|
||||
return Character.isWhitespace(ch) //
|
||||
|| ch == '\uFF0C' // U+FF0C FULLWIDTH COMMA (,)
|
||||
|| ch == '\uFF01' // U+FF01 FULLWIDTH EXCLAMATION MARK (!)
|
||||
|| ch == '\uFF1F' // U+FF1F FULLWIDTH QUESTION MARK (?)
|
||||
|| ch == '\uFF1B' // U+FF1B FULLWIDTH SEMICOLON (;)
|
||||
|| ch == '\uFF1A' // U+FF1A FULLWIDTH COLON (:)
|
||||
|| ch == '\u3002'; // U+3002 IDEOGRAPHIC FULL STOP (.)
|
||||
}
|
||||
|
||||
public final String getText() {
|
||||
|
@ -35,9 +35,9 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.png;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Iterator;
|
||||
|
||||
import javax.imageio.ImageReader;
|
||||
@ -47,12 +47,12 @@ import javax.imageio.stream.ImageInputStream;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import net.sourceforge.plantuml.security.SImageIO;
|
||||
import net.sourceforge.plantuml.security.SFile;
|
||||
import net.sourceforge.plantuml.security.SImageIO;
|
||||
|
||||
public class MetadataTag {
|
||||
|
||||
private final File source;
|
||||
private final Object source;
|
||||
private final String tag;
|
||||
|
||||
public MetadataTag(SFile file, String tag) throws FileNotFoundException {
|
||||
@ -65,6 +65,11 @@ public class MetadataTag {
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
public MetadataTag(InputStream is, String tag) {
|
||||
this.source = is;
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
public String getData() throws IOException {
|
||||
final ImageInputStream iis = SImageIO.createImageInputStream(source);
|
||||
final Iterator<ImageReader> readers = SImageIO.getImageReaders(iis);
|
||||
|
@ -38,7 +38,6 @@ package net.sourceforge.plantuml.security;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.RenderedImage;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
@ -83,10 +82,10 @@ public class SImageIO {
|
||||
return javax.imageio.ImageIO.createImageInputStream(file.conv());
|
||||
}
|
||||
|
||||
public static ImageInputStream createImageInputStream(File obj) throws IOException {
|
||||
// if (obj instanceof SFile) {
|
||||
// obj = ((SFile) obj).conv();
|
||||
// }
|
||||
public static ImageInputStream createImageInputStream(Object obj) throws IOException {
|
||||
if (obj instanceof SFile) {
|
||||
obj = ((SFile) obj).conv();
|
||||
}
|
||||
return javax.imageio.ImageIO.createImageInputStream(obj);
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.ugraphic;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
|
||||
@ -92,6 +93,10 @@ public class UTranslate implements UChange {
|
||||
return new Point2D.Double(p.getX() + dx, p.getY() + dy);
|
||||
}
|
||||
|
||||
public Point2D getTranslated(Dimension2D dim) {
|
||||
return new Point2D.Double(dim.getWidth() + dx, dim.getHeight() + dy);
|
||||
}
|
||||
|
||||
public UTranslate scaled(double scale) {
|
||||
return new UTranslate(dx * scale, dy * scale);
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ public class Version {
|
||||
}
|
||||
|
||||
public static int beta() {
|
||||
final int beta = 7;
|
||||
final int beta = 8;
|
||||
return beta;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user