import java.awt.Color;
import java.awt.geom.Arc2D;
import java.awt.geom.Area;
import java.awt.geom.GeneralPath;
import java.awt.geom.Point2D;
class Pie3D {
privateArc2Darc;// 这里的弧并不是圆上的一弧,而是椭圆的一部分.
private Area frontSite;
private Area leftSite;
private Area rightSite;
private Color color;
private Pie3D selectedPie;
private Point2D arcMiddle;
private Point2D labelPosition;
privatedoublevalue;
privateintshadowDepth;
privatedoubleselectedShiftDis;// 被选中的饼图在他的中线上移动的距离
public Pie3D(Arc2D arc, Color color, double value) {
this(arc, color, value, 10, 30);
}
public Pie3D(Arc2D arc, Color color, double value, int shadowDepth, double selectedShiftDis) {
this.arc = arc;
this.color = color;
this.value = value;
this.selectedShiftDis = selectedShiftDis;
this.shadowDepth = shadowDepth;
Arc2D arcBottom = new Arc2D.Double(arc.getX(), arc.getY() + shadowDepth, arc.getWidth(),
arc.getHeight() + 0, arc.getAngleStart(), arc.getAngleExtent(), Arc2D.CHORD);
Point2D[] topPs = getPointsOfArc(arc);
Point2D[] bottomPs = getPointsOfArc(arcBottom);
// Front site
GeneralPath font = new GeneralPath();
font.moveTo(topPs[1].getX(), topPs[1].getY());
font.lineTo(topPs[2].getX(), topPs[2].getY());
font.lineTo(bottomPs[2].getX(), bottomPs[2].getY());
font.lineTo(bottomPs[1].getX(), bottomPs[1].getY());
font.closePath();
this.frontSite = new Area(arcBottom);
this.frontSite.add(new Area(font));
// Left site
GeneralPath left = new GeneralPath();
left.moveTo(topPs[0].getX(), topPs[0].getY());
left.lineTo(topPs[1].getX(), topPs[1].getY());
left.lineTo(bottomPs[1].getX(), bottomPs[1].getY());
left.lineTo(topPs[0].getX(), topPs[0].getY() + 3);
left.closePath();
this.leftSite = new Area(left);
// Right site
GeneralPath right = new GeneralPath();
right.moveTo(topPs[0].getX(), topPs[0].getY());
right.lineTo(topPs[2].getX(), topPs[2].getY());
right.lineTo(bottomPs[2].getX(), bottomPs[2].getY());
right.lineTo(topPs[0].getX(), topPs[0].getY() + 3);
right.closePath();
this.rightSite = new Area(right);
arcMiddle = calculateArcMiddle();
// Label position: 五分之四处
Point2D c = getPieCenter();
// Point2D m = getChordMiddle();
Point2D