net.sourceforge.plantuml.klimt.creole.atom.AtomWithMargin 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.creole.atom;
import net.sourceforge.plantuml.klimt.UTranslate;
import net.sourceforge.plantuml.klimt.drawing.UGraphic;
import net.sourceforge.plantuml.klimt.font.StringBounder;
import net.sourceforge.plantuml.klimt.geom.XDimension2D;
public class AtomWithMargin extends AbstractAtom implements Atom {
private final double marginY1;
private final double marginY2;
private final Atom atom;
public AtomWithMargin(Atom atom, double marginY1, double marginY2) {
this.atom = atom;
this.marginY1 = marginY1;
this.marginY2 = marginY2;
}
public XDimension2D calculateDimension(StringBounder stringBounder) {
return atom.calculateDimension(stringBounder).delta(0, marginY1 + marginY2);
}
public double getStartingAltitude(StringBounder stringBounder) {
return atom.getStartingAltitude(stringBounder);
}
public void drawU(UGraphic ug) {
atom.drawU(ug.apply(UTranslate.dy(marginY1)));
}
}