From aae9a99e127a20cfd7def2ced9265dcf669bf737 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Mon, 15 May 2006 14:09:34 +0000 Subject: [PATCH] All or nothing drawing display char --- src/jalview/datamodel/AlignmentAnnotation.java | 16 ++++++++++++++++ src/jalview/io/AnnotationReader.java | 24 ++++++++++-------------- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/jalview/datamodel/AlignmentAnnotation.java b/src/jalview/datamodel/AlignmentAnnotation.java index ae3c5f9..7f6b08a 100755 --- a/src/jalview/datamodel/AlignmentAnnotation.java +++ b/src/jalview/datamodel/AlignmentAnnotation.java @@ -139,6 +139,8 @@ public class AlignmentAnnotation this.annotations = annotations; graph = graphType; + boolean drawValues = true; + if (min == max) { min = 999999999; @@ -149,6 +151,11 @@ public class AlignmentAnnotation continue; } + if(drawValues && annotations[i].displayCharacter.length() > 1 ) + { + drawValues = false; + } + if (annotations[i].value > max) { max = annotations[i].value; @@ -161,6 +168,15 @@ public class AlignmentAnnotation } } + if(!drawValues) + { + for (int i = 0; i < annotations.length; i++) + { + if (annotations[i] != null) + annotations[i].displayCharacter = ""; + } + } + graphMin = min; graphMax = max; diff --git a/src/jalview/io/AnnotationReader.java b/src/jalview/io/AnnotationReader.java index d42167a..cd7abfd 100755 --- a/src/jalview/io/AnnotationReader.java +++ b/src/jalview/io/AnnotationReader.java @@ -170,6 +170,7 @@ public class AnnotationReader String desc = "", displayChar=""; char ss = ' '; // secondaryStructure float value = 0; + boolean parsedValue = false; StringTokenizer st = new StringTokenizer(string, ","); String token; while(st.hasMoreTokens()) @@ -178,29 +179,24 @@ public class AnnotationReader if(token.length()==0) continue; - if(value==0) - { try{ - value = new Float(token).floatValue(); + if(!parsedValue) + { + try{ + value = new Float(token).floatValue(); + displayChar = token; + parsedValue = true; }catch(NumberFormatException ex){} } - if(token.length()==1) + if(token.equals("H") || token.equals("E")) { // Either this character represents a helix or sheet // or an integer which can be displayed - if(token.equals("H") || token.equals("E")) - { - ss = token.charAt(0); - } - else //if(value!=0) - { - displayChar = token; - } + ss = token.charAt(0); } else if(desc.length()<1) desc = token; - else - displayChar = token; + } return new Annotation(displayChar, desc, ss, value); -- 1.7.10.2