14cbcea0e11978988d92195d5e55a399ca4dbbdd
[jalviewjs.git] / site / j2s / org / uwi / TanSugd3S.js
1 Clazz.declarePackage ("org.uwi");\r
2 Clazz.load (["java.awt.event.ItemListener", "$.MouseListener", "$.MouseMotionListener", "javax.swing.JApplet", "$.JPanel", "java.awt.Color", "$.Font", "$.Rectangle"], ["org.uwi.TSd3Controls", "$.TSd3Canvas", "$.TanSugd3S"], ["java.awt.BasicStroke", "$.BorderLayout", "$.FlowLayout", "$.Point", "java.lang.Double", "$.StringBuffer", "javax.swing.ButtonGroup", "$.JFrame", "$.JRadioButton"], function () {\r
3 c$ = Clazz.decorateAsClass (function () {\r
4 this.canvas = null;\r
5 this.controls = null;\r
6 Clazz.instantialize (this, arguments);\r
7 }, org.uwi, "TanSugd3S", javax.swing.JApplet);\r
8 Clazz.makeConstructor (c$, \r
9 function () {\r
10 Clazz.superConstructor (this, org.uwi.TanSugd3S, []);\r
11 this.setName ("TanSugd3S");\r
12 });\r
13 Clazz.overrideMethod (c$, "init", \r
14 function () {\r
15 this.setLayout ( new java.awt.BorderLayout ());\r
16 this.canvas =  new org.uwi.TSd3Canvas ();\r
17 this.canvas.setSize (850, 500);\r
18 var c = this.getContentPane ();\r
19 c.setSize (850, 500);\r
20 c.add (this.canvas, "Center");\r
21 c.add (this.controls =  new org.uwi.TSd3Controls (this.canvas), "North");\r
22 System.out.println ("Hello, world!");\r
23 });\r
24 Clazz.defineMethod (c$, "setSize", \r
25 function (width, height) {\r
26 Clazz.superCall (this, org.uwi.TanSugd3S, "setSize", [width, height]);\r
27 this.validate ();\r
28 }, "~N,~N");\r
29 Clazz.overrideMethod (c$, "destroy", \r
30 function () {\r
31 this.remove (this.controls);\r
32 this.remove (this.canvas);\r
33 });\r
34 Clazz.overrideMethod (c$, "start", \r
35 function () {\r
36 this.controls.setEnabled (true);\r
37 });\r
38 Clazz.overrideMethod (c$, "stop", \r
39 function () {\r
40 this.controls.setEnabled (false);\r
41 });\r
42 Clazz.overrideMethod (c$, "processEvent", \r
43 function (e) {\r
44 if (e.getID () == 201) {\r
45 System.exit (0);\r
46 }}, "java.awt.AWTEvent");\r
47 c$.main = Clazz.defineMethod (c$, "main", \r
48 function (args) {\r
49 var f =  new javax.swing.JFrame ("Tanabe-Sugano");\r
50 var tanabe =  new org.uwi.TanSugd3S ();\r
51 tanabe.init ();\r
52 tanabe.start ();\r
53 f.add ("Center", tanabe);\r
54 f.pack ();\r
55 f.setVisible (true);\r
56 f.setDefaultCloseOperation (3);\r
57 }, "~A");\r
58 Clazz.overrideMethod (c$, "getAppletInfo", \r
59 function () {\r
60 return "A d3 octahedral Tanabe-Sugano Diagram";\r
61 });\r
62 c$.CalcF4T1g = Clazz.defineMethod (c$, "CalcF4T1g", \r
63 function (x1) {\r
64 return (15 + (3 * x1) - Math.sqrt (225 - (18 * x1) + (x1 * x1))) / 2;\r
65 }, "~N");\r
66 c$.CalcP4T1g = Clazz.defineMethod (c$, "CalcP4T1g", \r
67 function (x1) {\r
68 return (15 + (3 * x1) + Math.sqrt (225 - (18 * x1) + (x1 * x1))) / 2;\r
69 }, "~N");\r
70 c$.CalcG2Eg = Clazz.defineMethod (c$, "CalcG2Eg", \r
71 function (x1) {\r
72 return 0.0000002727 * x1 * x1 * x1 * x1 * x1 - 0.00003926 * x1 * x1 * x1 * x1 + 0.002110 * x1 * x1 * x1 - 0.05256 * x1 * x1 + 0.6345 * x1 + 17.50161;\r
73 }, "~N");\r
74 c$.CalcG2A1g = Clazz.defineMethod (c$, "CalcG2A1g", \r
75 function (x1) {\r
76 return x1 + 17.50161;\r
77 }, "~N");\r
78 c$.CalcG2T1g = Clazz.defineMethod (c$, "CalcG2T1g", \r
79 function (x1) {\r
80 return 0.0000003205 * x1 * x1 * x1 * x1 * x1 - 0.00004689 * x1 * x1 * x1 * x1 + 0.00258 * x1 * x1 * x1 - 0.06641 * x1 * x1 + 0.8232 * x1 + 17.50161;\r
81 }, "~N");\r
82 c$.CalcG2T2g = Clazz.defineMethod (c$, "CalcG2T2g", \r
83 function (x1) {\r
84 return 0.0000001933 * x1 * x1 * x1 * x1 * x1 - 0.00003336 * x1 * x1 * x1 * x1 + 0.002274 * x1 * x1 * x1 - 0.07898 * x1 * x1 + 1.557 * x1 + 17.50161;\r
85 }, "~N");\r
86 c$.CalcH2T2g = Clazz.defineMethod (c$, "CalcH2T2g", \r
87 function (x1) {\r
88 return 0.00000002443 * x1 * x1 * x1 * x1 * x1 + 0.0000002677 * x1 * x1 * x1 * x1 - 0.0003003 * x1 * x1 * x1 + 0.01745 * x1 * x1 + 0.6635 * x1 + 22.50161;\r
89 }, "~N");\r
90 c$.CalcH2T1g = Clazz.defineMethod (c$, "CalcH2T1g", \r
91 function (x1) {\r
92 return 0.00000002195 * x1 * x1 * x1 * x1 * x1 - 0.000005305 * x1 * x1 * x1 * x1 + 0.0004933 * x1 * x1 * x1 - 0.02294 * x1 * x1 + 1.570 * x1 + 22.50161;\r
93 }, "~N");\r
94 c$.CalcH2Eg = Clazz.defineMethod (c$, "CalcH2Eg", \r
95 function (x1) {\r
96 return 0.0000001881 * x1 * x1 * x1 * x1 * x1 - 0.00002683 * x1 * x1 * x1 * x1 + 0.001416 * x1 * x1 * x1 - 0.0338 * x1 * x1 + 1.3525 * x1 + 22.50161;\r
97 }, "~N");\r
98 c$.CalcD2T2g = Clazz.defineMethod (c$, "CalcD2T2g", \r
99 function (x1) {\r
100 return -7.532E-7 * x1 * x1 * x1 * x1 * x1 + 0.00009886 * x1 * x1 * x1 * x1 - 0.004352 * x1 * x1 * x1 + 0.06092 * x1 * x1 + 1.378 * x1 + 24.8951929;\r
101 }, "~N");\r
102 Clazz.defineMethod (c$, "processDelB", \r
103 function (msgstr) {\r
104 var x1;\r
105 var y1;\r
106 var y2;\r
107 var y3;\r
108 var fE;\r
109 var fT1;\r
110 var fT2;\r
111 var fA1;\r
112 var fT2b;\r
113 var fT2H;\r
114 var fT1H;\r
115 var fEH;\r
116 var Delta;\r
117 var Bp;\r
118 var ret =  new StringBuffer ();\r
119 var ii = msgstr.indexOf (":");\r
120 var ll = msgstr.length;\r
121 Delta = Double.parseDouble (msgstr.substring (0, ii).trim ());\r
122 Bp = Double.parseDouble (msgstr.substring (ii + 1, ll).trim ());\r
123 x1 = Delta / Bp;\r
124 y1 = x1;\r
125 y2 = org.uwi.TanSugd3S.CalcF4T1g (x1);\r
126 y3 = org.uwi.TanSugd3S.CalcP4T1g (x1);\r
127 fE = org.uwi.TanSugd3S.CalcG2Eg (x1);\r
128 fT1 = org.uwi.TanSugd3S.CalcG2T1g (x1);\r
129 fT2 = org.uwi.TanSugd3S.CalcG2T2g (x1);\r
130 fA1 = org.uwi.TanSugd3S.CalcG2A1g (x1);\r
131 fT2b = org.uwi.TanSugd3S.CalcD2T2g (x1);\r
132 fT2H = org.uwi.TanSugd3S.CalcH2T2g (x1);\r
133 fEH = org.uwi.TanSugd3S.CalcH2Eg (x1);\r
134 fT1H = org.uwi.TanSugd3S.CalcH2T1g (x1);\r
135 var sBp = "" + Math.round (Bp);\r
136 var va1 = "" + Math.round (y1 * Bp);\r
137 var va2 = "" + Math.round (y2 * Bp);\r
138 var va3 = "" + Math.round (y3 * Bp);\r
139 var vfE = "" + Math.round (fE * Bp);\r
140 var vfT1 = "" + Math.round (fT1 * Bp);\r
141 var vfT2 = "" + Math.round (fT2 * Bp);\r
142 var vfA1 = "" + Math.round (fA1 * Bp);\r
143 var vfT2b = "" + Math.round (fT2b * Bp);\r
144 var vfT2H = "" + Math.round (fT2H * Bp);\r
145 var vfEH = "" + Math.round (fEH * Bp);\r
146 var vfT1H = "" + Math.round (fT1H * Bp);\r
147 ret.append ("B\' " + sBp + ", A " + va1 + ", " + va2 + ", " + va3 + ", F " + vfE + ", " + vfT1 + ", " + vfT2 + ", " + vfA1 + ", " + vfT2H + ", " + vfEH + ", " + vfT1H + ", " + vfT2b);\r
148 this.canvas.start_x = 0;\r
149 this.canvas.end_x = 50;\r
150 this.canvas.mouseOn = true;\r
151 this.canvas.deltaB = x1;\r
152 this.canvas.y1 = x1;\r
153 this.canvas.y2 = y2;\r
154 this.canvas.y3 = y3;\r
155 this.canvas.fE = fE;\r
156 this.canvas.fT1 = fT1;\r
157 this.canvas.fT2 = fT2;\r
158 this.canvas.fA1 = fA1;\r
159 this.canvas.fT2b = fT2b;\r
160 this.canvas.fT2H = fT2H;\r
161 this.canvas.fEH = fEH;\r
162 this.canvas.fT1H = fT1H;\r
163 this.canvas.ratio21 = y2 / y1;\r
164 this.canvas.repaint ();\r
165 return ret.toString ();\r
166 }, "~S");\r
167 Clazz.defineMethod (c$, "processRatio", \r
168 function (msgstr) {\r
169 var x1;\r
170 var temp_ratio21;\r
171 var y1;\r
172 var y2;\r
173 var y3;\r
174 var ratio21;\r
175 var v1;\r
176 var fE;\r
177 var fT1;\r
178 var fT2;\r
179 var fA1;\r
180 var fT2b;\r
181 var fT2H;\r
182 var fT1H;\r
183 var fEH;\r
184 var ii = msgstr.indexOf (":");\r
185 var ll = msgstr.length;\r
186 ratio21 = Double.parseDouble (msgstr.substring (0, ii).trim ());\r
187 v1 = Double.parseDouble (msgstr.substring (ii + 1, ll).trim ());\r
188 var x;\r
189 var ratioFound = false;\r
190 var ret =  new StringBuffer ();\r
191 ret.append ("no value");\r
192 for (x = 0; x <= 50; x++) {\r
193 y1 = x;\r
194 y2 = org.uwi.TanSugd3S.CalcF4T1g (x);\r
195 temp_ratio21 = y2 / y1;\r
196 if ((temp_ratio21 < ratio21) && (ratio21 > 1.192) && (ratio21 < 1.75)) {\r
197 ratioFound = true;\r
198 break;\r
199 }}\r
200 if (ratioFound) {\r
201 for (x1 = (x - 1); x1 < x; x1 += 0.02) {\r
202 y1 = x1;\r
203 y2 = org.uwi.TanSugd3S.CalcF4T1g (x1);\r
204 y3 = org.uwi.TanSugd3S.CalcP4T1g (x1);\r
205 fE = org.uwi.TanSugd3S.CalcG2Eg (x1);\r
206 fT1 = org.uwi.TanSugd3S.CalcG2T1g (x1);\r
207 fT2 = org.uwi.TanSugd3S.CalcG2T2g (x1);\r
208 fA1 = org.uwi.TanSugd3S.CalcG2A1g (x1);\r
209 fT2b = org.uwi.TanSugd3S.CalcD2T2g (x1);\r
210 fT2H = org.uwi.TanSugd3S.CalcH2T2g (x1);\r
211 fEH = org.uwi.TanSugd3S.CalcH2Eg (x1);\r
212 fT1H = org.uwi.TanSugd3S.CalcH2T1g (x1);\r
213 temp_ratio21 = y2 / y1;\r
214 if (temp_ratio21 < ratio21) {\r
215 ret =  new StringBuffer ();\r
216 var Bp = v1 / x1;\r
217 var temp = Math.round (Bp * 10);\r
218 var tmp =  String.instantialize ("" + temp);\r
219 var Bprime = (tmp.substring (0, tmp.length - 1) + "." + tmp.substring (tmp.length - 1, tmp.length));\r
220 y3 = org.uwi.TanSugd3S.CalcP4T1g (x1);\r
221 var va1 = "" + Math.round (y1 * Bp);\r
222 var va2 = "" + Math.round (y2 * Bp);\r
223 var va3 = "" + Math.round (y3 * Bp);\r
224 var vfE = "" + Math.round (fE * Bp);\r
225 var vfT1 = "" + Math.round (fT1 * Bp);\r
226 var vfT2 = "" + Math.round (fT2 * Bp);\r
227 var vfA1 = "" + Math.round (fA1 * Bp);\r
228 var vfT2b = "" + Math.round (fT2b * Bp);\r
229 var vfT2H = "" + Math.round (fT2H * Bp);\r
230 var vfEH = "" + Math.round (fEH * Bp);\r
231 var vfT1H = "" + Math.round (fT1H * Bp);\r
232 ret.append ("B\' " + Bprime + ", A " + va1 + ", " + va2 + ", " + va3 + ", F " + vfE + ", " + vfT1 + ", " + vfT2 + ", " + vfA1 + ", " + vfT2H + ", " + vfEH + ", " + vfT1H + ", " + vfT2b);\r
233 this.canvas.start_x = 0;\r
234 this.canvas.end_x = 50;\r
235 this.canvas.mouseOn = true;\r
236 this.canvas.deltaB = x1;\r
237 this.canvas.y1 = x1;\r
238 this.canvas.y2 = y2;\r
239 this.canvas.y3 = y3;\r
240 this.canvas.fE = fE;\r
241 this.canvas.fT1 = fT1;\r
242 this.canvas.fT2 = fT2;\r
243 this.canvas.fA1 = fA1;\r
244 this.canvas.fT2b = fT2b;\r
245 this.canvas.fT2H = fT2H;\r
246 this.canvas.fEH = fEH;\r
247 this.canvas.fT1H = fT1H;\r
248 this.canvas.ratio21 = y2 / y1;\r
249 this.canvas.repaint ();\r
250 return ret.toString ();\r
251 }}\r
252 }this.canvas.mouseOn = false;\r
253 this.canvas.repaint ();\r
254 return ret.toString ();\r
255 }, "~S");\r
256 c$ = Clazz.decorateAsClass (function () {\r
257 this.$y = 0;\r
258 this.bottomLeft = null;\r
259 this.btmLeft = null;\r
260 this.start_x = 0;\r
261 this.end_x = 0;\r
262 this.lrange = 0;\r
263 this.$x = 0;\r
264 this.hlines = 0;\r
265 this.vlines = 0;\r
266 this.gx = 0;\r
267 this.deltaB = 0;\r
268 this.xScale = 0;\r
269 this.yScale = 0;\r
270 this.mouseOn = false;\r
271 this.x1 = 0;\r
272 this.y1 = 0;\r
273 this.y2 = 0;\r
274 this.y3 = 0;\r
275 this.ratio21 = 0;\r
276 this.ratio31 = 0;\r
277 this.ratio32 = 0;\r
278 this.fE = 0;\r
279 this.fT2 = 0;\r
280 this.fT1 = 0;\r
281 this.fA1 = 0;\r
282 this.fT2b = 0;\r
283 this.fT2H = 0;\r
284 this.fT1H = 0;\r
285 this.fEH = 0;\r
286 this.fb = null;\r
287 this.f = null;\r
288 this.dkgreen = null;\r
289 this.gold = null;\r
290 this.ltgrey = null;\r
291 this.teal = null;\r
292 this.purple = null;\r
293 this.lgreen = null;\r
294 this.dgreen = null;\r
295 this.copper = null;\r
296 this.graphRec = null;\r
297 this.outPRec = null;\r
298 Clazz.instantialize (this, arguments);\r
299 }, org.uwi, "TSd3Canvas", javax.swing.JPanel, [java.awt.event.MouseListener, java.awt.event.MouseMotionListener]);\r
300 Clazz.prepareFields (c$, function () {\r
301 this.fb =  new java.awt.Font ("Arial", 1, 18);\r
302 this.f =  new java.awt.Font ("Courier", 0, 16);\r
303 this.dkgreen =  new java.awt.Color (142, 244, 108);\r
304 this.gold =  new java.awt.Color (191, 139, 32);\r
305 this.ltgrey =  new java.awt.Color (233, 233, 233);\r
306 this.teal =  new java.awt.Color (168, 207, 251);\r
307 this.purple =  new java.awt.Color (192, 12, 255);\r
308 this.lgreen =  new java.awt.Color (82, 179, 53);\r
309 this.dgreen =  new java.awt.Color (41, 94, 28);\r
310 this.copper =  new java.awt.Color (179, 100, 13);\r
311 this.graphRec =  new java.awt.Rectangle (50, 10, 600, 460);\r
312 this.outPRec =  new java.awt.Rectangle (650, 10, 685, 360);\r
313 });\r
314 Clazz.makeConstructor (c$, \r
315 function () {\r
316 Clazz.superConstructor (this, org.uwi.TSd3Canvas, []);\r
317 this.setName ("TSd3Canvas");\r
318 this.setBackground (java.awt.Color.blue);\r
319 this.start_x = 0;\r
320 this.end_x = 50;\r
321 this.hlines = 10;\r
322 this.vlines = 10;\r
323 this.addMouseListener (this);\r
324 this.addMouseMotionListener (this);\r
325 this.mouseOn = false;\r
326 });\r
327 Clazz.overrideMethod (c$, "paint", \r
328 function (g) {\r
329 this.drawDiagram (g);\r
330 }, "java.awt.Graphics");\r
331 Clazz.defineMethod (c$, "redraw", \r
332 function (range) {\r
333 this.lrange = range;\r
334 switch (range) {\r
335 case 0:\r
336 this.start_x = 0;\r
337 this.end_x = 50;\r
338 break;\r
339 case 1:\r
340 this.start_x = 0;\r
341 this.end_x = 10;\r
342 break;\r
343 case 2:\r
344 this.start_x = 10;\r
345 this.end_x = 20;\r
346 break;\r
347 case 3:\r
348 this.start_x = 20;\r
349 this.end_x = 30;\r
350 break;\r
351 case 4:\r
352 this.start_x = 30;\r
353 this.end_x = 40;\r
354 break;\r
355 case 5:\r
356 this.start_x = 40;\r
357 this.end_x = 50;\r
358 break;\r
359 }\r
360 this.repaint ();\r
361 }, "~N");\r
362 Clazz.defineMethod (c$, "drawDiagram", \r
363  function (g) {\r
364 this.displayGraph (g);\r
365 }, "java.awt.Graphics");\r
366 Clazz.defineMethod (c$, "displayGraph", \r
367  function (g) {\r
368 var g2 = g;\r
369 g2.setColor (this.ltgrey);\r
370 g2.fillRect (0, 0, this.getWidth (), this.getHeight ());\r
371 g2.setBackground (g2.getBackground ());\r
372 var stroke2 =  new java.awt.BasicStroke (2);\r
373 var stroke1 =  new java.awt.BasicStroke (1);\r
374 var stroke_d1 =  new java.awt.BasicStroke (1, 0, 2, 0,  Clazz.newFloatArray (-1, [6, 6]), 0);\r
375 var yDivisor;\r
376 g2.clearRect (this.graphRec.x, this.graphRec.y, this.graphRec.width, this.graphRec.height);\r
377 g2.setColor (java.awt.Color.black);\r
378 this.bottomLeft =  new java.awt.Point (this.graphRec.x, this.graphRec.y + this.graphRec.height);\r
379 this.btmLeft =  new java.awt.Point (this.outPRec.x, this.outPRec.y + this.outPRec.height);\r
380 g2.drawLine (this.bottomLeft.x, this.bottomLeft.y, this.bottomLeft.x + this.graphRec.width, this.bottomLeft.y);\r
381 g2.drawLine (this.bottomLeft.x, this.bottomLeft.y, this.bottomLeft.x, this.graphRec.y);\r
382 this.xScale = (this.graphRec.width / (this.end_x - this.start_x));\r
383 if (this.end_x < 35) {\r
384 yDivisor = org.uwi.TanSugd3S.CalcD2T2g (this.end_x);\r
385 } else yDivisor = org.uwi.TanSugd3S.CalcP4T1g (this.end_x);\r
386 this.yScale = this.graphRec.height / yDivisor;\r
387 var start_x1 =  Clazz.newIntArray (-1, [(this.bottomLeft.x)]);\r
388 var start_x2 =  Clazz.newIntArray (-1, [(this.bottomLeft.x)]);\r
389 var start_x3 =  Clazz.newIntArray (-1, [(this.bottomLeft.x)]);\r
390 var start_x4 =  Clazz.newIntArray (-1, [(this.bottomLeft.x)]);\r
391 var start_x5 =  Clazz.newIntArray (-1, [(this.bottomLeft.x)]);\r
392 var start_x6 =  Clazz.newIntArray (-1, [(this.bottomLeft.x)]);\r
393 var start_x7 =  Clazz.newIntArray (-1, [(this.bottomLeft.x)]);\r
394 var start_x8 =  Clazz.newIntArray (-1, [(this.bottomLeft.x)]);\r
395 var start_x9 =  Clazz.newIntArray (-1, [(this.bottomLeft.x)]);\r
396 var start_x10 =  Clazz.newIntArray (-1, [(this.bottomLeft.x)]);\r
397 var start_x11 =  Clazz.newIntArray (-1, [(this.bottomLeft.x)]);\r
398 var start_y1 =  Clazz.newIntArray (-1, [Clazz.doubleToInt (this.bottomLeft.y - (this.start_x * this.yScale))]);\r
399 this.$y = org.uwi.TanSugd3S.CalcF4T1g (this.start_x);\r
400 var start_y2 =  Clazz.newIntArray (-1, [Clazz.doubleToInt (this.bottomLeft.y - (this.yScale * this.$y))]);\r
401 this.$y = org.uwi.TanSugd3S.CalcP4T1g (this.start_x);\r
402 var start_y3 =  Clazz.newIntArray (-1, [Clazz.doubleToInt (this.bottomLeft.y - (this.yScale * this.$y))]);\r
403 this.$y = org.uwi.TanSugd3S.CalcG2Eg (this.start_x);\r
404 var start_y4 =  Clazz.newIntArray (-1, [Clazz.doubleToInt (this.bottomLeft.y - (this.yScale * this.$y))]);\r
405 this.$y = org.uwi.TanSugd3S.CalcG2T1g (this.start_x);\r
406 var start_y5 =  Clazz.newIntArray (-1, [Clazz.doubleToInt (this.bottomLeft.y - (this.yScale * this.$y))]);\r
407 this.$y = org.uwi.TanSugd3S.CalcG2T2g (this.start_x);\r
408 var start_y6 =  Clazz.newIntArray (-1, [Clazz.doubleToInt (this.bottomLeft.y - (this.yScale * this.$y))]);\r
409 this.$y = org.uwi.TanSugd3S.CalcG2A1g (this.start_x);\r
410 var start_y7 =  Clazz.newIntArray (-1, [Clazz.doubleToInt (this.bottomLeft.y - (this.yScale * this.$y))]);\r
411 this.$y = org.uwi.TanSugd3S.CalcD2T2g (this.start_x);\r
412 var start_y8 =  Clazz.newIntArray (-1, [Clazz.doubleToInt (this.bottomLeft.y - (this.yScale * this.$y))]);\r
413 this.$y = org.uwi.TanSugd3S.CalcH2T2g (this.start_x);\r
414 var start_y9 =  Clazz.newIntArray (-1, [Clazz.doubleToInt (this.bottomLeft.y - (this.yScale * this.$y))]);\r
415 this.$y = org.uwi.TanSugd3S.CalcH2T1g (this.start_x);\r
416 var start_y10 =  Clazz.newIntArray (-1, [Clazz.doubleToInt (this.bottomLeft.y - (this.yScale * this.$y))]);\r
417 this.$y = org.uwi.TanSugd3S.CalcH2Eg (this.start_x);\r
418 var start_y11 =  Clazz.newIntArray (-1, [Clazz.doubleToInt (this.bottomLeft.y - (this.yScale * this.$y))]);\r
419 var hSlines = Clazz.doubleToInt (this.graphRec.height / this.hlines);\r
420 var vSlines = Clazz.doubleToInt (this.graphRec.width / this.vlines);\r
421 g2.setColor (this.ltgrey);\r
422 g2.setStroke (stroke1);\r
423 for (var ii = 1; ii <= this.hlines; ii++) {\r
424 g2.drawLine (this.bottomLeft.x, this.bottomLeft.y - (ii * hSlines), this.bottomLeft.x + this.graphRec.width, this.bottomLeft.y - (ii * hSlines));\r
425 }\r
426 for (var ii = 1; ii <= this.vlines; ii++) {\r
427 g2.drawLine (this.bottomLeft.x + (ii * vSlines), this.bottomLeft.y, this.bottomLeft.x + (ii * vSlines), this.bottomLeft.y - this.graphRec.height);\r
428 }\r
429 for (this.$x = this.start_x; this.$x <= this.end_x; this.$x++) {\r
430 g2.setStroke (stroke2);\r
431 g2.setColor (java.awt.Color.red);\r
432 this.$y = this.$x;\r
433 this.drawXtoY (this.$x, this.$y, start_x1, start_y1, g);\r
434 g2.setColor (java.awt.Color.blue);\r
435 this.$y = org.uwi.TanSugd3S.CalcF4T1g (this.$x);\r
436 this.drawXtoY (this.$x, this.$y, start_x2, start_y2, g);\r
437 g2.setColor (this.dkgreen);\r
438 this.$y = org.uwi.TanSugd3S.CalcP4T1g (this.$x);\r
439 this.drawXtoY (this.$x, this.$y, start_x3, start_y3, g);\r
440 g2.setStroke (stroke_d1);\r
441 g2.setColor (this.teal);\r
442 this.$y = org.uwi.TanSugd3S.CalcG2Eg (this.$x);\r
443 this.drawXtoY (this.$x, this.$y, start_x4, start_y4, g);\r
444 g2.setColor (java.awt.Color.orange);\r
445 this.$y = org.uwi.TanSugd3S.CalcG2T1g (this.$x);\r
446 this.drawXtoY (this.$x, this.$y, start_x5, start_y5, g);\r
447 g2.setColor (this.gold);\r
448 this.$y = org.uwi.TanSugd3S.CalcG2T2g (this.$x);\r
449 this.drawXtoY (this.$x, this.$y, start_x6, start_y6, g);\r
450 g2.setColor (java.awt.Color.gray);\r
451 this.$y = org.uwi.TanSugd3S.CalcG2A1g (this.$x);\r
452 this.drawXtoY (this.$x, this.$y, start_x7, start_y7, g);\r
453 g2.setColor (this.purple);\r
454 this.$y = org.uwi.TanSugd3S.CalcD2T2g (this.$x);\r
455 this.drawXtoY (this.$x, this.$y, start_x8, start_y8, g);\r
456 g2.setColor (this.lgreen);\r
457 this.$y = org.uwi.TanSugd3S.CalcH2T2g (this.$x);\r
458 this.drawXtoY (this.$x, this.$y, start_x9, start_y9, g);\r
459 g2.setColor (this.copper);\r
460 this.$y = org.uwi.TanSugd3S.CalcH2Eg (this.$x);\r
461 this.drawXtoY (this.$x, this.$y, start_x11, start_y11, g);\r
462 g2.setColor (this.dgreen);\r
463 this.$y = org.uwi.TanSugd3S.CalcH2T1g (this.$x);\r
464 this.drawXtoY (this.$x, this.$y, start_x10, start_y10, g);\r
465 }\r
466 g2.setStroke (stroke1);\r
467 g2.setColor (java.awt.Color.black);\r
468 g2.setFont (this.fb);\r
469 var sx = this.bottomLeft.x;\r
470 var sy = this.bottomLeft.y;\r
471 g2.drawString ("" + this.start_x, sx, sy + 15);\r
472 g2.drawString ("delta/B", sx + 170, sy + 15);\r
473 g2.drawString ("C/B=4.5", sx + 345, sy + 30);\r
474 g2.drawString ("" + this.end_x, this.graphRec.width + 35, sy + 15);\r
475 g2.drawString ("E/B", sx - 35, this.graphRec.y + 100);\r
476 if (this.lrange == 0) {\r
477 g2.drawString ("4F", sx - 25, this.graphRec.y + 465);\r
478 g2.drawString ("4P", sx - 25, this.graphRec.y + 400);\r
479 g2.drawString ("2G", sx - 25, this.graphRec.y + 385);\r
480 g2.drawString ("2H", sx - 25, this.graphRec.y + 370);\r
481 g2.drawString ("2D", sx - 25, this.graphRec.y + 355);\r
482 }if (this.mouseOn) {\r
483 g2.setColor (java.awt.Color.black);\r
484 this.gx = Clazz.doubleToInt (((this.deltaB - this.start_x) * this.xScale) + this.bottomLeft.x);\r
485 g2.drawLine (this.gx, this.bottomLeft.y, this.gx, this.graphRec.y);\r
486 g2.setFont (this.f);\r
487 g2.drawString ("delta/B'   " + this.toThreePlaces (this.deltaB), this.outPRec.x, this.outPRec.y + 15);\r
488 g2.setColor (java.awt.Color.red);\r
489 g2.drawString ("v1(T2g)/B' " + this.toThreePlaces (this.y1), this.outPRec.x, this.outPRec.y + 28);\r
490 g2.setColor (java.awt.Color.blue);\r
491 g2.drawString ("v2(T1g)/B' " + this.toThreePlaces (this.y2), this.outPRec.x, this.outPRec.y + 43);\r
492 g2.setColor (this.dkgreen);\r
493 g2.drawString ("v3(T1g)/B' " + this.toThreePlaces (this.y3), this.outPRec.x, this.outPRec.y + 56);\r
494 g2.setColor (java.awt.Color.black);\r
495 g2.drawString ("ratio v2/v1 " + this.toThreePlaces (this.ratio21), this.outPRec.x, this.outPRec.y + 70);\r
496 g2.setColor (this.teal);\r
497 g2.drawString ("f1 (Eg)/B' " + this.toThreePlaces (this.fE), this.outPRec.x, this.outPRec.y + 83);\r
498 g2.setColor (java.awt.Color.orange);\r
499 g2.drawString ("f2(T1g)/B' " + this.toThreePlaces (this.fT1), this.outPRec.x, this.outPRec.y + 98);\r
500 g2.setColor (this.gold);\r
501 g2.drawString ("f3(T2g)/B' " + this.toThreePlaces (this.fT2), this.outPRec.x, this.outPRec.y + 113);\r
502 g2.setColor (java.awt.Color.gray);\r
503 g2.drawString ("f4(A1g)/B' " + this.toThreePlaces (this.fA1), this.outPRec.x, this.outPRec.y + 128);\r
504 g2.setColor (this.lgreen);\r
505 g2.drawString ("f5(T2g)/B' " + this.toThreePlaces (this.fT2H), this.outPRec.x, this.outPRec.y + 143);\r
506 g2.setColor (this.copper);\r
507 g2.drawString ("f6(Eg)/B'  " + this.toThreePlaces (this.fEH), this.outPRec.x, this.outPRec.y + 159);\r
508 g2.setColor (this.dgreen);\r
509 g2.drawString ("f7(T1g)/B' " + this.toThreePlaces (this.fT1H), this.outPRec.x, this.outPRec.y + 173);\r
510 g2.setColor (this.purple);\r
511 g2.drawString ("f8(T2g)/B' " + this.toThreePlaces (this.fT2b), this.outPRec.x, this.outPRec.y + 189);\r
512 this.mouseOn = false;\r
513 }}, "java.awt.Graphics");\r
514 Clazz.defineMethod (c$, "toThreePlaces", \r
515 function ($in) {\r
516 var temp = Math.round ($in * 1000);\r
517 var tmp =  String.instantialize ("" + temp);\r
518 return (tmp.substring (0, tmp.length - 3) + "." + tmp.substring (tmp.length - 3, tmp.length));\r
519 }, "~N");\r
520 Clazz.defineMethod (c$, "drawXtoY", \r
521  function (x, y, screen_x, screen_y, g) {\r
522 var end_x1;\r
523 var end_y1;\r
524 end_x1 = Clazz.doubleToInt (((x - this.start_x) * this.xScale) + this.bottomLeft.x);\r
525 end_y1 = Clazz.doubleToInt (this.bottomLeft.y - (y * this.yScale));\r
526 g.drawLine (screen_x[0], screen_y[0], end_x1, end_y1);\r
527 screen_x[0] = end_x1;\r
528 screen_y[0] = end_y1;\r
529 }, "~N,~N,~A,~A,java.awt.Graphics");\r
530 Clazz.overrideMethod (c$, "mousePressed", \r
531 function (e) {\r
532 this.mouseOn = true;\r
533 e.consume ();\r
534 this.gx = e.getX ();\r
535 this.deltaB = ((this.gx - this.bottomLeft.x) / this.xScale) + this.start_x;\r
536 if ((this.deltaB >= this.start_x) && (this.deltaB <= this.end_x)) {\r
537 this.x1 = this.deltaB;\r
538 this.y1 = this.x1;\r
539 this.y2 = org.uwi.TanSugd3S.CalcF4T1g (this.x1);\r
540 this.y3 = org.uwi.TanSugd3S.CalcP4T1g (this.x1);\r
541 this.fE = org.uwi.TanSugd3S.CalcG2Eg (this.x1);\r
542 this.fT1 = org.uwi.TanSugd3S.CalcG2T1g (this.x1);\r
543 this.fT2 = org.uwi.TanSugd3S.CalcG2T2g (this.x1);\r
544 this.fA1 = org.uwi.TanSugd3S.CalcG2A1g (this.x1);\r
545 this.fT2b = org.uwi.TanSugd3S.CalcD2T2g (this.x1);\r
546 this.fT2H = org.uwi.TanSugd3S.CalcH2T2g (this.x1);\r
547 this.fEH = org.uwi.TanSugd3S.CalcH2Eg (this.x1);\r
548 this.fT1H = org.uwi.TanSugd3S.CalcH2T1g (this.x1);\r
549 this.ratio21 = this.y2 / this.y1;\r
550 this.ratio31 = this.y3 / this.y1;\r
551 this.ratio32 = this.y3 / this.y2;\r
552 this.repaint ();\r
553 }}, "java.awt.event.MouseEvent");\r
554 Clazz.overrideMethod (c$, "mouseEntered", \r
555 function (e) {\r
556 }, "java.awt.event.MouseEvent");\r
557 Clazz.overrideMethod (c$, "mouseExited", \r
558 function (e) {\r
559 }, "java.awt.event.MouseEvent");\r
560 Clazz.overrideMethod (c$, "mouseClicked", \r
561 function (e) {\r
562 }, "java.awt.event.MouseEvent");\r
563 Clazz.overrideMethod (c$, "mouseReleased", \r
564 function (e) {\r
565 }, "java.awt.event.MouseEvent");\r
566 Clazz.overrideMethod (c$, "mouseDragged", \r
567 function (e) {\r
568 this.mousePressed (e);\r
569 }, "java.awt.event.MouseEvent");\r
570 Clazz.overrideMethod (c$, "mouseMoved", \r
571 function (e) {\r
572 }, "java.awt.event.MouseEvent");\r
573 c$ = Clazz.decorateAsClass (function () {\r
574 this.s = null;\r
575 this.e = null;\r
576 this.canvas = null;\r
577 this.range = 0;\r
578 this.bg0 = null;\r
579 this.bg5 = null;\r
580 Clazz.instantialize (this, arguments);\r
581 }, org.uwi, "TSd3Controls", javax.swing.JPanel, java.awt.event.ItemListener);\r
582 Clazz.makeConstructor (c$, \r
583 function (canvas) {\r
584 Clazz.superConstructor (this, org.uwi.TSd3Controls, []);\r
585 this.setLayout ( new java.awt.FlowLayout ());\r
586 this.setName ("T3d3Controls");\r
587 this.canvas = canvas;\r
588 this.range = 0;\r
589 var bg =  new javax.swing.ButtonGroup ();\r
590 this.bg0 = this.addButton (bg, "0-50", true);\r
591 this.addButton (bg, "0-10", false);\r
592 this.addButton (bg, "10-20", false);\r
593 this.addButton (bg, "20-30", false);\r
594 this.addButton (bg, "30-40", false);\r
595 this.bg5 = this.addButton (bg, "40-50", false);\r
596 this.setVisible (true);\r
597 }, "org.uwi.TSd3Canvas");\r
598 Clazz.defineMethod (c$, "addButton", \r
599  function (bg, text, b) {\r
600 var c;\r
601 bg.add (c =  new javax.swing.JRadioButton (text, b));\r
602 c.setName (text);\r
603 this.add (c);\r
604 c.addItemListener (this);\r
605 c.setFont ( new java.awt.Font ("Arial", 0, 10));\r
606 return c;\r
607 }, "javax.swing.ButtonGroup,~S,~B");\r
608 Clazz.overrideMethod (c$, "itemStateChanged", \r
609 function (e) {\r
610 if (Clazz.instanceOf (e.getSource (), javax.swing.JRadioButton) && e.getStateChange () == 1) {\r
611 var b = (e.getItemSelectable ()).getText ();\r
612 if (b === "0-50") {\r
613 this.range = 0;\r
614 } else if (b === "0-10") {\r
615 this.range = 1;\r
616 } else if (b === "10-20") {\r
617 this.range = 2;\r
618 } else if (b === "20-30") {\r
619 this.range = 3;\r
620 } else if (b === "30-40") {\r
621 this.range = 4;\r
622 } else if (b === "40-50") {\r
623 this.range = 5;\r
624 }this.canvas.redraw (this.range);\r
625 }}, "java.awt.event.ItemEvent");\r
626 });\r