1 | if (this.labelLinksVisible) {↵ | | 1 | if (this.labelLinksVisible) {↵
|
2 | double theta = record.getAngle();↵ | | 2 | double theta = record.getAngle();↵
|
3 | double linkX = state.getPieCenterX() + Math.cos(theta) ↵ | | 3 | double linkX = state.getPieCenterX() + Math.cos(theta) ↵
|
4 | * state.getPieWRadius() * record.getLinkPercent();↵ | | 4 | * state.getPieWRadius() * record.getLinkPercent();↵
|
5 | double linkY = state.getPieCenterY() - Math.sin(theta) ↵ | | 5 | double linkY = state.getPieCenterY() - Math.sin(theta) ↵
|
6 | * state.getPieHRadius() * record.getLinkPercent();↵ | | 6 | * state.getPieHRadius() * record.getLinkPercent();↵
|
7 | double elbowX = state.getPieCenterX() + Math.cos(theta) ↵ | | 7 | double elbowX = state.getPieCenterX() + Math.cos(theta) ↵
|
8 | * state.getLinkArea().getWidth() / 2.0;↵ | | 8 | * state.getLinkArea().getWidth() / 2.0;↵
|
9 | double elbowY = state.getPieCenterY() - Math.sin(theta) ↵ | | 9 | double elbowY = state.getPieCenterY() - Math.sin(theta) ↵
|
10 | * state.getLinkArea().getHeight() / 2.0;↵ | | 10 | * state.getLinkArea().getHeight() / 2.0;↵
|
11 | double anchorY = elbowY;↵ | | 11 | double anchorY = elbowY;↵
|
12 | g2.setPaint(this.labelLinkPaint);↵ | | 12 | g2.setPaint(this.labelLinkPaint);↵
|
13 | g2.setStroke(this.labelLinkStroke);↵ | | 13 | g2.setStroke(this.labelLinkStroke);↵
|
14 | PieLabelLinkStyle style = getLabelLinkStyle();↵ | | 14 | PieLabelLinkStyle style = getLabelLinkStyle();↵
|
15 | if (style.equals(PieLabelLinkStyle.STANDARD)) {↵ | | 15 | if (style.equals(PieLabelLinkStyle.STANDARD)) {↵
|
16 | g2.draw(new Line2D.Double(linkX, linkY, elbowX, elbowY));↵ | | 16 | g2.draw(new Line2D.Double(linkX, linkY, elbowX, elbowY));↵
|
17 | g2.draw(new Line2D.Double(anchorX, anchorY, elbowX, elbowY));↵ | | 17 | g2.draw(new Line2D.Double(anchorX, anchorY, elbowX, elbowY));↵
|
18 | g2.draw(new Line2D.Double(anchorX, anchorY, targetX, targetY));↵ | | 18 | g2.draw(new Line2D.Double(anchorX, anchorY, targetX, targetY));↵
|
19 | }↵ | | 19 | }↵
|
20 | else if (style.equals(PieLabelLinkStyle.QUAD_CURVE)) {↵ | | 20 | else if (style.equals(PieLabelLinkStyle.QUAD_CURVE)) {↵
|
21 | QuadCurve2D q = new QuadCurve2D.Float();↵ | | 21 | QuadCurve2D q = new QuadCurve2D.Float();↵
|
22 | q.setCurve(targetX, targetY, anchorX, anchorY, elbowX, elbowY);↵ | | 22 | q.setCurve(targetX, targetY, anchorX, anchorY, elbowX, elbowY);↵
|
23 | g2.draw(q);↵ | | 23 | g2.draw(q);↵
|
24 | g2.draw(new Line2D.Double(elbowX, elbowY, linkX, linkY)); ↵ | | 24 | g2.draw(new Line2D.Double(elbowX, elbowY, linkX, linkY)); ↵
|
25 | }↵ | | 25 | }↵
|
26 | else if (style.equals(PieLabelLinkStyle.CUBIC_CURVE)) {↵ | | 26 | else if (style.equals(PieLabelLinkStyle.CUBIC_CURVE)) {↵
|
27 | CubicCurve2D c = new CubicCurve2D .Float();↵ | | 27 | CubicCurve2D c = new CubicCurve2D .Float();↵
|
28 | c.setCurve(targetX, targetY, anchorX, anchorY, elbowX, elbowY, ↵ | | 28 | c.setCurve(targetX, targetY, anchorX, anchorY, elbowX, elbowY, ↵
|
29 | linkX, linkY);↵ | | 29 | linkX, linkY);↵
|
30 | g2.draw(c);↵ | | 30 | g2.draw(c);↵
|
31 | | | 31 |
|