X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FOverviewPanel.java;h=a4b7f06bef72dfbd9d385662896aaecb5ef6c41e;hb=bf2bf43c980b18a26b724d2a2d51dddc1a79a185;hp=57150c39777d1535d414adb7999912cd3aed54fd;hpb=d355ad106f73e0de0abc3fb3f375af4eaf352591;p=jalview.git diff --git a/src/jalview/appletgui/OverviewPanel.java b/src/jalview/appletgui/OverviewPanel.java index 57150c3..a4b7f06 100755 --- a/src/jalview/appletgui/OverviewPanel.java +++ b/src/jalview/appletgui/OverviewPanel.java @@ -57,8 +57,9 @@ public class OverviewPanel sr = new SequenceRenderer(av); sr.graphics = nullFrame.getGraphics(); sr.renderGaps( false ); + sr.forOverview = true; fr = new FeatureRenderer(av); - fr.drawText = false; + fr.overview = true; @@ -184,8 +185,10 @@ public class OverviewPanel } if (av.showSequenceFeatures) - fr.featuresDisplayed = ap.seqPanel.seqCanvas.getFeatureRenderer().featuresDisplayed; - + { + fr.featureGroups = ap.seqPanel.seqCanvas.getFeatureRenderer().featureGroups; + fr.featureColours = ap.seqPanel.seqCanvas.getFeatureRenderer().featureColours; + } resizing = true; @@ -212,6 +215,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; @@ -232,50 +243,78 @@ public class OverviewPanel float sampleCol = (float) alwidth / (float) width; float sampleRow = (float) alheight / (float) sequencesHeight; - int lastcol=-1, lastrow=-1; + int lastcol=0, lastseq=0; + int xstart=0, ystart=0; Color color = Color.yellow; - int row, col; - for (col = 0; col < width; col++) + int col, sameRow = 0, sameCol = 0; + jalview.datamodel.SequenceI sequence; + + for (int row = 0; row <= sequencesHeight; row++) { - for (row = 0; row < sequencesHeight; row++) + if((int)(row*sampleRow)==lastseq) { - if((int)(col*sampleCol) == lastcol && (int)(row*sampleRow)==lastrow) - { - mg.drawLine(col, row, col, row); - continue; - } + sameRow ++; + continue; + } - if (av.conservation != null) + sequence = av.getAlignment().getSequenceAt(lastseq); + + for (col = 0; col < width; col++) + { + if((int)(col*sampleCol) == lastcol) { - mg.translate(col, sequencesHeight); - ap.annotationPanel.drawGraph(mg, av.conservation, - (int) (sampleCol) + 1, - graphHeight, - (int) (col * sampleCol), - (int) (col * sampleCol) + 1); - mg.translate( -col, -sequencesHeight); + sameCol ++; + continue; } - lastrow = (int)(row*sampleRow); lastcol = (int)(col*sampleCol); - if(av.alignment.getSequenceAt(lastrow).getLength()>lastcol) + if(sequence.getLength()>lastcol) { - color = sr.findSequenceColour(av.alignment.getSequenceAt(lastrow), lastcol); - + color = sr.findSequenceColour(sequence, lastcol); if (av.showSequenceFeatures) color = fr.findFeatureColour(color, - av.alignment.getSequenceAt(lastrow), - lastcol); + sequence, + lastcol); } + else + 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) + { + for (col = 0; col < width; col++) + { + lastcol = (int) (col * sampleCol); + { + mg.translate(col, sequencesHeight); + ap.annotationPanel.drawGraph(mg, av.conservation, + (int) (sampleCol) + 1, + graphHeight, + (int) (col * sampleCol), + (int) (col * sampleCol) + 1); + mg.translate( -col, -sequencesHeight); + } + } + } + + System.gc();