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 * Embryonic class which: Supplies and updates viewport properties relating to
27 * position such as: start and end residues and sequences; ideally will serve
28 * hidden columns/rows too
30 public class ViewportRanges extends ViewportProperties
32 // start residue of viewport
35 // end residue of viewport
38 // start sequence of viewport
41 // end sequence of viewport
45 private AlignmentI al;
51 * the viewport's alignment
53 public ViewportRanges(AlignmentI alignment)
55 // initial values of viewport settings
57 this.endRes = alignment.getWidth() - 1;
59 this.endSeq = alignment.getHeight() - 1;
64 * Get alignment width in cols, including hidden cols
66 public int getAbsoluteAlignmentWidth()
72 * Get alignment height in rows, including hidden rows
74 public int getAbsoluteAlignmentHeight()
76 return al.getHeight() + al.getHiddenSequences().getSize();
80 * Set first residue visible in the viewport
85 public void setStartRes(int res)
87 if (res > al.getWidth() - 1)
89 res = al.getWidth() - 1;
99 * Set last residue visible in the viewport
104 public void setEndRes(int res)
106 if (res >= al.getWidth())
108 res = al.getWidth() - 1;
118 * Set the first sequence visible in the viewport
123 public void setStartSeq(int seq)
125 if (seq > al.getHeight() - 1)
127 seq = al.getHeight() - 1;
137 * Set the last sequence visible in the viewport
142 public void setEndSeq(int seq)
144 if (seq >= al.getHeight())
146 seq = al.getHeight() - 1;
156 * Get start residue of viewport
158 public int getStartRes()
164 * Get end residue of viewport
166 public int getEndRes()
172 * Get start sequence of viewport
174 public int getStartSeq()
180 * Get end sequence of viewport
182 public int getEndSeq()