X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FAlignmentAnnotation.java;h=5a2c46e0b3e2be52032af8a67f02cfbefdde6cfc;hb=d6e1bbede5adc04f34c969213ac6a4c6d9e5d34a;hp=337d8797a398d125178535ac8f74f01f1dab3673;hpb=99c58ee0ae2a848f982552e53feaf6d5cb9925e5;p=jalview.git diff --git a/src/jalview/datamodel/AlignmentAnnotation.java b/src/jalview/datamodel/AlignmentAnnotation.java index 337d879..5a2c46e 100755 --- a/src/jalview/datamodel/AlignmentAnnotation.java +++ b/src/jalview/datamodel/AlignmentAnnotation.java @@ -16,107 +16,314 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.datamodel; + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ public class AlignmentAnnotation { - public String label; - public String description; - public Annotation [] annotations; - public boolean isGraph = false; - public float graphMin, graphMax; - public int windowLength; - - // Graphical hints and tips - public boolean editable = false; - public boolean hasIcons; // - public boolean hasText; - public boolean visible = true; - public int height=0; - - public AlignmentAnnotation(String label, String description, Annotation [] annotations) - { - // always editable? - editable = true; - this.label = label; - this.description = description; - this.annotations = annotations; - for(int i=0; i0) - hasText = true; + public int graphHeight = 40; + + public static final int NO_GRAPH = 0; + + public static final int BAR_GRAPH = 1; + + public static final int LINE_GRAPH = 2; + + public static int getGraphValueFromString(String string) + { + if(string.equalsIgnoreCase("BAR_GRAPH")) + return BAR_GRAPH; + else if(string.equalsIgnoreCase("LINE_GRAPH")) + return LINE_GRAPH; + else + return NO_GRAPH; } - } - - public AlignmentAnnotation(String label, String description, Annotation [] annotations, float min, float max, int winLength) - { - // graphs are not editable - this.label = label; - this.description = description; - this.annotations = annotations; - isGraph = true; - if(min==max) + + /** + * Creates a new AlignmentAnnotation object. + * + * @param label DOCUMENT ME! + * @param description DOCUMENT ME! + * @param annotations DOCUMENT ME! + */ + public AlignmentAnnotation(String label, String description, + Annotation[] annotations) { - for(int i=0; imax) - max = annotations[i].value; - if(annotations[i].value 0)) + { + hasText = true; + } + } } - graphMin = min; - graphMax = max; - windowLength = winLength; - for(int i=0; i 1 ) + { + drawValues = false; + } + + if (annotations[i].value > max) + { + max = annotations[i].value; + } + + if (annotations[i].value < min) + { + min = annotations[i].value; + } + } + } + + graphMin = min; + graphMax = max; + + for (int i = 0; i < annotations.length; i++) + { + if (!hasIcons + && annotations[i] != null + && ((annotations[i].secondaryStructure == 'H') || + (annotations[i].secondaryStructure == 'E'))) + { + hasIcons = true; + } + + if (!hasText + && annotations[i]!=null + && annotations[i].displayCharacter.length() > 0) + { + hasText = true; + } + } - if (annotations[i]!=null && annotations[i].displayCharacter.length()>0) - hasText = true; + if(!drawValues && graphType!=NO_GRAPH) + { + for (int i = 0; i < annotations.length; i++) + { + if (annotations[i] != null) + annotations[i].displayCharacter = ""; + } + } } - } - - public String toString() - { - StringBuffer buffer = new StringBuffer(); - for(int i=0; i sequenceRef.getStart()) + { + fileOffset = startRes - sequenceRef.getStart(); + } + + for(int i = 0; i < annotations.length; i++) + { + seqPos = sequenceRef.findPosition(i + fileOffset); + if(seqPos