JAL-1807 Bob's JalviewJS prototype first commit
[jalviewjs.git] / site / j2s / java / awt / geom / CubicIterator.js
1 Clazz.declarePackage ("java.awt.geom");\r
2 Clazz.load (["java.awt.geom.PathIterator"], "java.awt.geom.CubicIterator", ["java.util.NoSuchElementException"], function () {\r
3 c$ = Clazz.decorateAsClass (function () {\r
4 this.cubic = null;\r
5 this.affine = null;\r
6 this.index = 0;\r
7 Clazz.instantialize (this, arguments);\r
8 }, java.awt.geom, "CubicIterator", null, java.awt.geom.PathIterator);\r
9 Clazz.makeConstructor (c$, \r
10 function () {\r
11 });\r
12 Clazz.makeConstructor (c$, \r
13 function (q, at) {\r
14 this.set (q, at);\r
15 }, "java.awt.geom.CubicCurve2D,java.awt.geom.AffineTransform");\r
16 Clazz.defineMethod (c$, "set", \r
17 function (q, at) {\r
18 this.cubic = q;\r
19 this.affine = at;\r
20 return this;\r
21 }, "java.awt.geom.CubicCurve2D,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 > 1);\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 ("cubic iterator iterator out of bounds");\r
38 }var type;\r
39 if (this.index == 0) {\r
40 coords[0] = this.cubic.getX1 ();\r
41 coords[1] = this.cubic.getY1 ();\r
42 type = 0;\r
43 } else {\r
44 coords[0] = this.cubic.getCtrlX1 ();\r
45 coords[1] = this.cubic.getCtrlY1 ();\r
46 coords[2] = this.cubic.getCtrlX2 ();\r
47 coords[3] = this.cubic.getCtrlY2 ();\r
48 coords[4] = this.cubic.getX2 ();\r
49 coords[5] = this.cubic.getY2 ();\r
50 type = 3;\r
51 }if (this.affine != null) {\r
52 this.affine.transform (coords, 0, coords, 0, this.index == 0 ? 1 : 3);\r
53 }return type;\r
54 }, "~A");\r
55 Clazz.defineMethod (c$, "currentSegment", \r
56 function (coords) {\r
57 if (this.isDone ()) {\r
58 throw  new java.util.NoSuchElementException ("cubic iterator iterator out of bounds");\r
59 }var type;\r
60 if (this.index == 0) {\r
61 coords[0] = this.cubic.getX1 ();\r
62 coords[1] = this.cubic.getY1 ();\r
63 type = 0;\r
64 } else {\r
65 coords[0] = this.cubic.getCtrlX1 ();\r
66 coords[1] = this.cubic.getCtrlY1 ();\r
67 coords[2] = this.cubic.getCtrlX2 ();\r
68 coords[3] = this.cubic.getCtrlY2 ();\r
69 coords[4] = this.cubic.getX2 ();\r
70 coords[5] = this.cubic.getY2 ();\r
71 type = 3;\r
72 }if (this.affine != null) {\r
73 this.affine.transform (coords, 0, coords, 0, this.index == 0 ? 1 : 3);\r
74 }return type;\r
75 }, "~A");\r
76 });\r