当前位置: 首页>>代码示例>>Java>>正文


Java Arc2D类代码示例

本文整理汇总了Java中java.awt.geom.Arc2D的典型用法代码示例。如果您正苦于以下问题:Java Arc2D类的具体用法?Java Arc2D怎么用?Java Arc2D使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Arc2D类属于java.awt.geom包,在下文中一共展示了Arc2D类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: drawNeedle

import java.awt.geom.Arc2D; //导入依赖的package包/类
/**
 * 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) {

    Arc2D shape = new Arc2D.Double(Arc2D.PIE);
    double radius = plotArea.getHeight();
    double halfX = plotArea.getWidth() / 2;
    double diameter = 2 * radius;

    shape.setFrame(plotArea.getMinX() + halfX - radius ,
                   plotArea.getMinY() - radius,
                   diameter, diameter);
    radius = Math.toDegrees(Math.asin(halfX / radius));
    shape.setAngleStart(270 - radius);
    shape.setAngleExtent(2 * radius);

    Area s = new Area(shape);

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

    defaultDisplay(g2, s);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:34,代码来源:PlumNeedle.java

示例2: drawStatus

import java.awt.geom.Arc2D; //导入依赖的package包/类
public void drawStatus(int status, double probability, Graphics2D g2d, Color sc, Color pc, Color borderC, boolean bold) {
	double x = 2.0 * (2.0 * STATUS_RAD + ELEMS_GAP) * status + START_GAP;
	double y = panelH / 2.0 - STATUS_RAD;
	double pie = probability * 360;
	Color ctmp = g2d.getColor();
	if (bold) {
		g2d.setStroke(strokeB);
	}
	statusE[status] = new Ellipse2D.Double(x, y, STATUS_RAD * 2.0, STATUS_RAD * 2.0);
	statusP[status] = new Arc2D.Double(x, y, STATUS_RAD * 2.0, STATUS_RAD * 2.0, 0.0, pie, Arc2D.PIE);
	g2d.setPaint(sc);
	g2d.fill(statusE[status]);
	g2d.setPaint(pc);
	g2d.fill(statusP[status]);
	g2d.setPaint(borderC);
	g2d.draw(statusE[status]);
	drawCenteredText(probabilityToString(probability, 3), Color.BLACK, x + STATUS_RAD, y - STATUS_RAD, g2d, false);
	drawCenteredText("" + status, borderC, x + STATUS_RAD, panelH / 2.0, g2d, false);
	g2d.setColor(ctmp);
	g2d.setStroke(stroke);
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:22,代码来源:StatiDrawer.java

示例3: drawLastStatus

import java.awt.geom.Arc2D; //导入依赖的package包/类
public void drawLastStatus(String jobStr, double probability, Graphics2D g2d, Color sc, Color pc) {
	double x = 2.0 * (2.0 * STATUS_RAD + ELEMS_GAP) * (queueLength() - 1) + START_GAP;
	double y = panelH / 2.0 - STATUS_RAD;
	Color ctmp = g2d.getColor();
	lastStatusE = new Ellipse2D.Double(x, y, STATUS_RAD * 2.0, STATUS_RAD * 2.0);
	g2d.setPaint(sc);
	g2d.fill(lastStatusE);
	//if (queueMax != 0) {
	double pie = probability * 360;
	lastStatusP = new Arc2D.Double(x, y, STATUS_RAD * 2.0, STATUS_RAD * 2.0, 0.0, pie, Arc2D.PIE);
	g2d.setPaint(pc);
	g2d.fill(lastStatusP);
	g2d.setPaint(Color.BLACK);
	drawCenteredText(probabilityToString(probability, 3), Color.BLACK, x + STATUS_RAD, y - STATUS_RAD, g2d, false);
	//drawCenteredText("" + queueMax, Color.BLACK, x + STATUS_RAD, panelH/2.0, g2d, false);
	drawCenteredText(jobStr, Color.BLACK, x + STATUS_RAD, panelH / 2.0, g2d, false);
	//}
	g2d.setPaint(Color.BLACK);
	g2d.draw(lastStatusE);
	g2d.setColor(ctmp);
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:22,代码来源:StatiDrawer.java

示例4: drawLastStatus

import java.awt.geom.Arc2D; //导入依赖的package包/类
public void drawLastStatus(String jobStr, double probability, Graphics2D g2d, Color sc, Color pc) {
	double x = 2.0 * (2.0 * STATUS_RAD + ELEMS_GAP) * (queueLenght() - 1) + START_GAP;
	double y = panelH / 2.0 - STATUS_RAD;
	Color ctmp = g2d.getColor();
	lastStatusE = new Ellipse2D.Double(x, y, STATUS_RAD * 2.0, STATUS_RAD * 2.0);
	g2d.setPaint(sc);
	g2d.fill(lastStatusE);
	//if(queueMax != 0){
	double pie = probability * 360;
	lastStatusP = new Arc2D.Double(x, y, STATUS_RAD * 2.0, STATUS_RAD * 2.0, 0.0, pie, Arc2D.PIE);
	g2d.setPaint(pc);
	g2d.fill(lastStatusP);
	g2d.setPaint(Color.BLACK);
	drawCenteredText(probabilityToString(probability, 3), Color.BLACK, x + STATUS_RAD, y - STATUS_RAD, g2d, false);
	//drawCenteredText("" + queueMax, Color.BLACK, x + STATUS_RAD, panelH/2.0, g2d, false);
	drawCenteredText(jobStr, Color.BLACK, x + STATUS_RAD, panelH / 2.0, g2d, false);
	//}
	g2d.setPaint(Color.BLACK);
	g2d.draw(lastStatusE);
	g2d.setColor(ctmp);
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:22,代码来源:StatiDrawer.java

示例5: paintTilda

import java.awt.geom.Arc2D; //导入依赖的package包/类
public static void paintTilda(final Graphics2D g, final double x1,
                              final double y1, final double x2, final double y2, final double x3,
                              final double y3, double w, MovingArea movingArea) {
    double x = x1;
    double y = y1;
    if (x3 < x)
        x = x3;
    else if (x2 > x)
        x = x2;
    if (y3 < y)
        y = y3;
    else if (y2 > y)
        y = y2;

    g.fill(new Arc2D.Double(x1 - w / 2, y1 - w / 2, w, w, 0, 360, Arc2D.PIE));
    paintTilda(g, x1, y1, x, y, movingArea);
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:18,代码来源:ArrowPainter.java

示例6: getArcBounds

import java.awt.geom.Arc2D; //导入依赖的package包/类
/**
 * Returns a rectangle that can be used to create a pie section (taking
 * into account the amount by which the pie section is 'exploded').
 *
 * @param unexploded  the area inside which the unexploded pie sections are drawn.
 * @param exploded  the area inside which the exploded pie sections are drawn.
 * @param angle  the start angle.
 * @param extent  the extent of the arc.
 * @param explodePercent  the amount by which the pie section is exploded.
 *
 * @return a rectangle that can be used to create a pie section.
 */
protected Rectangle2D getArcBounds(Rectangle2D unexploded, Rectangle2D exploded,
                                   double angle, double extent, double explodePercent) {

    if (explodePercent == 0.0) {
        return unexploded;
    }
    else {
        Arc2D arc1 = new Arc2D.Double(unexploded, angle, extent / 2, Arc2D.OPEN);
        Point2D point1 = arc1.getEndPoint();
        Arc2D.Double arc2 = new Arc2D.Double(exploded, angle, extent / 2, Arc2D.OPEN);
        Point2D point2 = arc2.getEndPoint();
        double deltaX = (point1.getX() - point2.getX()) * explodePercent;
        double deltaY = (point1.getY() - point2.getY()) * explodePercent;
        return new Rectangle2D.Double(unexploded.getX() - deltaX,
            unexploded.getY() - deltaY,
            unexploded.getWidth(),
            unexploded.getHeight());

    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:33,代码来源:PiePlot.java

示例7: drawNeedle

import java.awt.geom.Arc2D; //导入依赖的package包/类
/**
 * 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) {

    Arc2D shape = new Arc2D.Double(Arc2D.PIE);
    double radius = plotArea.getHeight();
    double halfX = plotArea.getWidth() / 2;
    double diameter = 2 * radius;

    shape.setFrame(plotArea.getMinX() + halfX - radius ,
                   plotArea.getMinY() - radius,
                   diameter, diameter);
    radius = Math.toDegrees(Math.asin(halfX / radius));
    shape.setAngleStart(270 - radius);
    shape.setAngleExtent(2 * radius);

    Area s = new Area(shape);

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

    defaultDisplay(g2, s);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:33,代码来源:PlumNeedle.java

示例8: drawNeedle

import java.awt.geom.Arc2D; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:29,代码来源:ShipNeedle.java

示例9: getWindow

import java.awt.geom.Arc2D; //导入依赖的package包/类
/**
 * Returns the shape for the window for this dial.  Some dial layers will
 * request that their drawing be clipped within this window.
 *
 * @param frame  the reference frame (<code>null</code> not permitted).
 *
 * @return The shape of the dial's window.
 */
public Shape getWindow(Rectangle2D frame) {
    
    Rectangle2D innerFrame = DialPlot.rectangleByRadius(frame, 
            this.innerRadius, this.innerRadius);
    Rectangle2D outerFrame = DialPlot.rectangleByRadius(frame, 
            this.outerRadius, this.outerRadius);
    Arc2D inner = new Arc2D.Double(innerFrame, this.startAngle, this.extent, 
            Arc2D.OPEN);
    Arc2D outer = new Arc2D.Double(outerFrame, this.startAngle 
            + this.extent, - this.extent, Arc2D.OPEN);
    GeneralPath p = new GeneralPath();
    Point2D point1 = inner.getStartPoint();
    p.moveTo((float) point1.getX(), (float) point1.getY());
    p.append(inner, true);
    p.append(outer, true);
    p.closePath();
    return p;
    
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:28,代码来源:StandardDialFrame.java

示例10: getOuterWindow

import java.awt.geom.Arc2D; //导入依赖的package包/类
protected Shape getOuterWindow(Rectangle2D frame) {
    double radiusMargin = 0.02;
    double angleMargin = 1.5;
    Rectangle2D innerFrame = DialPlot.rectangleByRadius(frame, 
            this.innerRadius - radiusMargin, this.innerRadius 
            - radiusMargin);
    Rectangle2D outerFrame = DialPlot.rectangleByRadius(frame, 
            this.outerRadius + radiusMargin, this.outerRadius 
            + radiusMargin);
    Arc2D inner = new Arc2D.Double(innerFrame, this.startAngle 
            - angleMargin, this.extent + 2 * angleMargin, Arc2D.OPEN);
    Arc2D outer = new Arc2D.Double(outerFrame, this.startAngle 
            + angleMargin + this.extent, - this.extent - 2 * angleMargin, 
            Arc2D.OPEN);
    GeneralPath p = new GeneralPath();
    Point2D point1 = inner.getStartPoint();
    p.moveTo((float) point1.getX(), (float) point1.getY());
    p.append(inner, true);
    p.append(outer, true);
    p.closePath();
    return p;
    
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:24,代码来源:StandardDialFrame.java

示例11: draw

import java.awt.geom.Arc2D; //导入依赖的package包/类
/**
 * Draws the pointer.
 * 
 * @param g2  the graphics target.
 * @param plot  the plot.
 * @param frame  the dial's reference frame.
 * @param view  the dial's view.
 */
public void draw(Graphics2D g2, DialPlot plot, Rectangle2D frame, 
    Rectangle2D view) {

    g2.setPaint(this.paint);
    g2.setStroke(this.stroke);
    Rectangle2D arcRect = DialPlot.rectangleByRadius(frame, 
            this.radius, this.radius);

    double value = plot.getValue(this.datasetIndex);
    DialScale scale = plot.getScaleForDataset(this.datasetIndex);
    double angle = scale.valueToAngle(value);

    Arc2D arc = new Arc2D.Double(arcRect, angle, 0, Arc2D.OPEN);
    Point2D pt = arc.getEndPoint();

    Line2D line = new Line2D.Double(frame.getCenterX(), 
            frame.getCenterY(), pt.getX(), pt.getY());
    g2.draw(line);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:28,代码来源:DialPointer.java

示例12: draw

import java.awt.geom.Arc2D; //导入依赖的package包/类
/**
 * Draws the range.
 * 
 * @param g2  the graphics target.
 * @param plot  the plot.
 * @param frame  the dial's reference frame (in Java2D space).
 * @param view  the dial's view rectangle (in Java2D space).
 */
public void draw(Graphics2D g2, DialPlot plot, Rectangle2D frame, 
        Rectangle2D view) {
    
    Rectangle2D arcRectInner = DialPlot.rectangleByRadius(frame, 
            this.innerRadius, this.innerRadius);
    Rectangle2D arcRectOuter = DialPlot.rectangleByRadius(frame, 
            this.outerRadius, this.outerRadius);
    //double range = this.upperBound - this.lowerBound;
    
    DialScale scale = plot.getScaleForDataset(0);
    double angleMin = scale.valueToAngle(this.lowerBound);
    double angleMax = scale.valueToAngle(this.upperBound);

    Arc2D arcInner = new Arc2D.Double(arcRectInner, angleMin, 
            angleMax - angleMin, Arc2D.OPEN);
    Arc2D arcOuter = new Arc2D.Double(arcRectOuter, angleMax, 
            angleMin - angleMax, Arc2D.OPEN);
    
    g2.setPaint(this.paint);
    g2.setStroke(new BasicStroke(2.0f));
    g2.draw(arcInner);
    g2.draw(arcOuter);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:32,代码来源:StandardDialRange.java

示例13: drawArc

import java.awt.geom.Arc2D; //导入依赖的package包/类
/**
 * 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);
    }

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:34,代码来源:MeterPlot.java

示例14: getArcBounds

import java.awt.geom.Arc2D; //导入依赖的package包/类
/**
 * Returns a rectangle that can be used to create a pie section (taking
 * into account the amount by which the pie section is 'exploded').
 *
 * @param unexploded  the area inside which the unexploded pie sections are
 *                    drawn.
 * @param exploded  the area inside which the exploded pie sections are 
 *                  drawn.
 * @param angle  the start angle.
 * @param extent  the extent of the arc.
 * @param explodePercent  the amount by which the pie section is exploded.
 *
 * @return A rectangle that can be used to create a pie section.
 */
protected Rectangle2D getArcBounds(Rectangle2D unexploded, 
                                   Rectangle2D exploded,
                                   double angle, double extent, 
                                   double explodePercent) {

    if (explodePercent == 0.0) {
        return unexploded;
    }
    else {
        Arc2D arc1 = new Arc2D.Double(unexploded, angle, extent / 2, 
                Arc2D.OPEN);
        Point2D point1 = arc1.getEndPoint();
        Arc2D.Double arc2 = new Arc2D.Double(exploded, angle, extent / 2, 
                Arc2D.OPEN);
        Point2D point2 = arc2.getEndPoint();
        double deltaX = (point1.getX() - point2.getX()) * explodePercent;
        double deltaY = (point1.getY() - point2.getY()) * explodePercent;
        return new Rectangle2D.Double(unexploded.getX() - deltaX, 
                unexploded.getY() - deltaY, unexploded.getWidth(), 
                unexploded.getHeight());
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:37,代码来源:PiePlot.java

示例15: drawNeedle

import java.awt.geom.Arc2D; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:30,代码来源:ShipNeedle.java


注:本文中的java.awt.geom.Arc2D类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。