當前位置: 首頁>>代碼示例>>Java>>正文


Java Arc2D.Double方法代碼示例

本文整理匯總了Java中java.awt.geom.Arc2D.Double方法的典型用法代碼示例。如果您正苦於以下問題:Java Arc2D.Double方法的具體用法?Java Arc2D.Double怎麽用?Java Arc2D.Double使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.awt.geom.Arc2D的用法示例。


在下文中一共展示了Arc2D.Double方法的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: 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

示例3: 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

示例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) * (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

示例5: 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

示例6: 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

示例7: drawCurrentPoint

import java.awt.geom.Arc2D; //導入方法依賴的package包/類
public void drawCurrentPoint() {
	if( map==null || point==null || !map.isVisible() ) return;
	synchronized (map.getTreeLock() ) {
		Graphics2D g = map.getGraphics2D();
		float zoom = (float)map.getZoom();
		g.setStroke( new BasicStroke( 2f/ zoom ) );
		g.setColor(Color.RED);
		g.setXORMode( Color.white );
		Rectangle2D rect = map.getClipRect2D();
		double wrap = map.getWrap();
		if( wrap>0. ) while( point.x-wrap > rect.getX() ) point.x-=wrap;
		double size = 10./map.getZoom();
		Arc2D.Double arc = new Arc2D.Double( 0., point.y-.5*size, 
						size, size, 0., 360., Arc2D.CHORD);
		if( wrap>0. ) {
			while( point.x < rect.getX()+rect.getWidth() ) {
				arc.x = point.x-.5*size;
				g.draw(arc);
				point.x += wrap;
			}
		} else {
			arc.x = point.x-.5*size;
			g.draw(arc);
		}
	}
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:27,代碼來源:CustomDB.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) {

    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

示例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: 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:mdzio,項目名稱:ccu-historian,代碼行數:34,代碼來源:MeterPlot.java

示例13: update

import java.awt.geom.Arc2D; //導入方法依賴的package包/類
public void update() {
        Point origin = surfaceGraphic.getViewLocation( 0 );
//        if( getRampWorld() != null ) {
//            origin = getRampWorld().convertToWorld( origin );
//        }
        Point twoMetersOver = getGroundLocationView( 5 );

        int squareWidth = ( twoMetersOver.x - origin.x ) * 2;

        Rectangle2D ellipseBounds = new Rectangle2D.Double();
        ellipseBounds.setFrameFromCenter( origin, new Point2D.Double( origin.x + squareWidth / 2, origin.y + squareWidth / 2 ) );

        double extent = surfaceGraphic.getSurface().getAngle() * 180 / Math.PI;
        extent = Math.max( extent, 0.00001 );
        Arc2D.Double arc = new Arc2D.Double( ellipseBounds, 0, extent, Arc2D.OPEN );
        phetShapeGraphic.setPathTo( arc );

        label.setOffset( arc.getBounds().getMaxX(), arc.getBounds().getY() + arc.getBounds().getHeight() / 2 + 20 );
        label.setHTML( "" + getAngleMessage() );
    }
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:21,代碼來源:AngleGraphic.java

示例14: draw

import java.awt.geom.Arc2D; //導入方法依賴的package包/類
/**
 * Draws the background to the specified graphics device.  If the dial
 * frame specifies a window, the clipping region will already have been
 * set to this window before this method is called.
 *
 * @param g2  the graphics device (<code>null</code> not permitted).
 * @param plot  the plot (ignored here).
 * @param frame  the dial frame (ignored here).
 * @param view  the view rectangle (<code>null</code> not permitted).
 */
@Override
public void draw(Graphics2D g2, DialPlot plot, Rectangle2D frame,
        Rectangle2D view) {

    // work out the anchor point
    Rectangle2D f = DialPlot.rectangleByRadius(frame, this.radius,
            this.radius);
    Arc2D arc = new Arc2D.Double(f, this.angle, 0.0, Arc2D.OPEN);
    Point2D pt = arc.getStartPoint();
    g2.setPaint(this.paint);
    g2.setFont(this.font);
    TextUtilities.drawAlignedString(this.label, g2, (float) pt.getX(),
            (float) pt.getY(), this.anchor);

}
 
開發者ID:mdzio,項目名稱:ccu-historian,代碼行數:26,代碼來源:DialTextAnnotation.java

示例15: 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.
 */
@Override
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:mdzio,項目名稱:ccu-historian,代碼行數:29,代碼來源:ArcDialFrame.java


注:本文中的java.awt.geom.Arc2D.Double方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。