* taking into account sequence feature locations, feature colour schemes,
* render ordering, feature and feature group visibility, and transparency.
* <p>
+ * Does not take into account global feature visibility (show features on or
+ * off). Test for this before calling this method if necessary. This allows,
+ * for example, feature colours to be computed for structures even if not
+ * shown on the alignment.
+ * <p>
* The graphics argument should be provided if transparency is applied
* (getTransparency() < 1). With feature transparency, visible features are
* written to the graphics context and the composite colour may be read off
AlignmentI alignment,
ResidueShaderI resshader, OverviewResColourFinder colFinder)
{
- finder = new FeatureColourFinder(fr);
+ finder = fr.getViewport().isShowSequenceFeatures() ?
+ new FeatureColourFinder(fr) : null;
resColFinder = colFinder;
al = alignment;
{
if (noFeaturesDisplayed())
{
- return defaultColour;
+ // return defaultColour;
}
Graphics g = null;
@Override
public Color findFeatureColour(SequenceI seq, int column, Graphics g)
{
- if (!av.isShowSequenceFeatures())
- {
- return null;
- }
-
// column is 'base 1' but getCharAt is an array index (ie from 0)
if (Comparison.isGap(seq.getCharAt(column - 1)))
{
seq.addSequenceFeature(new SequenceFeature("Metal", "Metal", 2, 12,
Float.NaN, "MetalGroup"));
fr.featuresAdded();
+ fr.setColour("Metal", new FeatureColour(Color.red));
+
+ /*
+ * global show features flag is _not_ checked by findFeatureColour
+ */
av.setShowSequenceFeatures(false);
Color c = finder.findFeatureColour(Color.blue, seq, 10);
- assertEquals(c, Color.blue);
+ assertEquals(c, Color.red);
}
@Test(groups = "Functional")