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

Import version 1.2020.18

This commit is contained in:
Arnaud Roques 2020-09-30 22:57:58 +02:00
parent b27fa50b50
commit 58936dc235
153 changed files with 1692 additions and 926 deletions

View File

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

View File

@ -60,6 +60,29 @@ import net.sourceforge.plantuml.ugraphic.UShape;
public class EmbeddedDiagram implements CharSequence { public class EmbeddedDiagram implements CharSequence {
public static String getEmbeddedType(CharSequence s) {
if (s == null) {
return null;
}
s = StringUtils.trin(s.toString());
if (s.equals("{{")) {
return "uml";
}
if (s.equals("{{uml")) {
return "uml";
}
if (s.equals("{{wbs")) {
return "wbs";
}
if (s.equals("{{mindmap")) {
return "mindmap";
}
if (s.equals("{{gantt")) {
return "gantt";
}
return null;
}
private final Display system; private final Display system;
public EmbeddedDiagram(Display system) { public EmbeddedDiagram(Display system) {
@ -131,10 +154,12 @@ public class EmbeddedDiagram implements CharSequence {
} }
private String getImageSvg() throws IOException, InterruptedException { private String getImageSvg() throws IOException, InterruptedException {
final boolean sav = SkinParam.USE_STYLES();
final Diagram system = getSystem(); final Diagram system = getSystem();
final ByteArrayOutputStream os = new ByteArrayOutputStream(); final ByteArrayOutputStream os = new ByteArrayOutputStream();
system.exportDiagram(os, 0, new FileFormatOption(FileFormat.SVG)); system.exportDiagram(os, 0, new FileFormatOption(FileFormat.SVG));
os.close(); os.close();
SkinParam.setBetaStyle(sav);
return new String(os.toByteArray()); return new String(os.toByteArray());
} }

View File

@ -126,8 +126,6 @@ public interface ISkinParam extends ISkinSimple {
public ConditionEndStyle getConditionEndStyle(); public ConditionEndStyle getConditionEndStyle();
public double minClassWidth();
public boolean sameClassWidth(); public boolean sameClassWidth();
public Rankdir getRankdir(); public Rankdir getRankdir();

View File

@ -62,4 +62,6 @@ public interface ISkinSimple extends SpriteContainer {
public void copyAllFrom(ISkinSimple other); public void copyAllFrom(ISkinSimple other);
public double minClassWidth();
} }

View File

@ -78,7 +78,7 @@ import net.sourceforge.plantuml.openiconic.PSystemListOpenIconicFactory;
import net.sourceforge.plantuml.openiconic.PSystemOpenIconicFactory; import net.sourceforge.plantuml.openiconic.PSystemOpenIconicFactory;
import net.sourceforge.plantuml.oregon.PSystemOregonFactory; import net.sourceforge.plantuml.oregon.PSystemOregonFactory;
import net.sourceforge.plantuml.project.GanttDiagramFactory; import net.sourceforge.plantuml.project.GanttDiagramFactory;
import net.sourceforge.plantuml.salt.PSystemSaltFactory; import net.sourceforge.plantuml.salt.PSystemSaltFactory2;
import net.sourceforge.plantuml.security.SecurityProfile; import net.sourceforge.plantuml.security.SecurityProfile;
import net.sourceforge.plantuml.security.SecurityUtils; import net.sourceforge.plantuml.security.SecurityUtils;
import net.sourceforge.plantuml.sequencediagram.SequenceDiagramFactory; import net.sourceforge.plantuml.sequencediagram.SequenceDiagramFactory;
@ -168,8 +168,8 @@ public class PSystemBuilder {
factories.add(new PSystemOpenIconicFactory()); factories.add(new PSystemOpenIconicFactory());
factories.add(new PSystemListOpenIconicFactory()); factories.add(new PSystemListOpenIconicFactory());
factories.add(new PSystemListInternalSpritesFactory()); factories.add(new PSystemListInternalSpritesFactory());
factories.add(new PSystemSaltFactory(DiagramType.SALT)); factories.add(new PSystemSaltFactory2(DiagramType.SALT));
factories.add(new PSystemSaltFactory(DiagramType.UML)); factories.add(new PSystemSaltFactory2(DiagramType.UML));
factories.add(new PSystemDotFactory(DiagramType.DOT)); factories.add(new PSystemDotFactory(DiagramType.DOT));
factories.add(new PSystemDotFactory(DiagramType.UML)); factories.add(new PSystemDotFactory(DiagramType.UML));
factories.add(new NwDiagramFactory()); factories.add(new NwDiagramFactory());

View File

@ -59,7 +59,7 @@ import net.sourceforge.plantuml.classdiagram.ClassDiagramFactory;
import net.sourceforge.plantuml.code.NoPlantumlCompressionException; import net.sourceforge.plantuml.code.NoPlantumlCompressionException;
import net.sourceforge.plantuml.code.Transcoder; import net.sourceforge.plantuml.code.Transcoder;
import net.sourceforge.plantuml.code.TranscoderUtil; import net.sourceforge.plantuml.code.TranscoderUtil;
import net.sourceforge.plantuml.command.UmlDiagramFactory; import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.descdiagram.DescriptionDiagramFactory; import net.sourceforge.plantuml.descdiagram.DescriptionDiagramFactory;
import net.sourceforge.plantuml.ftp.FtpServer; import net.sourceforge.plantuml.ftp.FtpServer;
import net.sourceforge.plantuml.png.MetadataTag; import net.sourceforge.plantuml.png.MetadataTag;
@ -349,7 +349,7 @@ public class Run {
// printPattern(new ObjectDiagramFactory(null)); // printPattern(new ObjectDiagramFactory(null));
} }
private static void printPattern(UmlDiagramFactory factory) { private static void printPattern(PSystemCommandFactory factory) {
System.out.println(); System.out.println();
System.out.println(factory.getClass().getSimpleName().replaceAll("Factory", "")); System.out.println(factory.getClass().getSimpleName().replaceAll("Factory", ""));
final List<String> descriptions = factory.getDescription(); final List<String> descriptions = factory.getDescription();

View File

@ -94,4 +94,8 @@ public class SpriteContainerEmpty implements SpriteContainer, ISkinSimple {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
public double minClassWidth() {
return 0;
}
} }

View File

@ -37,10 +37,7 @@ package net.sourceforge.plantuml;
import java.io.IOException; import java.io.IOException;
import net.sourceforge.plantuml.command.BlocLines;
import net.sourceforge.plantuml.command.CommandControl;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.CommandSkinParamMultilines;
import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.DisplayPositionned; import net.sourceforge.plantuml.cucadiagram.DisplayPositionned;
@ -48,6 +45,7 @@ import net.sourceforge.plantuml.cucadiagram.DisplaySection;
import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.VerticalAlignment; import net.sourceforge.plantuml.graphic.VerticalAlignment;
import net.sourceforge.plantuml.sprite.Sprite; import net.sourceforge.plantuml.sprite.Sprite;
import net.sourceforge.plantuml.style.StyleBuilder;
public abstract class TitledDiagram extends AbstractPSystem implements Diagram, Annotated { public abstract class TitledDiagram extends AbstractPSystem implements Diagram, Annotated {
@ -61,10 +59,20 @@ public abstract class TitledDiagram extends AbstractPSystem implements Diagram,
private final SkinParam skinParam; private final SkinParam skinParam;
private final Pragma pragma = new Pragma();
public Pragma getPragma() {
return pragma;
}
public TitledDiagram() { public TitledDiagram() {
this.skinParam = SkinParam.create(getUmlDiagramType()); this.skinParam = SkinParam.create(getUmlDiagramType());
} }
public final StyleBuilder getCurrentStyleBuilder() {
return skinParam.getCurrentStyleBuilder();
}
public TitledDiagram(ISkinSimple orig) { public TitledDiagram(ISkinSimple orig) {
this(); this();
if (orig != null) { if (orig != null) {
@ -179,4 +187,25 @@ public abstract class TitledDiagram extends AbstractPSystem implements Diagram,
return mainFrame; return mainFrame;
} }
private boolean useJDot;
public void setUseJDot(boolean useJDot) {
this.useJDot = useJDot;
}
public static final boolean FORCE_JDOT = false;
public boolean isUseJDot() {
if (FORCE_JDOT)
return true;
return useJDot;
}
public final double getScaleCoef(FileFormatOption fileFormatOption) {
if (getSkinParam().getDpi() == 96) {
return fileFormatOption.getScaleCoef();
}
return getSkinParam().getDpi() * fileFormatOption.getScaleCoef() / 96.0;
}
} }

View File

@ -55,10 +55,7 @@ import javax.script.ScriptException;
import net.sourceforge.plantuml.anim.Animation; import net.sourceforge.plantuml.anim.Animation;
import net.sourceforge.plantuml.anim.AnimationDecoder; import net.sourceforge.plantuml.anim.AnimationDecoder;
import net.sourceforge.plantuml.api.ImageDataSimple; import net.sourceforge.plantuml.api.ImageDataSimple;
import net.sourceforge.plantuml.command.BlocLines;
import net.sourceforge.plantuml.command.CommandControl;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.CommandSkinParamMultilines;
import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
@ -75,7 +72,6 @@ import net.sourceforge.plantuml.pdf.PdfConverter;
import net.sourceforge.plantuml.security.ImageIO; import net.sourceforge.plantuml.security.ImageIO;
import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.security.SFile;
import net.sourceforge.plantuml.security.SecurityUtils; import net.sourceforge.plantuml.security.SecurityUtils;
import net.sourceforge.plantuml.sprite.Sprite;
import net.sourceforge.plantuml.svek.EmptySvgException; import net.sourceforge.plantuml.svek.EmptySvgException;
import net.sourceforge.plantuml.svek.GraphvizCrash; import net.sourceforge.plantuml.svek.GraphvizCrash;
import net.sourceforge.plantuml.svek.TextBlockBackcolored; import net.sourceforge.plantuml.svek.TextBlockBackcolored;
@ -97,7 +93,6 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot
private int minwidth = Integer.MAX_VALUE; private int minwidth = Integer.MAX_VALUE;
private final Pragma pragma = new Pragma();
private Animation animation; private Animation animation;
public UmlDiagram() { public UmlDiagram() {
@ -134,10 +129,6 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
public Pragma getPragma() {
return pragma;
}
final public void setAnimation(Iterable<CharSequence> animationData) { final public void setAnimation(Iterable<CharSequence> animationData) {
try { try {
final AnimationDecoder animationDecoder = new AnimationDecoder(animationData); final AnimationDecoder animationDecoder = new AnimationDecoder(animationData);
@ -152,13 +143,6 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot
return animation; return animation;
} }
public final double getScaleCoef(FileFormatOption fileFormatOption) {
if (getSkinParam().getDpi() == 96) {
return fileFormatOption.getScaleCoef();
}
return getSkinParam().getDpi() * fileFormatOption.getScaleCoef() / 96.0;
}
public final boolean isHideUnlinkedData() { public final boolean isHideUnlinkedData() {
return hideUnlinkedData; return hideUnlinkedData;
} }
@ -242,8 +226,7 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot
graphicStrings.drawU(ug); graphicStrings.drawU(ug);
final double height = graphicStrings.calculateDimension(ug.getStringBounder()).getHeight(); final double height = graphicStrings.calculateDimension(ug.getStringBounder()).getHeight();
ug = ug.apply(UTranslate.dy(height)); ug = ug.apply(UTranslate.dy(height));
ug.draw(new UImage(new PixelImage(im, AffineTransformType.TYPE_NEAREST_NEIGHBOR)) ug.draw(new UImage(new PixelImage(im, AffineTransformType.TYPE_NEAREST_NEIGHBOR)).scale(3));
.scale(3));
} }
}); });
} }
@ -327,7 +310,7 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot
private ImageData exportDiagramInternalPdf(OutputStream os, int index) throws IOException { private ImageData exportDiagramInternalPdf(OutputStream os, int index) throws IOException {
final File svg = FileUtils.createTempFileLegacy("pdf", ".svf"); final File svg = FileUtils.createTempFileLegacy("pdf", ".svf");
final File pdfFile = FileUtils.createTempFileLegacy("pdf", ".pdf"); final File pdfFile = FileUtils.createTempFileLegacy("pdf", ".pdf");
final OutputStream fos = new BufferedOutputStream(new FileOutputStream(svg));; final OutputStream fos = new BufferedOutputStream(new FileOutputStream(svg));
final ImageData result = exportDiagram(fos, index, new FileFormatOption(FileFormat.SVG)); final ImageData result = exportDiagram(fos, index, new FileFormatOption(FileFormat.SVG));
fos.close(); fos.close();
PdfConverter.convert(svg, pdfFile); PdfConverter.convert(svg, pdfFile);
@ -384,21 +367,6 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot
return null; return null;
} }
private boolean useJDot;
public void setUseJDot(boolean useJDot) {
this.useJDot = useJDot;
}
public static final boolean FORCE_JDOT = false;
public boolean isUseJDot() {
if (FORCE_JDOT)
return true;
return useJDot;
}
public void setHideEmptyDescription(boolean hideEmptyDescription) { public void setHideEmptyDescription(boolean hideEmptyDescription) {
} }

View File

@ -39,7 +39,7 @@ import net.sourceforge.plantuml.style.SName;
public enum UmlDiagramType { public enum UmlDiagramType {
SEQUENCE, STATE, CLASS, OBJECT, ACTIVITY, DESCRIPTION, COMPOSITE, FLOW, TIMING, BPM, NWDIAG, MINDMAP, WBS, WIRE, SEQUENCE, STATE, CLASS, OBJECT, ACTIVITY, DESCRIPTION, COMPOSITE, FLOW, TIMING, BPM, NWDIAG, MINDMAP, WBS, WIRE,
HELP, GANTT; HELP, GANTT, SALT;
public SName getStyleName() { public SName getStyleName() {
if (this == SEQUENCE) { if (this == SEQUENCE) {
@ -72,6 +72,9 @@ public enum UmlDiagramType {
if (this == GANTT) { if (this == GANTT) {
return SName.ganttDiagram; return SName.ganttDiagram;
} }
if (this == SALT) {
return SName.saltDiagram;
}
return SName.activityDiagram; return SName.activityDiagram;
} }
} }

View File

@ -50,11 +50,11 @@ import net.sourceforge.plantuml.classdiagram.command.CommandHideShow2;
import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommandFootboxIgnored; import net.sourceforge.plantuml.command.CommandFootboxIgnored;
import net.sourceforge.plantuml.command.CommandRankDir; import net.sourceforge.plantuml.command.CommandRankDir;
import net.sourceforge.plantuml.command.UmlDiagramFactory; import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.command.note.CommandFactoryNoteActivity; import net.sourceforge.plantuml.command.note.CommandFactoryNoteActivity;
import net.sourceforge.plantuml.command.note.CommandFactoryNoteOnLink; import net.sourceforge.plantuml.command.note.CommandFactoryNoteOnLink;
public class ActivityDiagramFactory extends UmlDiagramFactory { public class ActivityDiagramFactory extends PSystemCommandFactory {
private final ISkinSimple skinParam; private final ISkinSimple skinParam;

View File

@ -86,9 +86,9 @@ import net.sourceforge.plantuml.activitydiagram3.command.CommandWhileEnd3;
import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommandDecoratorMultine; import net.sourceforge.plantuml.command.CommandDecoratorMultine;
import net.sourceforge.plantuml.command.CommandFootboxIgnored; import net.sourceforge.plantuml.command.CommandFootboxIgnored;
import net.sourceforge.plantuml.command.UmlDiagramFactory; import net.sourceforge.plantuml.command.PSystemCommandFactory;
public class ActivityDiagramFactory3 extends UmlDiagramFactory { public class ActivityDiagramFactory3 extends PSystemCommandFactory {
private final ISkinSimple skinParam; private final ISkinSimple skinParam;

View File

@ -52,7 +52,7 @@ import net.sourceforge.plantuml.ugraphic.color.HColor;
public class InstructionRepeat implements Instruction { public class InstructionRepeat implements Instruction {
private final InstructionList repeatList = new InstructionList(); private final InstructionList repeatList;
private final Instruction parent; private final Instruction parent;
private final LinkRendering nextLinkRenderer; private final LinkRendering nextLinkRenderer;
private final Swimlane swimlane; private final Swimlane swimlane;
@ -78,6 +78,7 @@ public class InstructionRepeat implements Instruction {
public InstructionRepeat(Swimlane swimlane, Instruction parent, LinkRendering nextLinkRenderer, HColor color, public InstructionRepeat(Swimlane swimlane, Instruction parent, LinkRendering nextLinkRenderer, HColor color,
Display startLabel, BoxStyle boxStyleIn, Colors colors) { Display startLabel, BoxStyle boxStyleIn, Colors colors) {
this.repeatList = new InstructionList(swimlane);
this.boxStyleIn = boxStyleIn; this.boxStyleIn = boxStyleIn;
this.startLabel = startLabel; this.startLabel = startLabel;
this.parent = parent; this.parent = parent;

View File

@ -39,12 +39,16 @@ import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.LineParam; import net.sourceforge.plantuml.LineParam;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
@ -52,6 +56,13 @@ public class EntityImageLegend {
public static TextBlock create(Display note, ISkinParam skinParam) { public static TextBlock create(Display note, ISkinParam skinParam) {
if (SkinParam.USE_STYLES()) {
final Style style = StyleSignature
.of(SName.root, skinParam.getUmlDiagramType().getStyleName(), SName.legend)
.getMergedStyle(skinParam.getCurrentStyleBuilder());
return style.createTextBlockBordered(note, skinParam.getIHtmlColorSet(), skinParam);
}
final TextBlock textBlock = note.create(new FontConfiguration(skinParam, FontParam.LEGEND, null), final TextBlock textBlock = note.create(new FontConfiguration(skinParam, FontParam.LEGEND, null),
HorizontalAlignment.LEFT, skinParam); HorizontalAlignment.LEFT, skinParam);
final Rose rose = new Rose(); final Rose rose = new Rose();

View File

@ -218,7 +218,7 @@ public class FtileWithNoteOpale extends AbstractFtile implements Stencil, Stylea
final Point2D pp2 = new Point2D.Double(-suppSpace, dimNote.getHeight() / 2); final Point2D pp2 = new Point2D.Double(-suppSpace, dimNote.getHeight() / 2);
opale.setOpale(strategy, pp1, pp2); opale.setOpale(strategy, pp1, pp2);
} }
if (swimlaneNote == null || intoSw == swimlaneNote) { if (ug instanceof UGraphicInterceptorOneSwimlane == false || swimlaneNote == null || intoSw == swimlaneNote) {
opale.drawU(ug.apply(getTranslateForOpale(ug))); opale.drawU(ug.apply(getTranslateForOpale(ug)));
} }
ug.apply(getTranslate(stringBounder)).draw(tile); ug.apply(getTranslate(stringBounder)).draw(tile);

View File

@ -92,8 +92,9 @@ public class BpmDiagram extends UmlDiagram {
margin1 = 10; margin1 = 10;
margin2 = 10; margin2 = 10;
} }
final ImageBuilder imageBuilder = ImageBuilder.buildD(getSkinParam(), ClockwiseTopRightBottomLeft.margin1margin2((double) margin1, (double) margin2), getAnimation(), fileFormatOption.isWithMetadata() ? getMetadata() : null, final ImageBuilder imageBuilder = ImageBuilder.buildD(getSkinParam(),
getWarningOrError(), dpiFactor); ClockwiseTopRightBottomLeft.margin1margin2(margin1, margin2), getAnimation(),
fileFormatOption.isWithMetadata() ? getMetadata() : null, getWarningOrError(), dpiFactor);
imageBuilder.setUDrawable(getUDrawable()); imageBuilder.setUDrawable(getUDrawable());
return imageBuilder.writeImageTOBEMOVED(fileFormatOption, seed(), os); return imageBuilder.writeImageTOBEMOVED(fileFormatOption, seed(), os);

View File

@ -40,10 +40,10 @@ import java.util.List;
import net.sourceforge.plantuml.AbstractPSystem; import net.sourceforge.plantuml.AbstractPSystem;
import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.UmlDiagramFactory; import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.DiagramType;
public class BpmDiagramFactory extends UmlDiagramFactory { public class BpmDiagramFactory extends PSystemCommandFactory {
public BpmDiagramFactory(DiagramType type) { public BpmDiagramFactory(DiagramType type) {
super(DiagramType.BPM); super(DiagramType.BPM);

View File

@ -208,10 +208,10 @@ public class ClassDiagram extends AbstractClassOrObjectDiagram {
final int margin2; final int margin2;
if (SkinParam.USE_STYLES()) { if (SkinParam.USE_STYLES()) {
margin1 = SkinParam.zeroMargin(0); margin1 = SkinParam.zeroMargin(0);
margin2 = SkinParam.zeroMargin(10); margin2 = SkinParam.zeroMargin(0);
} else { } else {
margin1 = 0; margin1 = 0;
margin2 = 10; margin2 = 0;
} }
final ImageBuilder imageBuilder = ImageBuilder.buildD(getSkinParam(), final ImageBuilder imageBuilder = ImageBuilder.buildD(getSkinParam(),
ClockwiseTopRightBottomLeft.margin1margin2(margin1, margin2), null, null, null, 1); ClockwiseTopRightBottomLeft.margin1margin2(margin1, margin2), null, null, null, 1);

View File

@ -65,7 +65,7 @@ import net.sourceforge.plantuml.command.CommandPackage;
import net.sourceforge.plantuml.command.CommandPackageEmpty; import net.sourceforge.plantuml.command.CommandPackageEmpty;
import net.sourceforge.plantuml.command.CommandPage; import net.sourceforge.plantuml.command.CommandPage;
import net.sourceforge.plantuml.command.CommandRankDir; import net.sourceforge.plantuml.command.CommandRankDir;
import net.sourceforge.plantuml.command.UmlDiagramFactory; import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.command.note.CommandConstraintOnLinks; import net.sourceforge.plantuml.command.note.CommandConstraintOnLinks;
import net.sourceforge.plantuml.command.note.CommandFactoryNote; import net.sourceforge.plantuml.command.note.CommandFactoryNote;
import net.sourceforge.plantuml.command.note.CommandFactoryNoteOnEntity; import net.sourceforge.plantuml.command.note.CommandFactoryNoteOnEntity;
@ -80,7 +80,7 @@ import net.sourceforge.plantuml.objectdiagram.command.CommandCreateEntityObject;
import net.sourceforge.plantuml.objectdiagram.command.CommandCreateEntityObjectMultilines; import net.sourceforge.plantuml.objectdiagram.command.CommandCreateEntityObjectMultilines;
import net.sourceforge.plantuml.objectdiagram.command.CommandCreateMap; import net.sourceforge.plantuml.objectdiagram.command.CommandCreateMap;
public class ClassDiagramFactory extends UmlDiagramFactory { public class ClassDiagramFactory extends PSystemCommandFactory {
private final ISkinSimple skinParam; private final ISkinSimple skinParam;

View File

@ -39,7 +39,6 @@ import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.TitledDiagram; import net.sourceforge.plantuml.TitledDiagram;
import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
@ -72,13 +71,11 @@ public class CommandFooter extends SingleLineCommand2<TitledDiagram> {
final String align = arg.get("POSITION", 0); final String align = arg.get("POSITION", 0);
HorizontalAlignment ha = HorizontalAlignment.fromString(align, HorizontalAlignment.CENTER); HorizontalAlignment ha = HorizontalAlignment.fromString(align, HorizontalAlignment.CENTER);
if (SkinParam.USE_STYLES() && align == null) { if (SkinParam.USE_STYLES() && align == null) {
ha = FontParam.FOOTER.getStyleDefinition(null) ha = FontParam.FOOTER.getStyleDefinition(null).getMergedStyle(diagram.getCurrentStyleBuilder())
.getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder())
.getHorizontalAlignment(); .getHorizontalAlignment();
} }
diagram.getFooter().putDisplay(Display.getWithNewlines(arg.get("LABEL", 0)), ha); diagram.getFooter().putDisplay(Display.getWithNewlines(arg.get("LABEL", 0)), ha);
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
} }
} }

View File

@ -39,7 +39,6 @@ import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.TitledDiagram; import net.sourceforge.plantuml.TitledDiagram;
import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
@ -74,8 +73,7 @@ public class CommandHeader extends SingleLineCommand2<TitledDiagram> {
final String align = arg.get("POSITION", 0); final String align = arg.get("POSITION", 0);
HorizontalAlignment ha = HorizontalAlignment.fromString(align, HorizontalAlignment.RIGHT); HorizontalAlignment ha = HorizontalAlignment.fromString(align, HorizontalAlignment.RIGHT);
if (SkinParam.USE_STYLES() && align == null) { if (SkinParam.USE_STYLES() && align == null) {
ha = FontParam.HEADER.getStyleDefinition(null) ha = FontParam.HEADER.getStyleDefinition(null).getMergedStyle(diagram.getCurrentStyleBuilder())
.getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder())
.getHorizontalAlignment(); .getHorizontalAlignment();
} }
diagram.getHeader().putDisplay(Display.getWithNewlines(arg.get("LABEL", 0)), ha); diagram.getHeader().putDisplay(Display.getWithNewlines(arg.get("LABEL", 0)), ha);

View File

@ -37,7 +37,7 @@ package net.sourceforge.plantuml.command;
import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.TitledDiagram;
import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
@ -45,7 +45,7 @@ import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils; import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils;
public class CommandPragma extends SingleLineCommand2<UmlDiagram> { public class CommandPragma extends SingleLineCommand2<TitledDiagram> {
public CommandPragma() { public CommandPragma() {
super(getRegexConcat()); super(getRegexConcat());
@ -64,7 +64,7 @@ public class CommandPragma extends SingleLineCommand2<UmlDiagram> {
} }
@Override @Override
protected CommandExecutionResult executeArg(UmlDiagram system, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(TitledDiagram system, LineLocation location, RegexResult arg) {
final String name = StringUtils.goLowerCase(arg.get("NAME", 0)); final String name = StringUtils.goLowerCase(arg.get("NAME", 0));
final String value = arg.get("VALUE", 0); final String value = arg.get("VALUE", 0);
system.getPragma().define(name, value); system.getPragma().define(name, value);

View File

@ -36,13 +36,13 @@
package net.sourceforge.plantuml.command; package net.sourceforge.plantuml.command;
import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.TitledDiagram;
import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
public class CommandSkinParam extends SingleLineCommand2<UmlDiagram> { public class CommandSkinParam extends SingleLineCommand2<TitledDiagram> {
public CommandSkinParam() { public CommandSkinParam() {
super(getRegexConcat()); super(getRegexConcat());
@ -58,7 +58,7 @@ public class CommandSkinParam extends SingleLineCommand2<UmlDiagram> {
} }
@Override @Override
protected CommandExecutionResult executeArg(UmlDiagram diagram, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(TitledDiagram diagram, LineLocation location, RegexResult arg) {
// arg.get(0).endsWith("locked"); // arg.get(0).endsWith("locked");
diagram.setParam(arg.get("NAME", 0), arg.get("VALUE", 0)); diagram.setParam(arg.get("NAME", 0), arg.get("VALUE", 0));
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();

View File

@ -36,11 +36,11 @@
package net.sourceforge.plantuml.command; package net.sourceforge.plantuml.command;
import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.TitledDiagram;
import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.MyPattern;
public class CommandSkinParamMultilines extends CommandMultilinesBracket<UmlDiagram> { public class CommandSkinParamMultilines extends CommandMultilinesBracket<TitledDiagram> {
public CommandSkinParamMultilines() { public CommandSkinParamMultilines() {
super("(?i)^skinparam[%s]*(?:[%s]+([\\w.]*(?:\\<\\<.*\\>\\>)?[\\w.]*))?[%s]*\\{$"); super("(?i)^skinparam[%s]*(?:[%s]+([\\w.]*(?:\\<\\<.*\\>\\>)?[\\w.]*))?[%s]*\\{$");
@ -60,7 +60,7 @@ public class CommandSkinParamMultilines extends CommandMultilinesBracket<UmlDiag
return MyPattern.mtches(line, CommandMultilinesComment.COMMENT_SINGLE_LINE); return MyPattern.mtches(line, CommandMultilinesComment.COMMENT_SINGLE_LINE);
} }
public CommandExecutionResult execute(UmlDiagram diagram, BlocLines lines) { public CommandExecutionResult execute(TitledDiagram diagram, BlocLines lines) {
final SkinLoader skinLoader = new SkinLoader(diagram); final SkinLoader skinLoader = new SkinLoader(diagram);
final Matcher2 mStart = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); final Matcher2 mStart = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());

View File

@ -45,7 +45,7 @@ import net.sourceforge.plantuml.FileSystem;
import net.sourceforge.plantuml.FileUtils; import net.sourceforge.plantuml.FileUtils;
import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.Log;
import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.TitledDiagram;
import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
@ -56,7 +56,7 @@ import net.sourceforge.plantuml.sprite.Sprite;
import net.sourceforge.plantuml.sprite.SpriteImage; import net.sourceforge.plantuml.sprite.SpriteImage;
import net.sourceforge.plantuml.sprite.SpriteSvg; import net.sourceforge.plantuml.sprite.SpriteSvg;
public class CommandSpriteFile extends SingleLineCommand2<UmlDiagram> { public class CommandSpriteFile extends SingleLineCommand2<TitledDiagram> {
public CommandSpriteFile() { public CommandSpriteFile() {
super(getRegexConcat()); super(getRegexConcat());
@ -73,7 +73,7 @@ public class CommandSpriteFile extends SingleLineCommand2<UmlDiagram> {
} }
@Override @Override
protected CommandExecutionResult executeArg(UmlDiagram system, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(TitledDiagram system, LineLocation location, RegexResult arg) {
final String src = arg.get("FILE", 0); final String src = arg.get("FILE", 0);
final Sprite sprite; final Sprite sprite;
try { try {

View File

@ -59,15 +59,15 @@ import net.sourceforge.plantuml.style.CommandStyleMultilinesCSS;
import net.sourceforge.plantuml.utils.StartUtils; import net.sourceforge.plantuml.utils.StartUtils;
import net.sourceforge.plantuml.version.IteratorCounter2; import net.sourceforge.plantuml.version.IteratorCounter2;
public abstract class UmlDiagramFactory extends PSystemAbstractFactory { public abstract class PSystemCommandFactory extends PSystemAbstractFactory {
private List<Command> cmds; private List<Command> cmds;
protected UmlDiagramFactory() { protected PSystemCommandFactory() {
this(DiagramType.UML); this(DiagramType.UML);
} }
protected UmlDiagramFactory(DiagramType type) { protected PSystemCommandFactory(DiagramType type) {
super(type); super(type);
} }

View File

@ -39,7 +39,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.sourceforge.plantuml.StringLocated; import net.sourceforge.plantuml.StringLocated;
import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.TitledDiagram;
import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.MyPattern;
import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.command.regex.Pattern2;
@ -50,9 +50,9 @@ public class SkinLoader {
.cmpile("^([\\w.]*(?:\\<\\<.*\\>\\>)?[\\w.]*)[%s]+(?:(\\{)|(.*))$|^\\}?$"); .cmpile("^([\\w.]*(?:\\<\\<.*\\>\\>)?[\\w.]*)[%s]+(?:(\\{)|(.*))$|^\\}?$");
final private List<String> context = new ArrayList<String>(); final private List<String> context = new ArrayList<String>();
final private UmlDiagram diagram; final private TitledDiagram diagram;
public SkinLoader(UmlDiagram diagram) { public SkinLoader(TitledDiagram diagram) {
this.diagram = diagram; this.diagram = diagram;
} }

View File

@ -40,13 +40,13 @@ import java.util.List;
import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.UmlDiagramFactory; import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.compositediagram.command.CommandCreateBlock; import net.sourceforge.plantuml.compositediagram.command.CommandCreateBlock;
import net.sourceforge.plantuml.compositediagram.command.CommandCreatePackageBlock; import net.sourceforge.plantuml.compositediagram.command.CommandCreatePackageBlock;
import net.sourceforge.plantuml.compositediagram.command.CommandEndPackageBlock; import net.sourceforge.plantuml.compositediagram.command.CommandEndPackageBlock;
import net.sourceforge.plantuml.compositediagram.command.CommandLinkBlock; import net.sourceforge.plantuml.compositediagram.command.CommandLinkBlock;
public class CompositeDiagramFactory extends UmlDiagramFactory { public class CompositeDiagramFactory extends PSystemCommandFactory {
private final ISkinSimple skinParam; private final ISkinSimple skinParam;

View File

@ -58,8 +58,15 @@ public class Parser {
return new CreoleParser(fontConfiguration, horizontalAlignment, skinParam, creoleMode, stereotype); return new CreoleParser(fontConfiguration, horizontalAlignment, skinParam, creoleMode, stereotype);
} }
public static boolean isCodeStart(String line) {
return line.equals("<code>");
}
public static boolean isCodeEnd(String line) {
return line.equals("</code>");
}
public static boolean isTreeStart(String line) { public static boolean isTreeStart(String line) {
// return false;
return line.startsWith("|_"); return line.startsWith("|_");
} }

View File

@ -75,6 +75,16 @@ public class CreoleParser implements SheetBuilder {
private Stripe createStripe(String line, CreoleContext context, Stripe lastStripe, private Stripe createStripe(String line, CreoleContext context, Stripe lastStripe,
FontConfiguration fontConfiguration) { FontConfiguration fontConfiguration) {
if (lastStripe instanceof StripeCode) {
final StripeCode code = (StripeCode) lastStripe;
if (code.isTerminated()) {
lastStripe = null;
} else {
final boolean terminated = code.addAndCheckTermination(line);
return null;
}
}
if (lastStripe instanceof StripeTable && isTableLine(line)) { if (lastStripe instanceof StripeTable && isTableLine(line)) {
final StripeTable table = (StripeTable) lastStripe; final StripeTable table = (StripeTable) lastStripe;
table.analyzeAndAddLine(line); table.analyzeAndAddLine(line);
@ -87,6 +97,8 @@ public class CreoleParser implements SheetBuilder {
return new StripeTable(fontConfiguration, skinParam, line); return new StripeTable(fontConfiguration, skinParam, line);
} else if (Parser.isTreeStart(line)) { } else if (Parser.isTreeStart(line)) {
return new StripeTree(fontConfiguration, skinParam, line); return new StripeTree(fontConfiguration, skinParam, line);
} else if (Parser.isCodeStart(line)) {
return new StripeCode(fontConfiguration.changeFamily(Parser.MONOSPACED), skinParam, line);
} }
return new CreoleStripeSimpleParser(line, context, fontConfiguration, skinParam, creoleMode) return new CreoleStripeSimpleParser(line, context, fontConfiguration, skinParam, creoleMode)
.createStripe(context); .createStripe(context);

View File

@ -0,0 +1,116 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.creole.legacy;
import java.awt.geom.Dimension2D;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.creole.Parser;
import net.sourceforge.plantuml.creole.Stripe;
import net.sourceforge.plantuml.creole.atom.Atom;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UText;
import net.sourceforge.plantuml.ugraphic.UTranslate;
public class StripeCode implements Stripe, Atom {
final private FontConfiguration fontConfiguration;
private final List<String> raw = new ArrayList<String>();
private boolean terminated;
public StripeCode(FontConfiguration fontConfiguration, ISkinSimple skinParam, String line) {
// this.skinParam = skinParam;
this.fontConfiguration = fontConfiguration;
}
public List<Atom> getAtoms() {
return Collections.<Atom>singletonList(this);
}
public Atom getLHeader() {
return null;
}
public boolean addAndCheckTermination(String line) {
if (Parser.isCodeEnd(line)) {
this.terminated = true;
return true;
}
this.raw.add(line);
return false;
}
public final boolean isTerminated() {
return terminated;
}
public Dimension2D calculateDimension(StringBounder stringBounder) {
double width = 0;
double height = 0;
for (String s : raw) {
final Dimension2D dim = stringBounder.calculateDimension(fontConfiguration.getFont(), s);
width = Math.max(width, dim.getWidth());
height += dim.getHeight();
}
return new Dimension2DDouble(width, height);
}
public double getStartingAltitude(StringBounder stringBounder) {
return 0;
}
public void drawU(UGraphic ug) {
double y = 0;
for (String s : raw) {
final UText shape = new UText(s, fontConfiguration);
final Dimension2D dim = ug.getStringBounder().calculateDimension(fontConfiguration.getFont(), s);
y += dim.getHeight();
ug.apply(UTranslate.dy(y - shape.getDescent())).draw(shape);
}
}
public List<Atom> splitInTwo(StringBounder stringBounder, double width) {
throw new UnsupportedOperationException();
}
}

View File

@ -209,7 +209,9 @@ public class BodierImpl implements Bodier {
if (showFields == false) { if (showFields == false) {
return new TextBlockLineBefore(TextBlockUtils.empty(0, 0)); return new TextBlockLineBefore(TextBlockUtils.empty(0, 0));
} }
return fields.asBlockMemberImpl(); // return fields.asBlockMemberImpl();
return new BodyEnhanced(rawBodyWithoutHidden(), fontParam, skinParam, manageModifier, stereotype, leaf,
SName.objectDiagram);
} }
if (type.isLikeClass() == false) { if (type.isLikeClass() == false) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();

View File

@ -164,9 +164,11 @@ public class BodyEnhanced extends AbstractTextBlock implements TextBlock, WithPo
for (ListIterator<CharSequence> it = rawBody.listIterator(); it.hasNext();) { for (ListIterator<CharSequence> it = rawBody.listIterator(); it.hasNext();) {
final CharSequence s2 = it.next(); final CharSequence s2 = it.next();
if (s2 instanceof EmbeddedDiagram) { if (s2 instanceof EmbeddedDiagram) {
if (members.size() > 0) { if (members.size() > 0 || separator != 0) {
blocks.add(decorate(stringBounder, new MethodsOrFieldsArea(members, fontParam, skinParam, align, blocks.add(decorate(stringBounder, new MethodsOrFieldsArea(members, fontParam, skinParam, align,
stereotype, entity, diagramType), separator, title)); stereotype, entity, diagramType), separator, title));
separator = 0;
title = null;
members = new ArrayList<Member>(); members = new ArrayList<Member>();
} }
blocks.add(((EmbeddedDiagram) s2).asDraw(skinParam)); blocks.add(((EmbeddedDiagram) s2).asDraw(skinParam));
@ -183,6 +185,8 @@ public class BodyEnhanced extends AbstractTextBlock implements TextBlock, WithPo
blocks.add(decorate(stringBounder, new MethodsOrFieldsArea(members, fontParam, skinParam, align, blocks.add(decorate(stringBounder, new MethodsOrFieldsArea(members, fontParam, skinParam, align,
stereotype, entity, diagramType), separator, title)); stereotype, entity, diagramType), separator, title));
} }
separator = 0;
title = null;
members = new ArrayList<Member>(); members = new ArrayList<Member>();
final List<CharSequence> allTree = buildAllTree(s, it); final List<CharSequence> allTree = buildAllTree(s, it);
final TextBlock bloc = Display.create(allTree).create7(fontParam.getFontConfiguration(skinParam), final TextBlock bloc = Display.create(allTree).create7(fontParam.getFontConfiguration(skinParam),

View File

@ -40,6 +40,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.Guillemet;
import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy; import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.StringUtils;
@ -55,21 +56,23 @@ import net.sourceforge.plantuml.ugraphic.UGraphic;
public class BodyEnhanced2 extends AbstractTextBlock implements TextBlock { public class BodyEnhanced2 extends AbstractTextBlock implements TextBlock {
private TextBlock area2; private TextBlock area;
private final FontConfiguration titleConfig; private final FontConfiguration titleConfig;
private final Display rawBody2; private final Display rawBody;
private final ISkinSimple spriteContainer; private final ISkinSimple spriteContainer;
private final HorizontalAlignment align; private final HorizontalAlignment align;
private final LineBreakStrategy lineBreakStrategy; private final LineBreakStrategy lineBreakStrategy;
private final double minClassWidth;
// private final List<Url> urls = new ArrayList<Url>(); // private final List<Url> urls = new ArrayList<Url>();
public BodyEnhanced2(Display rawBody, FontParam fontParam, ISkinSimple spriteContainer, HorizontalAlignment align, public BodyEnhanced2(Display rawBody, FontParam fontParam, ISkinSimple spriteContainer, HorizontalAlignment align,
FontConfiguration titleConfig, LineBreakStrategy lineBreakStrategy) { FontConfiguration titleConfig, LineBreakStrategy lineBreakStrategy, double minClassWidth) {
this.rawBody2 = rawBody; this.rawBody = rawBody;
this.lineBreakStrategy = lineBreakStrategy; this.lineBreakStrategy = lineBreakStrategy;
this.spriteContainer = spriteContainer; this.spriteContainer = spriteContainer;
this.minClassWidth = minClassWidth;
this.titleConfig = titleConfig; this.titleConfig = titleConfig;
this.align = align; this.align = align;
@ -93,38 +96,45 @@ public class BodyEnhanced2 extends AbstractTextBlock implements TextBlock {
} }
private TextBlock getArea(StringBounder stringBounder) { private TextBlock getArea(StringBounder stringBounder) {
if (area2 != null) { if (area != null) {
return area2; return area;
} }
// urls.clear(); // urls.clear();
final List<TextBlock> blocks = new ArrayList<TextBlock>(); final List<TextBlock> blocks = new ArrayList<TextBlock>();
char separator = 0; char separator = 0;
TextBlock title = null; TextBlock title = null;
Display members2 = Display.empty(); Display display = Display.empty();
for (CharSequence s : rawBody2) { for (CharSequence s : rawBody) {
if (isBlockSeparator(s.toString())) { if (isBlockSeparator(s.toString())) {
blocks.add(decorate(stringBounder, getTextBlock(members2, stringBounder), separator, title)); blocks.add(decorate(stringBounder, getTextBlock(display, stringBounder), separator, title));
separator = s.charAt(0); separator = s.charAt(0);
title = getTitle(s.toString(), spriteContainer); title = getTitle(s.toString(), spriteContainer);
members2 = Display.empty(); display = Display.empty();
} else { } else {
members2 = members2.add(s); if (s instanceof String) {
s = Guillemet.GUILLEMET.manageGuillemet(s.toString());
}
display = display.add(s);
} }
} }
blocks.add(decorate(stringBounder, getTextBlock(members2, stringBounder), separator, title)); blocks.add(decorate(stringBounder, getTextBlock(display, stringBounder), separator, title));
if (blocks.size() == 1) { if (blocks.size() == 1) {
this.area2 = blocks.get(0); this.area = blocks.get(0);
} else { } else {
this.area2 = new TextBlockVertical2(blocks, align); this.area = new TextBlockVertical2(blocks, align);
} }
return area2; if (minClassWidth > 0) {
this.area = TextBlockUtils.withMinWidth(this.area, minClassWidth, align);
}
return area;
} }
private TextBlock getTextBlock(Display members2, StringBounder stringBounder) { private TextBlock getTextBlock(Display display, StringBounder stringBounder) {
final TextBlock result = members2.create9(titleConfig, align, spriteContainer, lineBreakStrategy); final TextBlock result = display.create9(titleConfig, align, spriteContainer, lineBreakStrategy);
return result; return result;
} }

View File

@ -237,9 +237,10 @@ public class Display implements Iterable<CharSequence> {
final Iterator<? extends CharSequence> it = strings.iterator(); final Iterator<? extends CharSequence> it = strings.iterator();
while (it.hasNext()) { while (it.hasNext()) {
CharSequence s = it.next(); CharSequence s = it.next();
if (s != null && StringUtils.trin(s.toString()).equals("{{")) { final String type = EmbeddedDiagram.getEmbeddedType(s);
if (type != null) {
final List<CharSequence> other = new ArrayList<CharSequence>(); final List<CharSequence> other = new ArrayList<CharSequence>();
other.add("@startuml"); other.add("@start" + type);
while (it.hasNext()) { while (it.hasNext()) {
CharSequence s2 = it.next(); CharSequence s2 = it.next();
if (s2 != null && StringUtils.trin(s2.toString()).equals("}}")) { if (s2 != null && StringUtils.trin(s2.toString()).equals("}}")) {
@ -247,7 +248,7 @@ public class Display implements Iterable<CharSequence> {
} }
other.add(s2); other.add(s2);
} }
other.add("@enduml"); other.add("@end" + type);
s = new EmbeddedDiagram(Display.create(other)); s = new EmbeddedDiagram(Display.create(other));
} }
result.add(s); result.add(s);

View File

@ -61,6 +61,10 @@ public enum LinkArrow {
public Direction getArrowDirection() { public Direction getArrowDirection() {
return guide.getArrowDirection().getInv(); return guide.getArrowDirection().getInv();
} }
public double getArrowDirection2() {
return Math.PI + guide.getArrowDirection2();
}
}; };
} }

View File

@ -101,8 +101,8 @@ public class Member {
this.visibilityModifier = null; this.visibilityModifier = null;
this.abstractModifier = false; this.abstractModifier = false;
tmpDisplay = StringUtils.trin(tmpDisplay); tmpDisplay = StringUtils.trin(tmpDisplay);
this.display = tmpDisplay.length() == 0 ? " " : Guillemet.GUILLEMET.manageGuillemet(StringUtils this.display = tmpDisplay.length() == 0 ? " "
.trin(tmpDisplay)); : Guillemet.GUILLEMET.manageGuillemet(StringUtils.trin(tmpDisplay));
} }
} }
@ -114,7 +114,8 @@ public class Member {
} }
private String getDisplayWithoutVisibilityChar() { private String getDisplayWithoutVisibilityChar() {
// assert display.length() == 0 || VisibilityModifier.isVisibilityCharacter(display.charAt(0)) == false; // assert display.length() == 0 ||
// VisibilityModifier.isVisibilityCharacter(display.charAt(0)) == false;
return display; return display;
} }
@ -193,13 +194,13 @@ public class Member {
} }
public static boolean isMethod(String s) { public static boolean isMethod(String s) {
// s = UrlBuilder.purgeUrl(s); final String purged = s.replaceAll(UrlBuilder.getRegexp(), "");
if (s.contains("{method}")) { if (purged.contains("{method}")) {
return true; return true;
} }
if (s.contains("{field}")) { if (purged.contains("{field}")) {
return false; return false;
} }
return s.contains("(") || s.contains(")"); return purged.contains("(") || purged.contains(")");
} }
} }

View File

@ -61,7 +61,6 @@ import net.sourceforge.plantuml.skin.VisibilityModifier;
import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.svek.Ports; import net.sourceforge.plantuml.svek.Ports;
import net.sourceforge.plantuml.svek.WithPorts; import net.sourceforge.plantuml.svek.WithPorts;
import net.sourceforge.plantuml.ugraphic.PlacementStrategy; import net.sourceforge.plantuml.ugraphic.PlacementStrategy;

View File

@ -97,8 +97,8 @@ public class PSystemCute extends AbstractPSystem {
margin1 = 10; margin1 = 10;
margin2 = 10; margin2 = 10;
} }
final ImageBuilder builder = ImageBuilder.buildB(new ColorMapperIdentity(), false, ClockwiseTopRightBottomLeft.margin1margin2((double) margin1, (double) margin2), final ImageBuilder builder = ImageBuilder.buildB(new ColorMapperIdentity(), false,
null, null, null, 1.0, null); ClockwiseTopRightBottomLeft.margin1margin2(margin1, margin2), null, null, null, 1.0, null);
builder.setUDrawable(root); builder.setUDrawable(root);
return builder.writeImageTOBEMOVED(fileFormat, seed, os); return builder.writeImageTOBEMOVED(fileFormat, seed, os);
} }

Binary file not shown.

View File

@ -35,7 +35,6 @@
*/ */
package net.sourceforge.plantuml.dedication; package net.sourceforge.plantuml.dedication;
import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -54,6 +53,7 @@ public class Dedications {
addNormal("Boundaries allow discipline to create true strength", "boundaries"); addNormal("Boundaries allow discipline to create true strength", "boundaries");
addCrypted("0", "pOhci6rKgPXw32AeYXhOpSY0suoauHq5VUSwFqHLHsLYgSO6WaJ7BW5vtHBAoU6ePbcW7d8Flx99MWjPSKQTDm00"); addCrypted("0", "pOhci6rKgPXw32AeYXhOpSY0suoauHq5VUSwFqHLHsLYgSO6WaJ7BW5vtHBAoU6ePbcW7d8Flx99MWjPSKQTDm00");
addCrypted("1", "LTxN3hdnhSJ515qcA7IQ841axt4GXfUd3n2wgNirYCdLnyX2360Gv1OEOnJ1-gwFzRW5B3HAqLBkR6Ge0WW_Z000"); addCrypted("1", "LTxN3hdnhSJ515qcA7IQ841axt4GXfUd3n2wgNirYCdLnyX2360Gv1OEOnJ1-gwFzRW5B3HAqLBkR6Ge0WW_Z000");
addCrypted("2", "lZqLduj4j1yRqSfAvkhbqVpqK8diklatiFeenDUXSdna9bKYQTzdS264YfUBScUVDYCp2Vcq04updoN98RwxE000");
} }
private static void addNormal(String sentence, String name) { private static void addNormal(String sentence, String name) {
@ -82,13 +82,13 @@ public class Dedications {
if (signature.equals(ent.getKey())) { if (signature.equals(ent.getKey())) {
return dedication; return dedication;
} }
} catch (IOException e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
try { try {
if (is != null) if (is != null)
is.close(); is.close();
} catch (IOException e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }

View File

@ -48,7 +48,7 @@ import net.sourceforge.plantuml.command.CommandEndPackage;
import net.sourceforge.plantuml.command.CommandFootboxIgnored; import net.sourceforge.plantuml.command.CommandFootboxIgnored;
import net.sourceforge.plantuml.command.CommandPage; import net.sourceforge.plantuml.command.CommandPage;
import net.sourceforge.plantuml.command.CommandRankDir; import net.sourceforge.plantuml.command.CommandRankDir;
import net.sourceforge.plantuml.command.UmlDiagramFactory; import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.command.note.CommandFactoryNote; import net.sourceforge.plantuml.command.note.CommandFactoryNote;
import net.sourceforge.plantuml.command.note.CommandFactoryNoteOnEntity; import net.sourceforge.plantuml.command.note.CommandFactoryNoteOnEntity;
import net.sourceforge.plantuml.command.note.CommandFactoryNoteOnLink; import net.sourceforge.plantuml.command.note.CommandFactoryNoteOnLink;
@ -62,7 +62,7 @@ import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement;
import net.sourceforge.plantuml.descdiagram.command.CommandNewpage; import net.sourceforge.plantuml.descdiagram.command.CommandNewpage;
import net.sourceforge.plantuml.descdiagram.command.CommandPackageWithUSymbol; import net.sourceforge.plantuml.descdiagram.command.CommandPackageWithUSymbol;
public class DescriptionDiagramFactory extends UmlDiagramFactory { public class DescriptionDiagramFactory extends PSystemCommandFactory {
private final ISkinSimple skinParam; private final ISkinSimple skinParam;

View File

@ -40,7 +40,7 @@ import net.sourceforge.plantuml.NewpagedDiagram;
import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.UmlDiagramFactory; import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
@ -48,9 +48,9 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
public class CommandNewpage extends SingleLineCommand2<UmlDiagram> { public class CommandNewpage extends SingleLineCommand2<UmlDiagram> {
private final UmlDiagramFactory factory; private final PSystemCommandFactory factory;
public CommandNewpage(UmlDiagramFactory factory) { public CommandNewpage(PSystemCommandFactory factory) {
super(getRegexConcat()); super(getRegexConcat());
this.factory = factory; this.factory = factory;
} }

View File

@ -35,7 +35,6 @@
*/ */
package net.sourceforge.plantuml.descdiagram.command; package net.sourceforge.plantuml.descdiagram.command;
import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
@ -43,10 +42,9 @@ import net.sourceforge.plantuml.cucadiagram.LinkArrow;
import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockArrow; import net.sourceforge.plantuml.graphic.TextBlockArrow2;
import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.VerticalAlignment; import net.sourceforge.plantuml.graphic.VerticalAlignment;
import net.sourceforge.plantuml.svek.DirectionalTextBlock;
import net.sourceforge.plantuml.svek.GuideLine; import net.sourceforge.plantuml.svek.GuideLine;
public class StringWithArrow { public class StringWithArrow {
@ -104,18 +102,17 @@ public class StringWithArrow {
} }
static public TextBlock addMagicArrow(TextBlock label, GuideLine guide, FontConfiguration font) { static public TextBlock addMagicArrow(TextBlock label, GuideLine guide, FontConfiguration font) {
final TextBlock arrowRight = new TextBlockArrow(Direction.RIGHT, font); final TextBlock arrow = new TextBlockArrow2(guide, font);
final TextBlock arrowLeft = new TextBlockArrow(Direction.LEFT, font); return TextBlockUtils.mergeLR(arrow, label, VerticalAlignment.CENTER);
final TextBlock arrowUp = new TextBlockArrow(Direction.UP, font);
final TextBlock arrowDown = new TextBlockArrow(Direction.DOWN, font);
final TextBlock right = TextBlockUtils.mergeLR(label, arrowRight, VerticalAlignment.CENTER);
final TextBlock left = TextBlockUtils.mergeLR(arrowLeft, label, VerticalAlignment.CENTER);
final TextBlock up = TextBlockUtils.mergeTB(arrowUp, label, HorizontalAlignment.CENTER);
final TextBlock down = TextBlockUtils.mergeTB(label, arrowDown, HorizontalAlignment.CENTER);
return new DirectionalTextBlock(guide, right, left, up, down);
} }
static private TextBlock addMagicArrow2(TextBlock label, GuideLine guide, FontConfiguration font) { static private TextBlock addMagicArrow2(TextBlock label, GuideLine guide, FontConfiguration font) {
final TextBlock arrow = new TextBlockArrow2(guide, font);
return TextBlockUtils.mergeLR(arrow, label, VerticalAlignment.CENTER);
}
/*
static public TextBlock addMagicArrow2(TextBlock label, GuideLine guide, FontConfiguration font) {
final TextBlock arrowRight = new TextBlockArrow(Direction.RIGHT, font); final TextBlock arrowRight = new TextBlockArrow(Direction.RIGHT, font);
final TextBlock arrowLeft = new TextBlockArrow(Direction.LEFT, font); final TextBlock arrowLeft = new TextBlockArrow(Direction.LEFT, font);
final TextBlock arrowUp = new TextBlockArrow(Direction.UP, font); final TextBlock arrowUp = new TextBlockArrow(Direction.UP, font);
@ -127,6 +124,27 @@ public class StringWithArrow {
return new DirectionalTextBlock(guide, right, left, up, down); return new DirectionalTextBlock(guide, right, left, up, down);
} }
static public TextBlock addMagicArrow(TextBlock label, GuideLine guide, FontConfiguration font) {
final TextBlock arrow = new TextBlockArrow2(guide, font);
return TextBlockUtils.mergeLR(label, arrow, VerticalAlignment.CENTER);
}
public static TextBlock addSeveralMagicArrows(Display label, GuideLine guide, FontConfiguration font,
HorizontalAlignment alignment, ISkinParam skinParam) {
TextBlock result = TextBlockUtils.EMPTY_TEXT_BLOCK;
for (CharSequence cs : label) {
StringWithArrow tmp = new StringWithArrow(cs.toString());
TextBlock block = tmp.getDisplay().create9(font, alignment, skinParam, skinParam.maxMessageSize());
if (tmp.getLinkArrow() != LinkArrow.NONE_OR_SEVERAL) {
block = StringWithArrow.addMagicArrow(block, tmp.getLinkArrow().mute(guide), font);
}
result = TextBlockUtils.mergeTB(result, block, alignment);
}
return result;
}
*/
public static TextBlock addSeveralMagicArrows(Display label, GuideLine guide, FontConfiguration font, public static TextBlock addSeveralMagicArrows(Display label, GuideLine guide, FontConfiguration font,
HorizontalAlignment alignment, ISkinParam skinParam) { HorizontalAlignment alignment, ISkinParam skinParam) {
TextBlock result = TextBlockUtils.EMPTY_TEXT_BLOCK; TextBlock result = TextBlockUtils.EMPTY_TEXT_BLOCK;

View File

@ -74,26 +74,27 @@ public class PSystemDonors extends AbstractPSystem {
private static final int COLS = 6; private static final int COLS = 6;
private static final int FREE_LINES = 6; private static final int FREE_LINES = 6;
public static final String DONORS = "6peC02mFU3XMJbc44wzsvvsjcZxOY0eHBCyJYiF08fxk1iGVuDxfSR-H_YAwqhrlcX5jsPhYF6DGBGXw" public static final String DONORS = "6rqC0AmEU9ELAujmujswMQFgmN9H8OBbUK9n65Z4qzs0-0FSEptkDz9VH5UwzqqpeYsRKvfd5TM2eE5u"
+ "F3NN3DlSsmFFQdxwAlbcQdI5gJ0auIuaB6JOJp-fCgG4ptAz-MSKutlkfA5Pjis5a1j8l_2-CpRFJkEB" + "ctROvizU27Dcl0Zkp17qVFW0KHArbH-f8zkv1sAfPFqs5TCdNSg6oFYiDq8te7FUXlUTiNbs6b-yUZH1"
+ "LuycQ2FmOs1V_TyrhQoxLrLXI9TLZQbHfoiSmeZ84VuVTPkwHMsSJ6qQFQ1JELTmKvsAj0LlUgALD1Da" + "6u4V0_lg_owThRjNLM6MxbQj4JNgT8KRcxdN_r45TKJ1Jb2Wfn_JgHogmw6A2koem6DV-LKtpaUD9gjY"
+ "NEiu7ysQLCL4caZnr4OA7ZcPeRqcgy-JAttG-QL-W3QjtJN4SmOKnqhfqVsrqVxp1DklaFYGS8POi5bW" + "GYbIdBKH0gSOpD2Gazudo2zzKFYXta2RrkeQOha7AOwPqgFhiTgEVGV3BvJuaB05Nv1PO4vAEKmNA7vk"
+ "3fKSrYSeVcswqN6A8A5r5jdOwYktF371u8SM-kOFPNB5UqXabY55n-KA57WynW39dDIk2MU7RWPKrOCj" + "kg5Wuu53tIfcOqjAZZpHG-255lBc3qLIqdg8PvN1HS6kX1GuFOm2aj6eGHFE3Xm6LDo3BJeqSDNbVcDk"
+ "-ZK8rULnu-uQX-MfP3OQRW4B5mjg1se8yZ_e4pwjx_p8v5o78fQGfqdSbcr0_LdoFkvDHT_CgqaWV6qV" + "deVbgNWc3JU2XPq5jO0QWlmFUa6dzvMtJEvpKzWIyZQ9LxULg3zBtaxThEWRNPe4pDVMKpEjNrdAraCQ"
+ "cXdYAbEr7jBOyZFMgqQ7t3LarUXVnXg57C6ytysbOFxH0laHwA4-4KdyBFkDXGI4QqlzqBlEJITN5k6K" + "Mzxd_AkpaxnfoChP7qOVgHn1lH_caZ6_jK3j27JVcB0alhzqFrX8GAYsr9lUTQu-ARC89sH8gLWdRsBB"
+ "3YaLw_HRR7aj-K9NOB5nqQmEbkYxyUjoKoBOGbScbw47MbMvhVE9aj9G_x_8ew7hl-2QAhLxXsWzq-Oy" + "Q_4_TFaw6n39sS4IVjVzN6wA1rleogIOz8PMSQfrFf2J6khlBtarTRuBhYaMkpUFUw9JeI7wVzSjpGp5"
+ "-x_hbcQ6uW0Txs8MT2qW44RJgg_OG0I7XIuFkGcG0wXk9hVYPdaHU-G716yk6NI5ZPGEYEUNa9iSGfY6" + "0Jemn2pe6e4XpAPLUx6127OBdPta9a0se7oPtFANvPVe8ouaU7E9e2jif3I2Fx-4tENWGdIawveKAu3P"
+ "BjrSeWAOFQNKHSTjWOSwdO9kHPLyUfcxFgP9oxHjO-O-QOFdxGPZ5CTqGld4_JONk8LXbLeq9qzh7s6M" + "KqgzA3YSOA5SXw2RKIMPNkQkds7IicpPcBbFsk1vgy4O-J6TK5oOR-O2zp0iLelc-6xjGwmIFCh7IJvr"
+ "u74-JlEg-npCg-Ysj_2UzY4qhsJ0hp1dHAJITELvfdt4tTGHc4LRy58NszrjSF3GNGjEiMW5CzgqGvQ0" + "d_sv2d1fuJtYnhL-oO2VOSw8I9dfYdrFkyNSrM6OHPrpLHVTm-tavg6R5vp5ebdCQ9E7B0QDKycegOy8"
+ "oOLarDAlA3ur6FuEGZPXhqr5li3MS9qQmin8WzTBarjgSaJ7QJhBiR4DmAilNh4hA9mYHDlIajcwbZ0r" + "RMWm_Es7RCnUgxDQ1vl3TKfmCoCDhYzDRgZ94GMRvIp7p1O0bx7un2w_S0d16fQQoDQrXCWHgySXGtud"
+ "O_KaLCZlb4zWgQmBInisjhiApyGy2l9mtYEhB_LZIN5RGFMnJ92N5a9V8KKHjZV8m5X9ptAROFjJEnRK" + "sWIMohJGD63dS5VWcR17GHpEUs3LgRvDoSu5L17J14bfmOmPakLXQu4Cp3NfcMa3x7PfnuAopKzs774e"
+ "RJrouPX3yMqJRJTkY64AJ4_XVf4W4gCJIOLUOf8eu7j-_4gzQAw3ZU_iQSKuI5f88g2As7Bg1yPAG_L8" + "lcsYhSOD4Ko1wIRS1mv4OhWXAT5BJ181-FvSdb8lFDV1ndVrj68S92qaCL15k3lb1wMdxhg5fh5Uel_7"
+ "JMEzHlzVQ-rksVdpxtLaarE7t_Cp1T5pK3J-ZHJ0KKuWWwU1hoPVbBoLi98LoY33bMkLdWOI5kp2ErTH" + "MZiiEt_-lOviScgqUzrD43q7SG68y08DvNuXWhS1xuCDtO03Ld3HamXNhbfw6aXOi9dMsKNTlyoetF5Y"
+ "3vOPrJjHB3Uh5gsYVQYgt-xACN0sDgouoASeLjzYbBMxUb05RT_rncAHW-0_H9L9cLoD9gin4Zg3BCxT" + "kJ6vQENveOf_kYX7WTE-8SL5Cba--n8bhHtgGUMtVVCNYuiS1FyILOPaSbKRhsGaT09cSMx7hZCLTTj8"
+ "sFTAnJmtDe45lMCoWRPVVNQQnat6dAz8AWsF0Fb-Zqn9MWyjhAbfNJuHs2ITwtiBsvH8wt_1Y7v1hPFZ" + "0nQCZie4wfvwUZvCuoLZhbSeDGqF0_bkYmm9UWyjhAbfULm8h9RE_jx2DiJJ-xzWH3-_rl7pgXuQJc9q"
+ "KJsq3t9texj0mxS-f7P19XWkaayKoBTpJZHmyus2kgWMoiJIZXbsZc25_iP_H1GIZjd61u8iSx6iTaSE" + "VRj0mxScf75E91WkaWy4oDLpJZHevfi4yg9QA0DBssROMOCLyXlu4Lv8E68R7mXocelcR0Too1Qo3un6"
+ "sKBsyTue-a1HKsWW6ulr-anYePJZWHH9mPhPCfv7sg1jsDSJW5CKpFVtDeHB9ffVa5dxUlP6CfT-xiKP" + "rWVoQa83MLYiq6iI2wKS3wH82kQSBUDPf9sq0Njw1D0e2iR_xoq85myqFoEpzddrHZ2NPkx6CuXqk7y6"
+ "H3gSdqrYqvIj3Jcm7scvREkEtFw-I8UT-k_4ZlETZwXR1n740Z7I25wF2UlcncxL5ZuZpwqQ7CTbEWuc" + "FuoJc9O0"; + "YKsdRFN8XlrGvhBDAt8xnY8STkA_uplEjp-YRfv440d4K1AyLXFIuSOErIOsGyzr6jp7PMxSJ7u1bwAT"
+ "9ndO6eejo58s0oMU1000";
/* /*
* Special thanks to our sponsors and donors: * Special thanks to our sponsors and donors:

View File

@ -39,10 +39,10 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.UmlDiagramFactory; import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.DiagramType;
public class FlowDiagramFactory extends UmlDiagramFactory { public class FlowDiagramFactory extends PSystemCommandFactory {
public FlowDiagramFactory() { public FlowDiagramFactory() {
super(DiagramType.FLOW); super(DiagramType.FLOW);

View File

@ -262,7 +262,7 @@ public class QuoteUtils {
"Gur terngrfg rarzl bs xabjyrqtr vf abg vtabenapr; vg vf gur vyyhfvba bs xabjyrqtr", "Gur terngrfg rarzl bs xabjyrqtr vf abg vtabenapr; vg vf gur vyyhfvba bs xabjyrqtr",
"N fghql sbhaq gung vtabenag crbcyr ner zber yvxryl gb oryvrir gurl'er oevyyvnag", "N fghql sbhaq gung vtabenag crbcyr ner zber yvxryl gb oryvrir gurl'er oevyyvnag",
"Dh'rfg-pr dh'ba n qbap n fbaare pbzzr pn, pr zngva ?", "Ernyvgl vf gur bayl guvat gung'f erny", "Dh'rfg-pr dh'ba n qbap n fbaare pbzzr pn, pr zngva ?", "Ernyvgl vf gur bayl guvat gung'f erny",
"V jbhyq tvir zlfrys na N+", "Lbh rire unir frpbaq gubhtugf nobhg fbzrguvat ?", "V jbhyq tvir zlfrys na N+ ba fbsgjner qrirybczrag", "Lbh rire unir frpbaq gubhtugf nobhg fbzrguvat ?",
"V oryvrir vg'f n ebhtu fvghngvba bire gurer", "Whfg fb lbh xabj, V tbg zl yvprafr fhfcraqrq", "V oryvrir vg'f n ebhtu fvghngvba bire gurer", "Whfg fb lbh xabj, V tbg zl yvprafr fhfcraqrq",
"Gunax lbh sbe pubbfvat Bprnavp Nveyvarf", "4-8-15-16-23-42", "Gunax lbh sbe pubbfvat Bprnavp Nveyvarf", "4-8-15-16-23-42",
"...naq gnk phgf. Gung'yy fubj gurz znegvnaf.", "...naq gnk phgf. Gung'yy fubj gurz znegvnaf.",
@ -276,7 +276,7 @@ public class QuoteUtils {
"Vs lbh ner abg rzoneenffrq ol gur svefg irefvba bs lbhe cebqhpg, lbh'ir ynhapurq gbb yngr", "Vs lbh ner abg rzoneenffrq ol gur svefg irefvba bs lbhe cebqhpg, lbh'ir ynhapurq gbb yngr",
"Zvfgnxrf znqr zl fhpprff: V znxr ehoore renfre", "Ovt Oebgure vf Jngpuvat Lbh.", "Zvfgnxrf znqr zl fhpprff: V znxr ehoore renfre", "Ovt Oebgure vf Jngpuvat Lbh.",
"Ab bar'f gnyxvat nobhg yrnivat gur fvatyr znexrg", "...rnfvrfg oht gb svk va uhzna uvfgbel", "Ab bar'f gnyxvat nobhg yrnivat gur fvatyr znexrg", "...rnfvrfg oht gb svk va uhzna uvfgbel",
"Arire nggevohgr gb znyvpr jung pna or rkcynvarq ol fghcvqvgl"); "Arire nggevohgr gb znyvpr jung pna or rkcynvarq ol fghcvqvgl", "Guvf oht nssrpgf iveghnyyl abobql");
private QuoteUtils() { private QuoteUtils() {
} }

View File

@ -69,11 +69,7 @@ public class TextBlockArrow extends AbstractTextBlock implements TextBlock {
triSize--; triSize--;
} }
final UPolygon triangle = getTriangle(triSize); final UPolygon triangle = getTriangle(triSize);
if (arrow == Direction.RIGHT || arrow == Direction.LEFT) { ug.apply(new UTranslate(2, (size - triSize) - 2)).draw(triangle);
ug.apply(new UTranslate(2, (size - triSize) - 2)).draw(triangle);
} else {
ug.apply(new UTranslate(2, (size - triSize) - 2)).draw(triangle);
}
} }
private UPolygon getTriangle(int triSize) { private UPolygon getTriangle(int triSize) {

View File

@ -0,0 +1,91 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.graphic;
import java.awt.geom.Dimension2D;
import java.awt.geom.Point2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.svek.GuideLine;
import net.sourceforge.plantuml.ugraphic.UEllipse;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UPolygon;
import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColor;
public class TextBlockArrow2 extends AbstractTextBlock implements TextBlock {
private final double size;
private final GuideLine angle;
private final HColor color;
public TextBlockArrow2(GuideLine angle, FontConfiguration fontConfiguration) {
if (angle == null) {
throw new IllegalArgumentException();
}
this.angle = angle;
this.size = fontConfiguration.getFont().getSize2D();
this.color = fontConfiguration.getColor();
}
public void drawU(UGraphic ug) {
// final double triSize = size * .80;
final int triSize = (int) (size * .80);
ug = ug.apply(color);
ug = ug.apply(color.bg());
ug = ug.apply(new UTranslate(triSize / 2, size / 2));
final UPolygon triangle = new UPolygon();
final double beta = Math.PI * 4 / 5;
triangle.addPoint(getPoint(triSize / 2, angle.getArrowDirection2()));
triangle.addPoint(getPoint(triSize / 2, angle.getArrowDirection2() + beta));
triangle.addPoint(getPoint(triSize / 2, angle.getArrowDirection2() - beta));
triangle.addPoint(getPoint(triSize / 2, angle.getArrowDirection2()));
ug.draw(triangle);
}
private Point2D getPoint(double len, double alpha) {
final double dx = len * Math.sin(alpha);
final double dy = len * Math.cos(alpha);
return new Point2D.Double(dx, dy);
}
public Dimension2D calculateDimension(StringBounder stringBounder) {
return new Dimension2DDouble(size, size);
}
}

View File

@ -42,6 +42,7 @@ import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft; import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft;
import net.sourceforge.plantuml.svek.Ports; import net.sourceforge.plantuml.svek.Ports;
import net.sourceforge.plantuml.svek.WithPorts; import net.sourceforge.plantuml.svek.WithPorts;
import net.sourceforge.plantuml.ugraphic.UEmpty;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.UTranslate;
@ -75,8 +76,14 @@ class TextBlockMarged extends AbstractTextBlock implements TextBlock, WithPorts
} }
public void drawU(UGraphic ug) { public void drawU(UGraphic ug) {
final UTranslate translate = new UTranslate(left, top); // ug.apply(HColorUtils.BLUE).draw(new
textBlock.drawU(ug.apply(translate)); // URectangle(calculateDimension(ug.getStringBounder())));
final Dimension2D dim = calculateDimension(ug.getStringBounder());
if (dim.getWidth() > 0) {
ug.draw(new UEmpty(dim));
final UTranslate translate = new UTranslate(left, top);
textBlock.drawU(ug.apply(translate));
}
} }
@Override @Override

View File

@ -83,8 +83,8 @@ public abstract class USymbol {
public final static USymbol COMPONENT2 = record("COMPONENT2", SkinParameter.COMPONENT2, new USymbolComponent2()); public final static USymbol COMPONENT2 = record("COMPONENT2", SkinParameter.COMPONENT2, new USymbolComponent2());
public final static USymbol BOUNDARY = record("BOUNDARY", SkinParameter.BOUNDARY, new USymbolBoundary()); public final static USymbol BOUNDARY = record("BOUNDARY", SkinParameter.BOUNDARY, new USymbolBoundary());
public final static USymbol ENTITY_DOMAIN = record("ENTITY_DOMAIN", SkinParameter.ENTITY, public final static USymbol ENTITY_DOMAIN = record("ENTITY_DOMAIN", SkinParameter.ENTITY,
new USymbolEntityDomain(2)); new USymbolEntityDomain());
public final static USymbol CONTROL = record("CONTROL", SkinParameter.CONTROL, new USymbolControl(2)); public final static USymbol CONTROL = record("CONTROL", SkinParameter.CONTROL, new USymbolControl());
public final static USymbol INTERFACE = record("INTERFACE", SkinParameter.INTERFACE, new USymbolInterface()); public final static USymbol INTERFACE = record("INTERFACE", SkinParameter.INTERFACE, new USymbolInterface());
public final static USymbol QUEUE = record("QUEUE", SkinParameter.QUEUE, new USymbolQueue()); public final static USymbol QUEUE = record("QUEUE", SkinParameter.QUEUE, new USymbolQueue());
public final static USymbol STACK = record("STACK", SkinParameter.STACK, new USymbolStack()); public final static USymbol STACK = record("STACK", SkinParameter.STACK, new USymbolStack());

View File

@ -36,7 +36,6 @@
package net.sourceforge.plantuml.graphic; package net.sourceforge.plantuml.graphic;
import net.sourceforge.plantuml.skin.ActorStyle; import net.sourceforge.plantuml.skin.ActorStyle;
import net.sourceforge.plantuml.ugraphic.UStroke;
class USymbolActor extends USymbolSimpleAbstract { class USymbolActor extends USymbolSimpleAbstract {
@ -54,8 +53,8 @@ class USymbolActor extends USymbolSimpleAbstract {
@Override @Override
protected TextBlock getDrawing(SymbolContext symbolContext) { protected TextBlock getDrawing(SymbolContext symbolContext) {
final double deltaShadow = symbolContext.isShadowing() ? 4.0 : 0.0; // final double deltaShadow = symbolContext.isShadowing() ? 4.0 : 0.0;
final SymbolContext tmp = symbolContext.withDeltaShadow(deltaShadow).withStroke(new UStroke(2)); // final SymbolContext tmp = symbolContext.withDeltaShadow(deltaShadow).withStroke(new UStroke(2));
return actorStyle.getTextBlock(symbolContext); return actorStyle.getTextBlock(symbolContext);
} }

View File

@ -36,7 +36,6 @@
package net.sourceforge.plantuml.graphic; package net.sourceforge.plantuml.graphic;
import net.sourceforge.plantuml.svek.Boundary; import net.sourceforge.plantuml.svek.Boundary;
import net.sourceforge.plantuml.ugraphic.UStroke;
class USymbolBoundary extends USymbolSimpleAbstract { class USymbolBoundary extends USymbolSimpleAbstract {
@ -45,10 +44,8 @@ class USymbolBoundary extends USymbolSimpleAbstract {
return SkinParameter.BOUNDARY; return SkinParameter.BOUNDARY;
} }
@Override @Override
protected TextBlock getDrawing(final SymbolContext symbolContext) { protected TextBlock getDrawing(SymbolContext symbolContext) {
return new Boundary(symbolContext.withDeltaShadow(symbolContext.isShadowing() ? 4.0 : 0.0).withStroke( return new Boundary(symbolContext.withDeltaShadow(symbolContext.isShadowing() ? 4.0 : 0.0));
new UStroke(2)));
} }
} }

View File

@ -36,26 +36,17 @@
package net.sourceforge.plantuml.graphic; package net.sourceforge.plantuml.graphic;
import net.sourceforge.plantuml.svek.Control; import net.sourceforge.plantuml.svek.Control;
import net.sourceforge.plantuml.ugraphic.UStroke;
class USymbolControl extends USymbolSimpleAbstract { class USymbolControl extends USymbolSimpleAbstract {
private final double thickness;
public USymbolControl(double thickness) {
this.thickness = thickness;
}
@Override @Override
public SkinParameter getSkinParameter() { public SkinParameter getSkinParameter() {
return SkinParameter.CONTROL; return SkinParameter.CONTROL;
} }
@Override @Override
protected TextBlock getDrawing(final SymbolContext symbolContext) { protected TextBlock getDrawing(final SymbolContext symbolContext) {
return new Control(symbolContext.withDeltaShadow(symbolContext.isShadowing() ? 4.0 : 0.0).withStroke( return new Control(symbolContext.withDeltaShadow(symbolContext.isShadowing() ? 4.0 : 0.0));
new UStroke(thickness)));
} }
} }

View File

@ -36,25 +36,16 @@
package net.sourceforge.plantuml.graphic; package net.sourceforge.plantuml.graphic;
import net.sourceforge.plantuml.svek.EntityDomain; import net.sourceforge.plantuml.svek.EntityDomain;
import net.sourceforge.plantuml.ugraphic.UStroke;
class USymbolEntityDomain extends USymbolSimpleAbstract { class USymbolEntityDomain extends USymbolSimpleAbstract {
private final double thickness;
public USymbolEntityDomain(double thickness) {
this.thickness = thickness;
}
@Override @Override
public SkinParameter getSkinParameter() { public SkinParameter getSkinParameter() {
return SkinParameter.ENTITY; return SkinParameter.ENTITY;
} }
@Override @Override
protected TextBlock getDrawing(final SymbolContext symbolContext) { protected TextBlock getDrawing(final SymbolContext symbolContext) {
return new EntityDomain(symbolContext.withDeltaShadow(symbolContext.isShadowing() ? 4.0 : 0.0).withStroke( return new EntityDomain(symbolContext.withDeltaShadow(symbolContext.isShadowing() ? 4.0 : 0.0));
new UStroke(thickness)));
} }
} }

View File

@ -39,6 +39,8 @@ import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.UTranslate;
abstract class USymbolSimpleAbstract extends USymbol { abstract class USymbolSimpleAbstract extends USymbol {
@ -66,9 +68,9 @@ abstract class USymbolSimpleAbstract extends USymbol {
final double labelY = dimStickMan.getHeight() + dimStereo.getHeight(); final double labelY = dimStickMan.getHeight() + dimStereo.getHeight();
// Actor bug? // Actor bug?
// final UGraphic ug2 = UGraphicStencil.create(ug, getRectangleStencil(dimLabel), new UStroke()); final UGraphic ug2 = UGraphicStencil.create(ug, getRectangleStencil(dimLabel), new UStroke());
// label.drawU(ug2.apply(new UTranslate(labelX, labelY))); label.drawU(ug2.apply(new UTranslate(labelX, labelY)));
label.drawU(ug.apply(new UTranslate(labelX, labelY))); // label.drawU(ug.apply(new UTranslate(labelX, labelY)));
final double stereoX = (dimTotal.getWidth() - dimStereo.getWidth()) / 2; final double stereoX = (dimTotal.getWidth() - dimStereo.getWidth()) / 2;
stereotype.drawU(ug.apply(UTranslate.dx(stereoX))); stereotype.drawU(ug.apply(UTranslate.dx(stereoX)));

View File

@ -39,9 +39,9 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.UmlDiagramFactory; import net.sourceforge.plantuml.command.PSystemCommandFactory;
public class HelpFactory extends UmlDiagramFactory { public class HelpFactory extends PSystemCommandFactory {
@Override @Override
public Help createEmptyDiagram() { public Help createEmptyDiagram() {

View File

@ -423,10 +423,10 @@ public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker {
final int margin2; final int margin2;
if (SkinParam.USE_STYLES()) { if (SkinParam.USE_STYLES()) {
margin1 = SkinParam.zeroMargin(0); margin1 = SkinParam.zeroMargin(0);
margin2 = SkinParam.zeroMargin(10); margin2 = SkinParam.zeroMargin(0);
} else { } else {
margin1 = 0; margin1 = 0;
margin2 = 10; margin2 = 0;
} }
final ImageBuilder imageBuilder = ImageBuilder.buildD(diagram.getSkinParam(), final ImageBuilder imageBuilder = ImageBuilder.buildD(diagram.getSkinParam(),
ClockwiseTopRightBottomLeft.margin1margin2(margin1, margin2), diagram.getAnimation(), ClockwiseTopRightBottomLeft.margin1margin2(margin1, margin2), diagram.getAnimation(),

View File

@ -76,8 +76,8 @@ public class PSystemTree extends AbstractPSystem {
margin1 = 5; margin1 = 5;
margin2 = 5; margin2 = 5;
} }
final ImageBuilder builder = ImageBuilder.buildB(new ColorMapperIdentity(), false, ClockwiseTopRightBottomLeft.margin1margin2((double) margin1, (double) margin2), final ImageBuilder builder = ImageBuilder.buildB(new ColorMapperIdentity(), false,
null, null, null, 1.0, HColorUtils.WHITE); ClockwiseTopRightBottomLeft.margin1margin2(margin1, margin2), null, null, null, 1.0, HColorUtils.WHITE);
if (rendering == Rendering.NEEDLE) { if (rendering == Rendering.NEEDLE) {
final UDrawable tmp = Needle.getNeedle(root, 200, 0, 60); final UDrawable tmp = Needle.getNeedle(root, 200, 0, 60);
final LimitFinder limitFinder = new LimitFinder(fileFormat.getDefaultStringBounder(), true); final LimitFinder limitFinder = new LimitFinder(fileFormat.getDefaultStringBounder(), true);

View File

@ -38,10 +38,10 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.UmlDiagramFactory; import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.DiagramType;
public class PSystemTreeFactory extends UmlDiagramFactory { public class PSystemTreeFactory extends PSystemCommandFactory {
public PSystemTreeFactory(DiagramType type) { public PSystemTreeFactory(DiagramType type) {
super(type); super(type);

View File

@ -39,10 +39,10 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.UmlDiagramFactory; import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.DiagramType;
public class MindMapDiagramFactory extends UmlDiagramFactory { public class MindMapDiagramFactory extends PSystemCommandFactory {
public MindMapDiagramFactory() { public MindMapDiagramFactory() {
super(DiagramType.MINDMAP); super(DiagramType.MINDMAP);

View File

@ -39,9 +39,9 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.UmlDiagramFactory; import net.sourceforge.plantuml.command.PSystemCommandFactory;
public class NwDiagramFactory extends UmlDiagramFactory { public class NwDiagramFactory extends PSystemCommandFactory {
@Override @Override
public NwDiagram createEmptyDiagram() { public NwDiagram createEmptyDiagram() {

View File

@ -73,8 +73,8 @@ public class PSystemOpenIconic extends AbstractPSystem {
margin1 = 5; margin1 = 5;
margin2 = 5; margin2 = 5;
} }
final ImageBuilder imageBuilder = ImageBuilder.buildB(new ColorMapperIdentity(), false, ClockwiseTopRightBottomLeft.margin1margin2((double) margin1, (double) margin2), final ImageBuilder imageBuilder = ImageBuilder.buildB(new ColorMapperIdentity(), false,
null, null, null, 1.0, null); ClockwiseTopRightBottomLeft.margin1margin2(margin1, margin2), null, null, null, 1.0, null);
imageBuilder.setUDrawable(icon.asTextBlock(HColorUtils.BLACK, factor)); imageBuilder.setUDrawable(icon.asTextBlock(HColorUtils.BLACK, factor));
return imageBuilder.writeImageTOBEMOVED(fileFormat, seed, os); return imageBuilder.writeImageTOBEMOVED(fileFormat, seed, os);
@ -89,7 +89,8 @@ public class PSystemOpenIconic extends AbstractPSystem {
// private GraphicStrings getGraphicStrings() throws IOException { // private GraphicStrings getGraphicStrings() throws IOException {
// final UFont font = new UFont("SansSerif", Font.PLAIN, 12); // final UFont font = new UFont("SansSerif", Font.PLAIN, 12);
// final GraphicStrings result = new GraphicStrings(strings, font, HtmlColorUtils.BLACK, HtmlColorUtils.WHITE, // final GraphicStrings result = new GraphicStrings(strings, font,
// HtmlColorUtils.BLACK, HtmlColorUtils.WHITE,
// UAntiAliasing.ANTI_ALIASING_ON); // UAntiAliasing.ANTI_ALIASING_ON);
// return result; // return result;
// } // }

View File

@ -39,9 +39,9 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.UmlDiagramFactory; import net.sourceforge.plantuml.command.PSystemCommandFactory;
public class PostIdDiagramFactory extends UmlDiagramFactory { public class PostIdDiagramFactory extends PSystemCommandFactory {
@Override @Override
protected List<Command> createCommands() { protected List<Command> createCommands() {

View File

@ -35,7 +35,7 @@
*/ */
package net.sourceforge.plantuml.project; package net.sourceforge.plantuml.project;
import net.sourceforge.plantuml.project.time.Wink; import net.sourceforge.plantuml.project.time.Day;
public class ConstantPlan implements LoadPlanable { public class ConstantPlan implements LoadPlanable {
@ -53,7 +53,7 @@ public class ConstantPlan implements LoadPlanable {
return new ConstantPlan(load); return new ConstantPlan(load);
} }
public int getLoadAt(Wink instant) { public int getLoadAt(Day instant) {
return loadPerInstant; return loadPerInstant;
} }

View File

@ -56,7 +56,7 @@ public class DaysAsDates implements Iterable<Day> {
if (gantt.isOpen(tmp)) { if (gantt.isOpen(tmp)) {
count--; count--;
} }
tmp = tmp.next(); tmp = tmp.increment();
} }
this.date2 = tmp; this.date2 = tmp;
} }
@ -75,7 +75,7 @@ public class DaysAsDates implements Iterable<Day> {
public Day next() { public Day next() {
final Day result = current; final Day result = current;
current = current.next(); current = current.increment();
return result; return result;
} }

View File

@ -98,13 +98,13 @@ public class GanttArrow implements UDrawable {
ug = ug.apply(color.bg()).apply(color).apply(style.getStroke3(new UStroke(1.5))); ug = ug.apply(color.bg()).apply(color).apply(style.getStroke3(new UStroke(1.5)));
double x1 = getX(source.withDelta(0), atStart); double x1 = getX(source.withDelta(0), atStart);
double y1 = getSource().getY(atStart).getValue(); double y1 = getSource().getY(atStart);
final double x2 = getX(dest, atEnd.getInv()); final double x2 = getX(dest, atEnd.getInv());
final double y2 = getDestination().getY(atEnd).getValue(); final double y2 = getDestination().getY(atEnd);
if (atStart == Direction.DOWN && y2 < y1) { if (atStart == Direction.DOWN && y2 < y1) {
y1 = getSource().getY(atStart.getInv()).getValue(); y1 = getSource().getY(atStart.getInv());
} }
if (this.atStart == Direction.DOWN && this.atEnd == Direction.RIGHT) { if (this.atStart == Direction.DOWN && this.atEnd == Direction.RIGHT) {
@ -115,7 +115,7 @@ public class GanttArrow implements UDrawable {
drawLine(ug, x1, y1, x1, y2, x2, y2); drawLine(ug, x1, y1, x1, y2, x2, y2);
} else { } else {
x1 = getX(source.withDelta(0), Direction.RIGHT); x1 = getX(source.withDelta(0), Direction.RIGHT);
y1 = getSource().getY(Direction.RIGHT).getValue(); y1 = getSource().getY(Direction.RIGHT);
drawLine(ug, x1, y1, x1 + 6, y1, x1 + 6, y1 + 8, x2 - 8, y1 + 8, x2 - 8, y2, x2, y2); drawLine(ug, x1, y1, x1 + 6, y1, x1 + 6, y1 + 8, x2 - 8, y1 + 8, x2 - 8, y2, x2, y2);
} }
} else if (this.atStart == Direction.RIGHT && this.atEnd == Direction.LEFT) { } else if (this.atStart == Direction.RIGHT && this.atEnd == Direction.LEFT) {

View File

@ -40,7 +40,7 @@ import net.sourceforge.plantuml.cucadiagram.LinkType;
import net.sourceforge.plantuml.cucadiagram.WithLinkType; import net.sourceforge.plantuml.cucadiagram.WithLinkType;
import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.UDrawable;
import net.sourceforge.plantuml.project.core.TaskInstant; import net.sourceforge.plantuml.project.core.TaskInstant;
import net.sourceforge.plantuml.project.time.Wink; import net.sourceforge.plantuml.project.time.Day;
import net.sourceforge.plantuml.project.timescale.TimeScale; import net.sourceforge.plantuml.project.timescale.TimeScale;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
@ -72,7 +72,7 @@ public class GanttConstraint extends WithLinkType {
return new GanttArrow(timeScale, source, dest, getSpecificColor(), getType(), toTaskDraw); return new GanttArrow(timeScale, source, dest, getSpecificColor(), getType(), toTaskDraw);
} }
public boolean isHidden(Wink min, Wink max) { public boolean isHidden(Day min, Day max) {
if (isHidden(source.getInstantPrecise(), min, max)) { if (isHidden(source.getInstantPrecise(), min, max)) {
return true; return true;
} }
@ -82,7 +82,7 @@ public class GanttConstraint extends WithLinkType {
return false; return false;
} }
private boolean isHidden(Wink now, Wink min, Wink max) { private boolean isHidden(Day now, Day min, Day max) {
if (now.compareTo(min) < 0) { if (now.compareTo(min) < 0) {
return true; return true;
} }

View File

@ -57,6 +57,7 @@ import net.sourceforge.plantuml.Scale;
import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.TitledDiagram; import net.sourceforge.plantuml.TitledDiagram;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.WithSprite;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.core.ImageData;
@ -85,12 +86,9 @@ import net.sourceforge.plantuml.project.draw.TimeHeaderDaily;
import net.sourceforge.plantuml.project.draw.TimeHeaderMonthly; import net.sourceforge.plantuml.project.draw.TimeHeaderMonthly;
import net.sourceforge.plantuml.project.draw.TimeHeaderSimple; import net.sourceforge.plantuml.project.draw.TimeHeaderSimple;
import net.sourceforge.plantuml.project.draw.TimeHeaderWeekly; import net.sourceforge.plantuml.project.draw.TimeHeaderWeekly;
import net.sourceforge.plantuml.project.draw.YMovable;
import net.sourceforge.plantuml.project.lang.CenterBorderColor; import net.sourceforge.plantuml.project.lang.CenterBorderColor;
import net.sourceforge.plantuml.project.time.Day; import net.sourceforge.plantuml.project.time.Day;
import net.sourceforge.plantuml.project.time.DayOfWeek; import net.sourceforge.plantuml.project.time.DayOfWeek;
import net.sourceforge.plantuml.project.time.GCalendar;
import net.sourceforge.plantuml.project.time.Wink;
import net.sourceforge.plantuml.project.timescale.TimeScale; import net.sourceforge.plantuml.project.timescale.TimeScale;
import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft; import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft;
import net.sourceforge.plantuml.svek.TextBlockBackcolored; import net.sourceforge.plantuml.svek.TextBlockBackcolored;
@ -103,7 +101,7 @@ import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorSet; import net.sourceforge.plantuml.ugraphic.color.HColorSet;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils; import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
public class GanttDiagram extends TitledDiagram implements ToTaskDraw { public class GanttDiagram extends TitledDiagram implements ToTaskDraw, WithSprite {
private final Map<TaskCode, Task> tasks = new LinkedHashMap<TaskCode, Task>(); private final Map<TaskCode, Task> tasks = new LinkedHashMap<TaskCode, Task>();
private final Map<String, Task> byShortName = new HashMap<String, Task>(); private final Map<String, Task> byShortName = new HashMap<String, Task>();
@ -120,10 +118,10 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw {
private PrintScale printScale = PrintScale.DAILY; private PrintScale printScale = PrintScale.DAILY;
private Day today; private Day today;
private GCalendar calendar; private Day calendar;
private double totalHeight; private double totalHeight;
private Wink min = new Wink(0); private Day min = Day.create(0);
private Wink max; private Day max;
private Day printStart; private Day printStart;
private Day printEnd; private Day printEnd;
@ -213,8 +211,8 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw {
if (printStart == null) { if (printStart == null) {
initMinMax(); initMinMax();
} else { } else {
this.min = calendar.fromDayAsDate(printStart); this.min = printStart;
this.max = calendar.fromDayAsDate(printEnd); this.max = printEnd;
} }
final TimeHeader timeHeader; final TimeHeader timeHeader;
if (calendar == null) { if (calendar == null) {
@ -262,7 +260,7 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw {
private void drawTasksRect(UGraphic ug) { private void drawTasksRect(UGraphic ug) {
for (Task task : tasks.values()) { for (Task task : tasks.values()) {
final TaskDraw draw = draws.get(task); final TaskDraw draw = draws.get(task);
final UTranslate move = UTranslate.dy(draw.getY().getValue()); final UTranslate move = UTranslate.dy(draw.getY());
draw.drawU(ug.apply(move)); draw.drawU(ug.apply(move));
} }
} }
@ -282,7 +280,7 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw {
continue; continue;
} }
final TaskDraw draw = draws.get(task); final TaskDraw draw = draws.get(task);
final UTranslate move = UTranslate.dy(draw.getY().getValue()); final UTranslate move = UTranslate.dy(draw.getY());
draw.drawTitle(ug1.apply(move)); draw.drawTitle(ug1.apply(move));
} }
} }
@ -297,11 +295,10 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw {
public final LoadPlanable getDefaultPlan() { public final LoadPlanable getDefaultPlan() {
return new LoadPlanable() { return new LoadPlanable() {
public int getLoadAt(Wink instant) { public int getLoadAt(Day day) {
if (calendar == null) { if (calendar == null) {
return 100; return 100;
} }
final Day day = calendar.toDayAsDate((Wink) instant);
if (isClosed(day)) { if (isClosed(day)) {
return 0; return 0;
} }
@ -333,7 +330,7 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw {
private final Map<Task, TaskDraw> draws = new LinkedHashMap<Task, TaskDraw>(); private final Map<Task, TaskDraw> draws = new LinkedHashMap<Task, TaskDraw>();
private void initTaskAndResourceDraws(TimeScale timeScale, double headerHeight, StringBounder stringBounder) { private void initTaskAndResourceDraws(TimeScale timeScale, double headerHeight, StringBounder stringBounder) {
YMovable y = new YMovable(headerHeight); double y = headerHeight;
for (Task task : tasks.values()) { for (Task task : tasks.values()) {
final TaskDraw draw; final TaskDraw draw;
if (task instanceof TaskSeparator) { if (task instanceof TaskSeparator) {
@ -352,30 +349,36 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw {
draw.setColorsAndCompletion(tmp.getColors(), tmp.getCompletion(), tmp.getUrl(), tmp.getNote()); draw.setColorsAndCompletion(tmp.getColors(), tmp.getCompletion(), tmp.getUrl(), tmp.getNote());
} }
if (task.getRow() == null) { if (task.getRow() == null) {
y = y.add(draw.getHeightTask()); y += draw.getHeightTask();
} }
draws.put(task, draw); draws.put(task, draw);
} }
magicPush(stringBounder); while (magicPushOnce(stringBounder)) {
y = lastY(stringBounder); //
for (Resource res : resources.values()) {
final ResourceDraw draw = new ResourceDraw(this, res, timeScale, y, min, max);
res.setTaskDraw(draw);
y = y.add(draw.getHeight());
} }
this.totalHeight = y.getValue(); if (lastY(stringBounder) != 0) {
y = lastY(stringBounder);
for (Resource res : resources.values()) {
final ResourceDraw draw = new ResourceDraw(this, res, timeScale, y, min, max);
res.setTaskDraw(draw);
y += draw.getHeight();
}
}
this.totalHeight = y;
} }
private YMovable lastY(StringBounder stringBounder) { private double lastY(StringBounder stringBounder) {
TaskDraw last = null; TaskDraw last = null;
for (TaskDraw td : draws.values()) { for (TaskDraw td : draws.values()) {
last = td; last = td;
} }
return last.getY().add(last.getHeightMax(stringBounder)); if (last == null) {
return 0;
}
return last.getY() + last.getHeightMax(stringBounder);
} }
private boolean magicPush(StringBounder stringBounder) { private boolean magicPushOnce(StringBounder stringBounder) {
final List<FingerPrint> notes = new ArrayList<FingerPrint>(); final List<FingerPrint> notes = new ArrayList<FingerPrint>();
for (TaskDraw td : draws.values()) { for (TaskDraw td : draws.values()) {
final FingerPrint taskPrint = td.getFingerPrint(); final FingerPrint taskPrint = td.getFingerPrint();
@ -397,29 +400,32 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw {
private void pushIncluding(TaskDraw first, double deltaY) { private void pushIncluding(TaskDraw first, double deltaY) {
boolean skipping = true; boolean skipping = true;
if (first.getTrueRow() != null) {
first = first.getTrueRow();
}
for (TaskDraw td : draws.values()) { for (TaskDraw td : draws.values()) {
if (td == first) if (td == first)
skipping = false; skipping = false;
if (skipping) if (skipping)
continue; continue;
td.getY().pushMe(deltaY + 1); td.pushMe(deltaY + 1);
} }
} }
private Wink getStart(final TaskImpl tmp) { private Day getStart(final TaskImpl tmp) {
if (printStart == null) { if (printStart == null) {
return tmp.getStart(); return tmp.getStart();
} }
return Wink.max(min, tmp.getStart()); return Day.max(min, tmp.getStart());
} }
private Wink getEnd(final TaskImpl tmp) { private Day getEnd(final TaskImpl tmp) {
if (printStart == null) { if (printStart == null) {
return tmp.getEnd(); return tmp.getEnd();
} }
return Wink.min(max, tmp.getEnd()); return Day.min(max, tmp.getEnd());
} }
private void initMinMax() { private void initMinMax() {
@ -431,8 +437,8 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw {
if (task instanceof TaskSeparator) { if (task instanceof TaskSeparator) {
continue; continue;
} }
final Wink start = task.getStart(); final Day start = task.getStart();
final Wink end = task.getEnd(); final Day end = task.getEnd();
// if (min.compareTo(start) > 0) { // if (min.compareTo(start) > 0) {
// min = start; // min = start;
// } // }
@ -443,15 +449,13 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw {
} }
if (calendar != null) { if (calendar != null) {
for (Day d : colorDays.keySet()) { for (Day d : colorDays.keySet()) {
final Wink instant = calendar.fromDayAsDate(d); if (d.compareTo(max) > 0) {
if (instant.compareTo(max) > 0) { max = d;
max = instant;
} }
} }
for (Day d : nameDays.keySet()) { for (Day d : nameDays.keySet()) {
final Wink instant = calendar.fromDayAsDate(d); if (d.compareTo(max) > 0) {
if (instant.compareTo(max) > 0) { max = d;
max = instant;
} }
} }
} }
@ -547,33 +551,27 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw {
} }
public void setStartingDate(Day start) { public void setStartingDate(Day start) {
this.calendar = new GCalendar(start); this.calendar = start;
this.min = start;
} }
public Day getStartingDate() { public Day getStartingDate() {
if (this.calendar == null) { return this.calendar;
return null;
}
return this.calendar.getStartingDate();
} }
public Day getStartingDate(int nday) { public Day getStartingDate(int nday) {
if (this.calendar == null) { if (this.calendar == null) {
return null; return null;
} }
return this.calendar.toDayAsDate(new Wink(nday)); return this.calendar.addDays(nday);
} }
public int daysInWeek() { public int daysInWeek() {
return 7 - closedDayOfWeek.size(); return 7 - closedDayOfWeek.size();
} }
public Wink convert(Day day) {
return calendar.fromDayAsDate(day);
}
public boolean isOpen(Day day) { public boolean isOpen(Day day) {
return getDefaultPlan().getLoadAt(convert(day)) > 0; return getDefaultPlan().getLoadAt(day) > 0;
} }
public void affectResource(Task result, String description) { public void affectResource(Task result, String description) {
@ -593,13 +591,13 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw {
public Resource getResource(String resourceName) { public Resource getResource(String resourceName) {
Resource resource = resources.get(resourceName); Resource resource = resources.get(resourceName);
if (resource == null) { if (resource == null) {
resource = new Resource(resourceName, getDefaultPlan(), calendar); resource = new Resource(resourceName, getDefaultPlan());
} }
resources.put(resourceName, resource); resources.put(resourceName, resource);
return resource; return resource;
} }
public int getLoadForResource(Resource res, Wink i) { public int getLoadForResource(Resource res, Day i) {
int result = 0; int result = 0;
for (Task task : tasks.values()) { for (Task task : tasks.values()) {
if (task instanceof TaskSeparator) { if (task instanceof TaskSeparator) {
@ -624,7 +622,7 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw {
end = max(end, ent.getKey()); end = max(end, ent.getKey());
} }
if (start != null) { if (start != null) {
result = new MomentImpl(convert(start), convert(end)); result = new MomentImpl(start, end);
} }
} }
return result; return result;

View File

@ -42,8 +42,7 @@ import java.util.List;
import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommandNope; import net.sourceforge.plantuml.command.CommandNope;
import net.sourceforge.plantuml.command.CommandScale; import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.command.UmlDiagramFactory;
import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.DiagramType;
import net.sourceforge.plantuml.project.command.CommandColorTask; import net.sourceforge.plantuml.project.command.CommandColorTask;
import net.sourceforge.plantuml.project.command.CommandGanttArrow; import net.sourceforge.plantuml.project.command.CommandGanttArrow;
@ -69,7 +68,7 @@ import net.sourceforge.plantuml.project.lang.SubjectToday;
import net.sourceforge.plantuml.style.CommandStyleImport; import net.sourceforge.plantuml.style.CommandStyleImport;
import net.sourceforge.plantuml.style.CommandStyleMultilinesCSS; import net.sourceforge.plantuml.style.CommandStyleMultilinesCSS;
public class GanttDiagramFactory extends UmlDiagramFactory { public class GanttDiagramFactory extends PSystemCommandFactory {
static private final List<Subject> subjects() { static private final List<Subject> subjects() {
return Arrays.<Subject>asList(new SubjectTask(), new SubjectProject(), new SubjectDayOfWeek(), return Arrays.<Subject>asList(new SubjectTask(), new SubjectProject(), new SubjectDayOfWeek(),
@ -85,6 +84,7 @@ public class GanttDiagramFactory extends UmlDiagramFactory {
protected List<Command> createCommands() { protected List<Command> createCommands() {
final List<Command> cmds = new ArrayList<Command>(); final List<Command> cmds = new ArrayList<Command>();
addTitleCommands(cmds); addTitleCommands(cmds);
addCommonCommands2(cmds);
cmds.add(new CommandStyleMultilinesCSS()); cmds.add(new CommandStyleMultilinesCSS());
cmds.add(new CommandStyleImport()); cmds.add(new CommandStyleImport());
@ -101,7 +101,6 @@ public class GanttDiagramFactory extends UmlDiagramFactory {
cmds.add(new CommandPrintScale()); cmds.add(new CommandPrintScale());
cmds.add(new CommandPrintBetween()); cmds.add(new CommandPrintBetween());
cmds.add(new CommandScale());
cmds.add(new CommandPage()); cmds.add(new CommandPage());
cmds.add(new CommandNoteBottom()); cmds.add(new CommandNoteBottom());

View File

@ -35,9 +35,9 @@
*/ */
package net.sourceforge.plantuml.project; package net.sourceforge.plantuml.project;
import net.sourceforge.plantuml.project.time.Wink; import net.sourceforge.plantuml.project.time.Day;
public interface LoadPlanable { public interface LoadPlanable {
public int getLoadAt(Wink instant); public int getLoadAt(Day instant);
} }

View File

@ -35,7 +35,7 @@
*/ */
package net.sourceforge.plantuml.project; package net.sourceforge.plantuml.project;
import net.sourceforge.plantuml.project.time.Wink; import net.sourceforge.plantuml.project.time.Day;
public class PlanUtils { public class PlanUtils {
@ -45,7 +45,7 @@ public class PlanUtils {
public static LoadPlanable minOf(final LoadPlanable p1, final LoadPlanable p2) { public static LoadPlanable minOf(final LoadPlanable p1, final LoadPlanable p2) {
return new LoadPlanable() { return new LoadPlanable() {
public int getLoadAt(Wink instant) { public int getLoadAt(Day instant) {
return Math.min(p1.getLoadAt(instant), p2.getLoadAt(instant)); return Math.min(p1.getLoadAt(instant), p2.getLoadAt(instant));
} }
}; };
@ -53,7 +53,7 @@ public class PlanUtils {
public static LoadPlanable multiply(final LoadPlanable p1, final LoadPlanable p2) { public static LoadPlanable multiply(final LoadPlanable p1, final LoadPlanable p2) {
return new LoadPlanable() { return new LoadPlanable() {
public int getLoadAt(Wink instant) { public int getLoadAt(Day instant) {
return p1.getLoadAt(instant) * p2.getLoadAt(instant) / 100; return p1.getLoadAt(instant) * p2.getLoadAt(instant) / 100;
} }
}; };

View File

@ -41,7 +41,7 @@ import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import net.sourceforge.plantuml.project.core.TaskAttribute; import net.sourceforge.plantuml.project.core.TaskAttribute;
import net.sourceforge.plantuml.project.time.Wink; import net.sourceforge.plantuml.project.time.Day;
public class Solver { public class Solver {
@ -56,8 +56,8 @@ public class Solver {
public void setData(TaskAttribute attribute, Value value) { public void setData(TaskAttribute attribute, Value value) {
final Value previous = values.remove(attribute); final Value previous = values.remove(attribute);
if (previous != null && attribute == TaskAttribute.START) { if (previous != null && attribute == TaskAttribute.START) {
final Wink previousInstant = (Wink) previous; final Day previousInstant = (Day) previous;
if (previousInstant.compareTo((Wink) value) > 0) { if (previousInstant.compareTo((Day) value) > 0) {
value = previous; value = previous;
} }
} }
@ -90,8 +90,8 @@ public class Solver {
return result; return result;
} }
private Wink computeEnd() { private Day computeEnd() {
Wink current = (Wink) values.get(TaskAttribute.START); Day current = (Day) values.get(TaskAttribute.START);
int fullLoad = ((Load) values.get(TaskAttribute.LOAD)).getFullLoad(); int fullLoad = ((Load) values.get(TaskAttribute.LOAD)).getFullLoad();
while (fullLoad > 0) { while (fullLoad > 0) {
fullLoad -= loadPlanable.getLoadAt(current); fullLoad -= loadPlanable.getLoadAt(current);
@ -100,13 +100,13 @@ public class Solver {
return current.decrement(); return current.decrement();
} }
private Wink computeStart() { private Day computeStart() {
Wink current = (Wink) values.get(TaskAttribute.END); Day current = (Day) values.get(TaskAttribute.END);
int fullLoad = ((Load) values.get(TaskAttribute.LOAD)).getFullLoad(); int fullLoad = ((Load) values.get(TaskAttribute.LOAD)).getFullLoad();
while (fullLoad > 0) { while (fullLoad > 0) {
fullLoad -= loadPlanable.getLoadAt(current); fullLoad -= loadPlanable.getLoadAt(current);
current = current.decrement(); current = current.decrement();
if (current.getWink() <= 0) { if (current.getMillis() <= 0) {
return current; return current;
} }
} }

View File

@ -42,4 +42,6 @@ public interface ToTaskDraw {
public TaskDraw getTaskDraw(Task task); public TaskDraw getTaskDraw(Task task);
public LoadPlanable getDefaultPlan();
} }

View File

@ -46,8 +46,6 @@ import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement;
import net.sourceforge.plantuml.project.GanttConstraint; import net.sourceforge.plantuml.project.GanttConstraint;
import net.sourceforge.plantuml.project.GanttDiagram; import net.sourceforge.plantuml.project.GanttDiagram;
import net.sourceforge.plantuml.project.core.Task; import net.sourceforge.plantuml.project.core.Task;
import net.sourceforge.plantuml.project.core.TaskAttribute;
import net.sourceforge.plantuml.project.core.TaskInstant;
public class CommandGanttArrow extends SingleLineCommand2<GanttDiagram> { public class CommandGanttArrow extends SingleLineCommand2<GanttDiagram> {

View File

@ -35,12 +35,12 @@
*/ */
package net.sourceforge.plantuml.project.core; package net.sourceforge.plantuml.project.core;
import net.sourceforge.plantuml.project.time.Wink; import net.sourceforge.plantuml.project.time.Day;
public interface Moment { public interface Moment {
public Wink getStart(); public Day getStart();
public Wink getEnd(); public Day getEnd();
} }

View File

@ -35,23 +35,23 @@
*/ */
package net.sourceforge.plantuml.project.core; package net.sourceforge.plantuml.project.core;
import net.sourceforge.plantuml.project.time.Wink; import net.sourceforge.plantuml.project.time.Day;
public class MomentImpl implements Moment { public class MomentImpl implements Moment {
private final Wink start; private final Day start;
private final Wink end; private final Day end;
public MomentImpl(Wink start, Wink end) { public MomentImpl(Day start, Day end) {
this.start = start; this.start = start;
this.end = end; this.end = end;
} }
public Wink getStart() { public Day getStart() {
return start; return start;
} }
public Wink getEnd() { public Day getEnd() {
return end; return end;
} }

View File

@ -44,22 +44,18 @@ import net.sourceforge.plantuml.project.LoadPlanable;
import net.sourceforge.plantuml.project.draw.ResourceDraw; import net.sourceforge.plantuml.project.draw.ResourceDraw;
import net.sourceforge.plantuml.project.time.Day; import net.sourceforge.plantuml.project.time.Day;
import net.sourceforge.plantuml.project.time.DayOfWeek; import net.sourceforge.plantuml.project.time.DayOfWeek;
import net.sourceforge.plantuml.project.time.GCalendar;
import net.sourceforge.plantuml.project.time.Wink;
public class Resource { public class Resource {
private final String name; private final String name;
private ResourceDraw draw; private ResourceDraw draw;
private final Set<Wink> closed = new TreeSet<Wink>(); private final Set<Day> closed = new TreeSet<Day>();
private final Set<Wink> forcedOn = new TreeSet<Wink>(); private final Set<Day> forcedOn = new TreeSet<Day>();
private final GCalendar calendar;
private final Collection<DayOfWeek> closedDayOfWeek = EnumSet.noneOf(DayOfWeek.class); private final Collection<DayOfWeek> closedDayOfWeek = EnumSet.noneOf(DayOfWeek.class);
public Resource(String name, LoadPlanable loadPlanable, GCalendar calendar) { public Resource(String name, LoadPlanable loadPlanable) {
this.name = name; this.name = name;
this.calendar = calendar;
} }
@Override @Override
@ -90,24 +86,23 @@ public class Resource {
this.draw = draw; this.draw = draw;
} }
public boolean isClosedAt(Wink instant) { public boolean isClosedAt(Day instant) {
if (this.forcedOn.contains(instant)) { if (this.forcedOn.contains(instant)) {
return false; return false;
} }
if (closedDayOfWeek.size() > 0 && calendar != null) { if (closedDayOfWeek.size() > 0) {
final Day d = calendar.toDayAsDate((Wink) instant); if (closedDayOfWeek.contains(instant.getDayOfWeek())) {
if (closedDayOfWeek.contains(d.getDayOfWeek())) {
return true; return true;
} }
} }
return this.closed.contains(instant); return this.closed.contains(instant);
} }
public void addCloseDay(Wink instant) { public void addCloseDay(Day instant) {
this.closed.add(instant); this.closed.add(instant);
} }
public void addForceOnDay(Wink instant) { public void addForceOnDay(Day instant) {
this.forcedOn.add(instant); this.forcedOn.add(instant);
} }

View File

@ -39,24 +39,24 @@ import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.project.Load; import net.sourceforge.plantuml.project.Load;
import net.sourceforge.plantuml.project.lang.CenterBorderColor; import net.sourceforge.plantuml.project.lang.CenterBorderColor;
import net.sourceforge.plantuml.project.time.Day;
import net.sourceforge.plantuml.project.time.DayOfWeek; import net.sourceforge.plantuml.project.time.DayOfWeek;
import net.sourceforge.plantuml.project.time.Wink;
public interface Task extends Moment { public interface Task extends Moment {
public TaskCode getCode(); public TaskCode getCode();
public Wink getStart(); public Day getStart();
public Wink getEnd(); public Day getEnd();
public Load getLoad(); public Load getLoad();
public void setLoad(Load load); public void setLoad(Load load);
public void setStart(Wink start); public void setStart(Day start);
public void setEnd(Wink end); public void setEnd(Day end);
public void setColors(CenterBorderColor colors); public void setColors(CenterBorderColor colors);
@ -74,7 +74,7 @@ public interface Task extends Moment {
public Task getRow(); public Task getRow();
public void addPause(Wink pause); public void addPause(Day pause);
public void addPause(DayOfWeek pause); public void addPause(DayOfWeek pause);

View File

@ -54,17 +54,14 @@ import net.sourceforge.plantuml.project.Solver;
import net.sourceforge.plantuml.project.lang.CenterBorderColor; import net.sourceforge.plantuml.project.lang.CenterBorderColor;
import net.sourceforge.plantuml.project.time.Day; import net.sourceforge.plantuml.project.time.Day;
import net.sourceforge.plantuml.project.time.DayOfWeek; import net.sourceforge.plantuml.project.time.DayOfWeek;
import net.sourceforge.plantuml.project.time.GCalendar;
import net.sourceforge.plantuml.project.time.Wink;
public class TaskImpl extends AbstractTask implements Task, LoadPlanable { public class TaskImpl extends AbstractTask implements Task, LoadPlanable {
private final SortedSet<Wink> pausedDay = new TreeSet<Wink>(); private final SortedSet<Day> pausedDay = new TreeSet<Day>();
private final Set<DayOfWeek> pausedDayOfWeek = new HashSet<DayOfWeek>(); private final Set<DayOfWeek> pausedDayOfWeek = new HashSet<DayOfWeek>();
private final Solver solver; private final Solver solver;
private final Map<Resource, Integer> resources = new LinkedHashMap<Resource, Integer>(); private final Map<Resource, Integer> resources = new LinkedHashMap<Resource, Integer>();
private final LoadPlanable defaultPlan; private final LoadPlanable defaultPlan;
private final GCalendar calendar;
private boolean diamond; private boolean diamond;
private int completion = 100; private int completion = 100;
@ -77,16 +74,19 @@ public class TaskImpl extends AbstractTask implements Task, LoadPlanable {
this.url = url; this.url = url;
} }
public TaskImpl(TaskCode code, LoadPlanable defaultPlan, GCalendar calendar) { public TaskImpl(TaskCode code, LoadPlanable defaultPlan, Day calendar) {
super(code); super(code);
this.calendar = calendar;
this.defaultPlan = defaultPlan; this.defaultPlan = defaultPlan;
this.solver = new Solver(this); this.solver = new Solver(this);
setStart(new Wink(0)); if (calendar == null) {
setStart(Day.create(0));
} else {
setStart(calendar);
}
setLoad(Load.inWinks(1)); setLoad(Load.inWinks(1));
} }
public int getLoadAt(Wink instant) { public int getLoadAt(Day instant) {
if (pausedDay.contains(instant)) { if (pausedDay.contains(instant)) {
return 0; return 0;
} }
@ -101,16 +101,16 @@ public class TaskImpl extends AbstractTask implements Task, LoadPlanable {
return result.getLoadAt(instant); return result.getLoadAt(instant);
} }
private boolean pausedDayOfWeek(Wink instant) { private boolean pausedDayOfWeek(Day instant) {
for (DayOfWeek dayOfWeek : pausedDayOfWeek) { for (DayOfWeek dayOfWeek : pausedDayOfWeek) {
if (calendar.toDayAsDate(instant).getDayOfWeek() == dayOfWeek) { if (instant.getDayOfWeek() == dayOfWeek) {
return true; return true;
} }
} }
return false; return false;
} }
public int loadForResource(Resource res, Wink instant) { public int loadForResource(Resource res, Day instant) {
if (resources.keySet().contains(res) && instant.compareTo(getStart()) >= 0 if (resources.keySet().contains(res) && instant.compareTo(getStart()) >= 0
&& instant.compareTo(getEnd()) <= 0) { && instant.compareTo(getEnd()) <= 0) {
if (res.isClosedAt(instant)) { if (res.isClosedAt(instant)) {
@ -121,7 +121,7 @@ public class TaskImpl extends AbstractTask implements Task, LoadPlanable {
return 0; return 0;
} }
public void addPause(Wink pause) { public void addPause(Day pause) {
this.pausedDay.add(pause); this.pausedDay.add(pause);
} }
@ -134,7 +134,7 @@ public class TaskImpl extends AbstractTask implements Task, LoadPlanable {
throw new IllegalStateException(); throw new IllegalStateException();
} }
return new LoadPlanable() { return new LoadPlanable() {
public int getLoadAt(Wink instant) { public int getLoadAt(Day instant) {
int result = 0; int result = 0;
for (Map.Entry<Resource, Integer> ent : resources.entrySet()) { for (Map.Entry<Resource, Integer> ent : resources.entrySet()) {
final Resource res = ent.getKey(); final Resource res = ent.getKey();
@ -184,16 +184,16 @@ public class TaskImpl extends AbstractTask implements Task, LoadPlanable {
return code; return code;
} }
public Wink getStart() { public Day getStart() {
Wink result = (Wink) solver.getData(TaskAttribute.START); Day result = (Day) solver.getData(TaskAttribute.START);
while (getLoadAt(result) == 0) { while (getLoadAt(result) == 0) {
result = result.increment(); result = result.increment();
} }
return result; return result;
} }
public Wink getEnd() { public Day getEnd() {
return (Wink) solver.getData(TaskAttribute.END); return (Day) solver.getData(TaskAttribute.END);
} }
public Load getLoad() { public Load getLoad() {
@ -204,11 +204,11 @@ public class TaskImpl extends AbstractTask implements Task, LoadPlanable {
solver.setData(TaskAttribute.LOAD, load); solver.setData(TaskAttribute.LOAD, load);
} }
public void setStart(Wink start) { public void setStart(Day start) {
solver.setData(TaskAttribute.START, start); solver.setData(TaskAttribute.START, start);
} }
public void setEnd(Wink end) { public void setEnd(Day end) {
solver.setData(TaskAttribute.END, end); solver.setData(TaskAttribute.END, end);
} }
@ -244,20 +244,20 @@ public class TaskImpl extends AbstractTask implements Task, LoadPlanable {
return completion; return completion;
} }
public final Collection<Wink> getAllPaused() { public final Collection<Day> getAllPaused() {
final SortedSet<Wink> result = new TreeSet<Wink>(pausedDay); final SortedSet<Day> result = new TreeSet<Day>(pausedDay);
for (DayOfWeek dayOfWeek : pausedDayOfWeek) { for (DayOfWeek dayOfWeek : pausedDayOfWeek) {
addAll(result, dayOfWeek); addAll(result, dayOfWeek);
} }
return Collections.unmodifiableCollection(result); return Collections.unmodifiableCollection(result);
} }
private void addAll(SortedSet<Wink> result, DayOfWeek dayOfWeek) { private void addAll(SortedSet<Day> result, DayOfWeek dayOfWeek) {
final Day start = calendar.toDayAsDate(getStart()); final Day start = getStart();
final Day end = calendar.toDayAsDate(getEnd()); final Day end = getEnd();
for (Day current = start; current.compareTo(end) <= 0; current = current.next()) { for (Day current = start; current.compareTo(end) <= 0; current = current.increment()) {
if (current.getDayOfWeek() == dayOfWeek) { if (current.getDayOfWeek() == dayOfWeek) {
result.add(calendar.fromDayAsDate(current)); result.add(current);
} }
} }
} }

View File

@ -35,7 +35,7 @@
*/ */
package net.sourceforge.plantuml.project.core; package net.sourceforge.plantuml.project.core;
import net.sourceforge.plantuml.project.time.Wink; import net.sourceforge.plantuml.project.time.Day;
public class TaskInstant { public class TaskInstant {
@ -60,7 +60,7 @@ public class TaskInstant {
return new TaskInstant(task, attribute, newDelta); return new TaskInstant(task, attribute, newDelta);
} }
private Wink manageDelta(Wink value) { private Day manageDelta(Day value) {
if (delta > 0) { if (delta > 0) {
for (int i = 0; i < delta; i++) { for (int i = 0; i < delta; i++) {
value = value.increment(); value = value.increment();
@ -74,7 +74,7 @@ public class TaskInstant {
return value; return value;
} }
public Wink getInstantPrecise() { public Day getInstantPrecise() {
if (attribute == TaskAttribute.START) { if (attribute == TaskAttribute.START) {
return manageDelta(task.getStart()); return manageDelta(task.getStart());
} }
@ -84,7 +84,7 @@ public class TaskInstant {
throw new IllegalStateException(); throw new IllegalStateException();
} }
public Wink getInstantTheorical() { public Day getInstantTheorical() {
if (attribute == TaskAttribute.START) { if (attribute == TaskAttribute.START) {
return manageDelta(task.getStart()); return manageDelta(task.getStart());
} }

View File

@ -39,8 +39,8 @@ import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.project.Load; import net.sourceforge.plantuml.project.Load;
import net.sourceforge.plantuml.project.lang.CenterBorderColor; import net.sourceforge.plantuml.project.lang.CenterBorderColor;
import net.sourceforge.plantuml.project.time.Day;
import net.sourceforge.plantuml.project.time.DayOfWeek; import net.sourceforge.plantuml.project.time.DayOfWeek;
import net.sourceforge.plantuml.project.time.Wink;
public class TaskSeparator extends AbstractTask implements Task { public class TaskSeparator extends AbstractTask implements Task {
@ -55,19 +55,19 @@ public class TaskSeparator extends AbstractTask implements Task {
return code; return code;
} }
public Wink getStart() { public Day getStart() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
public Wink getEnd() { public Day getEnd() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
public void setStart(Wink start) { public void setStart(Day start) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
public void setEnd(Wink end) { public void setEnd(Day end) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@ -107,7 +107,7 @@ public class TaskSeparator extends AbstractTask implements Task {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
public void addPause(Wink pause) { public void addPause(Day pause) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }

View File

@ -35,6 +35,8 @@
*/ */
package net.sourceforge.plantuml.project.core2; package net.sourceforge.plantuml.project.core2;
import net.sourceforge.plantuml.project.time.DayOfWeek;
public class Hole implements Comparable<Hole> { public class Hole implements Comparable<Hole> {
private final long start; private final long start;
@ -48,6 +50,11 @@ public class Hole implements Comparable<Hole> {
this.end = end; this.end = end;
} }
@Override
public String toString() {
return DayOfWeek.timeToString(start) + " --> " + DayOfWeek.timeToString(end);
}
public final long getStart() { public final long getStart() {
return start; return start;
} }

View File

@ -44,11 +44,15 @@ public class HolesList implements Iterable<Hole> {
private final List<Hole> list = new ArrayList<Hole>(); private final List<Hole> list = new ArrayList<Hole>();
public void add(Hole tooth) { public void addHole(Hole tooth) {
list.add(tooth); list.add(tooth);
Collections.sort(list); Collections.sort(list);
} }
public int size() {
return list.size();
}
@Override @Override
public String toString() { public String toString() {
return list.toString(); return list.toString();
@ -66,4 +70,15 @@ public class HolesList implements Iterable<Hole> {
return Collections.unmodifiableList(list).iterator(); return Collections.unmodifiableList(list).iterator();
} }
public HolesList negate() {
final HolesList result = new HolesList();
long i = 0;
for (Hole hole : list) {
result.addHole(new Hole(i, hole.getStart()));
i = hole.getEnd();
}
result.addHole(new Hole(i, 1000L * Integer.MAX_VALUE));
return result;
}
} }

View File

@ -79,18 +79,25 @@ public class Slice {
public List<Slice> intersectWith(HolesList holes) { public List<Slice> intersectWith(HolesList holes) {
final List<Slice> result = new ArrayList<Slice>(); final List<Slice> result = new ArrayList<Slice>();
for (Hole hole : holes) { for (Hole hole : holes.negate()) {
final Slice inter = intersectWith(hole); final Slice inter = intersectWith(hole);
if (inter != null) {
result.add(inter);
}
} }
return Collections.unmodifiableList(result); return Collections.unmodifiableList(result);
} }
private Slice intersectWith(Hole hole) { private Slice intersectWith(Hole hole) {
if (hole.getEnd() <= start || hole.getStart() <= end) { // if (hole.getEnd() <= start || hole.getStart() <= end) {
// return null;
// }
final long newStart = Math.max(start, hole.getStart());
final long newEnd = Math.min(end, hole.getEnd());
if (newEnd <= newStart) {
return null; return null;
} }
return new Slice(Math.max(start, hole.getStart()), Math.min(end, hole.getEnd()), workLoad); return new Slice(newStart, newEnd, workLoad);
} }
} }

View File

@ -35,7 +35,6 @@
*/ */
package net.sourceforge.plantuml.project.core2; package net.sourceforge.plantuml.project.core2;
import java.util.ArrayList;
import java.util.List; import java.util.List;
public class WorkLoadWithHoles implements WorkLoad { public class WorkLoadWithHoles implements WorkLoad {
@ -44,7 +43,7 @@ public class WorkLoadWithHoles implements WorkLoad {
private final HolesList holes = new HolesList(); private final HolesList holes = new HolesList();
public void addHole(long start, long end) { public void addHole(long start, long end) {
this.holes.add(new Hole(start, end)); this.holes.addHole(new Hole(start, end));
} }
public WorkLoadWithHoles(WorkLoad source) { public WorkLoadWithHoles(WorkLoad source) {
@ -61,6 +60,8 @@ public class WorkLoadWithHoles implements WorkLoad {
public Slice next() { public Slice next() {
final Slice candidat = slices.next(); final Slice candidat = slices.next();
final List<Slice> pending = candidat.intersectWith(holes);
System.err.println("pending=" + pending);
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
} }

View File

@ -0,0 +1,42 @@
/* ========================================================================
* 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.project.core3;
public interface Histogram extends TimeLine {
public long getValueAt(long moment);
}

View File

@ -33,55 +33,43 @@
* *
* *
*/ */
package net.sourceforge.plantuml.project.time; package net.sourceforge.plantuml.project.core3;
import net.sourceforge.plantuml.project.Value; import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;
public class Wink implements Value, Comparable<Wink> { public class HistogramSimple implements Histogram {
private final int wink; private final Map<Long, Long> events = new TreeMap<Long, Long>();
public Wink(int wink) { public long getNext(long moment) {
this.wink = wink; for (long e : events.keySet()) {
if (e > moment) {
return e;
}
}
return 1000L * Integer.MAX_VALUE;
}
public void put(long event, long value) {
this.events.put(event, value);
} }
@Override @Override
public String toString() { public String toString() {
return "(Wink +" + wink + ")"; return events.toString();
} }
public Wink increment() { public long getValueAt(long moment) {
return new Wink(wink + 1); long last = 0;
} for (Entry<Long, Long> ent : events.entrySet()) {
if (ent.getKey() > moment) {
public Wink decrement() { return last;
return new Wink(wink - 1); }
} last = ent.getValue();
public final int getWink() {
return wink;
}
public int compareTo(Wink other) {
return this.wink - other.wink;
}
public String toShortString() {
return "" + (wink + 1);
}
public static Wink min(Wink wink1, Wink wink2) {
if (wink2.wink < wink1.wink) {
return wink2;
} }
return wink1; return last;
}
public static Wink max(Wink wink1, Wink wink2) {
if (wink2.wink > wink1.wink) {
return wink2;
}
return wink1;
} }
} }

View File

@ -0,0 +1,72 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.project.core3;
public class Solver10 {
private final Histogram workLoad;
public Solver10(Histogram workLoad) {
this.workLoad = workLoad;
}
public TaskLoad solver(long totalLoad) {
final HistogramSimple resultLoad = new HistogramSimple();
final TaskLoadImpl result = new TaskLoadImpl(resultLoad);
final long start = workLoad.getNext(0);
result.setStart(start);
long currentTime = start;
while (totalLoad > 0) {
final long tmpWorkLoad = workLoad.getValueAt(currentTime);
final long nextChange = workLoad.getNext(currentTime);
final long duration = nextChange - currentTime;
final long partialLoad = duration * tmpWorkLoad;
resultLoad.put(currentTime, tmpWorkLoad);
if (partialLoad >= totalLoad) {
final long end = currentTime + totalLoad / tmpWorkLoad;
result.setEnd(end);
resultLoad.put(end, 0);
return result;
}
totalLoad -= partialLoad;
currentTime = nextChange;
}
throw new UnsupportedOperationException();
}
}

View File

@ -33,27 +33,14 @@
* *
* *
*/ */
package net.sourceforge.plantuml.project.draw; package net.sourceforge.plantuml.project.core3;
public class YMovable { public interface TaskLoad {
private double y; public long getStart();
public YMovable(double y) { public long getEnd();
this.y = y;
}
public YMovable add(double v) { public Histogram getLoad();
return new YMovable(y + v);
}
public final double getValue() {
return y;
}
public void pushMe(double delta) {
this.y += delta;
}
} }

View File

@ -33,40 +33,36 @@
* *
* *
*/ */
package net.sourceforge.plantuml.project.time; package net.sourceforge.plantuml.project.core3;
public class GCalendar { class TaskLoadImpl implements TaskLoad {
private final Day start; private long start;
private long end;
private final Histogram load;
public GCalendar(Day start) { public TaskLoadImpl(Histogram load) {
this.start = start; this.load = load;
} }
public Day toDayAsDate(Wink day) { public final long getStart() {
Day result = start;
final int target = day.getWink();
int work = 0;
while (work < target) {
result = result.next();
work++;
}
return result;
}
public Wink fromDayAsDate(Day day) {
if (day.compareTo(start) < 0) {
throw new IllegalArgumentException();
}
Wink result = new Wink(0);
while (toDayAsDate(result).equals(day) == false) {
result = result.increment();
}
return result;
}
public Day getStartingDate() {
return start; return start;
} }
public final void setStart(long start) {
this.start = start;
}
public final long getEnd() {
return end;
}
public final void setEnd(long end) {
this.end = end;
}
public final Histogram getLoad() {
return load;
}
} }

View File

@ -0,0 +1,42 @@
/* ========================================================================
* 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.project.core3;
public interface TimeLine {
public long getNext(long moment);
}

View File

@ -0,0 +1,60 @@
/* ========================================================================
* 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.project.core3;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class TimeLineSimple implements TimeLine {
private final List<Long> events = new ArrayList<Long>();
public long getNext(long moment) {
for (long e : events) {
if (e > moment) {
return e;
}
}
return Long.MAX_VALUE;
}
public void add(long event) {
this.events.add(event);
Collections.sort(events);
}
}

View File

@ -43,7 +43,7 @@ import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.project.ToTaskDraw; import net.sourceforge.plantuml.project.ToTaskDraw;
import net.sourceforge.plantuml.project.core.Task; import net.sourceforge.plantuml.project.core.Task;
import net.sourceforge.plantuml.project.lang.CenterBorderColor; import net.sourceforge.plantuml.project.lang.CenterBorderColor;
import net.sourceforge.plantuml.project.time.Wink; import net.sourceforge.plantuml.project.time.Day;
import net.sourceforge.plantuml.project.timescale.TimeScale; import net.sourceforge.plantuml.project.timescale.TimeScale;
import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.Style;
@ -56,15 +56,20 @@ public abstract class AbstractTaskDraw implements TaskDraw {
protected Url url; protected Url url;
protected Display note; protected Display note;
protected final TimeScale timeScale; protected final TimeScale timeScale;
protected final YMovable y; private double y;
protected final String prettyDisplay; protected final String prettyDisplay;
protected final Wink start; protected final Day start;
protected final ISkinParam skinParam; protected final ISkinParam skinParam;
private final Task task; private final Task task;
private final ToTaskDraw toTaskDraw; private final ToTaskDraw toTaskDraw;
protected final double margin = 2; protected final double margin = 2;
@Override
final public String toString() {
return super.toString() + " " + task;
}
final public void setColorsAndCompletion(CenterBorderColor colors, int completion, Url url, Display note) { final public void setColorsAndCompletion(CenterBorderColor colors, int completion, Url url, Display note) {
this.colors = colors; this.colors = colors;
this.completion = completion; this.completion = completion;
@ -72,7 +77,7 @@ public abstract class AbstractTaskDraw implements TaskDraw {
this.note = note; this.note = note;
} }
public AbstractTaskDraw(TimeScale timeScale, YMovable y, String prettyDisplay, Wink start, ISkinParam skinParam, public AbstractTaskDraw(TimeScale timeScale, double y, String prettyDisplay, Day start, ISkinParam skinParam,
Task task, ToTaskDraw toTaskDraw) { Task task, ToTaskDraw toTaskDraw) {
this.y = y; this.y = y;
this.toTaskDraw = toTaskDraw; this.toTaskDraw = toTaskDraw;
@ -105,25 +110,35 @@ public abstract class AbstractTaskDraw implements TaskDraw {
return getFontConfiguration().getFont().getSize2D() + 5; return getFontConfiguration().getFont().getSize2D() + 5;
} }
final public YMovable getY() { public TaskDraw getTrueRow() {
return toTaskDraw.getTaskDraw(task.getRow());
}
final public double getY() {
if (task.getRow() == null) { if (task.getRow() == null) {
return y; return y;
} }
return toTaskDraw.getTaskDraw(task.getRow()).getY(); return getTrueRow().getY();
}
public void pushMe(double deltaY) {
if (task.getRow() == null) {
this.y += deltaY;
}
} }
public final Task getTask() { public final Task getTask() {
return task; return task;
} }
public final YMovable getY(Direction direction) { public final double getY(Direction direction) {
if (direction == Direction.UP) { if (direction == Direction.UP) {
return getY(); return getY();
} }
if (direction == Direction.DOWN) { if (direction == Direction.DOWN) {
return getY().add(getHeightTask()); return getY() + getHeightTask();
} }
return getY().add(getHeightTask() / 2); return getY() + getHeightTask() / 2;
} }
} }

View File

@ -43,7 +43,7 @@ import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.UDrawable;
import net.sourceforge.plantuml.project.GanttDiagram; import net.sourceforge.plantuml.project.GanttDiagram;
import net.sourceforge.plantuml.project.core.Resource; import net.sourceforge.plantuml.project.core.Resource;
import net.sourceforge.plantuml.project.time.Wink; import net.sourceforge.plantuml.project.time.Day;
import net.sourceforge.plantuml.project.timescale.TimeScale; import net.sourceforge.plantuml.project.timescale.TimeScale;
import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
@ -56,12 +56,12 @@ public class ResourceDraw implements UDrawable {
private final Resource res; private final Resource res;
private final TimeScale timeScale; private final TimeScale timeScale;
private final YMovable y; private final double y;
private final Wink min; private final Day min;
private final Wink max; private final Day max;
private final GanttDiagram gantt; private final GanttDiagram gantt;
public ResourceDraw(GanttDiagram gantt, Resource res, TimeScale timeScale, YMovable y, Wink min, Wink max) { public ResourceDraw(GanttDiagram gantt, Resource res, TimeScale timeScale, double y, Day min, Day max) {
this.res = res; this.res = res;
this.timeScale = timeScale; this.timeScale = timeScale;
this.y = y; this.y = y;
@ -81,7 +81,7 @@ public class ResourceDraw implements UDrawable {
double startingPosition = -1; double startingPosition = -1;
int totalLoad = 0; int totalLoad = 0;
int totalLimit = 0; int totalLimit = 0;
for (Wink i = min; i.compareTo(max) <= 0; i = i.increment()) { for (Day i = min; i.compareTo(max) <= 0; i = i.increment()) {
final boolean isBreaking = timeScale.isBreaking(i); final boolean isBreaking = timeScale.isBreaking(i);
totalLoad += gantt.getLoadForResource(res, i); totalLoad += gantt.getLoadForResource(res, i);
totalLimit += 100; totalLimit += 100;
@ -123,8 +123,8 @@ public class ResourceDraw implements UDrawable {
return 16 * 2; return 16 * 2;
} }
public double getY() { public final double getY() {
return y.getValue(); return y;
} }
} }

View File

@ -46,12 +46,16 @@ import net.sourceforge.plantuml.ugraphic.UGraphic;
public interface TaskDraw extends UDrawable { public interface TaskDraw extends UDrawable {
public TaskDraw getTrueRow();
public void setColorsAndCompletion(CenterBorderColor colors, int completion, Url url, Display note); public void setColorsAndCompletion(CenterBorderColor colors, int completion, Url url, Display note);
public YMovable getY(); public double getY();
public YMovable getY(Direction direction); public double getY(Direction direction);
public void pushMe(double deltaY);
public void drawTitle(UGraphic ug); public void drawTitle(UGraphic ug);
public double getHeightTask(); public double getHeightTask();
@ -64,4 +68,5 @@ public interface TaskDraw extends UDrawable {
public FingerPrint getFingerPrintNote(StringBounder stringBounder); public FingerPrint getFingerPrintNote(StringBounder stringBounder);
} }

View File

@ -43,7 +43,7 @@ import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.project.ToTaskDraw; import net.sourceforge.plantuml.project.ToTaskDraw;
import net.sourceforge.plantuml.project.core.Task; import net.sourceforge.plantuml.project.core.Task;
import net.sourceforge.plantuml.project.time.Wink; import net.sourceforge.plantuml.project.time.Day;
import net.sourceforge.plantuml.project.timescale.TimeScale; import net.sourceforge.plantuml.project.timescale.TimeScale;
import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.Style;
@ -55,7 +55,7 @@ import net.sourceforge.plantuml.ugraphic.UTranslate;
public class TaskDrawDiamond extends AbstractTaskDraw { public class TaskDrawDiamond extends AbstractTaskDraw {
public TaskDrawDiamond(TimeScale timeScale, YMovable y, String prettyDisplay, Wink start, ISkinParam skinParam, public TaskDrawDiamond(TimeScale timeScale, double y, String prettyDisplay, Day start, ISkinParam skinParam,
Task task, ToTaskDraw toTaskDraw) { Task task, ToTaskDraw toTaskDraw) {
super(timeScale, y, prettyDisplay, start, skinParam, task, toTaskDraw); super(timeScale, y, prettyDisplay, start, skinParam, task, toTaskDraw);
} }
@ -108,7 +108,7 @@ public class TaskDrawDiamond extends AbstractTaskDraw {
public FingerPrint getFingerPrint() { public FingerPrint getFingerPrint() {
final double h = getHeightTask(); final double h = getHeightTask();
final double startPos = timeScale.getStartingPosition(start); final double startPos = timeScale.getStartingPosition(start);
return new FingerPrint(startPos, y.getValue(), startPos + h, y.getValue() + h); return new FingerPrint(startPos, getY(), startPos + h, getY() + h);
} }
private UShape getDiamond() { private UShape getDiamond() {

View File

@ -37,6 +37,7 @@ package net.sourceforge.plantuml.project.draw;
import java.awt.geom.Dimension2D; import java.awt.geom.Dimension2D;
import java.util.Collection; import java.util.Collection;
import java.util.TreeSet;
import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
@ -54,7 +55,7 @@ import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.project.ToTaskDraw; import net.sourceforge.plantuml.project.ToTaskDraw;
import net.sourceforge.plantuml.project.core.Task; import net.sourceforge.plantuml.project.core.Task;
import net.sourceforge.plantuml.project.core.TaskImpl; import net.sourceforge.plantuml.project.core.TaskImpl;
import net.sourceforge.plantuml.project.time.Wink; import net.sourceforge.plantuml.project.time.Day;
import net.sourceforge.plantuml.project.timescale.TimeScale; import net.sourceforge.plantuml.project.timescale.TimeScale;
import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.SName;
@ -72,20 +73,27 @@ import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
public class TaskDrawRegular extends AbstractTaskDraw { public class TaskDrawRegular extends AbstractTaskDraw {
private final Wink end; private final Day end;
private final boolean oddStart; private final boolean oddStart;
private final boolean oddEnd; private final boolean oddEnd;
private final Collection<Wink> paused; private final Collection<Day> paused;
private final double margin = 2; private final double margin = 2;
public TaskDrawRegular(TimeScale timeScale, YMovable y, String prettyDisplay, Wink start, Wink end, public TaskDrawRegular(TimeScale timeScale, double y, String prettyDisplay, Day start, Day end, boolean oddStart,
boolean oddStart, boolean oddEnd, ISkinParam skinParam, Task task, ToTaskDraw toTaskDraw) { boolean oddEnd, ISkinParam skinParam, Task task, ToTaskDraw toTaskDraw) {
super(timeScale, y, prettyDisplay, start, skinParam, task, toTaskDraw); super(timeScale, y, prettyDisplay, start, skinParam, task, toTaskDraw);
this.end = end; this.end = end;
this.oddStart = oddStart; this.oddStart = oddStart;
this.oddEnd = oddEnd; this.oddEnd = oddEnd;
this.paused = ((TaskImpl) task).getAllPaused(); this.paused = new TreeSet<Day>(((TaskImpl) task).getAllPaused());
for (Day tmp = start; tmp.compareTo(end) <= 0; tmp = tmp.increment()) {
final int load = toTaskDraw.getDefaultPlan().getLoadAt(tmp);
if (load == 0) {
this.paused.add(tmp);
}
}
} }
public void drawTitle(UGraphic ug) { public void drawTitle(UGraphic ug) {
@ -156,7 +164,7 @@ public class TaskDrawRegular extends AbstractTaskDraw {
final double h = getHeightTask(); final double h = getHeightTask();
final double startPos = timeScale.getStartingPosition(start); final double startPos = timeScale.getStartingPosition(start);
final double endPos = timeScale.getEndingPosition(end); final double endPos = timeScale.getEndingPosition(end);
return new FingerPrint(startPos, y.getValue(), endPos - startPos, h); return new FingerPrint(startPos, getY(), endPos - startPos, h);
} }
public FingerPrint getFingerPrintNote(StringBounder stringBounder) { public FingerPrint getFingerPrintNote(StringBounder stringBounder) {
@ -166,7 +174,7 @@ public class TaskDrawRegular extends AbstractTaskDraw {
final Dimension2D dim = getOpaleNote().calculateDimension(stringBounder); final Dimension2D dim = getOpaleNote().calculateDimension(stringBounder);
final double startPos = timeScale.getStartingPosition(start); final double startPos = timeScale.getStartingPosition(start);
// final double endPos = timeScale.getEndingPosition(end); // final double endPos = timeScale.getEndingPosition(end);
return new FingerPrint(startPos, y.getValue() + getYNotePosition(), dim.getWidth(), dim.getHeight()); return new FingerPrint(startPos, getY() + getYNotePosition(), dim.getWidth(), dim.getHeight());
} }
private UGraphic applyColors(UGraphic ug) { private UGraphic applyColors(UGraphic ug) {
@ -213,8 +221,8 @@ public class TaskDrawRegular extends AbstractTaskDraw {
if (url != null) { if (url != null) {
ug.closeUrl(); ug.closeUrl();
} }
Wink begin = null; Day begin = null;
for (Wink pause : paused) { for (Day pause : paused) {
if (paused.contains(pause.increment())) { if (paused.contains(pause.increment())) {
if (begin == null) if (begin == null)
begin = pause; begin = pause;
@ -228,7 +236,7 @@ public class TaskDrawRegular extends AbstractTaskDraw {
} }
} }
private void drawPause(UGraphic ug, Wink start1, Wink end) { private void drawPause(UGraphic ug, Day start1, Day end) {
final double x1 = timeScale.getStartingPosition(start1); final double x1 = timeScale.getStartingPosition(start1);
final double x2 = timeScale.getEndingPosition(end); final double x2 = timeScale.getEndingPosition(end);
final URectangle small = new URectangle(x2 - x1 - 1, getShapeHeight() + 1); final URectangle small = new URectangle(x2 - x1 - 1, getShapeHeight() + 1);

View File

@ -46,7 +46,7 @@ import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.project.core.Task; import net.sourceforge.plantuml.project.core.Task;
import net.sourceforge.plantuml.project.lang.CenterBorderColor; import net.sourceforge.plantuml.project.lang.CenterBorderColor;
import net.sourceforge.plantuml.project.time.Wink; import net.sourceforge.plantuml.project.time.Day;
import net.sourceforge.plantuml.project.timescale.TimeScale; import net.sourceforge.plantuml.project.timescale.TimeScale;
import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
@ -57,12 +57,12 @@ import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
public class TaskDrawSeparator implements TaskDraw { public class TaskDrawSeparator implements TaskDraw {
private final TimeScale timeScale; private final TimeScale timeScale;
private final YMovable y; private double y;
private final Wink min; private final Day min;
private final Wink max; private final Day max;
private final String name; private final String name;
public TaskDrawSeparator(String name, TimeScale timeScale, YMovable y, Wink min, Wink max) { public TaskDrawSeparator(String name, TimeScale timeScale, double y, Day min, Day max) {
this.name = name; this.name = name;
this.y = y; this.y = y;
this.timeScale = timeScale; this.timeScale = timeScale;
@ -112,17 +112,25 @@ public class TaskDrawSeparator implements TaskDraw {
public FingerPrint getFingerPrint() { public FingerPrint getFingerPrint() {
final double h = getHeightTask(); final double h = getHeightTask();
final double end = timeScale.getEndingPosition(max); final double end = timeScale.getEndingPosition(max);
return new FingerPrint(0, y.getValue(), end, y.getValue() + h); return new FingerPrint(0, y, end, y + h);
} }
public double getHeightTask() { public double getHeightTask() {
return 16; return 16;
} }
public YMovable getY() { public double getY() {
return y; return y;
} }
public void pushMe(double deltaY) {
this.y += deltaY;
}
public TaskDraw getTrueRow() {
return null;
}
public void setColorsAndCompletion(CenterBorderColor colors, int completion, Url url, Display note) { public void setColorsAndCompletion(CenterBorderColor colors, int completion, Url url, Display note) {
} }
@ -130,7 +138,7 @@ public class TaskDrawSeparator implements TaskDraw {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
public YMovable getY(Direction direction) { public double getY(Direction direction) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }

View File

@ -40,7 +40,7 @@ import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.project.time.Wink; import net.sourceforge.plantuml.project.time.Day;
import net.sourceforge.plantuml.project.timescale.TimeScale; import net.sourceforge.plantuml.project.timescale.TimeScale;
import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
@ -55,10 +55,10 @@ public abstract class TimeHeader {
protected static final int Y_POS_ROW28 = 28; protected static final int Y_POS_ROW28 = 28;
private final TimeScale timeScale; private final TimeScale timeScale;
protected final Wink min; protected final Day min;
protected final Wink max; protected final Day max;
public TimeHeader(Wink min, Wink max, TimeScale timeScale) { public TimeHeader(Day min, Day max, TimeScale timeScale) {
this.timeScale = timeScale; this.timeScale = timeScale;
this.min = min; this.min = min;
this.max = max; this.max = max;

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