JAL-1807 Bob's JalviewJS prototype first commit
[jalviewjs.git] / site / j2s / java / awt / geom / Ellipse2D.js
1 Clazz.declarePackage ("java.awt.geom");\r
2 Clazz.load (["java.awt.geom.RectangularShape"], "java.awt.geom.Ellipse2D", ["java.lang.Double", "java.awt.geom.EllipseIterator", "$.Rectangle2D"], function () {\r
3 c$ = Clazz.declareType (java.awt.geom, "Ellipse2D", java.awt.geom.RectangularShape);\r
4 Clazz.makeConstructor (c$, \r
5 function () {\r
6 Clazz.superConstructor (this, java.awt.geom.Ellipse2D, []);\r
7 });\r
8 Clazz.defineMethod (c$, "contains", \r
9 function (x, y) {\r
10 var ellw = this.getWidth ();\r
11 if (ellw <= 0.0) {\r
12 return false;\r
13 }var normx = (x - this.getX ()) / ellw - 0.5;\r
14 var ellh = this.getHeight ();\r
15 if (ellh <= 0.0) {\r
16 return false;\r
17 }var normy = (y - this.getY ()) / ellh - 0.5;\r
18 return (normx * normx + normy * normy) < 0.25;\r
19 }, "~N,~N");\r
20 Clazz.defineMethod (c$, "intersects", \r
21 function (x, y, w, h) {\r
22 if (w <= 0.0 || h <= 0.0) {\r
23 return false;\r
24 }var ellw = this.getWidth ();\r
25 if (ellw <= 0.0) {\r
26 return false;\r
27 }var normx0 = (x - this.getX ()) / ellw - 0.5;\r
28 var normx1 = normx0 + w / ellw;\r
29 var ellh = this.getHeight ();\r
30 if (ellh <= 0.0) {\r
31 return false;\r
32 }var normy0 = (y - this.getY ()) / ellh - 0.5;\r
33 var normy1 = normy0 + h / ellh;\r
34 var nearx;\r
35 var neary;\r
36 if (normx0 > 0.0) {\r
37 nearx = normx0;\r
38 } else if (normx1 < 0.0) {\r
39 nearx = normx1;\r
40 } else {\r
41 nearx = 0.0;\r
42 }if (normy0 > 0.0) {\r
43 neary = normy0;\r
44 } else if (normy1 < 0.0) {\r
45 neary = normy1;\r
46 } else {\r
47 neary = 0.0;\r
48 }return (nearx * nearx + neary * neary) < 0.25;\r
49 }, "~N,~N,~N,~N");\r
50 Clazz.defineMethod (c$, "contains", \r
51 function (x, y, w, h) {\r
52 return (this.contains (x, y) && this.contains (x + w, y) && this.contains (x, y + h) && this.contains (x + w, y + h));\r
53 }, "~N,~N,~N,~N");\r
54 Clazz.defineMethod (c$, "getPathIterator", \r
55 function (at) {\r
56 return  new java.awt.geom.EllipseIterator (this, at);\r
57 }, "java.awt.geom.AffineTransform");\r
58 Clazz.overrideMethod (c$, "hashCode", \r
59 function () {\r
60 var bits = java.lang.Double.doubleToLongBits (this.getX ());\r
61 bits += java.lang.Double.doubleToLongBits (this.getY ()) * 37;\r
62 bits += java.lang.Double.doubleToLongBits (this.getWidth ()) * 43;\r
63 bits += java.lang.Double.doubleToLongBits (this.getHeight ()) * 47;\r
64 return ((bits) ^ ((bits >> 32)));\r
65 });\r
66 Clazz.overrideMethod (c$, "equals", \r
67 function (obj) {\r
68 if (obj === this) {\r
69 return true;\r
70 }if (Clazz.instanceOf (obj, java.awt.geom.Ellipse2D)) {\r
71 var e2d = obj;\r
72 return ((this.getX () == e2d.getX ()) && (this.getY () == e2d.getY ()) && (this.getWidth () == e2d.getWidth ()) && (this.getHeight () == e2d.getHeight ()));\r
73 }return false;\r
74 }, "~O");\r
75 Clazz.pu$h(self.c$);\r
76 c$ = Clazz.decorateAsClass (function () {\r
77 this.x = 0;\r
78 this.y = 0;\r
79 this.width = 0;\r
80 this.height = 0;\r
81 Clazz.instantialize (this, arguments);\r
82 }, java.awt.geom.Ellipse2D, "Float", java.awt.geom.Ellipse2D);\r
83 Clazz.makeConstructor (c$, \r
84 function () {\r
85 Clazz.superConstructor (this, java.awt.geom.Ellipse2D.Float, []);\r
86 });\r
87 Clazz.makeConstructor (c$, \r
88 function (a, b, c, d) {\r
89 Clazz.superConstructor (this, java.awt.geom.Ellipse2D.Float, []);\r
90 this.setFrame (a, b, c, d);\r
91 }, "~N,~N,~N,~N");\r
92 Clazz.overrideMethod (c$, "getX", \r
93 function () {\r
94 return this.x;\r
95 });\r
96 Clazz.overrideMethod (c$, "getY", \r
97 function () {\r
98 return this.y;\r
99 });\r
100 Clazz.overrideMethod (c$, "getWidth", \r
101 function () {\r
102 return this.width;\r
103 });\r
104 Clazz.overrideMethod (c$, "getHeight", \r
105 function () {\r
106 return this.height;\r
107 });\r
108 Clazz.overrideMethod (c$, "isEmpty", \r
109 function () {\r
110 return (this.width <= 0.0 || this.height <= 0.0);\r
111 });\r
112 Clazz.defineMethod (c$, "setFrame", \r
113 function (a, b, c, d) {\r
114 this.x = a;\r
115 this.y = b;\r
116 this.width = c;\r
117 this.height = d;\r
118 }, "~N,~N,~N,~N");\r
119 Clazz.defineMethod (c$, "setFrame", \r
120 function (a, b, c, d) {\r
121 this.x = a;\r
122 this.y = b;\r
123 this.width = c;\r
124 this.height = d;\r
125 }, "~N,~N,~N,~N");\r
126 Clazz.overrideMethod (c$, "getBounds2D", \r
127 function () {\r
128 return  new java.awt.geom.Rectangle2D.Float (this.x, this.y, this.width, this.height);\r
129 });\r
130 c$ = Clazz.p0p ();\r
131 Clazz.pu$h(self.c$);\r
132 c$ = Clazz.decorateAsClass (function () {\r
133 this.x = 0;\r
134 this.y = 0;\r
135 this.width = 0;\r
136 this.height = 0;\r
137 Clazz.instantialize (this, arguments);\r
138 }, java.awt.geom.Ellipse2D, "Double", java.awt.geom.Ellipse2D);\r
139 Clazz.makeConstructor (c$, \r
140 function () {\r
141 Clazz.superConstructor (this, java.awt.geom.Ellipse2D.Double, []);\r
142 });\r
143 Clazz.makeConstructor (c$, \r
144 function (a, b, c, d) {\r
145 Clazz.superConstructor (this, java.awt.geom.Ellipse2D.Double, []);\r
146 this.setFrame (a, b, c, d);\r
147 }, "~N,~N,~N,~N");\r
148 Clazz.overrideMethod (c$, "getX", \r
149 function () {\r
150 return this.x;\r
151 });\r
152 Clazz.overrideMethod (c$, "getY", \r
153 function () {\r
154 return this.y;\r
155 });\r
156 Clazz.overrideMethod (c$, "getWidth", \r
157 function () {\r
158 return this.width;\r
159 });\r
160 Clazz.overrideMethod (c$, "getHeight", \r
161 function () {\r
162 return this.height;\r
163 });\r
164 Clazz.overrideMethod (c$, "isEmpty", \r
165 function () {\r
166 return (this.width <= 0.0 || this.height <= 0.0);\r
167 });\r
168 Clazz.defineMethod (c$, "setFrame", \r
169 function (a, b, c, d) {\r
170 this.x = a;\r
171 this.y = b;\r
172 this.width = c;\r
173 this.height = d;\r
174 }, "~N,~N,~N,~N");\r
175 Clazz.overrideMethod (c$, "getBounds2D", \r
176 function () {\r
177 return  new java.awt.geom.Rectangle2D.Double (this.x, this.y, this.width, this.height);\r
178 });\r
179 c$ = Clazz.p0p ();\r
180 });\r