find top and bottom of group
authoramwaterhouse <Andrew Waterhouse>
Thu, 7 Apr 2005 10:42:03 +0000 (10:42 +0000)
committeramwaterhouse <Andrew Waterhouse>
Thu, 7 Apr 2005 10:42:03 +0000 (10:42 +0000)
src/jalview/gui/SeqCanvas.java

index ef11e2d..ff9488e 100755 (executable)
@@ -244,23 +244,34 @@ public void fastPaint(int horizontal, int vertical)
         int oldY = -1;\r
         int i = 0;\r
         boolean inGroup = false;\r
+        int top=-1, bottom =-1;\r
         for (i = y1; i < y2; i++)\r
         {\r
           sx = (group.getStartRes() - startx) * av.charWidth;\r
           sy = offset + AlignmentUtil.getPixelHeight(starty, i, av.charHeight);\r
           ex = (group.getEndRes() + 1 - group.getStartRes()) * av.charWidth;\r
 \r
-          if (group.sequences.contains(av.alignment.getSequenceAt(i))\r
-              && sx < getWidth()\r
-              && ex > 0)\r
+\r
+          if (sx < getWidth()\r
+              && ex > 0\r
+              && group.sequences.contains(av.alignment.getSequenceAt(i)))\r
           {\r
+\r
+            if (bottom == -1 &&\r
+                !group.sequences.contains(av.alignment.getSequenceAt(i + 1)))\r
+              bottom = sy + av.charHeight - 1;\r
+\r
             if (!inGroup)\r
             {\r
+              if (top == -1 && i==0 ||\r
+                  !group.sequences.contains(av.alignment.getSequenceAt(i - 1)))\r
+                top = sy;\r
+\r
               oldY = sy;\r
               inGroup = true;\r
               if (group == av.getSelectionGroup())\r
               {\r
-            //    g.setStroke(new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 3f, new float[]{5f,2f,2f}, 0f ));\r
+                g.setStroke(new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 3f, new float[]{5f,3f}, 0f ));\r
                 g.setColor(Color.RED);\r
               }\r
               else\r
@@ -274,18 +285,32 @@ public void fastPaint(int horizontal, int vertical)
           {\r
             if (inGroup)\r
             {\r
-              g.drawRect(sx, oldY, ex, (sy - oldY));\r
+\r
+              g.drawLine(sx, oldY, sx, sy );\r
+              g.drawLine(sx+ex, oldY, sx+ex, sy );\r
+              if (top != -1)\r
+                g.drawLine(sx, top, sx + ex, top);\r
+              if (bottom != -1)\r
+                g.drawLine(sx, bottom, sx + ex, bottom);\r
+\r
               inGroup = false;\r
             }\r
           }\r
         }\r
+\r
         if (inGroup)\r
         {\r
+\r
+          if(top!=-1)\r
+             g.drawLine(sx,top, sx+ex, top);\r
+          if(bottom!=-1)\r
+             g.drawLine(sx,bottom, sx+ex, bottom);\r
+\r
           sy = offset + AlignmentUtil.getPixelHeight(starty, i, av.charHeight);\r
-          g.drawRect(sx, oldY, ex, (sy - oldY));\r
+          g.drawLine(sx, oldY, sx, sy );\r
+          g.drawLine(sx+ex, oldY, sx+ex, sy );\r
           inGroup = false;\r
         }\r
-\r
         groupIndex++;\r
         if (groupIndex >= groups.size())\r
           break;\r