From 43a9f559bb49f579ce153c812052c149963a99de Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Mon, 28 Nov 2005 17:15:29 +0000 Subject: [PATCH] new Implementation for getting colour quickly --- src/jalview/gui/FeatureRenderer.java | 1 + src/jalview/gui/OverviewPanel.java | 2 +- src/jalview/gui/RotatableCanvas.java | 2 -- src/jalview/gui/SequenceRenderer.java | 46 +++++++++++---------------------- 4 files changed, 17 insertions(+), 34 deletions(-) diff --git a/src/jalview/gui/FeatureRenderer.java b/src/jalview/gui/FeatureRenderer.java index fa06d94..03080bd 100755 --- a/src/jalview/gui/FeatureRenderer.java +++ b/src/jalview/gui/FeatureRenderer.java @@ -73,6 +73,7 @@ public class FeatureRenderer bi.setRGB(0,0, initialCol.getRGB()); drawText = false; + drawSequence(bi.getGraphics(), seq, i, i, 0, 0, 1, 1); drawText = true; diff --git a/src/jalview/gui/OverviewPanel.java b/src/jalview/gui/OverviewPanel.java index 5391e78..3662ec2 100755 --- a/src/jalview/gui/OverviewPanel.java +++ b/src/jalview/gui/OverviewPanel.java @@ -281,7 +281,7 @@ public class OverviewPanel extends JPanel implements Runnable lastrow = (int)(row*sampleRow); lastcol = (int)(col*sampleCol); - color = sr.findSequenceColour(Color.white, + color = sr.getResidueBoxColour( av.alignment.getSequenceAt(lastrow), lastcol); if(av.showSequenceFeatures) diff --git a/src/jalview/gui/RotatableCanvas.java b/src/jalview/gui/RotatableCanvas.java index 632b284..fc72b4b 100755 --- a/src/jalview/gui/RotatableCanvas.java +++ b/src/jalview/gui/RotatableCanvas.java @@ -486,8 +486,6 @@ public class RotatableCanvas extends JPanel implements MouseListener, */ public void keyPressed(KeyEvent evt) { - requestFocus(); - if (evt.getKeyCode() == KeyEvent.VK_UP) { scalefactor = (float) (scalefactor * 1.1); diff --git a/src/jalview/gui/SequenceRenderer.java b/src/jalview/gui/SequenceRenderer.java index 460c6d1..0cc7952 100755 --- a/src/jalview/gui/SequenceRenderer.java +++ b/src/jalview/gui/SequenceRenderer.java @@ -62,40 +62,24 @@ public class SequenceRenderer renderGaps = b; } - /** - * DOCUMENT ME! - * - * @param cs DOCUMENT ME! - * @param seq DOCUMENT ME! - * @param i DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public Color getResidueBoxColour(ColourSchemeI cs, SequenceI seq, int i) - { - getBoxColour(cs, seq, i); - - return resBoxColour; - } - BufferedImage bi; - public Color findSequenceColour(Color initialCol, SequenceI seq, int i) + public Color getResidueBoxColour(SequenceI seq, int i) { - if (bi == null) - bi = new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB); - - graphics = bi.getGraphics(); - - if(initialCol!=null) - bi.setRGB(0,0, initialCol.getRGB()); - allGroups = av.alignment.findAllGroups(seq); - i = seq.findIndex(i); - - drawBoxes(seq, i,i, 0, 0, 1,1); + if (inCurrentSequenceGroup(i)) + { + if (currentSequenceGroup.getDisplayBoxes()) + { + getBoxColour(currentSequenceGroup.cs, seq, i); + } + } + else if (av.getShowBoxes()) + { + getBoxColour(av.globalColourScheme, seq, i); + } - return new Color(bi.getRGB(0, 0)); + return resBoxColour; } @@ -181,7 +165,7 @@ public class SequenceRenderer } else if (av.getShowBoxes()) { - getBoxColour(av.getGlobalColourScheme(), seq, i); + getBoxColour(av.globalColourScheme, seq, i); } } @@ -271,7 +255,7 @@ public class SequenceRenderer if (av.getColourText()) { - getBoxColour(av.getGlobalColourScheme(), seq, i); + getBoxColour(av.globalColourScheme, seq, i); if (av.getShowBoxes()) { -- 1.7.10.2