All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sourceforge.plantuml.klimt.geom.PlacementStrategyX1X2 Maven / Gradle / Ivy

There is a newer version: 1.2025.0
Show newest version
// 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 PlacementStrategyX1X2 extends AbstractPlacementStrategy {
	// ::remove file when __HAXE__

	public PlacementStrategyX1X2(StringBounder stringBounder) {
		super(stringBounder);
	}

	public Map getPositions(double width, double height) {
		final double usedWidth = getSumWidth();
		// double maxHeight = getMaxHeight();

		final double space = (width - usedWidth) / (getDimensions().size() + 1);
		final Map result = new LinkedHashMap<>();
		double x = space;
		for (Map.Entry ent : getDimensions().entrySet()) {
			final double y = (height - ent.getValue().getHeight()) / 2;
			result.put(ent.getKey(), new XPoint2D(x, y));
			x += ent.getValue().getWidth() + space;
		}
		return result;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy