public void AddPie(float x, float y, float width, float height, float startAngle, float sweepAngle) { Shape shape = null; if (sweepAngle >= 360) { shape = new Ellipse2D.Float(x, y, width, height); } else { double d1Tod2 = width / height; double sqrd1Tod2 = d1Tod2 * d1Tod2; double start = ConvertArcAngle(sqrd1Tod2, startAngle); double extent = ConvertArcAngle(sqrd1Tod2, startAngle + sweepAngle) - start; shape = new Arc2D.Double(x, y, width, height, -start, -extent, Arc2D.PIE); } NativeObject.append(shape, false); }
public override void draw(Graphics2D g2, DialPlot plot, Rectangle2D frame, Rectangle2D view) { g2.setPaint((Paint) Color.blue); g2.setStroke((Stroke) new BasicStroke(1f)); Rectangle2D rectangle2D1 = DialPlot.rectangleByRadius(frame, this.radius, this.radius); Rectangle2D rectangle2D2 = DialPlot.rectangleByRadius(frame, this.widthRadius, this.widthRadius); double d = plot.getValue(this.datasetIndex); double num = plot.getScaleForDataset(this.datasetIndex).valueToAngle(d); Point2D endPoint1 = ((Arc2D) new Arc2D.Double(rectangle2D1, num, 0.0, 0)).getEndPoint(); Arc2D.Double double1 = new Arc2D.Double(rectangle2D2, num - 90.0, 180.0, 0); Point2D startPoint1 = ((Arc2D) double1).getStartPoint(); Point2D endPoint2 = ((Arc2D) double1).getEndPoint(); Point2D startPoint2 = ((Arc2D) new Arc2D.Double(rectangle2D2, num - 180.0, 0.0, 0)).getStartPoint(); GeneralPath generalPath = new GeneralPath(); ((Path2D.Float) generalPath).moveTo((float) endPoint1.getX(), (float) endPoint1.getY()); ((Path2D.Float) generalPath).lineTo((float) startPoint1.getX(), (float) startPoint1.getY()); ((Path2D.Float) generalPath).lineTo((float) startPoint2.getX(), (float) startPoint2.getY()); ((Path2D.Float) generalPath).lineTo((float) endPoint2.getX(), (float) endPoint2.getY()); ((Path2D) generalPath).closePath(); g2.setPaint(this.fillPaint); g2.fill((Shape) generalPath); g2.setPaint(this.outlinePaint); Line2D.Double double2 = new Line2D.Double(((RectangularShape) frame).getCenterX(), ((RectangularShape) frame).getCenterY(), endPoint1.getX(), endPoint1.getY()); g2.draw((Shape) double2); ((Line2D) double2).setLine(startPoint1, endPoint2); g2.draw((Shape) double2); ((Line2D) double2).setLine(endPoint2, endPoint1); g2.draw((Shape) double2); ((Line2D) double2).setLine(startPoint1, endPoint1); g2.draw((Shape) double2); ((Line2D) double2).setLine(startPoint1, startPoint2); g2.draw((Shape) double2); ((Line2D) double2).setLine(endPoint2, startPoint2); g2.draw((Shape) double2); }
/** * @see Graphics#fillArc(int, int, int, int, int, int) */ public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle) { Arc2D arc = new Arc2D.Double(x, y, width, height, startAngle, arcAngle, Arc2D.OPEN); fill(arc); }
public void AddPie (float x, float y, float width, float height, float startAngle, float sweepAngle) { Shape shape = null; if (sweepAngle >= 360) shape = new Ellipse2D.Float(x, y, width, height); else { double d1Tod2 = width/height; double sqrd1Tod2 = d1Tod2*d1Tod2; double start = ConvertArcAngle(sqrd1Tod2, startAngle); double extent = ConvertArcAngle(sqrd1Tod2, startAngle+sweepAngle) - start; shape = new Arc2D.Double(x,y,width,height,-start,-extent,Arc2D.PIE); } NativeObject.append(shape,false); }