JAL-1807 Bob's JalviewJS prototype first commit
[jalviewjs.git] / site / j2s / java / awt / geom / EllipseIterator.js
1 Clazz.declarePackage ("java.awt.geom");\r
2 Clazz.load (["java.awt.geom.PathIterator"], "java.awt.geom.EllipseIterator", ["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, "EllipseIterator", null, java.awt.geom.PathIterator);\r
12 Clazz.makeConstructor (c$, \r
13 function (e, at) {\r
14 this.x = e.getX ();\r
15 this.y = e.getY ();\r
16 this.w = e.getWidth ();\r
17 this.h = e.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.Ellipse2D,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 ("ellipse iterator out of bounds");\r
38 }if (this.index == 5) {\r
39 return 4;\r
40 }if (this.index == 0) {\r
41 var ctrls = java.awt.geom.EllipseIterator.ctrlpts[3];\r
42 coords[0] = (this.x + ctrls[4] * this.w);\r
43 coords[1] = (this.y + ctrls[5] * this.h);\r
44 if (this.affine != null) {\r
45 this.affine.transform (coords, 0, coords, 0, 1);\r
46 }return 0;\r
47 }var ctrls = java.awt.geom.EllipseIterator.ctrlpts[this.index - 1];\r
48 coords[0] = (this.x + ctrls[0] * this.w);\r
49 coords[1] = (this.y + ctrls[1] * this.h);\r
50 coords[2] = (this.x + ctrls[2] * this.w);\r
51 coords[3] = (this.y + ctrls[3] * this.h);\r
52 coords[4] = (this.x + ctrls[4] * this.w);\r
53 coords[5] = (this.y + ctrls[5] * this.h);\r
54 if (this.affine != null) {\r
55 this.affine.transform (coords, 0, coords, 0, 3);\r
56 }return 3;\r
57 }, "~A");\r
58 Clazz.defineMethod (c$, "currentSegment", \r
59 function (coords) {\r
60 if (this.isDone ()) {\r
61 throw  new java.util.NoSuchElementException ("ellipse iterator out of bounds");\r
62 }if (this.index == 5) {\r
63 return 4;\r
64 }if (this.index == 0) {\r
65 var ctrls = java.awt.geom.EllipseIterator.ctrlpts[3];\r
66 coords[0] = this.x + ctrls[4] * this.w;\r
67 coords[1] = this.y + ctrls[5] * this.h;\r
68 if (this.affine != null) {\r
69 this.affine.transform (coords, 0, coords, 0, 1);\r
70 }return 0;\r
71 }var ctrls = java.awt.geom.EllipseIterator.ctrlpts[this.index - 1];\r
72 coords[0] = this.x + ctrls[0] * this.w;\r
73 coords[1] = this.y + ctrls[1] * this.h;\r
74 coords[2] = this.x + ctrls[2] * this.w;\r
75 coords[3] = this.y + ctrls[3] * this.h;\r
76 coords[4] = this.x + ctrls[4] * this.w;\r
77 coords[5] = this.y + ctrls[5] * this.h;\r
78 if (this.affine != null) {\r
79 this.affine.transform (coords, 0, coords, 0, 3);\r
80 }return 3;\r
81 }, "~A");\r
82 Clazz.defineStatics (c$,\r
83 "CtrlVal", 0.5522847498307933,\r
84 "pcv", 0.7761423749153966,\r
85 "ncv", 0.22385762508460333,\r
86 "ctrlpts",  Clazz.newArray (-1, [ Clazz.newDoubleArray (-1, [1.0, 0.7761423749153966, 0.7761423749153966, 1.0, 0.5, 1.0]),  Clazz.newDoubleArray (-1, [0.22385762508460333, 1.0, 0.0, 0.7761423749153966, 0.0, 0.5]),  Clazz.newDoubleArray (-1, [0.0, 0.22385762508460333, 0.22385762508460333, 0.0, 0.5, 0.0]),  Clazz.newDoubleArray (-1, [0.7761423749153966, 0.0, 1.0, 0.22385762508460333, 1.0, 0.5])]));\r
87 });\r