2011-08-08 17:48:29 +00:00
|
|
|
/* ========================================================================
|
|
|
|
* PlantUML : a free UML diagram generator
|
|
|
|
* ========================================================================
|
|
|
|
*
|
2016-01-09 12:15:40 +00:00
|
|
|
* (C) Copyright 2009-2017, Arnaud Roques
|
2011-08-08 17:48:29 +00:00
|
|
|
*
|
2016-03-06 16:47:34 +00:00
|
|
|
* Project Info: http://plantuml.com
|
2011-08-08 17:48:29 +00:00
|
|
|
*
|
2017-03-15 19:13:31 +00:00
|
|
|
* 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
|
|
|
|
*
|
2011-08-08 17:48:29 +00:00
|
|
|
* 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
|
2013-12-10 19:36:50 +00:00
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
2011-08-08 17:48:29 +00:00
|
|
|
* 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
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
2013-12-10 19:36:50 +00:00
|
|
|
package net.sourceforge.plantuml.svek.image;
|
2011-08-08 17:48:29 +00:00
|
|
|
|
|
|
|
import java.awt.geom.Dimension2D;
|
|
|
|
|
|
|
|
import net.sourceforge.plantuml.Dimension2DDouble;
|
|
|
|
import net.sourceforge.plantuml.ISkinParam;
|
2013-12-10 19:36:50 +00:00
|
|
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
2015-06-07 10:23:10 +00:00
|
|
|
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
|
2011-08-08 17:48:29 +00:00
|
|
|
import net.sourceforge.plantuml.graphic.HtmlColor;
|
|
|
|
import net.sourceforge.plantuml.graphic.StringBounder;
|
2015-09-28 20:42:17 +00:00
|
|
|
import net.sourceforge.plantuml.graphic.color.Colors;
|
2013-12-10 19:36:50 +00:00
|
|
|
import net.sourceforge.plantuml.skin.Area;
|
2011-08-08 17:48:29 +00:00
|
|
|
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;
|
2013-12-10 19:36:50 +00:00
|
|
|
import net.sourceforge.plantuml.svek.IEntityImage;
|
2017-04-05 17:37:42 +00:00
|
|
|
import net.sourceforge.plantuml.svek.Margins;
|
2013-12-10 19:36:50 +00:00
|
|
|
import net.sourceforge.plantuml.svek.ShapeType;
|
2011-08-08 17:48:29 +00:00
|
|
|
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
|
|
|
|
2015-06-07 10:23:10 +00:00
|
|
|
public class EntityImageNoteLink extends AbstractTextBlock implements IEntityImage {
|
2011-08-08 17:48:29 +00:00
|
|
|
|
|
|
|
private final Component comp;
|
|
|
|
|
2015-09-28 20:42:17 +00:00
|
|
|
public EntityImageNoteLink(Display note, Colors colors, ISkinParam skinParam) {
|
2011-08-08 17:48:29 +00:00
|
|
|
final Rose skin = new Rose();
|
2015-09-28 20:42:17 +00:00
|
|
|
comp = skin.createComponent(ComponentType.NOTE, null, colors.mute(skinParam), note);
|
2011-08-08 17:48:29 +00:00
|
|
|
}
|
|
|
|
|
2013-12-10 19:36:50 +00:00
|
|
|
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
2011-08-08 17:48:29 +00:00
|
|
|
final double height = comp.getPreferredHeight(stringBounder);
|
|
|
|
final double width = comp.getPreferredWidth(stringBounder);
|
|
|
|
return new Dimension2DDouble(width, height);
|
|
|
|
}
|
|
|
|
|
2013-12-10 19:36:50 +00:00
|
|
|
public void drawU(UGraphic ug) {
|
|
|
|
comp.drawU(ug, new Area(calculateDimension(ug.getStringBounder())), new SimpleContext2D(false));
|
2011-08-08 17:48:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public ShapeType getShapeType() {
|
|
|
|
return ShapeType.RECTANGLE;
|
|
|
|
}
|
|
|
|
|
|
|
|
public HtmlColor getBackcolor() {
|
|
|
|
return null;
|
|
|
|
}
|
2013-12-10 19:36:50 +00:00
|
|
|
|
2017-04-05 17:37:42 +00:00
|
|
|
public Margins getShield(StringBounder stringBounder) {
|
|
|
|
return Margins.NONE;
|
2011-09-07 20:41:58 +00:00
|
|
|
}
|
|
|
|
|
2013-12-10 19:36:50 +00:00
|
|
|
public boolean isHidden() {
|
|
|
|
return false;
|
|
|
|
}
|
2018-12-22 11:11:40 +00:00
|
|
|
|
|
|
|
public double getOverscanX(StringBounder stringBounder) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-08-08 17:48:29 +00:00
|
|
|
|
|
|
|
}
|