X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FOverviewPanel.java;h=867ce56797cf768a81ca544e794b6a4ba6135a62;hb=2e699d341f8e64868e3c279f9c02af617c4e9b44;hp=4d3dec4ab313383920ffbfbd5d60545606965645;hpb=4a62141371fa3ab28aa2e21bab95399e97382142;p=jalview.git diff --git a/src/jalview/appletgui/OverviewPanel.java b/src/jalview/appletgui/OverviewPanel.java index 4d3dec4..867ce56 100755 --- a/src/jalview/appletgui/OverviewPanel.java +++ b/src/jalview/appletgui/OverviewPanel.java @@ -1,6 +1,6 @@ /* * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -26,6 +26,7 @@ public class OverviewPanel extends Panel implements Runnable, MouseMotionListener, MouseListener { Image miniMe; + Image offscreen; AlignViewport av; AlignmentPanel ap; float scalew = 1f; @@ -67,7 +68,7 @@ public class OverviewPanel float initialScale = (float) av.alignment.getWidth() / (float) av.alignment.getHeight(); - if(av.vconsensus==null) + if(av.hconsensus==null) graphHeight = 0; if (av.alignment.getWidth() > av.alignment.getHeight()) @@ -252,17 +253,19 @@ public class OverviewPanel scaleh = (float) sequencesHeight / (float) fullsizeHeight; miniMe = nullFrame.createImage(width, sequencesHeight + graphHeight); + offscreen = nullFrame.createImage(width, sequencesHeight + graphHeight); Graphics mg = miniMe.getGraphics(); float sampleCol = (float) alwidth / (float) width; float sampleRow = (float) alheight / (float) sequencesHeight; - int lastcol=-1, lastrow=-1; + int lastcol=0, lastrow=0; + int xstart=0, ystart=0; Color color = Color.yellow; int row, col, sameRow = 0, sameCol = 0; jalview.datamodel.SequenceI seq; boolean hiddenRow = false; - for (row = 0; row < sequencesHeight; row++) + for (row = 0; row <= sequencesHeight; row++) { if((int)(row*sampleRow)==lastrow) { @@ -270,8 +273,6 @@ public class OverviewPanel continue; } - lastrow = (int)(row*sampleRow); - hiddenRow = false; if (av.hasHiddenRows) { @@ -291,12 +292,6 @@ public class OverviewPanel else seq = av.alignment.getSequenceAt(lastrow); - if(seq==null) - { - System.out.println(lastrow+" null"); - continue; - } - for (col = 0; col < width; col++) { if ( (int) (col * sampleCol) == lastcol && (int) (row * sampleRow) == lastrow) @@ -328,12 +323,15 @@ public class OverviewPanel mg.setColor(color); if (sameCol == 1 && sameRow == 1) - mg.drawLine(col, row, col, row); + mg.drawLine(xstart, ystart, xstart, ystart); else - mg.fillRect(col, row, col+sameCol, col+sameRow); + mg.fillRect(xstart, ystart, sameCol, sameRow); + xstart = col; sameCol = 1; } + lastrow = (int)(row*sampleRow); + ystart = row; sameRow = 1; } @@ -418,9 +416,14 @@ public class OverviewPanel public void paint(Graphics g) { + Graphics og = offscreen.getGraphics(); if (miniMe != null) { - g.drawImage(miniMe, 0, 0, this); + og.drawImage(miniMe, 0, 0, this); + og.setColor(Color.red); + og.drawRect(boxX, boxY, boxWidth, boxHeight); + og.drawRect(boxX + 1, boxY + 1, boxWidth - 2, boxHeight - 2); + g.drawImage(offscreen, 0,0, this); } else { @@ -431,10 +434,6 @@ public class OverviewPanel g.drawString("Recalculating", 5, sequencesHeight / 2); g.drawString("Overview.....", 5, (sequencesHeight / 2) + 20); } - - g.setColor(Color.red); - g.drawRect(boxX, boxY, boxWidth, boxHeight); - g.drawRect(boxX + 1, boxY + 1, boxWidth - 2, boxHeight - 2); } }