net.sourceforge.plantuml.klimt.geom.PlacementStrategyY1Y2 Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of plantuml-mit Show documentation
Show all versions of plantuml-mit Show documentation
PlantUML is a component that allows to quickly write diagrams from text.
// THIS FILE HAS BEEN GENERATED BY A PREPROCESSOR.
package net.sourceforge.plantuml.klimt.geom;
import java.util.LinkedHashMap;
import java.util.Map;
import net.sourceforge.plantuml.klimt.font.StringBounder;
import net.sourceforge.plantuml.klimt.shape.TextBlock;
public class PlacementStrategyY1Y2 extends AbstractPlacementStrategy {
// ::remove file when __HAXE__
public PlacementStrategyY1Y2(StringBounder stringBounder) {
super(stringBounder);
}
public Map getPositions(double width, double height) {
final 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 XPoint2D(x, y));
y += ent.getValue().getHeight() + space;
}
return result;
}
}