JAL-1807 Bob's JalviewJS prototype first commit
[jalviewjs.git] / site / j2s / java / awt / geom / RectIterator.js
1 Clazz.declarePackage ("java.awt.geom");\r
2 Clazz.load (["java.awt.geom.PathIterator"], "java.awt.geom.RectIterator", ["java.util.NoSuchElementException"], function () {\r
3 c$ = Clazz.decorateAsClass (function () {\r
4 this.x = 0;\r
5 this.y = 0;\r
6 this.w = 0;\r
7 this.h = 0;\r
8 this.affine = null;\r
9 this.index = 0;\r
10 Clazz.instantialize (this, arguments);\r
11 }, java.awt.geom, "RectIterator", null, java.awt.geom.PathIterator);\r
12 Clazz.makeConstructor (c$, \r
13 function (r, at) {\r
14 this.x = r.getX ();\r
15 this.y = r.getY ();\r
16 this.w = r.getWidth ();\r
17 this.h = r.getHeight ();\r
18 this.affine = at;\r
19 if (this.w < 0 || this.h < 0) {\r
20 this.index = 6;\r
21 }}, "java.awt.geom.Rectangle2D,java.awt.geom.AffineTransform");\r
22 Clazz.overrideMethod (c$, "getWindingRule", \r
23 function () {\r
24 return 1;\r
25 });\r
26 Clazz.overrideMethod (c$, "isDone", \r
27 function () {\r
28 return this.index > 5;\r
29 });\r
30 Clazz.overrideMethod (c$, "next", \r
31 function () {\r
32 this.index++;\r
33 });\r
34 Clazz.defineMethod (c$, "currentSegment", \r
35 function (coords) {\r
36 if (this.isDone ()) {\r
37 throw  new java.util.NoSuchElementException ("rect iterator out of bounds");\r
38 }if (this.index == 5) {\r
39 return 4;\r
40 }coords[0] = this.x;\r
41 coords[1] = this.y;\r
42 if (this.index == 1 || this.index == 2) {\r
43 coords[0] += this.w;\r
44 }if (this.index == 2 || this.index == 3) {\r
45 coords[1] += this.h;\r
46 }if (this.affine != null) {\r
47 this.affine.transform (coords, 0, coords, 0, 1);\r
48 }return (this.index == 0 ? 0 : 1);\r
49 }, "~A");\r
50 Clazz.defineMethod (c$, "currentSegment", \r
51 function (coords) {\r
52 if (this.isDone ()) {\r
53 throw  new java.util.NoSuchElementException ("rect iterator out of bounds");\r
54 }if (this.index == 5) {\r
55 return 4;\r
56 }coords[0] = this.x;\r
57 coords[1] = this.y;\r
58 if (this.index == 1 || this.index == 2) {\r
59 coords[0] += this.w;\r
60 }if (this.index == 2 || this.index == 3) {\r
61 coords[1] += this.h;\r
62 }if (this.affine != null) {\r
63 this.affine.transform (coords, 0, coords, 0, 1);\r
64 }return (this.index == 0 ? 0 : 1);\r
65 }, "~A");\r
66 });\r