8635505945a1a73dd2145920f9a154eebb3842eb
[jalview.git] / src / jalview / datamodel / AlignmentAnnotation.java
1 package jalview.datamodel;\r
2 \r
3 public class AlignmentAnnotation\r
4 {\r
5   public String label;\r
6   public String description;\r
7   public Annotation  [] annotations;\r
8   public boolean isGraph = false;\r
9   public float graphMin, graphMax;\r
10   public int windowLength;\r
11 \r
12   // Graphical hints and tips\r
13   public boolean editable = false;\r
14   public boolean hasIcons; //\r
15   public boolean hasText;\r
16   public boolean visible = true;\r
17   public int height=0;\r
18 \r
19   public AlignmentAnnotation(String label, String description, Annotation [] annotations)\r
20   {\r
21     // always editable?\r
22     editable = true;\r
23     this.label = label;\r
24     this.description = description;\r
25     this.annotations = annotations;\r
26     for(int i=0; i<annotations.length; i++)\r
27     {\r
28       if (annotations[i]!=null &&(\r
29           annotations[i].secondaryStructure == 'H' ||\r
30           annotations[i].secondaryStructure == 'E'))\r
31         hasIcons = true;\r
32 \r
33       if (annotations[i]!=null && annotations[i].displayCharacter.length()>0)\r
34         hasText = true;\r
35     }\r
36   }\r
37 \r
38   public AlignmentAnnotation(String label, String description, Annotation [] annotations, float min, float max, int winLength)\r
39   {\r
40     // graphs are not editable\r
41     this.label = label;\r
42     this.description = description;\r
43     this.annotations = annotations;\r
44     isGraph = true;\r
45     if(min==max)\r
46     {\r
47       for(int i=0; i<annotations.length; i++)\r
48       {\r
49         if(annotations[i]==null)\r
50           continue;\r
51         if(annotations[i].value>max)\r
52           max = annotations[i].value;\r
53         if(annotations[i].value<min)\r
54           min = annotations[i].value;\r
55       }\r
56 \r
57 \r
58     }\r
59 \r
60     graphMin = min;\r
61     graphMax = max;\r
62     windowLength = winLength;\r
63     for(int i=0; i<annotations.length; i++)\r
64     {\r
65       if (annotations[i]!=null &&(\r
66           annotations[i].secondaryStructure == 'H' ||\r
67           annotations[i].secondaryStructure == 'E'))\r
68         hasIcons = true;\r
69 \r
70       if (annotations[i]!=null && annotations[i].displayCharacter.length()>0)\r
71         hasText = true;\r
72     }\r
73 \r
74 \r
75   }\r
76 \r
77 }\r