1 | if (extent > -180.0) { // the segment is entirely at the ↵ | | 1 | if (extent < 180.0) { // segment ↵
|
2 | // front of the chart↵ | | 2 | only occupies the front↵
|
3 | if (drawFront) {↵ | | 3 | if (drawFront) {↵
|
4 | Area side = new Area(new Rectangle2D.Double(↵ | | 4 | Area side = new Area(new Rectangle2D.Double(↵
|
5 | arc.getEndPoint().getX(), plotArea.getY(), ↵ | | 5 | arc.getStartPoint().getX(), plotArea.getY(),↵
|
6 | arc.getStartPoint().getX() ↵ | | 6 | arc.getEndPoint().getX() ↵
|
7 | - arc.getEndPoint().getX(),↵ | | 7 | - arc.getStartPoint().getX(),↵
|
8 | plotArea.getHeight()));↵ | | 8 | plotArea.getHeight()));↵
|
9 | side.intersect(front);↵ | | 9 | side.intersect(front);↵
|
10 | g2.setPaint(paint);↵ | | 10 | g2.setPaint(paint);↵
|
11 | g2.fill(side);↵ | | 11 | g2.fill(side);↵
|
12 | g2.setPaint(outlinePaint);↵ | | 12 | g2.setPaint(outlinePaint);↵
|
13 | g2.draw(side);↵ | | 13 | g2.draw(side);↵
|
14 | }↵ | | 14 | }↵
|
15 | }↵ | | 15 | }↵
|
16 | else { // the segment starts at the front, and wraps all ↵ | | 16 | else { // segment↵
|
17 | // the way around↵ | | |
|
18 | // the back and finishes at the front again↵ | | 17 | s wraps right around the back...↵
|
19 | Area side1 = new Area(new Rectangle2D.Double(↵ | | 18 | Area side1 = new Area(new Rectangle2D.Double(↵
|
20 | plotArea.getX(), plotArea.getY(),↵ | | 19 | arc.getStartPoint().getX(), plotArea.getY(),↵
|
21 | arc.getStartPoint().getX() - plotArea.getX(), ↵ | | 20 | plotArea.getMaxX() - arc.getStartPoint().getX(),↵
|
22 | plotArea.getHeight()));↵ | | 21 | plotArea.getHeight()));↵
|
23 | side1.intersect(front);↵ | | 22 | side1.intersect(front);↵
|
|
24 | Area side2 = new Area(new Rectangle2D.Double(↵ | | 23 | Area side2 = new Area(new Rectangle2D.Double(↵
|
25 | arc.getEndPoint().getX(), plotArea.getY(),↵ | | 24 | plotArea.getX(), plotArea.getY(),↵
|
26 | plotArea.getMaxX() - arc.getEndPoint().getX(),↵ | | 25 | arc.getEndPoint().getX() - plotArea.getX(),↵
|
27 | plotArea.getHeight()));↵ | | 26 | plotArea.getHeight()));↵
|
|
28 | side2.intersect(front);↵ | | 27 | side2.intersect(front);↵
|
|
29 | g2.setPaint(paint);↵ | | 28 | g2.setPaint(paint);↵
|
30 | if (drawFront) {↵ | | 29 | if (drawFront) {↵
|
31 | g2.fill(side1);↵ | | 30 | g2.fill(side1);↵
|
32 | g2.fill(side2);↵ | | 31 | g2.fill(side2);↵
|
33 | }↵ | | 32 | }↵
|
|
34 | if (drawBack) {↵ | | 33 | if (drawBack) {↵
|
35 | g2.fill(back);↵ | | 34 | g2.fill(back);↵
|
36 | }↵ | | 35 | }↵
|
|
37 | g2.setPaint(outlinePaint);↵ | | 36 | g2.setPaint(outlinePaint);↵
|
38 | if (drawFront) {↵ | | 37 | if (drawFront) {↵
|
39 | g2.draw(side1);↵ | | 38 | g2.draw(side1);↵
|
40 | g2.draw(side2);↵ | | 39 | g2.draw(side2);↵
|
41 | }↵ | | 40 | }↵
|
|
42 | if (drawBack) {↵ | | 41 | if (drawBack) {↵
|
43 | g2.draw(back);↵ | | 42 | g2.draw(back);↵
|
44 | | | 43 |
|