MeterPlot.java 文件源码

java
阅读 26 收藏 0 点赞 0 评论 0

项目:ccu-historian 作者:
/**
 * Draws an arc.
 *
 * @param g2  the graphics device.
 * @param area  the plot area.
 * @param minValue  the minimum value.
 * @param maxValue  the maximum value.
 * @param paint  the paint.
 * @param stroke  the stroke.
 */
protected void drawArc(Graphics2D g2, Rectangle2D area, double minValue,
                       double maxValue, Paint paint, Stroke stroke) {

    double startAngle = valueToAngle(maxValue);
    double endAngle = valueToAngle(minValue);
    double extent = endAngle - startAngle;

    double x = area.getX();
    double y = area.getY();
    double w = area.getWidth();
    double h = area.getHeight();
    g2.setPaint(paint);
    g2.setStroke(stroke);

    if (paint != null && stroke != null) {
        Arc2D.Double arc = new Arc2D.Double(x, y, w, h, startAngle,
                extent, Arc2D.OPEN);
        g2.setPaint(paint);
        g2.setStroke(stroke);
        g2.draw(arc);
    }

}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号