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