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