![JAR search and dependency download from the Maven repository](/logo.png)
net.sourceforge.plantuml.klimt.shape.TextBlockRecentred 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.shape;
import net.sourceforge.plantuml.klimt.UTranslate;
import net.sourceforge.plantuml.klimt.color.HColor;
import net.sourceforge.plantuml.klimt.drawing.UGraphic;
import net.sourceforge.plantuml.klimt.font.StringBounder;
import net.sourceforge.plantuml.klimt.geom.MinMax;
import net.sourceforge.plantuml.klimt.geom.XDimension2D;
public class TextBlockRecentred extends AbstractTextBlock {
// ::remove file when __HAXE__
private final TextBlock textBlock;
public TextBlockRecentred(TextBlock textBlock) {
this.textBlock = textBlock;
}
public void drawU(final UGraphic ug) {
StringBounder stringBounder = ug.getStringBounder();
final MinMax minMax = getMinMax(stringBounder);
textBlock.drawU(ug.apply(new UTranslate(-minMax.getMinX(), -minMax.getMinY())));
}
// private MinMax cachedMinMax;
public MinMax getMinMax(StringBounder stringBounder) {
return textBlock.getMinMax(stringBounder);
// if (cachedMinMax == null) {
// cachedMinMax = getMinMaxSlow(stringBounder);
// }
// // assert
// cachedMinMax.toString().equals(getMinMaxSlow(stringBounder).toString());
// return cachedMinMax;
}
// private MinMax getMinMaxSlow(StringBounder stringBounder) {
// final MinMax result = TextBlockUtils.getMinMax(textBlock, stringBounder);
// return result;
// }
public XDimension2D calculateDimension(StringBounder stringBounder) {
final MinMax minMax = getMinMax(stringBounder);
return minMax.getDimension();
}
public HColor getBackcolor() {
return textBlock.getBackcolor();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy