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.HiddenColumns; |
27 |
|
import jalview.datamodel.HiddenSequences; |
28 |
|
import jalview.datamodel.VisibleColsCollection; |
29 |
|
import jalview.datamodel.VisibleRowsCollection; |
30 |
|
|
|
|
| 91.5% |
Uncovered Elements: 6 (71) |
Complexity: 18 |
Complexity Density: 0.39 |
|
31 |
|
public class OverviewDimensionsHideHidden extends OverviewDimensions |
32 |
|
{ |
33 |
|
private ViewportRanges ranges; |
34 |
|
|
35 |
|
private int xdiff; |
36 |
|
|
37 |
|
|
38 |
|
private int ydiff; |
39 |
|
|
40 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
41 |
59 |
public OverviewDimensionsHideHidden(ViewportRanges vpranges,... |
42 |
|
boolean showAnnotationPanel) |
43 |
|
{ |
44 |
59 |
super(vpranges, showAnnotationPanel); |
45 |
59 |
ranges = vpranges; |
46 |
59 |
resetAlignmentDims(); |
47 |
|
} |
48 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
49 |
56 |
@Override... |
50 |
|
public void updateViewportFromMouse(int mousex, int mousey, |
51 |
|
HiddenSequences hiddenSeqs, HiddenColumns hiddenCols) |
52 |
|
{ |
53 |
56 |
resetAlignmentDims(); |
54 |
|
|
55 |
56 |
int xAsRes = getLeftXFromCentreX(mousex, hiddenCols); |
56 |
56 |
int yAsSeq = getTopYFromCentreY(mousey, hiddenSeqs); |
57 |
|
|
58 |
56 |
updateViewportFromTopLeft(xAsRes, yAsSeq, hiddenSeqs, hiddenCols); |
59 |
|
|
60 |
|
} |
61 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
62 |
3 |
@Override... |
63 |
|
public void adjustViewportFromMouse(int mousex, int mousey, |
64 |
|
HiddenSequences hiddenSeqs, HiddenColumns hiddenCols) |
65 |
|
{ |
66 |
3 |
resetAlignmentDims(); |
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
|
71 |
3 |
int vpx = Math.round(mousex * widthRatio); |
72 |
3 |
int vpy = Math.round(mousey * heightRatio); |
73 |
|
|
74 |
3 |
updateViewportFromTopLeft(vpx + xdiff, vpy + ydiff, hiddenSeqs, |
75 |
|
hiddenCols); |
76 |
|
|
77 |
|
} |
78 |
|
|
79 |
|
|
80 |
|
@inheritDoc |
81 |
|
|
82 |
|
|
|
|
| 81.8% |
Uncovered Elements: 6 (33) |
Complexity: 8 |
Complexity Density: 0.42 |
|
83 |
59 |
@Override... |
84 |
|
protected void updateViewportFromTopLeft(int leftx, int topy, |
85 |
|
HiddenSequences hiddenSeqs, HiddenColumns hiddenCols) |
86 |
|
{ |
87 |
59 |
int xAsRes = leftx; |
88 |
59 |
int yAsSeq = topy; |
89 |
|
|
90 |
59 |
if (xAsRes < 0) |
91 |
|
{ |
92 |
37 |
xAsRes = 0; |
93 |
|
} |
94 |
|
|
95 |
59 |
if (yAsSeq < 0) |
96 |
|
{ |
97 |
31 |
yAsSeq = 0; |
98 |
|
} |
99 |
|
|
100 |
59 |
if (ranges.isWrappedMode()) |
101 |
|
{ |
102 |
0 |
yAsSeq = 0; |
103 |
|
} |
104 |
|
|
105 |
|
|
106 |
59 |
int vpwidth = ranges.getViewportWidth(); |
107 |
|
|
108 |
59 |
if (xAsRes + vpwidth > alwidth) |
109 |
|
{ |
110 |
|
|
111 |
|
|
112 |
|
|
113 |
5 |
if (ranges.getStartRes() < alwidth) |
114 |
|
{ |
115 |
5 |
xAsRes = alwidth - vpwidth; |
116 |
|
} |
117 |
|
else |
118 |
|
{ |
119 |
0 |
xAsRes = ranges.getStartRes(); |
120 |
|
} |
121 |
|
} |
122 |
|
|
123 |
|
|
124 |
|
|
125 |
|
|
126 |
|
|
127 |
59 |
int vpheight = ranges.getViewportHeight(); |
128 |
|
|
129 |
59 |
if (yAsSeq + vpheight > alheight) |
130 |
|
{ |
131 |
|
|
132 |
2 |
if (ranges.getEndSeq() < alheight) |
133 |
|
{ |
134 |
2 |
yAsSeq = alheight - vpheight; |
135 |
|
} |
136 |
|
else |
137 |
|
{ |
138 |
0 |
yAsSeq = ranges.getStartSeq(); |
139 |
|
} |
140 |
|
} |
141 |
|
|
142 |
59 |
ranges.setStartResAndSeq(xAsRes, yAsSeq); |
143 |
|
} |
144 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
145 |
315 |
@Override... |
146 |
|
public void setBoxPosition(HiddenSequences hiddenSeqs, |
147 |
|
HiddenColumns hiddenCols) |
148 |
|
{ |
149 |
315 |
setBoxPosition(ranges.getStartRes(), ranges.getStartSeq(), |
150 |
|
ranges.getViewportWidth(), ranges.getViewportHeight()); |
151 |
|
} |
152 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
153 |
514 |
@Override... |
154 |
|
public AlignmentColsCollectionI getColumns(AlignmentI al) |
155 |
|
{ |
156 |
514 |
return new VisibleColsCollection(0, |
157 |
|
ranges.getAbsoluteAlignmentWidth() - 1, al.getHiddenColumns()); |
158 |
|
} |
159 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
160 |
259 |
@Override... |
161 |
|
public AlignmentRowsCollectionI getRows(AlignmentI al) |
162 |
|
{ |
163 |
259 |
return new VisibleRowsCollection(0, |
164 |
|
ranges.getAbsoluteAlignmentHeight() - 1, al); |
165 |
|
} |
166 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
167 |
954 |
@Override... |
168 |
|
protected void resetAlignmentDims() |
169 |
|
{ |
170 |
954 |
alwidth = ranges.getVisibleAlignmentWidth(); |
171 |
954 |
alheight = ranges.getVisibleAlignmentHeight(); |
172 |
|
|
173 |
954 |
widthRatio = (float) alwidth / width; |
174 |
954 |
heightRatio = (float) alheight / sequencesHeight; |
175 |
|
} |
176 |
|
|
177 |
|
|
178 |
|
@inheritDoc |
179 |
|
|
180 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
181 |
56 |
@Override... |
182 |
|
protected int getLeftXFromCentreX(int mousex, HiddenColumns hidden) |
183 |
|
{ |
184 |
56 |
int vpx = Math.round(mousex * widthRatio); |
185 |
56 |
return vpx - ranges.getViewportWidth() / 2; |
186 |
|
} |
187 |
|
|
188 |
|
|
189 |
|
@inheritDoc |
190 |
|
|
191 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
192 |
56 |
@Override... |
193 |
|
protected int getTopYFromCentreY(int mousey, HiddenSequences hidden) |
194 |
|
{ |
195 |
56 |
int vpy = Math.round(mousey * heightRatio); |
196 |
56 |
return vpy - ranges.getViewportHeight() / 2; |
197 |
|
} |
198 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
199 |
3 |
@Override... |
200 |
|
public void setDragPoint(int x, int y, HiddenSequences hiddenSeqs, |
201 |
|
HiddenColumns hiddenCols) |
202 |
|
{ |
203 |
3 |
resetAlignmentDims(); |
204 |
|
|
205 |
|
|
206 |
|
|
207 |
3 |
int vpx = Math.round(x * widthRatio); |
208 |
3 |
int vpy = Math.round(y * heightRatio); |
209 |
|
|
210 |
3 |
xdiff = ranges.getStartRes() - vpx; |
211 |
3 |
ydiff = ranges.getStartSeq() - vpy; |
212 |
|
} |
213 |
|
|
214 |
|
} |