Draw threshold over graph
authoramwaterhouse <Andrew Waterhouse>
Tue, 4 Apr 2006 13:09:28 +0000 (13:09 +0000)
committeramwaterhouse <Andrew Waterhouse>
Tue, 4 Apr 2006 13:09:28 +0000 (13:09 +0000)
src/jalview/gui/AnnotationPanel.java

index c5708ee..1b4a230 100755 (executable)
@@ -958,21 +958,6 @@ public class AnnotationPanel extends JPanel implements MouseListener,
       g.setColor(Color.gray);\r
       g.drawLine(x-av.charWidth,y2,(eRes-sRes+1)*av.charWidth,y2);\r
 \r
-\r
-      if(aa.threshold!=null)\r
-      {\r
-          g.setColor(aa.threshold.colour);\r
-          Graphics2D g2 = (Graphics2D)g;\r
-          g2.setStroke(new BasicStroke(1,\r
-                                        BasicStroke.CAP_SQUARE,\r
-                                        BasicStroke.JOIN_ROUND, 3f,\r
-                                        new float[] { 5f, 3f }, 0f));\r
-\r
-          y2 = (int)(y - ((aa.threshold.value-min) / range)*graphHeight);\r
-          g.drawLine(x-av.charWidth,y2,(eRes-sRes)*av.charWidth,y2);\r
-          g2.setStroke(new BasicStroke());\r
-      }\r
-\r
       eRes = Math.min(eRes, aa.annotations.length);\r
 \r
       int column = sRes;\r
@@ -1006,6 +991,19 @@ public class AnnotationPanel extends JPanel implements MouseListener,
           g.drawLine(x-av.charWidth/2, y1, x+av.charWidth/2, y2);\r
           x += av.charWidth;\r
        }\r
+       if(aa.threshold!=null)\r
+       {\r
+           g.setColor(aa.threshold.colour);\r
+           Graphics2D g2 = (Graphics2D)g;\r
+           g2.setStroke(new BasicStroke(1,\r
+                                         BasicStroke.CAP_SQUARE,\r
+                                         BasicStroke.JOIN_ROUND, 3f,\r
+                                         new float[] { 5f, 3f }, 0f));\r
+\r
+           y2 = (int)(y - ((aa.threshold.value-min) / range)*graphHeight);\r
+           g.drawLine(0,y2,(eRes-sRes)*av.charWidth,y2);\r
+           g2.setStroke(new BasicStroke());\r
+      }\r
     }\r
 \r
     public void drawBarGraph(Graphics g, AlignmentAnnotation aa,\r
@@ -1022,20 +1020,6 @@ public class AnnotationPanel extends JPanel implements MouseListener,
 \r
       float range = max - min;\r
 \r
-      if(aa.threshold!=null)\r
-      {\r
-          g.setColor(aa.threshold.colour);\r
-          Graphics2D g2 = (Graphics2D)g;\r
-          g2.setStroke(new BasicStroke(1,\r
-                                        BasicStroke.CAP_SQUARE,\r
-                                        BasicStroke.JOIN_ROUND, 3f,\r
-                                        new float[] { 5f, 3f }, 0f));\r
-\r
-          y2 = (int)(y - ((aa.threshold.value-min) / range)*aa.graphHeight);\r
-          g.drawLine(x-av.charWidth,y2,(eRes-sRes)*av.charWidth,y2);\r
-          g2.setStroke(new BasicStroke());\r
-      }\r
-\r
       y1 = y2 = y;\r
 \r
       if(min<0)\r
@@ -1082,7 +1066,19 @@ public class AnnotationPanel extends JPanel implements MouseListener,
 \r
           x += av.charWidth;\r
       }\r
+      if(aa.threshold!=null)\r
+      {\r
+          g.setColor(aa.threshold.colour);\r
+          Graphics2D g2 = (Graphics2D)g;\r
+          g2.setStroke(new BasicStroke(1,\r
+                                        BasicStroke.CAP_SQUARE,\r
+                                        BasicStroke.JOIN_ROUND, 3f,\r
+                                        new float[] { 5f, 3f }, 0f));\r
 \r
+          y2 = (int)(y - ((aa.threshold.value-min) / range)*aa.graphHeight);\r
+          g.drawLine(0,y2,(eRes-sRes)*av.charWidth,y2);\r
+          g2.setStroke(new BasicStroke());\r
+      }\r
     }\r
 \r
     // used by overview window\r