From 1f705a7597d9558cbb6962826bfdc2f0ac2c6a50 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Thu, 16 Mar 2006 15:16:21 +0000 Subject: [PATCH] Fastest implementation so far --- src/jalview/appletgui/OverviewPanel.java | 47 ++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/src/jalview/appletgui/OverviewPanel.java b/src/jalview/appletgui/OverviewPanel.java index 48f075e..e8f9f9f 100755 --- a/src/jalview/appletgui/OverviewPanel.java +++ b/src/jalview/appletgui/OverviewPanel.java @@ -59,7 +59,6 @@ public class OverviewPanel sr.renderGaps( false ); sr.forOverview = true; fr = new FeatureRenderer(av); - fr.drawText = false; fr.overview = true; @@ -192,7 +191,6 @@ public class OverviewPanel fr.sequenceFeatures = ap.seqPanel.seqCanvas.getFeatureRenderer().sequenceFeatures; } - resizing = true; if ( (getSize().width > 0) && (getSize().height > 0)) @@ -218,6 +216,14 @@ public class OverviewPanel int alwidth = av.alignment.getWidth(); int alheight = av.alignment.getHeight(); + if (av.showSequenceFeatures) + { + fr.renderOrder = ap.seqPanel.seqCanvas.getFeatureRenderer().renderOrder; + fr.featureGroups = ap.seqPanel.seqCanvas.getFeatureRenderer().featureGroups; + fr.featureColours = ap.seqPanel.seqCanvas.getFeatureRenderer().featureColours; + fr.sequenceFeatures = ap.seqPanel.seqCanvas.getFeatureRenderer().sequenceFeatures; + } + if (getSize().width > 0 && getSize().height > 0) { width = getSize().width; @@ -238,27 +244,34 @@ public class OverviewPanel float sampleCol = (float) alwidth / (float) width; float sampleRow = (float) alheight / (float) sequencesHeight; - int lastcol=-1, lastrow=0; + int lastcol=0, lastseq=0; + int xstart=0, ystart=0; Color color = Color.yellow; - int row, col; + int col, sameRow = 0, sameCol = 0; jalview.datamodel.SequenceI sequence; - for (row = 0; row < sequencesHeight; row++) + + for (int row = 0; row <= sequencesHeight; row++) { - sequence = av.getAlignment().getSequenceAt(lastrow); + if((int)(row*sampleRow)==lastseq) + { + sameRow ++; + continue; + } + + sequence = av.getAlignment().getSequenceAt(lastseq); + for (col = 0; col < width; col++) { - if((int)(col*sampleCol) == lastcol && (int)(row*sampleRow)==lastrow) + if((int)(col*sampleCol) == lastcol) { - mg.drawLine(col, row, col, row); + sameCol ++; continue; } - lastrow = (int)(row*sampleRow); lastcol = (int)(col*sampleCol); - if(av.alignment.getSequenceAt(lastrow).getLength()>lastcol) + if(sequence.getLength()>lastcol) { - color = sr.findSequenceColour(sequence, lastcol); if (av.showSequenceFeatures) @@ -270,9 +283,19 @@ public class OverviewPanel color = color.white; mg.setColor(color); - mg.drawLine(col,row,col,row); + if (sameCol == 1 && sameRow == 1) + mg.drawLine(xstart, ystart, xstart, ystart); + else + mg.fillRect(xstart, ystart, sameCol, sameRow); + xstart = col; + sameCol = 1; } + + + lastseq = (int)(row*sampleRow); + ystart = row; + sameRow = 1; } if (av.conservation != null) -- 1.7.10.2