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