X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FMCview%2FAtom.java;h=51c4f0135203fb2c675ddc8f12eea7b334d36bf3;hb=8893c2ac9824d4c566ae69c73d34889c5316b058;hp=0aaf0409a13314e72fe59bf9391a25960e8ef538;hpb=588042b69abf8e60bcc950b24c283933c7dd422f;p=jalview.git diff --git a/src/MCview/Atom.java b/src/MCview/Atom.java index 0aaf040..51c4f01 100755 --- a/src/MCview/Atom.java +++ b/src/MCview/Atom.java @@ -20,13 +20,11 @@ package MCview; import java.awt.*; -import java.util.*; - public class Atom { - double x; - double y; - double z; + float x; + float y; + float z; int number; String name; String resName; @@ -34,36 +32,24 @@ public class Atom { int type; Color color; String chain; + int alignmentMapping=-1; - public Atom(StringTokenizer str) { - this.number = (new Integer(str.nextToken())).intValue(); - this.name = str.nextToken(); - this.resName = str.nextToken(); + public boolean isSelected = false; - String tmpstr = new String(); + public Atom(String str) + { + name = str.substring(12,15).trim(); - try { - tmpstr = str.nextToken(); + resName = str.substring(17,20); - this.resNumber = (new Integer(tmpstr).intValue()); - this.chain = "A"; - this.color = Color.green; - } catch (NumberFormatException e) { - this.chain = tmpstr; + chain = str.substring(21,22); - if (tmpstr.equals("A")) { - this.color = new Color((float) Math.random(), - (float) Math.random(), (float) Math.random()); - } else { - this.color = Color.red; - } + resNumber = Integer.parseInt(str.substring(22,26).trim()); - this.resNumber = (new Integer(str.nextToken()).intValue()); - } + this.x = (float) (new Float(str.substring(30,38).trim()).floatValue()); + this.y = (float) (new Float(str.substring(38,46).trim()).floatValue()); + this.z = (float) (new Float(str.substring(47,55).trim()).floatValue()); - this.x = (double) (new Double(str.nextToken()).floatValue()); - this.y = (double) (new Double(str.nextToken()).floatValue()); - this.z = (double) (new Double(str.nextToken()).floatValue()); } public void setColor(Color col) {