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

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

There is a newer version: 1.2024.8
Show newest version
// 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;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy