2013-12-10 19:36:50 +00:00
|
|
|
/* ========================================================================
|
|
|
|
* PlantUML : a free UML diagram generator
|
|
|
|
* ========================================================================
|
|
|
|
*
|
2016-01-09 12:15:40 +00:00
|
|
|
* (C) Copyright 2009-2017, Arnaud Roques
|
2013-12-10 19:36:50 +00:00
|
|
|
*
|
2016-03-06 16:47:34 +00:00
|
|
|
* Project Info: http://plantuml.com
|
2013-12-10 19:36:50 +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
|
|
|
|
*
|
2013-12-10 19:36:50 +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
|
|
|
|
* 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.activitydiagram3.ftile;
|
|
|
|
|
|
|
|
import java.awt.geom.Dimension2D;
|
|
|
|
import java.util.Set;
|
|
|
|
|
2015-04-07 18:18:37 +00:00
|
|
|
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
|
2013-12-10 19:36:50 +00:00
|
|
|
import net.sourceforge.plantuml.graphic.StringBounder;
|
|
|
|
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
|
|
|
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
|
|
|
|
|
|
|
public class FtileHeightFixed extends AbstractFtile {
|
|
|
|
|
|
|
|
private final Ftile tile;
|
|
|
|
private final double fixedHeight;
|
|
|
|
|
|
|
|
public FtileHeightFixed(Ftile tile, double fixedHeight) {
|
2016-06-19 14:16:41 +00:00
|
|
|
super(tile.skinParam());
|
2013-12-10 19:36:50 +00:00
|
|
|
this.tile = tile;
|
|
|
|
this.fixedHeight = fixedHeight;
|
|
|
|
}
|
2015-04-07 18:18:37 +00:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public LinkRendering getInLinkRendering() {
|
|
|
|
return tile.getInLinkRendering();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public LinkRendering getOutLinkRendering() {
|
|
|
|
return tile.getOutLinkRendering();
|
|
|
|
}
|
|
|
|
|
2013-12-10 19:36:50 +00:00
|
|
|
public Set<Swimlane> getSwimlanes() {
|
|
|
|
return tile.getSwimlanes();
|
|
|
|
}
|
2015-04-07 18:18:37 +00:00
|
|
|
|
2013-12-10 19:36:50 +00:00
|
|
|
public Swimlane getSwimlaneIn() {
|
|
|
|
return tile.getSwimlaneIn();
|
|
|
|
}
|
|
|
|
|
|
|
|
public Swimlane getSwimlaneOut() {
|
|
|
|
return tile.getSwimlaneOut();
|
|
|
|
}
|
|
|
|
|
2017-11-20 16:10:36 +00:00
|
|
|
@Override
|
|
|
|
protected FtileGeometry calculateDimensionFtile(StringBounder stringBounder) {
|
2015-04-07 18:18:37 +00:00
|
|
|
return tile.calculateDimension(stringBounder).translate(getTranslate(stringBounder)).fixedHeight(fixedHeight);
|
2013-12-10 19:36:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private UTranslate getTranslate(StringBounder stringBounder) {
|
2015-04-07 18:18:37 +00:00
|
|
|
final Dimension2D dim = tile.calculateDimension(stringBounder);
|
2013-12-10 19:36:50 +00:00
|
|
|
if (dim.getHeight() > fixedHeight) {
|
|
|
|
throw new IllegalStateException();
|
|
|
|
}
|
|
|
|
return new UTranslate(0, (fixedHeight - dim.getHeight()) / 2);
|
|
|
|
}
|
|
|
|
|
2015-04-07 18:18:37 +00:00
|
|
|
public void drawU(UGraphic ug) {
|
|
|
|
ug.apply(getTranslate(ug.getStringBounder())).draw(tile);
|
2013-12-10 19:36:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|