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.
23 import jalview.datamodel.SequenceFeature;
24 import jalview.datamodel.SequenceI;
26 import java.awt.Color;
27 import java.awt.Graphics;
28 import java.util.List;
32 * Abstract feature renderer interface
37 public interface FeatureRenderer
41 * Computes the feature colour for a given sequence and column position,
42 * taking into account sequence feature locations, feature colour schemes,
43 * render ordering, feature and feature group visibility, and transparency.
45 * The graphics argument should be provided if transparency is applied
46 * (getTransparency() < 1). With feature transparency, visible features are
47 * written to the graphics context and the composite colour may be read off
48 * from it. In this case, the returned feature colour is not the composite
49 * colour but that of the last feature drawn.
51 * If no transparency applies, then the graphics argument may be null, and the
52 * returned colour is the one that would be drawn for the feature.
54 * Returns null if there is no visible feature at the position.
56 * This is provided to support rendering of feature colours other than on the
57 * sequence alignment, including by structure viewers and the overview window.
58 * Note this method takes no account of whether the sequence or column is
66 Color findFeatureColour(SequenceI sequence, int column, Graphics g);
69 * trigger the feature discovery process for a newly created feature renderer.
76 * @return display style for a feature
78 FeatureColourI getFeatureStyle(String ft);
81 * update the feature style for a particular feature
86 void setColour(String ft, FeatureColourI ggc);
88 AlignViewportI getViewport();
92 * @return container managing list of feature types and their visibility
94 FeaturesDisplayedI getFeaturesDisplayed();
97 * get display style for all features types - visible or invisible
101 Map<String, FeatureColourI> getFeatureColours();
104 * query the alignment view to find all features
106 * @param newMadeVisible
107 * - when true, automatically make newly discovered types visible
109 void findAllFeatures(boolean newMadeVisible);
112 * get display style for all features types currently visible
116 Map<String, FeatureColourI> getDisplayedFeatureCols();
119 * get all registered groups
123 List<String> getFeatureGroups();
126 * get groups that are visible/invisible
131 List<String> getGroups(boolean visible);
134 * change visibility for a range of groups
139 void setGroupVisibility(List<String> toset, boolean visible);
142 * change visibiilty of given group
147 void setGroupVisibility(String group, boolean visible);
150 * Returns features at the specified position on the given sequence.
151 * Non-positional features are not included.
157 List<SequenceFeature> findFeaturesAtRes(SequenceI sequence, int res);
160 * get current displayed types, in ordering of rendering (on top last)
162 * @return a (possibly empty) list of feature types
165 List<String> getDisplayedFeatureTypes();
168 * get current displayed groups
170 * @return a (possibly empty) list of feature groups
172 List<String> getDisplayedFeatureGroups();
175 * display all features of these types
177 * @param featureTypes
179 void setAllVisible(List<String> featureTypes);
182 * display featureType
186 void setVisible(String featureType);
189 * Sets the transparency value, between 0 (full transparency) and 1 (no
194 void setTransparency(float value);
197 * Returns the transparency value, between 0 (full transparency) and 1 (no
202 float getTransparency();