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.
21 package jalview.viewmodel;
23 import jalview.datamodel.AlignmentI;
26 * Supplies and updates viewport properties relating to position such as: start
27 * and end residues and sequences
29 public class ViewportPositionProps extends ViewportProperties
31 // start residue of viewport
34 // end residue of viewport
37 // start sequence of viewport
40 // end sequence of viewport
44 private AlignmentI al;
50 * the viewport's alignment
52 public ViewportPositionProps(AlignmentI alignment)
54 // initial values of viewport settings
56 this.endRes = alignment.getWidth() - 1;
58 this.endSeq = alignment.getHeight() - 1;
62 // ways to update values
64 // ways to notify of changes
66 // ways to supply positional information
69 * Get alignment width in cols, including hidden cols
71 public int getAbsoluteAlignmentWidth()
77 * Get alignment height in rows, including hidden rows
79 public int getAbsoluteAlignmentHeight()
81 return al.getHeight() + al.getHiddenSequences().getSize();
85 * Set first residue visible in the viewport
90 public void setStartRes(int res)
92 if (res > al.getWidth() - 1)
94 res = al.getWidth() - 1;
104 * Set last residue visible in the viewport
109 public void setEndRes(int res)
111 if (res >= al.getWidth())
113 res = al.getWidth() - 1;
123 * Set the first sequence visible in the viewport
128 public void setStartSeq(int seq)
130 if (seq > al.getHeight() - 1)
132 seq = al.getHeight() - 1;
142 * Set the last sequence visible in the viewport
147 public void setEndSeq(int seq)
149 if (seq >= al.getHeight())
151 seq = al.getHeight() - 1;
161 * Get start residue of viewport
163 public int getStartRes()
169 * Get end residue of viewport
171 public int getEndRes()
177 * Get start sequence of viewport
179 public int getStartSeq()
185 * Get end sequence of viewport
187 public int getEndSeq()