2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.renderer;
23 import jalview.datamodel.SequenceGroup;
24 import jalview.datamodel.SequenceI;
25 import jalview.util.Comparison;
27 import java.awt.Color;
29 public class OverviewResColourFinder extends ResidueColourFinder
31 final Color GAP_COLOUR;
33 final Color RESIDUE_COLOUR;
35 final Color HIDDEN_COLOUR;
37 boolean useLegacy = false;
39 public OverviewResColourFinder()
41 GAP_COLOUR = new Color(240, 240, 240);
42 RESIDUE_COLOUR = Color.white;
43 HIDDEN_COLOUR = Color.DARK_GRAY.darker();
46 public OverviewResColourFinder(boolean useLegacyColouring, Color gapCol,
49 if (useLegacyColouring)
51 GAP_COLOUR = Color.white;
52 RESIDUE_COLOUR = new Color(240, 240, 240);
53 HIDDEN_COLOUR = hiddenCol;
58 RESIDUE_COLOUR = Color.white;
59 HIDDEN_COLOUR = hiddenCol;
64 public Color getBoxColour(ResidueShaderI shader, SequenceI seq, int i)
66 Color resBoxColour = RESIDUE_COLOUR;
67 char currentChar = seq.getCharAt(i);
69 // In the overview window, gaps are coloured grey, unless the colour scheme
70 // specifies a gap colour, in which case gaps honour the colour scheme
72 if (shader.getColourScheme() != null)
74 if (!shader.getColourScheme().hasGapColour()
75 && Comparison.isGap(currentChar))
77 resBoxColour = GAP_COLOUR;
81 resBoxColour = shader.findColour(currentChar, i, seq);
84 else if (Comparison.isGap(currentChar))
86 resBoxColour = GAP_COLOUR;
93 * {@inheritDoc} In the overview, the showBoxes setting is ignored, as the
94 * overview displays the colours regardless.
97 protected Color getResidueBoxColour(boolean showBoxes,
98 ResidueShaderI shader,
99 SequenceGroup[] allGroups, SequenceI seq, int i)
101 ResidueShaderI currentShader;
102 SequenceGroup currentSequenceGroup = getCurrentSequenceGroup(allGroups,
104 if (currentSequenceGroup != null)
106 currentShader = currentSequenceGroup.getGroupColourScheme();
110 currentShader = shader;
113 return getBoxColour(currentShader, seq, i);
116 protected Color getHiddenColour()
118 return HIDDEN_COLOUR;