X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FOverviewPanel.java;h=7ffac1e9da0eab40d69def91c86ddd147cc832ae;hb=9807ea8cc4e867378c52d51b832168d4bc611d29;hp=635e4550591766e076fb979312246ccb701981fe;hpb=2ffe2deedb1527c067060646055bddd18d41d367;p=jalview.git diff --git a/src/jalview/gui/OverviewPanel.java b/src/jalview/gui/OverviewPanel.java index 635e455..7ffac1e 100755 --- a/src/jalview/gui/OverviewPanel.java +++ b/src/jalview/gui/OverviewPanel.java @@ -49,7 +49,8 @@ public class OverviewPanel extends JPanel implements Runnable // Can set different properties in this seqCanvas than // main visible SeqCanvas - SeqCanvas overviewSeq; + SequenceRenderer sr; + FeatureRenderer fr; /** * Creates a new OverviewPanel object. @@ -62,14 +63,17 @@ public class OverviewPanel extends JPanel implements Runnable this.ap = ap; setLayout(null); - overviewSeq = new SeqCanvas(av); - overviewSeq.isOverview = true; - overviewSeq.sr.renderGaps = false; + sr = new SequenceRenderer(av); + sr.renderGaps( false ); + sr.forOverview = true; + fr = new FeatureRenderer(av); + fr.overview = true; + // scale the initial size of overviewpanel to shape of alignment float initialScale = (float) av.alignment.getWidth() / (float) av.alignment.getHeight(); - if(av.vconsensus==null) + if(av.conservation==null) graphHeight = 0; @@ -241,6 +245,14 @@ public class OverviewPanel extends JPanel implements Runnable { miniMe = null; + if (av.showSequenceFeatures) + { + fr.featureGroups = ap.seqPanel.seqCanvas.getFeatureRenderer().featureGroups; + fr.featureColours = ap.seqPanel.seqCanvas.getFeatureRenderer().featureColours; + fr.transparency = ap.seqPanel.seqCanvas.getFeatureRenderer().transparency; + fr.sequenceFeatures = ap.seqPanel.seqCanvas.getFeatureRenderer().sequenceFeatures; + } + int alwidth = av.alignment.getWidth(); int alheight = av.alignment.getHeight(); @@ -257,36 +269,64 @@ public class OverviewPanel extends JPanel implements Runnable Graphics mg = miniMe.getGraphics(); + mg.setColor(Color.orange); + mg.fillRect(0,0,width, miniMe.getHeight()); float sampleCol = (float) alwidth / (float) width; float sampleRow = (float) alheight / (float) sequencesHeight; - for (int col = 0; col < width; col++) + int lastcol=-1, lastrow=-1; + int color = Color.white.getRGB(); + int row, col; + for (row = 0; row < sequencesHeight; row++) + { + for (col = 0; col < width; col++) + { + if((int)(col*sampleCol) == lastcol && (int)(row*sampleRow)==lastrow) + { + miniMe.setRGB(col,row,color); + continue; + } + + lastrow = (int)(row*sampleRow); + lastcol = (int)(col*sampleCol); + + if(av.alignment.getSequenceAt(lastrow).getLength()>lastcol) + { + color = sr.getResidueBoxColour( + av.alignment.getSequenceAt(lastrow), lastcol).getRGB(); + + if(av.showSequenceFeatures) + color = fr.findFeatureColour(color, lastrow, lastcol); + + } + else + { + color = -1; //White + } + + miniMe.setRGB(col,row,color); + + + } + } + + if (av.conservation != null) { - for (int row = 0; row < sequencesHeight; row++) + for (col = 0; col < width; col++) { - overviewSeq.drawPanel(mg, - (int) (col * sampleCol), - (int) (col * sampleCol), - (int) (row * sampleRow), - (int) (row * sampleRow) + 1, - (int) (col * sampleCol), - (int) (row * sampleRow), 0); - mg.translate(0, 1); - - if (av.conservation != null) + 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); + } } - mg.translate(0, -sequencesHeight); - mg.translate(1, 0); - } - System.gc(); resizing = false;