1f4c66fe523bc02f3616dcb0db4fdca5d500a97e
[jalviewjs.git] / bin / MCview / Atom.js
1 Clazz.declarePackage ("MCview");\r
2 Clazz.load (["java.awt.Color"], "MCview.Atom", ["java.lang.Float"], function () {\r
3 c$ = Clazz.decorateAsClass (function () {\r
4 this.x = 0;\r
5 this.y = 0;\r
6 this.z = 0;\r
7 this.number = 0;\r
8 this.name = null;\r
9 this.resName = null;\r
10 this.resNumber = 0;\r
11 this.insCode = ' ';\r
12 this.resNumIns = null;\r
13 this.type = 0;\r
14 this.color = null;\r
15 this.chain = null;\r
16 this.alignmentMapping = -1;\r
17 this.atomIndex = 0;\r
18 this.occupancy = 0;\r
19 this.tfactor = 0;\r
20 this.isSelected = false;\r
21 Clazz.instantialize (this, arguments);\r
22 }, MCview, "Atom");\r
23 Clazz.prepareFields (c$, function () {\r
24 this.color = java.awt.Color.lightGray;\r
25 });\r
26 Clazz.makeConstructor (c$, \r
27 function (str) {\r
28 this.atomIndex = Integer.parseInt (str.substring (6, 11).trim ());\r
29 this.name = str.substring (12, 15).trim ();\r
30 this.resName = str.substring (17, 20);\r
31 this.chain = str.substring (21, 22);\r
32 this.resNumber = Integer.parseInt (str.substring (22, 26).trim ());\r
33 this.resNumIns = str.substring (22, 27).trim ();\r
34 this.insCode = str.substring (26, 27).charAt (0);\r
35 this.x = ( new Float (str.substring (30, 38).trim ()).floatValue ());\r
36 this.y = ( new Float (str.substring (38, 46).trim ()).floatValue ());\r
37 this.z = ( new Float (str.substring (47, 55).trim ()).floatValue ());\r
38 var tm = str.substring (54, 60).trim ();\r
39 if (tm.length > 0) {\r
40 this.occupancy = ( new Float (tm)).floatValue ();\r
41 } else {\r
42 this.occupancy = 1;\r
43 }tm = str.substring (60, 66).trim ();\r
44 if (tm.length > 0) {\r
45 this.tfactor = ( new Float (tm).floatValue ());\r
46 } else {\r
47 this.tfactor = 1;\r
48 }}, "~S");\r
49 Clazz.makeConstructor (c$, \r
50 function (x, y, z) {\r
51 this.x = x;\r
52 this.y = y;\r
53 this.z = z;\r
54 }, "~N,~N,~N");\r
55 });\r