X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fapi%2FFeatureRenderer.java;h=edd236ba2f12ee549b9ca7854d77177920914905;hb=60e252f7e0084336b0a85620842ce3db8f63e5b0;hp=cf98b2f38d27ef62f69699200cbf597a570fea14;hpb=68336e073e9f5592ca856e82be5f37acbe6c0daa;p=jalview.git diff --git a/src/jalview/api/FeatureRenderer.java b/src/jalview/api/FeatureRenderer.java index cf98b2f..edd236b 100644 --- a/src/jalview/api/FeatureRenderer.java +++ b/src/jalview/api/FeatureRenderer.java @@ -24,6 +24,7 @@ import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; import java.awt.Color; +import java.awt.Graphics; import java.util.List; import java.util.Map; @@ -37,18 +38,32 @@ public interface FeatureRenderer { /** - * compute the perceived colour for a given column position in sequenceI, - * taking transparency and feature visibility into account. + * Computes the feature colour for a given sequence and column position, + * taking into account sequence feature locations, feature colour schemes, + * render ordering, feature and feature group visibility, and transparency. + *

+ * 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 + * from it. In this case, the returned feature colour is not the composite + * colour but that of the last feature drawn. + *

+ * If no transparency applies, then the graphics argument may be null, and the + * returned colour is the one that would be drawn for the feature. + *

+ * Returns null if there is no visible feature at the position. + *

+ * This is provided to support rendering of feature colours other than on the + * sequence alignment, including by structure viewers and the overview window. + * Note this method takes no account of whether the sequence or column is + * hidden. * - * @param col - * - background colour (due to alignment/group shading schemes, etc). - * @param sequenceI - * - sequence providing features - * @param r - * - column position + * @param sequence + * @param column + * @param g * @return */ - Color findFeatureColour(Color col, SequenceI sequenceI, int r); + Color findFeatureColour(SequenceI sequence, int column, Graphics g); /** * trigger the feature discovery process for a newly created feature renderer. @@ -60,17 +75,15 @@ public interface FeatureRenderer * @param ft * @return display style for a feature */ - Object getFeatureStyle(String ft); + FeatureColourI getFeatureStyle(String ft); /** * update the feature style for a particular feature * * @param ft * @param ggc - * - currently allows java.awt.Color and - * jalview.schemes.GraduatedColor */ - void setColour(String ft, Object ggc); + void setColour(String ft, FeatureColourI ggc); AlignViewportI getViewport(); @@ -85,7 +98,7 @@ public interface FeatureRenderer * * @return */ - Map getFeatureColours(); + Map getFeatureColours(); /** * query the alignment view to find all features @@ -100,7 +113,7 @@ public interface FeatureRenderer * * @return */ - Map getDisplayedFeatureCols(); + Map getDisplayedFeatureCols(); /** * get all registered groups @@ -134,7 +147,8 @@ public interface FeatureRenderer void setGroupVisibility(String group, boolean visible); /** - * locate features at a particular position on the given sequence + * Returns features at the specified position on the given sequence. + * Non-positional features are not included. * * @param sequence * @param res @@ -143,25 +157,19 @@ public interface FeatureRenderer List findFeaturesAtRes(SequenceI sequence, int res); /** + * get current displayed types, in ordering of rendering (on top last) * - * @return true if the rendering platform supports transparency + * @return a (possibly empty) list of feature types */ - boolean isTransparencyAvailable(); - /** - * get current displayed types - * - * @return - */ - - String[] getDisplayedFeatureTypes(); + List getDisplayedFeatureTypes(); /** - * get current displayed groups + * Returns a (possibly empty) list of currently visible feature groups * * @return */ - String[] getDisplayedFeatureGroups(); + List getDisplayedFeatureGroups(); /** * display all features of these types @@ -177,4 +185,19 @@ public interface FeatureRenderer */ void setVisible(String featureType); + /** + * Sets the transparency value, between 0 (full transparency) and 1 (no + * transparency) + * + * @param value + */ + void setTransparency(float value); + + /** + * Returns the transparency value, between 0 (full transparency) and 1 (no + * transparency) + * + * @return + */ + float getTransparency(); }