1 Clazz.declarePackage ("java.awt.geom");
\r
2 Clazz.load (["java.awt.geom.RectangularShape"], "java.awt.geom.RoundRectangle2D", ["java.lang.Double", "java.awt.geom.Rectangle2D", "$.RoundRectIterator"], function () {
\r
3 c$ = Clazz.declareType (java.awt.geom, "RoundRectangle2D", java.awt.geom.RectangularShape);
\r
4 Clazz.makeConstructor (c$,
\r
6 Clazz.superConstructor (this, java.awt.geom.RoundRectangle2D, []);
\r
8 Clazz.defineMethod (c$, "setRoundRect",
\r
10 this.setRoundRect (rr.getX (), rr.getY (), rr.getWidth (), rr.getHeight (), rr.getArcWidth (), rr.getArcHeight ());
\r
11 }, "java.awt.geom.RoundRectangle2D");
\r
12 Clazz.defineMethod (c$, "setFrame",
\r
13 function (x, y, w, h) {
\r
14 this.setRoundRect (x, y, w, h, this.getArcWidth (), this.getArcHeight ());
\r
16 Clazz.defineMethod (c$, "contains",
\r
18 if (this.isEmpty ()) {
\r
20 }var rrx0 = this.getX ();
\r
21 var rry0 = this.getY ();
\r
22 var rrx1 = rrx0 + this.getWidth ();
\r
23 var rry1 = rry0 + this.getHeight ();
\r
24 if (x < rrx0 || y < rry0 || x >= rrx1 || y >= rry1) {
\r
26 }var aw = Math.min (this.getWidth (), Math.abs (this.getArcWidth ())) / 2.0;
\r
27 var ah = Math.min (this.getHeight (), Math.abs (this.getArcHeight ())) / 2.0;
\r
28 if (x >= (rrx0 += aw) && x < (rrx0 = rrx1 - aw)) {
\r
30 }if (y >= (rry0 += ah) && y < (rry0 = rry1 - ah)) {
\r
32 }x = (x - rrx0) / aw;
\r
33 y = (y - rry0) / ah;
\r
34 return (x * x + y * y <= 1.0);
\r
36 Clazz.defineMethod (c$, "classify",
\r
37 function (coord, left, right, arcsize) {
\r
40 } else if (coord < left + arcsize) {
\r
42 } else if (coord < right - arcsize) {
\r
44 } else if (coord < right) {
\r
49 Clazz.defineMethod (c$, "intersects",
\r
50 function (x, y, w, h) {
\r
51 if (this.isEmpty () || w <= 0 || h <= 0) {
\r
53 }var rrx0 = this.getX ();
\r
54 var rry0 = this.getY ();
\r
55 var rrx1 = rrx0 + this.getWidth ();
\r
56 var rry1 = rry0 + this.getHeight ();
\r
57 if (x + w <= rrx0 || x >= rrx1 || y + h <= rry0 || y >= rry1) {
\r
59 }var aw = Math.min (this.getWidth (), Math.abs (this.getArcWidth ())) / 2.0;
\r
60 var ah = Math.min (this.getHeight (), Math.abs (this.getArcHeight ())) / 2.0;
\r
61 var x0class = this.classify (x, rrx0, rrx1, aw);
\r
62 var x1class = this.classify (x + w, rrx0, rrx1, aw);
\r
63 var y0class = this.classify (y, rry0, rry1, ah);
\r
64 var y1class = this.classify (y + h, rry0, rry1, ah);
\r
65 if (x0class == 2 || x1class == 2 || y0class == 2 || y1class == 2) {
\r
67 }if ((x0class < 2 && x1class > 2) || (y0class < 2 && y1class > 2)) {
\r
69 }x = (x1class == 1) ? (x = x + w - (rrx0 + aw)) : (x = x - (rrx1 - aw));
\r
70 y = (y1class == 1) ? (y = y + h - (rry0 + ah)) : (y = y - (rry1 - ah));
\r
73 return (x * x + y * y <= 1.0);
\r
75 Clazz.defineMethod (c$, "contains",
\r
76 function (x, y, w, h) {
\r
77 if (this.isEmpty () || w <= 0 || h <= 0) {
\r
79 }return (this.contains (x, y) && this.contains (x + w, y) && this.contains (x, y + h) && this.contains (x + w, y + h));
\r
81 Clazz.defineMethod (c$, "getPathIterator",
\r
83 return new java.awt.geom.RoundRectIterator (this, at);
\r
84 }, "java.awt.geom.AffineTransform");
\r
85 Clazz.overrideMethod (c$, "hashCode",
\r
87 var bits = java.lang.Double.doubleToLongBits (this.getX ());
\r
88 bits += java.lang.Double.doubleToLongBits (this.getY ()) * 37;
\r
89 bits += java.lang.Double.doubleToLongBits (this.getWidth ()) * 43;
\r
90 bits += java.lang.Double.doubleToLongBits (this.getHeight ()) * 47;
\r
91 bits += java.lang.Double.doubleToLongBits (this.getArcWidth ()) * 53;
\r
92 bits += java.lang.Double.doubleToLongBits (this.getArcHeight ()) * 59;
\r
93 return ((bits) ^ ((bits >> 32)));
\r
95 Clazz.overrideMethod (c$, "equals",
\r
99 }if (Clazz.instanceOf (obj, java.awt.geom.RoundRectangle2D)) {
\r
101 return ((this.getX () == rr2d.getX ()) && (this.getY () == rr2d.getY ()) && (this.getWidth () == rr2d.getWidth ()) && (this.getHeight () == rr2d.getHeight ()) && (this.getArcWidth () == rr2d.getArcWidth ()) && (this.getArcHeight () == rr2d.getArcHeight ()));
\r
104 Clazz.pu$h(self.c$);
\r
105 c$ = Clazz.decorateAsClass (function () {
\r
111 this.archeight = 0;
\r
112 Clazz.instantialize (this, arguments);
\r
113 }, java.awt.geom.RoundRectangle2D, "Float", java.awt.geom.RoundRectangle2D);
\r
114 Clazz.makeConstructor (c$,
\r
116 Clazz.superConstructor (this, java.awt.geom.RoundRectangle2D.Float, []);
\r
118 Clazz.makeConstructor (c$,
\r
119 function (a, b, c, d, e, f) {
\r
120 Clazz.superConstructor (this, java.awt.geom.RoundRectangle2D.Float, []);
\r
121 this.setRoundRect (a, b, c, d, e, f);
\r
122 }, "~N,~N,~N,~N,~N,~N");
\r
123 Clazz.defineMethod (c$, "getX",
\r
127 Clazz.defineMethod (c$, "getY",
\r
131 Clazz.defineMethod (c$, "getWidth",
\r
135 Clazz.defineMethod (c$, "getHeight",
\r
137 return this.height;
\r
139 Clazz.defineMethod (c$, "getArcWidth",
\r
141 return this.arcwidth;
\r
143 Clazz.defineMethod (c$, "getArcHeight",
\r
145 return this.archeight;
\r
147 Clazz.overrideMethod (c$, "isEmpty",
\r
149 return (this.width <= 0.0) || (this.height <= 0.0);
\r
151 Clazz.defineMethod (c$, "setRoundRect",
\r
152 function (a, b, c, d, e, f) {
\r
158 this.archeight = f;
\r
159 }, "~N,~N,~N,~N,~N,~N");
\r
160 Clazz.defineMethod (c$, "setRoundRect",
\r
161 function (a, b, c, d, e, f) {
\r
167 this.archeight = f;
\r
168 }, "~N,~N,~N,~N,~N,~N");
\r
169 Clazz.defineMethod (c$, "setRoundRect",
\r
171 this.x = a.getX ();
\r
172 this.y = a.getY ();
\r
173 this.width = a.getWidth ();
\r
174 this.height = a.getHeight ();
\r
175 this.arcwidth = a.getArcWidth ();
\r
176 this.archeight = a.getArcHeight ();
\r
177 }, "java.awt.geom.RoundRectangle2D");
\r
178 Clazz.overrideMethod (c$, "getBounds2D",
\r
180 return new java.awt.geom.Rectangle2D.Float (this.x, this.y, this.width, this.height);
\r
183 Clazz.pu$h(self.c$);
\r
184 c$ = Clazz.decorateAsClass (function () {
\r
190 this.archeight = 0;
\r
191 Clazz.instantialize (this, arguments);
\r
192 }, java.awt.geom.RoundRectangle2D, "Double", java.awt.geom.RoundRectangle2D);
\r
193 Clazz.makeConstructor (c$,
\r
195 Clazz.superConstructor (this, java.awt.geom.RoundRectangle2D.Double, []);
\r
197 Clazz.makeConstructor (c$,
\r
198 function (a, b, c, d, e, f) {
\r
199 Clazz.superConstructor (this, java.awt.geom.RoundRectangle2D.Double, []);
\r
200 this.setRoundRect (a, b, c, d, e, f);
\r
201 }, "~N,~N,~N,~N,~N,~N");
\r
202 Clazz.defineMethod (c$, "getX",
\r
206 Clazz.defineMethod (c$, "getY",
\r
210 Clazz.defineMethod (c$, "getWidth",
\r
214 Clazz.defineMethod (c$, "getHeight",
\r
216 return this.height;
\r
218 Clazz.defineMethod (c$, "getArcWidth",
\r
220 return this.arcwidth;
\r
222 Clazz.defineMethod (c$, "getArcHeight",
\r
224 return this.archeight;
\r
226 Clazz.overrideMethod (c$, "isEmpty",
\r
228 return (this.width <= 0.0) || (this.height <= 0.0);
\r
230 Clazz.defineMethod (c$, "setRoundRect",
\r
231 function (a, b, c, d, e, f) {
\r
237 this.archeight = f;
\r
238 }, "~N,~N,~N,~N,~N,~N");
\r
239 Clazz.defineMethod (c$, "setRoundRect",
\r
241 this.x = a.getX ();
\r
242 this.y = a.getY ();
\r
243 this.width = a.getWidth ();
\r
244 this.height = a.getHeight ();
\r
245 this.arcwidth = a.getArcWidth ();
\r
246 this.archeight = a.getArcHeight ();
\r
247 }, "java.awt.geom.RoundRectangle2D");
\r
248 Clazz.overrideMethod (c$, "getBounds2D",
\r
250 return new java.awt.geom.Rectangle2D.Double (this.x, this.y, this.width, this.height);
\r