net.sourceforge.plantuml.braille.DriverPolygonBraille 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.braille;
import java.util.ArrayList;
import java.util.List;
import net.sourceforge.plantuml.klimt.ClipContainer;
import net.sourceforge.plantuml.klimt.UClip;
import net.sourceforge.plantuml.klimt.UParam;
import net.sourceforge.plantuml.klimt.UTranslate;
import net.sourceforge.plantuml.klimt.color.ColorMapper;
import net.sourceforge.plantuml.klimt.drawing.UDriver;
import net.sourceforge.plantuml.klimt.geom.XPoint2D;
import net.sourceforge.plantuml.klimt.shape.UPolygon;
public class DriverPolygonBraille implements UDriver {
private final ClipContainer clipContainer;
public DriverPolygonBraille(ClipContainer clipContainer) {
this.clipContainer = clipContainer;
}
public void draw(UPolygon shape, double x, double y, ColorMapper mapper, UParam param, BrailleGrid grid) {
final List points = new ArrayList<>();
int i = 0;
for (XPoint2D pt : shape.getPoints()) {
points.add(new UTranslate(x, y).getTranslated(pt));
}
final UClip clip = clipContainer.getClip();
if (clip != null) {
for (XPoint2D pt : points) {
if (clip.isInside(pt) == false) {
return;
}
}
}
grid.drawPolygon(points);
}
}