use of java.awt.geom.GeneralPath in project beast-mcmc by beast-dev.
the class ParentPlot method paintData.
/**
* Paint data series
*/
protected void paintData(Graphics2D g2, Variate.N xData, Variate.N yData) {
g2.setPaint(linePaint);
g2.setStroke(lineStroke);
if (getSelectedPoints() != null && getSelectedPoints().size() > 0) {
for (int i : getSelectedPoints()) {
double x = ((Number) xTipData.get(i)).doubleValue();
double y = ((Number) yTipData.get(i)).doubleValue();
double x1 = transformX(x);
double y1 = transformY(y);
double x2 = transformX(((Number) xData.get(0)).doubleValue());
double y2 = transformY(((Number) yData.get(0)).doubleValue());
GeneralPath path = new GeneralPath();
path.moveTo((float) x1, (float) y1);
// path.lineTo((float) x2, (float) y1);
path.lineTo((float) x2, (float) y2);
g2.draw(path);
}
} else {
for (int i = 0; i < xData.getCount(); i++) {
double x1 = transformX(((Number) xTipData.get(i)).doubleValue());
double y1 = transformY(((Number) yTipData.get(i)).doubleValue());
double x2 = transformX(((Number) xData.get(i)).doubleValue());
double y2 = transformY(((Number) yData.get(i)).doubleValue());
GeneralPath path = new GeneralPath();
path.moveTo((float) x1, (float) y1);
// path.lineTo((float) x2, (float) y1);
path.lineTo((float) x2, (float) y2);
g2.draw(path);
}
}
}
use of java.awt.geom.GeneralPath in project beast-mcmc by beast-dev.
the class AbstractPolygon2D method getShape.
Shape getShape() {
GeneralPath path = new GeneralPath();
java.util.List<Point2D> points = point2Ds;
path.moveTo((float) points.get(0).getX(), (float) points.get(0).getY());
for (int i = 1; i < points.size(); i++) {
path.lineTo((float) points.get(i).getX(), (float) points.get(i).getY());
}
path.closePath();
return path;
}
use of java.awt.geom.GeneralPath in project beast-mcmc by beast-dev.
the class KMLRenderer method render.
public void render(BufferedImage image) {
Graphics2D g2d = image.createGraphics();
g2d.setColor(background);
g2d.fillRect(0, 0, image.getWidth(), image.getHeight());
viewTransform = new ViewTransform(bounds, image.getWidth(), image.getHeight());
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setColor(shapeColor);
AffineTransform transform = viewTransform.getTransform();
for (Shape s : shapes) {
GeneralPath path = new GeneralPath(s);
path.transform(transform);
g2d.fill(path);
}
}
use of java.awt.geom.GeneralPath in project poi by apache.
the class SLGraphics method drawPolyline.
/**
* Draws a sequence of connected lines defined by
* arrays of <i>x</i> and <i>y</i> coordinates.
* Each pair of (<i>x</i>, <i>y</i>) coordinates defines a point.
* The figure is not closed if the first point
* differs from the last point.
* @param xPoints an array of <i>x</i> points
* @param yPoints an array of <i>y</i> points
* @param nPoints the total number of points
* @see java.awt.Graphics#drawPolygon(int[], int[], int)
* @since JDK1.1
*/
public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints) {
if (nPoints > 0) {
GeneralPath path = new GeneralPath();
path.moveTo(xPoints[0], yPoints[0]);
for (int i = 1; i < nPoints; i++) path.lineTo(xPoints[i], yPoints[i]);
draw(path);
}
}
use of java.awt.geom.GeneralPath in project poi by apache.
the class PPGraphics2D method drawPolyline.
/**
* Draws a sequence of connected lines defined by
* arrays of <i>x</i> and <i>y</i> coordinates.
* Each pair of (<i>x</i>, <i>y</i>) coordinates defines a point.
* The figure is not closed if the first point
* differs from the last point.
* @param xPoints an array of <i>x</i> points
* @param yPoints an array of <i>y</i> points
* @param nPoints the total number of points
* @see java.awt.Graphics#drawPolygon(int[], int[], int)
* @since JDK1.1
*/
public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints) {
if (nPoints > 0) {
GeneralPath path = new GeneralPath();
path.moveTo(xPoints[0], yPoints[0]);
for (int i = 1; i < nPoints; i++) path.lineTo(xPoints[i], yPoints[i]);
draw(path);
}
}
Aggregations