From 58936dc235e568bfeea580db93bbba90f6df66c7 Mon Sep 17 00:00:00 2001 From: Arnaud Roques Date: Wed, 30 Sep 2020 22:57:58 +0200 Subject: [PATCH] Import version 1.2020.18 --- pom.xml | 2 +- .../sourceforge/plantuml/EmbeddedDiagram.java | 25 ++++ src/net/sourceforge/plantuml/ISkinParam.java | 2 - src/net/sourceforge/plantuml/ISkinSimple.java | 2 + .../sourceforge/plantuml/PSystemBuilder.java | 6 +- src/net/sourceforge/plantuml/Run.java | 4 +- .../plantuml/SpriteContainerEmpty.java | 4 + .../sourceforge/plantuml/TitledDiagram.java | 35 ++++- src/net/sourceforge/plantuml/UmlDiagram.java | 36 +---- .../sourceforge/plantuml/UmlDiagramType.java | 5 +- .../ActivityDiagramFactory.java | 4 +- .../ActivityDiagramFactory3.java | 4 +- .../activitydiagram3/InstructionRepeat.java | 3 +- .../ftile/EntityImageLegend.java | 11 ++ .../ftile/vcompact/FtileWithNoteOpale.java | 2 +- .../sourceforge/plantuml/bpm/BpmDiagram.java | 5 +- .../plantuml/bpm/BpmDiagramFactory.java | 4 +- .../plantuml/classdiagram/ClassDiagram.java | 4 +- .../classdiagram/ClassDiagramFactory.java | 4 +- .../plantuml/command/CommandFooter.java | 5 +- .../plantuml/command/CommandHeader.java | 4 +- .../plantuml/command/CommandPragma.java | 6 +- .../plantuml/command/CommandSkinParam.java | 6 +- .../command/CommandSkinParamMultilines.java | 6 +- .../plantuml/command/CommandSpriteFile.java | 6 +- ...actory.java => PSystemCommandFactory.java} | 6 +- .../plantuml/command/SkinLoader.java | 6 +- .../CompositeDiagramFactory.java | 4 +- .../sourceforge/plantuml/creole/Parser.java | 9 +- .../plantuml/creole/legacy/CreoleParser.java | 12 ++ .../plantuml/creole/legacy/StripeCode.java | 116 +++++++++++++++ .../plantuml/cucadiagram/BodierImpl.java | 4 +- .../plantuml/cucadiagram/BodyEnhanced.java | 6 +- .../plantuml/cucadiagram/BodyEnhanced2.java | 44 +++--- .../plantuml/cucadiagram/Display.java | 7 +- .../plantuml/cucadiagram/LinkArrow.java | 4 + .../plantuml/cucadiagram/Member.java | 15 +- .../cucadiagram/MethodsOrFieldsArea.java | 1 - .../plantuml/cute/PSystemCute.java | 4 +- src/net/sourceforge/plantuml/dedication/2.png | Bin 0 -> 24111 bytes .../plantuml/dedication/Dedications.java | 6 +- .../DescriptionDiagramFactory.java | 4 +- .../descdiagram/command/CommandNewpage.java | 6 +- .../descdiagram/command/StringWithArrow.java | 42 ++++-- .../plantuml/donors/PSystemDonors.java | 41 +++--- .../flowdiagram/FlowDiagramFactory.java | 4 +- .../plantuml/graphic/QuoteUtils.java | 4 +- .../plantuml/graphic/TextBlockArrow.java | 6 +- .../plantuml/graphic/TextBlockArrow2.java | 91 ++++++++++++ .../plantuml/graphic/TextBlockMarged.java | 11 +- .../sourceforge/plantuml/graphic/USymbol.java | 4 +- .../plantuml/graphic/USymbolActor.java | 5 +- .../plantuml/graphic/USymbolBoundary.java | 7 +- .../plantuml/graphic/USymbolControl.java | 11 +- .../plantuml/graphic/USymbolEntityDomain.java | 11 +- .../graphic/USymbolSimpleAbstract.java | 8 +- .../plantuml/help/HelpFactory.java | 4 +- .../jdot/CucaDiagramFileMakerJDot.java | 4 +- .../plantuml/jungle/PSystemTree.java | 4 +- .../plantuml/jungle/PSystemTreeFactory.java | 4 +- .../mindmap/MindMapDiagramFactory.java | 4 +- .../plantuml/nwdiag/NwDiagramFactory.java | 4 +- .../openiconic/PSystemOpenIconic.java | 7 +- .../plantuml/postit/PostIdDiagramFactory.java | 4 +- .../plantuml/project/ConstantPlan.java | 4 +- .../plantuml/project/DaysAsDates.java | 4 +- .../plantuml/project/GanttArrow.java | 8 +- .../plantuml/project/GanttConstraint.java | 6 +- .../plantuml/project/GanttDiagram.java | 104 +++++++------ .../plantuml/project/GanttDiagramFactory.java | 7 +- .../plantuml/project/LoadPlanable.java | 4 +- .../plantuml/project/PlanUtils.java | 6 +- .../sourceforge/plantuml/project/Solver.java | 16 +- .../plantuml/project/ToTaskDraw.java | 2 + .../project/command/CommandGanttArrow.java | 2 - .../plantuml/project/core/Moment.java | 6 +- .../plantuml/project/core/MomentImpl.java | 12 +- .../plantuml/project/core/Resource.java | 21 +-- .../plantuml/project/core/Task.java | 12 +- .../plantuml/project/core/TaskImpl.java | 52 +++---- .../plantuml/project/core/TaskInstant.java | 8 +- .../plantuml/project/core/TaskSeparator.java | 12 +- .../plantuml/project/core2/Hole.java | 7 + .../plantuml/project/core2/HolesList.java | 17 ++- .../plantuml/project/core2/Slice.java | 15 +- .../project/core2/WorkLoadWithHoles.java | 5 +- .../plantuml/project/core3/Histogram.java | 42 ++++++ .../Wink.java => core3/HistogramSimple.java} | 64 ++++---- .../plantuml/project/core3/Solver10.java | 72 +++++++++ .../YMovable.java => core3/TaskLoad.java} | 23 +-- .../TaskLoadImpl.java} | 52 +++---- .../plantuml/project/core3/TimeLine.java | 42 ++++++ .../project/core3/TimeLineSimple.java | 60 ++++++++ .../project/draw/AbstractTaskDraw.java | 33 +++-- .../plantuml/project/draw/ResourceDraw.java | 16 +- .../plantuml/project/draw/TaskDraw.java | 9 +- .../project/draw/TaskDrawDiamond.java | 6 +- .../project/draw/TaskDrawRegular.java | 30 ++-- .../project/draw/TaskDrawSeparator.java | 24 ++- .../plantuml/project/draw/TimeHeader.java | 8 +- .../project/draw/TimeHeaderDaily.java | 49 ++---- .../project/draw/TimeHeaderMonthly.java | 23 +-- .../project/draw/TimeHeaderSimple.java | 15 +- .../project/draw/TimeHeaderWeekly.java | 28 ++-- .../project/lang/SentenceHappensDate.java | 2 +- .../project/lang/SentencePausesDate.java | 3 +- .../SentencePausesDates.java} | 56 +++---- .../lang/SentenceTaskEndsAbsolute.java | 2 +- .../lang/SentenceTaskStartsAbsolute.java | 2 +- .../project/lang/SubjectResource.java | 8 +- .../plantuml/project/lang/SubjectTask.java | 2 +- .../plantuml/project/lang/Verbs.java | 2 +- .../plantuml/project/time/Day.java | 139 +++++++++--------- .../plantuml/project/timescale/TimeScale.java | 10 +- .../timescale/TimeScaleCompressed.java | 17 +-- .../project/timescale/TimeScaleDaily.java | 16 +- .../project/timescale/TimeScaleWink.java | 14 +- .../plantuml/salt/CommandAnything.java | 72 +++++++++ .../plantuml/salt/CommandSalt.java | 66 +++++++++ .../sourceforge/plantuml/salt/Dictionary.java | 4 + .../plantuml/salt/PSystemSalt.java | 99 ++++++++++--- .../plantuml/salt/PSystemSaltFactory2.java | 74 ++++++++++ .../SequenceDiagramFactory.java | 4 +- .../SequenceDiagramFileMakerPuma2.java | 19 +-- .../teoz/SequenceDiagramFileMakerTeoz.java | 15 +- .../skin/AbstractTextualComponent.java | 2 +- .../plantuml/sprite/ListSpriteDiagram.java | 5 +- .../sprite/ListSpriteDiagramFactory.java | 4 +- .../plantuml/sprite/StdlibDiagram.java | 5 +- .../plantuml/sprite/StdlibDiagramFactory.java | 4 +- .../statediagram/StateDiagramFactory.java | 4 +- .../style/ClockwiseTopRightBottomLeft.java | 6 +- src/net/sourceforge/plantuml/style/SName.java | 1 + .../plantuml/svek/CircleInterface2.java | 5 +- .../svek/CucaDiagramFileMakerSvek.java | 2 +- .../sourceforge/plantuml/svek/GuideLine.java | 2 + src/net/sourceforge/plantuml/svek/Line.java | 18 +++ .../svek/image/EntityImageDescription.java | 35 +++-- .../plantuml/svek/image/EntityImageNote.java | 3 +- .../plantuml/svek/image/EntityImageTips.java | 5 +- .../svek/image/EntityImageUseCase.java | 48 +++++- .../plantuml/svek/image/Footprint.java | 8 + .../plantuml/syntax/LanguageDescriptor.java | 13 +- .../plantuml/timingdiagram/TimingDiagram.java | 5 +- .../timingdiagram/TimingDiagramFactory.java | 4 +- .../command/CommandConstraint.java | 3 + .../plantuml/ugraphic/ImageBuilder.java | 119 ++++----------- .../sourceforge/plantuml/ugraphic/UEmpty.java | 6 + .../sourceforge/plantuml/version/Version.java | 4 +- .../sourceforge/plantuml/wbs/WBSDiagram.java | 10 +- .../plantuml/wbs/WBSDiagramFactory.java | 4 +- .../plantuml/wire/WireDiagram.java | 8 +- .../plantuml/wire/WireDiagramFactory.java | 4 +- 153 files changed, 1692 insertions(+), 926 deletions(-) rename src/net/sourceforge/plantuml/command/{UmlDiagramFactory.java => PSystemCommandFactory.java} (98%) create mode 100644 src/net/sourceforge/plantuml/creole/legacy/StripeCode.java create mode 100644 src/net/sourceforge/plantuml/dedication/2.png create mode 100644 src/net/sourceforge/plantuml/graphic/TextBlockArrow2.java create mode 100644 src/net/sourceforge/plantuml/project/core3/Histogram.java rename src/net/sourceforge/plantuml/project/{time/Wink.java => core3/HistogramSimple.java} (62%) create mode 100644 src/net/sourceforge/plantuml/project/core3/Solver10.java rename src/net/sourceforge/plantuml/project/{draw/YMovable.java => core3/TaskLoad.java} (80%) rename src/net/sourceforge/plantuml/project/{time/GCalendar.java => core3/TaskLoadImpl.java} (68%) create mode 100644 src/net/sourceforge/plantuml/project/core3/TimeLine.java create mode 100644 src/net/sourceforge/plantuml/project/core3/TimeLineSimple.java rename src/net/sourceforge/plantuml/project/{timescale/UnusedTimeScaleWithoutWeekEnd.java => lang/SentencePausesDates.java} (52%) create mode 100644 src/net/sourceforge/plantuml/salt/CommandAnything.java create mode 100644 src/net/sourceforge/plantuml/salt/CommandSalt.java create mode 100644 src/net/sourceforge/plantuml/salt/PSystemSaltFactory2.java diff --git a/pom.xml b/pom.xml index 6b4f66779..c58f20590 100644 --- a/pom.xml +++ b/pom.xml @@ -35,7 +35,7 @@ net.sourceforge.plantuml plantuml - 1.2020.18-SNAPSHOT + 1.2020.19-SNAPSHOT jar PlantUML diff --git a/src/net/sourceforge/plantuml/EmbeddedDiagram.java b/src/net/sourceforge/plantuml/EmbeddedDiagram.java index 4a4c41d97..995ed7a26 100644 --- a/src/net/sourceforge/plantuml/EmbeddedDiagram.java +++ b/src/net/sourceforge/plantuml/EmbeddedDiagram.java @@ -60,6 +60,29 @@ import net.sourceforge.plantuml.ugraphic.UShape; 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; public EmbeddedDiagram(Display system) { @@ -131,10 +154,12 @@ public class EmbeddedDiagram implements CharSequence { } private String getImageSvg() throws IOException, InterruptedException { + final boolean sav = SkinParam.USE_STYLES(); final Diagram system = getSystem(); final ByteArrayOutputStream os = new ByteArrayOutputStream(); system.exportDiagram(os, 0, new FileFormatOption(FileFormat.SVG)); os.close(); + SkinParam.setBetaStyle(sav); return new String(os.toByteArray()); } diff --git a/src/net/sourceforge/plantuml/ISkinParam.java b/src/net/sourceforge/plantuml/ISkinParam.java index 2322e5660..950d69023 100644 --- a/src/net/sourceforge/plantuml/ISkinParam.java +++ b/src/net/sourceforge/plantuml/ISkinParam.java @@ -126,8 +126,6 @@ public interface ISkinParam extends ISkinSimple { public ConditionEndStyle getConditionEndStyle(); - public double minClassWidth(); - public boolean sameClassWidth(); public Rankdir getRankdir(); diff --git a/src/net/sourceforge/plantuml/ISkinSimple.java b/src/net/sourceforge/plantuml/ISkinSimple.java index 5a86337d5..54f4c32d4 100644 --- a/src/net/sourceforge/plantuml/ISkinSimple.java +++ b/src/net/sourceforge/plantuml/ISkinSimple.java @@ -62,4 +62,6 @@ public interface ISkinSimple extends SpriteContainer { public void copyAllFrom(ISkinSimple other); + public double minClassWidth(); + } \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/PSystemBuilder.java b/src/net/sourceforge/plantuml/PSystemBuilder.java index 18dc21a62..f7f559e12 100644 --- a/src/net/sourceforge/plantuml/PSystemBuilder.java +++ b/src/net/sourceforge/plantuml/PSystemBuilder.java @@ -78,7 +78,7 @@ import net.sourceforge.plantuml.openiconic.PSystemListOpenIconicFactory; import net.sourceforge.plantuml.openiconic.PSystemOpenIconicFactory; import net.sourceforge.plantuml.oregon.PSystemOregonFactory; 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.SecurityUtils; import net.sourceforge.plantuml.sequencediagram.SequenceDiagramFactory; @@ -168,8 +168,8 @@ public class PSystemBuilder { factories.add(new PSystemOpenIconicFactory()); factories.add(new PSystemListOpenIconicFactory()); factories.add(new PSystemListInternalSpritesFactory()); - factories.add(new PSystemSaltFactory(DiagramType.SALT)); - factories.add(new PSystemSaltFactory(DiagramType.UML)); + factories.add(new PSystemSaltFactory2(DiagramType.SALT)); + factories.add(new PSystemSaltFactory2(DiagramType.UML)); factories.add(new PSystemDotFactory(DiagramType.DOT)); factories.add(new PSystemDotFactory(DiagramType.UML)); factories.add(new NwDiagramFactory()); diff --git a/src/net/sourceforge/plantuml/Run.java b/src/net/sourceforge/plantuml/Run.java index 284efe355..8a903e1db 100644 --- a/src/net/sourceforge/plantuml/Run.java +++ b/src/net/sourceforge/plantuml/Run.java @@ -59,7 +59,7 @@ import net.sourceforge.plantuml.classdiagram.ClassDiagramFactory; import net.sourceforge.plantuml.code.NoPlantumlCompressionException; import net.sourceforge.plantuml.code.Transcoder; 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.ftp.FtpServer; import net.sourceforge.plantuml.png.MetadataTag; @@ -349,7 +349,7 @@ public class Run { // printPattern(new ObjectDiagramFactory(null)); } - private static void printPattern(UmlDiagramFactory factory) { + private static void printPattern(PSystemCommandFactory factory) { System.out.println(); System.out.println(factory.getClass().getSimpleName().replaceAll("Factory", "")); final List descriptions = factory.getDescription(); diff --git a/src/net/sourceforge/plantuml/SpriteContainerEmpty.java b/src/net/sourceforge/plantuml/SpriteContainerEmpty.java index a5361f1c5..1e9a7de0a 100644 --- a/src/net/sourceforge/plantuml/SpriteContainerEmpty.java +++ b/src/net/sourceforge/plantuml/SpriteContainerEmpty.java @@ -94,4 +94,8 @@ public class SpriteContainerEmpty implements SpriteContainer, ISkinSimple { throw new UnsupportedOperationException(); } + public double minClassWidth() { + return 0; + } + } \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/TitledDiagram.java b/src/net/sourceforge/plantuml/TitledDiagram.java index 9de2ceb7a..671d811d7 100644 --- a/src/net/sourceforge/plantuml/TitledDiagram.java +++ b/src/net/sourceforge/plantuml/TitledDiagram.java @@ -37,10 +37,7 @@ package net.sourceforge.plantuml; 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.CommandSkinParamMultilines; import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.cucadiagram.Display; 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.VerticalAlignment; import net.sourceforge.plantuml.sprite.Sprite; +import net.sourceforge.plantuml.style.StyleBuilder; 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 Pragma pragma = new Pragma(); + + public Pragma getPragma() { + return pragma; + } + public TitledDiagram() { this.skinParam = SkinParam.create(getUmlDiagramType()); } + public final StyleBuilder getCurrentStyleBuilder() { + return skinParam.getCurrentStyleBuilder(); + } + public TitledDiagram(ISkinSimple orig) { this(); if (orig != null) { @@ -179,4 +187,25 @@ public abstract class TitledDiagram extends AbstractPSystem implements Diagram, 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; + } + } diff --git a/src/net/sourceforge/plantuml/UmlDiagram.java b/src/net/sourceforge/plantuml/UmlDiagram.java index 615f2efc4..390701037 100644 --- a/src/net/sourceforge/plantuml/UmlDiagram.java +++ b/src/net/sourceforge/plantuml/UmlDiagram.java @@ -55,10 +55,7 @@ import javax.script.ScriptException; import net.sourceforge.plantuml.anim.Animation; import net.sourceforge.plantuml.anim.AnimationDecoder; 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.CommandSkinParamMultilines; import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.ImageData; 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.SFile; import net.sourceforge.plantuml.security.SecurityUtils; -import net.sourceforge.plantuml.sprite.Sprite; import net.sourceforge.plantuml.svek.EmptySvgException; import net.sourceforge.plantuml.svek.GraphvizCrash; 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 final Pragma pragma = new Pragma(); private Animation animation; public UmlDiagram() { @@ -134,10 +129,6 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot throw new IllegalArgumentException(); } - public Pragma getPragma() { - return pragma; - } - final public void setAnimation(Iterable animationData) { try { final AnimationDecoder animationDecoder = new AnimationDecoder(animationData); @@ -152,13 +143,6 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot 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() { return hideUnlinkedData; } @@ -242,8 +226,7 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot graphicStrings.drawU(ug); final double height = graphicStrings.calculateDimension(ug.getStringBounder()).getHeight(); ug = ug.apply(UTranslate.dy(height)); - ug.draw(new UImage(new PixelImage(im, AffineTransformType.TYPE_NEAREST_NEIGHBOR)) - .scale(3)); + ug.draw(new UImage(new PixelImage(im, AffineTransformType.TYPE_NEAREST_NEIGHBOR)).scale(3)); } }); } @@ -327,7 +310,7 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot private ImageData exportDiagramInternalPdf(OutputStream os, int index) throws IOException { final File svg = FileUtils.createTempFileLegacy("pdf", ".svf"); 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)); fos.close(); PdfConverter.convert(svg, pdfFile); @@ -384,21 +367,6 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot 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) { } diff --git a/src/net/sourceforge/plantuml/UmlDiagramType.java b/src/net/sourceforge/plantuml/UmlDiagramType.java index d6482a84a..c49c34366 100644 --- a/src/net/sourceforge/plantuml/UmlDiagramType.java +++ b/src/net/sourceforge/plantuml/UmlDiagramType.java @@ -39,7 +39,7 @@ import net.sourceforge.plantuml.style.SName; public enum UmlDiagramType { SEQUENCE, STATE, CLASS, OBJECT, ACTIVITY, DESCRIPTION, COMPOSITE, FLOW, TIMING, BPM, NWDIAG, MINDMAP, WBS, WIRE, - HELP, GANTT; + HELP, GANTT, SALT; public SName getStyleName() { if (this == SEQUENCE) { @@ -72,6 +72,9 @@ public enum UmlDiagramType { if (this == GANTT) { return SName.ganttDiagram; } + if (this == SALT) { + return SName.saltDiagram; + } return SName.activityDiagram; } } diff --git a/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagramFactory.java b/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagramFactory.java index 7d6c7a750..2d41edda5 100644 --- a/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagramFactory.java +++ b/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagramFactory.java @@ -50,11 +50,11 @@ import net.sourceforge.plantuml.classdiagram.command.CommandHideShow2; import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.CommandFootboxIgnored; 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.CommandFactoryNoteOnLink; -public class ActivityDiagramFactory extends UmlDiagramFactory { +public class ActivityDiagramFactory extends PSystemCommandFactory { private final ISkinSimple skinParam; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagramFactory3.java b/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagramFactory3.java index 2ef005d91..ac20baa83 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagramFactory3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagramFactory3.java @@ -86,9 +86,9 @@ import net.sourceforge.plantuml.activitydiagram3.command.CommandWhileEnd3; import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.CommandDecoratorMultine; 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; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionRepeat.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionRepeat.java index 09fa40353..98216f238 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/InstructionRepeat.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionRepeat.java @@ -52,7 +52,7 @@ import net.sourceforge.plantuml.ugraphic.color.HColor; public class InstructionRepeat implements Instruction { - private final InstructionList repeatList = new InstructionList(); + private final InstructionList repeatList; private final Instruction parent; private final LinkRendering nextLinkRenderer; private final Swimlane swimlane; @@ -78,6 +78,7 @@ public class InstructionRepeat implements Instruction { public InstructionRepeat(Swimlane swimlane, Instruction parent, LinkRendering nextLinkRenderer, HColor color, Display startLabel, BoxStyle boxStyleIn, Colors colors) { + this.repeatList = new InstructionList(swimlane); this.boxStyleIn = boxStyleIn; this.startLabel = startLabel; this.parent = parent; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/EntityImageLegend.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/EntityImageLegend.java index 59e0a826c..9fa01647b 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/EntityImageLegend.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/EntityImageLegend.java @@ -39,12 +39,16 @@ import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.LineParam; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.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.color.HColor; @@ -52,6 +56,13 @@ public class EntityImageLegend { 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), HorizontalAlignment.LEFT, skinParam); final Rose rose = new Rose(); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNoteOpale.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNoteOpale.java index 27b3d9e3b..26fe74505 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNoteOpale.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNoteOpale.java @@ -218,7 +218,7 @@ public class FtileWithNoteOpale extends AbstractFtile implements Stencil, Stylea final Point2D pp2 = new Point2D.Double(-suppSpace, dimNote.getHeight() / 2); 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))); } ug.apply(getTranslate(stringBounder)).draw(tile); diff --git a/src/net/sourceforge/plantuml/bpm/BpmDiagram.java b/src/net/sourceforge/plantuml/bpm/BpmDiagram.java index 7ecf1d131..baee43741 100644 --- a/src/net/sourceforge/plantuml/bpm/BpmDiagram.java +++ b/src/net/sourceforge/plantuml/bpm/BpmDiagram.java @@ -92,8 +92,9 @@ public class BpmDiagram extends UmlDiagram { margin1 = 10; margin2 = 10; } - final ImageBuilder imageBuilder = ImageBuilder.buildD(getSkinParam(), ClockwiseTopRightBottomLeft.margin1margin2((double) margin1, (double) margin2), getAnimation(), fileFormatOption.isWithMetadata() ? getMetadata() : null, - getWarningOrError(), dpiFactor); + final ImageBuilder imageBuilder = ImageBuilder.buildD(getSkinParam(), + ClockwiseTopRightBottomLeft.margin1margin2(margin1, margin2), getAnimation(), + fileFormatOption.isWithMetadata() ? getMetadata() : null, getWarningOrError(), dpiFactor); imageBuilder.setUDrawable(getUDrawable()); return imageBuilder.writeImageTOBEMOVED(fileFormatOption, seed(), os); diff --git a/src/net/sourceforge/plantuml/bpm/BpmDiagramFactory.java b/src/net/sourceforge/plantuml/bpm/BpmDiagramFactory.java index 4144b8826..53373b871 100644 --- a/src/net/sourceforge/plantuml/bpm/BpmDiagramFactory.java +++ b/src/net/sourceforge/plantuml/bpm/BpmDiagramFactory.java @@ -40,10 +40,10 @@ import java.util.List; import net.sourceforge.plantuml.AbstractPSystem; import net.sourceforge.plantuml.command.Command; -import net.sourceforge.plantuml.command.UmlDiagramFactory; +import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.core.DiagramType; -public class BpmDiagramFactory extends UmlDiagramFactory { +public class BpmDiagramFactory extends PSystemCommandFactory { public BpmDiagramFactory(DiagramType type) { super(DiagramType.BPM); diff --git a/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java b/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java index 5fcaba017..570f6da17 100644 --- a/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java +++ b/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java @@ -208,10 +208,10 @@ public class ClassDiagram extends AbstractClassOrObjectDiagram { final int margin2; if (SkinParam.USE_STYLES()) { margin1 = SkinParam.zeroMargin(0); - margin2 = SkinParam.zeroMargin(10); + margin2 = SkinParam.zeroMargin(0); } else { margin1 = 0; - margin2 = 10; + margin2 = 0; } final ImageBuilder imageBuilder = ImageBuilder.buildD(getSkinParam(), ClockwiseTopRightBottomLeft.margin1margin2(margin1, margin2), null, null, null, 1); diff --git a/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java b/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java index 486522aba..279d66bc2 100644 --- a/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java +++ b/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java @@ -65,7 +65,7 @@ import net.sourceforge.plantuml.command.CommandPackage; import net.sourceforge.plantuml.command.CommandPackageEmpty; import net.sourceforge.plantuml.command.CommandPage; 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.CommandFactoryNote; 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.CommandCreateMap; -public class ClassDiagramFactory extends UmlDiagramFactory { +public class ClassDiagramFactory extends PSystemCommandFactory { private final ISkinSimple skinParam; diff --git a/src/net/sourceforge/plantuml/command/CommandFooter.java b/src/net/sourceforge/plantuml/command/CommandFooter.java index aa20585d1..cbf5720ce 100644 --- a/src/net/sourceforge/plantuml/command/CommandFooter.java +++ b/src/net/sourceforge/plantuml/command/CommandFooter.java @@ -39,7 +39,6 @@ import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.TitledDiagram; -import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; @@ -72,13 +71,11 @@ public class CommandFooter extends SingleLineCommand2 { final String align = arg.get("POSITION", 0); HorizontalAlignment ha = HorizontalAlignment.fromString(align, HorizontalAlignment.CENTER); if (SkinParam.USE_STYLES() && align == null) { - ha = FontParam.FOOTER.getStyleDefinition(null) - .getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder()) + ha = FontParam.FOOTER.getStyleDefinition(null).getMergedStyle(diagram.getCurrentStyleBuilder()) .getHorizontalAlignment(); } diagram.getFooter().putDisplay(Display.getWithNewlines(arg.get("LABEL", 0)), ha); - return CommandExecutionResult.ok(); } } diff --git a/src/net/sourceforge/plantuml/command/CommandHeader.java b/src/net/sourceforge/plantuml/command/CommandHeader.java index 64ed2fe62..0894bcab7 100644 --- a/src/net/sourceforge/plantuml/command/CommandHeader.java +++ b/src/net/sourceforge/plantuml/command/CommandHeader.java @@ -39,7 +39,6 @@ import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.TitledDiagram; -import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; @@ -74,8 +73,7 @@ public class CommandHeader extends SingleLineCommand2 { final String align = arg.get("POSITION", 0); HorizontalAlignment ha = HorizontalAlignment.fromString(align, HorizontalAlignment.RIGHT); if (SkinParam.USE_STYLES() && align == null) { - ha = FontParam.HEADER.getStyleDefinition(null) - .getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder()) + ha = FontParam.HEADER.getStyleDefinition(null).getMergedStyle(diagram.getCurrentStyleBuilder()) .getHorizontalAlignment(); } diagram.getHeader().putDisplay(Display.getWithNewlines(arg.get("LABEL", 0)), ha); diff --git a/src/net/sourceforge/plantuml/command/CommandPragma.java b/src/net/sourceforge/plantuml/command/CommandPragma.java index 260772c09..e1491b980 100644 --- a/src/net/sourceforge/plantuml/command/CommandPragma.java +++ b/src/net/sourceforge/plantuml/command/CommandPragma.java @@ -37,7 +37,7 @@ package net.sourceforge.plantuml.command; import net.sourceforge.plantuml.LineLocation; 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.RegexConcat; 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.cucadiagram.dot.GraphvizUtils; -public class CommandPragma extends SingleLineCommand2 { +public class CommandPragma extends SingleLineCommand2 { public CommandPragma() { super(getRegexConcat()); @@ -64,7 +64,7 @@ public class CommandPragma extends SingleLineCommand2 { } @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 value = arg.get("VALUE", 0); system.getPragma().define(name, value); diff --git a/src/net/sourceforge/plantuml/command/CommandSkinParam.java b/src/net/sourceforge/plantuml/command/CommandSkinParam.java index addbcc238..52060fd96 100644 --- a/src/net/sourceforge/plantuml/command/CommandSkinParam.java +++ b/src/net/sourceforge/plantuml/command/CommandSkinParam.java @@ -36,13 +36,13 @@ package net.sourceforge.plantuml.command; 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.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; -public class CommandSkinParam extends SingleLineCommand2 { +public class CommandSkinParam extends SingleLineCommand2 { public CommandSkinParam() { super(getRegexConcat()); @@ -58,7 +58,7 @@ public class CommandSkinParam extends SingleLineCommand2 { } @Override - protected CommandExecutionResult executeArg(UmlDiagram diagram, LineLocation location, RegexResult arg) { + protected CommandExecutionResult executeArg(TitledDiagram diagram, LineLocation location, RegexResult arg) { // arg.get(0).endsWith("locked"); diagram.setParam(arg.get("NAME", 0), arg.get("VALUE", 0)); return CommandExecutionResult.ok(); diff --git a/src/net/sourceforge/plantuml/command/CommandSkinParamMultilines.java b/src/net/sourceforge/plantuml/command/CommandSkinParamMultilines.java index 53746101d..ef034bb74 100644 --- a/src/net/sourceforge/plantuml/command/CommandSkinParamMultilines.java +++ b/src/net/sourceforge/plantuml/command/CommandSkinParamMultilines.java @@ -36,11 +36,11 @@ package net.sourceforge.plantuml.command; 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.MyPattern; -public class CommandSkinParamMultilines extends CommandMultilinesBracket { +public class CommandSkinParamMultilines extends CommandMultilinesBracket { public CommandSkinParamMultilines() { super("(?i)^skinparam[%s]*(?:[%s]+([\\w.]*(?:\\<\\<.*\\>\\>)?[\\w.]*))?[%s]*\\{$"); @@ -60,7 +60,7 @@ public class CommandSkinParamMultilines extends CommandMultilinesBracket { +public class CommandSpriteFile extends SingleLineCommand2 { public CommandSpriteFile() { super(getRegexConcat()); @@ -73,7 +73,7 @@ public class CommandSpriteFile extends SingleLineCommand2 { } @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 Sprite sprite; try { diff --git a/src/net/sourceforge/plantuml/command/UmlDiagramFactory.java b/src/net/sourceforge/plantuml/command/PSystemCommandFactory.java similarity index 98% rename from src/net/sourceforge/plantuml/command/UmlDiagramFactory.java rename to src/net/sourceforge/plantuml/command/PSystemCommandFactory.java index 4fb89d33d..801c1658c 100644 --- a/src/net/sourceforge/plantuml/command/UmlDiagramFactory.java +++ b/src/net/sourceforge/plantuml/command/PSystemCommandFactory.java @@ -59,15 +59,15 @@ import net.sourceforge.plantuml.style.CommandStyleMultilinesCSS; import net.sourceforge.plantuml.utils.StartUtils; import net.sourceforge.plantuml.version.IteratorCounter2; -public abstract class UmlDiagramFactory extends PSystemAbstractFactory { +public abstract class PSystemCommandFactory extends PSystemAbstractFactory { private List cmds; - protected UmlDiagramFactory() { + protected PSystemCommandFactory() { this(DiagramType.UML); } - protected UmlDiagramFactory(DiagramType type) { + protected PSystemCommandFactory(DiagramType type) { super(type); } diff --git a/src/net/sourceforge/plantuml/command/SkinLoader.java b/src/net/sourceforge/plantuml/command/SkinLoader.java index 4bba6aee9..ae341ee93 100644 --- a/src/net/sourceforge/plantuml/command/SkinLoader.java +++ b/src/net/sourceforge/plantuml/command/SkinLoader.java @@ -39,7 +39,7 @@ import java.util.ArrayList; import java.util.List; 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.MyPattern; import net.sourceforge.plantuml.command.regex.Pattern2; @@ -50,9 +50,9 @@ public class SkinLoader { .cmpile("^([\\w.]*(?:\\<\\<.*\\>\\>)?[\\w.]*)[%s]+(?:(\\{)|(.*))$|^\\}?$"); final private List context = new ArrayList(); - final private UmlDiagram diagram; + final private TitledDiagram diagram; - public SkinLoader(UmlDiagram diagram) { + public SkinLoader(TitledDiagram diagram) { this.diagram = diagram; } diff --git a/src/net/sourceforge/plantuml/compositediagram/CompositeDiagramFactory.java b/src/net/sourceforge/plantuml/compositediagram/CompositeDiagramFactory.java index 5cf0fd123..7b855debf 100644 --- a/src/net/sourceforge/plantuml/compositediagram/CompositeDiagramFactory.java +++ b/src/net/sourceforge/plantuml/compositediagram/CompositeDiagramFactory.java @@ -40,13 +40,13 @@ import java.util.List; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.command.Command; -import net.sourceforge.plantuml.command.UmlDiagramFactory; +import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.compositediagram.command.CommandCreateBlock; import net.sourceforge.plantuml.compositediagram.command.CommandCreatePackageBlock; import net.sourceforge.plantuml.compositediagram.command.CommandEndPackageBlock; import net.sourceforge.plantuml.compositediagram.command.CommandLinkBlock; -public class CompositeDiagramFactory extends UmlDiagramFactory { +public class CompositeDiagramFactory extends PSystemCommandFactory { private final ISkinSimple skinParam; diff --git a/src/net/sourceforge/plantuml/creole/Parser.java b/src/net/sourceforge/plantuml/creole/Parser.java index 469b85195..0876c115f 100644 --- a/src/net/sourceforge/plantuml/creole/Parser.java +++ b/src/net/sourceforge/plantuml/creole/Parser.java @@ -58,8 +58,15 @@ public class Parser { return new CreoleParser(fontConfiguration, horizontalAlignment, skinParam, creoleMode, stereotype); } + public static boolean isCodeStart(String line) { + return line.equals(""); + } + + public static boolean isCodeEnd(String line) { + return line.equals(""); + } + public static boolean isTreeStart(String line) { - // return false; return line.startsWith("|_"); } diff --git a/src/net/sourceforge/plantuml/creole/legacy/CreoleParser.java b/src/net/sourceforge/plantuml/creole/legacy/CreoleParser.java index 8ead08824..28c62c8ec 100644 --- a/src/net/sourceforge/plantuml/creole/legacy/CreoleParser.java +++ b/src/net/sourceforge/plantuml/creole/legacy/CreoleParser.java @@ -75,6 +75,16 @@ public class CreoleParser implements SheetBuilder { private Stripe createStripe(String line, CreoleContext context, Stripe lastStripe, 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)) { final StripeTable table = (StripeTable) lastStripe; table.analyzeAndAddLine(line); @@ -87,6 +97,8 @@ public class CreoleParser implements SheetBuilder { return new StripeTable(fontConfiguration, skinParam, line); } else if (Parser.isTreeStart(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) .createStripe(context); diff --git a/src/net/sourceforge/plantuml/creole/legacy/StripeCode.java b/src/net/sourceforge/plantuml/creole/legacy/StripeCode.java new file mode 100644 index 000000000..40dc04563 --- /dev/null +++ b/src/net/sourceforge/plantuml/creole/legacy/StripeCode.java @@ -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 raw = new ArrayList(); + + private boolean terminated; + + public StripeCode(FontConfiguration fontConfiguration, ISkinSimple skinParam, String line) { +// this.skinParam = skinParam; + this.fontConfiguration = fontConfiguration; + } + + public List getAtoms() { + return Collections.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 splitInTwo(StringBounder stringBounder, double width) { + throw new UnsupportedOperationException(); + } + +} diff --git a/src/net/sourceforge/plantuml/cucadiagram/BodierImpl.java b/src/net/sourceforge/plantuml/cucadiagram/BodierImpl.java index dfa77c68b..221021b0c 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/BodierImpl.java +++ b/src/net/sourceforge/plantuml/cucadiagram/BodierImpl.java @@ -209,7 +209,9 @@ public class BodierImpl implements Bodier { if (showFields == false) { 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) { throw new UnsupportedOperationException(); diff --git a/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced.java b/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced.java index c08bce958..f08bc7335 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced.java +++ b/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced.java @@ -164,9 +164,11 @@ public class BodyEnhanced extends AbstractTextBlock implements TextBlock, WithPo for (ListIterator it = rawBody.listIterator(); it.hasNext();) { final CharSequence s2 = it.next(); if (s2 instanceof EmbeddedDiagram) { - if (members.size() > 0) { + if (members.size() > 0 || separator != 0) { blocks.add(decorate(stringBounder, new MethodsOrFieldsArea(members, fontParam, skinParam, align, stereotype, entity, diagramType), separator, title)); + separator = 0; + title = null; members = new ArrayList(); } 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, stereotype, entity, diagramType), separator, title)); } + separator = 0; + title = null; members = new ArrayList(); final List allTree = buildAllTree(s, it); final TextBlock bloc = Display.create(allTree).create7(fontParam.getFontConfiguration(skinParam), diff --git a/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced2.java b/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced2.java index 4199147c4..adfa7f8ab 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced2.java +++ b/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced2.java @@ -40,6 +40,7 @@ import java.util.ArrayList; import java.util.List; import net.sourceforge.plantuml.FontParam; +import net.sourceforge.plantuml.Guillemet; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.LineBreakStrategy; import net.sourceforge.plantuml.StringUtils; @@ -55,21 +56,23 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; public class BodyEnhanced2 extends AbstractTextBlock implements TextBlock { - private TextBlock area2; + private TextBlock area; private final FontConfiguration titleConfig; - private final Display rawBody2; + private final Display rawBody; private final ISkinSimple spriteContainer; private final HorizontalAlignment align; private final LineBreakStrategy lineBreakStrategy; + private final double minClassWidth; // private final List urls = new ArrayList(); public BodyEnhanced2(Display rawBody, FontParam fontParam, ISkinSimple spriteContainer, HorizontalAlignment align, - FontConfiguration titleConfig, LineBreakStrategy lineBreakStrategy) { - this.rawBody2 = rawBody; + FontConfiguration titleConfig, LineBreakStrategy lineBreakStrategy, double minClassWidth) { + this.rawBody = rawBody; this.lineBreakStrategy = lineBreakStrategy; this.spriteContainer = spriteContainer; + this.minClassWidth = minClassWidth; this.titleConfig = titleConfig; this.align = align; @@ -93,38 +96,45 @@ public class BodyEnhanced2 extends AbstractTextBlock implements TextBlock { } private TextBlock getArea(StringBounder stringBounder) { - if (area2 != null) { - return area2; + if (area != null) { + return area; } // urls.clear(); final List blocks = new ArrayList(); char separator = 0; TextBlock title = null; - Display members2 = Display.empty(); - for (CharSequence s : rawBody2) { + Display display = Display.empty(); + for (CharSequence s : rawBody) { 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); title = getTitle(s.toString(), spriteContainer); - members2 = Display.empty(); + display = Display.empty(); } 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) { - this.area2 = blocks.get(0); + this.area = blocks.get(0); } 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) { - final TextBlock result = members2.create9(titleConfig, align, spriteContainer, lineBreakStrategy); + private TextBlock getTextBlock(Display display, StringBounder stringBounder) { + final TextBlock result = display.create9(titleConfig, align, spriteContainer, lineBreakStrategy); return result; } diff --git a/src/net/sourceforge/plantuml/cucadiagram/Display.java b/src/net/sourceforge/plantuml/cucadiagram/Display.java index e5487b5b9..d26955344 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/Display.java +++ b/src/net/sourceforge/plantuml/cucadiagram/Display.java @@ -237,9 +237,10 @@ public class Display implements Iterable { final Iterator it = strings.iterator(); while (it.hasNext()) { CharSequence s = it.next(); - if (s != null && StringUtils.trin(s.toString()).equals("{{")) { + final String type = EmbeddedDiagram.getEmbeddedType(s); + if (type != null) { final List other = new ArrayList(); - other.add("@startuml"); + other.add("@start" + type); while (it.hasNext()) { CharSequence s2 = it.next(); if (s2 != null && StringUtils.trin(s2.toString()).equals("}}")) { @@ -247,7 +248,7 @@ public class Display implements Iterable { } other.add(s2); } - other.add("@enduml"); + other.add("@end" + type); s = new EmbeddedDiagram(Display.create(other)); } result.add(s); diff --git a/src/net/sourceforge/plantuml/cucadiagram/LinkArrow.java b/src/net/sourceforge/plantuml/cucadiagram/LinkArrow.java index cccf70219..f67a8b677 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/LinkArrow.java +++ b/src/net/sourceforge/plantuml/cucadiagram/LinkArrow.java @@ -61,6 +61,10 @@ public enum LinkArrow { public Direction getArrowDirection() { return guide.getArrowDirection().getInv(); } + + public double getArrowDirection2() { + return Math.PI + guide.getArrowDirection2(); + } }; } diff --git a/src/net/sourceforge/plantuml/cucadiagram/Member.java b/src/net/sourceforge/plantuml/cucadiagram/Member.java index 427502ad9..83f08b444 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/Member.java +++ b/src/net/sourceforge/plantuml/cucadiagram/Member.java @@ -101,8 +101,8 @@ public class Member { this.visibilityModifier = null; this.abstractModifier = false; tmpDisplay = StringUtils.trin(tmpDisplay); - this.display = tmpDisplay.length() == 0 ? " " : Guillemet.GUILLEMET.manageGuillemet(StringUtils - .trin(tmpDisplay)); + this.display = tmpDisplay.length() == 0 ? " " + : Guillemet.GUILLEMET.manageGuillemet(StringUtils.trin(tmpDisplay)); } } @@ -114,7 +114,8 @@ public class Member { } 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; } @@ -193,13 +194,13 @@ public class Member { } public static boolean isMethod(String s) { - // s = UrlBuilder.purgeUrl(s); - if (s.contains("{method}")) { + final String purged = s.replaceAll(UrlBuilder.getRegexp(), ""); + if (purged.contains("{method}")) { return true; } - if (s.contains("{field}")) { + if (purged.contains("{field}")) { return false; } - return s.contains("(") || s.contains(")"); + return purged.contains("(") || purged.contains(")"); } } diff --git a/src/net/sourceforge/plantuml/cucadiagram/MethodsOrFieldsArea.java b/src/net/sourceforge/plantuml/cucadiagram/MethodsOrFieldsArea.java index 3318b6548..608f6ac5d 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/MethodsOrFieldsArea.java +++ b/src/net/sourceforge/plantuml/cucadiagram/MethodsOrFieldsArea.java @@ -61,7 +61,6 @@ import net.sourceforge.plantuml.skin.VisibilityModifier; 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.svek.Ports; import net.sourceforge.plantuml.svek.WithPorts; import net.sourceforge.plantuml.ugraphic.PlacementStrategy; diff --git a/src/net/sourceforge/plantuml/cute/PSystemCute.java b/src/net/sourceforge/plantuml/cute/PSystemCute.java index 6a737491c..bf4b2d261 100644 --- a/src/net/sourceforge/plantuml/cute/PSystemCute.java +++ b/src/net/sourceforge/plantuml/cute/PSystemCute.java @@ -97,8 +97,8 @@ public class PSystemCute extends AbstractPSystem { margin1 = 10; margin2 = 10; } - final ImageBuilder builder = ImageBuilder.buildB(new ColorMapperIdentity(), false, ClockwiseTopRightBottomLeft.margin1margin2((double) margin1, (double) margin2), - null, null, null, 1.0, null); + final ImageBuilder builder = ImageBuilder.buildB(new ColorMapperIdentity(), false, + ClockwiseTopRightBottomLeft.margin1margin2(margin1, margin2), null, null, null, 1.0, null); builder.setUDrawable(root); return builder.writeImageTOBEMOVED(fileFormat, seed, os); } diff --git a/src/net/sourceforge/plantuml/dedication/2.png b/src/net/sourceforge/plantuml/dedication/2.png new file mode 100644 index 0000000000000000000000000000000000000000..c37934ee8b8ac0f1c360b38cbb100ce9337223e4 GIT binary patch literal 24111 zcmV(rK<>XTcju;BS)5)lhr(+f3u=~b&xKoFmrTg>bxYk^t-SEr15|)KNHs)hn zv)ouZi^JPML2h(mF6~UFn6Uz9d)wLq%)LMw12mY zKHp(n%H4yzgVq_jb?UxwDNz(gxXsWphd6T6K?aV|&Y!CrqI@X^SNuqlM_uPe8Mt02 zUb(Y_e|iSI@xVrB9-YhLsifL^)#gn~s|{Ur!IVTDLu1>GYa+30g~H>3UXB>|@!ChQ zVs`zul<1J`t}aSUQfXyRk^r#K3Ynu#^LJY|FPKFjrP$A2XK9gTQ0kyWCH;l9J6(5< zDaq0hwOz85@)ydasZjDBl8GnOL#H}G!=!*-wpqGXr7f|xq)8F6LY0d9_JCD=o&Trz zDbV0iG9350b|miyi*70mBqsb#&Z@|QsF(kzm}=H?k)u^TQjLeh#^+i{egUKLdwW3p`JbsHqw%qaG|+M8 zG6H1j$2wkn<{W4{Ywn4F(BakV{NXS0ZP-Onupk_Dk%KOh+(GlnP zzgTbJgxoA$zu(SLba02sDm))_sf~~{zE!5B;P^nGqR>=od{q!m6uAeKD>A@|s@z9s zhz)gW7U%SeJeqqfLC~rIx~H|!snNOOrj|IQ>G^bw^a*#vXymxInE{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AvrR z;sj=az{kq3sC}EpG#1FnVj}N$PW}S0kX#rGVL#@HgH8}0={ugk%RAB!G|s5!QK<4H zbY%B{mJV9eqN}*{G%6>G=HzQGP&JwUpWZiTp13Z_w)jy)>h5l-){V)~Qh|%n?v6 z_-K7Om;HIKbM0wPx*IlC29Jah=1)&cn7;L1>Do_!x*=a?8D%#nl zZ`6Oo0SuHHHL_%P$V|?tdOrP+p*klT!D5MuCz!b>D2uu;!L;&z`2n8bRJ8m?Hr%Pt z|4|eXqA#_)c|<<3*$|jzI6n>@g}D5f~WVZE<-4CSRjH1GB6Y0 zlS>A`%|`2xr|lVlMy`<8bb$c*^owB&ckQnqV45=neo3wWEl;e-2~Fna=6M)L y9LNruEbG7OWmufAqW)V|8&cv-gc>DkmOsNl0JGg)B51Fw8Q_E5_2O|MG1=2zxaze4 literal 0 HcmV?d00001 diff --git a/src/net/sourceforge/plantuml/dedication/Dedications.java b/src/net/sourceforge/plantuml/dedication/Dedications.java index edb3139f6..f800c39a1 100644 --- a/src/net/sourceforge/plantuml/dedication/Dedications.java +++ b/src/net/sourceforge/plantuml/dedication/Dedications.java @@ -35,7 +35,6 @@ */ package net.sourceforge.plantuml.dedication; -import java.io.IOException; import java.io.InputStream; import java.util.HashMap; import java.util.Map; @@ -54,6 +53,7 @@ public class Dedications { addNormal("Boundaries allow discipline to create true strength", "boundaries"); addCrypted("0", "pOhci6rKgPXw32AeYXhOpSY0suoauHq5VUSwFqHLHsLYgSO6WaJ7BW5vtHBAoU6ePbcW7d8Flx99MWjPSKQTDm00"); addCrypted("1", "LTxN3hdnhSJ515qcA7IQ841axt4GXfUd3n2wgNirYCdLnyX2360Gv1OEOnJ1-gwFzRW5B3HAqLBkR6Ge0WW_Z000"); + addCrypted("2", "lZqLduj4j1yRqSfAvkhbqVpqK8diklatiFeenDUXSdna9bKYQTzdS264YfUBScUVDYCp2Vcq04updoN98RwxE000"); } private static void addNormal(String sentence, String name) { @@ -82,13 +82,13 @@ public class Dedications { if (signature.equals(ent.getKey())) { return dedication; } - } catch (IOException e) { + } catch (Exception e) { e.printStackTrace(); } finally { try { if (is != null) is.close(); - } catch (IOException e) { + } catch (Exception e) { e.printStackTrace(); } } diff --git a/src/net/sourceforge/plantuml/descdiagram/DescriptionDiagramFactory.java b/src/net/sourceforge/plantuml/descdiagram/DescriptionDiagramFactory.java index 098e63917..fab486126 100644 --- a/src/net/sourceforge/plantuml/descdiagram/DescriptionDiagramFactory.java +++ b/src/net/sourceforge/plantuml/descdiagram/DescriptionDiagramFactory.java @@ -48,7 +48,7 @@ import net.sourceforge.plantuml.command.CommandEndPackage; import net.sourceforge.plantuml.command.CommandFootboxIgnored; import net.sourceforge.plantuml.command.CommandPage; 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.CommandFactoryNoteOnEntity; 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.CommandPackageWithUSymbol; -public class DescriptionDiagramFactory extends UmlDiagramFactory { +public class DescriptionDiagramFactory extends PSystemCommandFactory { private final ISkinSimple skinParam; diff --git a/src/net/sourceforge/plantuml/descdiagram/command/CommandNewpage.java b/src/net/sourceforge/plantuml/descdiagram/command/CommandNewpage.java index ae7aa9439..59d7de2f9 100644 --- a/src/net/sourceforge/plantuml/descdiagram/command/CommandNewpage.java +++ b/src/net/sourceforge/plantuml/descdiagram/command/CommandNewpage.java @@ -40,7 +40,7 @@ import net.sourceforge.plantuml.NewpagedDiagram; import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.command.CommandExecutionResult; 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.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; @@ -48,9 +48,9 @@ import net.sourceforge.plantuml.command.regex.RegexResult; public class CommandNewpage extends SingleLineCommand2 { - private final UmlDiagramFactory factory; + private final PSystemCommandFactory factory; - public CommandNewpage(UmlDiagramFactory factory) { + public CommandNewpage(PSystemCommandFactory factory) { super(getRegexConcat()); this.factory = factory; } diff --git a/src/net/sourceforge/plantuml/descdiagram/command/StringWithArrow.java b/src/net/sourceforge/plantuml/descdiagram/command/StringWithArrow.java index 1d72b7459..6e2e08003 100644 --- a/src/net/sourceforge/plantuml/descdiagram/command/StringWithArrow.java +++ b/src/net/sourceforge/plantuml/descdiagram/command/StringWithArrow.java @@ -35,7 +35,6 @@ */ package net.sourceforge.plantuml.descdiagram.command; -import net.sourceforge.plantuml.Direction; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.StringUtils; 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.HorizontalAlignment; 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.VerticalAlignment; -import net.sourceforge.plantuml.svek.DirectionalTextBlock; import net.sourceforge.plantuml.svek.GuideLine; public class StringWithArrow { @@ -104,18 +102,17 @@ public class StringWithArrow { } static public TextBlock addMagicArrow(TextBlock label, GuideLine guide, FontConfiguration font) { - final TextBlock arrowRight = new TextBlockArrow(Direction.RIGHT, font); - final TextBlock arrowLeft = new TextBlockArrow(Direction.LEFT, font); - 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); + final TextBlock arrow = new TextBlockArrow2(guide, font); + return TextBlockUtils.mergeLR(arrow, label, VerticalAlignment.CENTER); } 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 arrowLeft = new TextBlockArrow(Direction.LEFT, font); final TextBlock arrowUp = new TextBlockArrow(Direction.UP, font); @@ -127,6 +124,27 @@ public class StringWithArrow { 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, HorizontalAlignment alignment, ISkinParam skinParam) { TextBlock result = TextBlockUtils.EMPTY_TEXT_BLOCK; diff --git a/src/net/sourceforge/plantuml/donors/PSystemDonors.java b/src/net/sourceforge/plantuml/donors/PSystemDonors.java index 474608ec2..4241a0ad5 100644 --- a/src/net/sourceforge/plantuml/donors/PSystemDonors.java +++ b/src/net/sourceforge/plantuml/donors/PSystemDonors.java @@ -74,26 +74,27 @@ public class PSystemDonors extends AbstractPSystem { private static final int COLS = 6; private static final int FREE_LINES = 6; - public static final String DONORS = "6peC02mFU3XMJbc44wzsvvsjcZxOY0eHBCyJYiF08fxk1iGVuDxfSR-H_YAwqhrlcX5jsPhYF6DGBGXw" - + "F3NN3DlSsmFFQdxwAlbcQdI5gJ0auIuaB6JOJp-fCgG4ptAz-MSKutlkfA5Pjis5a1j8l_2-CpRFJkEB" - + "LuycQ2FmOs1V_TyrhQoxLrLXI9TLZQbHfoiSmeZ84VuVTPkwHMsSJ6qQFQ1JELTmKvsAj0LlUgALD1Da" - + "NEiu7ysQLCL4caZnr4OA7ZcPeRqcgy-JAttG-QL-W3QjtJN4SmOKnqhfqVsrqVxp1DklaFYGS8POi5bW" - + "3fKSrYSeVcswqN6A8A5r5jdOwYktF371u8SM-kOFPNB5UqXabY55n-KA57WynW39dDIk2MU7RWPKrOCj" - + "-ZK8rULnu-uQX-MfP3OQRW4B5mjg1se8yZ_e4pwjx_p8v5o78fQGfqdSbcr0_LdoFkvDHT_CgqaWV6qV" - + "cXdYAbEr7jBOyZFMgqQ7t3LarUXVnXg57C6ytysbOFxH0laHwA4-4KdyBFkDXGI4QqlzqBlEJITN5k6K" - + "3YaLw_HRR7aj-K9NOB5nqQmEbkYxyUjoKoBOGbScbw47MbMvhVE9aj9G_x_8ew7hl-2QAhLxXsWzq-Oy" - + "-x_hbcQ6uW0Txs8MT2qW44RJgg_OG0I7XIuFkGcG0wXk9hVYPdaH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15k3lb1wMdxhg5fh5Uel_7" + + "MZiiEt_-lOviScgqUzrD43q7SG68y08DvNuXWhS1xuCDtO03Ld3HamXNhbfw6aXOi9dMsKNTlyoetF5Y" + + "kJ6vQENveOf_kYX7WTE-8SL5Cba--n8bhHtgGUMtVVCNYuiS1FyILOPaSbKRhsGaT09cSMx7hZCLTTj8" + + "0nQCZie4wfvwUZvCuoLZhbSeDGqF0_bkYmm9UWyjhAbfULm8h9RE_jx2DiJJ-xzWH3-_rl7pgXuQJc9q" + + "VRj0mxScf75E91WkaWy4oDLpJZHevfi4yg9QA0DBssROMOCLyXlu4Lv8E68R7mXocelcR0Too1Qo3un6" + + "rWVoQa83MLYiq6iI2wKS3wH82kQSBUDPf9sq0Njw1D0e2iR_xoq85myqFoEpzddrHZ2NPkx6CuXqk7y6" + + "YKsdRFN8XlrGvhBDAt8xnY8STkA_uplEjp-YRfv440d4K1AyLXFIuSOErIOsGyzr6jp7PMxSJ7u1bwAT" + + "9ndO6eejo58s0oMU1000"; /* * Special thanks to our sponsors and donors: diff --git a/src/net/sourceforge/plantuml/flowdiagram/FlowDiagramFactory.java b/src/net/sourceforge/plantuml/flowdiagram/FlowDiagramFactory.java index 8c88e37e7..4e18b8def 100644 --- a/src/net/sourceforge/plantuml/flowdiagram/FlowDiagramFactory.java +++ b/src/net/sourceforge/plantuml/flowdiagram/FlowDiagramFactory.java @@ -39,10 +39,10 @@ import java.util.ArrayList; import java.util.List; import net.sourceforge.plantuml.command.Command; -import net.sourceforge.plantuml.command.UmlDiagramFactory; +import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.core.DiagramType; -public class FlowDiagramFactory extends UmlDiagramFactory { +public class FlowDiagramFactory extends PSystemCommandFactory { public FlowDiagramFactory() { super(DiagramType.FLOW); diff --git a/src/net/sourceforge/plantuml/graphic/QuoteUtils.java b/src/net/sourceforge/plantuml/graphic/QuoteUtils.java index 53a618831..eb51f24c7 100644 --- a/src/net/sourceforge/plantuml/graphic/QuoteUtils.java +++ b/src/net/sourceforge/plantuml/graphic/QuoteUtils.java @@ -262,7 +262,7 @@ public class QuoteUtils { "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", "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", "Gunax lbh sbe pubbfvat Bprnavp Nveyvarf", "4-8-15-16-23-42", "...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", "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", - "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() { } diff --git a/src/net/sourceforge/plantuml/graphic/TextBlockArrow.java b/src/net/sourceforge/plantuml/graphic/TextBlockArrow.java index 3ff14b3d2..5d53c3fa9 100644 --- a/src/net/sourceforge/plantuml/graphic/TextBlockArrow.java +++ b/src/net/sourceforge/plantuml/graphic/TextBlockArrow.java @@ -69,11 +69,7 @@ public class TextBlockArrow extends AbstractTextBlock implements TextBlock { triSize--; } final UPolygon triangle = getTriangle(triSize); - if (arrow == Direction.RIGHT || arrow == Direction.LEFT) { - ug.apply(new UTranslate(2, (size - triSize) - 2)).draw(triangle); - } else { - ug.apply(new UTranslate(2, (size - triSize) - 2)).draw(triangle); - } + ug.apply(new UTranslate(2, (size - triSize) - 2)).draw(triangle); } private UPolygon getTriangle(int triSize) { diff --git a/src/net/sourceforge/plantuml/graphic/TextBlockArrow2.java b/src/net/sourceforge/plantuml/graphic/TextBlockArrow2.java new file mode 100644 index 000000000..00a594138 --- /dev/null +++ b/src/net/sourceforge/plantuml/graphic/TextBlockArrow2.java @@ -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); + } +} \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/graphic/TextBlockMarged.java b/src/net/sourceforge/plantuml/graphic/TextBlockMarged.java index ad154e8bd..0ff11b94c 100644 --- a/src/net/sourceforge/plantuml/graphic/TextBlockMarged.java +++ b/src/net/sourceforge/plantuml/graphic/TextBlockMarged.java @@ -42,6 +42,7 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft; import net.sourceforge.plantuml.svek.Ports; import net.sourceforge.plantuml.svek.WithPorts; +import net.sourceforge.plantuml.ugraphic.UEmpty; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; @@ -75,8 +76,14 @@ class TextBlockMarged extends AbstractTextBlock implements TextBlock, WithPorts } public void drawU(UGraphic ug) { - final UTranslate translate = new UTranslate(left, top); - textBlock.drawU(ug.apply(translate)); + // ug.apply(HColorUtils.BLUE).draw(new + // 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 diff --git a/src/net/sourceforge/plantuml/graphic/USymbol.java b/src/net/sourceforge/plantuml/graphic/USymbol.java index 05ff6ef7a..c20a1c65e 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbol.java +++ b/src/net/sourceforge/plantuml/graphic/USymbol.java @@ -83,8 +83,8 @@ public abstract class USymbol { 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 ENTITY_DOMAIN = record("ENTITY_DOMAIN", SkinParameter.ENTITY, - new USymbolEntityDomain(2)); - public final static USymbol CONTROL = record("CONTROL", SkinParameter.CONTROL, new USymbolControl(2)); + new USymbolEntityDomain()); + 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 QUEUE = record("QUEUE", SkinParameter.QUEUE, new USymbolQueue()); public final static USymbol STACK = record("STACK", SkinParameter.STACK, new USymbolStack()); diff --git a/src/net/sourceforge/plantuml/graphic/USymbolActor.java b/src/net/sourceforge/plantuml/graphic/USymbolActor.java index 6f6d3431e..320b08281 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolActor.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolActor.java @@ -36,7 +36,6 @@ package net.sourceforge.plantuml.graphic; import net.sourceforge.plantuml.skin.ActorStyle; -import net.sourceforge.plantuml.ugraphic.UStroke; class USymbolActor extends USymbolSimpleAbstract { @@ -54,8 +53,8 @@ class USymbolActor extends USymbolSimpleAbstract { @Override protected TextBlock getDrawing(SymbolContext symbolContext) { - final double deltaShadow = symbolContext.isShadowing() ? 4.0 : 0.0; - final SymbolContext tmp = symbolContext.withDeltaShadow(deltaShadow).withStroke(new UStroke(2)); + // final double deltaShadow = symbolContext.isShadowing() ? 4.0 : 0.0; + // final SymbolContext tmp = symbolContext.withDeltaShadow(deltaShadow).withStroke(new UStroke(2)); return actorStyle.getTextBlock(symbolContext); } diff --git a/src/net/sourceforge/plantuml/graphic/USymbolBoundary.java b/src/net/sourceforge/plantuml/graphic/USymbolBoundary.java index c67922a62..b28cf0ec6 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolBoundary.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolBoundary.java @@ -36,7 +36,6 @@ package net.sourceforge.plantuml.graphic; import net.sourceforge.plantuml.svek.Boundary; -import net.sourceforge.plantuml.ugraphic.UStroke; class USymbolBoundary extends USymbolSimpleAbstract { @@ -45,10 +44,8 @@ class USymbolBoundary extends USymbolSimpleAbstract { return SkinParameter.BOUNDARY; } - @Override - protected TextBlock getDrawing(final SymbolContext symbolContext) { - return new Boundary(symbolContext.withDeltaShadow(symbolContext.isShadowing() ? 4.0 : 0.0).withStroke( - new UStroke(2))); + protected TextBlock getDrawing(SymbolContext symbolContext) { + return new Boundary(symbolContext.withDeltaShadow(symbolContext.isShadowing() ? 4.0 : 0.0)); } } \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/graphic/USymbolControl.java b/src/net/sourceforge/plantuml/graphic/USymbolControl.java index 6ea7865b1..0bdaa45ac 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolControl.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolControl.java @@ -36,26 +36,17 @@ package net.sourceforge.plantuml.graphic; import net.sourceforge.plantuml.svek.Control; -import net.sourceforge.plantuml.ugraphic.UStroke; class USymbolControl extends USymbolSimpleAbstract { - private final double thickness; - - public USymbolControl(double thickness) { - this.thickness = thickness; - } - @Override public SkinParameter getSkinParameter() { return SkinParameter.CONTROL; } - @Override protected TextBlock getDrawing(final SymbolContext symbolContext) { - return new Control(symbolContext.withDeltaShadow(symbolContext.isShadowing() ? 4.0 : 0.0).withStroke( - new UStroke(thickness))); + return new Control(symbolContext.withDeltaShadow(symbolContext.isShadowing() ? 4.0 : 0.0)); } } \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/graphic/USymbolEntityDomain.java b/src/net/sourceforge/plantuml/graphic/USymbolEntityDomain.java index d7b6ddb89..52f34df5b 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolEntityDomain.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolEntityDomain.java @@ -36,25 +36,16 @@ package net.sourceforge.plantuml.graphic; import net.sourceforge.plantuml.svek.EntityDomain; -import net.sourceforge.plantuml.ugraphic.UStroke; class USymbolEntityDomain extends USymbolSimpleAbstract { - private final double thickness; - - public USymbolEntityDomain(double thickness) { - this.thickness = thickness; - } - @Override public SkinParameter getSkinParameter() { return SkinParameter.ENTITY; } - @Override protected TextBlock getDrawing(final SymbolContext symbolContext) { - return new EntityDomain(symbolContext.withDeltaShadow(symbolContext.isShadowing() ? 4.0 : 0.0).withStroke( - new UStroke(thickness))); + return new EntityDomain(symbolContext.withDeltaShadow(symbolContext.isShadowing() ? 4.0 : 0.0)); } } \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/graphic/USymbolSimpleAbstract.java b/src/net/sourceforge/plantuml/graphic/USymbolSimpleAbstract.java index a7665cc90..704545a4b 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolSimpleAbstract.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolSimpleAbstract.java @@ -39,6 +39,8 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.UGraphicStencil; +import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; abstract class USymbolSimpleAbstract extends USymbol { @@ -66,9 +68,9 @@ abstract class USymbolSimpleAbstract extends USymbol { final double labelY = dimStickMan.getHeight() + dimStereo.getHeight(); // Actor bug? - // final UGraphic ug2 = UGraphicStencil.create(ug, getRectangleStencil(dimLabel), new UStroke()); - // label.drawU(ug2.apply(new UTranslate(labelX, labelY))); - label.drawU(ug.apply(new UTranslate(labelX, labelY))); + final UGraphic ug2 = UGraphicStencil.create(ug, getRectangleStencil(dimLabel), new UStroke()); + label.drawU(ug2.apply(new UTranslate(labelX, labelY))); + // label.drawU(ug.apply(new UTranslate(labelX, labelY))); final double stereoX = (dimTotal.getWidth() - dimStereo.getWidth()) / 2; stereotype.drawU(ug.apply(UTranslate.dx(stereoX))); diff --git a/src/net/sourceforge/plantuml/help/HelpFactory.java b/src/net/sourceforge/plantuml/help/HelpFactory.java index e10a418f0..da0220382 100644 --- a/src/net/sourceforge/plantuml/help/HelpFactory.java +++ b/src/net/sourceforge/plantuml/help/HelpFactory.java @@ -39,9 +39,9 @@ import java.util.ArrayList; import java.util.List; 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 public Help createEmptyDiagram() { diff --git a/src/net/sourceforge/plantuml/jdot/CucaDiagramFileMakerJDot.java b/src/net/sourceforge/plantuml/jdot/CucaDiagramFileMakerJDot.java index 271020af6..47aef8780 100644 --- a/src/net/sourceforge/plantuml/jdot/CucaDiagramFileMakerJDot.java +++ b/src/net/sourceforge/plantuml/jdot/CucaDiagramFileMakerJDot.java @@ -423,10 +423,10 @@ public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker { final int margin2; if (SkinParam.USE_STYLES()) { margin1 = SkinParam.zeroMargin(0); - margin2 = SkinParam.zeroMargin(10); + margin2 = SkinParam.zeroMargin(0); } else { margin1 = 0; - margin2 = 10; + margin2 = 0; } final ImageBuilder imageBuilder = ImageBuilder.buildD(diagram.getSkinParam(), ClockwiseTopRightBottomLeft.margin1margin2(margin1, margin2), diagram.getAnimation(), diff --git a/src/net/sourceforge/plantuml/jungle/PSystemTree.java b/src/net/sourceforge/plantuml/jungle/PSystemTree.java index 78589201c..0fc8eac64 100644 --- a/src/net/sourceforge/plantuml/jungle/PSystemTree.java +++ b/src/net/sourceforge/plantuml/jungle/PSystemTree.java @@ -76,8 +76,8 @@ public class PSystemTree extends AbstractPSystem { margin1 = 5; margin2 = 5; } - final ImageBuilder builder = ImageBuilder.buildB(new ColorMapperIdentity(), false, ClockwiseTopRightBottomLeft.margin1margin2((double) margin1, (double) margin2), - null, null, null, 1.0, HColorUtils.WHITE); + final ImageBuilder builder = ImageBuilder.buildB(new ColorMapperIdentity(), false, + ClockwiseTopRightBottomLeft.margin1margin2(margin1, margin2), null, null, null, 1.0, HColorUtils.WHITE); if (rendering == Rendering.NEEDLE) { final UDrawable tmp = Needle.getNeedle(root, 200, 0, 60); final LimitFinder limitFinder = new LimitFinder(fileFormat.getDefaultStringBounder(), true); diff --git a/src/net/sourceforge/plantuml/jungle/PSystemTreeFactory.java b/src/net/sourceforge/plantuml/jungle/PSystemTreeFactory.java index a461fb2fa..8cb3e7653 100644 --- a/src/net/sourceforge/plantuml/jungle/PSystemTreeFactory.java +++ b/src/net/sourceforge/plantuml/jungle/PSystemTreeFactory.java @@ -38,10 +38,10 @@ import java.util.ArrayList; import java.util.List; import net.sourceforge.plantuml.command.Command; -import net.sourceforge.plantuml.command.UmlDiagramFactory; +import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.core.DiagramType; -public class PSystemTreeFactory extends UmlDiagramFactory { +public class PSystemTreeFactory extends PSystemCommandFactory { public PSystemTreeFactory(DiagramType type) { super(type); diff --git a/src/net/sourceforge/plantuml/mindmap/MindMapDiagramFactory.java b/src/net/sourceforge/plantuml/mindmap/MindMapDiagramFactory.java index 90ccea6bd..fc42ac378 100644 --- a/src/net/sourceforge/plantuml/mindmap/MindMapDiagramFactory.java +++ b/src/net/sourceforge/plantuml/mindmap/MindMapDiagramFactory.java @@ -39,10 +39,10 @@ import java.util.ArrayList; import java.util.List; import net.sourceforge.plantuml.command.Command; -import net.sourceforge.plantuml.command.UmlDiagramFactory; +import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.core.DiagramType; -public class MindMapDiagramFactory extends UmlDiagramFactory { +public class MindMapDiagramFactory extends PSystemCommandFactory { public MindMapDiagramFactory() { super(DiagramType.MINDMAP); diff --git a/src/net/sourceforge/plantuml/nwdiag/NwDiagramFactory.java b/src/net/sourceforge/plantuml/nwdiag/NwDiagramFactory.java index 603c9cfae..1544ded57 100644 --- a/src/net/sourceforge/plantuml/nwdiag/NwDiagramFactory.java +++ b/src/net/sourceforge/plantuml/nwdiag/NwDiagramFactory.java @@ -39,9 +39,9 @@ import java.util.ArrayList; import java.util.List; 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 public NwDiagram createEmptyDiagram() { diff --git a/src/net/sourceforge/plantuml/openiconic/PSystemOpenIconic.java b/src/net/sourceforge/plantuml/openiconic/PSystemOpenIconic.java index 4217d922a..e55921f21 100644 --- a/src/net/sourceforge/plantuml/openiconic/PSystemOpenIconic.java +++ b/src/net/sourceforge/plantuml/openiconic/PSystemOpenIconic.java @@ -73,8 +73,8 @@ public class PSystemOpenIconic extends AbstractPSystem { margin1 = 5; margin2 = 5; } - final ImageBuilder imageBuilder = ImageBuilder.buildB(new ColorMapperIdentity(), false, ClockwiseTopRightBottomLeft.margin1margin2((double) margin1, (double) margin2), - null, null, null, 1.0, null); + final ImageBuilder imageBuilder = ImageBuilder.buildB(new ColorMapperIdentity(), false, + ClockwiseTopRightBottomLeft.margin1margin2(margin1, margin2), null, null, null, 1.0, null); imageBuilder.setUDrawable(icon.asTextBlock(HColorUtils.BLACK, factor)); return imageBuilder.writeImageTOBEMOVED(fileFormat, seed, os); @@ -89,7 +89,8 @@ public class PSystemOpenIconic extends AbstractPSystem { // private GraphicStrings getGraphicStrings() throws IOException { // 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); // return result; // } diff --git a/src/net/sourceforge/plantuml/postit/PostIdDiagramFactory.java b/src/net/sourceforge/plantuml/postit/PostIdDiagramFactory.java index 6bd057fc6..b2b17951e 100644 --- a/src/net/sourceforge/plantuml/postit/PostIdDiagramFactory.java +++ b/src/net/sourceforge/plantuml/postit/PostIdDiagramFactory.java @@ -39,9 +39,9 @@ import java.util.ArrayList; import java.util.List; 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 protected List createCommands() { diff --git a/src/net/sourceforge/plantuml/project/ConstantPlan.java b/src/net/sourceforge/plantuml/project/ConstantPlan.java index 2e7326264..0b9928633 100644 --- a/src/net/sourceforge/plantuml/project/ConstantPlan.java +++ b/src/net/sourceforge/plantuml/project/ConstantPlan.java @@ -35,7 +35,7 @@ */ package net.sourceforge.plantuml.project; -import net.sourceforge.plantuml.project.time.Wink; +import net.sourceforge.plantuml.project.time.Day; public class ConstantPlan implements LoadPlanable { @@ -53,7 +53,7 @@ public class ConstantPlan implements LoadPlanable { return new ConstantPlan(load); } - public int getLoadAt(Wink instant) { + public int getLoadAt(Day instant) { return loadPerInstant; } diff --git a/src/net/sourceforge/plantuml/project/DaysAsDates.java b/src/net/sourceforge/plantuml/project/DaysAsDates.java index 9fb8f7560..f52c70455 100644 --- a/src/net/sourceforge/plantuml/project/DaysAsDates.java +++ b/src/net/sourceforge/plantuml/project/DaysAsDates.java @@ -56,7 +56,7 @@ public class DaysAsDates implements Iterable { if (gantt.isOpen(tmp)) { count--; } - tmp = tmp.next(); + tmp = tmp.increment(); } this.date2 = tmp; } @@ -75,7 +75,7 @@ public class DaysAsDates implements Iterable { public Day next() { final Day result = current; - current = current.next(); + current = current.increment(); return result; } diff --git a/src/net/sourceforge/plantuml/project/GanttArrow.java b/src/net/sourceforge/plantuml/project/GanttArrow.java index bd8ac7303..fda24c1c9 100644 --- a/src/net/sourceforge/plantuml/project/GanttArrow.java +++ b/src/net/sourceforge/plantuml/project/GanttArrow.java @@ -98,13 +98,13 @@ public class GanttArrow implements UDrawable { ug = ug.apply(color.bg()).apply(color).apply(style.getStroke3(new UStroke(1.5))); 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 y2 = getDestination().getY(atEnd).getValue(); + final double y2 = getDestination().getY(atEnd); 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) { @@ -115,7 +115,7 @@ public class GanttArrow implements UDrawable { drawLine(ug, x1, y1, x1, y2, x2, y2); } else { 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); } } else if (this.atStart == Direction.RIGHT && this.atEnd == Direction.LEFT) { diff --git a/src/net/sourceforge/plantuml/project/GanttConstraint.java b/src/net/sourceforge/plantuml/project/GanttConstraint.java index 53fa4cf39..d087ef4c7 100644 --- a/src/net/sourceforge/plantuml/project/GanttConstraint.java +++ b/src/net/sourceforge/plantuml/project/GanttConstraint.java @@ -40,7 +40,7 @@ import net.sourceforge.plantuml.cucadiagram.LinkType; import net.sourceforge.plantuml.cucadiagram.WithLinkType; import net.sourceforge.plantuml.graphic.UDrawable; 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.ugraphic.color.HColor; @@ -72,7 +72,7 @@ public class GanttConstraint extends WithLinkType { 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)) { return true; } @@ -82,7 +82,7 @@ public class GanttConstraint extends WithLinkType { 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) { return true; } diff --git a/src/net/sourceforge/plantuml/project/GanttDiagram.java b/src/net/sourceforge/plantuml/project/GanttDiagram.java index d4a8a1fc9..7bb89880d 100644 --- a/src/net/sourceforge/plantuml/project/GanttDiagram.java +++ b/src/net/sourceforge/plantuml/project/GanttDiagram.java @@ -57,6 +57,7 @@ import net.sourceforge.plantuml.Scale; import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.TitledDiagram; import net.sourceforge.plantuml.UmlDiagramType; +import net.sourceforge.plantuml.WithSprite; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.core.DiagramDescription; 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.TimeHeaderSimple; 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.time.Day; 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.style.ClockwiseTopRightBottomLeft; 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.HColorUtils; -public class GanttDiagram extends TitledDiagram implements ToTaskDraw { +public class GanttDiagram extends TitledDiagram implements ToTaskDraw, WithSprite { private final Map tasks = new LinkedHashMap(); private final Map byShortName = new HashMap(); @@ -120,10 +118,10 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw { private PrintScale printScale = PrintScale.DAILY; private Day today; - private GCalendar calendar; + private Day calendar; private double totalHeight; - private Wink min = new Wink(0); - private Wink max; + private Day min = Day.create(0); + private Day max; private Day printStart; private Day printEnd; @@ -213,8 +211,8 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw { if (printStart == null) { initMinMax(); } else { - this.min = calendar.fromDayAsDate(printStart); - this.max = calendar.fromDayAsDate(printEnd); + this.min = printStart; + this.max = printEnd; } final TimeHeader timeHeader; if (calendar == null) { @@ -262,7 +260,7 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw { private void drawTasksRect(UGraphic ug) { for (Task task : tasks.values()) { 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)); } } @@ -282,7 +280,7 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw { continue; } 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)); } } @@ -297,11 +295,10 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw { public final LoadPlanable getDefaultPlan() { return new LoadPlanable() { - public int getLoadAt(Wink instant) { + public int getLoadAt(Day day) { if (calendar == null) { return 100; } - final Day day = calendar.toDayAsDate((Wink) instant); if (isClosed(day)) { return 0; } @@ -333,7 +330,7 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw { private final Map draws = new LinkedHashMap(); private void initTaskAndResourceDraws(TimeScale timeScale, double headerHeight, StringBounder stringBounder) { - YMovable y = new YMovable(headerHeight); + double y = headerHeight; for (Task task : tasks.values()) { final TaskDraw draw; 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()); } if (task.getRow() == null) { - y = y.add(draw.getHeightTask()); + y += draw.getHeightTask(); } draws.put(task, draw); } - magicPush(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()); - + while (magicPushOnce(stringBounder)) { + // } - 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; for (TaskDraw td : draws.values()) { 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 notes = new ArrayList(); for (TaskDraw td : draws.values()) { final FingerPrint taskPrint = td.getFingerPrint(); @@ -397,29 +400,32 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw { private void pushIncluding(TaskDraw first, double deltaY) { boolean skipping = true; + if (first.getTrueRow() != null) { + first = first.getTrueRow(); + } for (TaskDraw td : draws.values()) { if (td == first) skipping = false; if (skipping) 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) { 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) { return tmp.getEnd(); } - return Wink.min(max, tmp.getEnd()); + return Day.min(max, tmp.getEnd()); } private void initMinMax() { @@ -431,8 +437,8 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw { if (task instanceof TaskSeparator) { continue; } - final Wink start = task.getStart(); - final Wink end = task.getEnd(); + final Day start = task.getStart(); + final Day end = task.getEnd(); // if (min.compareTo(start) > 0) { // min = start; // } @@ -443,15 +449,13 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw { } if (calendar != null) { for (Day d : colorDays.keySet()) { - final Wink instant = calendar.fromDayAsDate(d); - if (instant.compareTo(max) > 0) { - max = instant; + if (d.compareTo(max) > 0) { + max = d; } } for (Day d : nameDays.keySet()) { - final Wink instant = calendar.fromDayAsDate(d); - if (instant.compareTo(max) > 0) { - max = instant; + if (d.compareTo(max) > 0) { + max = d; } } } @@ -547,33 +551,27 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw { } public void setStartingDate(Day start) { - this.calendar = new GCalendar(start); + this.calendar = start; + this.min = start; } public Day getStartingDate() { - if (this.calendar == null) { - return null; - } - return this.calendar.getStartingDate(); + return this.calendar; } public Day getStartingDate(int nday) { if (this.calendar == null) { return null; } - return this.calendar.toDayAsDate(new Wink(nday)); + return this.calendar.addDays(nday); } public int daysInWeek() { return 7 - closedDayOfWeek.size(); } - public Wink convert(Day day) { - return calendar.fromDayAsDate(day); - } - public boolean isOpen(Day day) { - return getDefaultPlan().getLoadAt(convert(day)) > 0; + return getDefaultPlan().getLoadAt(day) > 0; } public void affectResource(Task result, String description) { @@ -593,13 +591,13 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw { public Resource getResource(String resourceName) { Resource resource = resources.get(resourceName); if (resource == null) { - resource = new Resource(resourceName, getDefaultPlan(), calendar); + resource = new Resource(resourceName, getDefaultPlan()); } resources.put(resourceName, resource); return resource; } - public int getLoadForResource(Resource res, Wink i) { + public int getLoadForResource(Resource res, Day i) { int result = 0; for (Task task : tasks.values()) { if (task instanceof TaskSeparator) { @@ -624,7 +622,7 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw { end = max(end, ent.getKey()); } if (start != null) { - result = new MomentImpl(convert(start), convert(end)); + result = new MomentImpl(start, end); } } return result; diff --git a/src/net/sourceforge/plantuml/project/GanttDiagramFactory.java b/src/net/sourceforge/plantuml/project/GanttDiagramFactory.java index 1b9c6d2c1..25638c31a 100644 --- a/src/net/sourceforge/plantuml/project/GanttDiagramFactory.java +++ b/src/net/sourceforge/plantuml/project/GanttDiagramFactory.java @@ -42,8 +42,7 @@ import java.util.List; import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.CommandNope; -import net.sourceforge.plantuml.command.CommandScale; -import net.sourceforge.plantuml.command.UmlDiagramFactory; +import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.project.command.CommandColorTask; 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.CommandStyleMultilinesCSS; -public class GanttDiagramFactory extends UmlDiagramFactory { +public class GanttDiagramFactory extends PSystemCommandFactory { static private final List subjects() { return Arrays.asList(new SubjectTask(), new SubjectProject(), new SubjectDayOfWeek(), @@ -85,6 +84,7 @@ public class GanttDiagramFactory extends UmlDiagramFactory { protected List createCommands() { final List cmds = new ArrayList(); addTitleCommands(cmds); + addCommonCommands2(cmds); cmds.add(new CommandStyleMultilinesCSS()); cmds.add(new CommandStyleImport()); @@ -101,7 +101,6 @@ public class GanttDiagramFactory extends UmlDiagramFactory { cmds.add(new CommandPrintScale()); cmds.add(new CommandPrintBetween()); - cmds.add(new CommandScale()); cmds.add(new CommandPage()); cmds.add(new CommandNoteBottom()); diff --git a/src/net/sourceforge/plantuml/project/LoadPlanable.java b/src/net/sourceforge/plantuml/project/LoadPlanable.java index 64d004759..50c01f1a1 100644 --- a/src/net/sourceforge/plantuml/project/LoadPlanable.java +++ b/src/net/sourceforge/plantuml/project/LoadPlanable.java @@ -35,9 +35,9 @@ */ package net.sourceforge.plantuml.project; -import net.sourceforge.plantuml.project.time.Wink; +import net.sourceforge.plantuml.project.time.Day; public interface LoadPlanable { - public int getLoadAt(Wink instant); + public int getLoadAt(Day instant); } diff --git a/src/net/sourceforge/plantuml/project/PlanUtils.java b/src/net/sourceforge/plantuml/project/PlanUtils.java index 9ad264ffa..354044747 100644 --- a/src/net/sourceforge/plantuml/project/PlanUtils.java +++ b/src/net/sourceforge/plantuml/project/PlanUtils.java @@ -35,7 +35,7 @@ */ package net.sourceforge.plantuml.project; -import net.sourceforge.plantuml.project.time.Wink; +import net.sourceforge.plantuml.project.time.Day; public class PlanUtils { @@ -45,7 +45,7 @@ public class PlanUtils { public static LoadPlanable minOf(final LoadPlanable p1, final LoadPlanable p2) { return new LoadPlanable() { - public int getLoadAt(Wink instant) { + public int getLoadAt(Day 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) { return new LoadPlanable() { - public int getLoadAt(Wink instant) { + public int getLoadAt(Day instant) { return p1.getLoadAt(instant) * p2.getLoadAt(instant) / 100; } }; diff --git a/src/net/sourceforge/plantuml/project/Solver.java b/src/net/sourceforge/plantuml/project/Solver.java index a6b7679d1..06d273d85 100644 --- a/src/net/sourceforge/plantuml/project/Solver.java +++ b/src/net/sourceforge/plantuml/project/Solver.java @@ -41,7 +41,7 @@ import java.util.Map; import java.util.Map.Entry; import net.sourceforge.plantuml.project.core.TaskAttribute; -import net.sourceforge.plantuml.project.time.Wink; +import net.sourceforge.plantuml.project.time.Day; public class Solver { @@ -56,8 +56,8 @@ public class Solver { public void setData(TaskAttribute attribute, Value value) { final Value previous = values.remove(attribute); if (previous != null && attribute == TaskAttribute.START) { - final Wink previousInstant = (Wink) previous; - if (previousInstant.compareTo((Wink) value) > 0) { + final Day previousInstant = (Day) previous; + if (previousInstant.compareTo((Day) value) > 0) { value = previous; } } @@ -90,8 +90,8 @@ public class Solver { return result; } - private Wink computeEnd() { - Wink current = (Wink) values.get(TaskAttribute.START); + private Day computeEnd() { + Day current = (Day) values.get(TaskAttribute.START); int fullLoad = ((Load) values.get(TaskAttribute.LOAD)).getFullLoad(); while (fullLoad > 0) { fullLoad -= loadPlanable.getLoadAt(current); @@ -100,13 +100,13 @@ public class Solver { return current.decrement(); } - private Wink computeStart() { - Wink current = (Wink) values.get(TaskAttribute.END); + private Day computeStart() { + Day current = (Day) values.get(TaskAttribute.END); int fullLoad = ((Load) values.get(TaskAttribute.LOAD)).getFullLoad(); while (fullLoad > 0) { fullLoad -= loadPlanable.getLoadAt(current); current = current.decrement(); - if (current.getWink() <= 0) { + if (current.getMillis() <= 0) { return current; } } diff --git a/src/net/sourceforge/plantuml/project/ToTaskDraw.java b/src/net/sourceforge/plantuml/project/ToTaskDraw.java index 18b9c3959..19eed5c1e 100644 --- a/src/net/sourceforge/plantuml/project/ToTaskDraw.java +++ b/src/net/sourceforge/plantuml/project/ToTaskDraw.java @@ -42,4 +42,6 @@ public interface ToTaskDraw { public TaskDraw getTaskDraw(Task task); + public LoadPlanable getDefaultPlan(); + } diff --git a/src/net/sourceforge/plantuml/project/command/CommandGanttArrow.java b/src/net/sourceforge/plantuml/project/command/CommandGanttArrow.java index 409ed7706..671bbb441 100644 --- a/src/net/sourceforge/plantuml/project/command/CommandGanttArrow.java +++ b/src/net/sourceforge/plantuml/project/command/CommandGanttArrow.java @@ -46,8 +46,6 @@ import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement; import net.sourceforge.plantuml.project.GanttConstraint; import net.sourceforge.plantuml.project.GanttDiagram; 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 { diff --git a/src/net/sourceforge/plantuml/project/core/Moment.java b/src/net/sourceforge/plantuml/project/core/Moment.java index 47ec59be4..503d50f67 100644 --- a/src/net/sourceforge/plantuml/project/core/Moment.java +++ b/src/net/sourceforge/plantuml/project/core/Moment.java @@ -35,12 +35,12 @@ */ package net.sourceforge.plantuml.project.core; -import net.sourceforge.plantuml.project.time.Wink; +import net.sourceforge.plantuml.project.time.Day; public interface Moment { - public Wink getStart(); + public Day getStart(); - public Wink getEnd(); + public Day getEnd(); } diff --git a/src/net/sourceforge/plantuml/project/core/MomentImpl.java b/src/net/sourceforge/plantuml/project/core/MomentImpl.java index 8fe2d00fa..21dcea7da 100644 --- a/src/net/sourceforge/plantuml/project/core/MomentImpl.java +++ b/src/net/sourceforge/plantuml/project/core/MomentImpl.java @@ -35,23 +35,23 @@ */ 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 { - private final Wink start; - private final Wink end; + private final Day start; + private final Day end; - public MomentImpl(Wink start, Wink end) { + public MomentImpl(Day start, Day end) { this.start = start; this.end = end; } - public Wink getStart() { + public Day getStart() { return start; } - public Wink getEnd() { + public Day getEnd() { return end; } diff --git a/src/net/sourceforge/plantuml/project/core/Resource.java b/src/net/sourceforge/plantuml/project/core/Resource.java index e6234e07e..7dd1c32fa 100644 --- a/src/net/sourceforge/plantuml/project/core/Resource.java +++ b/src/net/sourceforge/plantuml/project/core/Resource.java @@ -44,22 +44,18 @@ import net.sourceforge.plantuml.project.LoadPlanable; import net.sourceforge.plantuml.project.draw.ResourceDraw; import net.sourceforge.plantuml.project.time.Day; import net.sourceforge.plantuml.project.time.DayOfWeek; -import net.sourceforge.plantuml.project.time.GCalendar; -import net.sourceforge.plantuml.project.time.Wink; public class Resource { private final String name; private ResourceDraw draw; - private final Set closed = new TreeSet(); - private final Set forcedOn = new TreeSet(); - private final GCalendar calendar; + private final Set closed = new TreeSet(); + private final Set forcedOn = new TreeSet(); private final Collection closedDayOfWeek = EnumSet.noneOf(DayOfWeek.class); - public Resource(String name, LoadPlanable loadPlanable, GCalendar calendar) { + public Resource(String name, LoadPlanable loadPlanable) { this.name = name; - this.calendar = calendar; } @Override @@ -90,24 +86,23 @@ public class Resource { this.draw = draw; } - public boolean isClosedAt(Wink instant) { + public boolean isClosedAt(Day instant) { if (this.forcedOn.contains(instant)) { return false; } - if (closedDayOfWeek.size() > 0 && calendar != null) { - final Day d = calendar.toDayAsDate((Wink) instant); - if (closedDayOfWeek.contains(d.getDayOfWeek())) { + if (closedDayOfWeek.size() > 0) { + if (closedDayOfWeek.contains(instant.getDayOfWeek())) { return true; } } return this.closed.contains(instant); } - public void addCloseDay(Wink instant) { + public void addCloseDay(Day instant) { this.closed.add(instant); } - public void addForceOnDay(Wink instant) { + public void addForceOnDay(Day instant) { this.forcedOn.add(instant); } diff --git a/src/net/sourceforge/plantuml/project/core/Task.java b/src/net/sourceforge/plantuml/project/core/Task.java index c2e323e86..6bac103c2 100644 --- a/src/net/sourceforge/plantuml/project/core/Task.java +++ b/src/net/sourceforge/plantuml/project/core/Task.java @@ -39,24 +39,24 @@ import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.project.Load; 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.Wink; public interface Task extends Moment { public TaskCode getCode(); - public Wink getStart(); + public Day getStart(); - public Wink getEnd(); + public Day getEnd(); public Load getLoad(); 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); @@ -74,7 +74,7 @@ public interface Task extends Moment { public Task getRow(); - public void addPause(Wink pause); + public void addPause(Day pause); public void addPause(DayOfWeek pause); diff --git a/src/net/sourceforge/plantuml/project/core/TaskImpl.java b/src/net/sourceforge/plantuml/project/core/TaskImpl.java index 653b23a25..ad149880d 100644 --- a/src/net/sourceforge/plantuml/project/core/TaskImpl.java +++ b/src/net/sourceforge/plantuml/project/core/TaskImpl.java @@ -54,17 +54,14 @@ import net.sourceforge.plantuml.project.Solver; 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.GCalendar; -import net.sourceforge.plantuml.project.time.Wink; public class TaskImpl extends AbstractTask implements Task, LoadPlanable { - private final SortedSet pausedDay = new TreeSet(); + private final SortedSet pausedDay = new TreeSet(); private final Set pausedDayOfWeek = new HashSet(); private final Solver solver; private final Map resources = new LinkedHashMap(); private final LoadPlanable defaultPlan; - private final GCalendar calendar; private boolean diamond; private int completion = 100; @@ -77,16 +74,19 @@ public class TaskImpl extends AbstractTask implements Task, LoadPlanable { this.url = url; } - public TaskImpl(TaskCode code, LoadPlanable defaultPlan, GCalendar calendar) { + public TaskImpl(TaskCode code, LoadPlanable defaultPlan, Day calendar) { super(code); - this.calendar = calendar; this.defaultPlan = defaultPlan; this.solver = new Solver(this); - setStart(new Wink(0)); + if (calendar == null) { + setStart(Day.create(0)); + } else { + setStart(calendar); + } setLoad(Load.inWinks(1)); } - public int getLoadAt(Wink instant) { + public int getLoadAt(Day instant) { if (pausedDay.contains(instant)) { return 0; } @@ -101,16 +101,16 @@ public class TaskImpl extends AbstractTask implements Task, LoadPlanable { return result.getLoadAt(instant); } - private boolean pausedDayOfWeek(Wink instant) { + private boolean pausedDayOfWeek(Day instant) { for (DayOfWeek dayOfWeek : pausedDayOfWeek) { - if (calendar.toDayAsDate(instant).getDayOfWeek() == dayOfWeek) { + if (instant.getDayOfWeek() == dayOfWeek) { return true; } } 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 && instant.compareTo(getEnd()) <= 0) { if (res.isClosedAt(instant)) { @@ -121,7 +121,7 @@ public class TaskImpl extends AbstractTask implements Task, LoadPlanable { return 0; } - public void addPause(Wink pause) { + public void addPause(Day pause) { this.pausedDay.add(pause); } @@ -134,7 +134,7 @@ public class TaskImpl extends AbstractTask implements Task, LoadPlanable { throw new IllegalStateException(); } return new LoadPlanable() { - public int getLoadAt(Wink instant) { + public int getLoadAt(Day instant) { int result = 0; for (Map.Entry ent : resources.entrySet()) { final Resource res = ent.getKey(); @@ -184,16 +184,16 @@ public class TaskImpl extends AbstractTask implements Task, LoadPlanable { return code; } - public Wink getStart() { - Wink result = (Wink) solver.getData(TaskAttribute.START); + public Day getStart() { + Day result = (Day) solver.getData(TaskAttribute.START); while (getLoadAt(result) == 0) { result = result.increment(); } return result; } - public Wink getEnd() { - return (Wink) solver.getData(TaskAttribute.END); + public Day getEnd() { + return (Day) solver.getData(TaskAttribute.END); } public Load getLoad() { @@ -204,11 +204,11 @@ public class TaskImpl extends AbstractTask implements Task, LoadPlanable { solver.setData(TaskAttribute.LOAD, load); } - public void setStart(Wink start) { + public void setStart(Day start) { solver.setData(TaskAttribute.START, start); } - public void setEnd(Wink end) { + public void setEnd(Day end) { solver.setData(TaskAttribute.END, end); } @@ -244,20 +244,20 @@ public class TaskImpl extends AbstractTask implements Task, LoadPlanable { return completion; } - public final Collection getAllPaused() { - final SortedSet result = new TreeSet(pausedDay); + public final Collection getAllPaused() { + final SortedSet result = new TreeSet(pausedDay); for (DayOfWeek dayOfWeek : pausedDayOfWeek) { addAll(result, dayOfWeek); } return Collections.unmodifiableCollection(result); } - private void addAll(SortedSet result, DayOfWeek dayOfWeek) { - final Day start = calendar.toDayAsDate(getStart()); - final Day end = calendar.toDayAsDate(getEnd()); - for (Day current = start; current.compareTo(end) <= 0; current = current.next()) { + private void addAll(SortedSet result, DayOfWeek dayOfWeek) { + final Day start = getStart(); + final Day end = getEnd(); + for (Day current = start; current.compareTo(end) <= 0; current = current.increment()) { if (current.getDayOfWeek() == dayOfWeek) { - result.add(calendar.fromDayAsDate(current)); + result.add(current); } } } diff --git a/src/net/sourceforge/plantuml/project/core/TaskInstant.java b/src/net/sourceforge/plantuml/project/core/TaskInstant.java index d28942515..e8645bcdb 100644 --- a/src/net/sourceforge/plantuml/project/core/TaskInstant.java +++ b/src/net/sourceforge/plantuml/project/core/TaskInstant.java @@ -35,7 +35,7 @@ */ package net.sourceforge.plantuml.project.core; -import net.sourceforge.plantuml.project.time.Wink; +import net.sourceforge.plantuml.project.time.Day; public class TaskInstant { @@ -60,7 +60,7 @@ public class TaskInstant { return new TaskInstant(task, attribute, newDelta); } - private Wink manageDelta(Wink value) { + private Day manageDelta(Day value) { if (delta > 0) { for (int i = 0; i < delta; i++) { value = value.increment(); @@ -74,7 +74,7 @@ public class TaskInstant { return value; } - public Wink getInstantPrecise() { + public Day getInstantPrecise() { if (attribute == TaskAttribute.START) { return manageDelta(task.getStart()); } @@ -84,7 +84,7 @@ public class TaskInstant { throw new IllegalStateException(); } - public Wink getInstantTheorical() { + public Day getInstantTheorical() { if (attribute == TaskAttribute.START) { return manageDelta(task.getStart()); } diff --git a/src/net/sourceforge/plantuml/project/core/TaskSeparator.java b/src/net/sourceforge/plantuml/project/core/TaskSeparator.java index 65e895b88..1ab603be2 100644 --- a/src/net/sourceforge/plantuml/project/core/TaskSeparator.java +++ b/src/net/sourceforge/plantuml/project/core/TaskSeparator.java @@ -39,8 +39,8 @@ import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.project.Load; 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.Wink; public class TaskSeparator extends AbstractTask implements Task { @@ -55,19 +55,19 @@ public class TaskSeparator extends AbstractTask implements Task { return code; } - public Wink getStart() { + public Day getStart() { throw new UnsupportedOperationException(); } - public Wink getEnd() { + public Day getEnd() { throw new UnsupportedOperationException(); } - public void setStart(Wink start) { + public void setStart(Day start) { throw new UnsupportedOperationException(); } - public void setEnd(Wink end) { + public void setEnd(Day end) { throw new UnsupportedOperationException(); } @@ -107,7 +107,7 @@ public class TaskSeparator extends AbstractTask implements Task { throw new UnsupportedOperationException(); } - public void addPause(Wink pause) { + public void addPause(Day pause) { throw new UnsupportedOperationException(); } diff --git a/src/net/sourceforge/plantuml/project/core2/Hole.java b/src/net/sourceforge/plantuml/project/core2/Hole.java index 264886dc9..f2c9b0c9a 100644 --- a/src/net/sourceforge/plantuml/project/core2/Hole.java +++ b/src/net/sourceforge/plantuml/project/core2/Hole.java @@ -35,6 +35,8 @@ */ package net.sourceforge.plantuml.project.core2; +import net.sourceforge.plantuml.project.time.DayOfWeek; + public class Hole implements Comparable { private final long start; @@ -48,6 +50,11 @@ public class Hole implements Comparable { this.end = end; } + @Override + public String toString() { + return DayOfWeek.timeToString(start) + " --> " + DayOfWeek.timeToString(end); + } + public final long getStart() { return start; } diff --git a/src/net/sourceforge/plantuml/project/core2/HolesList.java b/src/net/sourceforge/plantuml/project/core2/HolesList.java index c76bb23af..84ccd425b 100644 --- a/src/net/sourceforge/plantuml/project/core2/HolesList.java +++ b/src/net/sourceforge/plantuml/project/core2/HolesList.java @@ -44,11 +44,15 @@ public class HolesList implements Iterable { private final List list = new ArrayList(); - public void add(Hole tooth) { + public void addHole(Hole tooth) { list.add(tooth); Collections.sort(list); } + public int size() { + return list.size(); + } + @Override public String toString() { return list.toString(); @@ -66,4 +70,15 @@ public class HolesList implements Iterable { 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; + } + } diff --git a/src/net/sourceforge/plantuml/project/core2/Slice.java b/src/net/sourceforge/plantuml/project/core2/Slice.java index fe2237a65..2daf38028 100644 --- a/src/net/sourceforge/plantuml/project/core2/Slice.java +++ b/src/net/sourceforge/plantuml/project/core2/Slice.java @@ -79,18 +79,25 @@ public class Slice { public List intersectWith(HolesList holes) { final List result = new ArrayList(); - for (Hole hole : holes) { + for (Hole hole : holes.negate()) { final Slice inter = intersectWith(hole); - + if (inter != null) { + result.add(inter); + } } return Collections.unmodifiableList(result); } 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 new Slice(Math.max(start, hole.getStart()), Math.min(end, hole.getEnd()), workLoad); + return new Slice(newStart, newEnd, workLoad); } } diff --git a/src/net/sourceforge/plantuml/project/core2/WorkLoadWithHoles.java b/src/net/sourceforge/plantuml/project/core2/WorkLoadWithHoles.java index 96b5ab20b..23a6221e3 100644 --- a/src/net/sourceforge/plantuml/project/core2/WorkLoadWithHoles.java +++ b/src/net/sourceforge/plantuml/project/core2/WorkLoadWithHoles.java @@ -35,7 +35,6 @@ */ package net.sourceforge.plantuml.project.core2; -import java.util.ArrayList; import java.util.List; public class WorkLoadWithHoles implements WorkLoad { @@ -44,7 +43,7 @@ public class WorkLoadWithHoles implements WorkLoad { private final HolesList holes = new HolesList(); 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) { @@ -61,6 +60,8 @@ public class WorkLoadWithHoles implements WorkLoad { public Slice next() { final Slice candidat = slices.next(); + final List pending = candidat.intersectWith(holes); + System.err.println("pending=" + pending); throw new UnsupportedOperationException(); } } diff --git a/src/net/sourceforge/plantuml/project/core3/Histogram.java b/src/net/sourceforge/plantuml/project/core3/Histogram.java new file mode 100644 index 000000000..48fedb0b7 --- /dev/null +++ b/src/net/sourceforge/plantuml/project/core3/Histogram.java @@ -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); + +} diff --git a/src/net/sourceforge/plantuml/project/time/Wink.java b/src/net/sourceforge/plantuml/project/core3/HistogramSimple.java similarity index 62% rename from src/net/sourceforge/plantuml/project/time/Wink.java rename to src/net/sourceforge/plantuml/project/core3/HistogramSimple.java index 45566c9ea..40351a662 100644 --- a/src/net/sourceforge/plantuml/project/time/Wink.java +++ b/src/net/sourceforge/plantuml/project/core3/HistogramSimple.java @@ -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 { +public class HistogramSimple implements Histogram { - private final int wink; + private final Map events = new TreeMap(); - public Wink(int wink) { - this.wink = wink; + public long getNext(long moment) { + 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 public String toString() { - return "(Wink +" + wink + ")"; + return events.toString(); } - public Wink increment() { - return new Wink(wink + 1); - } - - public Wink decrement() { - return new Wink(wink - 1); - } - - 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; + public long getValueAt(long moment) { + long last = 0; + for (Entry ent : events.entrySet()) { + if (ent.getKey() > moment) { + return last; + } + last = ent.getValue(); } - return wink1; - } - - public static Wink max(Wink wink1, Wink wink2) { - if (wink2.wink > wink1.wink) { - return wink2; - } - return wink1; + return last; } } diff --git a/src/net/sourceforge/plantuml/project/core3/Solver10.java b/src/net/sourceforge/plantuml/project/core3/Solver10.java new file mode 100644 index 000000000..c70d75392 --- /dev/null +++ b/src/net/sourceforge/plantuml/project/core3/Solver10.java @@ -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(); + } + +} diff --git a/src/net/sourceforge/plantuml/project/draw/YMovable.java b/src/net/sourceforge/plantuml/project/core3/TaskLoad.java similarity index 80% rename from src/net/sourceforge/plantuml/project/draw/YMovable.java rename to src/net/sourceforge/plantuml/project/core3/TaskLoad.java index 78bc87cc5..9206dfd2e 100644 --- a/src/net/sourceforge/plantuml/project/draw/YMovable.java +++ b/src/net/sourceforge/plantuml/project/core3/TaskLoad.java @@ -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) { - this.y = y; - } + public long getEnd(); - public YMovable add(double v) { - return new YMovable(y + v); - } - - public final double getValue() { - return y; - } - - public void pushMe(double delta) { - this.y += delta; - - } + public Histogram getLoad(); } diff --git a/src/net/sourceforge/plantuml/project/time/GCalendar.java b/src/net/sourceforge/plantuml/project/core3/TaskLoadImpl.java similarity index 68% rename from src/net/sourceforge/plantuml/project/time/GCalendar.java rename to src/net/sourceforge/plantuml/project/core3/TaskLoadImpl.java index c0f359524..947c52b23 100644 --- a/src/net/sourceforge/plantuml/project/time/GCalendar.java +++ b/src/net/sourceforge/plantuml/project/core3/TaskLoadImpl.java @@ -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) { - this.start = start; + public TaskLoadImpl(Histogram load) { + this.load = load; } - public Day toDayAsDate(Wink day) { - 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() { + public final long getStart() { 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; + } + } diff --git a/src/net/sourceforge/plantuml/project/core3/TimeLine.java b/src/net/sourceforge/plantuml/project/core3/TimeLine.java new file mode 100644 index 000000000..be39e76c2 --- /dev/null +++ b/src/net/sourceforge/plantuml/project/core3/TimeLine.java @@ -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); + +} diff --git a/src/net/sourceforge/plantuml/project/core3/TimeLineSimple.java b/src/net/sourceforge/plantuml/project/core3/TimeLineSimple.java new file mode 100644 index 000000000..3d4fb5d8e --- /dev/null +++ b/src/net/sourceforge/plantuml/project/core3/TimeLineSimple.java @@ -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 events = new ArrayList(); + + 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); + } + +} diff --git a/src/net/sourceforge/plantuml/project/draw/AbstractTaskDraw.java b/src/net/sourceforge/plantuml/project/draw/AbstractTaskDraw.java index 48e76231a..91272855d 100644 --- a/src/net/sourceforge/plantuml/project/draw/AbstractTaskDraw.java +++ b/src/net/sourceforge/plantuml/project/draw/AbstractTaskDraw.java @@ -43,7 +43,7 @@ import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.project.ToTaskDraw; import net.sourceforge.plantuml.project.core.Task; 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.style.PName; import net.sourceforge.plantuml.style.Style; @@ -56,15 +56,20 @@ public abstract class AbstractTaskDraw implements TaskDraw { protected Url url; protected Display note; protected final TimeScale timeScale; - protected final YMovable y; + private double y; protected final String prettyDisplay; - protected final Wink start; + protected final Day start; protected final ISkinParam skinParam; private final Task task; private final ToTaskDraw toTaskDraw; 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) { this.colors = colors; this.completion = completion; @@ -72,7 +77,7 @@ public abstract class AbstractTaskDraw implements TaskDraw { 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) { this.y = y; this.toTaskDraw = toTaskDraw; @@ -105,25 +110,35 @@ public abstract class AbstractTaskDraw implements TaskDraw { 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) { 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() { return task; } - public final YMovable getY(Direction direction) { + public final double getY(Direction direction) { if (direction == Direction.UP) { return getY(); } if (direction == Direction.DOWN) { - return getY().add(getHeightTask()); + return getY() + getHeightTask(); } - return getY().add(getHeightTask() / 2); + return getY() + getHeightTask() / 2; } } diff --git a/src/net/sourceforge/plantuml/project/draw/ResourceDraw.java b/src/net/sourceforge/plantuml/project/draw/ResourceDraw.java index a2e8d5f55..d7c86c9b8 100644 --- a/src/net/sourceforge/plantuml/project/draw/ResourceDraw.java +++ b/src/net/sourceforge/plantuml/project/draw/ResourceDraw.java @@ -43,7 +43,7 @@ import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.project.GanttDiagram; 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.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -56,12 +56,12 @@ public class ResourceDraw implements UDrawable { private final Resource res; private final TimeScale timeScale; - private final YMovable y; - private final Wink min; - private final Wink max; + private final double y; + private final Day min; + private final Day max; 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.timeScale = timeScale; this.y = y; @@ -81,7 +81,7 @@ public class ResourceDraw implements UDrawable { double startingPosition = -1; int totalLoad = 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); totalLoad += gantt.getLoadForResource(res, i); totalLimit += 100; @@ -123,8 +123,8 @@ public class ResourceDraw implements UDrawable { return 16 * 2; } - public double getY() { - return y.getValue(); + public final double getY() { + return y; } } diff --git a/src/net/sourceforge/plantuml/project/draw/TaskDraw.java b/src/net/sourceforge/plantuml/project/draw/TaskDraw.java index 101caa0da..603bb3e77 100644 --- a/src/net/sourceforge/plantuml/project/draw/TaskDraw.java +++ b/src/net/sourceforge/plantuml/project/draw/TaskDraw.java @@ -46,12 +46,16 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; public interface TaskDraw extends UDrawable { + public TaskDraw getTrueRow(); + 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 double getHeightTask(); @@ -64,4 +68,5 @@ public interface TaskDraw extends UDrawable { public FingerPrint getFingerPrintNote(StringBounder stringBounder); + } diff --git a/src/net/sourceforge/plantuml/project/draw/TaskDrawDiamond.java b/src/net/sourceforge/plantuml/project/draw/TaskDrawDiamond.java index 7194ebeeb..8f4add48c 100644 --- a/src/net/sourceforge/plantuml/project/draw/TaskDrawDiamond.java +++ b/src/net/sourceforge/plantuml/project/draw/TaskDrawDiamond.java @@ -43,7 +43,7 @@ import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.project.ToTaskDraw; 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.style.SName; import net.sourceforge.plantuml.style.Style; @@ -55,7 +55,7 @@ import net.sourceforge.plantuml.ugraphic.UTranslate; 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) { super(timeScale, y, prettyDisplay, start, skinParam, task, toTaskDraw); } @@ -108,7 +108,7 @@ public class TaskDrawDiamond extends AbstractTaskDraw { public FingerPrint getFingerPrint() { final double h = getHeightTask(); 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() { diff --git a/src/net/sourceforge/plantuml/project/draw/TaskDrawRegular.java b/src/net/sourceforge/plantuml/project/draw/TaskDrawRegular.java index 95d77304b..4f00030e5 100644 --- a/src/net/sourceforge/plantuml/project/draw/TaskDrawRegular.java +++ b/src/net/sourceforge/plantuml/project/draw/TaskDrawRegular.java @@ -37,6 +37,7 @@ package net.sourceforge.plantuml.project.draw; import java.awt.geom.Dimension2D; import java.util.Collection; +import java.util.TreeSet; import net.sourceforge.plantuml.FontParam; 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.core.Task; 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.style.PName; import net.sourceforge.plantuml.style.SName; @@ -72,20 +73,27 @@ import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class TaskDrawRegular extends AbstractTaskDraw { - private final Wink end; + private final Day end; private final boolean oddStart; private final boolean oddEnd; - private final Collection paused; + private final Collection paused; private final double margin = 2; - public TaskDrawRegular(TimeScale timeScale, YMovable y, String prettyDisplay, Wink start, Wink end, - boolean oddStart, boolean oddEnd, ISkinParam skinParam, Task task, ToTaskDraw toTaskDraw) { + public TaskDrawRegular(TimeScale timeScale, double y, String prettyDisplay, Day start, Day end, boolean oddStart, + boolean oddEnd, ISkinParam skinParam, Task task, ToTaskDraw toTaskDraw) { super(timeScale, y, prettyDisplay, start, skinParam, task, toTaskDraw); this.end = end; this.oddStart = oddStart; this.oddEnd = oddEnd; - this.paused = ((TaskImpl) task).getAllPaused(); + this.paused = new TreeSet(((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) { @@ -156,7 +164,7 @@ public class TaskDrawRegular extends AbstractTaskDraw { final double h = getHeightTask(); final double startPos = timeScale.getStartingPosition(start); 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) { @@ -166,7 +174,7 @@ public class TaskDrawRegular extends AbstractTaskDraw { final Dimension2D dim = getOpaleNote().calculateDimension(stringBounder); final double startPos = timeScale.getStartingPosition(start); // 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) { @@ -213,8 +221,8 @@ public class TaskDrawRegular extends AbstractTaskDraw { if (url != null) { ug.closeUrl(); } - Wink begin = null; - for (Wink pause : paused) { + Day begin = null; + for (Day pause : paused) { if (paused.contains(pause.increment())) { if (begin == null) 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 x2 = timeScale.getEndingPosition(end); final URectangle small = new URectangle(x2 - x1 - 1, getShapeHeight() + 1); diff --git a/src/net/sourceforge/plantuml/project/draw/TaskDrawSeparator.java b/src/net/sourceforge/plantuml/project/draw/TaskDrawSeparator.java index ec6fade96..f38f56b99 100644 --- a/src/net/sourceforge/plantuml/project/draw/TaskDrawSeparator.java +++ b/src/net/sourceforge/plantuml/project/draw/TaskDrawSeparator.java @@ -46,7 +46,7 @@ import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.project.core.Task; 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.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -57,12 +57,12 @@ import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class TaskDrawSeparator implements TaskDraw { private final TimeScale timeScale; - private final YMovable y; - private final Wink min; - private final Wink max; + private double y; + private final Day min; + private final Day max; 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.y = y; this.timeScale = timeScale; @@ -112,17 +112,25 @@ public class TaskDrawSeparator implements TaskDraw { public FingerPrint getFingerPrint() { final double h = getHeightTask(); 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() { return 16; } - public YMovable getY() { + public double getY() { 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) { } @@ -130,7 +138,7 @@ public class TaskDrawSeparator implements TaskDraw { throw new UnsupportedOperationException(); } - public YMovable getY(Direction direction) { + public double getY(Direction direction) { throw new UnsupportedOperationException(); } diff --git a/src/net/sourceforge/plantuml/project/draw/TimeHeader.java b/src/net/sourceforge/plantuml/project/draw/TimeHeader.java index 80bc698ba..4a3ad4813 100644 --- a/src/net/sourceforge/plantuml/project/draw/TimeHeader.java +++ b/src/net/sourceforge/plantuml/project/draw/TimeHeader.java @@ -40,7 +40,7 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.project.time.Wink; +import net.sourceforge.plantuml.project.time.Day; import net.sourceforge.plantuml.project.timescale.TimeScale; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -55,10 +55,10 @@ public abstract class TimeHeader { protected static final int Y_POS_ROW28 = 28; private final TimeScale timeScale; - protected final Wink min; - protected final Wink max; + protected final Day min; + protected final Day max; - public TimeHeader(Wink min, Wink max, TimeScale timeScale) { + public TimeHeader(Day min, Day max, TimeScale timeScale) { this.timeScale = timeScale; this.min = min; this.max = max; diff --git a/src/net/sourceforge/plantuml/project/draw/TimeHeaderDaily.java b/src/net/sourceforge/plantuml/project/draw/TimeHeaderDaily.java index 7a3db976e..f69ecb5e1 100644 --- a/src/net/sourceforge/plantuml/project/draw/TimeHeaderDaily.java +++ b/src/net/sourceforge/plantuml/project/draw/TimeHeaderDaily.java @@ -40,9 +40,7 @@ import java.util.Map; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.project.LoadPlanable; import net.sourceforge.plantuml.project.time.Day; -import net.sourceforge.plantuml.project.time.GCalendar; import net.sourceforge.plantuml.project.time.MonthYear; -import net.sourceforge.plantuml.project.time.Wink; import net.sourceforge.plantuml.project.timescale.TimeScaleDaily; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; @@ -62,15 +60,13 @@ public class TimeHeaderDaily extends TimeHeader { private final HColor veryLightGray = HColorSet.instance().getColorIfValid("#E0E8E8"); private final HColor lightGray = HColorSet.instance().getColorIfValid("#909898"); - private final GCalendar calendar; private final LoadPlanable defaultPlan; private final Map colorDays; private final Map nameDays; - public TimeHeaderDaily(GCalendar calendar, Wink min, Wink max, LoadPlanable defaultPlan, Map colorDays, + public TimeHeaderDaily(Day calendar, Day min, Day max, LoadPlanable defaultPlan, Map colorDays, Map nameDays, Day printStart, Day printEnd) { super(min, max, new TimeScaleDaily(calendar, printStart)); - this.calendar = calendar; this.defaultPlan = defaultPlan; this.colorDays = colorDays; this.nameDays = nameDays; @@ -87,7 +83,6 @@ public class TimeHeaderDaily extends TimeHeader { private void drawCalendar(final UGraphic ug, double totalHeight) { drawTexts(ug, totalHeight); drawMonths(ug); - drawNonWorking(ug, totalHeight); drawVBars(ug, totalHeight); drawVbar(ug, getTimeScale().getStartingPosition(max.increment()), Y_POS_ROW16, totalHeight); printNamedDays(ug); @@ -96,37 +91,38 @@ public class TimeHeaderDaily extends TimeHeader { private void drawTexts(final UGraphic ug, double totalHeight) { final double height = totalHeight - getFullHeaderHeight(); - for (Wink wink = min; wink.compareTo(max) <= 0; wink = wink.increment()) { + for (Day wink = min; wink.compareTo(max) <= 0; wink = wink.increment()) { final double x1 = getTimeScale().getStartingPosition(wink); final double x2 = getTimeScale().getEndingPosition(wink); - final Day day = calendar.toDayAsDate(wink); HColor textColor = HColorUtils.BLACK; if (defaultPlan.getLoadAt(wink) <= 0) { textColor = lightGray; } - final HColor back = colorDays.get(day); + HColor back = colorDays.get(wink); + if (back == null && defaultPlan.getLoadAt(wink) == 0) { + back = veryLightGray; + } if (back != null) { drawRectangle(ug.apply(back.bg()), height, x1, x2); } printCentered(ug.apply(UTranslate.dy(Y_POS_ROW16)), - getTextBlock(day.getDayOfWeek().shortName(), 10, false, textColor), x1, x2); + getTextBlock(wink.getDayOfWeek().shortName(), 10, false, textColor), x1, x2); printCentered(ug.apply(UTranslate.dy(Y_POS_ROW28)), - getTextBlock("" + day.getDayOfMonth(), 10, false, textColor), x1, x2); + getTextBlock("" + wink.getDayOfMonth(), 10, false, textColor), x1, x2); } } private void drawMonths(final UGraphic ug) { MonthYear last = null; double lastChangeMonth = -1; - for (Wink wink = min; wink.compareTo(max) <= 0; wink = wink.increment()) { + for (Day wink = min; wink.compareTo(max) <= 0; wink = wink.increment()) { final double x1 = getTimeScale().getStartingPosition(wink); - final Day day = calendar.toDayAsDate(wink); - if (day.monthYear().equals(last) == false) { + if (wink.monthYear().equals(last) == false) { if (last != null) { printMonth(ug, last, lastChangeMonth, x1); } lastChangeMonth = x1; - last = day.monthYear(); + last = wink.monthYear(); } } final double x1 = getTimeScale().getStartingPosition(max.increment()); @@ -135,17 +131,6 @@ public class TimeHeaderDaily extends TimeHeader { } } - private void drawNonWorking(final UGraphic ug, double totalHeight) { - final double height = totalHeight - getFullHeaderHeight(); - for (Wink wink = min; wink.compareTo(max) <= 0; wink = wink.increment()) { - final double x1 = getTimeScale().getStartingPosition(wink); - final double x2 = getTimeScale().getEndingPosition(wink); - if (defaultPlan.getLoadAt(wink) == 0) { - drawRectangle(ug.apply(veryLightGray.bg()), height, x1, x2); - } - } - } - private void drawRectangle(UGraphic ug, double height, double x1, double x2) { if (height == 0) { return; @@ -157,12 +142,11 @@ public class TimeHeaderDaily extends TimeHeader { private void drawVBars(final UGraphic ug, double totalHeight) { MonthYear last = null; - for (Wink wink = min; wink.compareTo(max) <= 0; wink = wink.increment()) { + for (Day wink = min; wink.compareTo(max) <= 0; wink = wink.increment()) { double startingY = getFullHeaderHeight(); - final Day day = calendar.toDayAsDate(wink); - if (day.monthYear().equals(last) == false) { + if (wink.monthYear().equals(last) == false) { startingY = 0; - last = day.monthYear(); + last = wink.monthYear(); } drawVbar(ug, getTimeScale().getStartingPosition(wink), startingY, totalHeight); } @@ -183,9 +167,8 @@ public class TimeHeaderDaily extends TimeHeader { private void printNamedDays(final UGraphic ug) { if (nameDays.size() > 0) { String last = null; - for (Wink wink = min; wink.compareTo(max.increment()) <= 0; wink = wink.increment()) { - final Day tmpday = calendar.toDayAsDate(wink); - final String name = nameDays.get(tmpday); + for (Day wink = min; wink.compareTo(max.increment()) <= 0; wink = wink.increment()) { + final String name = nameDays.get(wink); if (name != null && name.equals(last) == false) { final double x1 = getTimeScale().getStartingPosition(wink); final double x2 = getTimeScale().getEndingPosition(wink); diff --git a/src/net/sourceforge/plantuml/project/draw/TimeHeaderMonthly.java b/src/net/sourceforge/plantuml/project/draw/TimeHeaderMonthly.java index 8261b4888..e5a6563ba 100644 --- a/src/net/sourceforge/plantuml/project/draw/TimeHeaderMonthly.java +++ b/src/net/sourceforge/plantuml/project/draw/TimeHeaderMonthly.java @@ -41,9 +41,7 @@ import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.project.LoadPlanable; import net.sourceforge.plantuml.project.core.PrintScale; import net.sourceforge.plantuml.project.time.Day; -import net.sourceforge.plantuml.project.time.GCalendar; import net.sourceforge.plantuml.project.time.MonthYear; -import net.sourceforge.plantuml.project.time.Wink; import net.sourceforge.plantuml.project.timescale.TimeScaleCompressed; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; @@ -57,12 +55,9 @@ public class TimeHeaderMonthly extends TimeHeader { return Y_POS_ROW16 + 13; } - private final GCalendar calendar; - - public TimeHeaderMonthly(GCalendar calendar, Wink min, Wink max, LoadPlanable defaultPlan, - Map colorDays, Map nameDays) { + public TimeHeaderMonthly(Day calendar, Day min, Day max, LoadPlanable defaultPlan, Map colorDays, + Map nameDays) { super(min, max, new TimeScaleCompressed(calendar, PrintScale.MONTHLY.getCompress())); - this.calendar = calendar; } @Override @@ -82,16 +77,15 @@ public class TimeHeaderMonthly extends TimeHeader { private void drawYears(final UGraphic ug) { MonthYear last = null; double lastChange = -1; - for (Wink wink = min; wink.compareTo(max) < 0; wink = wink.increment()) { - final Day day = calendar.toDayAsDate(wink); + for (Day wink = min; wink.compareTo(max) < 0; wink = wink.increment()) { final double x1 = getTimeScale().getStartingPosition(wink); - if (last == null || day.monthYear().year() != last.year()) { + if (last == null || wink.monthYear().year() != last.year()) { drawVbar(ug, x1, 0, Y_POS_ROW16); if (last != null) { printYear(ug, last, lastChange, x1); } lastChange = x1; - last = day.monthYear(); + last = wink.monthYear(); } } final double x1 = getTimeScale().getStartingPosition(max.increment()); @@ -103,16 +97,15 @@ public class TimeHeaderMonthly extends TimeHeader { private void drawMonths(final UGraphic ug) { MonthYear last = null; double lastChange = -1; - for (Wink wink = min; wink.compareTo(max) < 0; wink = wink.increment()) { - final Day day = calendar.toDayAsDate(wink); + for (Day wink = min; wink.compareTo(max) < 0; wink = wink.increment()) { final double x1 = getTimeScale().getStartingPosition(wink); - if (day.monthYear().equals(last) == false) { + if (wink.monthYear().equals(last) == false) { drawVbar(ug, x1, Y_POS_ROW16, Y_POS_ROW28); if (last != null) { printMonth(ug.apply(UTranslate.dy(Y_POS_ROW16)), last, lastChange, x1); } lastChange = x1; - last = day.monthYear(); + last = wink.monthYear(); } } final double x1 = getTimeScale().getStartingPosition(max.increment()); diff --git a/src/net/sourceforge/plantuml/project/draw/TimeHeaderSimple.java b/src/net/sourceforge/plantuml/project/draw/TimeHeaderSimple.java index 671838c1c..5e6b6ce1d 100644 --- a/src/net/sourceforge/plantuml/project/draw/TimeHeaderSimple.java +++ b/src/net/sourceforge/plantuml/project/draw/TimeHeaderSimple.java @@ -39,7 +39,7 @@ import net.sourceforge.plantuml.SpriteContainerEmpty; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.HorizontalAlignment; 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.TimeScaleWink; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -62,7 +62,7 @@ public class TimeHeaderSimple extends TimeHeader { return 0; } - public TimeHeaderSimple(Wink min, Wink max) { + public TimeHeaderSimple(Day min, Day max) { super(min, max, new TimeScaleWink()); } @@ -72,16 +72,17 @@ public class TimeHeaderSimple extends TimeHeader { final double xmax = getTimeScale().getEndingPosition(max); drawSimpleDayCounter(ug, getTimeScale(), totalHeight); ug.apply(HColorUtils.LIGHT_GRAY).draw(ULine.hline(xmax - xmin)); - ug.apply(HColorUtils.LIGHT_GRAY).apply(UTranslate.dy(getFullHeaderHeight() - 3)) - .draw(ULine.hline(xmax - xmin)); + ug.apply(HColorUtils.LIGHT_GRAY).apply(UTranslate.dy(getFullHeaderHeight() - 3)).draw(ULine.hline(xmax - xmin)); } private void drawSimpleDayCounter(final UGraphic ug, TimeScale timeScale, double totalHeight) { final ULine vbar = ULine.vline(totalHeight); - for (Wink i = min; i.compareTo(max.increment()) <= 0; i = i.increment()) { - final TextBlock num = Display.getWithNewlines(i.toShortString()).create(getFontConfiguration(10, false, HColorUtils.BLACK), - HorizontalAlignment.LEFT, new SpriteContainerEmpty()); + for (Day i = min; i.compareTo(max.increment()) <= 0; i = i.increment()) { + final String number = "" + (i.getAbsoluteDayNum() + 1); + final TextBlock num = Display.getWithNewlines(number).create( + getFontConfiguration(10, false, HColorUtils.BLACK), HorizontalAlignment.LEFT, + new SpriteContainerEmpty()); final double x1 = timeScale.getStartingPosition(i); final double x2 = timeScale.getEndingPosition(i); final double width = num.calculateDimension(ug.getStringBounder()).getWidth(); diff --git a/src/net/sourceforge/plantuml/project/draw/TimeHeaderWeekly.java b/src/net/sourceforge/plantuml/project/draw/TimeHeaderWeekly.java index 3fbdf9691..0070c4937 100644 --- a/src/net/sourceforge/plantuml/project/draw/TimeHeaderWeekly.java +++ b/src/net/sourceforge/plantuml/project/draw/TimeHeaderWeekly.java @@ -42,9 +42,7 @@ import net.sourceforge.plantuml.project.LoadPlanable; import net.sourceforge.plantuml.project.core.PrintScale; import net.sourceforge.plantuml.project.time.Day; import net.sourceforge.plantuml.project.time.DayOfWeek; -import net.sourceforge.plantuml.project.time.GCalendar; import net.sourceforge.plantuml.project.time.MonthYear; -import net.sourceforge.plantuml.project.time.Wink; import net.sourceforge.plantuml.project.timescale.TimeScaleCompressed; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; @@ -58,12 +56,9 @@ public class TimeHeaderWeekly extends TimeHeader { return Y_POS_ROW16 + 13; } - private final GCalendar calendar; - - public TimeHeaderWeekly(GCalendar calendar, Wink min, Wink max, LoadPlanable defaultPlan, - Map colorDays, Map nameDays) { + public TimeHeaderWeekly(Day calendar, Day min, Day max, LoadPlanable defaultPlan, Map colorDays, + Map nameDays) { super(min, max, new TimeScaleCompressed(calendar, PrintScale.WEEKLY.getCompress())); - this.calendar = calendar; } @Override @@ -84,16 +79,15 @@ public class TimeHeaderWeekly extends TimeHeader { private void printMonths(final UGraphic ug) { MonthYear last = null; double lastChangeMonth = -1; - for (Wink wink = min; wink.compareTo(max) < 0; wink = wink.increment()) { - final Day day = calendar.toDayAsDate(wink); + for (Day wink = min; wink.compareTo(max) < 0; wink = wink.increment()) { final double x1 = getTimeScale().getStartingPosition(wink); - if (day.monthYear().equals(last) == false) { + if (wink.monthYear().equals(last) == false) { drawVbar(ug, x1, 0, Y_POS_ROW16); if (last != null) { printMonth(ug, last, lastChangeMonth, x1); } lastChangeMonth = x1; - last = day.monthYear(); + last = wink.monthYear(); } } final double x1 = getTimeScale().getStartingPosition(max.increment()); @@ -103,18 +97,18 @@ public class TimeHeaderWeekly extends TimeHeader { } private void printSmallVbars(final UGraphic ug, double totalHeight) { - for (Wink wink = min; wink.compareTo(max) <= 0; wink = wink.increment()) { - if (calendar.toDayAsDate(wink).getDayOfWeek() == DayOfWeek.MONDAY) { + for (Day wink = min; wink.compareTo(max) <= 0; wink = wink.increment()) { + if (wink.getDayOfWeek() == DayOfWeek.MONDAY) { drawVbar(ug, getTimeScale().getStartingPosition(wink), Y_POS_ROW16, totalHeight); } } } private void printDaysOfMonth(final UGraphic ug) { - for (Wink wink = min; wink.compareTo(max) < 0; wink = wink.increment()) { - final Day day = calendar.toDayAsDate(wink); - if (day.getDayOfWeek() == DayOfWeek.MONDAY) { - printLeft(ug.apply(UTranslate.dy(Y_POS_ROW16)), getTextBlock("" + day.getDayOfMonth(), 10, false, HColorUtils.BLACK), + for (Day wink = min; wink.compareTo(max) < 0; wink = wink.increment()) { + if (wink.getDayOfWeek() == DayOfWeek.MONDAY) { + printLeft(ug.apply(UTranslate.dy(Y_POS_ROW16)), + getTextBlock("" + wink.getDayOfMonth(), 10, false, HColorUtils.BLACK), getTimeScale().getStartingPosition(wink) + 5); } } diff --git a/src/net/sourceforge/plantuml/project/lang/SentenceHappensDate.java b/src/net/sourceforge/plantuml/project/lang/SentenceHappensDate.java index 79b7fa52a..5390f3abf 100644 --- a/src/net/sourceforge/plantuml/project/lang/SentenceHappensDate.java +++ b/src/net/sourceforge/plantuml/project/lang/SentenceHappensDate.java @@ -56,7 +56,7 @@ public class SentenceHappensDate extends SentenceSimple { if (startingDate == null) { return CommandExecutionResult.error("No starting date for the project"); } - task.setStart(start.asInstantDay(startingDate)); + task.setStart(start); task.setDiamond(true); return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/project/lang/SentencePausesDate.java b/src/net/sourceforge/plantuml/project/lang/SentencePausesDate.java index 49c5468d2..1960a01a7 100644 --- a/src/net/sourceforge/plantuml/project/lang/SentencePausesDate.java +++ b/src/net/sourceforge/plantuml/project/lang/SentencePausesDate.java @@ -37,7 +37,6 @@ package net.sourceforge.plantuml.project.lang; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.project.GanttDiagram; -import net.sourceforge.plantuml.project.Load; import net.sourceforge.plantuml.project.core.Task; import net.sourceforge.plantuml.project.time.Day; @@ -55,7 +54,7 @@ public class SentencePausesDate extends SentenceSimple { if (startingDate == null) { return CommandExecutionResult.error("No starting date for the project"); } - task.addPause(pause.asInstantDay(startingDate)); + task.addPause(pause); return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/project/timescale/UnusedTimeScaleWithoutWeekEnd.java b/src/net/sourceforge/plantuml/project/lang/SentencePausesDates.java similarity index 52% rename from src/net/sourceforge/plantuml/project/timescale/UnusedTimeScaleWithoutWeekEnd.java rename to src/net/sourceforge/plantuml/project/lang/SentencePausesDates.java index c5d53d7e9..c729c980e 100644 --- a/src/net/sourceforge/plantuml/project/timescale/UnusedTimeScaleWithoutWeekEnd.java +++ b/src/net/sourceforge/plantuml/project/lang/SentencePausesDates.java @@ -33,50 +33,32 @@ * * */ -package net.sourceforge.plantuml.project.timescale; +package net.sourceforge.plantuml.project.lang; +import net.sourceforge.plantuml.command.CommandExecutionResult; +import net.sourceforge.plantuml.project.DaysAsDates; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.core.Task; import net.sourceforge.plantuml.project.time.Day; -import net.sourceforge.plantuml.project.time.DayOfWeek; -import net.sourceforge.plantuml.project.time.GCalendar; -import net.sourceforge.plantuml.project.time.Wink; -public class UnusedTimeScaleWithoutWeekEnd implements TimeScale { +public class SentencePausesDates extends SentenceSimple { - private final double scale = 16.0; - private final GCalendar calendar; + public SentencePausesDates() { + super(new SubjectTask(), Verbs.pauses(), new ComplementDates()); + } - public UnusedTimeScaleWithoutWeekEnd(GCalendar calendar) { - if (calendar == null) { - throw new IllegalArgumentException(); + @Override + public CommandExecutionResult execute(GanttDiagram project, Object subject, Object complement) { + final Task task = (Task) subject; + final DaysAsDates pauses = (DaysAsDates) complement; + final Day startingDate = project.getStartingDate(); + if (startingDate == null) { + return CommandExecutionResult.error("No starting date for the project"); } - this.calendar = calendar; - } - - public double getStartingPosition(Wink instant) { - double result = 0; - Wink current = (Wink) instant; - while (current.getWink() > 0) { - current = current.decrement(); - result += getWidth(current); + for (Day day : pauses) { + task.addPause(day); } - return result; - } - - public double getWidth(Wink instant) { - final Day day = calendar.toDayAsDate((Wink) instant); - final DayOfWeek dayOfWeek = day.getDayOfWeek(); - if (dayOfWeek == DayOfWeek.SATURDAY || dayOfWeek == DayOfWeek.SUNDAY) { - return 1; - } - return scale; - } - - public double getEndingPosition(Wink instant) { - throw new UnsupportedOperationException(); - } - - public boolean isBreaking(Wink instant) { - throw new UnsupportedOperationException(); + return CommandExecutionResult.ok(); } } diff --git a/src/net/sourceforge/plantuml/project/lang/SentenceTaskEndsAbsolute.java b/src/net/sourceforge/plantuml/project/lang/SentenceTaskEndsAbsolute.java index a08dd404b..a38f1cc3c 100644 --- a/src/net/sourceforge/plantuml/project/lang/SentenceTaskEndsAbsolute.java +++ b/src/net/sourceforge/plantuml/project/lang/SentenceTaskEndsAbsolute.java @@ -54,7 +54,7 @@ public class SentenceTaskEndsAbsolute extends SentenceSimple { if (startingDate == null) { return CommandExecutionResult.error("No starting date for the project"); } - task.setEnd(end.asInstantDay(startingDate)); + task.setEnd(end); return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/project/lang/SentenceTaskStartsAbsolute.java b/src/net/sourceforge/plantuml/project/lang/SentenceTaskStartsAbsolute.java index 1d27dea58..b072e6120 100644 --- a/src/net/sourceforge/plantuml/project/lang/SentenceTaskStartsAbsolute.java +++ b/src/net/sourceforge/plantuml/project/lang/SentenceTaskStartsAbsolute.java @@ -54,7 +54,7 @@ public class SentenceTaskStartsAbsolute extends SentenceSimple { if (startingDate == null) { return CommandExecutionResult.error("No starting date for the project"); } - task.setStart(start.asInstantDay(startingDate)); + task.setStart(start); return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/project/lang/SubjectResource.java b/src/net/sourceforge/plantuml/project/lang/SubjectResource.java index 60ebd5246..fc47a9d7b 100644 --- a/src/net/sourceforge/plantuml/project/lang/SubjectResource.java +++ b/src/net/sourceforge/plantuml/project/lang/SubjectResource.java @@ -77,7 +77,7 @@ public class SubjectResource implements Subject { public CommandExecutionResult execute(GanttDiagram project, Object subject, Object complement) { final Resource resource = (Resource) subject; final Day when = (Day) complement; - resource.addCloseDay(project.convert(when)); + resource.addCloseDay(when); return CommandExecutionResult.ok(); } @@ -93,7 +93,7 @@ public class SubjectResource implements Subject { public CommandExecutionResult execute(GanttDiagram project, Object subject, Object complement) { final Resource resource = (Resource) subject; for (Day when : (DaysAsDates) complement) { - resource.addCloseDay(project.convert(when)); + resource.addCloseDay(when); } return CommandExecutionResult.ok(); } @@ -125,7 +125,7 @@ public class SubjectResource implements Subject { public CommandExecutionResult execute(GanttDiagram project, Object subject, Object complement) { final Resource resource = (Resource) subject; final Day when = (Day) complement; - resource.addForceOnDay(project.convert(when)); + resource.addForceOnDay(when); return CommandExecutionResult.ok(); } @@ -141,7 +141,7 @@ public class SubjectResource implements Subject { public CommandExecutionResult execute(GanttDiagram project, Object subject, Object complement) { final Resource resource = (Resource) subject; for (Day when : (DaysAsDates) complement) { - resource.addForceOnDay(project.convert(when)); + resource.addForceOnDay(when); } return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/project/lang/SubjectTask.java b/src/net/sourceforge/plantuml/project/lang/SubjectTask.java index 9883384ce..148f83b2b 100644 --- a/src/net/sourceforge/plantuml/project/lang/SubjectTask.java +++ b/src/net/sourceforge/plantuml/project/lang/SubjectTask.java @@ -76,7 +76,7 @@ public class SubjectTask implements Subject { new SentenceTaskStartsAbsolute(), new SentenceHappens(), new SentenceHappensDate(), new SentenceEnds(), new SentenceTaskEndsAbsolute(), new SentenceIsColored(), new SentenceIsDeleted(), new SentenceIsForTask(), new SentenceLinksTo(), new SentenceOccurs(), new SentenceDisplayOnSameRowAs(), - new SentencePausesDate(), new SentencePausesDayOfWeek()); + new SentencePausesDate(), new SentencePausesDates(), new SentencePausesDayOfWeek()); } public IRegex toRegex() { diff --git a/src/net/sourceforge/plantuml/project/lang/Verbs.java b/src/net/sourceforge/plantuml/project/lang/Verbs.java index b19f52cb1..089166963 100644 --- a/src/net/sourceforge/plantuml/project/lang/Verbs.java +++ b/src/net/sourceforge/plantuml/project/lang/Verbs.java @@ -68,7 +68,7 @@ public class Verbs { } public static IRegex pauses() { - return new RegexLeaf("pauses?[%s]*(at[%s]*|the[%s]*|on[%s]*)*"); + return new RegexLeaf("pauses?[%s]*(at[%s]*|the[%s]*|on[%s]*|from[%s]*)*"); } public static IRegex isDeleted() { diff --git a/src/net/sourceforge/plantuml/project/time/Day.java b/src/net/sourceforge/plantuml/project/time/Day.java index 8496e58e8..51cce4736 100644 --- a/src/net/sourceforge/plantuml/project/time/Day.java +++ b/src/net/sourceforge/plantuml/project/time/Day.java @@ -35,12 +35,19 @@ */ package net.sourceforge.plantuml.project.time; -import java.util.Date; +import java.util.Calendar; +import java.util.TimeZone; -public class Day implements Comparable { +import net.sourceforge.plantuml.project.Value; + +public class Day implements Comparable, Value { + + static final public long MILLISECONDS_PER_DAY = 1000L * 3600L * 24; + static final private Calendar gmt = Calendar.getInstance(TimeZone.getTimeZone("GMT")); private final int dayOfMonth; private final MonthYear monthYear; + private final long ms1; public static Day create(int year, String month, int dayOfMonth) { return new Day(year, Month.fromString(month), dayOfMonth); @@ -50,21 +57,56 @@ public class Day implements Comparable { return new Day(year, Month.values()[month - 1], dayOfMonth); } + public static Day create(long ms) { + return new Day(ms); + } + public static Day today() { - final Date now = new Date(); - final int year = now.getYear() + 1900; - final int month = now.getMonth() + 1; - final int dayOfMonth = now.getDate(); - return create(year, month, dayOfMonth); + return create(System.currentTimeMillis()); } private Day(int year, Month month, int dayOfMonth) { - this(MonthYear.create(year, month), dayOfMonth); + this.dayOfMonth = dayOfMonth; + this.monthYear = MonthYear.create(year, month); + synchronized (gmt) { + gmt.clear(); + gmt.set(year, month.ordinal(), dayOfMonth); + this.ms1 = gmt.getTimeInMillis(); + } } - private Day(MonthYear monthYear, int dayOfMonth) { - this.dayOfMonth = dayOfMonth; - this.monthYear = monthYear; + private Day(long ms) { + this.ms1 = ms; + synchronized (gmt) { + gmt.clear(); + gmt.setTimeInMillis(ms); + final int year = gmt.get(Calendar.YEAR); + final int month = gmt.get(Calendar.MONTH); + final int dayOfMonth = gmt.get(Calendar.DAY_OF_MONTH); + this.dayOfMonth = dayOfMonth; + this.monthYear = MonthYear.create(year, Month.values()[month]); + } + + } + + public Day increment() { + return addDays(1); + } + + public Day decrement() { + return addDays(-1); + } + + public Day addDays(int nday) { + return create(MILLISECONDS_PER_DAY * (getAbsoluteDayNum() + nday)); + } + + public final int getAbsoluteDayNum() { + return (int) (ms1 / MILLISECONDS_PER_DAY); + } + + public final long getMillis() { + return ms1; } public int year() { @@ -99,15 +141,6 @@ public class Day implements Comparable { return month().getDaysPerMonth(year()); } - public Day next() { - int newDayOfMonth = dayOfMonth + 1; - if (newDayOfMonth <= daysPerMonth()) { - return new Day(year(), month(), newDayOfMonth); - } - assert newDayOfMonth > daysPerMonth(); - return new Day(monthYear.next(), 1); - } - public Month month() { return monthYear.month(); } @@ -127,60 +160,22 @@ public class Day implements Comparable { return DayOfWeek.fromH(h); } - public static int DOW(int y_, int m_, int d_) { - final int q = d_; - final int m = 3 + (m_ - 1 + 10) % 12; - final int y = m >= 13 ? y_ - 1 : y_; - final int k = y % 100; - final int j = y / 100; - final int h = ((q + 13 * (m + 1) / 5) + k + k / 4 + j / 4 + 5 * j) % 7; - return h; - } - - public Wink asInstantDay(Day reference) { - // if (this.compareTo(reference) < 0) { - // throw new IllegalArgumentException(); - // } - int cmp = 0; - Day current = reference; - while (current.compareTo(this) < 0) { - current = current.next(); - cmp++; - } - return new Wink(cmp); - } - - // https://www.staff.science.uu.nl/~gent0113/calendar/isocalendar_text_5.htm - // https://en.wikipedia.org/wiki/ISO_week_date - // http://www.proesite.com/timex/wkcalc.htm - public int ISO_WN() { - final int y = year(); - int m = month().ordinal() + 1; - int d = dayOfMonth; - int dow = DOW(y, m, d); - int dow0101 = DOW(y, 1, 1); - - if (m == 1 && 3 < dow0101 && dow0101 < 7 - (d - 1)) { - // days before week 1 of the current year have the same week number as - // the last day of the last week of the previous year - - dow = dow0101 - 1; - dow0101 = DOW(y - 1, 1, 1); - m = 12; - d = 31; - } else if (m == 12 && 30 - (d - 1) < DOW(y + 1, 1, 1) && DOW(y + 1, 1, 1) < 4) { - // days after the last week of the current year have the same week number as - // the first day of the next year, (i.e. 1) - - return 1; - } - - return (DOW(y, 1, 1) < 4) ? 1 : 0 + 4 * (m - 1) + (2 * (m - 1) + (d - 1) + dow0101 - dow + 6) * 36 / 256; - - } - public int compareTo(Day other) { return this.internalNumber() - other.internalNumber(); } + public static Day min(Day wink1, Day wink2) { + if (wink2.internalNumber() < wink1.internalNumber()) { + return wink2; + } + return wink1; + } + + public static Day max(Day wink1, Day wink2) { + if (wink2.internalNumber() > wink1.internalNumber()) { + return wink2; + } + return wink1; + } + } diff --git a/src/net/sourceforge/plantuml/project/timescale/TimeScale.java b/src/net/sourceforge/plantuml/project/timescale/TimeScale.java index 4f519b7b8..824982664 100644 --- a/src/net/sourceforge/plantuml/project/timescale/TimeScale.java +++ b/src/net/sourceforge/plantuml/project/timescale/TimeScale.java @@ -35,16 +35,16 @@ */ package net.sourceforge.plantuml.project.timescale; -import net.sourceforge.plantuml.project.time.Wink; +import net.sourceforge.plantuml.project.time.Day; public interface TimeScale { - public double getStartingPosition(Wink instant); + public double getStartingPosition(Day instant); - public double getEndingPosition(Wink instant); + public double getEndingPosition(Day instant); - public double getWidth(Wink instant); + public double getWidth(Day instant); - public boolean isBreaking(Wink instant); + public boolean isBreaking(Day instant); } diff --git a/src/net/sourceforge/plantuml/project/timescale/TimeScaleCompressed.java b/src/net/sourceforge/plantuml/project/timescale/TimeScaleCompressed.java index 24888ee8e..f2278432c 100644 --- a/src/net/sourceforge/plantuml/project/timescale/TimeScaleCompressed.java +++ b/src/net/sourceforge/plantuml/project/timescale/TimeScaleCompressed.java @@ -37,36 +37,31 @@ package net.sourceforge.plantuml.project.timescale; import net.sourceforge.plantuml.project.time.Day; import net.sourceforge.plantuml.project.time.DayOfWeek; -import net.sourceforge.plantuml.project.time.GCalendar; -import net.sourceforge.plantuml.project.time.Wink; public class TimeScaleCompressed implements TimeScale { private final int compress; private final TimeScale daily; - private final GCalendar calendar; - public TimeScaleCompressed(GCalendar calendar, int compress) { + public TimeScaleCompressed(Day calendar, int compress) { this.daily = new TimeScaleDaily(calendar, null); this.compress = compress; - this.calendar = calendar; } - public double getStartingPosition(Wink instant) { + public double getStartingPosition(Day instant) { return daily.getStartingPosition(instant) / compress; } - public double getEndingPosition(Wink instant) { + public double getEndingPosition(Day instant) { return daily.getEndingPosition(instant) / compress; } - public double getWidth(Wink instant) { + public double getWidth(Day instant) { return daily.getWidth(instant) / compress; } - public boolean isBreaking(Wink instant) { - final Day day = calendar.toDayAsDate(instant); - return day.getDayOfWeek() == DayOfWeek.SUNDAY; + public boolean isBreaking(Day instant) { + return instant.getDayOfWeek() == DayOfWeek.SUNDAY; } } diff --git a/src/net/sourceforge/plantuml/project/timescale/TimeScaleDaily.java b/src/net/sourceforge/plantuml/project/timescale/TimeScaleDaily.java index ade9a8461..6b86aa204 100644 --- a/src/net/sourceforge/plantuml/project/timescale/TimeScaleDaily.java +++ b/src/net/sourceforge/plantuml/project/timescale/TimeScaleDaily.java @@ -36,37 +36,35 @@ package net.sourceforge.plantuml.project.timescale; import net.sourceforge.plantuml.project.time.Day; -import net.sourceforge.plantuml.project.time.GCalendar; -import net.sourceforge.plantuml.project.time.Wink; public final class TimeScaleDaily implements TimeScale { private final TimeScaleWink basic; private final double delta; - public TimeScaleDaily(GCalendar calendar, Day zeroDay) { + public TimeScaleDaily(Day calendar, Day zeroDay) { this.basic = new TimeScaleWink(); if (zeroDay == null) { - this.delta = 0; + this.delta = basic.getStartingPosition(calendar); } else { - this.delta = basic.getStartingPosition(calendar.fromDayAsDate(zeroDay)); + this.delta = basic.getStartingPosition(zeroDay); } } - public double getStartingPosition(Wink instant) { + public double getStartingPosition(Day instant) { return basic.getStartingPosition(instant) - delta; } - public double getEndingPosition(Wink instant) { + public double getEndingPosition(Day instant) { return basic.getEndingPosition(instant) - delta; } - public double getWidth(Wink instant) { + public double getWidth(Day instant) { return basic.getWidth(instant); } - public boolean isBreaking(Wink instant) { + public boolean isBreaking(Day instant) { return true; } diff --git a/src/net/sourceforge/plantuml/project/timescale/TimeScaleWink.java b/src/net/sourceforge/plantuml/project/timescale/TimeScaleWink.java index ce0af8d66..4410ea230 100644 --- a/src/net/sourceforge/plantuml/project/timescale/TimeScaleWink.java +++ b/src/net/sourceforge/plantuml/project/timescale/TimeScaleWink.java @@ -35,26 +35,26 @@ */ package net.sourceforge.plantuml.project.timescale; -import net.sourceforge.plantuml.project.time.Wink; +import net.sourceforge.plantuml.project.time.Day; public class TimeScaleWink implements TimeScale { private final double scale = 16.0; - public double getStartingPosition(Wink instant) { - final int wink = instant.getWink(); - return wink * scale; + public double getStartingPosition(Day instant) { + final long wink = instant.getMillis(); + return wink * scale / Day.MILLISECONDS_PER_DAY; } - public double getEndingPosition(Wink instant) { + public double getEndingPosition(Day instant) { return getStartingPosition(instant) + getWidth(instant); } - public double getWidth(Wink instant) { + public double getWidth(Day instant) { return scale; } - public boolean isBreaking(Wink instant) { + public boolean isBreaking(Day instant) { return true; } diff --git a/src/net/sourceforge/plantuml/salt/CommandAnything.java b/src/net/sourceforge/plantuml/salt/CommandAnything.java new file mode 100644 index 000000000..c2e3a9e28 --- /dev/null +++ b/src/net/sourceforge/plantuml/salt/CommandAnything.java @@ -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.salt; + +import net.sourceforge.plantuml.LineLocation; +import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.command.CommandExecutionResult; +import net.sourceforge.plantuml.command.SingleLineCommand2; +import net.sourceforge.plantuml.command.regex.IRegex; +import net.sourceforge.plantuml.command.regex.RegexConcat; +import net.sourceforge.plantuml.command.regex.RegexLeaf; +import net.sourceforge.plantuml.command.regex.RegexResult; + +public class CommandAnything extends SingleLineCommand2 { + + public CommandAnything() { + super(false, getRegexConcat()); + } + + static IRegex getRegexConcat() { + return RegexConcat.build(CommandAnything.class.getName(), RegexLeaf.start(), // + new RegexLeaf("ALL", "(.*)"), // + RegexLeaf.end()); + } + + @Override + protected CommandExecutionResult executeArg(PSystemSalt diagram, LineLocation location, RegexResult arg) { + final String s = arg.get("ALL", 0); + if (diagram.isIamSalt() == false) { + if (StringUtils.isEmpty(s)) { + return CommandExecutionResult.ok(); + } + return CommandExecutionResult.error("Not ready"); + } + diagram.add(s); + return CommandExecutionResult.ok(); + } + +} diff --git a/src/net/sourceforge/plantuml/salt/CommandSalt.java b/src/net/sourceforge/plantuml/salt/CommandSalt.java new file mode 100644 index 000000000..6b4c64383 --- /dev/null +++ b/src/net/sourceforge/plantuml/salt/CommandSalt.java @@ -0,0 +1,66 @@ +/* ======================================================================== + * 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.salt; + +import net.sourceforge.plantuml.LineLocation; +import net.sourceforge.plantuml.command.CommandExecutionResult; +import net.sourceforge.plantuml.command.SingleLineCommand2; +import net.sourceforge.plantuml.command.regex.IRegex; +import net.sourceforge.plantuml.command.regex.RegexConcat; +import net.sourceforge.plantuml.command.regex.RegexLeaf; +import net.sourceforge.plantuml.command.regex.RegexResult; + +public class CommandSalt extends SingleLineCommand2 { + + public CommandSalt() { + super(false, getRegexConcat()); + } + + static IRegex getRegexConcat() { + return RegexConcat.build(CommandSalt.class.getName(), RegexLeaf.start(), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("salt"), // + RegexLeaf.spaceZeroOrMore(), // + RegexLeaf.end()); + } + + @Override + protected CommandExecutionResult executeArg(PSystemSalt diagram, LineLocation location, RegexResult arg) { + diagram.setIamSalt(true); + return CommandExecutionResult.ok(); + } + +} diff --git a/src/net/sourceforge/plantuml/salt/Dictionary.java b/src/net/sourceforge/plantuml/salt/Dictionary.java index d07f47806..12174086a 100644 --- a/src/net/sourceforge/plantuml/salt/Dictionary.java +++ b/src/net/sourceforge/plantuml/salt/Dictionary.java @@ -121,4 +121,8 @@ public class Dictionary implements SpriteContainer, ISkinSimple { throw new UnsupportedOperationException(); } + public double minClassWidth() { + return 0; + } + } diff --git a/src/net/sourceforge/plantuml/salt/PSystemSalt.java b/src/net/sourceforge/plantuml/salt/PSystemSalt.java index c66107240..5fb1dacf8 100644 --- a/src/net/sourceforge/plantuml/salt/PSystemSalt.java +++ b/src/net/sourceforge/plantuml/salt/PSystemSalt.java @@ -36,6 +36,7 @@ package net.sourceforge.plantuml.salt; import java.awt.geom.Dimension2D; +import java.awt.geom.Rectangle2D; import java.io.IOException; import java.io.OutputStream; import java.util.ArrayList; @@ -43,13 +44,17 @@ import java.util.Collection; import java.util.Iterator; import java.util.List; -import net.sourceforge.plantuml.AbstractPSystem; +import net.sourceforge.plantuml.AnnotatedWorker; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FileFormatOption; +import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.Log; +import net.sourceforge.plantuml.Scale; import net.sourceforge.plantuml.ScaleSimple; import net.sourceforge.plantuml.SkinParam; +import net.sourceforge.plantuml.TitledDiagram; import net.sourceforge.plantuml.UmlDiagram; +import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.WithSprite; import net.sourceforge.plantuml.api.ImageDataSimple; import net.sourceforge.plantuml.command.BlocLines; @@ -58,7 +63,10 @@ import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandFactorySprite; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; -import net.sourceforge.plantuml.graphic.UDrawable; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; +import net.sourceforge.plantuml.graphic.InnerStrategy; +import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.salt.element.Element; import net.sourceforge.plantuml.salt.factory.AbstractElementFactoryComplex; import net.sourceforge.plantuml.salt.factory.ElementFactory; @@ -81,12 +89,14 @@ import net.sourceforge.plantuml.salt.factory.ElementFactoryTextField; import net.sourceforge.plantuml.salt.factory.ElementFactoryTree; import net.sourceforge.plantuml.sprite.Sprite; import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft; +import net.sourceforge.plantuml.svek.TextBlockBackcolored; import net.sourceforge.plantuml.ugraphic.ImageBuilder; +import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColorUtils; -public class PSystemSalt extends AbstractPSystem implements WithSprite { +public class PSystemSalt extends TitledDiagram implements WithSprite { private final List data; private final Dictionary dictionary = new Dictionary(); @@ -105,20 +115,19 @@ public class PSystemSalt extends AbstractPSystem implements WithSprite { } @Override - final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) + final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormatOption, long seed) throws IOException { try { final Element salt = createElement(manageSprite()); - final Dimension2D size = salt.getPreferredDimension(fileFormat.getDefaultStringBounder(), 0, 0); + final Dimension2D size = salt.getPreferredDimension(fileFormatOption.getDefaultStringBounder(), 0, 0); - double scale = 1; - if (getScale() != null) { - scale = getScale().getScale(size.getWidth(), size.getHeight()); - } + final Scale scale = getScale(); + final double dpiFactor = scale == null ? getScaleCoef(fileFormatOption) : scale.getScale(100, 100); + final ISkinParam skinParam = getSkinParam(); - final int margin1; - final int margin2; + final double margin1; + final double margin2; if (SkinParam.USE_STYLES()) { margin1 = SkinParam.zeroMargin(5); margin2 = SkinParam.zeroMargin(5); @@ -127,25 +136,52 @@ public class PSystemSalt extends AbstractPSystem implements WithSprite { margin2 = 5; } - final ImageBuilder builder = ImageBuilder.buildB(new ColorMapperIdentity(), false, - ClockwiseTopRightBottomLeft.margin1margin2(margin1, margin2), null, getMetadata(), null, scale, - HColorUtils.WHITE); - builder.setUDrawable(new UDrawable() { + final ImageBuilder imageBuilder = ImageBuilder.buildB(skinParam.getColorMapper(), skinParam.handwritten(), + ClockwiseTopRightBottomLeft.margin1margin2(margin1, margin2), null, + fileFormatOption.isWithMetadata() ? getMetadata() : null, "", dpiFactor, + skinParam.getBackgroundColor(false)); - public void drawU(UGraphic ug) { - ug = ug.apply(HColorUtils.BLACK); - salt.drawU(ug, 0, new Dimension2DDouble(size.getWidth(), size.getHeight())); - salt.drawU(ug, 1, new Dimension2DDouble(size.getWidth(), size.getHeight())); - } - }); - return builder.writeImageTOBEMOVED(fileFormat, seed, os); + TextBlock result = getTextBlock(salt, size); + + result = new AnnotatedWorker(this, skinParam, fileFormatOption.getDefaultStringBounder()).addAdd(result); + imageBuilder.setUDrawable(result); + + return imageBuilder.writeImageTOBEMOVED(fileFormatOption, seed(), os); } catch (Exception e) { e.printStackTrace(); - UmlDiagram.exportDiagramError(os, e, fileFormat, seed, getMetadata(), "none", new ArrayList()); + UmlDiagram.exportDiagramError(os, e, fileFormatOption, seed, getMetadata(), "none", + new ArrayList()); return ImageDataSimple.error(); } } + private TextBlockBackcolored getTextBlock(final Element salt, final Dimension2D size) { + return new TextBlockBackcolored() { + + public void drawU(UGraphic ug) { + ug = ug.apply(HColorUtils.BLACK); + salt.drawU(ug, 0, new Dimension2DDouble(size.getWidth(), size.getHeight())); + salt.drawU(ug, 1, new Dimension2DDouble(size.getWidth(), size.getHeight())); + } + + public Dimension2D calculateDimension(StringBounder stringBounder) { + return size; + } + + public MinMax getMinMax(StringBounder stringBounder) { + throw new UnsupportedOperationException(); + } + + public Rectangle2D getInnerPosition(String member, StringBounder stringBounder, InnerStrategy strategy) { + return null; + } + + public HColor getBackcolor() { + return getSkinParam().getBackgroundColor(false); + } + }; + } + public DiagramDescription getDescription() { return new DiagramDescription("(Salt)"); } @@ -233,4 +269,19 @@ public class PSystemSalt extends AbstractPSystem implements WithSprite { cpxFactory.addFactory(new ElementFactoryText(source, dictionary)); } + private boolean iamSalt; + + public void setIamSalt(boolean iamSalt) { + this.iamSalt = true; + } + + @Override + public UmlDiagramType getUmlDiagramType() { + return UmlDiagramType.SALT; + } + + public final boolean isIamSalt() { + return iamSalt; + } + } diff --git a/src/net/sourceforge/plantuml/salt/PSystemSaltFactory2.java b/src/net/sourceforge/plantuml/salt/PSystemSaltFactory2.java new file mode 100644 index 000000000..69c934179 --- /dev/null +++ b/src/net/sourceforge/plantuml/salt/PSystemSaltFactory2.java @@ -0,0 +1,74 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * PlantUML is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PlantUML distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * + * Original Author: Arnaud Roques + * + * + */ +package net.sourceforge.plantuml.salt; + +import java.util.ArrayList; +import java.util.List; + +import net.sourceforge.plantuml.command.Command; +import net.sourceforge.plantuml.command.PSystemCommandFactory; +import net.sourceforge.plantuml.core.DiagramType; + +public class PSystemSaltFactory2 extends PSystemCommandFactory { + + public PSystemSaltFactory2(DiagramType init) { + super(init); + } + + @Override + protected List createCommands() { + + final List cmds = new ArrayList(); + if (getDiagramType() == DiagramType.UML) { + cmds.add(new CommandSalt()); + } + addCommonCommands2(cmds); + addTitleCommands(cmds); + cmds.add(new CommandAnything()); + + return cmds; + } + + @Override + public PSystemSalt createEmptyDiagram() { + final PSystemSalt result = new PSystemSalt(); + if (getDiagramType() == DiagramType.SALT) { + result.setIamSalt(true); + } + return result; + } + +} diff --git a/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagramFactory.java b/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagramFactory.java index db24a20c1..e24d84f75 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagramFactory.java +++ b/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagramFactory.java @@ -40,7 +40,7 @@ import java.util.List; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.command.Command; -import net.sourceforge.plantuml.command.UmlDiagramFactory; +import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.command.note.sequence.FactorySequenceNoteAcrossCommand; import net.sourceforge.plantuml.command.note.sequence.FactorySequenceNoteCommand; import net.sourceforge.plantuml.command.note.sequence.FactorySequenceNoteOnArrowCommand; @@ -77,7 +77,7 @@ import net.sourceforge.plantuml.sequencediagram.command.CommandReferenceOverSeve import net.sourceforge.plantuml.sequencediagram.command.CommandReturn; import net.sourceforge.plantuml.sequencediagram.command.CommandUrl; -public class SequenceDiagramFactory extends UmlDiagramFactory { +public class SequenceDiagramFactory extends PSystemCommandFactory { private final ISkinSimple skinParam; diff --git a/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramFileMakerPuma2.java b/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramFileMakerPuma2.java index 9002ff842..99cae55c7 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramFileMakerPuma2.java +++ b/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramFileMakerPuma2.java @@ -51,10 +51,8 @@ import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.activitydiagram3.ftile.EntityImageLegend; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.cucadiagram.DisplayPositionned; import net.sourceforge.plantuml.cucadiagram.DisplaySection; import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; @@ -200,18 +198,17 @@ public class SequenceDiagramFileMakerPuma2 implements FileMaker { final String metadata = fileFormatOption.isWithMetadata() ? diagram.getMetadata() : null; - final int margin1; - final int margin2; + final ClockwiseTopRightBottomLeft margins; if (SkinParam.USE_STYLES()) { - margin1 = SkinParam.zeroMargin(3); - margin2 = SkinParam.zeroMargin(10); + final Style style = StyleSignature.of(SName.root, SName.sequenceDiagram, SName.document) + .getMergedStyle(diagram.getSkinParam().getCurrentStyleBuilder()); + // margins = style.getMargin(); + margins = ClockwiseTopRightBottomLeft.topRightBottomLeft(5, 5, 5, 0); } else { - margin1 = 3; - margin2 = 10; + margins = ClockwiseTopRightBottomLeft.topRightBottomLeft(5, 5, 5, 0); } - final ImageBuilder imageBuilder = ImageBuilder.buildD(diagram.getSkinParam(), - ClockwiseTopRightBottomLeft.margin1margin2(margin1, margin2), diagram.getAnimation(), metadata, null, - oneOf(scale, dpiFactor)); + final ImageBuilder imageBuilder = ImageBuilder.buildD(diagram.getSkinParam(), margins, diagram.getAnimation(), + metadata, null, oneOf(scale, dpiFactor)); imageBuilder.setUDrawable(new UDrawable() { public void drawU(UGraphic ug) { diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/SequenceDiagramFileMakerTeoz.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/SequenceDiagramFileMakerTeoz.java index ed99f118f..b1ee438fa 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/SequenceDiagramFileMakerTeoz.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/SequenceDiagramFileMakerTeoz.java @@ -151,17 +151,16 @@ public class SequenceDiagramFileMakerTeoz implements FileMaker { final double scale = 1; final String metadata = fileFormatOption.isWithMetadata() ? diagram.getMetadata() : null; - final int margin1; - final int margin2; + final ClockwiseTopRightBottomLeft margins; if (SkinParam.USE_STYLES()) { - margin1 = SkinParam.zeroMargin(3); - margin2 = SkinParam.zeroMargin(10); + final Style style = StyleSignature.of(SName.root, SName.document) + .getMergedStyle(diagram.getSkinParam().getCurrentStyleBuilder()); + margins = style.getMargin(); } else { - margin1 = 3; - margin2 = 10; + margins = ClockwiseTopRightBottomLeft.topRightBottomLeft(5, 5, 5, 5); } - final ImageBuilder imageBuilder = ImageBuilder.buildD(diagram.getSkinParam(), - ClockwiseTopRightBottomLeft.margin1margin2((double) margin1, (double) margin2), diagram.getAnimation(), + + final ImageBuilder imageBuilder = ImageBuilder.buildD(diagram.getSkinParam(), margins, diagram.getAnimation(), metadata, null, oneOf(scale, dpiFactor)); imageBuilder.setUDrawable(new Foo(index)); diff --git a/src/net/sourceforge/plantuml/skin/AbstractTextualComponent.java b/src/net/sourceforge/plantuml/skin/AbstractTextualComponent.java index d0883b5b4..b8261ad30 100644 --- a/src/net/sourceforge/plantuml/skin/AbstractTextualComponent.java +++ b/src/net/sourceforge/plantuml/skin/AbstractTextualComponent.java @@ -112,7 +112,7 @@ public abstract class AbstractTextualComponent extends AbstractComponent { textBlock = new TextBlockEmpty(); } else if (enhanced) { textBlock = new BodyEnhanced2(this.display, FontParam.NOTE, spriteContainer, horizontalAlignment, fc, - maxMessageSize); + maxMessageSize, spriteContainer.minClassWidth()); } else { textBlock = this.display.create0(fc, horizontalAlignment, spriteContainer, maxMessageSize, CreoleMode.FULL, fontForStereotype, htmlColorForStereotype); diff --git a/src/net/sourceforge/plantuml/sprite/ListSpriteDiagram.java b/src/net/sourceforge/plantuml/sprite/ListSpriteDiagram.java index 70211eb15..102baac12 100644 --- a/src/net/sourceforge/plantuml/sprite/ListSpriteDiagram.java +++ b/src/net/sourceforge/plantuml/sprite/ListSpriteDiagram.java @@ -92,8 +92,9 @@ public class ListSpriteDiagram extends UmlDiagram { margin1 = 10; margin2 = 10; } - final ImageBuilder imageBuilder = ImageBuilder.buildD(getSkinParam(), ClockwiseTopRightBottomLeft.margin1margin2((double) margin1, (double) margin2), getAnimation(), fileFormatOption.isWithMetadata() ? getMetadata() : null, - getWarningOrError(), dpiFactor); + final ImageBuilder imageBuilder = ImageBuilder.buildD(getSkinParam(), + ClockwiseTopRightBottomLeft.margin1margin2(margin1, margin2), getAnimation(), + fileFormatOption.isWithMetadata() ? getMetadata() : null, getWarningOrError(), dpiFactor); imageBuilder.setUDrawable(result); return imageBuilder.writeImageTOBEMOVED(fileFormatOption, seed(), os); diff --git a/src/net/sourceforge/plantuml/sprite/ListSpriteDiagramFactory.java b/src/net/sourceforge/plantuml/sprite/ListSpriteDiagramFactory.java index 1f58ba03b..495276358 100644 --- a/src/net/sourceforge/plantuml/sprite/ListSpriteDiagramFactory.java +++ b/src/net/sourceforge/plantuml/sprite/ListSpriteDiagramFactory.java @@ -40,9 +40,9 @@ import java.util.List; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.command.Command; -import net.sourceforge.plantuml.command.UmlDiagramFactory; +import net.sourceforge.plantuml.command.PSystemCommandFactory; -public class ListSpriteDiagramFactory extends UmlDiagramFactory { +public class ListSpriteDiagramFactory extends PSystemCommandFactory { private final ISkinSimple skinParam; diff --git a/src/net/sourceforge/plantuml/sprite/StdlibDiagram.java b/src/net/sourceforge/plantuml/sprite/StdlibDiagram.java index 9ae7cd145..dda08f3f1 100644 --- a/src/net/sourceforge/plantuml/sprite/StdlibDiagram.java +++ b/src/net/sourceforge/plantuml/sprite/StdlibDiagram.java @@ -101,8 +101,9 @@ public class StdlibDiagram extends UmlDiagram { margin1 = 10; margin2 = 10; } - final ImageBuilder imageBuilder = ImageBuilder.buildD(getSkinParam(), ClockwiseTopRightBottomLeft.margin1margin2((double) margin1, (double) margin2), getAnimation(), fileFormatOption.isWithMetadata() ? getMetadata() : null, - getWarningOrError(), dpiFactor); + final ImageBuilder imageBuilder = ImageBuilder.buildD(getSkinParam(), + ClockwiseTopRightBottomLeft.margin1margin2(margin1, margin2), getAnimation(), + fileFormatOption.isWithMetadata() ? getMetadata() : null, getWarningOrError(), dpiFactor); imageBuilder.setUDrawable(result); return imageBuilder.writeImageTOBEMOVED(fileFormatOption, seed(), os); diff --git a/src/net/sourceforge/plantuml/sprite/StdlibDiagramFactory.java b/src/net/sourceforge/plantuml/sprite/StdlibDiagramFactory.java index b2d427689..cb26b6e32 100644 --- a/src/net/sourceforge/plantuml/sprite/StdlibDiagramFactory.java +++ b/src/net/sourceforge/plantuml/sprite/StdlibDiagramFactory.java @@ -40,9 +40,9 @@ import java.util.List; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.command.Command; -import net.sourceforge.plantuml.command.UmlDiagramFactory; +import net.sourceforge.plantuml.command.PSystemCommandFactory; -public class StdlibDiagramFactory extends UmlDiagramFactory { +public class StdlibDiagramFactory extends PSystemCommandFactory { private final ISkinSimple skinParam; diff --git a/src/net/sourceforge/plantuml/statediagram/StateDiagramFactory.java b/src/net/sourceforge/plantuml/statediagram/StateDiagramFactory.java index 0f54ec44b..2a6cccb93 100644 --- a/src/net/sourceforge/plantuml/statediagram/StateDiagramFactory.java +++ b/src/net/sourceforge/plantuml/statediagram/StateDiagramFactory.java @@ -46,7 +46,7 @@ import net.sourceforge.plantuml.classdiagram.command.CommandUrl; import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.CommandFootboxIgnored; 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.CommandFactoryNoteOnEntity; import net.sourceforge.plantuml.command.note.CommandFactoryNoteOnLink; @@ -59,7 +59,7 @@ import net.sourceforge.plantuml.statediagram.command.CommandCreateState; import net.sourceforge.plantuml.statediagram.command.CommandEndState; import net.sourceforge.plantuml.statediagram.command.CommandLinkState; -public class StateDiagramFactory extends UmlDiagramFactory { +public class StateDiagramFactory extends PSystemCommandFactory { private final ISkinSimple skinParam; diff --git a/src/net/sourceforge/plantuml/style/ClockwiseTopRightBottomLeft.java b/src/net/sourceforge/plantuml/style/ClockwiseTopRightBottomLeft.java index ba02f6ac3..83bdb5a96 100644 --- a/src/net/sourceforge/plantuml/style/ClockwiseTopRightBottomLeft.java +++ b/src/net/sourceforge/plantuml/style/ClockwiseTopRightBottomLeft.java @@ -80,7 +80,11 @@ public class ClockwiseTopRightBottomLeft { } public static ClockwiseTopRightBottomLeft margin1margin2(double margin1, double margin2) { - return new ClockwiseTopRightBottomLeft(margin1, margin2, margin2, margin1); + return topRightBottomLeft(margin1, margin2, margin1, margin2); + } + + public static ClockwiseTopRightBottomLeft topRightBottomLeft(double top, double right, double bottom, double left) { + return new ClockwiseTopRightBottomLeft(top, right, bottom, left); } private ClockwiseTopRightBottomLeft(double top, double right, double bottom, double left) { diff --git a/src/net/sourceforge/plantuml/style/SName.java b/src/net/sourceforge/plantuml/style/SName.java index ba58f4afc..79fbc14d7 100644 --- a/src/net/sourceforge/plantuml/style/SName.java +++ b/src/net/sourceforge/plantuml/style/SName.java @@ -92,6 +92,7 @@ public enum SName { referenceHeader, // root, // rootNode, // + saltDiagram, // separator, // sequenceDiagram, // stack, // diff --git a/src/net/sourceforge/plantuml/svek/CircleInterface2.java b/src/net/sourceforge/plantuml/svek/CircleInterface2.java index 66906fded..c60b5ebca 100644 --- a/src/net/sourceforge/plantuml/svek/CircleInterface2.java +++ b/src/net/sourceforge/plantuml/svek/CircleInterface2.java @@ -43,7 +43,6 @@ import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.color.HColor; @@ -55,7 +54,6 @@ public class CircleInterface2 extends AbstractTextBlock implements TextBlock { private final HColor backgroundColor; private final HColor foregroundColor; - private final float thickness = 2; private final double deltaShadow; @@ -70,8 +68,7 @@ public class CircleInterface2 extends AbstractTextBlock implements TextBlock { double y = 0; x += margin; y += margin; - ug = ug.apply(new UStroke(thickness)).apply(backgroundColor.bg()) - .apply(foregroundColor); + ug = ug.apply(backgroundColor.bg()).apply(foregroundColor); final UEllipse circle = new UEllipse(radius * 2, radius * 2); circle.setDeltaShadow(deltaShadow); ug.apply(new UTranslate(x, y)).draw(circle); diff --git a/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek.java b/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek.java index 953cac707..89218a566 100644 --- a/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek.java +++ b/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek.java @@ -134,7 +134,7 @@ public final class CucaDiagramFileMakerSvek implements CucaDiagramFileMaker { .getMergedStyle(diagram.getSkinParam().getCurrentStyleBuilder()); margins = style.getMargin(); } else { - margins = ClockwiseTopRightBottomLeft.margin1margin2(0, 10); + margins = ClockwiseTopRightBottomLeft.topRightBottomLeft(0, 5, 5, 0); } final ImageBuilder imageBuilder = ImageBuilder.buildC(diagram.getSkinParam(), margins, diagram.getAnimation(), fileFormatOption.isWithMetadata() ? diagram.getMetadata() : null, warningOrError, scale, backcolor); diff --git a/src/net/sourceforge/plantuml/svek/GuideLine.java b/src/net/sourceforge/plantuml/svek/GuideLine.java index b021f9c4e..18ef94b9b 100644 --- a/src/net/sourceforge/plantuml/svek/GuideLine.java +++ b/src/net/sourceforge/plantuml/svek/GuideLine.java @@ -41,4 +41,6 @@ public interface GuideLine { public Direction getArrowDirection(); + public double getArrowDirection2(); + } diff --git a/src/net/sourceforge/plantuml/svek/Line.java b/src/net/sourceforge/plantuml/svek/Line.java index 5cbd155bf..fa8f709eb 100644 --- a/src/net/sourceforge/plantuml/svek/Line.java +++ b/src/net/sourceforge/plantuml/svek/Line.java @@ -175,6 +175,24 @@ public class Line implements Moveable, Hideable, GuideLine { return end.getX() > start.getX() ? Direction.RIGHT : Direction.LEFT; } + public double getArrowDirection2() { + if (getLinkArrow() == LinkArrow.BACKWARD) { + return Math.PI + getArrowDirectionInternal2(); + } + return getArrowDirectionInternal2(); + } + + private double getArrowDirectionInternal2() { + if (isAutolink()) { + final double startAngle = dotPath.getStartAngle(); + return startAngle; + } + final Point2D start = dotPath.getStartPoint(); + final Point2D end = dotPath.getEndPoint(); + final double ang = Math.atan2(end.getX() - start.getX(), end.getY() - start.getY()); + return ang; + } + private Cluster getCluster2(Bibliotekon bibliotekon, IEntity entityMutable) { for (Cluster cl : bibliotekon.allCluster()) { if (cl.getGroups().contains(entityMutable)) { diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java b/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java index 113fde69b..37dd130e7 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java @@ -48,6 +48,7 @@ import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.cucadiagram.BodyEnhanced; +import net.sourceforge.plantuml.cucadiagram.BodyEnhanced2; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.EntityPortion; import net.sourceforge.plantuml.cucadiagram.IEntity; @@ -100,8 +101,8 @@ public class EntityImageDescription extends AbstractEntityImage { public EntityImageDescription(ILeaf entity, ISkinParam skinParam, PortionShower portionShower, Collection links, SName styleName, UStroke forceStroke) { super(entity, entity.getColors(skinParam).mute(skinParam)); - this.useRankSame = skinParam.useRankSame(); - this.fixCircleLabelOverlapping = skinParam.fixCircleLabelOverlapping(); + this.useRankSame = getSkinParam().useRankSame(); + this.fixCircleLabelOverlapping = getSkinParam().fixCircleLabelOverlapping(); this.links = links; final Stereotype stereotype = entity.getStereotype(); @@ -109,23 +110,13 @@ public class EntityImageDescription extends AbstractEntityImage { if (symbol == USymbol.FOLDER) { this.shapeType = ShapeType.FOLDER; } else if (symbol == USymbol.INTERFACE) { - this.shapeType = skinParam.fixCircleLabelOverlapping() ? ShapeType.RECTANGLE_WITH_CIRCLE_INSIDE + this.shapeType = getSkinParam().fixCircleLabelOverlapping() ? ShapeType.RECTANGLE_WITH_CIRCLE_INSIDE : ShapeType.RECTANGLE; } else { this.shapeType = ShapeType.RECTANGLE; } this.hideText = symbol == USymbol.INTERFACE; - final Display codeDisplay = Display.getWithNewlines(entity.getCodeGetName()); - if ((entity.getDisplay().equals(codeDisplay) && symbol.getSkinParameter() == SkinParameter.PACKAGE) - || entity.getDisplay().isWhite()) { - desc = TextBlockUtils.empty(skinParam.minClassWidth(), 0); - } else { - desc = new BodyEnhanced(entity.getDisplay(), symbol.getFontParam(), getSkinParam(), - HorizontalAlignment.LEFT, stereotype, symbol.manageHorizontalLine(), false, entity, - skinParam.minClassWidth(), SName.componentDiagram); - } - this.url = entity.getUrl99(); final Colors colors = entity.getColors(skinParam); @@ -163,10 +154,26 @@ public class EntityImageDescription extends AbstractEntityImage { } assert getStereo() == stereotype; - + final SymbolContext ctx = new SymbolContext(backcolor, forecolor).withStroke(stroke).withShadow(deltaShadow) .withCorner(roundCorner, diagonalCorner); + final Display codeDisplay = Display.getWithNewlines(entity.getCodeGetName()); + if ((entity.getDisplay().equals(codeDisplay) && symbol.getSkinParameter() == SkinParameter.PACKAGE) + || entity.getDisplay().isWhite()) { + desc = TextBlockUtils.empty(getSkinParam().minClassWidth(), 0); + } else { + final FontConfiguration titleConfig = new FontConfiguration(getSkinParam(), symbol.getFontParam(), + stereotype); + + desc = new BodyEnhanced2(entity.getDisplay(), symbol.getFontParam(), getSkinParam(), + getSkinParam().getDefaultTextAlignment(HorizontalAlignment.LEFT), titleConfig, + getSkinParam().wrapWidth(), getSkinParam().minClassWidth()); +// desc = new BodyEnhanced(entity.getDisplay(), symbol.getFontParam(), getSkinParam(), +// HorizontalAlignment.LEFT, stereotype, symbol.manageHorizontalLine(), false, entity, +// skinParam.minClassWidth(), SName.componentDiagram); + } + stereo = TextBlockUtils.empty(0, 0); if (stereotype != null && stereotype.getSprite(getSkinParam()) != null) { diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageNote.java b/src/net/sourceforge/plantuml/svek/image/EntityImageNote.java index d8397af91..ac77b3728 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageNote.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageNote.java @@ -126,7 +126,8 @@ public class EntityImageNote extends AbstractEntityImage implements Stencil { textBlock = new TextBlockEmpty(); } else { textBlock = new BodyEnhanced2(strings, FontParam.NOTE, getSkinParam(), HorizontalAlignment.LEFT, - new FontConfiguration(getSkinParam(), FontParam.NOTE, null), getSkinParam().wrapWidth()); + new FontConfiguration(getSkinParam(), FontParam.NOTE, null), getSkinParam().wrapWidth(), + getSkinParam().minClassWidth()); } } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageTips.java b/src/net/sourceforge/plantuml/svek/image/EntityImageTips.java index 79a8efa79..98ebf1c79 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageTips.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageTips.java @@ -162,8 +162,9 @@ public class EntityImageTips extends AbstractEntityImage { // final HtmlColor fontColor = rose.getFontColor(skinParam, FontParam.NOTE); // final UFont fontNote = skinParam.getFont(FontParam.NOTE, null, false); final TextBlock textBlock = new BodyEnhanced2(display, FontParam.NOTE, skinParam, HorizontalAlignment.LEFT, - new FontConfiguration(skinParam, FontParam.NOTE, null), LineBreakStrategy.NONE); - final double shadowing = skinParam.shadowing(getEntity().getStereotype())?4:0; + new FontConfiguration(skinParam, FontParam.NOTE, null), LineBreakStrategy.NONE, + skinParam.minClassWidth()); + final double shadowing = skinParam.shadowing(getEntity().getStereotype()) ? 4 : 0; final Opale opale = new Opale(shadowing, borderColor, noteBackgroundColor, textBlock, true); return opale; } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageUseCase.java b/src/net/sourceforge/plantuml/svek/image/EntityImageUseCase.java index 4e8c40b47..9e9e19b2f 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageUseCase.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageUseCase.java @@ -42,6 +42,7 @@ import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.Guillemet; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.LineParam; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.creole.Stencil; @@ -58,7 +59,10 @@ import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.ugraphic.AbstractUGraphicHorizontalLine; @@ -102,6 +106,10 @@ public class EntityImageUseCase extends AbstractEntityImage { } private UStroke getStroke() { + if (SkinParam.USE_STYLES()) { + final Style style = getDefaultStyleDefinition().getMergedStyle(getSkinParam().getCurrentStyleBuilder()); + return style.getStroke(); + } UStroke stroke = getSkinParam().getThickness(LineParam.usecaseBorder, getStereo()); if (stroke == null) { @@ -126,15 +134,9 @@ public class EntityImageUseCase extends AbstractEntityImage { } ug = ug.apply(getStroke()); - HColor linecolor = getEntity().getColors(getSkinParam()).getColor(ColorType.LINE); - if (linecolor == null) { - linecolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.usecaseBorder); - } + final HColor linecolor = getLineColor(); ug = ug.apply(linecolor); - HColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); - if (backcolor == null) { - backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.usecaseBackground); - } + final HColor backcolor = getBackColor(); ug = ug.apply(backcolor.bg()); final UGraphic ug2 = new MyUGraphicEllipse(ug, 0, 0, ellipse.getUEllipse()); @@ -145,6 +147,36 @@ public class EntityImageUseCase extends AbstractEntityImage { } } + private HColor getBackColor() { + HColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); + if (backcolor == null) { + if (SkinParam.USE_STYLES()) { + final Style style = getDefaultStyleDefinition().getMergedStyle(getSkinParam().getCurrentStyleBuilder()); + backcolor = style.value(PName.BackGroundColor).asColor(getSkinParam().getIHtmlColorSet()); + } else { + backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.usecaseBackground); + } + } + return backcolor; + } + + private StyleSignature getDefaultStyleDefinition() { + return StyleSignature.of(SName.root, SName.element, SName.componentDiagram, SName.usecase); + } + + private HColor getLineColor() { + HColor linecolor = getEntity().getColors(getSkinParam()).getColor(ColorType.LINE); + if (linecolor == null) { + if (SkinParam.USE_STYLES()) { + final Style style = getDefaultStyleDefinition().getMergedStyle(getSkinParam().getCurrentStyleBuilder()); + linecolor = style.value(PName.LineColor).asColor(getSkinParam().getIHtmlColorSet()); + } else { + linecolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.usecaseBorder); + } + } + return linecolor; + } + public ShapeType getShapeType() { return ShapeType.OVAL; } diff --git a/src/net/sourceforge/plantuml/svek/image/Footprint.java b/src/net/sourceforge/plantuml/svek/image/Footprint.java index 2935fae3b..7031efd61 100644 --- a/src/net/sourceforge/plantuml/svek/image/Footprint.java +++ b/src/net/sourceforge/plantuml/svek/image/Footprint.java @@ -44,6 +44,7 @@ import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.ugraphic.UBackground; import net.sourceforge.plantuml.ugraphic.UChange; +import net.sourceforge.plantuml.ugraphic.UEmpty; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphicNo; import net.sourceforge.plantuml.ugraphic.UHorizontalLine; @@ -125,6 +126,8 @@ public class Footprint { drawPath(x, y, (UPath) shape); } else if (shape instanceof URectangle) { drawRectangle(x, y, (URectangle) shape); + } else if (shape instanceof UEmpty) { + drawEmpty(x, y, (UEmpty) shape); } else { throw new UnsupportedOperationException(shape.getClass().toString()); } @@ -165,6 +168,11 @@ public class Footprint { addPoint(x + rect.getWidth(), y + rect.getHeight()); } + private void drawEmpty(double x, double y, UEmpty rect) { + addPoint(x, y); + addPoint(x + rect.getWidth(), y + rect.getHeight()); + } + public void flushUg() { } diff --git a/src/net/sourceforge/plantuml/syntax/LanguageDescriptor.java b/src/net/sourceforge/plantuml/syntax/LanguageDescriptor.java index 1b973ca8e..723fb3b64 100644 --- a/src/net/sourceforge/plantuml/syntax/LanguageDescriptor.java +++ b/src/net/sourceforge/plantuml/syntax/LanguageDescriptor.java @@ -161,7 +161,18 @@ public class LanguageDescriptor { keyword.add("stereotype"); keyword.add("split"); keyword.add("style"); - keyword.add("sprite"); + keyword.add("sprite"); + keyword.add("circle"); + keyword.add("empty"); + keyword.add("members"); + keyword.add("description"); + keyword.add("true"); + keyword.add("false"); + keyword.add("normal"); + keyword.add("italic"); + keyword.add("bold"); + keyword.add("plain"); + preproc.add("!exit"); preproc.add("!include"); diff --git a/src/net/sourceforge/plantuml/timingdiagram/TimingDiagram.java b/src/net/sourceforge/plantuml/timingdiagram/TimingDiagram.java index a357f3d49..c40b149de 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/TimingDiagram.java +++ b/src/net/sourceforge/plantuml/timingdiagram/TimingDiagram.java @@ -111,8 +111,9 @@ public class TimingDiagram extends UmlDiagram implements Clocks { margin1 = 10; margin2 = 10; } - final ImageBuilder imageBuilder = ImageBuilder.buildD(getSkinParam(), ClockwiseTopRightBottomLeft.margin1margin2((double) margin1, (double) margin2), getAnimation(), fileFormatOption.isWithMetadata() ? getMetadata() : null, - getWarningOrError(), dpiFactor); + final ImageBuilder imageBuilder = ImageBuilder.buildD(getSkinParam(), + ClockwiseTopRightBottomLeft.margin1margin2(margin1, margin2), getAnimation(), + fileFormatOption.isWithMetadata() ? getMetadata() : null, getWarningOrError(), dpiFactor); TextBlock result = getTextBlock(); final ISkinParam skinParam = getSkinParam(); diff --git a/src/net/sourceforge/plantuml/timingdiagram/TimingDiagramFactory.java b/src/net/sourceforge/plantuml/timingdiagram/TimingDiagramFactory.java index d86ee96b7..76df98d01 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/TimingDiagramFactory.java +++ b/src/net/sourceforge/plantuml/timingdiagram/TimingDiagramFactory.java @@ -40,7 +40,7 @@ import java.util.List; import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.CommandFootboxIgnored; -import net.sourceforge.plantuml.command.UmlDiagramFactory; +import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.timingdiagram.command.CommandAnalog; import net.sourceforge.plantuml.timingdiagram.command.CommandAtPlayer; import net.sourceforge.plantuml.timingdiagram.command.CommandAtTime; @@ -62,7 +62,7 @@ import net.sourceforge.plantuml.timingdiagram.command.CommandScalePixel; import net.sourceforge.plantuml.timingdiagram.command.CommandTicks; import net.sourceforge.plantuml.timingdiagram.command.CommandTimeMessage; -public class TimingDiagramFactory extends UmlDiagramFactory { +public class TimingDiagramFactory extends PSystemCommandFactory { @Override public TimingDiagram createEmptyDiagram() { diff --git a/src/net/sourceforge/plantuml/timingdiagram/command/CommandConstraint.java b/src/net/sourceforge/plantuml/timingdiagram/command/CommandConstraint.java index 2362f8b2d..264aba858 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/command/CommandConstraint.java +++ b/src/net/sourceforge/plantuml/timingdiagram/command/CommandConstraint.java @@ -84,6 +84,9 @@ public class CommandConstraint extends SingleLineCommand2 { } } else { player1 = diagram.getPlayer(part1); + if (player1 == null) { + return CommandExecutionResult.error("No such participant " + part1); + } } final TimeTick tick1 = TimeTickBuilder.parseTimeTick("TIME1", arg, diagram); diagram.updateNow(tick1); diff --git a/src/net/sourceforge/plantuml/ugraphic/ImageBuilder.java b/src/net/sourceforge/plantuml/ugraphic/ImageBuilder.java index 8a5f06105..3463aea4f 100644 --- a/src/net/sourceforge/plantuml/ugraphic/ImageBuilder.java +++ b/src/net/sourceforge/plantuml/ugraphic/ImageBuilder.java @@ -215,36 +215,7 @@ public class ImageBuilder { return writeImageInternal(fileFormatOption, seed, os, animation); } - private static Semaphore SEMAPHORE_SMALL; - private static Semaphore SEMAPHORE_BIG; - private static int MAX_PRICE = 0; - public static void setMaxPixel(int max) { - MAX_PRICE = max / 2; - SEMAPHORE_SMALL = new Semaphore(MAX_PRICE, true); - SEMAPHORE_BIG = new Semaphore(MAX_PRICE, true); - } - - private int getPrice(FileFormatOption fileFormatOption, Dimension2D dim) { - // if (fileFormatOption.getFileFormat() != FileFormat.PNG) { - // return 0; - // } - if (MAX_PRICE == 0) { - return 0; - } - final int price = Math.min(MAX_PRICE, - ((int) (dim.getHeight() * dpiFactor)) * ((int) (dim.getWidth() * dpiFactor))); - return price; - } - - private Semaphore getSemaphore(int price) { - if (price == 0) { - return null; - } - if (price == MAX_PRICE) { - return SEMAPHORE_BIG; - } - return SEMAPHORE_SMALL; } private ImageData writeImageInternal(FileFormatOption fileFormatOption, long seed, OutputStream os, @@ -260,57 +231,32 @@ public class ImageBuilder { dy = -minmax.getMinY(); } - final int price = getPrice(fileFormatOption, dim); - final Semaphore semaphore = getSemaphore(price); - if (semaphore != null) { - try { - semaphore.acquire(price); - } catch (InterruptedException e) { - e.printStackTrace(); - throw new IOException(e); + final UGraphic2 ug = createUGraphic(fileFormatOption, seed, dim, animationArg, dx, dy); + UGraphic ug2 = ug; + if (borderStroke != null) { + final HColor color = borderColor == null ? HColorUtils.BLACK : borderColor; + final URectangle shape = new URectangle(dim.getWidth() - borderStroke.getThickness(), + dim.getHeight() - borderStroke.getThickness()).rounded(borderCorner); + ug2.apply(color).apply(borderStroke).draw(shape); + } + if (randomPixel) { + drawRandomPoint(ug2); + } + ug2 = ug2.apply(new UTranslate(left, top)); + final UGraphic ugDecored = handwritten(ug2); + udrawable.drawU(ugDecored); + ugDecored.flushUg(); + ug.writeImageTOBEMOVED(os, metadata, 96); + os.flush(); + + if (ug instanceof UGraphicG2d) { + final Set urls = ((UGraphicG2d) ug).getAllUrlsEncountered(); + if (urls.size() > 0) { + final CMapData cmap = CMapData.cmapString(urls, dpiFactor); + return new ImageDataComplex(dim, cmap, warningOrError); } } - try { - final UGraphic2 ug = createUGraphic(fileFormatOption, seed, dim, animationArg, dx, dy); - UGraphic ug2 = ug; -// if (externalMargin1 > 0) { -// ug2 = ug2.apply(new UTranslate(externalMargin1, externalMargin1)); -// } - if (borderStroke != null) { - final HColor color = borderColor == null ? HColorUtils.BLACK : borderColor; -// final URectangle shape = new URectangle(dim.getWidth() - externalMargin() - borderStroke.getThickness(), -// dim.getHeight() - externalMargin() - borderStroke.getThickness()).rounded(borderCorner); - final URectangle shape = new URectangle(dim.getWidth() - borderStroke.getThickness(), - dim.getHeight() - borderStroke.getThickness()).rounded(borderCorner); - ug2.apply(color).apply(borderStroke).draw(shape); - } - if (randomPixel) { - drawRandomPoint(ug2); - } -// if (externalMargin1 > 0) { -// ug2 = ug2.apply(new UTranslate(externalMargin2, externalMargin2)); -// } - ug2 = ug2.apply(new UTranslate(left, top)); - final UGraphic ugDecored = handwritten(ug2); - udrawable.drawU(ugDecored); - ugDecored.flushUg(); - ug.writeImageTOBEMOVED(os, metadata, 96); - os.flush(); - - if (ug instanceof UGraphicG2d) { - final Set urls = ((UGraphicG2d) ug).getAllUrlsEncountered(); - if (urls.size() > 0) { - final CMapData cmap = CMapData.cmapString(urls, dpiFactor); - return new ImageDataComplex(dim, cmap, warningOrError); - } - } - return new ImageDataSimple(dim); - } finally { - if (semaphore != null) { - semaphore.release(price); - } - } - + return new ImageDataSimple(dim); } private void drawRandomPoint(UGraphic ug2) { @@ -324,10 +270,6 @@ public class ImageBuilder { } -// private double externalMargin() { -// return 2 * (externalMargin1 + externalMargin2); -// } - public Dimension2D getFinalDimension(StringBounder stringBounder) { final Dimension2D dim; @@ -335,8 +277,6 @@ public class ImageBuilder { udrawable.drawU(limitFinder); dim = new Dimension2DDouble(limitFinder.getMaxX(), limitFinder.getMaxY()); -// return new Dimension2DDouble(dim.getWidth() + 1 + margin1 + margin2 + externalMargin(), -// dim.getHeight() + 1 + margin1 + margin2 + externalMargin()); return new Dimension2DDouble(dim.getWidth() + 1 + left + right, dim.getHeight() + 1 + top + bottom); } @@ -467,8 +407,8 @@ public class ImageBuilder { preserveAspectRatio); } else { final String tmp = colorMapper.toSvg(backColor); - ug = new UGraphicSvg(svgDimensionStyle, dim, colorMapper, tmp, false, scale, - svgLinkTarget, hover, seed, preserveAspectRatio); + ug = new UGraphicSvg(svgDimensionStyle, dim, colorMapper, tmp, false, scale, svgLinkTarget, hover, seed, + preserveAspectRatio); } return ug; @@ -483,17 +423,10 @@ public class ImageBuilder { backColor = null; } - /* - * if (rotation) { builder = new EmptyImageBuilder((int) (dim.getHeight() * - * dpiFactor), (int) (dim.getWidth() * dpiFactor), backColor); graphics2D = - * builder.getGraphics2D(); graphics2D.rotate(-Math.PI / 2); - * graphics2D.translate(-builder.getBufferedImage().getHeight(), 0); } else { - */ final EmptyImageBuilder builder = new EmptyImageBuilder(watermark, (int) (dim.getWidth() * dpiFactor), (int) (dim.getHeight() * dpiFactor), backColor); final Graphics2D graphics2D = builder.getGraphics2D(); - // } final UGraphicG2d ug = new UGraphicG2d(colorMapper, graphics2D, dpiFactor, affineTransforms == null ? null : affineTransforms.getFirst(), dx, dy); ug.setBufferedImage(builder.getBufferedImage()); diff --git a/src/net/sourceforge/plantuml/ugraphic/UEmpty.java b/src/net/sourceforge/plantuml/ugraphic/UEmpty.java index bcfb10177..4eb90f444 100644 --- a/src/net/sourceforge/plantuml/ugraphic/UEmpty.java +++ b/src/net/sourceforge/plantuml/ugraphic/UEmpty.java @@ -34,6 +34,8 @@ */ package net.sourceforge.plantuml.ugraphic; +import java.awt.geom.Dimension2D; + public class UEmpty implements UShape { private final double width; @@ -47,6 +49,10 @@ public class UEmpty implements UShape { this.height = height; } + public UEmpty(Dimension2D dim) { + this(dim.getWidth(), dim.getHeight()); + } + public double getWidth() { return width; } diff --git a/src/net/sourceforge/plantuml/version/Version.java b/src/net/sourceforge/plantuml/version/Version.java index 58871d92b..622feefd2 100644 --- a/src/net/sourceforge/plantuml/version/Version.java +++ b/src/net/sourceforge/plantuml/version/Version.java @@ -44,7 +44,7 @@ public class Version { private static final int MAJOR_SEPARATOR = 1000000; public static int version() { - return 1202017; + return 1202018; } public static int versionPatched() { @@ -93,7 +93,7 @@ public class Version { } public static long compileTime() { - return 1600518611890L; + return 1601494844773L; } public static String compileTimeString() { diff --git a/src/net/sourceforge/plantuml/wbs/WBSDiagram.java b/src/net/sourceforge/plantuml/wbs/WBSDiagram.java index 0c0ab76df..c68e060ab 100644 --- a/src/net/sourceforge/plantuml/wbs/WBSDiagram.java +++ b/src/net/sourceforge/plantuml/wbs/WBSDiagram.java @@ -84,8 +84,8 @@ public class WBSDiagram extends UmlDiagram { final double dpiFactor = scale == null ? getScaleCoef(fileFormatOption) : scale.getScale(100, 100); final ISkinParam skinParam = getSkinParam(); - final int margin1; - final int margin2; + final double margin1; + final double margin2; if (SkinParam.USE_STYLES()) { margin1 = SkinParam.zeroMargin(10); margin2 = SkinParam.zeroMargin(10); @@ -93,8 +93,10 @@ public class WBSDiagram extends UmlDiagram { margin1 = 10; margin2 = 10; } - final ImageBuilder imageBuilder = ImageBuilder.buildB(skinParam.getColorMapper(), skinParam.handwritten(), ClockwiseTopRightBottomLeft.margin1margin2((double) margin1, (double) margin2), - null, fileFormatOption.isWithMetadata() ? getMetadata() : null, "", dpiFactor, skinParam.getBackgroundColor(false)); + final ImageBuilder imageBuilder = ImageBuilder.buildB(skinParam.getColorMapper(), skinParam.handwritten(), + ClockwiseTopRightBottomLeft.margin1margin2(margin1, margin2), null, + fileFormatOption.isWithMetadata() ? getMetadata() : null, "", dpiFactor, + skinParam.getBackgroundColor(false)); TextBlock result = getTextBlock(); result = new AnnotatedWorker(this, skinParam, fileFormatOption.getDefaultStringBounder()).addAdd(result); diff --git a/src/net/sourceforge/plantuml/wbs/WBSDiagramFactory.java b/src/net/sourceforge/plantuml/wbs/WBSDiagramFactory.java index 9ad83b855..c898d3545 100644 --- a/src/net/sourceforge/plantuml/wbs/WBSDiagramFactory.java +++ b/src/net/sourceforge/plantuml/wbs/WBSDiagramFactory.java @@ -39,10 +39,10 @@ import java.util.ArrayList; import java.util.List; import net.sourceforge.plantuml.command.Command; -import net.sourceforge.plantuml.command.UmlDiagramFactory; +import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.core.DiagramType; -public class WBSDiagramFactory extends UmlDiagramFactory { +public class WBSDiagramFactory extends PSystemCommandFactory { public WBSDiagramFactory() { super(DiagramType.WBS); diff --git a/src/net/sourceforge/plantuml/wire/WireDiagram.java b/src/net/sourceforge/plantuml/wire/WireDiagram.java index d41399c19..a47dbc9bb 100644 --- a/src/net/sourceforge/plantuml/wire/WireDiagram.java +++ b/src/net/sourceforge/plantuml/wire/WireDiagram.java @@ -83,7 +83,7 @@ public class WireDiagram extends UmlDiagram { final double dpiFactor = scale == null ? getScaleCoef(fileFormatOption) : scale.getScale(100, 100); final ISkinParam skinParam = getSkinParam(); - + final int margin1; final int margin2; if (SkinParam.USE_STYLES()) { @@ -93,8 +93,10 @@ public class WireDiagram extends UmlDiagram { margin1 = 10; margin2 = 10; } - final ImageBuilder imageBuilder = ImageBuilder.buildB(skinParam.getColorMapper(), skinParam.handwritten(), ClockwiseTopRightBottomLeft.margin1margin2((double) margin1, (double) margin2), - null, fileFormatOption.isWithMetadata() ? getMetadata() : null, "", dpiFactor, skinParam.getBackgroundColor(false)); + final ImageBuilder imageBuilder = ImageBuilder.buildB(skinParam.getColorMapper(), skinParam.handwritten(), + ClockwiseTopRightBottomLeft.margin1margin2(margin1, margin2), null, + fileFormatOption.isWithMetadata() ? getMetadata() : null, "", dpiFactor, + skinParam.getBackgroundColor(false)); TextBlock result = getTextBlock(); result = new AnnotatedWorker(this, skinParam, fileFormatOption.getDefaultStringBounder()).addAdd(result); diff --git a/src/net/sourceforge/plantuml/wire/WireDiagramFactory.java b/src/net/sourceforge/plantuml/wire/WireDiagramFactory.java index e15d2b5c4..954050c69 100644 --- a/src/net/sourceforge/plantuml/wire/WireDiagramFactory.java +++ b/src/net/sourceforge/plantuml/wire/WireDiagramFactory.java @@ -39,10 +39,10 @@ import java.util.ArrayList; import java.util.List; import net.sourceforge.plantuml.command.Command; -import net.sourceforge.plantuml.command.UmlDiagramFactory; +import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.core.DiagramType; -public class WireDiagramFactory extends UmlDiagramFactory { +public class WireDiagramFactory extends PSystemCommandFactory { public WireDiagramFactory() { super(DiagramType.WIRE);