mirror of
https://github.com/octoleo/plantuml.git
synced 2024-12-23 03:19:06 +00:00
Remove unused files
This commit is contained in:
parent
e6437ce908
commit
ad2e9d5fb3
@ -1,112 +0,0 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2020, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* If you like this project or if you find it useful, you can support us at:
|
||||
*
|
||||
* http://plantuml.com/patreon (only 1$ per month!)
|
||||
* http://plantuml.com/paypal
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.postit;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class Area implements Elastic {
|
||||
|
||||
private final String title;
|
||||
private final char id;
|
||||
|
||||
private Dimension2D minimumDimension;
|
||||
|
||||
private final List<PostIt> postIts = new ArrayList<PostIt>();
|
||||
|
||||
public Area(char id, String title) {
|
||||
this.id = id;
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public char getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public Dimension2D getMinimumDimension() {
|
||||
return minimumDimension;
|
||||
}
|
||||
|
||||
public void setMinimunDimension(Dimension2D minimumDimension) {
|
||||
this.minimumDimension = minimumDimension;
|
||||
}
|
||||
|
||||
public Dimension2D getDimension() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public double heightWhenWidthIs(double width, StringBounder stringBounder) {
|
||||
final AreaLayoutFixedWidth layout = new AreaLayoutFixedWidth(width);
|
||||
final Map<PostIt, Point2D> pos = layout.getPositions(postIts, stringBounder);
|
||||
double max = 10;
|
||||
for (Map.Entry<PostIt, Point2D> ent : pos.entrySet()) {
|
||||
final double y = ent.getKey().getDimension(stringBounder).getHeight() + ent.getValue().getY();
|
||||
max = Math.max(max, y);
|
||||
}
|
||||
|
||||
return max + 10;
|
||||
}
|
||||
|
||||
public double widthWhenHeightIs(double height, StringBounder stringBounder) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public void add(PostIt postIt) {
|
||||
postIts.add(postIt);
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug, double width) {
|
||||
final AreaLayout layout = new AreaLayoutFixedWidth(width);
|
||||
final Map<PostIt, Point2D> pos = layout.getPositions(postIts, ug.getStringBounder());
|
||||
for (Map.Entry<PostIt, Point2D> ent : pos.entrySet()) {
|
||||
final UGraphic ugTranslated = ug.apply(new UTranslate(ent.getValue().getX(), ent.getValue().getY()));
|
||||
ent.getKey().drawU(ugTranslated);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2020, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* If you like this project or if you find it useful, you can support us at:
|
||||
*
|
||||
* http://plantuml.com/patreon (only 1$ per month!)
|
||||
* http://plantuml.com/paypal
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.postit;
|
||||
|
||||
import java.awt.geom.Point2D;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
|
||||
public interface AreaLayout {
|
||||
|
||||
Map<PostIt, Point2D> getPositions(Collection<PostIt> all, StringBounder stringBounder);
|
||||
|
||||
}
|
@ -1,75 +0,0 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2020, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* If you like this project or if you find it useful, you can support us at:
|
||||
*
|
||||
* http://plantuml.com/patreon (only 1$ per month!)
|
||||
* http://plantuml.com/paypal
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.postit;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
|
||||
public class AreaLayoutFixedWidth implements AreaLayout {
|
||||
|
||||
private final double width;
|
||||
|
||||
public AreaLayoutFixedWidth(double width) {
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
public Map<PostIt, Point2D> getPositions(Collection<PostIt> all, StringBounder stringBounder) {
|
||||
double x = 0;
|
||||
double y = 0;
|
||||
double maxY = 0;
|
||||
final Map<PostIt, Point2D> result = new LinkedHashMap<PostIt, Point2D>();
|
||||
|
||||
for (PostIt p : all) {
|
||||
final Dimension2D dim = p.getDimension(stringBounder);
|
||||
if (x + dim.getWidth() > width) {
|
||||
x = 0;
|
||||
y = maxY;
|
||||
}
|
||||
result.put(p, new Point2D.Double(x, y));
|
||||
x += dim.getWidth();
|
||||
maxY = Math.max(maxY, y + dim.getHeight());
|
||||
}
|
||||
|
||||
return Collections.unmodifiableMap(result);
|
||||
}
|
||||
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2020, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* If you like this project or if you find it useful, you can support us at:
|
||||
*
|
||||
* http://plantuml.com/patreon (only 1$ per month!)
|
||||
* http://plantuml.com/paypal
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.postit;
|
||||
|
||||
import net.sourceforge.plantuml.LineLocation;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
import net.sourceforge.plantuml.command.SingleLineCommand2;
|
||||
import net.sourceforge.plantuml.command.regex.IRegex;
|
||||
import net.sourceforge.plantuml.command.regex.RegexConcat;
|
||||
import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
|
||||
public class CommandCreatePostIt extends SingleLineCommand2<PostItDiagram> {
|
||||
|
||||
public CommandCreatePostIt() {
|
||||
super(getRegexConcat());
|
||||
}
|
||||
|
||||
static IRegex getRegexConcat() {
|
||||
return RegexConcat.build(CommandCreatePostIt.class.getName(), RegexLeaf.start(), //
|
||||
new RegexLeaf("post[-[%s]]?it"), //
|
||||
RegexLeaf.spaceOneOrMore(), //
|
||||
new RegexLeaf("ID", "([-\\p{L}0-9_./]+)"), //
|
||||
RegexLeaf.spaceOneOrMore(), new RegexLeaf("TEXT", ":?(.*)?$"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(PostItDiagram diagram, LineLocation location, RegexResult arg) {
|
||||
final String id = arg.get("ID", 0);
|
||||
final String text = arg.get("TEXT", 0);
|
||||
diagram.createPostIt(id, Display.getWithNewlines(text));
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2020, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* If you like this project or if you find it useful, you can support us at:
|
||||
*
|
||||
* http://plantuml.com/patreon (only 1$ per month!)
|
||||
* http://plantuml.com/paypal
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.postit;
|
||||
|
||||
import net.sourceforge.plantuml.LineLocation;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
import net.sourceforge.plantuml.command.SingleLineCommand2;
|
||||
import net.sourceforge.plantuml.command.regex.IRegex;
|
||||
import net.sourceforge.plantuml.command.regex.RegexConcat;
|
||||
import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
|
||||
public class CommandWidth extends SingleLineCommand2<PostItDiagram> {
|
||||
|
||||
public CommandWidth() {
|
||||
super(getRegexConcat());
|
||||
}
|
||||
|
||||
static IRegex getRegexConcat() {
|
||||
return RegexConcat.build(CommandWidth.class.getName(), RegexLeaf.start(), //
|
||||
new RegexLeaf("width"), //
|
||||
RegexLeaf.spaceOneOrMore(), //
|
||||
new RegexLeaf("WIDTH", "(\\d+)"), RegexLeaf.end()); //
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(PostItDiagram system, LineLocation location, RegexResult arg) {
|
||||
final int width = Integer.parseInt(arg.get("WIDTH", 0));
|
||||
system.setWidth(width);
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2020, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* If you like this project or if you find it useful, you can support us at:
|
||||
*
|
||||
* http://plantuml.com/patreon (only 1$ per month!)
|
||||
* http://plantuml.com/paypal
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.postit;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
|
||||
public interface Elastic {
|
||||
|
||||
double widthWhenHeightIs(double height, StringBounder stringBounder);
|
||||
|
||||
double heightWhenWidthIs(double width, StringBounder stringBounder);
|
||||
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2020, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* If you like this project or if you find it useful, you can support us at:
|
||||
*
|
||||
* http://plantuml.com/patreon (only 1$ per month!)
|
||||
* http://plantuml.com/paypal
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.postit;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.command.Command;
|
||||
import net.sourceforge.plantuml.command.PSystemCommandFactory;
|
||||
|
||||
public class PostIdDiagramFactory extends PSystemCommandFactory {
|
||||
|
||||
@Override
|
||||
protected List<Command> createCommands() {
|
||||
final List<Command> cmds = new ArrayList<Command>();
|
||||
addCommonCommands1(cmds);
|
||||
cmds.add(new CommandCreatePostIt());
|
||||
cmds.add(new CommandWidth());
|
||||
return cmds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PostItDiagram createEmptyDiagram() {
|
||||
return new PostItDiagram();
|
||||
}
|
||||
|
||||
}
|
@ -1,124 +0,0 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2020, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* If you like this project or if you find it useful, you can support us at:
|
||||
*
|
||||
* http://plantuml.com/patreon (only 1$ per month!)
|
||||
* http://plantuml.com/paypal
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.postit;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.SkinParam;
|
||||
import net.sourceforge.plantuml.SpriteContainerEmpty;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.SymbolContext;
|
||||
import net.sourceforge.plantuml.skin.Area;
|
||||
import net.sourceforge.plantuml.skin.Component;
|
||||
import net.sourceforge.plantuml.skin.SimpleContext2D;
|
||||
import net.sourceforge.plantuml.skin.rose.ComponentRoseNote;
|
||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorSet;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
|
||||
|
||||
public class PostIt {
|
||||
|
||||
private final String id;
|
||||
private final Display text;
|
||||
|
||||
private Dimension2D minimumDimension;
|
||||
|
||||
public PostIt(String id, Display text) {
|
||||
this.id = id;
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public Display getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public Dimension2D getMinimumDimension() {
|
||||
return minimumDimension;
|
||||
}
|
||||
|
||||
public void setMinimumDimension(Dimension2D minimumDimension) {
|
||||
this.minimumDimension = minimumDimension;
|
||||
}
|
||||
|
||||
public Dimension2D getDimension(StringBounder stringBounder) {
|
||||
double width = getComponent().getPreferredWidth(stringBounder);
|
||||
double height = getComponent().getPreferredHeight(stringBounder);
|
||||
|
||||
if (minimumDimension != null && width < minimumDimension.getWidth()) {
|
||||
width = minimumDimension.getWidth();
|
||||
}
|
||||
if (minimumDimension != null && height < minimumDimension.getHeight()) {
|
||||
height = minimumDimension.getHeight();
|
||||
}
|
||||
|
||||
return new Dimension2DDouble(width, height);
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
|
||||
final Component note = getComponent();
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final Dimension2D dimensionToUse = getDimension(stringBounder);
|
||||
|
||||
note.drawU(ug, new Area(dimensionToUse), new SimpleContext2D(false));
|
||||
|
||||
}
|
||||
|
||||
private Component getComponent() {
|
||||
final HColor noteBackgroundColor = HColorSet.instance().getColorOrWhite("#FBFB77");
|
||||
final HColor borderColor = HColorUtils.MY_RED;
|
||||
|
||||
final SkinParam param = SkinParam.noShadowing(null);
|
||||
final UFont fontNote = param.getFont(null, false, FontParam.NOTE);
|
||||
final FontConfiguration font2 = fontNote.toFont2(HColorUtils.BLACK, true, HColorUtils.BLUE, 8);
|
||||
final ComponentRoseNote note = new ComponentRoseNote(null,
|
||||
new SymbolContext(noteBackgroundColor, borderColor).withStroke(new UStroke()), font2, text, 0, 0,
|
||||
new SpriteContainerEmpty(), 0, HorizontalAlignment.LEFT);
|
||||
return note;
|
||||
}
|
||||
}
|
@ -1,140 +0,0 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2020, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* If you like this project or if you find it useful, you can support us at:
|
||||
*
|
||||
* http://plantuml.com/patreon (only 1$ per month!)
|
||||
* http://plantuml.com/paypal
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.postit;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sourceforge.plantuml.EmptyImageBuilder;
|
||||
import net.sourceforge.plantuml.FileFormat;
|
||||
import net.sourceforge.plantuml.FileFormatOption;
|
||||
import net.sourceforge.plantuml.UmlDiagram;
|
||||
import net.sourceforge.plantuml.UmlDiagramType;
|
||||
import net.sourceforge.plantuml.api.ImageDataSimple;
|
||||
import net.sourceforge.plantuml.core.DiagramDescription;
|
||||
import net.sourceforge.plantuml.core.ImageData;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.png.PngIO;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity;
|
||||
import net.sourceforge.plantuml.ugraphic.eps.UGraphicEps;
|
||||
import net.sourceforge.plantuml.ugraphic.g2d.UGraphicG2d;
|
||||
import net.sourceforge.plantuml.ugraphic.svg.UGraphicSvg;
|
||||
|
||||
public class PostItDiagram extends UmlDiagram {
|
||||
|
||||
private final Area defaultArea = new Area('\0', null);
|
||||
|
||||
private final Map<String, PostIt> postIts = new HashMap<String, PostIt>();
|
||||
|
||||
public PostItDiagram() {
|
||||
super(UmlDiagramType.TIMING);
|
||||
}
|
||||
|
||||
@Override
|
||||
final protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption)
|
||||
throws IOException {
|
||||
final UGraphic ug = createImage(fileFormatOption);
|
||||
drawU(ug);
|
||||
if (ug instanceof UGraphicG2d) {
|
||||
final BufferedImage im = ((UGraphicG2d) ug).getBufferedImage();
|
||||
PngIO.write(im, os, fileFormatOption.isWithMetadata() ? getMetadata() : null, 96);
|
||||
} else if (ug instanceof UGraphicSvg) {
|
||||
final UGraphicSvg svg = (UGraphicSvg) ug;
|
||||
svg.createXml(os, fileFormatOption.isWithMetadata() ? getMetadata() : null);
|
||||
} else if (ug instanceof UGraphicEps) {
|
||||
final UGraphicEps eps = (UGraphicEps) ug;
|
||||
os.write(eps.getEPSCode().getBytes());
|
||||
}
|
||||
return ImageDataSimple.ok();
|
||||
}
|
||||
|
||||
public DiagramDescription getDescription() {
|
||||
return new DiagramDescription("Board of post-it");
|
||||
}
|
||||
|
||||
public Area getDefaultArea() {
|
||||
return defaultArea;
|
||||
}
|
||||
|
||||
public Area createArea(char id) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public PostIt createPostIt(String id, Display text) {
|
||||
if (postIts.containsKey(id)) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
final PostIt postIt = new PostIt(id, text);
|
||||
postIts.put(id, postIt);
|
||||
getDefaultArea().add(postIt);
|
||||
return postIt;
|
||||
}
|
||||
|
||||
void drawU(UGraphic ug) {
|
||||
getDefaultArea().drawU(ug, width);
|
||||
}
|
||||
|
||||
private UGraphic createImage(FileFormatOption fileFormatOption) {
|
||||
final Color backColor = getSkinParam().getColorMapper().toColor(this.getSkinParam().getBackgroundColor(false));
|
||||
final FileFormat fileFormat = fileFormatOption.getFileFormat();
|
||||
if (fileFormat == FileFormat.PNG) {
|
||||
final double height = getDefaultArea().heightWhenWidthIs(width,
|
||||
fileFormatOption.getDefaultStringBounder(getSkinParam()));
|
||||
final EmptyImageBuilder builder = new EmptyImageBuilder(fileFormatOption.getWatermark(), width, height,
|
||||
backColor);
|
||||
|
||||
final Graphics2D graphics2D = builder.getGraphics2D();
|
||||
final double dpiFactor = this.getScaleCoef(fileFormatOption);
|
||||
final UGraphicG2d result = new UGraphicG2d(new ColorMapperIdentity(), graphics2D, dpiFactor);
|
||||
result.setBufferedImage(builder.getBufferedImage());
|
||||
return result;
|
||||
}
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
private int width = 800;
|
||||
|
||||
public void setWidth(int width) {
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user