No need to hava SSX as array
authoramwaterhouse <Andrew Waterhouse>
Fri, 24 Mar 2006 15:33:44 +0000 (15:33 +0000)
committeramwaterhouse <Andrew Waterhouse>
Fri, 24 Mar 2006 15:33:44 +0000 (15:33 +0000)
src/jalview/gui/AnnotationPanel.java

index ab6d395..a10d58b 100755 (executable)
@@ -606,8 +606,8 @@ public class AnnotationPanel extends JPanel implements MouseListener,
 \r
         int x = 0;\r
         int y = 0;\r
-        char[] lastSS = new char[aa.length];\r
-        int[] lastSSX = new int[aa.length];\r
+        char lastSS;\r
+        int lastSSX;\r
         int iconOffset = av.charHeight / 2;\r
         boolean validRes = false;\r
 \r
@@ -624,6 +624,8 @@ public class AnnotationPanel extends JPanel implements MouseListener,
                 continue;\r
             }\r
 \r
+            lastSS = ' ';\r
+            lastSSX = 0;\r
 \r
 \r
             if (row.graph>0)\r
@@ -651,14 +653,13 @@ public class AnnotationPanel extends JPanel implements MouseListener,
 \r
             int column = startRes;\r
             int yPos = startRes;\r
-            int aaMax = row.annotations.length-1;\r
 \r
             while (yPos < endRes)\r
             {\r
               if (av.hasHiddenColumns)\r
               {\r
                 column = av.getColumnSelection().adjustForHiddenColumns(yPos);\r
-                if (column > aaMax)\r
+                if (column > row.annotations.length-1)\r
                 {\r
                   break;\r
                 }\r
@@ -724,21 +725,21 @@ public class AnnotationPanel extends JPanel implements MouseListener,
                 if (row.hasIcons)\r
                 {\r
                     if (!validRes ||\r
-                            (row.annotations[column].secondaryStructure != lastSS[i]))\r
+                            (row.annotations[column].secondaryStructure != lastSS))\r
                     {\r
-                        switch (lastSS[i])\r
+                        switch (lastSS)\r
                         {\r
                         case 'H':\r
                             g.setColor(HELIX_COLOUR);\r
-                            g.fillRoundRect(lastSSX[i], y + 4 + iconOffset,\r
-                                x - lastSSX[i], 7, 8, 8);\r
+                            g.fillRoundRect(lastSSX, y + 4 + iconOffset,\r
+                                x - lastSSX, 7, 8, 8);\r
 \r
                             break;\r
 \r
                         case 'E':\r
                             g.setColor(SHEET_COLOUR);\r
-                            g.fillRect(lastSSX[i], y + 4 + iconOffset,\r
-                                x - lastSSX[i] - 4, 7);\r
+                            g.fillRect(lastSSX, y + 4 + iconOffset,\r
+                                x - lastSSX - 4, 7);\r
                             g.fillPolygon(new int[] { x - 4, x - 4, x },\r
                                 new int[]\r
                                 {\r
@@ -751,22 +752,22 @@ public class AnnotationPanel extends JPanel implements MouseListener,
 \r
                         default:\r
                             g.setColor(Color.gray);\r
-                            g.fillRect(lastSSX[i], y + 6 + iconOffset,\r
-                                x - lastSSX[i], 2);\r
+                            g.fillRect(lastSSX, y + 6 + iconOffset,\r
+                                x - lastSSX, 2);\r
 \r
                             break;\r
                         }\r
 \r
                         if (validRes)\r
                         {\r
-                            lastSS[i] = row.annotations[column].secondaryStructure;\r
+                            lastSS = row.annotations[column].secondaryStructure;\r
                         }\r
                         else\r
                         {\r
-                            lastSS[i] = ' ';\r
+                            lastSS = ' ';\r
                         }\r
 \r
-                        lastSSX[i] = x;\r
+                        lastSSX = x;\r
                     }\r
                 }\r
 \r
@@ -777,12 +778,12 @@ public class AnnotationPanel extends JPanel implements MouseListener,
 \r
             if (row.hasIcons)\r
             {\r
-                switch (lastSS[i])\r
+                switch (lastSS)\r
                 {\r
                 case 'H':\r
                     g.setColor(HELIX_COLOUR);\r
-                    g.fillRoundRect(lastSSX[i], y + 4 + iconOffset,\r
-                        x - lastSSX[i], 7, 8, 8);\r
+                    g.fillRoundRect(lastSSX, y + 4 + iconOffset,\r
+                        x - lastSSX, 7, 8, 8);\r
 \r
                     break;\r
 \r
@@ -792,8 +793,8 @@ public class AnnotationPanel extends JPanel implements MouseListener,
                     if (row.annotations[endRes] !=null\r
                         && row.annotations[endRes].secondaryStructure != 'E')\r
                     {\r
-                      g.fillRect(lastSSX[i], y + 4 + iconOffset,\r
-                                 x - lastSSX[i] - 4, 7);\r
+                      g.fillRect(lastSSX, y + 4 + iconOffset,\r
+                                 x - lastSSX - 4, 7);\r
                       g.fillPolygon(new int[]\r
                                     {x - 4, x - 4, x},\r
                                     new int[]\r
@@ -803,17 +804,15 @@ public class AnnotationPanel extends JPanel implements MouseListener,
                       }, 3);\r
                     }\r
                     else\r
-                      g.fillRect(lastSSX[i], y + 4 + iconOffset,\r
-                                 x - lastSSX[i], 7);\r
+                      g.fillRect(lastSSX, y + 4 + iconOffset,\r
+                                 x - lastSSX, 7);\r
 \r
                     break;\r
 \r
-                case 'C':\r
-                    break;\r
 \r
                 default:\r
                     g.setColor(Color.gray);\r
-                    g.fillRect(lastSSX[i], y + 6 + iconOffset, x - lastSSX[i], 2);\r
+                    g.fillRect(lastSSX, y + 6 + iconOffset, x - lastSSX, 2);\r
 \r
                     break;\r
                 }\r