javadoc
[jalview.git] / src / jalview / datamodel / AlignmentAnnotation.java
index d75683c..5a2c46e 100755 (executable)
@@ -139,6 +139,8 @@ public class AlignmentAnnotation
         this.annotations = annotations;\r
         graph = graphType;\r
 \r
+        boolean drawValues = true;\r
+\r
         if (min == max)\r
         {\r
             min = 999999999;\r
@@ -149,6 +151,11 @@ public class AlignmentAnnotation
                     continue;\r
                 }\r
 \r
+                if(drawValues && annotations[i].displayCharacter.length() > 1 )\r
+                {\r
+                  drawValues = false;\r
+                }\r
+\r
                 if (annotations[i].value > max)\r
                 {\r
                     max = annotations[i].value;\r
@@ -166,19 +173,30 @@ public class AlignmentAnnotation
 \r
         for (int i = 0; i < annotations.length; i++)\r
         {\r
-            if ((annotations[i] != null) &&\r
-                    ((annotations[i].secondaryStructure == 'H') ||\r
+            if (!hasIcons\r
+                && annotations[i] != null\r
+                && ((annotations[i].secondaryStructure == 'H') ||\r
                     (annotations[i].secondaryStructure == 'E')))\r
             {\r
                 hasIcons = true;\r
             }\r
 \r
-            if ((annotations[i] != null) &&\r
-                    (annotations[i].displayCharacter.length() > 0))\r
+            if (!hasText\r
+                && annotations[i]!=null\r
+                && annotations[i].displayCharacter.length() > 0)\r
             {\r
                 hasText = true;\r
             }\r
         }\r
+\r
+        if(!drawValues && graphType!=NO_GRAPH)\r
+        {\r
+          for (int i = 0; i < annotations.length; i++)\r
+          {\r
+            if (annotations[i] != null)\r
+              annotations[i].displayCharacter = "";\r
+          }\r
+        }\r
     }\r
 \r
     /**\r
@@ -254,7 +272,7 @@ public class AlignmentAnnotation
         if(startRes < sequenceRef.getStart())\r
           startRes = sequenceRef.getStart();\r
 \r
-        int seqPos, seqIndex;\r
+        int seqPos;\r
 \r
         int fileOffset = 0;\r
         if(startRes > sequenceRef.getStart())\r
@@ -264,16 +282,13 @@ public class AlignmentAnnotation
 \r
         for(int i = 0; i < annotations.length; i++)\r
         {\r
-            seqPos = sequenceRef.findPosition(i - fileOffset)-1;\r
+            seqPos = sequenceRef.findPosition(i + fileOffset);\r
             if(seqPos<annotations.length)\r
             {\r
-              if (annotations[seqPos] != null)\r
+              if (annotations[i] != null)\r
               {\r
-                seqIndex = sequenceRef.findIndex(i) + 1;\r
-\r
-                if(seqIndex>=startRes)\r
-                sequenceMapping.put(new Integer(seqIndex),\r
-                                    annotations[seqPos]);\r
+                  sequenceMapping.put(new Integer(seqPos),\r
+                                      annotations[i]);\r
               }\r
             }\r
          }\r
@@ -286,9 +301,16 @@ public class AlignmentAnnotation
       {\r
           int a=0, aSize = sequenceRef.getLength();\r
 \r
+          if(aSize == 0)\r
+          {\r
+            //Its been deleted\r
+            return;\r
+          }\r
+\r
           int position;\r
           Annotation[] temp = new Annotation[aSize];\r
           Integer index;\r
+\r
           for (a = sequenceRef.getStart(); a <= sequenceRef.getEnd(); a++)\r
           {\r
               index = new Integer(a);\r