net.sourceforge.plantuml.klimt.geom.PlacementStrategyVisibility 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.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import net.sourceforge.plantuml.klimt.font.StringBounder;
import net.sourceforge.plantuml.klimt.shape.TextBlock;
public class PlacementStrategyVisibility extends AbstractPlacementStrategy {
// ::remove file when __HAXE__
private final int col2;
public PlacementStrategyVisibility(StringBounder stringBounder, int col2) {
super(stringBounder);
this.col2 = col2;
}
public Map getPositions(double width, double height) {
final Map result = new LinkedHashMap<>();
double y = 0;
for (final Iterator> it = getDimensions().entrySet().iterator(); it
.hasNext();) {
final Map.Entry ent1 = it.next();
final Map.Entry ent2 = it.next();
final double height1 = ent1.getValue().getHeight();
final double height2 = ent2.getValue().getHeight();
final double maxHeight12 = Math.max(height1, height2);
result.put(ent1.getKey(), new XPoint2D(0, 2 + y + (maxHeight12 - height1) / 2));
result.put(ent2.getKey(), new XPoint2D(col2, y + (maxHeight12 - height2) / 2));
y += maxHeight12;
}
return result;
}
}