ShipNeedle.java 文件源码

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

项目:parabuild-ci 作者:
/**
 * Draws the needle.
 *
 * @param g2  the graphics device.
 * @param plotArea  the plot area.
 * @param rotate  the rotation point.
 * @param angle  the angle.
 */
protected void drawNeedle(Graphics2D g2, Rectangle2D plotArea, 
                          Point2D rotate, double angle) {

    GeneralPath shape = new GeneralPath();
    shape.append(new Arc2D.Double(-9.0, -7.0, 10, 14, 0.0, 25.5, 
            Arc2D.OPEN), true);
    shape.append(new Arc2D.Double(0.0, -7.0, 10, 14, 154.5, 25.5, 
            Arc2D.OPEN), true);
    shape.closePath();
    getTransform().setToTranslation(plotArea.getMinX(), plotArea.getMaxY());
    getTransform().scale(plotArea.getWidth(), plotArea.getHeight() / 3);
    shape.transform(getTransform());

    if ((rotate != null) && (angle != 0)) {
        /// we have rotation
        getTransform().setToRotation(angle, rotate.getX(), rotate.getY());
        shape.transform(getTransform());
    }

    defaultDisplay(g2, shape);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号