1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.viewmodel; |
22 |
|
|
23 |
|
import jalview.api.AlignmentColsCollectionI; |
24 |
|
import jalview.api.AlignmentRowsCollectionI; |
25 |
|
import jalview.datamodel.AlignmentI; |
26 |
|
import jalview.datamodel.AllColsCollection; |
27 |
|
import jalview.datamodel.AllRowsCollection; |
28 |
|
import jalview.datamodel.HiddenColumns; |
29 |
|
import jalview.datamodel.HiddenSequences; |
30 |
|
|
|
|
| 22.6% |
Uncovered Elements: 65 (84) |
Complexity: 18 |
Complexity Density: 0.31 |
|
31 |
|
public class OverviewDimensionsShowHidden extends OverviewDimensions |
32 |
|
{ |
33 |
|
private ViewportRanges ranges; |
34 |
|
|
35 |
|
private int xdiff; |
36 |
|
|
37 |
|
|
38 |
|
private int ydiff; |
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
@param |
45 |
|
|
46 |
|
@param |
47 |
|
|
48 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
49 |
2 |
public OverviewDimensionsShowHidden(ViewportRanges vpranges,... |
50 |
|
boolean showAnnotationPanel) |
51 |
|
{ |
52 |
2 |
super(vpranges, showAnnotationPanel); |
53 |
2 |
ranges = vpranges; |
54 |
2 |
resetAlignmentDims(); |
55 |
|
} |
56 |
|
|
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
@param |
61 |
|
|
62 |
|
@param |
63 |
|
|
64 |
|
@param |
65 |
|
|
66 |
|
@param |
67 |
|
|
68 |
|
@param |
69 |
|
|
70 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 1 |
Complexity Density: 0.11 |
|
71 |
0 |
@Override... |
72 |
|
public void updateViewportFromMouse(int mousex, int mousey, |
73 |
|
HiddenSequences hiddenSeqs, HiddenColumns hiddenCols) |
74 |
|
{ |
75 |
0 |
resetAlignmentDims(); |
76 |
|
|
77 |
|
|
78 |
|
|
79 |
0 |
int xAsRes = getLeftXFromCentreX(mousex, hiddenCols); |
80 |
0 |
int yAsSeq = getTopYFromCentreY(mousey, hiddenSeqs); |
81 |
|
|
82 |
|
|
83 |
0 |
int visXAsRes = hiddenCols.absoluteToVisibleColumn(xAsRes); |
84 |
0 |
yAsSeq = hiddenSeqs.adjustForHiddenSeqs( |
85 |
|
hiddenSeqs.findIndexWithoutHiddenSeqs(yAsSeq)); |
86 |
0 |
yAsSeq = Math.max(yAsSeq, 0); |
87 |
0 |
int visYAsSeq = hiddenSeqs.findIndexWithoutHiddenSeqs(yAsSeq); |
88 |
0 |
visYAsSeq = Math.max(visYAsSeq, 0); |
89 |
|
|
90 |
|
|
91 |
0 |
updateViewportFromTopLeft(visXAsRes, visYAsSeq, hiddenSeqs, hiddenCols); |
92 |
|
} |
93 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
94 |
0 |
@Override... |
95 |
|
public void adjustViewportFromMouse(int mousex, int mousey, |
96 |
|
HiddenSequences hiddenSeqs, HiddenColumns hiddenCols) |
97 |
|
{ |
98 |
0 |
resetAlignmentDims(); |
99 |
|
|
100 |
|
|
101 |
|
|
102 |
|
|
103 |
|
|
104 |
0 |
int vpx = Math.round((float) mousex * alwidth / width); |
105 |
0 |
int visXAsRes = hiddenCols.absoluteToVisibleColumn(vpx) + xdiff; |
106 |
|
|
107 |
0 |
int vpy = Math.round(mousey * heightRatio); |
108 |
0 |
int visYAsRes = hiddenSeqs.findIndexWithoutHiddenSeqs(vpy) + ydiff; |
109 |
|
|
110 |
|
|
111 |
0 |
updateViewportFromTopLeft(visXAsRes, visYAsRes, hiddenSeqs, hiddenCols); |
112 |
|
} |
113 |
|
|
114 |
|
|
115 |
|
@inheritDoc |
116 |
|
|
117 |
|
|
|
|
| 0% |
Uncovered Elements: 35 (35) |
Complexity: 8 |
Complexity Density: 0.38 |
|
118 |
0 |
@Override... |
119 |
|
protected void updateViewportFromTopLeft(int leftx, int topy, |
120 |
|
HiddenSequences hiddenSeqs, HiddenColumns hiddenCols) |
121 |
|
{ |
122 |
0 |
int visXAsRes = leftx; |
123 |
0 |
int visYAsSeq = topy; |
124 |
|
|
125 |
0 |
if (visXAsRes < 0) |
126 |
|
{ |
127 |
0 |
visXAsRes = 0; |
128 |
|
} |
129 |
|
|
130 |
0 |
if (visYAsSeq < 0) |
131 |
|
{ |
132 |
0 |
visYAsSeq = 0; |
133 |
|
} |
134 |
|
|
135 |
0 |
if (ranges.isWrappedMode()) |
136 |
|
{ |
137 |
0 |
visYAsSeq = 0; |
138 |
|
} |
139 |
|
|
140 |
|
|
141 |
|
|
142 |
|
|
143 |
0 |
int vpwidth = ranges.getViewportWidth(); |
144 |
|
|
145 |
|
|
146 |
0 |
int visAlignWidth = hiddenCols.absoluteToVisibleColumn(alwidth - 1); |
147 |
0 |
if (visXAsRes + vpwidth - 1 > visAlignWidth) |
148 |
|
{ |
149 |
|
|
150 |
|
|
151 |
|
|
152 |
0 |
if (ranges.getEndRes() < visAlignWidth) |
153 |
|
{ |
154 |
0 |
visXAsRes = hiddenCols.absoluteToVisibleColumn(hiddenCols |
155 |
|
.offsetByVisibleColumns(-(vpwidth - 1), alwidth - 1)); |
156 |
|
} |
157 |
|
else |
158 |
|
{ |
159 |
0 |
visXAsRes = ranges.getStartRes(); |
160 |
|
} |
161 |
|
} |
162 |
|
|
163 |
|
|
164 |
|
|
165 |
|
|
166 |
0 |
int vpheight = ranges.getViewportHeight(); |
167 |
|
|
168 |
|
|
169 |
0 |
int visAlignHeight = hiddenSeqs.findIndexWithoutHiddenSeqs(alheight); |
170 |
|
|
171 |
0 |
if (visYAsSeq + vpheight - 1 > visAlignHeight) |
172 |
|
{ |
173 |
|
|
174 |
0 |
if (ranges.getEndSeq() < visAlignHeight) |
175 |
|
{ |
176 |
0 |
visYAsSeq = hiddenSeqs.findIndexWithoutHiddenSeqs( |
177 |
|
hiddenSeqs.subtractVisibleRows(vpheight - 1, alheight - 1)); |
178 |
|
} |
179 |
|
else |
180 |
|
{ |
181 |
0 |
visYAsSeq = ranges.getStartSeq(); |
182 |
|
} |
183 |
|
} |
184 |
|
|
185 |
|
|
186 |
0 |
ranges.setStartResAndSeq(visXAsRes, visYAsSeq); |
187 |
|
} |
188 |
|
|
189 |
|
|
190 |
|
|
191 |
|
|
192 |
|
|
193 |
|
@param |
194 |
|
|
195 |
|
@param |
196 |
|
|
197 |
|
@param |
198 |
|
|
199 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
200 |
6 |
@Override... |
201 |
|
public void setBoxPosition(HiddenSequences hiddenSeqs, |
202 |
|
HiddenColumns hiddenCols) |
203 |
|
{ |
204 |
|
|
205 |
6 |
int startRes = hiddenCols.visibleToAbsoluteColumn(ranges.getStartRes()); |
206 |
6 |
int endRes = hiddenCols.visibleToAbsoluteColumn(ranges.getEndRes()); |
207 |
|
|
208 |
|
|
209 |
6 |
int startSeq = hiddenSeqs.adjustForHiddenSeqs(ranges.getStartSeq()); |
210 |
6 |
int endSeq = hiddenSeqs.adjustForHiddenSeqs(ranges.getEndSeq()); |
211 |
|
|
212 |
6 |
setBoxPosition(startRes, startSeq, endRes - startRes + 1, |
213 |
|
endSeq - startSeq + 1); |
214 |
|
} |
215 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
216 |
10 |
@Override... |
217 |
|
public AlignmentColsCollectionI getColumns(AlignmentI al) |
218 |
|
{ |
219 |
10 |
return new AllColsCollection(0, ranges.getAbsoluteAlignmentWidth() - 1, |
220 |
|
al); |
221 |
|
} |
222 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
223 |
5 |
@Override... |
224 |
|
public AlignmentRowsCollectionI getRows(AlignmentI al) |
225 |
|
{ |
226 |
5 |
return new AllRowsCollection(0, ranges.getAbsoluteAlignmentHeight() - 1, |
227 |
|
al); |
228 |
|
} |
229 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
230 |
18 |
@Override... |
231 |
|
protected void resetAlignmentDims() |
232 |
|
{ |
233 |
18 |
alwidth = ranges.getAbsoluteAlignmentWidth(); |
234 |
18 |
alheight = ranges.getAbsoluteAlignmentHeight(); |
235 |
|
|
236 |
18 |
widthRatio = (float) alwidth / width; |
237 |
18 |
heightRatio = (float) alheight / sequencesHeight; |
238 |
|
} |
239 |
|
|
240 |
|
|
241 |
|
@inheritDoc |
242 |
|
|
243 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
244 |
0 |
@Override... |
245 |
|
protected int getLeftXFromCentreX(int mousex, HiddenColumns hidden) |
246 |
|
{ |
247 |
0 |
int vpx = Math.round((float) mousex * alwidth / width); |
248 |
0 |
return hidden.offsetByVisibleColumns(-ranges.getViewportWidth() / 2, |
249 |
|
vpx); |
250 |
|
} |
251 |
|
|
252 |
|
|
253 |
|
@inheritDoc |
254 |
|
|
255 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
256 |
0 |
@Override... |
257 |
|
protected int getTopYFromCentreY(int mousey, HiddenSequences hidden) |
258 |
|
{ |
259 |
0 |
int vpy = Math.round(mousey * heightRatio); |
260 |
0 |
return hidden.subtractVisibleRows(ranges.getViewportHeight() / 2, vpy); |
261 |
|
} |
262 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
263 |
0 |
@Override... |
264 |
|
public void setDragPoint(int x, int y, HiddenSequences hiddenSeqs, |
265 |
|
HiddenColumns hiddenCols) |
266 |
|
{ |
267 |
0 |
resetAlignmentDims(); |
268 |
|
|
269 |
|
|
270 |
|
|
271 |
0 |
int vpx = Math.round(x * widthRatio); |
272 |
0 |
int vpy = Math.round(y * heightRatio); |
273 |
|
|
274 |
0 |
xdiff = ranges.getStartRes() - hiddenCols.absoluteToVisibleColumn(vpx); |
275 |
0 |
ydiff = ranges.getStartSeq() |
276 |
|
- hiddenSeqs.findIndexWithoutHiddenSeqs(vpy); |
277 |
|
} |
278 |
|
|
279 |
|
} |