X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FSeqCanvas.java;h=2f7cd7638ffc73bccadff4327285318d425cad61;hb=fd81731a3e96d74a14c114d8808b44ee9673f9ef;hp=4c04ad37d2a409c951f2f7550ddb77a6d79496e7;hpb=be32c14cd8e48fe0a207cd7030cb9cd46f894678;p=jalview.git diff --git a/src/jalview/gui/SeqCanvas.java b/src/jalview/gui/SeqCanvas.java index 4c04ad3..2f7cd76 100755 --- a/src/jalview/gui/SeqCanvas.java +++ b/src/jalview/gui/SeqCanvas.java @@ -106,6 +106,7 @@ public class SeqCanvas extends JComponent charHeight = av.getCharHeight(); charWidth = av.getCharWidth(); } + /** * DOCUMENT ME! * @@ -121,25 +122,26 @@ public class SeqCanvas extends JComponent private void drawNorthScale(Graphics g, int startx, int endx, int ypos) { updateViewport(); - int scalestartx = startx - (startx % 10) + 10; - - g.setColor(Color.black); - // NORTH SCALE - for (int i = scalestartx; i < endx; i += 10) + for (Object[] mark : jalview.renderer.ScaleRenderer.calculateMarks(av, + startx, endx)) { - int value = i; - if (av.hasHiddenColumns()) + int mpos = ((Integer) mark[1]).intValue(); // (i - startx - 1) + if (mpos < 0) { - value = av.getColumnSelection().adjustForHiddenColumns(value); + continue; } + String mstring = (String) mark[2]; - g.drawString(String.valueOf(value), (i - startx - 1) * charWidth, - ypos - (charHeight / 2)); - - g.drawLine(((i - startx - 1) * charWidth) + (charWidth / 2), - (ypos + 2) - (charHeight / 2), ((i - startx - 1) * charWidth) - + (charWidth / 2), - ypos - 2); + if (Boolean.valueOf((Boolean) mark[0])) + { + if (mstring != null) + { + g.drawString(mstring, mpos * charWidth, ypos - (charHeight / 2)); + } + g.drawLine((mpos * charWidth) + (charWidth / 2), (ypos + 2) + - (charHeight / 2), (mpos * charWidth) + (charWidth / 2), + ypos - 2); + } } } @@ -335,6 +337,7 @@ public class SeqCanvas extends JComponent */ // Set this to false to force a full panel paint + @Override public void paintComponent(Graphics g) { updateViewport(); @@ -557,12 +560,12 @@ public class SeqCanvas extends JComponent continue; } - gg.fillPolygon(new int[] - { res * charWidth - charHeight / 4, - res * charWidth + charHeight / 4, res * charWidth }, - new int[] - { ypos - (charHeight / 2), ypos - (charHeight / 2), - ypos - (charHeight / 2) + 8 }, 3); + gg.fillPolygon( + new int[] { res * charWidth - charHeight / 4, + res * charWidth + charHeight / 4, res * charWidth }, + new int[] { ypos - (charHeight / 2), + ypos - (charHeight / 2), ypos - (charHeight / 2) + 8 }, + 3); } } @@ -591,8 +594,8 @@ public class SeqCanvas extends JComponent annotations = new AnnotationPanel(av); } - annotations.renderer.drawComponent(annotations, av, g, - -1, startRes, endx + 1); + annotations.renderer.drawComponent(annotations, av, g, -1, + startRes, endx + 1); g.translate(0, -cHeight - ypos - 3); } g.setClip(clip); @@ -638,8 +641,7 @@ public class SeqCanvas extends JComponent * DOCUMENT ME! */ public void drawPanel(Graphics g1, int startRes, int endRes, - int startSeq, - int endSeq, int offset) + int startSeq, int endSeq, int offset) { updateViewport(); if (!av.hasHiddenColumns()) @@ -683,10 +685,17 @@ public class SeqCanvas extends JComponent g1.translate(-screenY * charWidth, 0); screenY += blockEnd - blockStart + 1; blockStart = hideEnd + 1; + + if (screenY > (endRes - startRes)) + { + // already rendered last block + return; + } } if (screenY <= (endRes - startRes)) { + // remaining visible region to render blockEnd = blockStart + (endRes - startRes) - screenY; g1.translate(screenY * charWidth, 0); draw(g1, blockStart, blockEnd, startSeq, endSeq, offset); @@ -700,8 +709,7 @@ public class SeqCanvas extends JComponent // int startRes, int endRes, int startSeq, int endSeq, int x, int y, // int x1, int x2, int y1, int y2, int startx, int starty, private void draw(Graphics g, int startRes, int endRes, int startSeq, - int endSeq, - int offset) + int endSeq, int offset) { g.setFont(av.getFont()); sr.prepare(g, av.isRenderGaps()); @@ -831,8 +839,8 @@ public class SeqCanvas extends JComponent if (group == av.getSelectionGroup()) { g.setStroke(new BasicStroke(1, BasicStroke.CAP_BUTT, - BasicStroke.JOIN_ROUND, 3f, new float[] - { 5f, 3f }, 0f)); + BasicStroke.JOIN_ROUND, 3f, new float[] { 5f, 3f }, + 0f)); g.setColor(Color.RED); } else @@ -941,8 +949,7 @@ public class SeqCanvas extends JComponent break; } - group = av.getAlignment().getGroups() - .get(groupIndex); + group = av.getAlignment().getGroups().get(groupIndex); } while (groupIndex < av.getAlignment().getGroups().size());