From 543e0271f4fe6e4c27d9d163f5c5d9e1a59c8472 Mon Sep 17 00:00:00 2001 From: Arnaud Roques Date: Thu, 25 Nov 2010 22:12:39 +0100 Subject: [PATCH] Version 5658 --- .../plantuml/EmptyImageBuilder.java | 3 +- .../plantuml/classdiagram/ClassDiagram.java | 5 +- .../classdiagram/ClassDiagramFactory.java | 12 +- .../command/CommandAddMethod.java | 4 +- .../command/CommandCreateEntityClass2.java | 120 ++++++++++ .../CommandCreateEntityClassMultilines2.java | 115 ++++++++++ .../classdiagram/command/CommandHideShow.java | 2 +- .../command/CommandLinkClass2.java | 10 +- .../command/CommandMultilinesClassNote.java | 4 +- .../command/CommandStereotype.java | 4 +- .../classdiagram/command/CommandUrl.java | 2 +- .../plantuml/command/CommandMultilines2.java | 111 +++++++++ .../plantuml/command/CommandNoteEntity.java | 4 +- .../plantuml/cucadiagram/CucaDiagram.java | 6 +- .../plantuml/cucadiagram/Entity.java | 6 +- .../plantuml/cucadiagram/Link.java | 34 ++- .../plantuml/cucadiagram/Member.java | 12 +- .../cucadiagram/dot/CucaDiagramFileMaker.java | 12 +- .../dot/CucaDiagramFileMakerBeta.java | 16 +- .../cucadiagram/dot/CucaDiagramTxtMaker.java | 4 +- .../plantuml/cucadiagram/dot/DotMaker.java | 19 +- .../plantuml/cucadiagram/dot/PlayField.java | 163 +++++++------- .../cucadiagram/dot/ProcessRunner.java | 5 +- .../plantuml/graph/EntityImageClass.java | 2 +- .../plantuml/graph/MethodsOrFieldsArea.java | 9 +- .../plantuml/graph/MethodsOrFieldsArea2.java | 157 +++++++++++++ .../plantuml/graphic/CircledCharacter.java | 17 +- .../plantuml/posimo/AbstractEntityImage2.java | 57 ++--- .../plantuml/posimo/BezierUtils.java | 10 +- .../sourceforge/plantuml/posimo/Block.java | 7 +- .../sourceforge/plantuml/posimo/Cluster.java | 19 +- .../sourceforge/plantuml/posimo/DotPath.java | 121 ++++++++-- .../plantuml/posimo/DotxMaker.java | 26 ++- .../plantuml/posimo/EntityImageBlock.java | 57 +++-- .../plantuml/posimo/EntityImageClass2.java | 149 ++++++++---- .../plantuml/posimo/EntityImageNote2.java | 84 +++++++ .../sourceforge/plantuml/posimo/Frame.java | 32 ++- .../plantuml/posimo/GraphvizSolverB.java | 17 +- .../plantuml/posimo/LineRectIntersection.java | 81 +++++++ .../posimo/LineSegmentIntersection.java | 79 +++++++ .../plantuml/posimo/MargedBlock.java | 8 +- .../sourceforge/plantuml/posimo/MinMax.java | 65 ++++++ src/net/sourceforge/plantuml/posimo/Path.java | 3 + .../plantuml/posimo/PathDrawerInterface.java | 213 ++++++++---------- .../plantuml/posimo/PositionableUtils.java | 4 + .../sourceforge/plantuml/posimo/Racorder.java | 42 ++++ .../plantuml/posimo/RacorderAbstract.java | 56 +++++ .../posimo/RacorderFollowTangeante.java | 71 ++++++ .../posimo/RacorderFollowTangeanteOld.java | 56 +++++ .../plantuml/posimo/RacorderInToCenter.java | 55 +++++ .../plantuml/posimo/RacorderOrthogonal.java | 81 +++++++ .../plantuml/posimo/TwoLinesIntersection.java | 71 ++++++ .../sequencediagram/graphic/LifeLine.java | 11 +- .../graphic/LivingParticipantBox.java | 4 +- .../plantuml/skin/VisibilityModifier.java | 38 +++- .../ugraphic/AbstractPlacementStrategy.java | 109 +++++++++ .../plantuml/ugraphic/PlacementStrategy.java | 47 ++++ .../ugraphic/PlacementStrategyVisibility.java | 70 ++++++ .../ugraphic/PlacementStrategyX1X2.java | 65 ++++++ .../ugraphic/PlacementStrategyX1Y2Y3.java | 84 +++++++ .../ugraphic/PlacementStrategyY1Y2.java | 65 ++++++ .../ugraphic/PlacementStrategyY1Y2Left.java | 65 ++++++ .../sourceforge/plantuml/ugraphic/UGroup.java | 63 ++++++ .../sourceforge/plantuml/version/Version.java | 6 +- src/pom.xml | 187 +++++++++++++++ 65 files changed, 2709 insertions(+), 427 deletions(-) create mode 100644 src/net/sourceforge/plantuml/classdiagram/command/CommandCreateEntityClass2.java create mode 100644 src/net/sourceforge/plantuml/classdiagram/command/CommandCreateEntityClassMultilines2.java create mode 100644 src/net/sourceforge/plantuml/command/CommandMultilines2.java create mode 100644 src/net/sourceforge/plantuml/graph/MethodsOrFieldsArea2.java create mode 100644 src/net/sourceforge/plantuml/posimo/EntityImageNote2.java create mode 100644 src/net/sourceforge/plantuml/posimo/LineRectIntersection.java create mode 100644 src/net/sourceforge/plantuml/posimo/LineSegmentIntersection.java create mode 100644 src/net/sourceforge/plantuml/posimo/MinMax.java create mode 100644 src/net/sourceforge/plantuml/posimo/Racorder.java create mode 100644 src/net/sourceforge/plantuml/posimo/RacorderAbstract.java create mode 100644 src/net/sourceforge/plantuml/posimo/RacorderFollowTangeante.java create mode 100644 src/net/sourceforge/plantuml/posimo/RacorderFollowTangeanteOld.java create mode 100644 src/net/sourceforge/plantuml/posimo/RacorderInToCenter.java create mode 100644 src/net/sourceforge/plantuml/posimo/RacorderOrthogonal.java create mode 100644 src/net/sourceforge/plantuml/posimo/TwoLinesIntersection.java create mode 100644 src/net/sourceforge/plantuml/ugraphic/AbstractPlacementStrategy.java create mode 100644 src/net/sourceforge/plantuml/ugraphic/PlacementStrategy.java create mode 100644 src/net/sourceforge/plantuml/ugraphic/PlacementStrategyVisibility.java create mode 100644 src/net/sourceforge/plantuml/ugraphic/PlacementStrategyX1X2.java create mode 100644 src/net/sourceforge/plantuml/ugraphic/PlacementStrategyX1Y2Y3.java create mode 100644 src/net/sourceforge/plantuml/ugraphic/PlacementStrategyY1Y2.java create mode 100644 src/net/sourceforge/plantuml/ugraphic/PlacementStrategyY1Y2Left.java create mode 100644 src/net/sourceforge/plantuml/ugraphic/UGroup.java create mode 100644 src/pom.xml diff --git a/src/net/sourceforge/plantuml/EmptyImageBuilder.java b/src/net/sourceforge/plantuml/EmptyImageBuilder.java index aac2a952f..d0087aa8d 100644 --- a/src/net/sourceforge/plantuml/EmptyImageBuilder.java +++ b/src/net/sourceforge/plantuml/EmptyImageBuilder.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 3824 $ + * Revision $Revision: 5579 $ * */ package net.sourceforge.plantuml; @@ -44,6 +44,7 @@ public class EmptyImageBuilder { private final Graphics2D g2d; public EmptyImageBuilder(int width, int height, Color background) { + Log.info("Creating image " + width + "x" + height); im = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); g2d = im.createGraphics(); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); diff --git a/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java b/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java index a14e5b817..e73705e7e 100644 --- a/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java +++ b/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java @@ -28,11 +28,12 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 5536 $ + * Revision $Revision: 5616 $ * */ package net.sourceforge.plantuml.classdiagram; +import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.cucadiagram.Entity; import net.sourceforge.plantuml.cucadiagram.EntityType; @@ -85,7 +86,7 @@ public class ClassDiagram extends AbstractClassOrObjectDiagram { @Override public IEntity getOrCreateClass(String code) { - return getOrCreateEntity(code, EntityType.CLASS); + return getOrCreateEntity(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(code), EntityType.CLASS); } final public IEntity getOrCreateClass(String code, EntityType type) { diff --git a/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java b/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java index 8bec4b36f..1ad3790a0 100644 --- a/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java +++ b/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java @@ -28,14 +28,14 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 5472 $ + * Revision $Revision: 5613 $ * */ package net.sourceforge.plantuml.classdiagram; import net.sourceforge.plantuml.classdiagram.command.CommandAddMethod; -import net.sourceforge.plantuml.classdiagram.command.CommandCreateEntityClass; -import net.sourceforge.plantuml.classdiagram.command.CommandCreateEntityClassMultilines; +import net.sourceforge.plantuml.classdiagram.command.CommandCreateEntityClass2; +import net.sourceforge.plantuml.classdiagram.command.CommandCreateEntityClassMultilines2; import net.sourceforge.plantuml.classdiagram.command.CommandEndNamespace; import net.sourceforge.plantuml.classdiagram.command.CommandHideShow; import net.sourceforge.plantuml.classdiagram.command.CommandImport; @@ -70,7 +70,8 @@ public class ClassDiagramFactory extends AbstractUmlSystemCommandFactory { addCommand(new CommandPage(system)); addCommand(new CommandAddMethod(system)); - addCommand(new CommandCreateEntityClass(system)); + //addCommand(new CommandCreateEntityClass(system)); + addCommand(new CommandCreateEntityClass2(system)); addCommand(new CommandCreateNote(system)); addCommand(new CommandPackage(system)); @@ -89,7 +90,8 @@ public class ClassDiagramFactory extends AbstractUmlSystemCommandFactory { addCommand(new CommandMultilinesClassNote(system)); addCommand(new CommandMultilinesStandaloneNote(system)); - addCommand(new CommandCreateEntityClassMultilines(system)); +// addCommand(new CommandCreateEntityClassMultilines(system)); + addCommand(new CommandCreateEntityClassMultilines2(system)); addCommand(new CommandHideShow(system)); diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandAddMethod.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandAddMethod.java index 6dc02c55a..454c57867 100644 --- a/src/net/sourceforge/plantuml/classdiagram/command/CommandAddMethod.java +++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandAddMethod.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 5019 $ + * Revision $Revision: 5618 $ * */ package net.sourceforge.plantuml.classdiagram.command; @@ -44,7 +44,7 @@ import net.sourceforge.plantuml.skin.VisibilityModifier; public class CommandAddMethod extends SingleLineCommand { public CommandAddMethod(ClassDiagram diagram) { - super(diagram, "(?i)^([\\p{L}0-9_.]+)\\s*:\\s*(.*)$"); + super(diagram, "(?i)^([\\p{L}0-9_.]+|\"[^\"]+\")\\s*:\\s*(.*)$"); } @Override diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateEntityClass2.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateEntityClass2.java new file mode 100644 index 000000000..8cfc15994 --- /dev/null +++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateEntityClass2.java @@ -0,0 +1,120 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009, Arnaud Roques + * + * Project Info: http://plantuml.sourceforge.net + * + * 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 Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * [Java is a trademark or registered trademark of Sun Microsystems, Inc. + * in the United States and other countries.] + * + * Original Author: Arnaud Roques + * + * Revision $Revision: 5075 $ + * + */ +package net.sourceforge.plantuml.classdiagram.command; + +import java.util.Map; + +import net.sourceforge.plantuml.FontParam; +import net.sourceforge.plantuml.classdiagram.ClassDiagram; +import net.sourceforge.plantuml.command.CommandExecutionResult; +import net.sourceforge.plantuml.command.SingleLineCommand2; +import net.sourceforge.plantuml.command.regex.RegexConcat; +import net.sourceforge.plantuml.command.regex.RegexLeaf; +import net.sourceforge.plantuml.command.regex.RegexOr; +import net.sourceforge.plantuml.command.regex.RegexPartialMatch; +import net.sourceforge.plantuml.cucadiagram.Entity; +import net.sourceforge.plantuml.cucadiagram.EntityType; +import net.sourceforge.plantuml.cucadiagram.Stereotype; + +public class CommandCreateEntityClass2 extends SingleLineCommand2 { + + public CommandCreateEntityClass2(ClassDiagram diagram) { + super(diagram, getRegexConcat()); + } + + private static RegexConcat getRegexConcat() { + return new RegexConcat(new RegexLeaf("^"), + new RegexLeaf("TYPE", "(interface|enum|abstract\\s+class|abstract|class)\\s+"), + new RegexOr( + new RegexLeaf("NAME1", "(?:\"([^\"]+)\"\\s+as\\s+)?(\\.?[\\p{L}0-9_]+(?:\\.[\\p{L}0-9_]+)*)"), + new RegexLeaf("NAME2", "(\\.?[\\p{L}0-9_]+(?:\\.[\\p{L}0-9_]+)*)\\s+as\\s+\"([^\"]+)\""), + new RegexLeaf("NAME3", "\"([^\"]+)\"")), + new RegexLeaf("STEREO", "(?:\\s*([\\<\\[]{2}.*[\\>\\]]{2}))?"), + new RegexLeaf("$")); + } + + @Override + protected CommandExecutionResult executeArg(Map arg) { + final EntityType type = EntityType.getEntityType(arg.get("TYPE").get(0).toUpperCase()); + final String code; + final String display; + if (arg.get("NAME1").get(1) != null) { + code = arg.get("NAME1").get(1); + display = arg.get("NAME1").get(0); + } else if (arg.get("NAME3").get(0) != null) { + code = arg.get("NAME3").get(0); + display = arg.get("NAME3").get(0); + } else { + code = arg.get("NAME2").get(0); + display = arg.get("NAME2").get(1); + } + final String stereotype = arg.get("STEREO").get(0); + final Entity entity; + if (getSystem().entityExist(code)) { + entity = (Entity) getSystem().getOrCreateEntity(code, type); + entity.muteToType(type); + } else { + entity = getSystem().createEntity(code, display, type); + } + if (stereotype != null) { + entity.setStereotype(new Stereotype(stereotype, getSystem().getSkinParam().getCircledCharacterRadius(), + getSystem().getSkinParam().getFont(FontParam.CIRCLED_CHARACTER))); + } + return CommandExecutionResult.ok(); + } + + // @Override + // protected CommandExecutionResult executeArg(List arg) { + // final String arg0 = arg.get(0).toUpperCase(); + // final EntityType type = EntityType.getEntityType(arg0); + // final String code = arg.get(2); + // final String display = arg.get(1); + // final String stereotype = arg.get(3); + // final Entity entity; + // if (getSystem().entityExist(code)) { + // // return CommandExecutionResult.error("Class already exists : " + // // + code); + // entity = (Entity) getSystem().getOrCreateEntity(code, type); + // entity.muteToType(type); + // } else { + // entity = getSystem().createEntity(code, display, type); + // } + // if (stereotype != null) { + // entity.setStereotype(new Stereotype(stereotype, getSystem().getSkinParam().getCircledCharacterRadius(), + // getSystem().getSkinParam().getFont(FontParam.CIRCLED_CHARACTER))); + // } + // return CommandExecutionResult.ok(); + // } + +} diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateEntityClassMultilines2.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateEntityClassMultilines2.java new file mode 100644 index 000000000..05ffd625e --- /dev/null +++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateEntityClassMultilines2.java @@ -0,0 +1,115 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009, Arnaud Roques + * + * Project Info: http://plantuml.sourceforge.net + * + * 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 Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * [Java is a trademark or registered trademark of Sun Microsystems, Inc. + * in the United States and other countries.] + * + * Original Author: Arnaud Roques + * + * Revision $Revision: 4161 $ + * + */ +package net.sourceforge.plantuml.classdiagram.command; + +import java.util.List; +import java.util.Map; + +import net.sourceforge.plantuml.FontParam; +import net.sourceforge.plantuml.classdiagram.ClassDiagram; +import net.sourceforge.plantuml.command.CommandExecutionResult; +import net.sourceforge.plantuml.command.CommandMultilines2; +import net.sourceforge.plantuml.command.regex.RegexConcat; +import net.sourceforge.plantuml.command.regex.RegexLeaf; +import net.sourceforge.plantuml.command.regex.RegexOr; +import net.sourceforge.plantuml.command.regex.RegexPartialMatch; +import net.sourceforge.plantuml.cucadiagram.Entity; +import net.sourceforge.plantuml.cucadiagram.EntityType; +import net.sourceforge.plantuml.cucadiagram.Stereotype; +import net.sourceforge.plantuml.skin.VisibilityModifier; + +public class CommandCreateEntityClassMultilines2 extends CommandMultilines2 { + + public CommandCreateEntityClassMultilines2(ClassDiagram diagram) { + super(diagram, getRegexConcat(), "(?i)^\\s*\\}\\s*$"); + } + + private static RegexConcat getRegexConcat() { + return new RegexConcat(new RegexLeaf("^"), + new RegexLeaf("TYPE", "(interface|enum|abstract\\s+class|abstract|class)\\s+"), + new RegexOr( + new RegexLeaf("NAME1", "(?:\"([^\"]+)\"\\s+as\\s+)?(\\.?[\\p{L}0-9_]+(?:\\.[\\p{L}0-9_]+)*)"), + new RegexLeaf("NAME2", "(\\.?[\\p{L}0-9_]+(?:\\.[\\p{L}0-9_]+)*)\\s+as\\s+\"([^\"]+)\""), + new RegexLeaf("NAME3", "\"([^\"]+)\"")), + new RegexLeaf("STEREO", "(?:\\s*([\\<\\[]{2}.*[\\>\\]]{2}))?"), + new RegexLeaf("\\s*\\{\\s*$")); + } + + + public CommandExecutionResult execute(List lines) { + final Map line0 = getStartingPattern().matcher(lines.get(0)); + final Entity entity = executeArg0(line0); + if (entity == null) { + return CommandExecutionResult.error("No such entity"); + } + for (String s : lines.subList(1, lines.size() - 1)) { + if (s.length() > 0 && VisibilityModifier.isVisibilityCharacter(s.charAt(0))) { + getSystem().setVisibilityModifierPresent(true); + } + entity.addFieldOrMethod(s); + } + return CommandExecutionResult.ok(); + } + + private Entity executeArg0(Map arg) { + + final EntityType type = EntityType.getEntityType(arg.get("TYPE").get(0).toUpperCase()); + final String code; + final String display; + if (arg.get("NAME1").get(1) != null) { + code = arg.get("NAME1").get(1); + display = arg.get("NAME1").get(0); + } else if (arg.get("NAME3").get(0) != null) { + code = arg.get("NAME3").get(0); + display = arg.get("NAME3").get(0); + } else { + code = arg.get("NAME2").get(0); + display = arg.get("NAME2").get(1); + } + final String stereotype = arg.get("STEREO").get(0); + + if (getSystem().entityExist(code)) { + final Entity result = (Entity) getSystem().getOrCreateClass(code); + result.muteToType(type); + return result; + } + final Entity entity = getSystem().createEntity(code, display, type); + if (stereotype != null) { + entity.setStereotype(new Stereotype(stereotype, getSystem().getSkinParam().getCircledCharacterRadius(), + getSystem().getSkinParam().getFont(FontParam.CIRCLED_CHARACTER))); + } + return entity; + } + +} diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShow.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShow.java index c280155eb..de816aa4d 100644 --- a/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShow.java +++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShow.java @@ -56,7 +56,7 @@ public class CommandHideShow extends SingleLineCommand { public CommandHideShow(ClassDiagram classDiagram) { super( classDiagram, - "(?i)^(hide|show)\\s+(?:(class|interface|enum|abstract|[\\p{L}0-9_.]+|\\<\\<.*\\>\\>)\\s+)*?(?:(empty)\\s+)?(members?|attributes?|fields?|methods?|circle\\w*|stereotypes?)$"); + "(?i)^(hide|show)\\s+(?:(class|interface|enum|abstract|[\\p{L}0-9_.]+|\"[^\"]+\"|\\<\\<.*\\>\\>)\\s+)*?(?:(empty)\\s+)?(members?|attributes?|fields?|methods?|circle\\w*|stereotypes?)$"); } private final EntityGender emptyByGender(Set portion) { diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass2.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass2.java index 2195063a1..3f964be63 100644 --- a/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass2.java +++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass2.java @@ -64,7 +64,7 @@ final public class CommandLinkClass2 extends SingleLineCommand2 arg) { - final String ent1 = arg.get("ENT1").get(1); - final String ent2 = arg.get("ENT2").get(1); + String ent1 = arg.get("ENT1").get(1); + String ent2 = arg.get("ENT2").get(1); if (ent1 == null) { return executeArgSpecial1(arg); } if (ent2 == null) { return executeArgSpecial2(arg); } + ent1 = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(ent1); + ent2 = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(ent2); if (getSystem().isGroup(ent1) && getSystem().isGroup(ent2)) { return executePackageLink(arg); } diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandMultilinesClassNote.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandMultilinesClassNote.java index 46b09a599..d84e965d6 100644 --- a/src/net/sourceforge/plantuml/classdiagram/command/CommandMultilinesClassNote.java +++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandMultilinesClassNote.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 4239 $ + * Revision $Revision: 5616 $ * */ package net.sourceforge.plantuml.classdiagram.command; @@ -39,7 +39,7 @@ import net.sourceforge.plantuml.command.AbstractCommandMultilinesNoteEntity; public class CommandMultilinesClassNote extends AbstractCommandMultilinesNoteEntity { public CommandMultilinesClassNote(final AbstractEntityDiagram system) { - super(system, "(?i)^note\\s+(right|left|top|bottom)\\s+(?:of\\s+)?([\\p{L}0-9_.]+)\\s*(#\\w+)?$"); + super(system, "(?i)^note\\s+(right|left|top|bottom)\\s+(?:of\\s+)?([\\p{L}0-9_.]+|\"[^\"]+\")\\s*(#\\w+)?$"); } } diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandStereotype.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandStereotype.java index d1d0cebda..abd638e5d 100644 --- a/src/net/sourceforge/plantuml/classdiagram/command/CommandStereotype.java +++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandStereotype.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 5019 $ + * Revision $Revision: 5654 $ * */ package net.sourceforge.plantuml.classdiagram.command; @@ -45,7 +45,7 @@ import net.sourceforge.plantuml.cucadiagram.Stereotype; public class CommandStereotype extends SingleLineCommand { public CommandStereotype(ClassDiagram classDiagram) { - super(classDiagram, "(?i)^([\\p{L}0-9_.]+)\\s*(\\<\\<.*\\>\\>)$"); + super(classDiagram, "(?i)^([\\p{L}0-9_.]+|\"[^\"]+\")\\s*(\\<\\<.*\\>\\>)$"); } @Override diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandUrl.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandUrl.java index 9cd540468..2aecc8495 100644 --- a/src/net/sourceforge/plantuml/classdiagram/command/CommandUrl.java +++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandUrl.java @@ -43,7 +43,7 @@ import net.sourceforge.plantuml.cucadiagram.Entity; public class CommandUrl extends SingleLineCommand { public CommandUrl(ClassDiagram classDiagram) { - super(classDiagram, "(?i)^url\\s*(?:of|for)?\\s+([\\p{L}0-9_.]+)\\s+(?:is)?\\s*\\[\\[(.*)\\]\\]$"); + super(classDiagram, "(?i)^url\\s*(?:of|for)?\\s+([\\p{L}0-9_.]+|\"[^\"]+\")\\s+(?:is)?\\s*\\[\\[(.*)\\]\\]$"); } @Override diff --git a/src/net/sourceforge/plantuml/command/CommandMultilines2.java b/src/net/sourceforge/plantuml/command/CommandMultilines2.java new file mode 100644 index 000000000..b48434ee2 --- /dev/null +++ b/src/net/sourceforge/plantuml/command/CommandMultilines2.java @@ -0,0 +1,111 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009, Arnaud Roques + * + * Project Info: http://plantuml.sourceforge.net + * + * 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 Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * [Java is a trademark or registered trademark of Sun Microsystems, Inc. + * in the United States and other countries.] + * + * Original Author: Arnaud Roques + * + * Revision $Revision: 5041 $ + * + */ +package net.sourceforge.plantuml.command; + +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import net.sourceforge.plantuml.PSystem; +import net.sourceforge.plantuml.command.regex.RegexConcat; + +public abstract class CommandMultilines2 implements Command { + + private final S system; + + private final RegexConcat starting; + private final Pattern ending; + + public CommandMultilines2(final S system, RegexConcat patternStart, String patternEnd) { + if (patternStart.getPattern().startsWith("^") == false || patternStart.getPattern().endsWith("$") == false) { + throw new IllegalArgumentException("Bad pattern " + patternStart.getPattern()); + } + if (patternEnd.startsWith("(?i)^") == false || patternEnd.endsWith("$") == false) { + throw new IllegalArgumentException("Bad pattern " + patternEnd); + } + this.system = system; + this.starting = patternStart; + this.ending = Pattern.compile(patternEnd); + } + + final public CommandControl isValid(List lines) { + if (isCommandForbidden()) { + return CommandControl.NOT_OK; + } + //Matcher m1 = starting.matcher(lines.get(0)); + final boolean result1 = starting.match(lines.get(0)); + if (result1 == false) { + return CommandControl.NOT_OK; + } + if (lines.size() == 1) { + return CommandControl.OK_PARTIAL; + } + + Matcher m1 = ending.matcher(lines.get(lines.size() - 1)); + if (m1.matches() == false) { + return CommandControl.OK_PARTIAL; + } + + actionIfCommandValid(); + return CommandControl.OK; + } + + protected boolean isCommandForbidden() { + return false; + } + + protected void actionIfCommandValid() { + } + + protected S getSystem() { + return system; + } + + protected final RegexConcat getStartingPattern() { + return starting; + } + + protected final Pattern getEnding() { + return ending; + } + + public boolean isDeprecated(List line) { + return false; + } + + public String getHelpMessageForDeprecated(List lines) { + return null; + } + +} diff --git a/src/net/sourceforge/plantuml/command/CommandNoteEntity.java b/src/net/sourceforge/plantuml/command/CommandNoteEntity.java index 2aba47b06..bc3db1894 100644 --- a/src/net/sourceforge/plantuml/command/CommandNoteEntity.java +++ b/src/net/sourceforge/plantuml/command/CommandNoteEntity.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 5019 $ + * Revision $Revision: 5616 $ * */ package net.sourceforge.plantuml.command; @@ -49,7 +49,7 @@ final public class CommandNoteEntity extends SingleLineCommand entities = getFirstLevelEntities(); - System.err.println("entities=" + entities); + // System.err.println("entities=" + entities); // final Collection links = getLinks(entities); final Collection links = diagram.getLinks(); @@ -148,32 +148,32 @@ public final class CucaDiagramFileMakerBeta { private Collection getFirstLevelEntities() { final Collection result = new HashSet(); diagram.computeAutonomyOfGroups(); - System.err.println("diagramEntities = " + diagram.entities()); - System.err.println("diagramGroups = " + diagram.getGroups()); +// System.err.println("diagramEntities = " + diagram.entities()); +// System.err.println("diagramGroups = " + diagram.getGroups()); addEntitiesOfGroup(result, null); return result; } private void addEntitiesOfGroup(final Collection result, Group parent) { - System.err.println("addEntitiesOfGroup parent=" + parent); +// System.err.println("addEntitiesOfGroup parent=" + parent); for (IEntity ent : diagram.entities().values()) { if (ent.getParent() == parent) { result.add(ent); - System.err.println("addingA " + ent); + // System.err.println("addingA " + ent); } } final Collection groups = parent == null ? diagram.getGroups() : parent.getChildren(); for (Group g : groups) { - System.err.println("g=" + g + " parent = " + g.getParent()); + // System.err.println("g=" + g + " parent = " + g.getParent()); if (g.isAutonom() == false) { addEntitiesOfGroup(result, g); result.add(g.getEntityCluster()); - System.err.println("addingB " + g.getEntityCluster()); + // System.err.println("addingB " + g.getEntityCluster()); } else if (g.getParent() == parent) { assert g.isAutonom(); assert result.contains(g.getEntityCluster()) == false; result.add(g.getEntityCluster()); - System.err.println("addingC " + g.getEntityCluster()); + // System.err.println("addingC " + g.getEntityCluster()); } } diff --git a/src/net/sourceforge/plantuml/cucadiagram/dot/CucaDiagramTxtMaker.java b/src/net/sourceforge/plantuml/cucadiagram/dot/CucaDiagramTxtMaker.java index afcf2aa6b..a17b69cc0 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/dot/CucaDiagramTxtMaker.java +++ b/src/net/sourceforge/plantuml/cucadiagram/dot/CucaDiagramTxtMaker.java @@ -75,7 +75,7 @@ public final class CucaDiagramTxtMaker { this.diagram = diagram; this.fileFormat = fileFormat; - final Cluster root = new Cluster(null); + final Cluster root = new Cluster(null, 0, 0); int uid = 0; final Map blocks = new HashMap(); @@ -85,7 +85,7 @@ public final class CucaDiagramTxtMaker { // ug.translate(0, getHeight(ent) + 1); final double width = getWidth(ent) * getXPixelPerChar(); final double height = getHeight(ent) * getYPixelPerChar(); - final Block b = new Block(uid++, width, height); + final Block b = new Block(uid++, width, height, null); root.addBloc(b); blocks.put(ent, b); } diff --git a/src/net/sourceforge/plantuml/cucadiagram/dot/DotMaker.java b/src/net/sourceforge/plantuml/cucadiagram/dot/DotMaker.java index 696bf0327..c95140614 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/dot/DotMaker.java +++ b/src/net/sourceforge/plantuml/cucadiagram/dot/DotMaker.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 5575 $ + * Revision $Revision: 5581 $ * */ package net.sourceforge.plantuml.cucadiagram.dot; @@ -125,9 +125,9 @@ final public class DotMaker implements GraphvizMaker { private void initPrintWriter(StringBuilder sb) { - Log.info("Entities = "+data.getEntities().size()); - final boolean huge = data.getEntities().size()>800; - + Log.info("Entities = " + data.getEntities().size()); + final boolean huge = data.getEntities().size() > 800; + sb.append("digraph unix {"); if (isJunit == false) { for (String s : dotStrings) { @@ -139,16 +139,15 @@ final public class DotMaker implements GraphvizMaker { sb.append("size=\"400,400;\""); } else { sb.append("ratio=auto;"); + // sb.append("concentrate=true;"); } sb.append("compound=true;"); sb.append("remincross=true;"); - // sb.append("concentrate=true;"); sb.append("searchsize=500;"); if (data.getRankdir() == Rankdir.LEFT_TO_RIGHT) { sb.append("rankdir=LR;"); } } - private Collection getUnpackagedEntities() { final List result = new ArrayList(); @@ -638,10 +637,10 @@ final public class DotMaker implements GraphvizMaker { } private void eventuallySameRank(StringBuilder sb, Group entityPackage, Link link) { -// if (workAroundDotBug()) { -// throw new UnsupportedOperationException("workAroundDotBug"); -// // return; -// } + // if (workAroundDotBug()) { + // throw new UnsupportedOperationException("workAroundDotBug"); + // // return; + // } final int len = link.getLength(); if (len == 1 && link.getEntity1().getParent() == entityPackage && link.getEntity2().getParent() == entityPackage) { diff --git a/src/net/sourceforge/plantuml/cucadiagram/dot/PlayField.java b/src/net/sourceforge/plantuml/cucadiagram/dot/PlayField.java index 10e76396a..ab2f1582a 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/dot/PlayField.java +++ b/src/net/sourceforge/plantuml/cucadiagram/dot/PlayField.java @@ -34,10 +34,12 @@ package net.sourceforge.plantuml.cucadiagram.dot; import java.awt.Color; +import java.awt.Font; import java.awt.geom.Dimension2D; import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; import java.io.IOException; +import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; @@ -54,13 +56,16 @@ import net.sourceforge.plantuml.cucadiagram.EntityType; import net.sourceforge.plantuml.cucadiagram.Group; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.Link; -import net.sourceforge.plantuml.cucadiagram.LinkDecor; import net.sourceforge.plantuml.cucadiagram.LinkType; +import net.sourceforge.plantuml.graphic.HorizontalAlignement; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.posimo.Block; import net.sourceforge.plantuml.posimo.Cluster; import net.sourceforge.plantuml.posimo.EntityImageBlock; import net.sourceforge.plantuml.posimo.EntityImageClass2; +import net.sourceforge.plantuml.posimo.EntityImageNote2; import net.sourceforge.plantuml.posimo.Frame; import net.sourceforge.plantuml.posimo.GraphvizSolverB; import net.sourceforge.plantuml.posimo.IEntityImageBlock; @@ -79,20 +84,22 @@ public final class PlayField { private final Rose rose = new Rose(); private final ISkinParam skinParam; - private final Cluster root = new Cluster(null); + private final Cluster root = new Cluster(null, 0, 0); private final Map paths = new LinkedHashMap(); private final Map blocks = new HashMap(); private final Map clusters = new HashMap(); + private final Map frames = new HashMap(); final private double marginLabel = 6; + final private Font fontQualif; public PlayField(ISkinParam skinParam) { this.skinParam = skinParam; + this.fontQualif = skinParam.getFont(FontParam.CLASS_ARROW); } - public void initInternal(Collection entities, - Collection links, StringBounder stringBounder) { + public void initInternal(Collection entities, Collection links, StringBounder stringBounder) { if (blocks.size() != 0 || paths.size() != 0 /* || images.size() != 0 */ || clusters.size() != 0) { throw new IllegalStateException(); @@ -105,38 +112,39 @@ public final class PlayField { } for (IEntity ent : entities) { - if (ent.getType() == EntityType.GROUP - && ent.getParent().isAutonom() == false) { - clusters.put(ent, new Cluster(root)); - System.err.println("Creating cluster for " + ent + " " - + clusters.get(ent)); + if (ent.getType() == EntityType.GROUP && ent.getParent().isAutonom() == false) { + // final IEntityImageBlock title = createClusterTitle(); + // final Frame frame = new Frame(StringUtils.getWithNewlines(ent.getDisplay()), Color.BLACK, skinParam + // .getFont(FontParam.CLASS), rose.getHtmlColor(skinParam, ColorParam.classBorder).getColor()); + final Frame frame = new Frame(StringUtils.getWithNewlines(ent.getDisplay()), skinParam); + frames.put(ent, frame); + // final Dimension2D dimTitle = + // title.getDimension(stringBounder); + final Dimension2D dimTitle = frame.getTextDim(stringBounder); + clusters.put(ent, new Cluster(root, dimTitle.getWidth(), dimTitle.getHeight())); } } for (IEntity ent : entities) { - System.err.println("ENT=" + ent); - if (ent.getType() == EntityType.GROUP - && ent.getParent().isAutonom() == false) { + // System.err.println("ENT=" + ent); + if (ent.getType() == EntityType.GROUP && ent.getParent().isAutonom() == false) { assert clusters.containsKey(ent); continue; } assert clusters.containsKey(ent) == false; Cluster parentCluster = root; if (ent.getType() != EntityType.GROUP && ent.getParent() != null) { - parentCluster = clusters - .get(ent.getParent().getEntityCluster()); + parentCluster = clusters.get(ent.getParent().getEntityCluster()); if (parentCluster == null) { parentCluster = root; } } - final IEntityImageBlock entityImageBlock = createEntityImageBlock( - links, ent); + final IEntityImageBlock entityImageBlock = createEntityImageBlock(links, ent); // final Dimension2D d = // entityImageBlock.getDimension(stringBounder); // final Block b = new Block(uid++, d.getWidth() + 2 * // marginDecorator, d.getHeight() + 2 * marginDecorator); - final MargedBlock b = new MargedBlock(stringBounder, - entityImageBlock, getMargin(ent, links)); + final MargedBlock b = new MargedBlock(stringBounder, entityImageBlock, getMargin(stringBounder, ent, links), parentCluster); blocks.put(ent, b); // images.put(ent, entityImageBlock); @@ -150,42 +158,40 @@ public final class PlayField { } for (Link link : links) { - System.err.println("LINK=" + link); - if (entities.contains(link.getEntity1()) - && entities.contains(link.getEntity2())) { + // System.err.println("LINK=" + link); + if (entities.contains(link.getEntity1()) && entities.contains(link.getEntity2())) { final Block b1 = getToto(link.getEntity1()); final Block b2 = getToto(link.getEntity2()); final Label label; if (link.getLabel() == null) { label = null; } else { - final LabelImage labelImage = new LabelImage(link, rose, - skinParam); - final Dimension2D dim = Dimension2DDouble.delta(labelImage - .getDimension(stringBounder), marginLabel); + final LabelImage labelImage = new LabelImage(link, rose, skinParam); + final Dimension2D dim = Dimension2DDouble + .delta(labelImage.getDimension(stringBounder), marginLabel); label = new Label(dim.getWidth(), dim.getHeight()); } - final Path p = new Path(b1, b2, label); + final Path p = new Path(b1, b2, label, link.getLength()); paths.put(p, link); } } } - private int getMargin(IEntity ent, Collection links) { - int result = 0; + private double getMargin(StringBounder stringBounder, IEntity ent, Collection links) { + double result = 0; for (Link link : links) { - if (link.getEntity2()==ent) { - final LinkDecor decor = link.getType().getDecor1(); - result = Math.max(result, decor.getSize()); + if (link.getEntity2() == ent) { + // final LinkDecor decor = link.getType().getDecor1(); + result = Math.max(result, link.getMarginDecors2(stringBounder, fontQualif)); } - if (link.getEntity1()==ent) { - final LinkDecor decor = link.getType().getDecor2(); - result = Math.max(result, decor.getSize()); + if (link.getEntity1() == ent) { + // final LinkDecor decor = link.getType().getDecor2(); + result = Math.max(result, link.getMarginDecors1(stringBounder, fontQualif)); } - + } return result; - //return 40; + // return 40; } private Block getToto(IEntity ent) { @@ -207,27 +213,20 @@ public final class PlayField { public void drawInternal(UGraphic ug) { for (Map.Entry ent : clusters.entrySet()) { - final Frame frame = new Frame(StringUtils.getWithNewlines(ent - .getKey().getDisplay()), Color.BLACK, skinParam - .getFont(FontParam.CLASS), rose.getHtmlColor(skinParam, - ColorParam.classBorder).getColor()); + final Frame frame = frames.get(ent.getKey()); final Rectangle2D rect = PositionableUtils.convert(ent.getValue()); final double oldX = ug.getTranslateX(); final double oldY = ug.getTranslateY(); ug.translate(rect.getX(), rect.getY()); - frame.drawU(ug, new Dimension2DDouble(rect.getWidth(), rect - .getHeight()), null); + frame.drawU(ug, new Dimension2DDouble(rect.getWidth(), rect.getHeight()), null); ug.setTranslate(oldX, oldY); } for (Map.Entry ent : paths.entrySet()) { final LinkType type = ent.getValue().getType(); - final PathDrawerInterface pathDrawer = PathDrawerInterface.create( - new Rose(), skinParam, type); + final PathDrawerInterface pathDrawer = PathDrawerInterface.create(skinParam, type); final Path p = ent.getKey(); - ug.getParam().setColor( - rose.getHtmlColor(skinParam, ColorParam.classBorder) - .getColor()); + ug.getParam().setColor(rose.getHtmlColor(skinParam, ColorParam.classBorder).getColor()); // pathDrawer.drawPathBefore(ug, PositionableUtils.addMargin(p // .getStart(), -marginDecorator, -marginDecorator), // PositionableUtils.addMargin(p.getEnd(), -marginDecorator, @@ -245,20 +244,34 @@ public final class PlayField { } for (Map.Entry ent : paths.entrySet()) { - final LinkType type = ent.getValue().getType(); - final PathDrawerInterface pathDrawer = PathDrawerInterface.create( - new Rose(), skinParam, type); + final Link link = ent.getValue(); + final LinkType type = link.getType(); + final PathDrawerInterface pathDrawer = PathDrawerInterface.create(skinParam, type); final Path p = ent.getKey(); - ug.getParam().setColor( - rose.getHtmlColor(skinParam, ColorParam.classBorder) - .getColor()); + ug.getParam().setColor(rose.getHtmlColor(skinParam, ColorParam.classBorder).getColor()); // pathDrawer.drawPathAfter(ug, PositionableUtils.addMargin(p // .getStart(), -marginDecorator, -marginDecorator), // PositionableUtils.addMargin(p.getEnd(), -marginDecorator, // -marginDecorator), p); - pathDrawer.drawPathAfter(ug, getMargedBlock(p.getStart()) - .getImagePosition(), getMargedBlock(p.getEnd()) + pathDrawer.drawPathAfter(ug, getMargedBlock(p.getStart()).getImagePosition(), getMargedBlock(p.getEnd()) .getImagePosition(), p); + + final String qual1 = link.getQualifier1(); + if (qual1 != null) { + final TextBlock b = TextBlockUtils.create(Arrays.asList(qual1), fontQualif, + skinParam.getFontHtmlColor(FontParam.CLASS_ARROW).getColor(), HorizontalAlignement.LEFT); + final Point2D pos = p.getDotPath().getStartPoint(); + b.drawU(ug, pos.getX(), pos.getY()); + } + + final String qual2 = link.getQualifier2(); + if (qual2 != null) { + final TextBlock b = TextBlockUtils.create(Arrays.asList(qual2), fontQualif, + skinParam.getFontHtmlColor(FontParam.CLASS_ARROW).getColor(), HorizontalAlignement.LEFT); + final Point2D pos = p.getDotPath().getEndPoint(); + b.drawU(ug, pos.getX(), pos.getY()); + } + } } @@ -273,9 +286,8 @@ public final class PlayField { public Dimension2D solve() throws IOException, InterruptedException { final GraphvizSolverB solver = new GraphvizSolverB(); - System.err.println("sub=" + root.getSubClusters()); - final Dimension2D dim = Dimension2DDouble.delta(solver.solve(root, - paths.keySet()), 20); + // System.err.println("sub=" + root.getSubClusters()); + final Dimension2D dim = Dimension2DDouble.delta(solver.solve(root, paths.keySet()), 20); return dim; } @@ -286,29 +298,28 @@ public final class PlayField { ug.getParam().setColor(Color.GREEN); ug.getParam().setBackcolor(null); final Dimension2D dim = label.getSize(); - ug.draw(pos.getX(), pos.getY(), new URectangle(dim.getWidth(), dim - .getHeight())); - final LabelImage labelImage = new LabelImage(paths.get(p), rose, - skinParam); - final Dimension2D dimImage = labelImage.getDimension(ug - .getStringBounder()); - ug.draw(pos.getX(), pos.getY(), new URectangle(dimImage.getWidth(), - dimImage.getHeight())); + ug.draw(pos.getX(), pos.getY(), new URectangle(dim.getWidth(), dim.getHeight())); + final LabelImage labelImage = new LabelImage(paths.get(p), rose, skinParam); + final Dimension2D dimImage = labelImage.getDimension(ug.getStringBounder()); + ug.draw(pos.getX(), pos.getY(), new URectangle(dimImage.getWidth(), dimImage.getHeight())); } - final LabelImage labelImage = new LabelImage(paths.get(p), rose, - skinParam); + final LabelImage labelImage = new LabelImage(paths.get(p), rose, skinParam); labelImage.drawU(ug, pos.getX(), pos.getY()); } - private IEntityImageBlock createEntityImageBlock(Collection links, - IEntity ent) { - if (ent.getType() == EntityType.CLASS - || ent.getType() == EntityType.ABSTRACT_CLASS - || ent.getType() == EntityType.INTERFACE - || ent.getType() == EntityType.ENUM) { - return new EntityImageClass2(ent, rose, skinParam, links); + private IEntityImageBlock createEntityImageBlock(Collection links, IEntity ent) { + if (ent.getType() == EntityType.CLASS || ent.getType() == EntityType.ABSTRACT_CLASS + || ent.getType() == EntityType.INTERFACE || ent.getType() == EntityType.ENUM) { + return new EntityImageClass2(ent, skinParam, links); } - return new EntityImageBlock(ent, rose, skinParam, links); + if (ent.getType() == EntityType.NOTE) { + return new EntityImageNote2(ent, skinParam, links); + } + return new EntityImageBlock(ent, rose, skinParam, links, FontParam.PACKAGE); + } + + private IEntityImageBlock createClusterTitle() { + return null; } } diff --git a/src/net/sourceforge/plantuml/cucadiagram/dot/ProcessRunner.java b/src/net/sourceforge/plantuml/cucadiagram/dot/ProcessRunner.java index 8bc69aaa8..5be6f45ef 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/dot/ProcessRunner.java +++ b/src/net/sourceforge/plantuml/cucadiagram/dot/ProcessRunner.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 3829 $ + * Revision $Revision: 5650 $ * */ package net.sourceforge.plantuml.cucadiagram.dot; @@ -49,6 +49,8 @@ public class ProcessRunner { public ProcessRunner(String cmd) { this.cmd = cmd; } + + static private int cpt = 0; public void run(byte in[], OutputStream redirection) throws IOException, InterruptedException { final Process process = Runtime.getRuntime().exec(cmd); @@ -66,6 +68,7 @@ public class ProcessRunner { outStream.join(10000L); this.out = outStream.sb.toString(); this.error = errorStream.sb.toString(); + Log.info("RUN nb = "+(++cpt)); } static class ThreadStream extends Thread { diff --git a/src/net/sourceforge/plantuml/graph/EntityImageClass.java b/src/net/sourceforge/plantuml/graph/EntityImageClass.java index c3722e00c..6bd3ffc61 100644 --- a/src/net/sourceforge/plantuml/graph/EntityImageClass.java +++ b/src/net/sourceforge/plantuml/graph/EntityImageClass.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 5386 $ + * Revision $Revision: 5609 $ * */ package net.sourceforge.plantuml.graph; diff --git a/src/net/sourceforge/plantuml/graph/MethodsOrFieldsArea.java b/src/net/sourceforge/plantuml/graph/MethodsOrFieldsArea.java index f68aae3bc..bc8c79c23 100644 --- a/src/net/sourceforge/plantuml/graph/MethodsOrFieldsArea.java +++ b/src/net/sourceforge/plantuml/graph/MethodsOrFieldsArea.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 5386 $ + * Revision $Revision: 5609 $ * */ package net.sourceforge.plantuml.graph; @@ -48,6 +48,7 @@ import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounderUtils; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; +import net.sourceforge.plantuml.skin.VisibilityModifier; import net.sourceforge.plantuml.ugraphic.UGraphic; public class MethodsOrFieldsArea { @@ -58,10 +59,14 @@ public class MethodsOrFieldsArea { public MethodsOrFieldsArea(List attributes, Font font) { this.font = font; for (Member att : attributes) { - this.strings.add(att.getDisplayWithVisibilityChar()); + this.strings.add(att.getDisplayWithoutVisibilityChar()); } } + public VisibilityModifier getVisibilityModifier() { + throw new UnsupportedOperationException(); + } + public Dimension2D calculateDimension(StringBounder stringBounder) { double x = 0; double y = 0; diff --git a/src/net/sourceforge/plantuml/graph/MethodsOrFieldsArea2.java b/src/net/sourceforge/plantuml/graph/MethodsOrFieldsArea2.java new file mode 100644 index 000000000..c54036b0e --- /dev/null +++ b/src/net/sourceforge/plantuml/graph/MethodsOrFieldsArea2.java @@ -0,0 +1,157 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009, Arnaud Roques + * + * Project Info: http://plantuml.sourceforge.net + * + * 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 Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * [Java is a trademark or registered trademark of Sun Microsystems, Inc. + * in the United States and other countries.] + * + * Original Author: Arnaud Roques + * + * Revision $Revision: 5608 $ + * + */ +package net.sourceforge.plantuml.graph; + +import java.awt.Color; +import java.awt.Font; +import java.awt.Graphics2D; +import java.awt.geom.Dimension2D; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.FontParam; +import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.cucadiagram.Member; +import net.sourceforge.plantuml.graphic.HorizontalAlignement; +import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.graphic.TextBlockUtils; +import net.sourceforge.plantuml.skin.VisibilityModifier; +import net.sourceforge.plantuml.skin.rose.Rose; +import net.sourceforge.plantuml.ugraphic.PlacementStrategyVisibility; +import net.sourceforge.plantuml.ugraphic.PlacementStrategyY1Y2Left; +import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.UGroup; + +public class MethodsOrFieldsArea2 { + + private final Font font; + private final List members = new ArrayList(); + private final ISkinParam skinParam; + private final Color color; + private final Rose rose = new Rose(); + + public MethodsOrFieldsArea2(List attributes, FontParam fontParam, ISkinParam skinParam) { + this.members.addAll(attributes); + this.skinParam = skinParam; + this.font = skinParam.getFont(fontParam); + this.color = rose.getFontColor(skinParam, FontParam.CLASS_ATTRIBUTE); + + } + + private boolean hasSmallIcon() { + for (Member m : members) { + if (m.getVisibilityModifier() != null) { + return true; + } + } + return false; + } + + public Dimension2D calculateDimension(StringBounder stringBounder) { + double x = 0; + double y = 0; + for (Member m : members) { + final String s = m.getDisplayWithoutVisibilityChar(); + final TextBlock bloc = createTextBlock(s); + final Dimension2D dim = bloc.calculateDimension(stringBounder); + y += dim.getHeight(); + x = Math.max(dim.getWidth(), x); + } + if (hasSmallIcon()) { + x += skinParam.getCircledCharacterRadius(); + } + return new Dimension2DDouble(x, y); + } + + private TextBlock createTextBlock(String s) { + return TextBlockUtils.create(Arrays.asList(s), font, color, HorizontalAlignement.LEFT); + } + + public void drawTOBEREMOVED(Graphics2D g2d, double x, double y) { + throw new UnsupportedOperationException(); + } + + public void draw(UGraphic ug, double x, double y) { + final Dimension2D dim = calculateDimension(ug.getStringBounder()); + final UGroup group; + if (hasSmallIcon()) { + group = new UGroup(new PlacementStrategyVisibility(ug.getStringBounder(), + skinParam.getCircledCharacterRadius())); + for (Member att : members) { + final String s = att.getDisplayWithoutVisibilityChar(); + final TextBlock bloc = createTextBlock(s); + final VisibilityModifier modifier = att.getVisibilityModifier(); + group.add(getUBlock(modifier)); + group.add(bloc); + } + } else { + group = new UGroup(new PlacementStrategyY1Y2Left(ug.getStringBounder())); + for (Member att : members) { + final String s = att.getDisplayWithoutVisibilityChar(); + final TextBlock bloc = createTextBlock(s); + group.add(bloc); + } + } + group.drawU(ug, x, y, dim.getWidth(), dim.getHeight()); + + } + + private TextBlock getUBlock(final VisibilityModifier modifier) { + if (modifier == null) { + return new TextBlock() { + + public void drawU(UGraphic ug, double x, double y) { + } + + public void drawTOBEREMOVED(Graphics2D g2d, double x, double y) { + throw new UnsupportedOperationException(); + } + + public Dimension2D calculateDimension(StringBounder stringBounder) { + return new Dimension2DDouble(1, 1); + } + }; + } + final Color back = modifier.getBackground() == null ? null : rose.getHtmlColor(skinParam, + modifier.getBackground()).getColor(); + final Color fore = rose.getHtmlColor(skinParam, modifier.getForeground()).getColor(); + + final TextBlock uBlock = modifier.getUBlock(skinParam.getCircledCharacterRadius(), fore, back); + return uBlock; + } + +} diff --git a/src/net/sourceforge/plantuml/graphic/CircledCharacter.java b/src/net/sourceforge/plantuml/graphic/CircledCharacter.java index 94475fa6c..403732378 100644 --- a/src/net/sourceforge/plantuml/graphic/CircledCharacter.java +++ b/src/net/sourceforge/plantuml/graphic/CircledCharacter.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 4917 $ + * Revision $Revision: 5594 $ * */ package net.sourceforge.plantuml.graphic; @@ -42,6 +42,7 @@ import java.awt.font.TextLayout; import java.awt.geom.Dimension2D; import java.awt.geom.PathIterator; +import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.skin.UDrawable; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -49,7 +50,7 @@ import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.USegmentType; import net.sourceforge.plantuml.ugraphic.g2d.UGraphicG2d; -public class CircledCharacter implements UDrawable { +public class CircledCharacter implements UDrawable, TextBlock { private final String c; private final Font font; @@ -77,8 +78,8 @@ public class CircledCharacter implements UDrawable { ug.getParam().setColor(circle); } -// final Color circleToUse = circle == null ? ug.getParam().getColor() : circle; -// ug.getParam().setColor(circleToUse); + // final Color circleToUse = circle == null ? ug.getParam().getColor() : circle; + // ug.getParam().setColor(circleToUse); ug.getParam().setBackcolor(innerCircle); @@ -133,4 +134,12 @@ public class CircledCharacter implements UDrawable { return result; } + public Dimension2D calculateDimension(StringBounder stringBounder) { + return new Dimension2DDouble(getPreferredWidth(stringBounder), getPreferredHeight(stringBounder)); + } + + public void drawTOBEREMOVED(Graphics2D g2d, double x, double y) { + throw new UnsupportedOperationException(); + } + } diff --git a/src/net/sourceforge/plantuml/posimo/AbstractEntityImage2.java b/src/net/sourceforge/plantuml/posimo/AbstractEntityImage2.java index f883850ef..9464cdf48 100644 --- a/src/net/sourceforge/plantuml/posimo/AbstractEntityImage2.java +++ b/src/net/sourceforge/plantuml/posimo/AbstractEntityImage2.java @@ -37,29 +37,26 @@ import java.awt.Color; import java.awt.Font; import java.awt.geom.Dimension2D; +import net.sourceforge.plantuml.ColorParam; +import net.sourceforge.plantuml.FontParam; +import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.skin.rose.Rose; abstract class AbstractEntityImage2 implements IEntityImageBlock { private final IEntity entity; + private final ISkinParam skinParam; + + private final Rose rose = new Rose(); - final private Color red = new Color(Integer.parseInt("A80036", 16)); - final private Color yellow = new Color(Integer.parseInt("FEFECE", 16)); - private final Color yellowNote = new Color(Integer.parseInt("FBFB77", 16)); - - final private Font font14 = new Font("SansSerif", Font.PLAIN, 14); - final private Font font17 = new Font("Courier", Font.BOLD, 17); - final private Color green = new Color(Integer.parseInt("ADD1B2", 16)); - final private Color violet = new Color(Integer.parseInt("B4A7E5", 16)); - final private Color blue = new Color(Integer.parseInt("A9DCDF", 16)); - final private Color rose = new Color(Integer.parseInt("EB937F", 16)); - - public AbstractEntityImage2(IEntity entity) { + public AbstractEntityImage2(IEntity entity, ISkinParam skinParam) { if (entity == null) { throw new IllegalArgumentException("entity null"); } this.entity = entity; + this.skinParam = skinParam; } public abstract Dimension2D getDimension(StringBounder stringBounder); @@ -68,39 +65,19 @@ abstract class AbstractEntityImage2 implements IEntityImageBlock { return entity; } - protected final Color getRed() { - return red; + protected Font getFont(FontParam fontParam) { + return skinParam.getFont(fontParam); } - protected final Color getYellow() { - return yellow; + protected Color getFontColor(FontParam fontParam) { + return skinParam.getFontHtmlColor(fontParam).getColor(); } - protected final Font getFont17() { - return font17; + protected final Color getColor(ColorParam colorParam) { + return rose.getHtmlColor(skinParam, colorParam).getColor(); } - protected final Font getFont14() { - return font14; - } - - protected final Color getGreen() { - return green; - } - - protected final Color getViolet() { - return violet; - } - - protected final Color getBlue() { - return blue; - } - - protected final Color getRose() { - return rose; - } - - protected final Color getYellowNote() { - return yellowNote; + protected final ISkinParam getSkinParam() { + return skinParam; } } diff --git a/src/net/sourceforge/plantuml/posimo/BezierUtils.java b/src/net/sourceforge/plantuml/posimo/BezierUtils.java index 405ca73d9..d64bb2a92 100644 --- a/src/net/sourceforge/plantuml/posimo/BezierUtils.java +++ b/src/net/sourceforge/plantuml/posimo/BezierUtils.java @@ -160,8 +160,14 @@ public class BezierUtils { copy.x2 = mx; copy.y2 = my; } - if (dist(copy) < 1) { - return new Point2D.Double(mx, my); + if (dist(copy) < 0.1) { + if (contains1) { + return new Point2D.Double(copy.x2, copy.y2); + } + if (contains2) { + return new Point2D.Double(copy.x1, copy.y1); + } + throw new IllegalStateException(); } } } diff --git a/src/net/sourceforge/plantuml/posimo/Block.java b/src/net/sourceforge/plantuml/posimo/Block.java index 54e3ea8c0..063453195 100644 --- a/src/net/sourceforge/plantuml/posimo/Block.java +++ b/src/net/sourceforge/plantuml/posimo/Block.java @@ -46,11 +46,13 @@ public class Block implements Clusterable { private final double height; private double x; private double y; + private final Cluster parent; - public Block(int uid, double width, double height) { + public Block(int uid, double width, double height, Cluster parent) { this.uid = uid; this.width = width; this.height = height; + this.parent = parent; } @Override @@ -67,8 +69,7 @@ public class Block implements Clusterable { } public Cluster getParent() { - // TODO Auto-generated method stub - return null; + return parent; } public Point2D getPosition() { diff --git a/src/net/sourceforge/plantuml/posimo/Cluster.java b/src/net/sourceforge/plantuml/posimo/Cluster.java index ff90c2837..4bca72fa7 100644 --- a/src/net/sourceforge/plantuml/posimo/Cluster.java +++ b/src/net/sourceforge/plantuml/posimo/Cluster.java @@ -53,9 +53,18 @@ public class Cluster implements Clusterable { private double y; private double width; private double height; + + private final double titleWidth; + private final double titleHeight; - public Cluster(Cluster parent) { +// public Cluster(Cluster parent) { +// this(parent, 100, 20); +// } +// + public Cluster(Cluster parent, double titleWidth, double titleHeight) { this.parent = parent; + this.titleWidth = titleWidth; + this.titleHeight = titleHeight; if (parent != null) { parent.children.add(this); } @@ -134,5 +143,13 @@ public class Cluster implements Clusterable { this.height = height; } + public final double getTitleWidth() { + return titleWidth; + } + + public final double getTitleHeight() { + return titleHeight; + } + } diff --git a/src/net/sourceforge/plantuml/posimo/DotPath.java b/src/net/sourceforge/plantuml/posimo/DotPath.java index 4a46f4399..0f4181fcb 100644 --- a/src/net/sourceforge/plantuml/posimo/DotPath.java +++ b/src/net/sourceforge/plantuml/posimo/DotPath.java @@ -37,9 +37,11 @@ import java.awt.Graphics2D; import java.awt.Shape; import java.awt.geom.CubicCurve2D; import java.awt.geom.GeneralPath; +import java.awt.geom.Line2D; import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -70,19 +72,32 @@ public class DotPath implements UShape { private final double x; private final double y; -// @Override -// public String toString() { -// return "[" + x1 + "," + y1 + " " + x2 + "," + y2 + " " + x + "," + y + "]"; -// } + // @Override + // public String toString() { + // return "[" + x1 + "," + y1 + " " + x2 + "," + y2 + " " + x + "," + y + // + "]"; + // } } private final List beziers = new ArrayList(); - //private final String print; + + // private final String print; public Point2D getStartPoint() { return beziers.get(0).getP1(); } + public MinMax getMinMax() { + final MinMax result = new MinMax(); + for (CubicCurve2D.Double c : beziers) { + result.manage(c.x1, c.y1); + result.manage(c.x2, c.y2); + result.manage(c.ctrlx1, c.ctrly1); + result.manage(c.ctrlx2, c.ctrly2); + } + return result; + } + public DotPath() { this(new ArrayList()); } @@ -90,13 +105,53 @@ public class DotPath implements UShape { public Point2D getEndPoint() { return beziers.get(beziers.size() - 1).getP2(); } - + + public Line2D getEndTangeante() { + final CubicCurve2D.Double last = beziers.get(beziers.size() - 1); + double dx = last.x2 - last.ctrlx2; + double dy = last.y2 - last.ctrly2; + if (dx == 0 && dy == 0) { + dx = last.x2 - last.x1; + dy = last.y2 - last.y1; + } + return new Line2D.Double(last.x2, last.y2, last.x2 + dx, last.y2 + dy); + } + + public double getEndAngle() { + final Line2D tan = getEndTangeante(); + final double theta1 = Math.atan2(tan.getY2() - tan.getY1(), tan.getX2() - tan.getX1()); + return theta1; + } + + public double getStartAngle() { + final Line2D tan = getStartTangeante(); + final double theta1 = Math.atan2(tan.getY2() - tan.getY1(), tan.getX2() - tan.getX1()); + return theta1; + } + + public Line2D getStartTangeante() { + final CubicCurve2D.Double first = beziers.get(0); + double dx = first.ctrlx1 - first.x1; + double dy = first.ctrly1 - first.y1; + if (dx == 0 && dy == 0) { + dx = first.x2 - first.x1; + dy = first.y2 - first.y1; + } + return new Line2D.Double(first.x1, first.y1, first.x1 + dx, first.y1 + dy); + } + public DotPath addBefore(CubicCurve2D.Double before) { final List copy = new ArrayList(beziers); copy.add(0, before); return new DotPath(copy); } + public DotPath addBefore(DotPath other) { + final List copy = new ArrayList(beziers); + copy.addAll(0, other.beziers); + return new DotPath(copy); + } + public DotPath addAfter(CubicCurve2D.Double after) { final List copy = new ArrayList(beziers); copy.add(after); @@ -109,15 +164,16 @@ public class DotPath implements UShape { return new DotPath(copy); } + private DotPath(List beziers) { this.beziers.addAll(beziers); - //this.print = super.toString(); + // this.print = super.toString(); } -// @Override -// public String toString() { -// return print; -// } + // @Override + // public String toString() { + // return print; + // } public DotPath(String init, double deltaY) { if (init.startsWith("M") == false) { @@ -164,14 +220,15 @@ public class DotPath implements UShape { return result; } -// public void drawOld(Graphics2D g2d, double x, double y) { -// for (CubicCurve2D.Double bez : beziers) { -// bez = new CubicCurve2D.Double(x + bez.x1, y + bez.y1, x + bez.ctrlx1, y + bez.ctrly1, x + bez.ctrlx2, y -// + bez.ctrly2, x + bez.x2, y + bez.y2); -// g2d.draw(bez); -// } -// } -// + // public void drawOld(Graphics2D g2d, double x, double y) { + // for (CubicCurve2D.Double bez : beziers) { + // bez = new CubicCurve2D.Double(x + bez.x1, y + bez.y1, x + bez.ctrlx1, y + + // bez.ctrly1, x + bez.ctrlx2, y + // + bez.ctrly2, x + bez.x2, y + bez.y2); + // g2d.draw(bez); + // } + // } + // public void draw(Graphics2D g2d, double x, double y) { final GeneralPath p = new GeneralPath(); for (CubicCurve2D.Double bez : beziers) { @@ -275,11 +332,35 @@ public class DotPath implements UShape { } } - private String toString(CubicCurve2D.Double c) { + static String toString(CubicCurve2D.Double c) { return "(" + c.x1 + "," + c.y1 + ") " + "(" + c.ctrlx1 + "," + c.ctrly1 + ") " + "(" + c.ctrlx2 + "," + c.ctrly2 + ") " + "(" + c.x2 + "," + c.y2 + ") "; } + @Override + public String toString() { + final StringBuilder sb = new StringBuilder(); + for (CubicCurve2D.Double c : beziers) { + sb.append(toString(c)); + } + return sb.toString(); + } + + public static CubicCurve2D.Double reverse(CubicCurve2D curv) { + return new CubicCurve2D.Double(curv.getX2(), curv.getY2(), curv.getCtrlX2(), curv.getCtrlY2(), + curv.getCtrlX1(), curv.getCtrlY1(), curv.getX1(), curv.getY1()); + } + + public DotPath reverse() { + final List reverse = new ArrayList(beziers); + Collections.reverse(reverse); + final List copy = new ArrayList(); + for (CubicCurve2D.Double cub : reverse) { + copy.add(reverse(cub)); + } + return new DotPath(copy); + + } } diff --git a/src/net/sourceforge/plantuml/posimo/DotxMaker.java b/src/net/sourceforge/plantuml/posimo/DotxMaker.java index 0e1e76199..1ecf31ec3 100644 --- a/src/net/sourceforge/plantuml/posimo/DotxMaker.java +++ b/src/net/sourceforge/plantuml/posimo/DotxMaker.java @@ -46,9 +46,14 @@ public class DotxMaker { this.paths = paths; } - public String createDotString() { + public String createDotString(String... dotStrings) { final StringBuilder sb = new StringBuilder(); sb.append("digraph unix {"); + + for (String s : dotStrings) { + sb.append(s); + } + sb.append("compound=true;"); printCluster(sb, root); @@ -63,11 +68,16 @@ public class DotxMaker { } private void printCluster(StringBuilder sb, Cluster cl) { - if (cl.getContents().size() == 0) { + if (cl.getContents().size() == 0 && cl.getSubClusters().size() == 0) { throw new IllegalStateException(cl.toString()); } for (Cluster sub : cl.getSubClusters()) { sb.append("subgraph cluster" + sub.getUid() + " {"); + if (sub.getTitleWidth() > 0 && sub.getTitleHeight() > 0) { + sb.append("label=<
>"); + } + printCluster(sb, sub); sb.append("}"); @@ -83,8 +93,11 @@ public class DotxMaker { throw new IllegalArgumentException(); } final StringBuilder sb = new StringBuilder("b" + p.getStart().getUid() + " -> b" + p.getEnd().getUid()); - //sb.append(" [dir=none, arrowhead=none, headclip=false, tailclip=false"); sb.append(" [dir=none, arrowhead=none, headclip=true, tailclip=true"); + final int len = p.getLength(); + if (len >= 3) { + sb.append(",minlen=" + (len - 1)); + } if (p.getLabel() == null) { sb.append("]"); } else { @@ -94,7 +107,12 @@ public class DotxMaker { } if (p.getLength() <= 1) { - sb.append("{rank=same; b" + p.getStart().getUid() + "; b" + p.getEnd().getUid() + "}"); + final boolean samePackage = p.getStart().getParent() == p.getEnd().getParent(); + if (samePackage == false) { + System.err.println("!!!!!!!!!!!!!!!!!TURNING ARROUND DOT BUG!!!!!!!!!!!!!!!!!!"); + } else { + sb.append("{rank=same; b" + p.getStart().getUid() + "; b" + p.getEnd().getUid() + "}"); + } } return sb.toString(); diff --git a/src/net/sourceforge/plantuml/posimo/EntityImageBlock.java b/src/net/sourceforge/plantuml/posimo/EntityImageBlock.java index 1d69a87db..e4c30f06b 100644 --- a/src/net/sourceforge/plantuml/posimo/EntityImageBlock.java +++ b/src/net/sourceforge/plantuml/posimo/EntityImageBlock.java @@ -62,24 +62,46 @@ public class EntityImageBlock implements IEntityImageBlock { private final IEntity entity; private final ISkinParam param; private final Rose rose; - private final int margin = 6; + // private final int margin = 6; private final TextBlock name; private final Collection links; private PlayField playField; private Frame frame; + private Dimension2D dimension; - public EntityImageBlock(IEntity entity, Rose rose, ISkinParam param, Collection links) { + public EntityImageBlock(IEntity entity, Rose rose, ISkinParam param, Collection links, FontParam titleParam) { this.entity = entity; this.param = param; this.rose = rose; this.links = links; - this.name = TextBlockUtils.create(StringUtils.getWithNewlines(entity.getDisplay()), param - .getFont(FontParam.CLASS), Color.BLACK, HorizontalAlignement.CENTER); + + if (StringUtils.isNotEmpty(entity.getDisplay())) { + this.name = TextBlockUtils.create(StringUtils.getWithNewlines(entity.getDisplay()), + param.getFont(titleParam), Color.BLACK, HorizontalAlignement.CENTER); + } else { + this.name = null; + } } public Dimension2D getDimension(StringBounder stringBounder) { + if (dimension == null) { + dimension = getDimensionSlow(stringBounder); + + if (name != null) { + final Dimension2D dimName = name.calculateDimension(stringBounder); + final double widthName = dimName.getWidth(); + if (widthName > dimension.getWidth()) { + dimension = new Dimension2DDouble(widthName, dimension.getHeight()); + } + + } + } + return dimension; + } + + private Dimension2D getDimensionSlow(StringBounder stringBounder) { initPlayField(stringBounder); Dimension2D dim; if (playField == null) { @@ -99,7 +121,8 @@ public class EntityImageBlock implements IEntityImageBlock { throw new RuntimeException(); } } - return Dimension2DDouble.delta(dim, margin * 2); + return dim; + // return Dimension2DDouble.delta(dim, margin * 2); } private void initPlayField(StringBounder stringBounder) { @@ -109,13 +132,14 @@ public class EntityImageBlock implements IEntityImageBlock { this.playField = new PlayField(param); final Collection entities = new ArrayList(); for (IEntity ent : entity.getParent().entities().values()) { - //entities.add(EntityUtils.withNoParent(ent)); + // entities.add(EntityUtils.withNoParent(ent)); entities.add(ent); } playField.initInternal(entities, links, stringBounder); - this.frame = new Frame(StringUtils.getWithNewlines(entity.getDisplay()), Color.BLACK, param - .getFont(FontParam.CLASS), rose.getHtmlColor(param, ColorParam.classBorder).getColor()); + // this.frame = new Frame(StringUtils.getWithNewlines(entity.getDisplay()), Color.BLACK, param + // .getFont(FontParam.CLASS), rose.getHtmlColor(param, ColorParam.classBorder).getColor()); + this.frame = new Frame(StringUtils.getWithNewlines(entity.getDisplay()), param); } @@ -127,15 +151,17 @@ public class EntityImageBlock implements IEntityImageBlock { final double heightTotal = dim.getHeight() + 2 * marginHeight; final URectangle rect = new URectangle(widthTotal, heightTotal); - //if (entity.getParent() == null) { + // if (entity.getParent() == null) { if (entity.getType() != EntityType.GROUP) { ug.getParam().setBackcolor(rose.getHtmlColor(param, ColorParam.classBackground).getColor()); ug.getParam().setColor(rose.getHtmlColor(param, ColorParam.classBorder).getColor()); ug.draw(xTheoricalPosition - marginWidth, yTheoricalPosition - marginHeight, rect); - name.drawU(ug, xTheoricalPosition + margin, yTheoricalPosition + margin); + // name.drawU(ug, xTheoricalPosition + margin, yTheoricalPosition + margin); + name.drawU(ug, xTheoricalPosition + 0, yTheoricalPosition + 0); } else { - final Frame frame = new Frame(StringUtils.getWithNewlines(entity.getDisplay()), Color.BLACK, param - .getFont(FontParam.CLASS), rose.getHtmlColor(param, ColorParam.classBorder).getColor()); + // final Frame frame = new Frame(StringUtils.getWithNewlines(entity.getDisplay()), Color.BLACK, param + // .getFont(FontParam.CLASS), rose.getHtmlColor(param, ColorParam.classBorder).getColor()); + final Frame frame = new Frame(StringUtils.getWithNewlines(entity.getDisplay()), param); ug.getParam().setBackcolor(rose.getHtmlColor(param, ColorParam.background).getColor()); ug.getParam().setColor(null); @@ -149,8 +175,11 @@ public class EntityImageBlock implements IEntityImageBlock { // -yTheoricalPosition + marginHeight); ug.setTranslate(oldX, oldY); - playField.drawInternal(UGraphicUtils.translate(ug, xTheoricalPosition + margin, yTheoricalPosition + margin - + frame.getPreferredHeight(ug.getStringBounder()))); + // playField.drawInternal(UGraphicUtils.translate(ug, xTheoricalPosition + margin, yTheoricalPosition + + // margin + // + frame.getPreferredHeight(ug.getStringBounder()))); + playField.drawInternal(UGraphicUtils.translate(ug, xTheoricalPosition + 0, + yTheoricalPosition + 0 + frame.getPreferredHeight(ug.getStringBounder()))); } } } diff --git a/src/net/sourceforge/plantuml/posimo/EntityImageClass2.java b/src/net/sourceforge/plantuml/posimo/EntityImageClass2.java index 26da07835..dba55b780 100644 --- a/src/net/sourceforge/plantuml/posimo/EntityImageClass2.java +++ b/src/net/sourceforge/plantuml/posimo/EntityImageClass2.java @@ -34,87 +34,133 @@ package net.sourceforge.plantuml.posimo; import java.awt.Color; +import java.awt.Font; import java.awt.geom.Dimension2D; import java.util.Collection; +import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.cucadiagram.EntityType; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.Link; -import net.sourceforge.plantuml.graph.MethodsOrFieldsArea; +import net.sourceforge.plantuml.cucadiagram.Stereotype; +import net.sourceforge.plantuml.graph.MethodsOrFieldsArea2; import net.sourceforge.plantuml.graphic.CircledCharacter; import net.sourceforge.plantuml.graphic.HorizontalAlignement; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; -import net.sourceforge.plantuml.skin.rose.Rose; +import net.sourceforge.plantuml.ugraphic.PlacementStrategyX1Y2Y3; +import net.sourceforge.plantuml.ugraphic.PlacementStrategyY1Y2; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.UGroup; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.URectangle; public class EntityImageClass2 extends AbstractEntityImage2 { final private TextBlock name; - final private MethodsOrFieldsArea methods; - final private MethodsOrFieldsArea fields; + final private TextBlock stereo; + final private MethodsOrFieldsArea2 methods; + final private MethodsOrFieldsArea2 fields; final private CircledCharacter circledCharacter; - // private final int xMargin = 0; - // private final int yMargin = 0; - // public static final int MARGIN = 20; - - public EntityImageClass2(IEntity entity, Rose rose, ISkinParam skinParam, Collection links) { - super(entity); - this.name = TextBlockUtils.create(StringUtils.getWithNewlines(entity.getDisplay()), getFont14(), Color.BLACK, - HorizontalAlignement.CENTER); - this.methods = new MethodsOrFieldsArea(entity.methods2(), getFont14()); - this.fields = new MethodsOrFieldsArea(entity.fields2(), getFont14()); + public EntityImageClass2(IEntity entity, ISkinParam skinParam, Collection links) { + super(entity, skinParam); + this.name = TextBlockUtils.create(StringUtils.getWithNewlines(entity.getDisplay()), getFont(FontParam.CLASS), + Color.BLACK, HorizontalAlignement.CENTER); + final Stereotype stereotype = entity.getStereotype(); + if (stereotype == null || stereotype.getLabel() == null) { + this.stereo = null; + } else { + this.stereo = TextBlockUtils.create(StringUtils.getWithNewlines(stereotype.getLabel()), + getFont(FontParam.CLASS_STEREOTYPE), getFontColor(FontParam.CLASS_STEREOTYPE), + HorizontalAlignement.CENTER); + } + this.methods = new MethodsOrFieldsArea2(entity.methods2(), FontParam.CLASS_ATTRIBUTE, skinParam); + this.fields = new MethodsOrFieldsArea2(entity.fields2(), FontParam.CLASS_ATTRIBUTE, skinParam); circledCharacter = getCircledCharacter(entity); } private CircledCharacter getCircledCharacter(IEntity entity) { - // if (entity.getStereotype() != null) { - // return new CircledCharacter(entity.getStereotype().getCharacter(), - // font, entity.getStereotype().getColor(), - // red, Color.BLACK); - // } - final double radius = 10; + final Stereotype stereotype = entity.getStereotype(); + if (stereotype != null && stereotype.getCharacter() != 0) { + final Color classBorder = getColor(ColorParam.classBorder); + final Font font = getFont(FontParam.CIRCLED_CHARACTER); + return new CircledCharacter(stereotype.getCharacter(), getSkinParam().getCircledCharacterRadius(), font, + stereotype.getColor(), classBorder, getFontColor(FontParam.CIRCLED_CHARACTER)); + } if (entity.getType() == EntityType.ABSTRACT_CLASS) { - return new CircledCharacter('A', radius, getFont17(), getBlue(), getRed(), Color.BLACK); + return new CircledCharacter('A', getSkinParam().getCircledCharacterRadius(), + getFont(FontParam.CIRCLED_CHARACTER), getColor(ColorParam.stereotypeABackground), + getColor(ColorParam.classBorder), getFontColor(FontParam.CIRCLED_CHARACTER)); } if (entity.getType() == EntityType.CLASS) { - return new CircledCharacter('C', radius, getFont17(), getGreen(), getRed(), Color.BLACK); + return new CircledCharacter('C', getSkinParam().getCircledCharacterRadius(), + getFont(FontParam.CIRCLED_CHARACTER), getColor(ColorParam.stereotypeCBackground), + getColor(ColorParam.classBorder), getFontColor(FontParam.CIRCLED_CHARACTER)); } if (entity.getType() == EntityType.INTERFACE) { - return new CircledCharacter('I', radius, getFont17(), getViolet(), getRed(), Color.BLACK); + return new CircledCharacter('I', getSkinParam().getCircledCharacterRadius(), + getFont(FontParam.CIRCLED_CHARACTER), getColor(ColorParam.stereotypeIBackground), + getColor(ColorParam.classBorder), getFontColor(FontParam.CIRCLED_CHARACTER)); } if (entity.getType() == EntityType.ENUM) { - return new CircledCharacter('E', radius, getFont17(), getRose(), getRed(), Color.BLACK); + return new CircledCharacter('E', getSkinParam().getCircledCharacterRadius(), + getFont(FontParam.CIRCLED_CHARACTER), getColor(ColorParam.stereotypeEBackground), + getColor(ColorParam.classBorder), getFontColor(FontParam.CIRCLED_CHARACTER)); } assert false; return null; } + private int xMarginFieldsOrMethod = 5; + private int marginEmptyFieldsOrMethod = 13; + @Override public Dimension2D getDimension(StringBounder stringBounder) { - final Dimension2D dimName = getNameDimension(stringBounder); + final Dimension2D dimTitle = getTitleDimension(stringBounder); final Dimension2D dimMethods = methods.calculateDimension(stringBounder); final Dimension2D dimFields = fields.calculateDimension(stringBounder); - final double width = Math.max(Math.max(dimMethods.getWidth(), dimFields.getWidth()), dimName.getWidth()); - final double height = dimMethods.getHeight() + dimFields.getHeight() + dimName.getHeight(); + final double width = Math.max( + Math.max(dimMethods.getWidth() + 2 * xMarginFieldsOrMethod, dimFields.getWidth() + 2 + * xMarginFieldsOrMethod), dimTitle.getWidth() + 2 * xMarginCircle); + final double height = getMethodOrFieldHeight(dimMethods) + getMethodOrFieldHeight(dimFields) + + dimTitle.getHeight(); return new Dimension2DDouble(width, height); } - private Dimension2D getNameDimension(StringBounder stringBounder) { - final Dimension2D nameDim = name.calculateDimension(stringBounder); - if (circledCharacter == null) { - return nameDim; + private double getMethodOrFieldHeight(final Dimension2D dim) { + final double fieldsHeight = dim.getHeight(); + if (fieldsHeight == 0) { + return marginEmptyFieldsOrMethod; } - return new Dimension2DDouble(nameDim.getWidth() + getCircledWidth(stringBounder), Math.max(nameDim.getHeight(), - circledCharacter.getPreferredHeight(stringBounder))); + return fieldsHeight; + } + + private int xMarginCircle = 5; + private int yMarginCircle = 5; + + private Dimension2D getTitleDimension(StringBounder stringBounder) { + final Dimension2D nameAndStereo = getNameAndSteretypeDimension(stringBounder); + if (circledCharacter == null) { + return nameAndStereo; + } + return new Dimension2DDouble(nameAndStereo.getWidth() + getCircledWidth(stringBounder), Math.max( + nameAndStereo.getHeight(), circledCharacter.getPreferredHeight(stringBounder) + 2 * yMarginCircle)); + } + + private Dimension2D getNameAndSteretypeDimension(StringBounder stringBounder) { + final Dimension2D nameDim = name.calculateDimension(stringBounder); + final Dimension2D stereoDim = stereo == null ? new Dimension2DDouble(0, 0) : stereo + .calculateDimension(stringBounder); + final Dimension2D nameAndStereo = new Dimension2DDouble(Math.max(nameDim.getWidth(), stereoDim.getWidth()), + nameDim.getHeight() + stereoDim.getHeight()); + return nameAndStereo; } private double getCircledWidth(StringBounder stringBounder) { @@ -126,38 +172,45 @@ public class EntityImageClass2 extends AbstractEntityImage2 { public void drawU(UGraphic ug, double xTheoricalPosition, double yTheoricalPosition, double marginWidth, double marginHeight) { - final Dimension2D dimTotal = getDimension(ug.getStringBounder()); - final Dimension2D dimName = getNameDimension(ug.getStringBounder()); - final Dimension2D dimFields = fields.calculateDimension(ug.getStringBounder()); + final StringBounder stringBounder = ug.getStringBounder(); + final Dimension2D dimTotal = getDimension(stringBounder); + final Dimension2D dimTitle = getTitleDimension(stringBounder); final double widthTotal = dimTotal.getWidth(); final double heightTotal = dimTotal.getHeight(); final URectangle rect = new URectangle(widthTotal, heightTotal); - ug.getParam().setColor(getRed()); - ug.getParam().setBackcolor(getYellow()); + ug.getParam().setColor(getColor(ColorParam.classBorder)); + ug.getParam().setBackcolor(getColor(ColorParam.classBackground)); double x = xTheoricalPosition; double y = yTheoricalPosition; ug.draw(x, y, rect); - if (circledCharacter != null) { - circledCharacter.drawU(ug, x, y); - x += circledCharacter.getPreferredWidth(ug.getStringBounder()); + final UGroup header; + if (circledCharacter == null) { + header = new UGroup(new PlacementStrategyY1Y2(ug.getStringBounder())); + } else { + header = new UGroup(new PlacementStrategyX1Y2Y3(ug.getStringBounder())); + header.add(circledCharacter); } - name.drawU(ug, x, y); + if (stereo != null) { + header.add(stereo); + } + header.add(name); + header.drawU(ug, x, y, dimTotal.getWidth(), dimTitle.getHeight()); - y += dimName.getHeight(); + y += dimTitle.getHeight(); x = xTheoricalPosition; - ug.getParam().setColor(getRed()); + ug.getParam().setColor(getColor(ColorParam.classBorder)); ug.draw(x, y, new ULine(widthTotal, 0)); - fields.draw(ug, x, y); + fields.draw(ug, x + xMarginFieldsOrMethod, y); - y += dimFields.getHeight(); - ug.getParam().setColor(getRed()); + y += getMethodOrFieldHeight(fields.calculateDimension(stringBounder)); + ug.getParam().setColor(getColor(ColorParam.classBorder)); ug.draw(x, y, new ULine(widthTotal, 0)); - methods.draw(ug, x, y); + methods.draw(ug, x + xMarginFieldsOrMethod, y); } } diff --git a/src/net/sourceforge/plantuml/posimo/EntityImageNote2.java b/src/net/sourceforge/plantuml/posimo/EntityImageNote2.java new file mode 100644 index 000000000..68d1697d9 --- /dev/null +++ b/src/net/sourceforge/plantuml/posimo/EntityImageNote2.java @@ -0,0 +1,84 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009, Arnaud Roques + * + * Project Info: http://plantuml.sourceforge.net + * + * 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 Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * [Java is a trademark or registered trademark of Sun Microsystems, Inc. + * in the United States and other countries.] + * + * Original Author: Arnaud Roques + * + * Revision $Revision: 5183 $ + * + */ +package net.sourceforge.plantuml.posimo; + +import java.awt.geom.Dimension2D; +import java.util.Collection; + +import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.SkinParamBackcolored; +import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.cucadiagram.IEntity; +import net.sourceforge.plantuml.cucadiagram.Link; +import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.skin.Component; +import net.sourceforge.plantuml.skin.ComponentType; +import net.sourceforge.plantuml.skin.SimpleContext2D; +import net.sourceforge.plantuml.skin.rose.Rose; +import net.sourceforge.plantuml.ugraphic.UGraphic; + +public class EntityImageNote2 extends AbstractEntityImage2 { + + private final Component comp; + + public EntityImageNote2(IEntity entity, ISkinParam skinParam, + Collection links) { + super(entity, skinParam); + + final Rose skin = new Rose(); + + comp = skin.createComponent(ComponentType.NOTE, skinParam, StringUtils + .getWithNewlines(entity.getDisplay())); + + } + + @Override + public Dimension2D getDimension(StringBounder stringBounder) { + final double height = comp.getPreferredHeight(stringBounder); + final double width = comp.getPreferredWidth(stringBounder); + return new Dimension2DDouble(width, height); + } + + public void drawU(UGraphic ug, double xTheoricalPosition, + double yTheoricalPosition, double marginWidth, double marginHeight) { + final double dx = ug.getTranslateX(); + final double dy = ug.getTranslateY(); + ug.translate(xTheoricalPosition, yTheoricalPosition); + comp.drawU(ug, getDimension(ug.getStringBounder()), new SimpleContext2D(false)); + ug.setTranslate(dx, dy); + + } + +} diff --git a/src/net/sourceforge/plantuml/posimo/Frame.java b/src/net/sourceforge/plantuml/posimo/Frame.java index d94b806f5..8e222c5e9 100644 --- a/src/net/sourceforge/plantuml/posimo/Frame.java +++ b/src/net/sourceforge/plantuml/posimo/Frame.java @@ -38,34 +38,46 @@ import java.awt.Font; import java.awt.geom.Dimension2D; import java.util.List; +import net.sourceforge.plantuml.ColorParam; +import net.sourceforge.plantuml.FontParam; +import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.graphic.HorizontalAlignement; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.skin.Component; import net.sourceforge.plantuml.skin.Context2D; +import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.URectangle; +import net.sourceforge.plantuml.ugraphic.UStroke; public class Frame implements Component { private final List name; - private final Color textColor; - private final Color lineColor; - private final Font font; + private final ISkinParam skinParam; + private final Rose rose = new Rose(); - public Frame(List name, Color textColor, Font font, Color lineColor) { + // private final Color textColor; + // private final Color lineColor; + // private final Font font; + + public Frame(List name, ISkinParam skinParam) { this.name = name; - this.textColor = textColor; - this.lineColor = lineColor; - this.font = font; + this.skinParam = skinParam; + // this.textColor = textColor; + // this.lineColor = lineColor; + // this.font = font; } public void drawU(UGraphic ug, Dimension2D dimensionToUse, Context2D context) { + final Color lineColor = rose.getHtmlColor(skinParam, ColorParam.packageBorder).getColor(); ug.getParam().setColor(lineColor); ug.getParam().setBackcolor(null); + ug.getParam().setStroke(new UStroke(1.4)); ug.draw(0, 0, new URectangle(dimensionToUse.getWidth(), dimensionToUse.getHeight())); + ug.getParam().setStroke(new UStroke()); final TextBlock textBlock = createTextBloc(); textBlock.drawU(ug, 2, 2); @@ -80,7 +92,9 @@ public class Frame implements Component { poly.addPoint(0, y); poly.addPoint(0, 0); ug.getParam().setColor(lineColor); + ug.getParam().setStroke(new UStroke(1.4)); ug.draw(0, 0, poly); + ug.getParam().setStroke(new UStroke()); } @@ -94,12 +108,14 @@ public class Frame implements Component { return dim.getWidth() + 8; } - private Dimension2D getTextDim(StringBounder stringBounder) { + public Dimension2D getTextDim(StringBounder stringBounder) { final TextBlock bloc = createTextBloc(); return bloc.calculateDimension(stringBounder); } private TextBlock createTextBloc() { + final Font font = skinParam.getFont(FontParam.PACKAGE); + final Color textColor = skinParam.getFontHtmlColor(FontParam.PACKAGE).getColor(); final TextBlock bloc = TextBlockUtils.create(name, font, textColor, HorizontalAlignement.LEFT); return bloc; } diff --git a/src/net/sourceforge/plantuml/posimo/GraphvizSolverB.java b/src/net/sourceforge/plantuml/posimo/GraphvizSolverB.java index 9a5914772..6bbe4bca7 100644 --- a/src/net/sourceforge/plantuml/posimo/GraphvizSolverB.java +++ b/src/net/sourceforge/plantuml/posimo/GraphvizSolverB.java @@ -87,12 +87,14 @@ public class GraphvizSolverB { } public Dimension2D solve(Cluster root, Collection paths) throws IOException, InterruptedException { - final String dotString = new DotxMaker(root, paths).createDotString(); + final String dotString = new DotxMaker(root, paths).createDotString("nodesep=0.2;", "ranksep=0.2;"); if (OptionFlags.getInstance().isKeepTmpFiles()) { traceDotString(dotString); } + final MinMax minMax = new MinMax(); + // System.err.println("dotString=" + dotString); // exportPng(dotString, new File("png", "test1.png")); @@ -126,6 +128,7 @@ public class GraphvizSolverB { final List pointsList = extractPointsList(s, p1); b.setX(getMinX(pointsList)); b.setY(getMinY(pointsList) + height); + minMax.manage(b.getPosition()); } for (Cluster cl : root.getSubClusters()) { @@ -141,6 +144,7 @@ public class GraphvizSolverB { final double h = getMaxY(pointsList) - getMinY(pointsList); cl.setHeight(h); cl.setWidth(w); + minMax.manage(cl.getPosition()); } for (Path p : paths) { @@ -154,16 +158,23 @@ public class GraphvizSolverB { final int p2 = s.indexOf(" d=\"", p1); final int p3 = s.indexOf("\"", p2 + " d=\"".length()); final String points = s.substring(p2 + " d=\"".length(), p3); - p.setDotPath(new DotPath(points, height)); + final DotPath dotPath = new DotPath(points, height); + p.setDotPath(dotPath); + minMax.manage(dotPath.getMinMax()); // System.err.println("pointsList=" + pointsList); if (p.getLabel() != null) { final List pointsList = extractPointsList(s, p1); - p.setLabelPosition(getMinX(pointsList), getMinY(pointsList) + height); + final double x = getMinX(pointsList); + final double y = getMinY(pointsList) + height; + p.setLabelPosition(x, y); + minMax.manage(x, y); } } + System.err.println("minMax=" + minMax); + return new Dimension2DDouble(width, height); } diff --git a/src/net/sourceforge/plantuml/posimo/LineRectIntersection.java b/src/net/sourceforge/plantuml/posimo/LineRectIntersection.java new file mode 100644 index 000000000..a6b769a73 --- /dev/null +++ b/src/net/sourceforge/plantuml/posimo/LineRectIntersection.java @@ -0,0 +1,81 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009, Arnaud Roques + * + * Project Info: http://plantuml.sourceforge.net + * + * 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 Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * [Java is a trademark or registered trademark of Sun Microsystems, Inc. + * in the United States and other countries.] + * + * Original Author: Arnaud Roques + * + * Revision $Revision: 4236 $ + * + */ +package net.sourceforge.plantuml.posimo; + +import java.awt.geom.Line2D; +import java.awt.geom.Point2D; +import java.awt.geom.Rectangle2D; + +public class LineRectIntersection { + + private final Point2D inter; + + public LineRectIntersection(Line2D line, Rectangle2D rect) { + final Point2D p1 = new Point2D.Double(rect.getMinX(), rect.getMinY()); + final Point2D p2 = new Point2D.Double(rect.getMaxX(), rect.getMinY()); + final Point2D p3 = new Point2D.Double(rect.getMaxX(), rect.getMaxY()); + final Point2D p4 = new Point2D.Double(rect.getMinX(), rect.getMaxY()); + + final Point2D inter1 = new LineSegmentIntersection(new Line2D.Double(p1, p2), line).getIntersection(); + final Point2D inter2 = new LineSegmentIntersection(new Line2D.Double(p2, p3), line).getIntersection(); + final Point2D inter3 = new LineSegmentIntersection(new Line2D.Double(p3, p4), line).getIntersection(); + final Point2D inter4 = new LineSegmentIntersection(new Line2D.Double(p4, p1), line).getIntersection(); + + final Point2D o = line.getP1(); + inter = getCloser(o, inter1, inter2, inter3, inter4); + + } + + public static Point2D getCloser(final Point2D o, final Point2D... other) { + double minDist = Double.MAX_VALUE; + Point2D result = null; + + for (Point2D pt : other) { + if (pt != null) { + final double dist = pt.distanceSq(o); + if (dist < minDist) { + minDist = dist; + result = pt; + } + } + } + + return result; + } + + public final Point2D getIntersection() { + return inter; + } + +} diff --git a/src/net/sourceforge/plantuml/posimo/LineSegmentIntersection.java b/src/net/sourceforge/plantuml/posimo/LineSegmentIntersection.java new file mode 100644 index 000000000..96a5c8a9e --- /dev/null +++ b/src/net/sourceforge/plantuml/posimo/LineSegmentIntersection.java @@ -0,0 +1,79 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009, Arnaud Roques + * + * Project Info: http://plantuml.sourceforge.net + * + * 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 Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * [Java is a trademark or registered trademark of Sun Microsystems, Inc. + * in the United States and other countries.] + * + * Original Author: Arnaud Roques + * + * Revision $Revision: 4236 $ + * + */ +package net.sourceforge.plantuml.posimo; + +import java.awt.geom.Line2D; +import java.awt.geom.Point2D; + +public class LineSegmentIntersection { + + private final Point2D inter; + + // http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/ + + public LineSegmentIntersection(Line2D segment, Line2D lineB) { + final double x1 = segment.getX1(); + final double y1 = segment.getY1(); + final double x2 = segment.getX2(); + final double y2 = segment.getY2(); + final double x3 = lineB.getX1(); + final double y3 = lineB.getY1(); + final double x4 = lineB.getX2(); + final double y4 = lineB.getY2(); + + final double den = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1); + + if (den == 0) { + inter = null; + } else { + + final double uA1 = (x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3); + final double uA = uA1 / den; + + final double x = x1 + uA * (x2 - x1); + final double y = y1 + uA * (y2 - y1); + + if (uA >= 0 && uA <= 1) { + inter = new Point2D.Double(x, y); + } else { + inter = null; + } + } + } + + public final Point2D getIntersection() { + return inter; + } + +} diff --git a/src/net/sourceforge/plantuml/posimo/MargedBlock.java b/src/net/sourceforge/plantuml/posimo/MargedBlock.java index 5694c395c..d1700b0b4 100644 --- a/src/net/sourceforge/plantuml/posimo/MargedBlock.java +++ b/src/net/sourceforge/plantuml/posimo/MargedBlock.java @@ -42,25 +42,25 @@ public class MargedBlock { private final Block block; private final IEntityImageBlock imageBlock; - private final int marginDecorator; + private final double marginDecorator; private final Dimension2D imageDimension; static private int uid = 1; - public MargedBlock(StringBounder stringBounder, IEntityImageBlock imageBlock, int marginDecorator) { + public MargedBlock(StringBounder stringBounder, IEntityImageBlock imageBlock, double marginDecorator, Cluster parent) { this.imageBlock = imageBlock; this.marginDecorator = marginDecorator; this.imageDimension = imageBlock.getDimension(stringBounder); this.block = new Block(uid++, imageDimension.getWidth() + 2 * marginDecorator, imageDimension.getHeight() + 2 - * marginDecorator); + * marginDecorator, parent); } public Block getBlock() { return block; } - public int getMarginDecorator() { + public double getMarginDecorator() { return marginDecorator; } diff --git a/src/net/sourceforge/plantuml/posimo/MinMax.java b/src/net/sourceforge/plantuml/posimo/MinMax.java new file mode 100644 index 000000000..c59df79e5 --- /dev/null +++ b/src/net/sourceforge/plantuml/posimo/MinMax.java @@ -0,0 +1,65 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009, Arnaud Roques + * + * Project Info: http://plantuml.sourceforge.net + * + * 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 Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * [Java is a trademark or registered trademark of Sun Microsystems, Inc. + * in the United States and other countries.] + * + * Original Author: Arnaud Roques + * + * Revision $Revision: 4236 $ + * + */ +package net.sourceforge.plantuml.posimo; + +import java.awt.geom.Point2D; + +public class MinMax { + + private double minX = Double.MAX_VALUE; + private double minY = Double.MAX_VALUE; + + public void manage(double x, double y) { + if (x < minX) { + minX = x; + } + if (y < minY) { + minY = y; + } + } + + public void manage(Point2D p) { + manage(p.getX(), p.getY()); + } + + public void manage(MinMax other) { + manage(other.minX, other.minY); + } + + @Override + public String toString() { + return "minX=" + minX + " minY=" + minY; + } + +} diff --git a/src/net/sourceforge/plantuml/posimo/Path.java b/src/net/sourceforge/plantuml/posimo/Path.java index b053331ca..e00aa2eef 100644 --- a/src/net/sourceforge/plantuml/posimo/Path.java +++ b/src/net/sourceforge/plantuml/posimo/Path.java @@ -49,6 +49,9 @@ public class Path { if (start == null || end == null) { throw new IllegalArgumentException(); } + if (length < 1) { + throw new IllegalArgumentException("length=" + length); + } this.start = start; this.end = end; this.label = label; diff --git a/src/net/sourceforge/plantuml/posimo/PathDrawerInterface.java b/src/net/sourceforge/plantuml/posimo/PathDrawerInterface.java index b673fd0ab..51fa15a06 100644 --- a/src/net/sourceforge/plantuml/posimo/PathDrawerInterface.java +++ b/src/net/sourceforge/plantuml/posimo/PathDrawerInterface.java @@ -34,9 +34,7 @@ package net.sourceforge.plantuml.posimo; import java.awt.geom.CubicCurve2D; -import java.awt.geom.Line2D; import java.awt.geom.Point2D; -import java.awt.geom.Rectangle2D; import java.util.Collection; import java.util.Map; @@ -57,8 +55,8 @@ public class PathDrawerInterface implements PathDrawer { private final ISkinParam param; private final LinkType linkType; - public static PathDrawerInterface create(Rose rose, ISkinParam param, LinkType linkType) { - return new PathDrawerInterface(rose, param, linkType); + public static PathDrawerInterface create(ISkinParam param, LinkType linkType) { + return new PathDrawerInterface(new Rose(), param, linkType); } private PathDrawerInterface(Rose rose, ISkinParam param, LinkType linkType) { @@ -68,10 +66,10 @@ public class PathDrawerInterface implements PathDrawer { } public void drawPathBefore(UGraphic ug, Positionable start, Positionable end, Path path) { -//// final DotPath dotPath = path.getDotPath(); -//// goDash(ug); -//// ug.draw(0, 0, dotPath); -//// noDash(ug); + // // final DotPath dotPath = path.getDotPath(); + // // goDash(ug); + // // ug.draw(0, 0, dotPath); + // // noDash(ug); } private void noDash(UGraphic ug) { @@ -84,109 +82,58 @@ public class PathDrawerInterface implements PathDrawer { public void drawPathAfter(UGraphic ug, Positionable start, Positionable end, Path path) { DotPath dotPath = path.getDotPath(); + final Racorder racorder = new RacorderOrthogonal(); + //final Racorder racorder = new RacorderInToCenter(); + //final Racorder racorder = new RacorderFollowTangeante(); - final Rectangle2D startRect = PositionableUtils.convert(start); - final double xstartCenter = startRect.getCenterX(); - final double ystartCenter = startRect.getCenterY(); - final Rectangle2D endRect = PositionableUtils.convert(end); - final double xendCenter = endRect.getCenterX(); - final double yendCenter = endRect.getCenterY(); + final Point2D endPath = dotPath.getEndPoint(); + final DotPath in = racorder.getRacordIn(PositionableUtils.convert(end), dotPath.getEndTangeante()); + // final Point2D inPoint = in.getFrontierIntersection(end); + final Point2D inPoint = in.getEndPoint(); + // final double theta1_ = in.getEndAngle() + Math.PI / 2; + // System.err.println("theta1_=" + theta1_ + " " + theta1_ * 180 / + // Math.PI); + final double theta1 = atan2(endPath, inPoint); + // System.err.println("theta1=" + theta1 + " " + theta1 * 180 / + // Math.PI); + final Point2D middle1 = drawSymbol(ug, theta1, inPoint, linkType.getDecor1()); - final Point2D startCenter = new Point2D.Double(xstartCenter, ystartCenter); - final Point2D startPoint = dotPath.getStartPoint(); - final Point2D endPoint = dotPath.getEndPoint(); - final Point2D p1 = BezierUtils.intersect(new Line2D.Double(startPoint, startCenter), startRect); - final Point2D endCenter = new Point2D.Double(xendCenter, yendCenter); - final Point2D p2 = BezierUtils.intersect(new Line2D.Double(endPoint, endCenter), endRect); + final Point2D startPath = dotPath.getStartPoint(); + final DotPath out = racorder.getRacordOut(PositionableUtils.convert(start), dotPath.getStartTangeante()); + // final Point2D outPoint = out.getFrontierIntersection(start); + final Point2D outPoint = out.getStartPoint(); + // final double theta2_ = out.getStartAngle() - Math.PI / 2; + // System.err.println("theta2_=" + theta2_ + " " + theta2_ * 180 / + // Math.PI); + final double theta2 = atan2(startPath, outPoint); + // System.err.println("theta2=" + theta2 + " " + theta2 * 180 / + // Math.PI); + final Point2D middle2 = drawSymbol(ug, theta2, outPoint, linkType.getDecor2()); - - CubicCurve2D.Double after = null; - - if (linkType.getDecor1() == LinkDecor.SQUARRE) { - drawSquare(ug, p1.getX(), p1.getY()); - } else { - if (linkType.getDecor1() == LinkDecor.EXTENDS) { - final Point2D middle = drawExtends(ug, p2.getX(), p2.getY(), endPoint); - after = getLine(endPoint, middle); - } else if (linkType.getDecor1() == LinkDecor.AGREGATION) { - ug.getParam().setBackcolor(rose.getHtmlColor(param, ColorParam.background).getColor()); - ug.getParam().setColor(rose.getHtmlColor(param, ColorParam.classBorder).getColor()); - final Point2D middle = drawDiamond(ug, p2.getX(), p2.getY(), endPoint); - after = getLine(endPoint, middle); - } else if (linkType.getDecor1() == LinkDecor.COMPOSITION) { - ug.getParam().setBackcolor(rose.getHtmlColor(param, ColorParam.classBorder).getColor()); - ug.getParam().setColor(null); - final Point2D middle = drawDiamond(ug, p2.getX(), p2.getY(), endPoint); - after = getLine(endPoint, middle); - } else if (linkType.getDecor1() == LinkDecor.NONE) { - after = getLine(endPoint, p2); - } else if (linkType.getDecor1() == LinkDecor.ARROW) { - ug.getParam().setBackcolor(rose.getHtmlColor(param, ColorParam.classBorder).getColor()); - ug.getParam().setColor(rose.getHtmlColor(param, ColorParam.classBorder).getColor()); - final Point2D middle = drawArrow(ug, p2.getX(), p2.getY(), endPoint); - after = getLine(endPoint, middle); - } - } - if (after != null) { + if (middle1 != null) { + final CubicCurve2D.Double after = getLine(endPath, middle1); dotPath = dotPath.addAfter(after); + //dotPath = dotPath.addAfter(in); } - - CubicCurve2D.Double before = null; - - if (linkType.getDecor2() == LinkDecor.SQUARRE) { - drawSquare(ug, p2.getX(), p2.getY()); - } else { - if (linkType.getDecor2() == LinkDecor.EXTENDS) { - final Point2D middle = drawExtends(ug, p1.getX(), p1.getY(), - startPoint); - before = getLine(middle, startPoint); - } else if (linkType.getDecor2() == LinkDecor.AGREGATION) { - ug.getParam().setBackcolor( - rose.getHtmlColor(param, ColorParam.background) - .getColor()); - ug.getParam().setColor( - rose.getHtmlColor(param, ColorParam.classBorder) - .getColor()); - final Point2D middle = drawDiamond(ug, p1.getX(), p1.getY(), startPoint); - before = getLine(middle, startPoint); - } else if (linkType.getDecor2() == LinkDecor.COMPOSITION) { - ug.getParam().setBackcolor( - rose.getHtmlColor(param, ColorParam.classBorder) - .getColor()); - ug.getParam().setColor(null); - final Point2D middle = drawDiamond(ug, p1.getX(), p1.getY(), startPoint); - before = getLine(middle, startPoint); - } else if (linkType.getDecor2() == LinkDecor.NONE) { - before = getLine(p1, startPoint); - } else if (linkType.getDecor2() == LinkDecor.ARROW) { - ug.getParam().setBackcolor( - rose.getHtmlColor(param, ColorParam.classBorder) - .getColor()); - ug.getParam().setColor( - rose.getHtmlColor(param, ColorParam.classBorder) - .getColor()); - final Point2D middle = drawArrow(ug, p1.getX(), p1.getY(), startPoint); - before = getLine(middle, startPoint); - } - } - - if (before != null) { + if (middle2 != null) { + final CubicCurve2D.Double before = getLine(middle2, startPath); dotPath = dotPath.addBefore(before); + //dotPath = dotPath.addBefore(out); } final LinkStyle style = linkType.getStyle(); if (style == LinkStyle.INTERFACE_PROVIDER || style == LinkStyle.INTERFACE_USER) { final Decor decor = new DecorInterfaceProvider(style); final Map all = dotPath.somePoints(); - final Point2D p = getFarest(p1, p2, all.keySet()); + final Point2D p = getFarest(outPoint, inPoint, all.keySet()); ug.getParam().setBackcolor(rose.getHtmlColor(param, ColorParam.background).getColor()); ug.getParam().setColor(rose.getHtmlColor(param, ColorParam.classBorder).getColor()); decor.drawDecor(ug, p, all.get(p)); } - + ug.getParam().setColor(rose.getHtmlColor(param, ColorParam.classBorder).getColor()); if (linkType.isDashed()) { goDash(ug); @@ -197,10 +144,44 @@ public class PathDrawerInterface implements PathDrawer { } } + private double atan2(final Point2D endPath, final Point2D inPoint) { + final double y = -endPath.getX() + inPoint.getX(); + final double x = endPath.getY() - inPoint.getY(); + final double angle = Math.atan2(y, x); + System.err.println("x=" + x + " y=" + y + " angle=" + angle + " " + angle * 180.0 / Math.PI); + return angle; + } + + private Point2D drawSymbol(UGraphic ug, double theta, final Point2D position, LinkDecor decor) { + Point2D middle1 = null; + // final double theta = Math.atan2( + // -direction.getX() + position.getX(), direction.getY() + // - position.getY()); + if (decor == LinkDecor.SQUARRE) { + middle1 = drawSquare(ug, position.getX(), position.getY()); + } else if (decor == LinkDecor.EXTENDS) { + middle1 = drawExtends(ug, position.getX(), position.getY(), theta); + } else if (decor == LinkDecor.AGREGATION) { + ug.getParam().setBackcolor(rose.getHtmlColor(param, ColorParam.background).getColor()); + ug.getParam().setColor(rose.getHtmlColor(param, ColorParam.classBorder).getColor()); + middle1 = drawDiamond(ug, position.getX(), position.getY(), theta); + } else if (decor == LinkDecor.COMPOSITION) { + ug.getParam().setBackcolor(rose.getHtmlColor(param, ColorParam.classBorder).getColor()); + ug.getParam().setColor(null); + middle1 = drawDiamond(ug, position.getX(), position.getY(), theta); + } else if (decor == LinkDecor.NONE) { + middle1 = position; + } else if (decor == LinkDecor.ARROW) { + ug.getParam().setBackcolor(rose.getHtmlColor(param, ColorParam.classBorder).getColor()); + ug.getParam().setColor(rose.getHtmlColor(param, ColorParam.classBorder).getColor()); + middle1 = drawArrow(ug, position.getX(), position.getY(), theta); + } + return middle1; + } + private CubicCurve2D.Double getLine(final Point2D p1, Point2D p2) { - return new CubicCurve2D.Double(p1.getX(), p1 - .getY(), p1.getX(), p1.getY(), p2 - .getX(), p2.getY(), p2.getX(), p2.getY()); + return new CubicCurve2D.Double(p1.getX(), p1.getY(), p1.getX(), p1.getY(), p2.getX(), p2.getY(), p2.getX(), p2 + .getY()); } private static Point2D getFarest(Point2D p1, Point2D p2, Collection all) { @@ -224,22 +205,24 @@ public class PathDrawerInterface implements PathDrawer { return result; } - private void drawSquare(UGraphic ug, double centerX, double centerY) { + private Point2D drawSquare(UGraphic ug, double centerX, double centerY) { ug.getParam().setBackcolor(rose.getHtmlColor(param, ColorParam.classBackground).getColor()); ug.getParam().setColor(rose.getHtmlColor(param, ColorParam.classBorder).getColor()); final double width = 10; final double height = 10; ug.draw(centerX - width / 2, centerY - height / 2, new URectangle(width, height)); + return new Point2D.Double(centerX, centerY); } - private Point2D drawExtends(UGraphic ug, double x, double y, Point2D pathPoint) { + Point2D drawExtends(UGraphic ug, double x, double y, double theta) { ug.getParam().setBackcolor(rose.getHtmlColor(param, ColorParam.background).getColor()); ug.getParam().setColor(rose.getHtmlColor(param, ColorParam.classBorder).getColor()); final double width = 18; final double height = 26; - final double theta = Math.atan2(-pathPoint.getX() + x, pathPoint.getY() - y); + // final double theta = Math.atan2(-pathPoint.getX() + x, + // pathPoint.getY() - y); final UPolygon triangle = new UPolygon(); triangle.addPoint(0, 1); @@ -248,29 +231,17 @@ public class PathDrawerInterface implements PathDrawer { triangle.rotate(theta); ug.draw(x, y, triangle); - //ug.getParam().setColor(Color.BLACK); final Point2D middle = BezierUtils.middle(triangle.getPoints().get(1), triangle.getPoints().get(2)); middle.setLocation(middle.getX() + x, middle.getY() + y); - //drawLine2(ug, pathPoint, middle); -// return new CubicCurve2D.Double(middle.getX(), middle.getY(), middle.getX(), middle.getY(), -// pathPoint.getX(), pathPoint.getY(),pathPoint.getX(), pathPoint.getY()); return middle; } - -// private void drawLine(UGraphic ug, Point2D p1, Point2D p2) { -//// ug.getParam().setColor(Color.BLACK); -//// final ULine line = new ULine(p2.getX() - p1.getX(), p2.getY() - p1.getY()); -//// goDash(ug); -//// ug.draw(p1.getX(), p1.getY(), line); -//// noDash(ug); -// } - - private Point2D drawDiamond(UGraphic ug, double x, double y, Point2D pathPoint) { + private Point2D drawDiamond(UGraphic ug, double x, double y, double theta) { final double width = 10; final double height = 14; - final double theta = Math.atan2(-pathPoint.getX() + x, pathPoint.getY() - y); + // final double theta = Math.atan2(-pathPoint.getX() + x, + // pathPoint.getY() - y); final UPolygon triangle = new UPolygon(); triangle.addPoint(0, 0); @@ -280,21 +251,19 @@ public class PathDrawerInterface implements PathDrawer { triangle.rotate(theta); ug.draw(x, y, triangle); -// ug.getParam().setColor(Color.BLACK); final Point2D middle = triangle.getPoints().get(2); middle.setLocation(middle.getX() + x, middle.getY() + y); -// final ULine line = new ULine(pathPoint.getX() - middle.getX(), pathPoint.getY() - middle.getY()); -// ug.draw(middle.getX(), middle.getY(), line); return middle; } - private Point2D drawArrow(UGraphic ug, double x, double y, Point2D pathPoint) { - final double width = 16; - final double height = 16; - final double height2 = 7; + private Point2D drawArrow(UGraphic ug, double x, double y, double theta) { + final double width = 12; + final double height = 10; + final double height2 = 4; - final double theta = Math.atan2(-pathPoint.getX() + x, pathPoint.getY() - y); + // final double theta = Math.atan2(-pathPoint.getX() + x, + // pathPoint.getY() - y); final UPolygon triangle = new UPolygon(); triangle.addPoint(0, 0); @@ -304,10 +273,8 @@ public class PathDrawerInterface implements PathDrawer { triangle.rotate(theta); ug.draw(x, y, triangle); -// ug.getParam().setColor(Color.BLACK); final Point2D middle = triangle.getPoints().get(2); middle.setLocation(middle.getX() + x, middle.getY() + y); -// drawLine(ug, pathPoint, middle); return middle; } diff --git a/src/net/sourceforge/plantuml/posimo/PositionableUtils.java b/src/net/sourceforge/plantuml/posimo/PositionableUtils.java index ad68afeb5..ee8919b78 100644 --- a/src/net/sourceforge/plantuml/posimo/PositionableUtils.java +++ b/src/net/sourceforge/plantuml/posimo/PositionableUtils.java @@ -82,4 +82,8 @@ public class PositionableUtils { }; } + static Rectangle2D move(Rectangle2D rect, double dx, double dy) { + return new Rectangle2D.Double(rect.getX() + dx, rect.getY() + dy, rect.getWidth(), rect.getHeight()); + } + } diff --git a/src/net/sourceforge/plantuml/posimo/Racorder.java b/src/net/sourceforge/plantuml/posimo/Racorder.java new file mode 100644 index 000000000..fb824d9c4 --- /dev/null +++ b/src/net/sourceforge/plantuml/posimo/Racorder.java @@ -0,0 +1,42 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009, Arnaud Roques + * + * Project Info: http://plantuml.sourceforge.net + * + * 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 Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * [Java is a trademark or registered trademark of Sun Microsystems, Inc. + * in the United States and other countries.] + * + * Original Author: Arnaud Roques + * + * Revision $Revision: 4236 $ + * + */ +package net.sourceforge.plantuml.posimo; + +import java.awt.geom.Line2D; +import java.awt.geom.Rectangle2D; + +public interface Racorder { + public DotPath getRacordIn(Rectangle2D rect, Line2D tangeante); + public DotPath getRacordOut(Rectangle2D rect, Line2D tangeante); +} diff --git a/src/net/sourceforge/plantuml/posimo/RacorderAbstract.java b/src/net/sourceforge/plantuml/posimo/RacorderAbstract.java new file mode 100644 index 000000000..4907796f0 --- /dev/null +++ b/src/net/sourceforge/plantuml/posimo/RacorderAbstract.java @@ -0,0 +1,56 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009, Arnaud Roques + * + * Project Info: http://plantuml.sourceforge.net + * + * 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 Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * [Java is a trademark or registered trademark of Sun Microsystems, Inc. + * in the United States and other countries.] + * + * Original Author: Arnaud Roques + * + * Revision $Revision: 4236 $ + * + */ +package net.sourceforge.plantuml.posimo; + +import java.awt.geom.Line2D; +import java.awt.geom.Rectangle2D; + +public abstract class RacorderAbstract implements Racorder { + + public final DotPath getRacordOut(Rectangle2D rect, Line2D tangeante) { + tangeante = symetric(tangeante); + return getRacordIn(rect, tangeante).reverse(); + } + + private static Line2D symetric(Line2D line) { + final double x1 = line.getX1(); + final double y1 = line.getY1(); + final double x2 = line.getX2(); + final double y2 = line.getY2(); + final double dx = x2 - x1; + final double dy = y2 - y1; + return new Line2D.Double(x1, y1, x1 - dx, y1 - dy); + } + +} diff --git a/src/net/sourceforge/plantuml/posimo/RacorderFollowTangeante.java b/src/net/sourceforge/plantuml/posimo/RacorderFollowTangeante.java new file mode 100644 index 000000000..7826d355c --- /dev/null +++ b/src/net/sourceforge/plantuml/posimo/RacorderFollowTangeante.java @@ -0,0 +1,71 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009, Arnaud Roques + * + * Project Info: http://plantuml.sourceforge.net + * + * 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 Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * [Java is a trademark or registered trademark of Sun Microsystems, Inc. + * in the United States and other countries.] + * + * Original Author: Arnaud Roques + * + * Revision $Revision: 4236 $ + * + */ +package net.sourceforge.plantuml.posimo; + +import java.awt.geom.CubicCurve2D; +import java.awt.geom.Line2D; +import java.awt.geom.Point2D; +import java.awt.geom.Rectangle2D; + +public class RacorderFollowTangeante extends RacorderAbstract implements Racorder { + + public DotPath getRacordIn(Rectangle2D rect, Line2D tangeante) { + +// System.err.println("rect x=" + rect.getX() + " y=" + rect.getY() + " w=" + rect.getWidth() + " h=" +// + rect.getHeight()); +// System.err.println("tangeante (" + tangeante.getX1() + "," + tangeante.getY1() + ") (" + tangeante.getX2() +// + "," + tangeante.getY2() + ")"); + + final DotPath result = new DotPath(); + + // final Point2D inter = BezierUtils.intersect((Line2D.Double) + // tangeante, rect); + Point2D inter = new LineRectIntersection(tangeante, rect).getIntersection(); +// System.err.println("inter=" + inter); + + if (inter == null) { + final Point2D p1 = new Point2D.Double(rect.getMinX(), rect.getMinY()); + final Point2D p2 = new Point2D.Double(rect.getMaxX(), rect.getMinY()); + final Point2D p3 = new Point2D.Double(rect.getMaxX(), rect.getMaxY()); + final Point2D p4 = new Point2D.Double(rect.getMinX(), rect.getMaxY()); + + inter = LineRectIntersection.getCloser(tangeante.getP1(), p1, p2, p3, p4); + } + + final CubicCurve2D.Double curv = new CubicCurve2D.Double(tangeante.getX1(), tangeante.getY1(), + tangeante.getX1(), tangeante.getY1(), inter.getX(), inter.getY(), inter.getX(), inter.getY()); + return result.addAfter(curv); + } + +} diff --git a/src/net/sourceforge/plantuml/posimo/RacorderFollowTangeanteOld.java b/src/net/sourceforge/plantuml/posimo/RacorderFollowTangeanteOld.java new file mode 100644 index 000000000..8d79da549 --- /dev/null +++ b/src/net/sourceforge/plantuml/posimo/RacorderFollowTangeanteOld.java @@ -0,0 +1,56 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009, Arnaud Roques + * + * Project Info: http://plantuml.sourceforge.net + * + * 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 Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * [Java is a trademark or registered trademark of Sun Microsystems, Inc. + * in the United States and other countries.] + * + * Original Author: Arnaud Roques + * + * Revision $Revision: 4236 $ + * + */ +package net.sourceforge.plantuml.posimo; + +import java.awt.geom.CubicCurve2D; +import java.awt.geom.Line2D; +import java.awt.geom.Point2D; +import java.awt.geom.Rectangle2D; + +public class RacorderFollowTangeanteOld extends RacorderAbstract implements Racorder { + + public DotPath getRacordIn(Rectangle2D rect, Line2D tangeante) { + + final DotPath result = new DotPath(); + + final Point2D center = new Point2D.Double(rect.getCenterX(), rect.getCenterY()); + final Line2D.Double line = new Line2D.Double(tangeante.getP1(), center); + final Point2D inter = BezierUtils.intersect(line, rect); + + final CubicCurve2D.Double curv = new CubicCurve2D.Double(tangeante.getX1(), tangeante.getY1(), tangeante + .getX2(), tangeante.getY2(), tangeante.getX2(), tangeante.getY2(), inter.getX(), inter.getY()); + return result.addAfter(curv); + } + +} diff --git a/src/net/sourceforge/plantuml/posimo/RacorderInToCenter.java b/src/net/sourceforge/plantuml/posimo/RacorderInToCenter.java new file mode 100644 index 000000000..ce6938ce5 --- /dev/null +++ b/src/net/sourceforge/plantuml/posimo/RacorderInToCenter.java @@ -0,0 +1,55 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009, Arnaud Roques + * + * Project Info: http://plantuml.sourceforge.net + * + * 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 Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * [Java is a trademark or registered trademark of Sun Microsystems, Inc. + * in the United States and other countries.] + * + * Original Author: Arnaud Roques + * + * Revision $Revision: 4236 $ + * + */ +package net.sourceforge.plantuml.posimo; + +import java.awt.geom.CubicCurve2D; +import java.awt.geom.Line2D; +import java.awt.geom.Point2D; +import java.awt.geom.Rectangle2D; + +public class RacorderInToCenter extends RacorderAbstract implements Racorder { + + public DotPath getRacordIn(Rectangle2D rect, Line2D tangeante) { + final DotPath result = new DotPath(); + + final Point2D center = new Point2D.Double(rect.getCenterX(), rect.getCenterY()); + final Line2D.Double line = new Line2D.Double(tangeante.getP1(), center); + final Point2D inter = BezierUtils.intersect(line, rect); + + final CubicCurve2D.Double curv = new CubicCurve2D.Double(line.getX1(), line.getY1(), line.getX1(), + line.getY1(), inter.getX(), inter.getY(), inter.getX(), inter.getY()); + return result.addAfter(curv); + } + +} diff --git a/src/net/sourceforge/plantuml/posimo/RacorderOrthogonal.java b/src/net/sourceforge/plantuml/posimo/RacorderOrthogonal.java new file mode 100644 index 000000000..de0708658 --- /dev/null +++ b/src/net/sourceforge/plantuml/posimo/RacorderOrthogonal.java @@ -0,0 +1,81 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009, Arnaud Roques + * + * Project Info: http://plantuml.sourceforge.net + * + * 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 Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * [Java is a trademark or registered trademark of Sun Microsystems, Inc. + * in the United States and other countries.] + * + * Original Author: Arnaud Roques + * + * Revision $Revision: 4236 $ + * + */ +package net.sourceforge.plantuml.posimo; + +import java.awt.geom.CubicCurve2D; +import java.awt.geom.Line2D; +import java.awt.geom.Point2D; +import java.awt.geom.Rectangle2D; + +public class RacorderOrthogonal extends RacorderAbstract implements Racorder { + + public DotPath getRacordIn(Rectangle2D rect, Line2D tangeante) { + + final Point2D in = tangeante.getP1(); + + final DotPath result = new DotPath(); + Point2D inter = null; + + if (in.getX() > rect.getMinX() && in.getX() < rect.getMaxX()) { + if (in.getY() < rect.getMinY()) { + inter = new Point2D.Double(in.getX(), rect.getMinY()); + } else if (in.getY() > rect.getMaxY()) { + inter = new Point2D.Double(in.getX(), rect.getMaxY()); + } else { + throw new IllegalArgumentException(); + } + } else if (in.getY() > rect.getMinY() && in.getY() < rect.getMaxY()) { + if (in.getX() < rect.getMinX()) { + inter = new Point2D.Double(rect.getMinX(), in.getY()); + } else if (in.getX() > rect.getMaxX()) { + inter = new Point2D.Double(rect.getMaxX(), in.getY()); + } else { + throw new IllegalArgumentException(); + } + } else { + final Point2D p1 = new Point2D.Double(rect.getMinX(), rect.getMinY()); + final Point2D p2 = new Point2D.Double(rect.getMaxX(), rect.getMinY()); + final Point2D p3 = new Point2D.Double(rect.getMaxX(), rect.getMaxY()); + final Point2D p4 = new Point2D.Double(rect.getMinX(), rect.getMaxY()); + + inter = LineRectIntersection.getCloser(tangeante.getP1(), p1, p2, p3, p4); + + } + + final CubicCurve2D.Double curv = new CubicCurve2D.Double(tangeante.getX1(), tangeante.getY1(), + tangeante.getX1(), tangeante.getY1(), inter.getX(), inter.getY(), inter.getX(), inter.getY()); + return result.addAfter(curv); + } + +} diff --git a/src/net/sourceforge/plantuml/posimo/TwoLinesIntersection.java b/src/net/sourceforge/plantuml/posimo/TwoLinesIntersection.java new file mode 100644 index 000000000..15f25c2f9 --- /dev/null +++ b/src/net/sourceforge/plantuml/posimo/TwoLinesIntersection.java @@ -0,0 +1,71 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009, Arnaud Roques + * + * Project Info: http://plantuml.sourceforge.net + * + * 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 Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * [Java is a trademark or registered trademark of Sun Microsystems, Inc. + * in the United States and other countries.] + * + * Original Author: Arnaud Roques + * + * Revision $Revision: 4236 $ + * + */ +package net.sourceforge.plantuml.posimo; + +import java.awt.geom.Line2D; +import java.awt.geom.Point2D; + +public class TwoLinesIntersection { + + private final Point2D inter; + + public TwoLinesIntersection(Line2D lineA, Line2D lineB) { + final double x1 = lineA.getX1(); + final double y1 = lineA.getY1(); + final double x2 = lineA.getX2(); + final double y2 = lineA.getY2(); + final double x3 = lineB.getX1(); + final double y3 = lineB.getY1(); + final double x4 = lineB.getX2(); + final double y4 = lineB.getY2(); + + final double den = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1); + + final double uA1 = (x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3); + final double uA = uA1 / den; + + // final double uB1 = (x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3); + // uB = uB1 / den; + + final double x = x1 + uA * (x2 - x1); + final double y = y1 + uA * (y2 - y1); + + inter = new Point2D.Double(x, y); + } + + public final Point2D getIntersection() { + return inter; + } + +} diff --git a/src/net/sourceforge/plantuml/sequencediagram/graphic/LifeLine.java b/src/net/sourceforge/plantuml/sequencediagram/graphic/LifeLine.java index 448949758..b6f4fa808 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/graphic/LifeLine.java +++ b/src/net/sourceforge/plantuml/sequencediagram/graphic/LifeLine.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 5275 $ + * Revision $Revision: 5636 $ * */ package net.sourceforge.plantuml.sequencediagram.graphic; @@ -82,7 +82,7 @@ class LifeLine { if (y < last.y) { throw new IllegalArgumentException(); } - if (y==last.y && type != last.type) { + if (y == last.y && type != last.type) { throw new IllegalArgumentException(); } } @@ -119,8 +119,12 @@ class LifeLine { level++; } else { level--; + if (level < 0) { + level = 0; + } } } + assert level >= 0; return level; } @@ -192,10 +196,9 @@ class LifeLine { return new Segment(events.get(i).y, events.get(events.size() - 1).y, events.get(i).backcolor); } - public void drawU(UGraphic ug, Skin skin, ISkinParam skinParam) { final StringBounder stringBounder = ug.getStringBounder(); - + final double atX = ug.getTranslateX(); final double atY = ug.getTranslateY(); diff --git a/src/net/sourceforge/plantuml/sequencediagram/graphic/LivingParticipantBox.java b/src/net/sourceforge/plantuml/sequencediagram/graphic/LivingParticipantBox.java index a655054a7..df54def1a 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/graphic/LivingParticipantBox.java +++ b/src/net/sourceforge/plantuml/sequencediagram/graphic/LivingParticipantBox.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 5114 $ + * Revision $Revision: 5636 $ * */ package net.sourceforge.plantuml.sequencediagram.graphic; @@ -65,7 +65,7 @@ public class LivingParticipantBox implements InGroupable { final double left = lifeLine.getLeftShift(y); assert left >= 0; final double right = lifeLine.getRightShift(y); - assert right >= 0; + assert right >= 0 : "right=" + right; final double centerX = participantBox.getCenterX(stringBounder); // System.err.println("Attention, null for segment"); return new Segment(centerX - left, centerX + right, null); diff --git a/src/net/sourceforge/plantuml/skin/VisibilityModifier.java b/src/net/sourceforge/plantuml/skin/VisibilityModifier.java index 88d0dd78b..f271a9275 100644 --- a/src/net/sourceforge/plantuml/skin/VisibilityModifier.java +++ b/src/net/sourceforge/plantuml/skin/VisibilityModifier.java @@ -34,8 +34,13 @@ package net.sourceforge.plantuml.skin; import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.ColorParam; +import net.sourceforge.plantuml.Dimension2DDouble; +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.UPolygon; @@ -50,12 +55,12 @@ public enum VisibilityModifier { ColorParam.iconPackage, ColorParam.iconPackageBackground), PUBLIC_METHOD(ColorParam.iconPublic, ColorParam.iconPublicBackground); - private final ColorParam foreground; - private final ColorParam background; + private final ColorParam foregroundParam; + private final ColorParam backgroundParam; private VisibilityModifier(ColorParam foreground, ColorParam background) { - this.foreground = foreground; - this.background = background; + this.foregroundParam = foreground; + this.backgroundParam = background; } public UDrawable getUDrawable(final int size, final Color foregroundColor, final Color backgoundColor) { @@ -66,6 +71,27 @@ public enum VisibilityModifier { }; } + public TextBlock getUBlock(final int size, final Color foregroundColor, final Color backgoundColor) { + return new TextBlock() { + + public Dimension2D calculateDimension(StringBounder stringBounder) { + return new Dimension2DDouble(size + 1, size + 1); + } + + public void drawTOBEREMOVED(Graphics2D g2d, double x, double y) { + throw new UnsupportedOperationException(); + } + + public void drawU(UGraphic ug, double x, double y) { + final double tx = ug.getTranslateX(); + final double ty = ug.getTranslateY(); + ug.translate(x, y); + drawInternal(ug, size, foregroundColor, backgoundColor); + ug.setTranslate(tx, ty); + } + }; + } + private void drawInternal(UGraphic ug, int size, final Color foregroundColor, final Color backgoundColor) { ug.getParam().setBackcolor(backgoundColor); ug.getParam().setColor(foregroundColor); @@ -198,11 +224,11 @@ public enum VisibilityModifier { } public final ColorParam getForeground() { - return foreground; + return foregroundParam; } public final ColorParam getBackground() { - return background; + return backgroundParam; } } diff --git a/src/net/sourceforge/plantuml/ugraphic/AbstractPlacementStrategy.java b/src/net/sourceforge/plantuml/ugraphic/AbstractPlacementStrategy.java new file mode 100644 index 000000000..a6f9fb030 --- /dev/null +++ b/src/net/sourceforge/plantuml/ugraphic/AbstractPlacementStrategy.java @@ -0,0 +1,109 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009, Arnaud Roques + * + * Project Info: http://plantuml.sourceforge.net + * + * 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 Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * [Java is a trademark or registered trademark of Sun Microsystems, Inc. + * in the United States and other countries.] + * + * Original Author: Arnaud Roques + * + * Revision $Revision: 3837 $ + * + */ +package net.sourceforge.plantuml.ugraphic; + +import java.awt.geom.Dimension2D; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.Map; + +import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.TextBlock; + +public abstract class AbstractPlacementStrategy implements PlacementStrategy { + + private final StringBounder stringBounder; + private final Map dimensions = new LinkedHashMap(); + + public AbstractPlacementStrategy(StringBounder stringBounder) { + this.stringBounder = stringBounder; + } + + public void add(TextBlock block) { + this.dimensions.put(block, block.calculateDimension(stringBounder)); + } + + protected Map getDimensions() { + return dimensions; + } + + protected double getSumWidth() { + return getSumWidth(dimensions.values().iterator()); + } + + protected double getSumHeight() { + return getSumHeight(dimensions.values().iterator()); + } + + protected double getMaxHeight() { + return getMaxHeight(dimensions.values().iterator()); + } + + protected double getMaxWidth() { + return getMaxWidth(dimensions.values().iterator()); + } + + protected double getSumWidth(Iterator it) { + double result = 0; + while (it.hasNext()) { + result += it.next().getWidth(); + } + return result; + } + + protected double getSumHeight(Iterator it) { + double result = 0; + while (it.hasNext()) { + result += it.next().getHeight(); + } + return result; + } + + protected double getMaxWidth(Iterator it) { + double result = 0; + while (it.hasNext()) { + result = Math.max(result, it.next().getWidth()); + } + return result; + } + + protected double getMaxHeight(Iterator it) { + double result = 0; + while (it.hasNext()) { + result = Math.max(result, it.next().getHeight()); + } + return result; + } + +} diff --git a/src/net/sourceforge/plantuml/ugraphic/PlacementStrategy.java b/src/net/sourceforge/plantuml/ugraphic/PlacementStrategy.java new file mode 100644 index 000000000..ff07fe9f3 --- /dev/null +++ b/src/net/sourceforge/plantuml/ugraphic/PlacementStrategy.java @@ -0,0 +1,47 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009, Arnaud Roques + * + * Project Info: http://plantuml.sourceforge.net + * + * 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 Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * [Java is a trademark or registered trademark of Sun Microsystems, Inc. + * in the United States and other countries.] + * + * Original Author: Arnaud Roques + * + * Revision $Revision: 3837 $ + * + */ +package net.sourceforge.plantuml.ugraphic; + +import java.awt.geom.Point2D; +import java.util.Map; + +import net.sourceforge.plantuml.graphic.TextBlock; + +public interface PlacementStrategy { + + public void add(TextBlock block); + + public Map getPositions(double width, double height); + +} diff --git a/src/net/sourceforge/plantuml/ugraphic/PlacementStrategyVisibility.java b/src/net/sourceforge/plantuml/ugraphic/PlacementStrategyVisibility.java new file mode 100644 index 000000000..a6941754c --- /dev/null +++ b/src/net/sourceforge/plantuml/ugraphic/PlacementStrategyVisibility.java @@ -0,0 +1,70 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009, Arnaud Roques + * + * Project Info: http://plantuml.sourceforge.net + * + * 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 Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * [Java is a trademark or registered trademark of Sun Microsystems, Inc. + * in the United States and other countries.] + * + * Original Author: Arnaud Roques + * + * Revision $Revision: 3837 $ + * + */ +package net.sourceforge.plantuml.ugraphic; + +import java.awt.geom.Dimension2D; +import java.awt.geom.Point2D; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.Map; + +import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.TextBlock; + +public class PlacementStrategyVisibility extends AbstractPlacementStrategy { + + private final int col2; + + public PlacementStrategyVisibility(StringBounder stringBounder, int col2) { + super(stringBounder); + this.col2 = col2; + } + + public Map getPositions(double width, double height) { + final Map result = new LinkedHashMap(); + double y = 0; + for (Iterator> it = getDimensions().entrySet().iterator(); it.hasNext();) { + Map.Entry ent1 = it.next(); + Map.Entry ent2 = it.next(); + final double height1 = ent1.getValue().getHeight(); + final double height2 = ent2.getValue().getHeight(); + final double maxHeight = Math.max(height1, height2); + result.put(ent1.getKey(), new Point2D.Double(0, 2 + y + (maxHeight - height1) / 2)); + result.put(ent2.getKey(), new Point2D.Double(col2, y + (maxHeight - height2) / 2)); + y += maxHeight; + } + return result; + } + +} diff --git a/src/net/sourceforge/plantuml/ugraphic/PlacementStrategyX1X2.java b/src/net/sourceforge/plantuml/ugraphic/PlacementStrategyX1X2.java new file mode 100644 index 000000000..70999b059 --- /dev/null +++ b/src/net/sourceforge/plantuml/ugraphic/PlacementStrategyX1X2.java @@ -0,0 +1,65 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009, Arnaud Roques + * + * Project Info: http://plantuml.sourceforge.net + * + * 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 Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * [Java is a trademark or registered trademark of Sun Microsystems, Inc. + * in the United States and other countries.] + * + * Original Author: Arnaud Roques + * + * Revision $Revision: 3837 $ + * + */ +package net.sourceforge.plantuml.ugraphic; + +import java.awt.geom.Dimension2D; +import java.awt.geom.Point2D; +import java.util.LinkedHashMap; +import java.util.Map; + +import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.TextBlock; + +public class PlacementStrategyX1X2 extends AbstractPlacementStrategy { + + public PlacementStrategyX1X2(StringBounder stringBounder) { + super(stringBounder); + } + + public Map getPositions(double width, double height) { + double usedWidth = getSumWidth(); + //double maxHeight = getMaxHeight(); + + final double space = (width - usedWidth) / (getDimensions().size() + 1); + final Map result = new LinkedHashMap(); + double x = space; + for (Map.Entry ent : getDimensions().entrySet()) { + final double y = (height - ent.getValue().getHeight()) / 2; + result.put(ent.getKey(), new Point2D.Double(x, y)); + x += ent.getValue().getWidth() + space; + } + return result; + } + +} diff --git a/src/net/sourceforge/plantuml/ugraphic/PlacementStrategyX1Y2Y3.java b/src/net/sourceforge/plantuml/ugraphic/PlacementStrategyX1Y2Y3.java new file mode 100644 index 000000000..c0fae4371 --- /dev/null +++ b/src/net/sourceforge/plantuml/ugraphic/PlacementStrategyX1Y2Y3.java @@ -0,0 +1,84 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009, Arnaud Roques + * + * Project Info: http://plantuml.sourceforge.net + * + * 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 Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * [Java is a trademark or registered trademark of Sun Microsystems, Inc. + * in the United States and other countries.] + * + * Original Author: Arnaud Roques + * + * Revision $Revision: 3837 $ + * + */ +package net.sourceforge.plantuml.ugraphic; + +import java.awt.geom.Dimension2D; +import java.awt.geom.Point2D; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.Map; + +import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.TextBlock; + +public class PlacementStrategyX1Y2Y3 extends AbstractPlacementStrategy { + + public PlacementStrategyX1Y2Y3(StringBounder stringBounder) { + super(stringBounder); + } + + public Map getPositions(double width, double height) { + final Dimension2D first = getDimensions().values().iterator().next(); + + double maxWidthButFirst = getMaxWidth(butFirst()); + double sumHeightButFirst = getSumHeight(butFirst()); + + final double space = (width - first.getWidth() - maxWidthButFirst) / 5; + + final Map result = new LinkedHashMap(); + double x = space * 2; + + final Iterator> it = getDimensions().entrySet().iterator(); + final Map.Entry ent = it.next(); + double y = (height - ent.getValue().getHeight()) / 2; + result.put(ent.getKey(), new Point2D.Double(x, y)); + + x += ent.getValue().getWidth() + space; + + y = (height - sumHeightButFirst) / 2; + while (it.hasNext()) { + final Map.Entry ent2 = it.next(); + result.put(ent2.getKey(), new Point2D.Double(x, y)); + y += ent2.getValue().getHeight(); + } + return result; + } + + private Iterator butFirst() { + final Iterator iterator = getDimensions().values().iterator(); + iterator.next(); + return iterator; + } + +} diff --git a/src/net/sourceforge/plantuml/ugraphic/PlacementStrategyY1Y2.java b/src/net/sourceforge/plantuml/ugraphic/PlacementStrategyY1Y2.java new file mode 100644 index 000000000..f4ac3101c --- /dev/null +++ b/src/net/sourceforge/plantuml/ugraphic/PlacementStrategyY1Y2.java @@ -0,0 +1,65 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009, Arnaud Roques + * + * Project Info: http://plantuml.sourceforge.net + * + * 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 Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * [Java is a trademark or registered trademark of Sun Microsystems, Inc. + * in the United States and other countries.] + * + * Original Author: Arnaud Roques + * + * Revision $Revision: 3837 $ + * + */ +package net.sourceforge.plantuml.ugraphic; + +import java.awt.geom.Dimension2D; +import java.awt.geom.Point2D; +import java.util.LinkedHashMap; +import java.util.Map; + +import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.TextBlock; + +public class PlacementStrategyY1Y2 extends AbstractPlacementStrategy { + + public PlacementStrategyY1Y2(StringBounder stringBounder) { + super(stringBounder); + } + + public Map getPositions(double width, double height) { + double usedHeight = getSumHeight(); + //double maxWidth = getMaxWidth(); + + final double space = (height - usedHeight) / (getDimensions().size() + 1); + final Map result = new LinkedHashMap(); + double y = space; + for (Map.Entry ent : getDimensions().entrySet()) { + final double x = (width - ent.getValue().getWidth()) / 2; + result.put(ent.getKey(), new Point2D.Double(x, y)); + y += ent.getValue().getHeight() + space; + } + return result; + } + +} diff --git a/src/net/sourceforge/plantuml/ugraphic/PlacementStrategyY1Y2Left.java b/src/net/sourceforge/plantuml/ugraphic/PlacementStrategyY1Y2Left.java new file mode 100644 index 000000000..c69641fd8 --- /dev/null +++ b/src/net/sourceforge/plantuml/ugraphic/PlacementStrategyY1Y2Left.java @@ -0,0 +1,65 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009, Arnaud Roques + * + * Project Info: http://plantuml.sourceforge.net + * + * 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 Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * [Java is a trademark or registered trademark of Sun Microsystems, Inc. + * in the United States and other countries.] + * + * Original Author: Arnaud Roques + * + * Revision $Revision: 3837 $ + * + */ +package net.sourceforge.plantuml.ugraphic; + +import java.awt.geom.Dimension2D; +import java.awt.geom.Point2D; +import java.util.LinkedHashMap; +import java.util.Map; + +import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.TextBlock; + +public class PlacementStrategyY1Y2Left extends AbstractPlacementStrategy { + + public PlacementStrategyY1Y2Left(StringBounder stringBounder) { + super(stringBounder); + } + + public Map getPositions(double width, double height) { + double usedHeight = getSumHeight(); + //double maxWidth = getMaxWidth(); + + final double space = (height - usedHeight) / (getDimensions().size() + 1); + final Map result = new LinkedHashMap(); + double y = space; + for (Map.Entry ent : getDimensions().entrySet()) { + final double x = 0; + result.put(ent.getKey(), new Point2D.Double(x, y)); + y += ent.getValue().getHeight() + space; + } + return result; + } + +} diff --git a/src/net/sourceforge/plantuml/ugraphic/UGroup.java b/src/net/sourceforge/plantuml/ugraphic/UGroup.java new file mode 100644 index 000000000..1e78fc96e --- /dev/null +++ b/src/net/sourceforge/plantuml/ugraphic/UGroup.java @@ -0,0 +1,63 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009, Arnaud Roques + * + * Project Info: http://plantuml.sourceforge.net + * + * 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 Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * [Java is a trademark or registered trademark of Sun Microsystems, Inc. + * in the United States and other countries.] + * + * Original Author: Arnaud Roques + * + * Revision $Revision: 3837 $ + * + */ +package net.sourceforge.plantuml.ugraphic; + +import java.awt.geom.Dimension2D; +import java.awt.geom.Point2D; +import java.util.Map; + +import net.sourceforge.plantuml.graphic.TextBlock; + +public class UGroup { + + private final PlacementStrategy placementStrategy; + + public UGroup(PlacementStrategy placementStrategy) { + this.placementStrategy = placementStrategy; + } + + public void drawU(UGraphic ug, double x, double y, double width, double height) { + for (Map.Entry ent : placementStrategy.getPositions(width, height).entrySet()) { + final TextBlock block = ent.getKey(); + final Point2D pos = ent.getValue(); + block.drawU(ug, x + pos.getX(), y + pos.getY()); + } + } + + public void add(TextBlock block) { + placementStrategy.add(block); + + } + +} diff --git a/src/net/sourceforge/plantuml/version/Version.java b/src/net/sourceforge/plantuml/version/Version.java index 889b345af..2af35dff3 100644 --- a/src/net/sourceforge/plantuml/version/Version.java +++ b/src/net/sourceforge/plantuml/version/Version.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 5539 $ + * Revision $Revision: 5659 $ * */ package net.sourceforge.plantuml.version; @@ -36,11 +36,11 @@ package net.sourceforge.plantuml.version; public class Version { public static int version() { - return 5538; + return 5658; } public static long compileTime() { - return 1288721031328L; + return 1290708052921L; } } diff --git a/src/pom.xml b/src/pom.xml new file mode 100644 index 000000000..02af55387 --- /dev/null +++ b/src/pom.xml @@ -0,0 +1,187 @@ + + + + 4.0.0 + + net.sourceforge.plantuml + plantuml + 1.0.5636-SNAPSHOT + jar + + PlantUML + + PlantUML is a component that allows to quickly write : + * sequence diagram, + * use case diagram, + * class diagram, + * activity diagram, + * component diagram, + * state diagram + * object diagram + + http://plantuml.sourceforge.net + + + org.sonatype.oss + oss-parent + 5 + + + + + org.apache.ant + ant + 1.8.1 + provided + + + + + + The GNU General Public License + http://www.gnu.org/licenses/gpl.txt + repo + + + + + http://plantuml.svn.sourceforge.net/viewvc/plantuml + https://plantuml.svn.sourceforge.net/svnroot/plantuml + + + + Sourceforge + http://sourceforge.net/tracker/?group_id=259736 + + + + + arnaud.roques + Arnaud Roques + plantuml@gmail.com + + + + + ${project.basedir}/src + + + ${project.basedir}/src + + net/sourceforge/plantuml/version/logo.png + + + + + + maven-compiler-plugin + 2.3.2 + + 1.5 + 1.5 + false + + + + maven-source-plugin + + + attach-sources + + jar + + + + + + maven-javadoc-plugin + + + attach-javadocs + + jar + + + + + + maven-jar-plugin + + + + net.sourceforge.plantuml.Run + + + + + + maven-release-plugin + 2.1 + + forked-path + + + + + + + + release-sign-artifacts + + + performRelease + true + + + + + + maven-gpg-plugin + 1.1 + + + sign-artifacts + verify + + sign + + + + + + + + + +