Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / java / awt / geom / EllipseIterator.js
1 Clazz.declarePackage ("java.awt.geom");
2 Clazz.load (["java.awt.geom.PathIterator"], "java.awt.geom.EllipseIterator", ["java.util.NoSuchElementException"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.x = 0;
5 this.y = 0;
6 this.w = 0;
7 this.h = 0;
8 this.affine = null;
9 this.index = 0;
10 Clazz.instantialize (this, arguments);
11 }, java.awt.geom, "EllipseIterator", null, java.awt.geom.PathIterator);
12 Clazz.makeConstructor (c$, 
13 function (e, at) {
14 this.x = e.getX ();
15 this.y = e.getY ();
16 this.w = e.getWidth ();
17 this.h = e.getHeight ();
18 this.affine = at;
19 if (this.w < 0 || this.h < 0) {
20 this.index = 6;
21 }}, "java.awt.geom.Ellipse2D,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 > 5;
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 ("ellipse iterator out of bounds");
38 }if (this.index == 5) {
39 return 4;
40 }if (this.index == 0) {
41 var ctrls = java.awt.geom.EllipseIterator.ctrlpts[3];
42 coords[0] = (this.x + ctrls[4] * this.w);
43 coords[1] = (this.y + ctrls[5] * this.h);
44 if (this.affine != null) {
45 this.affine.transform (coords, 0, coords, 0, 1);
46 }return 0;
47 }var ctrls = java.awt.geom.EllipseIterator.ctrlpts[this.index - 1];
48 coords[0] = (this.x + ctrls[0] * this.w);
49 coords[1] = (this.y + ctrls[1] * this.h);
50 coords[2] = (this.x + ctrls[2] * this.w);
51 coords[3] = (this.y + ctrls[3] * this.h);
52 coords[4] = (this.x + ctrls[4] * this.w);
53 coords[5] = (this.y + ctrls[5] * this.h);
54 if (this.affine != null) {
55 this.affine.transform (coords, 0, coords, 0, 3);
56 }return 3;
57 }, "~A");
58 Clazz.defineMethod (c$, "currentSegment", 
59 function (coords) {
60 if (this.isDone ()) {
61 throw  new java.util.NoSuchElementException ("ellipse iterator out of bounds");
62 }if (this.index == 5) {
63 return 4;
64 }if (this.index == 0) {
65 var ctrls = java.awt.geom.EllipseIterator.ctrlpts[3];
66 coords[0] = this.x + ctrls[4] * this.w;
67 coords[1] = this.y + ctrls[5] * this.h;
68 if (this.affine != null) {
69 this.affine.transform (coords, 0, coords, 0, 1);
70 }return 0;
71 }var ctrls = java.awt.geom.EllipseIterator.ctrlpts[this.index - 1];
72 coords[0] = this.x + ctrls[0] * this.w;
73 coords[1] = this.y + ctrls[1] * this.h;
74 coords[2] = this.x + ctrls[2] * this.w;
75 coords[3] = this.y + ctrls[3] * this.h;
76 coords[4] = this.x + ctrls[4] * this.w;
77 coords[5] = this.y + ctrls[5] * this.h;
78 if (this.affine != null) {
79 this.affine.transform (coords, 0, coords, 0, 3);
80 }return 3;
81 }, "~A");
82 Clazz.defineStatics (c$,
83 "CtrlVal", 0.5522847498307933,
84 "pcv", 0.7761423749153966,
85 "ncv", 0.22385762508460333,
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])]));
87 });