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