Example usage for java.awt.geom Arc2D setArcByCenter

List of usage examples for java.awt.geom Arc2D setArcByCenter

Introduction

In this page you can find the example usage for java.awt.geom Arc2D setArcByCenter.

Prototype

public void setArcByCenter(double x, double y, double radius, double angSt, double angExt, int closure) 

Source Link

Document

Sets the position, bounds, angular extents, and closure type of this arc to the specified values.

Usage

From source file:Main.java

public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;
    int w = getSize().width;
    int h = getSize().height;

    Arc2D arc = new Arc2D.Double(0.0, 0.5, w, h, 0.0, 60.0, Arc2D.CHORD);

    g2.draw(arc);//  ww w.  jav a  2s .c  o m

    arc.setArcByCenter(2, 3, w, h, 110.0f, Arc2D.PIE);
    g2.fill(arc);

    arc = new Arc2D.Float(0.0f, 0.0f, w, h, 210.0f, 130.0f, Arc2D.OPEN);

    g2.draw(arc);
}

From source file:com.piketec.jenkins.plugins.tpt.publisher.PieChart.java

private Arc2D paintPieSegment(Graphics2D g2, double startRatio, double endRatio, double radius,
        Color fillColor) {/*w ww.  ja  v a 2 s . c om*/
    Arc2D pie = new Arc2D.Double(Arc2D.PIE);
    double startAngle = 90 - 360 * startRatio; // top (= north)
    double endAngle = -360 * endRatio; // mit dem Uhrzeigersinn
    pie.setArcByCenter(centerX, centerY, radius, startAngle, endAngle, Arc2D.PIE);
    g2.setColor(fillColor);
    g2.fill(pie);
    return pie;
}

From source file:org.amanzi.awe.render.network.NetworkRenderer.java

/**
 * Create sector/*from w ww  .j a v  a 2s  .  c  o m*/
 * 
 * @param point
 * @param radius
 * @param angle
 * @param beamwidth
 * @return sector
 */
private Arc2D createSector(final Point point, final double radius, final double angle, final double beamwidth) {
    int size = getSize();
    Arc2D sector = new Arc2D.Double();
    sector.setArcByCenter(getSectorXCoordinate(point, size), getSectorYCoordinate(point, size), radius, angle,
            beamwidth, Arc2D.OPEN);
    return sector;
}