X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fgui%2FFeatureRenderer.java;h=0553fef37f19fdbd6de5462fd3112e6b7d2fcf98;hb=bd53adc27eab07569b1944a7c33f31c41dad785f;hp=cd754c706a87aa38570ce6b9ebdd063b2ca6f0d2;hpb=1ecf6419aba86993b3c223bf5ec0fa79427baf85;p=jalview.git diff --git a/src/jalview/gui/FeatureRenderer.java b/src/jalview/gui/FeatureRenderer.java old mode 100755 new mode 100644 index cd754c7..0553fef --- a/src/jalview/gui/FeatureRenderer.java +++ b/src/jalview/gui/FeatureRenderer.java @@ -1,85 +1,54 @@ -package jalview.gui; - -import jalview.datamodel.*; -import jalview.schemes.*; -import java.awt.*; -import java.util.*; - -public class FeatureRenderer implements RendererI { - - - public Color getResidueBoxColour(ColourSchemeI cs, SequenceI seq, int i) { - Color c = cs.findColour(seq,seq.getSequence(i,i+1),i,null); - return c; - } - - public void drawSequence(Graphics g,ColourSchemeI cs,SequenceI seq,int start, int end, int x1, int y1, double width, int height,boolean showScores, boolean displayBoxes, boolean displayText,Vector pid, int seqnum,AlignViewport av) { - - int i = start; - int length = seq.getLength(); - - Color currentColor = Color.black; - - - int prev = -1; - int fstart = 0; - char prevc = '-'; - - g.setColor(Color.magenta); - - while (i <= end && i < length) { - char c = seq.getCharAt(i); - if (c != '-') { - - if (prevc != c) { - - if (prevc == 'F') { - g.setColor(Color.green); - } else if (prevc == 'R') { - g.setColor(Color.cyan); - } else if (prevc == 'M') { - g.setColor(Color.magenta); - } else if (prevc == 'P') { - g.setColor(Color.yellow); - } - g.fillRect(x1+(int)(width*(i-fstart)),y1+height/4,(int)((prev-fstart+1)*width),height/2); - - prevc = c; - fstart = i; - } - } else if (prevc != '-') { - if (prevc == 'F') { - g.setColor(Color.green); - } else if (prevc == 'R') { - g.setColor(Color.cyan); - } else if (prevc == 'M') { - g.setColor(Color.magenta); - } else if (prevc == 'P') { - g.setColor(Color.yellow); - } - g.fillRect(x1+(int)(width*(fstart-start)),y1+height/4,(int)((i-fstart+1)*width),height/2); - - prevc = c; - } else { - fstart = -1; - } - i++; - } - - if (fstart != -1) { - if (prevc == 'F') { - g.setColor(Color.green); - } else if (prevc == 'R') { - g.setColor(Color.cyan); - } else if (prevc == 'M') { - g.setColor(Color.magenta); - } else if (prevc == 'P') { - g.setColor(Color.yellow); - } - - //g.fillRect(x1+(int)(width*(fstart-start)),y1+height/4,(int)((end-fstart+1)*width),height/2); - - } - } - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ +package jalview.gui; + +import java.awt.Color; + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ +public class FeatureRenderer + extends jalview.renderer.seqfeatures.FeatureRenderer +{ + Color resBoxColour; + + AlignmentPanel ap; + + /** + * Creates a new FeatureRenderer object + * + * @param alignPanel + */ + public FeatureRenderer(AlignmentPanel alignPanel) + { + super(alignPanel.av); + this.ap = alignPanel; + if (alignPanel.getSeqPanel() != null + && alignPanel.getSeqPanel().seqCanvas != null + && alignPanel.getSeqPanel().seqCanvas.fr != null) + { + transferSettings(alignPanel.getSeqPanel().seqCanvas.fr); + } + } +}