Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / java / awt / geom / ArcIterator.js
index e0b6ab5..05fa96e 100644 (file)
-Clazz.declarePackage ("java.awt.geom");\r
-Clazz.load (["java.awt.geom.PathIterator"], "java.awt.geom.ArcIterator", ["java.util.NoSuchElementException"], function () {\r
-c$ = Clazz.decorateAsClass (function () {\r
-this.x = 0;\r
-this.y = 0;\r
-this.w = 0;\r
-this.h = 0;\r
-this.angStRad = 0;\r
-this.increment = 0;\r
-this.cv = 0;\r
-this.affine = null;\r
-this.index = 0;\r
-this.arcSegs = 0;\r
-this.lineSegs = 0;\r
-Clazz.instantialize (this, arguments);\r
-}, java.awt.geom, "ArcIterator", null, java.awt.geom.PathIterator);\r
-Clazz.makeConstructor (c$, \r
-function (a, at) {\r
-this.w = a.getWidth () / 2;\r
-this.h = a.getHeight () / 2;\r
-this.x = a.getX () + this.w;\r
-this.y = a.getY () + this.h;\r
-this.angStRad = -Math.toRadians (a.getAngleStart ());\r
-this.affine = at;\r
-var ext = -a.getAngleExtent ();\r
-if (ext >= 360.0 || ext <= -360) {\r
-this.arcSegs = 4;\r
-this.increment = 1.5707963267948966;\r
-this.cv = 0.5522847498307933;\r
-if (ext < 0) {\r
-this.increment = -this.increment;\r
-this.cv = -this.cv;\r
-}} else {\r
-this.arcSegs = Clazz.doubleToInt (Math.ceil (Math.abs (ext) / 90.0));\r
-this.increment = Math.toRadians (ext / this.arcSegs);\r
-this.cv = java.awt.geom.ArcIterator.btan (this.increment);\r
-if (this.cv == 0) {\r
-this.arcSegs = 0;\r
-}}switch (a.getArcType ()) {\r
-case 0:\r
-this.lineSegs = 0;\r
-break;\r
-case 1:\r
-this.lineSegs = 1;\r
-break;\r
-case 2:\r
-this.lineSegs = 2;\r
-break;\r
-}\r
-if (this.w < 0 || this.h < 0) {\r
-this.arcSegs = this.lineSegs = -1;\r
-}}, "java.awt.geom.Arc2D,java.awt.geom.AffineTransform");\r
-Clazz.overrideMethod (c$, "getWindingRule", \r
-function () {\r
-return 1;\r
-});\r
-Clazz.overrideMethod (c$, "isDone", \r
-function () {\r
-return this.index > this.arcSegs + this.lineSegs;\r
-});\r
-Clazz.overrideMethod (c$, "next", \r
-function () {\r
-this.index++;\r
-});\r
-c$.btan = Clazz.defineMethod (c$, "btan", \r
- function (increment) {\r
-increment /= 2.0;\r
-return 1.3333333333333333 * Math.sin (increment) / (1.0 + Math.cos (increment));\r
-}, "~N");\r
-Clazz.defineMethod (c$, "currentSegment", \r
-function (coords) {\r
-if (this.isDone ()) {\r
-throw  new java.util.NoSuchElementException ("arc iterator out of bounds");\r
-}var angle = this.angStRad;\r
-if (this.index == 0) {\r
-coords[0] = (this.x + Math.cos (angle) * this.w);\r
-coords[1] = (this.y + Math.sin (angle) * this.h);\r
-if (this.affine != null) {\r
-this.affine.transform (coords, 0, coords, 0, 1);\r
-}return 0;\r
-}if (this.index > this.arcSegs) {\r
-if (this.index == this.arcSegs + this.lineSegs) {\r
-return 4;\r
-}coords[0] = this.x;\r
-coords[1] = this.y;\r
-if (this.affine != null) {\r
-this.affine.transform (coords, 0, coords, 0, 1);\r
-}return 1;\r
-}angle += this.increment * (this.index - 1);\r
-var relx = Math.cos (angle);\r
-var rely = Math.sin (angle);\r
-coords[0] = (this.x + (relx - this.cv * rely) * this.w);\r
-coords[1] = (this.y + (rely + this.cv * relx) * this.h);\r
-angle += this.increment;\r
-relx = Math.cos (angle);\r
-rely = Math.sin (angle);\r
-coords[2] = (this.x + (relx + this.cv * rely) * this.w);\r
-coords[3] = (this.y + (rely - this.cv * relx) * this.h);\r
-coords[4] = (this.x + relx * this.w);\r
-coords[5] = (this.y + rely * this.h);\r
-if (this.affine != null) {\r
-this.affine.transform (coords, 0, coords, 0, 3);\r
-}return 3;\r
-}, "~A");\r
-Clazz.defineMethod (c$, "currentSegment", \r
-function (coords) {\r
-if (this.isDone ()) {\r
-throw  new java.util.NoSuchElementException ("arc iterator out of bounds");\r
-}var angle = this.angStRad;\r
-if (this.index == 0) {\r
-coords[0] = this.x + Math.cos (angle) * this.w;\r
-coords[1] = this.y + Math.sin (angle) * this.h;\r
-if (this.affine != null) {\r
-this.affine.transform (coords, 0, coords, 0, 1);\r
-}return 0;\r
-}if (this.index > this.arcSegs) {\r
-if (this.index == this.arcSegs + this.lineSegs) {\r
-return 4;\r
-}coords[0] = this.x;\r
-coords[1] = this.y;\r
-if (this.affine != null) {\r
-this.affine.transform (coords, 0, coords, 0, 1);\r
-}return 1;\r
-}angle += this.increment * (this.index - 1);\r
-var relx = Math.cos (angle);\r
-var rely = Math.sin (angle);\r
-coords[0] = this.x + (relx - this.cv * rely) * this.w;\r
-coords[1] = this.y + (rely + this.cv * relx) * this.h;\r
-angle += this.increment;\r
-relx = Math.cos (angle);\r
-rely = Math.sin (angle);\r
-coords[2] = this.x + (relx + this.cv * rely) * this.w;\r
-coords[3] = this.y + (rely - this.cv * relx) * this.h;\r
-coords[4] = this.x + relx * this.w;\r
-coords[5] = this.y + rely * this.h;\r
-if (this.affine != null) {\r
-this.affine.transform (coords, 0, coords, 0, 3);\r
-}return 3;\r
-}, "~A");\r
-});\r
+Clazz.declarePackage ("java.awt.geom");
+Clazz.load (["java.awt.geom.PathIterator"], "java.awt.geom.ArcIterator", ["java.util.NoSuchElementException"], function () {
+c$ = Clazz.decorateAsClass (function () {
+this.x = 0;
+this.y = 0;
+this.w = 0;
+this.h = 0;
+this.angStRad = 0;
+this.increment = 0;
+this.cv = 0;
+this.affine = null;
+this.index = 0;
+this.arcSegs = 0;
+this.lineSegs = 0;
+Clazz.instantialize (this, arguments);
+}, java.awt.geom, "ArcIterator", null, java.awt.geom.PathIterator);
+Clazz.makeConstructor (c$, 
+function (a, at) {
+this.w = a.getWidth () / 2;
+this.h = a.getHeight () / 2;
+this.x = a.getX () + this.w;
+this.y = a.getY () + this.h;
+this.angStRad = -Math.toRadians (a.getAngleStart ());
+this.affine = at;
+var ext = -a.getAngleExtent ();
+if (ext >= 360.0 || ext <= -360) {
+this.arcSegs = 4;
+this.increment = 1.5707963267948966;
+this.cv = 0.5522847498307933;
+if (ext < 0) {
+this.increment = -this.increment;
+this.cv = -this.cv;
+}} else {
+this.arcSegs = Clazz.doubleToInt (Math.ceil (Math.abs (ext) / 90.0));
+this.increment = Math.toRadians (ext / this.arcSegs);
+this.cv = java.awt.geom.ArcIterator.btan (this.increment);
+if (this.cv == 0) {
+this.arcSegs = 0;
+}}switch (a.getArcType ()) {
+case 0:
+this.lineSegs = 0;
+break;
+case 1:
+this.lineSegs = 1;
+break;
+case 2:
+this.lineSegs = 2;
+break;
+}
+if (this.w < 0 || this.h < 0) {
+this.arcSegs = this.lineSegs = -1;
+}}, "java.awt.geom.Arc2D,java.awt.geom.AffineTransform");
+Clazz.overrideMethod (c$, "getWindingRule", 
+function () {
+return 1;
+});
+Clazz.overrideMethod (c$, "isDone", 
+function () {
+return this.index > this.arcSegs + this.lineSegs;
+});
+Clazz.overrideMethod (c$, "next", 
+function () {
+this.index++;
+});
+c$.btan = Clazz.defineMethod (c$, "btan", 
+ function (increment) {
+increment /= 2.0;
+return 1.3333333333333333 * Math.sin (increment) / (1.0 + Math.cos (increment));
+}, "~N");
+Clazz.defineMethod (c$, "currentSegment", 
+function (coords) {
+if (this.isDone ()) {
+throw  new java.util.NoSuchElementException ("arc iterator out of bounds");
+}var angle = this.angStRad;
+if (this.index == 0) {
+coords[0] = (this.x + Math.cos (angle) * this.w);
+coords[1] = (this.y + Math.sin (angle) * this.h);
+if (this.affine != null) {
+this.affine.transform (coords, 0, coords, 0, 1);
+}return 0;
+}if (this.index > this.arcSegs) {
+if (this.index == this.arcSegs + this.lineSegs) {
+return 4;
+}coords[0] = this.x;
+coords[1] = this.y;
+if (this.affine != null) {
+this.affine.transform (coords, 0, coords, 0, 1);
+}return 1;
+}angle += this.increment * (this.index - 1);
+var relx = Math.cos (angle);
+var rely = Math.sin (angle);
+coords[0] = (this.x + (relx - this.cv * rely) * this.w);
+coords[1] = (this.y + (rely + this.cv * relx) * this.h);
+angle += this.increment;
+relx = Math.cos (angle);
+rely = Math.sin (angle);
+coords[2] = (this.x + (relx + this.cv * rely) * this.w);
+coords[3] = (this.y + (rely - this.cv * relx) * this.h);
+coords[4] = (this.x + relx * this.w);
+coords[5] = (this.y + rely * this.h);
+if (this.affine != null) {
+this.affine.transform (coords, 0, coords, 0, 3);
+}return 3;
+}, "~A");
+Clazz.defineMethod (c$, "currentSegment", 
+function (coords) {
+if (this.isDone ()) {
+throw  new java.util.NoSuchElementException ("arc iterator out of bounds");
+}var angle = this.angStRad;
+if (this.index == 0) {
+coords[0] = this.x + Math.cos (angle) * this.w;
+coords[1] = this.y + Math.sin (angle) * this.h;
+if (this.affine != null) {
+this.affine.transform (coords, 0, coords, 0, 1);
+}return 0;
+}if (this.index > this.arcSegs) {
+if (this.index == this.arcSegs + this.lineSegs) {
+return 4;
+}coords[0] = this.x;
+coords[1] = this.y;
+if (this.affine != null) {
+this.affine.transform (coords, 0, coords, 0, 1);
+}return 1;
+}angle += this.increment * (this.index - 1);
+var relx = Math.cos (angle);
+var rely = Math.sin (angle);
+coords[0] = this.x + (relx - this.cv * rely) * this.w;
+coords[1] = this.y + (rely + this.cv * relx) * this.h;
+angle += this.increment;
+relx = Math.cos (angle);
+rely = Math.sin (angle);
+coords[2] = this.x + (relx + this.cv * rely) * this.w;
+coords[3] = this.y + (rely - this.cv * relx) * this.h;
+coords[4] = this.x + relx * this.w;
+coords[5] = this.y + rely * this.h;
+if (this.affine != null) {
+this.affine.transform (coords, 0, coords, 0, 3);
+}return 3;
+}, "~A");
+});