15e5f1d868b7c3074ca7fe09e5e99673ec35ce97
[jalview.git] / src / jalview / api / AlignViewportI.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
3  * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
4  * 
5  * This file is part of Jalview.
6  * 
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 of the License, or (at your option) any later version.
10  *  
11  * Jalview is distributed in the hope that it will be useful, but 
12  * WITHOUT ANY WARRANTY; without even the implied warranty 
13  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14  * PURPOSE.  See the GNU General Public License for more details.
15  * 
16  * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
17  */
18 package jalview.api;
19
20 import java.awt.Color;
21 import java.util.Hashtable;
22 import java.util.Map;
23
24 import jalview.datamodel.AlignmentAnnotation;
25 import jalview.datamodel.AlignmentI;
26 import jalview.datamodel.AlignmentView;
27 import jalview.datamodel.CigarArray;
28 import jalview.datamodel.ColumnSelection;
29 import jalview.datamodel.SequenceCollectionI;
30 import jalview.datamodel.SequenceGroup;
31 import jalview.datamodel.SequenceI;
32 import jalview.schemes.ColourSchemeI;
33
34 /**
35  * @author jimp
36  * 
37  */
38 public interface AlignViewportI
39 {
40
41   int getCharWidth();
42
43   int getEndRes();
44
45   int getCharHeight();
46
47   /**
48    * calculate the height for visible annotation, revalidating bounds where
49    * necessary ABSTRACT GUI METHOD
50    * 
51    * @return total height of annotation
52    */
53   public int calcPanelHeight();
54
55   boolean hasHiddenColumns();
56
57   boolean isValidCharWidth();
58
59   boolean isShowConsensusHistogram();
60
61   boolean isShowSequenceLogo();
62
63   boolean isNormaliseSequenceLogo();
64
65   ColourSchemeI getGlobalColourScheme();
66
67   AlignmentI getAlignment();
68
69   ColumnSelection getColumnSelection();
70
71   Hashtable[] getSequenceConsensusHash();
72
73   Hashtable[] getRnaStructureConsensusHash();
74
75   boolean getIgnoreGapsConsensus();
76
77   boolean getCentreColumnLabels();
78
79   boolean isCalculationInProgress(AlignmentAnnotation alignmentAnnotation);
80
81   AlignmentAnnotation getAlignmentQualityAnnot();
82
83   AlignmentAnnotation getAlignmentConservationAnnotation();
84
85   /**
86    * get the container for alignment consensus annotation
87    * 
88    * @return
89    */
90   AlignmentAnnotation getAlignmentConsensusAnnotation();
91
92   /**
93    * Test to see if viewport is still open and active
94    * 
95    * @return true indicates that all references to viewport should be dropped
96    */
97   boolean isClosed();
98
99   /**
100    * get the associated calculation thread manager for the view
101    * 
102    * @return
103    */
104   AlignCalcManagerI getCalcManager();
105
106   /**
107    * get the percentage gaps allowed in a conservation calculation
108    * 
109    */
110   public int getConsPercGaps();
111
112   /**
113    * set the consensus result object for the viewport
114    * 
115    * @param hconsensus
116    */
117   void setSequenceConsensusHash(Hashtable[] hconsensus);
118
119   /**
120    * 
121    * @return the alignment annotatino row for the structure consensus
122    *         calculation
123    */
124   AlignmentAnnotation getAlignmentStrucConsensusAnnotation();
125
126   /**
127    * set the Rna structure consensus result object for the viewport
128    * 
129    * @param hStrucConsensus
130    */
131   void setRnaStructureConsensusHash(Hashtable[] hStrucConsensus);
132
133   /**
134    * set global colourscheme
135    * 
136    * @param rhc
137    */
138   void setGlobalColourScheme(ColourSchemeI rhc);
139
140   Map<SequenceI, SequenceCollectionI> getHiddenRepSequences();
141
142   void setHiddenRepSequences(
143           Map<SequenceI, SequenceCollectionI> hiddenRepSequences);
144
145   /**
146    * hides or shows dynamic annotation rows based on groups and group and
147    * alignment associated auto-annotation state flags apply the current
148    * group/autoannotation settings to the alignment view. Usually you should
149    * call the AlignmentViewPanel.adjustAnnotationHeight() method afterwards to
150    * ensure the annotation panel bounds are set correctly.
151    * 
152    * @param applyGlobalSettings
153    *          - apply to all autoannotation rows or just the ones associated
154    *          with the current visible region
155    * @param preserveNewGroupSettings
156    *          - don't apply global settings to groups which don't already have
157    *          group associated annotation
158    */
159   void updateGroupAnnotationSettings(boolean applyGlobalSettings,
160           boolean preserveNewGroupSettings);
161
162
163   SequenceGroup getSelectionGroup();
164
165   SequenceI[] getSequenceSelection();
166
167
168   CigarArray getViewAsCigars(boolean selectedRegionOnly);
169
170   AlignmentView getAlignmentView(boolean selectedOnly);
171
172   AlignmentView getAlignmentView(boolean selectedOnly, boolean markGroups);
173
174   String[] getViewAsString(boolean selectedRegionOnly);
175
176   void setSelectionGroup(SequenceGroup sg);
177
178   char getGapCharacter();
179
180
181 }