1 Clazz.declarePackage ("java.awt.geom");
\r
2 Clazz.load (["java.awt.geom.PathIterator"], "java.awt.geom.ArcIterator", ["java.util.NoSuchElementException"], function () {
\r
3 c$ = Clazz.decorateAsClass (function () {
\r
15 Clazz.instantialize (this, arguments);
\r
16 }, java.awt.geom, "ArcIterator", null, java.awt.geom.PathIterator);
\r
17 Clazz.makeConstructor (c$,
\r
19 this.w = a.getWidth () / 2;
\r
20 this.h = a.getHeight () / 2;
\r
21 this.x = a.getX () + this.w;
\r
22 this.y = a.getY () + this.h;
\r
23 this.angStRad = -Math.toRadians (a.getAngleStart ());
\r
25 var ext = -a.getAngleExtent ();
\r
26 if (ext >= 360.0 || ext <= -360) {
\r
28 this.increment = 1.5707963267948966;
\r
29 this.cv = 0.5522847498307933;
\r
31 this.increment = -this.increment;
\r
34 this.arcSegs = Clazz.doubleToInt (Math.ceil (Math.abs (ext) / 90.0));
\r
35 this.increment = Math.toRadians (ext / this.arcSegs);
\r
36 this.cv = java.awt.geom.ArcIterator.btan (this.increment);
\r
39 }}switch (a.getArcType ()) {
\r
50 if (this.w < 0 || this.h < 0) {
\r
51 this.arcSegs = this.lineSegs = -1;
\r
52 }}, "java.awt.geom.Arc2D,java.awt.geom.AffineTransform");
\r
53 Clazz.overrideMethod (c$, "getWindingRule",
\r
57 Clazz.overrideMethod (c$, "isDone",
\r
59 return this.index > this.arcSegs + this.lineSegs;
\r
61 Clazz.overrideMethod (c$, "next",
\r
65 c$.btan = Clazz.defineMethod (c$, "btan",
\r
66 function (increment) {
\r
68 return 1.3333333333333333 * Math.sin (increment) / (1.0 + Math.cos (increment));
\r
70 Clazz.defineMethod (c$, "currentSegment",
\r
72 if (this.isDone ()) {
\r
73 throw new java.util.NoSuchElementException ("arc iterator out of bounds");
\r
74 }var angle = this.angStRad;
\r
75 if (this.index == 0) {
\r
76 coords[0] = (this.x + Math.cos (angle) * this.w);
\r
77 coords[1] = (this.y + Math.sin (angle) * this.h);
\r
78 if (this.affine != null) {
\r
79 this.affine.transform (coords, 0, coords, 0, 1);
\r
81 }if (this.index > this.arcSegs) {
\r
82 if (this.index == this.arcSegs + this.lineSegs) {
\r
84 }coords[0] = this.x;
\r
86 if (this.affine != null) {
\r
87 this.affine.transform (coords, 0, coords, 0, 1);
\r
89 }angle += this.increment * (this.index - 1);
\r
90 var relx = Math.cos (angle);
\r
91 var rely = Math.sin (angle);
\r
92 coords[0] = (this.x + (relx - this.cv * rely) * this.w);
\r
93 coords[1] = (this.y + (rely + this.cv * relx) * this.h);
\r
94 angle += this.increment;
\r
95 relx = Math.cos (angle);
\r
96 rely = Math.sin (angle);
\r
97 coords[2] = (this.x + (relx + this.cv * rely) * this.w);
\r
98 coords[3] = (this.y + (rely - this.cv * relx) * this.h);
\r
99 coords[4] = (this.x + relx * this.w);
\r
100 coords[5] = (this.y + rely * this.h);
\r
101 if (this.affine != null) {
\r
102 this.affine.transform (coords, 0, coords, 0, 3);
\r
105 Clazz.defineMethod (c$, "currentSegment",
\r
106 function (coords) {
\r
107 if (this.isDone ()) {
\r
108 throw new java.util.NoSuchElementException ("arc iterator out of bounds");
\r
109 }var angle = this.angStRad;
\r
110 if (this.index == 0) {
\r
111 coords[0] = this.x + Math.cos (angle) * this.w;
\r
112 coords[1] = this.y + Math.sin (angle) * this.h;
\r
113 if (this.affine != null) {
\r
114 this.affine.transform (coords, 0, coords, 0, 1);
\r
116 }if (this.index > this.arcSegs) {
\r
117 if (this.index == this.arcSegs + this.lineSegs) {
\r
119 }coords[0] = this.x;
\r
120 coords[1] = this.y;
\r
121 if (this.affine != null) {
\r
122 this.affine.transform (coords, 0, coords, 0, 1);
\r
124 }angle += this.increment * (this.index - 1);
\r
125 var relx = Math.cos (angle);
\r
126 var rely = Math.sin (angle);
\r
127 coords[0] = this.x + (relx - this.cv * rely) * this.w;
\r
128 coords[1] = this.y + (rely + this.cv * relx) * this.h;
\r
129 angle += this.increment;
\r
130 relx = Math.cos (angle);
\r
131 rely = Math.sin (angle);
\r
132 coords[2] = this.x + (relx + this.cv * rely) * this.w;
\r
133 coords[3] = this.y + (rely - this.cv * relx) * this.h;
\r
134 coords[4] = this.x + relx * this.w;
\r
135 coords[5] = this.y + rely * this.h;
\r
136 if (this.affine != null) {
\r
137 this.affine.transform (coords, 0, coords, 0, 3);
\r