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