From d360d66235b8e99766ace8330175bd0258a8c07c Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Fri, 24 Mar 2006 15:33:44 +0000 Subject: [PATCH] No need to hava SSX as array --- src/jalview/gui/AnnotationPanel.java | 49 +++++++++++++++++----------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index ab6d395..a10d58b 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -606,8 +606,8 @@ public class AnnotationPanel extends JPanel implements MouseListener, int x = 0; int y = 0; - char[] lastSS = new char[aa.length]; - int[] lastSSX = new int[aa.length]; + char lastSS; + int lastSSX; int iconOffset = av.charHeight / 2; boolean validRes = false; @@ -624,6 +624,8 @@ public class AnnotationPanel extends JPanel implements MouseListener, continue; } + lastSS = ' '; + lastSSX = 0; if (row.graph>0) @@ -651,14 +653,13 @@ public class AnnotationPanel extends JPanel implements MouseListener, int column = startRes; int yPos = startRes; - int aaMax = row.annotations.length-1; while (yPos < endRes) { if (av.hasHiddenColumns) { column = av.getColumnSelection().adjustForHiddenColumns(yPos); - if (column > aaMax) + if (column > row.annotations.length-1) { break; } @@ -724,21 +725,21 @@ public class AnnotationPanel extends JPanel implements MouseListener, if (row.hasIcons) { if (!validRes || - (row.annotations[column].secondaryStructure != lastSS[i])) + (row.annotations[column].secondaryStructure != lastSS)) { - switch (lastSS[i]) + switch (lastSS) { case 'H': g.setColor(HELIX_COLOUR); - g.fillRoundRect(lastSSX[i], y + 4 + iconOffset, - x - lastSSX[i], 7, 8, 8); + g.fillRoundRect(lastSSX, y + 4 + iconOffset, + x - lastSSX, 7, 8, 8); break; case 'E': g.setColor(SHEET_COLOUR); - g.fillRect(lastSSX[i], y + 4 + iconOffset, - x - lastSSX[i] - 4, 7); + g.fillRect(lastSSX, y + 4 + iconOffset, + x - lastSSX - 4, 7); g.fillPolygon(new int[] { x - 4, x - 4, x }, new int[] { @@ -751,22 +752,22 @@ public class AnnotationPanel extends JPanel implements MouseListener, default: g.setColor(Color.gray); - g.fillRect(lastSSX[i], y + 6 + iconOffset, - x - lastSSX[i], 2); + g.fillRect(lastSSX, y + 6 + iconOffset, + x - lastSSX, 2); break; } if (validRes) { - lastSS[i] = row.annotations[column].secondaryStructure; + lastSS = row.annotations[column].secondaryStructure; } else { - lastSS[i] = ' '; + lastSS = ' '; } - lastSSX[i] = x; + lastSSX = x; } } @@ -777,12 +778,12 @@ public class AnnotationPanel extends JPanel implements MouseListener, if (row.hasIcons) { - switch (lastSS[i]) + switch (lastSS) { case 'H': g.setColor(HELIX_COLOUR); - g.fillRoundRect(lastSSX[i], y + 4 + iconOffset, - x - lastSSX[i], 7, 8, 8); + g.fillRoundRect(lastSSX, y + 4 + iconOffset, + x - lastSSX, 7, 8, 8); break; @@ -792,8 +793,8 @@ public class AnnotationPanel extends JPanel implements MouseListener, if (row.annotations[endRes] !=null && row.annotations[endRes].secondaryStructure != 'E') { - g.fillRect(lastSSX[i], y + 4 + iconOffset, - x - lastSSX[i] - 4, 7); + g.fillRect(lastSSX, y + 4 + iconOffset, + x - lastSSX - 4, 7); g.fillPolygon(new int[] {x - 4, x - 4, x}, new int[] @@ -803,17 +804,15 @@ public class AnnotationPanel extends JPanel implements MouseListener, }, 3); } else - g.fillRect(lastSSX[i], y + 4 + iconOffset, - x - lastSSX[i], 7); + g.fillRect(lastSSX, y + 4 + iconOffset, + x - lastSSX, 7); break; - case 'C': - break; default: g.setColor(Color.gray); - g.fillRect(lastSSX[i], y + 6 + iconOffset, x - lastSSX[i], 2); + g.fillRect(lastSSX, y + 6 + iconOffset, x - lastSSX, 2); break; } -- 1.7.10.2