Search in sources :

Example 86 with GeneralPath

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);
        }
    }
}
Also used : GeneralPath(java.awt.geom.GeneralPath)

Example 87 with GeneralPath

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;
}
Also used : GeneralPath(java.awt.geom.GeneralPath) java.util(java.util) Point2D(java.awt.geom.Point2D)

Example 88 with GeneralPath

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);
    }
}
Also used : GeneralPath(java.awt.geom.GeneralPath) AffineTransform(java.awt.geom.AffineTransform)

Example 89 with GeneralPath

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>,&nbsp;<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);
    }
}
Also used : GeneralPath(java.awt.geom.GeneralPath) Paint(java.awt.Paint)

Example 90 with GeneralPath

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>,&nbsp;<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);
    }
}
Also used : GeneralPath(java.awt.geom.GeneralPath) DrawPaint(org.apache.poi.sl.draw.DrawPaint) Paint(java.awt.Paint)

Aggregations

GeneralPath (java.awt.geom.GeneralPath)96 Point (java.awt.Point)14 AffineTransform (java.awt.geom.AffineTransform)14 PathIterator (java.awt.geom.PathIterator)14 Graphics2D (java.awt.Graphics2D)8 Rectangle2D (java.awt.geom.Rectangle2D)8 Color (java.awt.Color)7 Paint (java.awt.Paint)7 BasicStroke (java.awt.BasicStroke)6 Point2D (java.awt.geom.Point2D)6 Stroke (java.awt.Stroke)5 Area (java.awt.geom.Area)4 Shape (java.awt.Shape)3 CubicCurve2D (java.awt.geom.CubicCurve2D)3 LayoutPathImpl (sun.font.LayoutPathImpl)3 GradientPaint (java.awt.GradientPaint)2 Rectangle (java.awt.Rectangle)2 Line2D (java.awt.geom.Line2D)2 RoundRectangle2D (java.awt.geom.RoundRectangle2D)2 JBColor (com.intellij.ui.JBColor)1