plantuml/src/net/sourceforge/plantuml/svek/InnerActivity.java

99 lines
3.0 KiB
Java
Raw Normal View History

2011-08-08 17:48:29 +00:00
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
2022-03-07 19:33:46 +00:00
* (C) Copyright 2009-2023, 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
*
*
*/
package net.sourceforge.plantuml.svek;
2022-02-17 18:27:32 +00:00
import net.sourceforge.plantuml.awt.geom.Dimension2D;
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.StringBounder;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.URectangle;
import net.sourceforge.plantuml.ugraphic.UStroke;
2020-03-18 10:50:02 +00:00
import net.sourceforge.plantuml.ugraphic.color.HColor;
2011-08-08 17:48:29 +00:00
2015-06-07 10:23:10 +00:00
public final class InnerActivity extends AbstractTextBlock implements IEntityImage {
2011-08-08 17:48:29 +00:00
private final IEntityImage im;
2020-03-18 10:50:02 +00:00
private final HColor borderColor;
2019-08-26 17:07:21 +00:00
private final double shadowing;
2020-03-18 10:50:02 +00:00
private final HColor backColor;
2011-08-08 17:48:29 +00:00
2020-03-18 10:50:02 +00:00
public InnerActivity(final IEntityImage im, HColor borderColor, HColor backColor, double shadowing) {
2011-08-08 17:48:29 +00:00
this.im = im;
2013-12-10 19:36:50 +00:00
this.backColor = backColor;
2011-08-08 17:48:29 +00:00
this.borderColor = borderColor;
2013-12-10 19:36:50 +00:00
this.shadowing = shadowing;
2011-08-08 17:48:29 +00:00
}
public final static double THICKNESS_BORDER = 1.5;
2013-12-10 19:36:50 +00:00
public void drawU(UGraphic ug) {
final Dimension2D total = calculateDimension(ug.getStringBounder());
2011-08-08 17:48:29 +00:00
2021-12-14 21:38:22 +00:00
ug = ug.apply(backColor.bg()).apply(borderColor).apply(new UStroke(THICKNESS_BORDER));
2020-03-18 10:50:02 +00:00
final URectangle rect = new URectangle(total.getWidth(), total.getHeight()).rounded(IEntityImage.CORNER);
2019-08-26 17:07:21 +00:00
rect.setDeltaShadow(shadowing);
2013-12-10 19:36:50 +00:00
ug.draw(rect);
ug = ug.apply(new UStroke());
im.drawU(ug);
2011-08-08 17:48:29 +00:00
}
2020-03-18 10:50:02 +00:00
public HColor getBackcolor() {
2011-08-08 17:48:29 +00:00
return im.getBackcolor();
}
2013-12-10 19:36:50 +00:00
public Dimension2D calculateDimension(StringBounder stringBounder) {
final Dimension2D img = im.calculateDimension(stringBounder);
2011-08-08 17:48:29 +00:00
return img;
}
public ShapeType getShapeType() {
return ShapeType.ROUND_RECTANGLE;
}
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 im.isHidden();
}
2020-03-18 10:50:02 +00:00
2018-12-22 11:11:40 +00:00
public double getOverscanX(StringBounder stringBounder) {
return 0;
}
2011-08-08 17:48:29 +00:00
}