![JAR search and dependency download from the Maven repository](/logo.png)
net.sourceforge.plantuml.klimt.geom.AbstractPlacementStrategy 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 abstract class AbstractPlacementStrategy implements PlacementStrategy {
// ::remove file when __HAXE__
private final StringBounder stringBounder;
private final Map dimensions = new LinkedHashMap();
public AbstractPlacementStrategy(StringBounder stringBounder) {
this.stringBounder = stringBounder;
}
public void add(TextBlock block) {
this.dimensions.put(block, block.calculateDimension(stringBounder));
}
protected Map getDimensions() {
return dimensions;
}
protected double getSumWidth() {
return getSumWidth(dimensions.values().iterator());
}
protected double getSumHeight() {
return getSumHeight(dimensions.values().iterator());
}
protected double getMaxHeight() {
return getMaxHeight(dimensions.values().iterator());
}
protected double getMaxWidth() {
return getMaxWidth(dimensions.values().iterator());
}
protected double getSumWidth(Iterator it) {
double result = 0;
while (it.hasNext()) {
result += it.next().getWidth();
}
return result;
}
protected double getSumHeight(Iterator it) {
double result = 0;
while (it.hasNext()) {
result += it.next().getHeight();
}
return result;
}
protected double getMaxWidth(Iterator it) {
double result = 0;
while (it.hasNext()) {
result = Math.max(result, it.next().getWidth());
}
return result;
}
protected double getMaxHeight(Iterator it) {
double result = 0;
while (it.hasNext()) {
result = Math.max(result, it.next().getHeight());
}
return result;
}
protected final StringBounder getStringBounder() {
return stringBounder;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy