X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=site%2Fj2s%2Fjava%2Fawt%2Fgeom%2FCubicIterator.js;fp=site%2Fj2s%2Fjava%2Fawt%2Fgeom%2FCubicIterator.js;h=f5e2dc8c8e1e9b18749a574192854f8b6737f296;hb=4231d40261fef32ce4570a6bbad0d35df44e8baf;hp=0000000000000000000000000000000000000000;hpb=c07eb2c5794833bd0241000d6844d783fe10cb82;p=jalview.git diff --git a/site/j2s/java/awt/geom/CubicIterator.js b/site/j2s/java/awt/geom/CubicIterator.js new file mode 100644 index 0000000..f5e2dc8 --- /dev/null +++ b/site/j2s/java/awt/geom/CubicIterator.js @@ -0,0 +1,76 @@ +Clazz.declarePackage ("java.awt.geom"); +Clazz.load (["java.awt.geom.PathIterator"], "java.awt.geom.CubicIterator", ["java.util.NoSuchElementException"], function () { +c$ = Clazz.decorateAsClass (function () { +this.cubic = null; +this.affine = null; +this.index = 0; +Clazz.instantialize (this, arguments); +}, java.awt.geom, "CubicIterator", null, java.awt.geom.PathIterator); +Clazz.makeConstructor (c$, +function () { +}); +Clazz.makeConstructor (c$, +function (q, at) { +this.set (q, at); +}, "java.awt.geom.CubicCurve2D,java.awt.geom.AffineTransform"); +Clazz.defineMethod (c$, "set", +function (q, at) { +this.cubic = q; +this.affine = at; +return this; +}, "java.awt.geom.CubicCurve2D,java.awt.geom.AffineTransform"); +Clazz.overrideMethod (c$, "getWindingRule", +function () { +return 1; +}); +Clazz.overrideMethod (c$, "isDone", +function () { +return (this.index > 1); +}); +Clazz.overrideMethod (c$, "next", +function () { +this.index++; +}); +Clazz.defineMethod (c$, "currentSegment", +function (coords) { +if (this.isDone ()) { +throw new java.util.NoSuchElementException ("cubic iterator iterator out of bounds"); +}var type; +if (this.index == 0) { +coords[0] = this.cubic.getX1 (); +coords[1] = this.cubic.getY1 (); +type = 0; +} else { +coords[0] = this.cubic.getCtrlX1 (); +coords[1] = this.cubic.getCtrlY1 (); +coords[2] = this.cubic.getCtrlX2 (); +coords[3] = this.cubic.getCtrlY2 (); +coords[4] = this.cubic.getX2 (); +coords[5] = this.cubic.getY2 (); +type = 3; +}if (this.affine != null) { +this.affine.transform (coords, 0, coords, 0, this.index == 0 ? 1 : 3); +}return type; +}, "~A"); +Clazz.defineMethod (c$, "currentSegment", +function (coords) { +if (this.isDone ()) { +throw new java.util.NoSuchElementException ("cubic iterator iterator out of bounds"); +}var type; +if (this.index == 0) { +coords[0] = this.cubic.getX1 (); +coords[1] = this.cubic.getY1 (); +type = 0; +} else { +coords[0] = this.cubic.getCtrlX1 (); +coords[1] = this.cubic.getCtrlY1 (); +coords[2] = this.cubic.getCtrlX2 (); +coords[3] = this.cubic.getCtrlY2 (); +coords[4] = this.cubic.getX2 (); +coords[5] = this.cubic.getY2 (); +type = 3; +}if (this.affine != null) { +this.affine.transform (coords, 0, coords, 0, this.index == 0 ? 1 : 3); +}return type; +}, "~A"); +});