JAL-1807 update
[jalviewjs.git] / site / j2s / java / awt / geom / RoundRectIterator.js
1 Clazz.declarePackage ("java.awt.geom");
2 Clazz.load (["java.awt.geom.PathIterator"], "java.awt.geom.RoundRectIterator", ["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.aw = 0;
9 this.ah = 0;
10 this.affine = null;
11 this.index = 0;
12 Clazz.instantialize (this, arguments);
13 }, java.awt.geom, "RoundRectIterator", null, java.awt.geom.PathIterator);
14 Clazz.makeConstructor (c$, 
15 function (rr, at) {
16 this.x = rr.getX ();
17 this.y = rr.getY ();
18 this.w = rr.getWidth ();
19 this.h = rr.getHeight ();
20 this.aw = Math.min (this.w, Math.abs (rr.getArcWidth ()));
21 this.ah = Math.min (this.h, Math.abs (rr.getArcHeight ()));
22 this.affine = at;
23 if (this.aw < 0 || this.ah < 0) {
24 this.index = java.awt.geom.RoundRectIterator.ctrlpts.length;
25 }}, "java.awt.geom.RoundRectangle2D,java.awt.geom.AffineTransform");
26 Clazz.overrideMethod (c$, "getWindingRule", 
27 function () {
28 return 1;
29 });
30 Clazz.overrideMethod (c$, "isDone", 
31 function () {
32 return this.index >= java.awt.geom.RoundRectIterator.ctrlpts.length;
33 });
34 Clazz.overrideMethod (c$, "next", 
35 function () {
36 this.index++;
37 });
38 Clazz.defineMethod (c$, "currentSegment", 
39 function (coords) {
40 if (this.isDone ()) {
41 throw  new java.util.NoSuchElementException ("roundrect iterator out of bounds");
42 }var ctrls = java.awt.geom.RoundRectIterator.ctrlpts[this.index];
43 var nc = 0;
44 for (var i = 0; i < ctrls.length; i += 4) {
45 coords[nc++] = (this.x + ctrls[i + 0] * this.w + ctrls[i + 1] * this.aw);
46 coords[nc++] = (this.y + ctrls[i + 2] * this.h + ctrls[i + 3] * this.ah);
47 }
48 if (this.affine != null) {
49 this.affine.transform (coords, 0, coords, 0, Clazz.doubleToInt (nc / 2));
50 }return java.awt.geom.RoundRectIterator.types[this.index];
51 }, "~A");
52 Clazz.defineMethod (c$, "currentSegment", 
53 function (coords) {
54 if (this.isDone ()) {
55 throw  new java.util.NoSuchElementException ("roundrect iterator out of bounds");
56 }var ctrls = java.awt.geom.RoundRectIterator.ctrlpts[this.index];
57 var nc = 0;
58 for (var i = 0; i < ctrls.length; i += 4) {
59 coords[nc++] = (this.x + ctrls[i + 0] * this.w + ctrls[i + 1] * this.aw);
60 coords[nc++] = (this.y + ctrls[i + 2] * this.h + ctrls[i + 3] * this.ah);
61 }
62 if (this.affine != null) {
63 this.affine.transform (coords, 0, coords, 0, Clazz.doubleToInt (nc / 2));
64 }return java.awt.geom.RoundRectIterator.types[this.index];
65 }, "~A");
66 Clazz.defineStatics (c$,
67 "angle", 0.7853981633974483);
68 c$.a = c$.prototype.a = 1.0 - Math.cos (0.7853981633974483);
69 c$.b = c$.prototype.b = Math.tan (0.7853981633974483);
70 c$.c = c$.prototype.c = Math.sqrt (1.0 + java.awt.geom.RoundRectIterator.b * java.awt.geom.RoundRectIterator.b) - 1 + java.awt.geom.RoundRectIterator.a;
71 c$.cv = c$.prototype.cv = 1.3333333333333333 * java.awt.geom.RoundRectIterator.a * java.awt.geom.RoundRectIterator.b / java.awt.geom.RoundRectIterator.c;
72 c$.acv = c$.prototype.acv = (1.0 - java.awt.geom.RoundRectIterator.cv) / 2.0;
73 c$.ctrlpts = c$.prototype.ctrlpts =  Clazz.newArray (-1, [ Clazz.newDoubleArray (-1, [0.0, 0.0, 0.0, 0.5]),  Clazz.newDoubleArray (-1, [0.0, 0.0, 1.0, -0.5]),  Clazz.newDoubleArray (-1, [0.0, 0.0, 1.0, -java.awt.geom.RoundRectIterator.acv, 0.0, java.awt.geom.RoundRectIterator.acv, 1.0, 0.0, 0.0, 0.5, 1.0, 0.0]),  Clazz.newDoubleArray (-1, [1.0, -0.5, 1.0, 0.0]),  Clazz.newDoubleArray (-1, [1.0, -java.awt.geom.RoundRectIterator.acv, 1.0, 0.0, 1.0, 0.0, 1.0, -java.awt.geom.RoundRectIterator.acv, 1.0, 0.0, 1.0, -0.5]),  Clazz.newDoubleArray (-1, [1.0, 0.0, 0.0, 0.5]),  Clazz.newDoubleArray (-1, [1.0, 0.0, 0.0, java.awt.geom.RoundRectIterator.acv, 1.0, -java.awt.geom.RoundRectIterator.acv, 0.0, 0.0, 1.0, -0.5, 0.0, 0.0]),  Clazz.newDoubleArray (-1, [0.0, 0.5, 0.0, 0.0]),  Clazz.newDoubleArray (-1, [0.0, java.awt.geom.RoundRectIterator.acv, 0.0, 0.0, 0.0, 0.0, 0.0, java.awt.geom.RoundRectIterator.acv, 0.0, 0.0, 0.0, 0.5]),  Clazz.newDoubleArray (-1, [])]);
74 Clazz.defineStatics (c$,
75 "types",  Clazz.newIntArray (-1, [0, 1, 3, 1, 3, 1, 3, 1, 3, 4]));
76 });