1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.renderer; |
22 |
|
|
23 |
|
import java.awt.BasicStroke; |
24 |
|
import java.awt.Color; |
25 |
|
import java.awt.Font; |
26 |
|
import java.awt.FontMetrics; |
27 |
|
import java.awt.Graphics; |
28 |
|
import java.awt.Graphics2D; |
29 |
|
import java.awt.Image; |
30 |
|
import java.awt.RenderingHints; |
31 |
|
import java.awt.Stroke; |
32 |
|
import java.awt.geom.AffineTransform; |
33 |
|
import java.awt.image.ImageObserver; |
34 |
|
import java.util.BitSet; |
35 |
|
import java.util.Hashtable; |
36 |
|
|
37 |
|
import org.jfree.graphics2d.svg.SVGGraphics2D; |
38 |
|
import org.jibble.epsgraphics.EpsGraphics2D; |
39 |
|
|
40 |
|
import jalview.analysis.AAFrequency; |
41 |
|
import jalview.analysis.AlignmentUtils; |
42 |
|
import jalview.analysis.CodingUtils; |
43 |
|
import jalview.analysis.Rna; |
44 |
|
import jalview.analysis.StructureFrequency; |
45 |
|
import jalview.api.AlignViewportI; |
46 |
|
import jalview.bin.Cache; |
47 |
|
import jalview.bin.Console; |
48 |
|
import jalview.datamodel.AlignmentAnnotation; |
49 |
|
import jalview.datamodel.Annotation; |
50 |
|
import jalview.datamodel.ColumnSelection; |
51 |
|
import jalview.datamodel.HiddenColumns; |
52 |
|
import jalview.datamodel.ProfilesI; |
53 |
|
import jalview.renderer.api.AnnotationRendererFactoryI; |
54 |
|
import jalview.renderer.api.AnnotationRowRendererI; |
55 |
|
import jalview.schemes.ColourSchemeI; |
56 |
|
import jalview.schemes.NucleotideColourScheme; |
57 |
|
import jalview.schemes.ResidueProperties; |
58 |
|
import jalview.schemes.ZappoColourScheme; |
59 |
|
import jalview.util.MessageManager; |
60 |
|
import jalview.util.Platform; |
61 |
|
|
|
|
| 51.4% |
Uncovered Elements: 537 (1,104) |
Complexity: 416 |
Complexity Density: 0.54 |
|
62 |
|
public class AnnotationRenderer |
63 |
|
{ |
64 |
|
private static final int UPPER_TO_LOWER = 'a' - 'A'; |
65 |
|
|
66 |
|
private static final int CHAR_A = 'A'; |
67 |
|
|
68 |
|
private static final int CHAR_Z = 'Z'; |
69 |
|
|
70 |
|
|
71 |
|
|
72 |
|
|
73 |
|
private final boolean debugRedraw; |
74 |
|
|
75 |
|
private int charWidth, endRes, charHeight; |
76 |
|
|
77 |
|
private boolean validCharWidth, hasHiddenColumns; |
78 |
|
|
79 |
|
private FontMetrics fm; |
80 |
|
|
81 |
|
private final boolean USE_FILL_ROUND_RECT = Platform.isAMacAndNotJS(); |
82 |
|
|
83 |
|
boolean av_renderHistogram = true, av_renderProfile = true, |
84 |
|
av_normaliseProfile = false; |
85 |
|
|
86 |
|
ResidueShaderI profcolour = null; |
87 |
|
|
88 |
|
private ColumnSelection columnSelection; |
89 |
|
|
90 |
|
private HiddenColumns hiddenColumns; |
91 |
|
|
92 |
|
private ProfilesI hconsensus; |
93 |
|
|
94 |
|
private ProfilesI hSSconsensus; |
95 |
|
|
96 |
|
private Hashtable<String, Object>[] complementConsensus; |
97 |
|
|
98 |
|
private Hashtable<String, Object>[] hStrucConsensus; |
99 |
|
|
100 |
|
private boolean av_ignoreGapsConsensus; |
101 |
|
|
102 |
|
private boolean renderingVectors = false; |
103 |
|
|
104 |
|
private boolean glyphLineDrawn = false; |
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
|
109 |
|
|
110 |
|
|
111 |
|
|
112 |
|
|
113 |
|
private Image fadedImage; |
114 |
|
|
115 |
|
|
116 |
|
|
117 |
|
|
118 |
|
private ImageObserver annotationPanel; |
119 |
|
|
120 |
|
|
121 |
|
|
122 |
|
|
123 |
|
private int imgWidth; |
124 |
|
|
125 |
|
|
126 |
|
|
127 |
|
|
128 |
|
private int sOffset; |
129 |
|
|
130 |
|
|
131 |
|
|
132 |
|
|
133 |
|
private int visHeight; |
134 |
|
|
135 |
|
|
136 |
|
|
137 |
|
|
138 |
|
|
139 |
|
private boolean useClip = true; |
140 |
|
|
141 |
|
|
142 |
|
|
143 |
|
|
144 |
|
|
145 |
|
private boolean canClip = false; |
146 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
147 |
491 |
public AnnotationRenderer()... |
148 |
|
{ |
149 |
491 |
this(false); |
150 |
|
} |
151 |
|
|
152 |
|
|
153 |
|
|
154 |
|
|
155 |
|
@param |
156 |
|
|
157 |
|
|
158 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
159 |
491 |
public AnnotationRenderer(boolean debugRedraw)... |
160 |
|
{ |
161 |
491 |
this.debugRedraw = debugRedraw; |
162 |
|
} |
163 |
|
|
164 |
|
|
165 |
|
|
166 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
|
167 |
253 |
public void dispose()... |
168 |
|
{ |
169 |
253 |
hiddenColumns = null; |
170 |
253 |
hconsensus = null; |
171 |
253 |
hSSconsensus = null; |
172 |
253 |
complementConsensus = null; |
173 |
253 |
hStrucConsensus = null; |
174 |
253 |
fadedImage = null; |
175 |
253 |
annotationPanel = null; |
176 |
253 |
rendererFactoryI = null; |
177 |
|
} |
178 |
|
|
|
|
| 0% |
Uncovered Elements: 36 (36) |
Complexity: 11 |
Complexity Density: 0.5 |
|
179 |
0 |
void drawStemAnnot(Graphics g, Annotation[] row_annotations, int lastSSX,... |
180 |
|
int x, int y, int iconOffset, int startRes, int column, |
181 |
|
boolean validRes, boolean validEnd) |
182 |
|
{ |
183 |
0 |
int sCol = (lastSSX / charWidth) |
184 |
|
+ hiddenColumns.visibleToAbsoluteColumn(startRes); |
185 |
0 |
int x1 = lastSSX; |
186 |
0 |
int x2 = (x * charWidth); |
187 |
|
|
188 |
0 |
char dc = (column == 0 || row_annotations[column - 1] == null) ? ' ' |
189 |
|
: row_annotations[column - 1].secondaryStructure; |
190 |
|
|
191 |
0 |
boolean diffupstream = sCol == 0 || row_annotations[sCol - 1] == null |
192 |
|
|| dc != row_annotations[sCol - 1].secondaryStructure |
193 |
|
|| !validEnd; |
194 |
0 |
boolean diffdownstream = !validRes || !validEnd |
195 |
|
|| row_annotations[column] == null |
196 |
|
|| dc != row_annotations[column].secondaryStructure; |
197 |
|
|
198 |
0 |
if (diffupstream || diffdownstream) |
199 |
|
{ |
200 |
|
|
201 |
0 |
drawGlyphLine(g, lastSSX, x, y, iconOffset); |
202 |
|
} |
203 |
0 |
g.setColor(STEM_COLOUR); |
204 |
|
|
205 |
0 |
if (column > 0 && Rna.isClosingParenthesis(dc)) |
206 |
|
{ |
207 |
0 |
if (diffupstream) |
208 |
|
|
209 |
|
|
210 |
|
{ |
211 |
|
|
212 |
|
|
213 |
|
|
214 |
|
|
215 |
0 |
fillPolygon(g, new int[] { lastSSX + 5, lastSSX + 5, lastSSX }, |
216 |
|
new int[] |
217 |
|
{ y + iconOffset + 1, y + 13 + iconOffset, |
218 |
|
y + 7 + iconOffset }, |
219 |
|
3); |
220 |
0 |
x1 += 5; |
221 |
|
} |
222 |
0 |
if (diffdownstream) |
223 |
|
{ |
224 |
0 |
x2 -= 1; |
225 |
|
} |
226 |
|
} |
227 |
|
else |
228 |
|
{ |
229 |
|
|
230 |
0 |
if (diffdownstream) |
231 |
|
{ |
232 |
|
|
233 |
|
|
234 |
|
|
235 |
|
|
236 |
0 |
fillPolygon(g, new int[] { x2 - 6, x2 - 6, x2 - 1 }, |
237 |
|
new int[] |
238 |
|
{ y + iconOffset + 1, y + 13 + iconOffset, |
239 |
|
y + 7 + iconOffset }, |
240 |
|
3); |
241 |
0 |
x2 -= 5; |
242 |
|
} |
243 |
0 |
if (diffupstream) |
244 |
|
{ |
245 |
0 |
x1 += 1; |
246 |
|
} |
247 |
|
} |
248 |
|
|
249 |
0 |
unsetAntialias(g); |
250 |
0 |
fillRect(g, x1, y + 4 + iconOffset, x2 - x1, 6); |
251 |
|
} |
252 |
|
|
|
|
| 0% |
Uncovered Elements: 36 (36) |
Complexity: 11 |
Complexity Density: 0.5 |
|
253 |
0 |
void drawNotCanonicalAnnot(Graphics g, Color nonCanColor,... |
254 |
|
Annotation[] row_annotations, int lastSSX, int x, int y, |
255 |
|
int iconOffset, int startRes, int column, boolean validRes, |
256 |
|
boolean validEnd) |
257 |
|
{ |
258 |
|
|
259 |
|
|
260 |
0 |
int sCol = (lastSSX / charWidth) |
261 |
|
+ hiddenColumns.visibleToAbsoluteColumn(startRes); |
262 |
0 |
int x1 = lastSSX; |
263 |
0 |
int x2 = (x * charWidth); |
264 |
|
|
265 |
0 |
String dc = (column == 0 || row_annotations[column - 1] == null) ? "" |
266 |
|
: row_annotations[column - 1].displayCharacter; |
267 |
|
|
268 |
0 |
boolean diffupstream = sCol == 0 || row_annotations[sCol - 1] == null |
269 |
|
|| !dc.equals(row_annotations[sCol - 1].displayCharacter) |
270 |
|
|| !validEnd; |
271 |
0 |
boolean diffdownstream = !validRes || !validEnd |
272 |
|
|| row_annotations[column] == null |
273 |
|
|| !dc.equals(row_annotations[column].displayCharacter); |
274 |
|
|
275 |
|
|
276 |
|
|
277 |
|
|
278 |
0 |
if (diffupstream || diffdownstream) |
279 |
|
{ |
280 |
|
|
281 |
0 |
drawGlyphLine(g, lastSSX, x, y, iconOffset); |
282 |
|
} |
283 |
0 |
g.setColor(nonCanColor); |
284 |
0 |
if (column > 0 && Rna.isClosingParenthesis(dc)) |
285 |
|
{ |
286 |
|
|
287 |
0 |
if (diffupstream) |
288 |
|
|
289 |
|
|
290 |
|
{ |
291 |
0 |
fillPolygon(g, new int[] { lastSSX + 5, lastSSX + 5, lastSSX }, |
292 |
|
new int[] |
293 |
|
{ y + iconOffset + 1, y + 13 + iconOffset, |
294 |
|
y + 7 + iconOffset }, |
295 |
|
3); |
296 |
0 |
x1 += 5; |
297 |
|
} |
298 |
0 |
if (diffdownstream) |
299 |
|
{ |
300 |
0 |
x2 -= 1; |
301 |
|
} |
302 |
|
} |
303 |
|
else |
304 |
|
{ |
305 |
|
|
306 |
|
|
307 |
0 |
if (diffdownstream) |
308 |
|
{ |
309 |
0 |
fillPolygon(g, new int[] { x2 - 6, x2 - 6, x2 - 1 }, |
310 |
|
new int[] |
311 |
|
{ y + iconOffset + 1, y + 13 + iconOffset, |
312 |
|
y + 7 + iconOffset }, |
313 |
|
3); |
314 |
0 |
x2 -= 5; |
315 |
|
} |
316 |
0 |
if (diffupstream) |
317 |
|
{ |
318 |
0 |
x1 += 1; |
319 |
|
} |
320 |
|
} |
321 |
|
|
322 |
0 |
unsetAntialias(g); |
323 |
0 |
fillRect(g, x1, y + 4 + iconOffset, x2 - x1, 6); |
324 |
|
} |
325 |
|
|
326 |
|
|
327 |
|
|
|
|
| 88.9% |
Uncovered Elements: 2 (18) |
Complexity: 3 |
Complexity Density: 0.21 |
|
328 |
1832 |
public void updateFromAwtRenderPanel(AwtRenderPanelI annotPanel,... |
329 |
|
AlignViewportI av) |
330 |
|
{ |
331 |
1832 |
fm = annotPanel.getFontMetrics(); |
332 |
1832 |
annotationPanel = annotPanel; |
333 |
1832 |
fadedImage = annotPanel.getFadedImage(); |
334 |
1832 |
imgWidth = annotPanel.getFadedImageWidth(); |
335 |
|
|
336 |
1832 |
int[] bounds = annotPanel.getVisibleVRange(); |
337 |
1832 |
if (bounds != null) |
338 |
|
{ |
339 |
1640 |
sOffset = bounds[0]; |
340 |
1640 |
visHeight = bounds[1]; |
341 |
1640 |
if (visHeight == 0) |
342 |
|
{ |
343 |
0 |
useClip = false; |
344 |
|
} |
345 |
|
else |
346 |
|
{ |
347 |
1640 |
useClip = canClip; |
348 |
|
} |
349 |
|
} |
350 |
|
else |
351 |
|
{ |
352 |
192 |
useClip = false; |
353 |
|
} |
354 |
|
|
355 |
1832 |
rendererFactoryI = AnnotationRendererFactory.getRendererFactory(); |
356 |
1832 |
updateFromAlignViewport(av); |
357 |
|
} |
358 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (23) |
Complexity: 4 |
Complexity Density: 0.21 |
|
359 |
1832 |
public void updateFromAlignViewport(AlignViewportI av)... |
360 |
|
{ |
361 |
1832 |
charWidth = av.getCharWidth(); |
362 |
1832 |
endRes = av.getRanges().getEndRes(); |
363 |
1832 |
charHeight = av.getCharHeight(); |
364 |
1832 |
hasHiddenColumns = av.hasHiddenColumns(); |
365 |
1832 |
validCharWidth = av.isValidCharWidth(); |
366 |
1832 |
av_renderHistogram = av.isShowConsensusHistogram(); |
367 |
1832 |
av_renderProfile = av.isShowSequenceLogo(); |
368 |
1832 |
av_normaliseProfile = av.isNormaliseSequenceLogo(); |
369 |
1832 |
profcolour = av.getResidueShading(); |
370 |
1832 |
if (profcolour == null || profcolour.getColourScheme() == null) |
371 |
|
{ |
372 |
|
|
373 |
|
|
374 |
|
|
375 |
|
|
376 |
|
|
377 |
1594 |
ColourSchemeI col = av.getAlignment().isNucleotide() |
378 |
|
? new NucleotideColourScheme() |
379 |
|
: new ZappoColourScheme(); |
380 |
1594 |
profcolour = new ResidueShader(col); |
381 |
|
} |
382 |
1832 |
columnSelection = av.getColumnSelection(); |
383 |
1832 |
hiddenColumns = av.getAlignment().getHiddenColumns(); |
384 |
1832 |
hconsensus = av.getSequenceConsensusHash(); |
385 |
1832 |
hSSconsensus = av.getSequenceSSConsensusHash(); |
386 |
1832 |
complementConsensus = av.getComplementConsensusHash(); |
387 |
1832 |
hStrucConsensus = av.getRnaStructureConsensusHash(); |
388 |
1832 |
av_ignoreGapsConsensus = av.isIgnoreGapsConsensus(); |
389 |
|
} |
390 |
|
|
391 |
|
|
392 |
|
|
393 |
|
|
394 |
|
|
395 |
|
|
396 |
|
@param |
397 |
|
@param |
398 |
|
@return |
399 |
|
|
|
|
| 42.9% |
Uncovered Elements: 16 (28) |
Complexity: 18 |
Complexity Density: 1.29 |
|
400 |
69866 |
int[] getProfileFor(AlignmentAnnotation aa, int column)... |
401 |
|
{ |
402 |
|
|
403 |
|
|
404 |
|
|
405 |
|
|
406 |
69866 |
if (aa.autoCalculated && (aa.label.startsWith("Consensus") |
407 |
|
|| aa.label.startsWith("cDNA Consensus"))) |
408 |
|
{ |
409 |
69866 |
boolean forComplement = aa.label.startsWith("cDNA Consensus"); |
410 |
69866 |
if (aa.groupRef != null && aa.groupRef.consensusData != null |
411 |
|
&& aa.groupRef.isShowSequenceLogo()) |
412 |
|
{ |
413 |
|
|
414 |
29043 |
return AAFrequency.extractProfile( |
415 |
|
aa.groupRef.consensusData.get(column), |
416 |
|
aa.groupRef.getIgnoreGapsConsensus()); |
417 |
|
} |
418 |
|
|
419 |
|
|
420 |
40823 |
if (aa.groupRef == null && aa.sequenceRef == null) |
421 |
|
{ |
422 |
40823 |
if (forComplement) |
423 |
|
{ |
424 |
0 |
return AAFrequency.extractCdnaProfile(complementConsensus[column], |
425 |
|
av_ignoreGapsConsensus); |
426 |
|
} |
427 |
|
else |
428 |
|
{ |
429 |
40823 |
return AAFrequency.extractProfile(hconsensus.get(column), |
430 |
|
av_ignoreGapsConsensus); |
431 |
|
} |
432 |
|
} |
433 |
|
} |
434 |
|
|
435 |
0 |
else if (aa.autoCalculated && aa.label.startsWith( |
436 |
|
MessageManager.getString("label.ssconsensus_label"))) |
437 |
|
{ |
438 |
0 |
return AAFrequency.extractProfile(hSSconsensus.get(column), |
439 |
|
av_ignoreGapsConsensus); |
440 |
|
|
441 |
|
} |
442 |
|
|
443 |
|
else |
444 |
|
{ |
445 |
0 |
if (aa.autoCalculated && aa.label.startsWith("StrucConsensus")) |
446 |
|
{ |
447 |
|
|
448 |
|
|
449 |
|
|
450 |
|
|
451 |
|
|
452 |
|
|
453 |
|
|
454 |
|
|
455 |
|
|
456 |
|
|
457 |
|
|
458 |
0 |
if (aa.groupRef == null && aa.sequenceRef == null |
459 |
|
&& hStrucConsensus != null |
460 |
|
&& hStrucConsensus.length > column) |
461 |
|
{ |
462 |
0 |
return StructureFrequency.extractProfile(hStrucConsensus[column], |
463 |
|
av_ignoreGapsConsensus); |
464 |
|
} |
465 |
|
} |
466 |
|
} |
467 |
0 |
return null; |
468 |
|
} |
469 |
|
|
470 |
|
boolean rna = false; |
471 |
|
|
472 |
|
private AnnotationRendererFactoryI rendererFactoryI; |
473 |
|
|
474 |
|
|
475 |
|
|
476 |
|
|
477 |
|
@param |
478 |
|
|
479 |
|
@param |
480 |
|
|
481 |
|
@param |
482 |
|
|
483 |
|
@param |
484 |
|
|
485 |
|
@param |
486 |
|
|
487 |
|
@param |
488 |
|
|
489 |
|
@return |
490 |
|
|
491 |
|
|
|
|
| 50.8% |
Uncovered Elements: 251 (510) |
Complexity: 226 |
Complexity Density: 0.64 |
|
492 |
1832 |
public boolean drawComponent(AwtRenderPanelI annotPanel,... |
493 |
|
AlignViewportI av, Graphics g, int activeRow, int startRes, |
494 |
|
int endRes) |
495 |
|
{ |
496 |
1832 |
if (g instanceof EpsGraphics2D || g instanceof SVGGraphics2D) |
497 |
|
{ |
498 |
14 |
this.setVectorRendering(true); |
499 |
|
} |
500 |
1832 |
Graphics2D g2d = (Graphics2D) g; |
501 |
|
|
502 |
1832 |
long stime = System.currentTimeMillis(); |
503 |
1832 |
boolean usedFaded = false; |
504 |
|
|
505 |
|
|
506 |
|
|
507 |
1832 |
updateFromAwtRenderPanel(annotPanel, av); |
508 |
1832 |
fm = g.getFontMetrics(); |
509 |
1832 |
AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation(); |
510 |
|
|
511 |
1832 |
if (aa == null) |
512 |
|
{ |
513 |
0 |
return false; |
514 |
|
} |
515 |
1832 |
int x = 0, y = 0; |
516 |
1832 |
int column = 0; |
517 |
1832 |
char lastSS; |
518 |
1832 |
int lastSSX; |
519 |
1832 |
int iconOffset = 0; |
520 |
1832 |
boolean validRes = false; |
521 |
1832 |
boolean validEnd = false; |
522 |
1832 |
boolean labelAllCols = false; |
523 |
|
|
524 |
|
|
525 |
1832 |
boolean scaleColLabel = false; |
526 |
1832 |
final AlignmentAnnotation consensusAnnot = av |
527 |
|
.getAlignmentConsensusAnnotation(); |
528 |
1832 |
final AlignmentAnnotation structConsensusAnnot = av |
529 |
|
.getAlignmentStrucConsensusAnnotation(); |
530 |
1832 |
final AlignmentAnnotation complementConsensusAnnot = av |
531 |
|
.getComplementConsensusAnnotation(); |
532 |
1832 |
final AlignmentAnnotation ssConsensusAnnot = av |
533 |
|
.getAlignmentSecondaryStructureConsensusAnnotation(); |
534 |
|
|
535 |
1832 |
BitSet graphGroupDrawn = new BitSet(); |
536 |
1832 |
int charOffset = 0; |
537 |
|
|
538 |
|
|
539 |
1832 |
int yfrom = 0, f_i = 0, yto = 0, f_to = 0; |
540 |
1832 |
boolean clipst = false, clipend = false; |
541 |
11297 |
for (int i = 0; i < aa.length; i++) |
542 |
|
{ |
543 |
9466 |
AlignmentAnnotation row = aa[i]; |
544 |
9466 |
boolean renderHistogram = true; |
545 |
9466 |
boolean renderProfile = false; |
546 |
9466 |
boolean normaliseProfile = false; |
547 |
9466 |
boolean isRNA = row.isRNA(); |
548 |
|
|
549 |
|
|
550 |
|
|
551 |
|
|
552 |
|
|
553 |
9466 |
if (row.groupRef != null && row == row.groupRef.getConsensus()) |
554 |
|
{ |
555 |
462 |
renderHistogram = row.groupRef.isShowConsensusHistogram(); |
556 |
462 |
renderProfile = row.groupRef.isShowSequenceLogo(); |
557 |
462 |
normaliseProfile = row.groupRef.isNormaliseSequenceLogo(); |
558 |
|
} |
559 |
9004 |
else if (row == consensusAnnot || row == structConsensusAnnot |
560 |
|
|| row == complementConsensusAnnot || row == ssConsensusAnnot) |
561 |
|
{ |
562 |
1832 |
renderHistogram = av_renderHistogram; |
563 |
1832 |
renderProfile = av_renderProfile; |
564 |
1832 |
normaliseProfile = av_normaliseProfile; |
565 |
|
} |
566 |
|
|
567 |
9466 |
Annotation[] row_annotations = row.annotations; |
568 |
9466 |
if (!row.isForDisplay()) |
569 |
|
{ |
570 |
724 |
continue; |
571 |
|
} |
572 |
|
|
573 |
8742 |
labelAllCols = row.showAllColLabels; |
574 |
8742 |
scaleColLabel = row.scaleColLabel; |
575 |
8742 |
lastSS = ' '; |
576 |
8742 |
lastSSX = 0; |
577 |
|
|
578 |
8742 |
if (!useClip || ((y - charHeight) < visHeight |
579 |
|
&& (y + row.height + charHeight * 2) >= sOffset)) |
580 |
|
{ |
581 |
8742 |
if (!clipst) |
582 |
|
{ |
583 |
1820 |
clipst = true; |
584 |
1820 |
yfrom = y; |
585 |
1820 |
f_i = i; |
586 |
|
} |
587 |
8742 |
yto = y; |
588 |
8742 |
f_to = i; |
589 |
8742 |
if (row.graph > 0) |
590 |
|
{ |
591 |
7614 |
if (row.graphGroup > -1 && graphGroupDrawn.get(row.graphGroup)) |
592 |
|
{ |
593 |
0 |
continue; |
594 |
|
} |
595 |
|
|
596 |
|
|
597 |
7614 |
y += row.height; |
598 |
|
|
599 |
7614 |
if (row.hasText) |
600 |
|
{ |
601 |
7003 |
iconOffset = charHeight - fm.getDescent(); |
602 |
7003 |
y -= charHeight; |
603 |
|
} |
604 |
|
} |
605 |
1128 |
else if (row.hasText) |
606 |
|
{ |
607 |
830 |
iconOffset = charHeight - fm.getDescent(); |
608 |
|
|
609 |
|
} |
610 |
|
else |
611 |
|
{ |
612 |
298 |
iconOffset = 0; |
613 |
|
} |
614 |
|
|
615 |
8742 |
if (row.autoCalculated && av.isCalculationInProgress(row)) |
616 |
|
{ |
617 |
244 |
y += charHeight; |
618 |
244 |
usedFaded = true; |
619 |
244 |
g.drawImage(fadedImage, 0, y - row.height, imgWidth, y, 0, |
620 |
|
y - row.height, imgWidth, y, annotationPanel); |
621 |
244 |
g.setColor(Color.black); |
622 |
|
|
623 |
|
|
624 |
244 |
continue; |
625 |
|
} |
626 |
|
|
627 |
|
|
628 |
|
|
629 |
|
|
630 |
|
|
631 |
|
|
632 |
|
|
633 |
|
|
634 |
|
|
635 |
|
|
636 |
|
|
637 |
|
|
638 |
|
|
639 |
|
|
640 |
|
|
641 |
|
|
642 |
|
|
643 |
|
|
644 |
|
|
645 |
|
|
646 |
|
|
647 |
|
|
648 |
|
|
649 |
|
|
650 |
|
|
651 |
|
|
652 |
|
|
653 |
|
|
654 |
|
|
655 |
8498 |
this.glyphLineDrawn = false; |
656 |
8498 |
x = (startRes == 0) ? 0 : -1; |
657 |
426179 |
while (x < endRes - startRes) |
658 |
|
{ |
659 |
417683 |
if (hasHiddenColumns) |
660 |
|
{ |
661 |
95374 |
column = hiddenColumns.visibleToAbsoluteColumn(startRes + x); |
662 |
95374 |
if (column > row_annotations.length - 1) |
663 |
|
{ |
664 |
0 |
break; |
665 |
|
} |
666 |
|
} |
667 |
|
else |
668 |
|
{ |
669 |
322308 |
column = startRes + x; |
670 |
|
} |
671 |
|
|
672 |
417686 |
if ((row_annotations == null) |
673 |
|
|| (row_annotations.length <= column) |
674 |
|
|| (row_annotations[column] == null)) |
675 |
|
{ |
676 |
67878 |
validRes = false; |
677 |
|
} |
678 |
|
else |
679 |
|
{ |
680 |
349808 |
validRes = true; |
681 |
|
} |
682 |
417687 |
final String displayChar = validRes |
683 |
|
? row_annotations[column].displayCharacter |
684 |
|
: null; |
685 |
417686 |
if (x > -1) |
686 |
|
{ |
687 |
414782 |
unsetAntialias(g); |
688 |
414782 |
if (activeRow == i) |
689 |
|
{ |
690 |
0 |
g.setColor(Color.red); |
691 |
|
|
692 |
0 |
if (columnSelection != null) |
693 |
|
{ |
694 |
0 |
if (columnSelection.contains(column)) |
695 |
|
{ |
696 |
0 |
fillRect(g, x * charWidth, y, charWidth, charHeight); |
697 |
|
} |
698 |
|
} |
699 |
|
} |
700 |
414784 |
if (row.getInvalidStrucPos() > x) |
701 |
|
{ |
702 |
0 |
g.setColor(Color.orange); |
703 |
0 |
fillRect(g, x * charWidth, y, charWidth, charHeight); |
704 |
|
} |
705 |
414784 |
else if (row.getInvalidStrucPos() == x) |
706 |
|
{ |
707 |
0 |
g.setColor(Color.orange.darker()); |
708 |
0 |
fillRect(g, x * charWidth, y, charWidth, charHeight); |
709 |
|
} |
710 |
414786 |
if (validCharWidth && validRes && displayChar != null |
711 |
|
&& (displayChar.length() > 0)) |
712 |
|
{ |
713 |
|
|
714 |
246439 |
float fmWidth = fm.charsWidth(displayChar.toCharArray(), 0, |
715 |
|
displayChar.length()); |
716 |
|
|
717 |
|
|
718 |
|
|
719 |
|
|
720 |
|
|
721 |
246439 |
boolean scaledToFit = false; |
722 |
246439 |
float fmScaling = 1f; |
723 |
246439 |
if (scaleColLabel && fmWidth > charWidth) |
724 |
|
{ |
725 |
0 |
scaledToFit = true; |
726 |
0 |
fmScaling = charWidth; |
727 |
0 |
fmScaling /= fmWidth; |
728 |
|
|
729 |
0 |
fmWidth = charWidth; |
730 |
|
} |
731 |
|
|
732 |
246438 |
charOffset = (int) ((charWidth - fmWidth) / 2f); |
733 |
|
|
734 |
246439 |
if (row_annotations[column].colour == null) |
735 |
|
{ |
736 |
104996 |
g2d.setColor(Color.black); |
737 |
|
} |
738 |
|
else |
739 |
|
{ |
740 |
141443 |
g2d.setColor(row_annotations[column].colour); |
741 |
|
} |
742 |
|
|
743 |
|
|
744 |
|
|
745 |
|
|
746 |
|
|
747 |
246439 |
final int xPos = (x * charWidth) + charOffset; |
748 |
246439 |
final int yPos = y + iconOffset; |
749 |
|
|
750 |
|
|
751 |
|
|
752 |
|
|
753 |
246439 |
g2d.translate(xPos, yPos); |
754 |
246439 |
if (scaledToFit) |
755 |
|
{ |
756 |
|
|
757 |
|
|
758 |
|
|
759 |
|
|
760 |
0 |
g2d.transform( |
761 |
|
AffineTransform.getScaleInstance(fmScaling, 1.0)); |
762 |
|
} |
763 |
246439 |
setAntialias(g); |
764 |
246439 |
if (column == 0 || row.graph > 0) |
765 |
|
{ |
766 |
241962 |
g2d.drawString(displayChar, 0, 0); |
767 |
|
} |
768 |
4477 |
else if (row_annotations[column - 1] == null || (labelAllCols |
769 |
|
|| !displayChar.equals( |
770 |
|
row_annotations[column - 1].displayCharacter) |
771 |
|
|| (displayChar.length() < 2 |
772 |
|
&& row_annotations[column].secondaryStructure == ' '))) |
773 |
|
{ |
774 |
4477 |
g2d.drawString(displayChar, 0, 0); |
775 |
|
} |
776 |
246439 |
if (scaledToFit) |
777 |
|
{ |
778 |
|
|
779 |
|
|
780 |
|
|
781 |
|
|
782 |
0 |
g2d.transform(AffineTransform |
783 |
|
.getScaleInstance(1D / fmScaling, 1.0)); |
784 |
|
} |
785 |
246439 |
g2d.translate(-xPos, -yPos); |
786 |
|
} |
787 |
|
} |
788 |
417683 |
if (row.hasIcons) |
789 |
|
{ |
790 |
42096 |
char ss = validRes ? row_annotations[column].secondaryStructure |
791 |
|
: '-'; |
792 |
|
|
793 |
42096 |
if (ss == '(') |
794 |
|
{ |
795 |
|
|
796 |
0 |
if (displayChar.indexOf(')') > -1) |
797 |
|
{ |
798 |
|
|
799 |
0 |
ss = ')'; |
800 |
|
|
801 |
|
} |
802 |
|
} |
803 |
42096 |
if (ss == '[') |
804 |
|
{ |
805 |
0 |
if ((displayChar.indexOf(']') > -1)) |
806 |
|
{ |
807 |
0 |
ss = ']'; |
808 |
|
|
809 |
|
} |
810 |
|
} |
811 |
42096 |
if (ss == '{') |
812 |
|
{ |
813 |
|
|
814 |
0 |
if (displayChar.indexOf('}') > -1) |
815 |
|
{ |
816 |
0 |
ss = '}'; |
817 |
|
|
818 |
|
} |
819 |
|
} |
820 |
42096 |
if (ss == '<') |
821 |
|
{ |
822 |
|
|
823 |
0 |
if (displayChar.indexOf('<') > -1) |
824 |
|
{ |
825 |
0 |
ss = '>'; |
826 |
|
|
827 |
|
} |
828 |
|
} |
829 |
42096 |
if (isRNA && (ss >= CHAR_A) && (ss <= CHAR_Z)) |
830 |
|
{ |
831 |
|
|
832 |
0 |
int ssLowerCase = ss + UPPER_TO_LOWER; |
833 |
|
|
834 |
0 |
if (displayChar.indexOf(ssLowerCase) > -1) |
835 |
|
{ |
836 |
0 |
ss = (char) ssLowerCase; |
837 |
|
} |
838 |
|
} |
839 |
|
|
840 |
42096 |
if (!validRes || (ss != lastSS)) |
841 |
|
{ |
842 |
|
|
843 |
33793 |
if (x > -1) |
844 |
|
{ |
845 |
|
|
846 |
|
|
847 |
|
|
848 |
|
|
849 |
|
|
850 |
33360 |
switch (lastSS) |
851 |
|
{ |
852 |
0 |
case '(': |
853 |
0 |
case ')': |
854 |
0 |
drawStemAnnot(g, row_annotations, lastSSX, x, y, |
855 |
|
iconOffset, startRes, column, validRes, validEnd); |
856 |
|
|
857 |
0 |
break; |
858 |
|
|
859 |
505 |
case 'H': |
860 |
505 |
if (!isRNA) |
861 |
|
{ |
862 |
505 |
drawHelixAnnot(g, row_annotations, lastSSX, x, y, |
863 |
|
iconOffset, startRes, column, validRes, |
864 |
|
validEnd); |
865 |
505 |
break; |
866 |
|
} |
867 |
|
|
868 |
2719 |
case 'E': |
869 |
2719 |
if (!isRNA) |
870 |
|
{ |
871 |
2719 |
drawSheetAnnot(g, row_annotations, lastSSX, x, y, |
872 |
|
iconOffset, startRes, column, validRes, |
873 |
|
validEnd); |
874 |
2719 |
break; |
875 |
|
} |
876 |
|
|
877 |
|
|
878 |
0 |
case '{': |
879 |
0 |
case '}': |
880 |
0 |
case '[': |
881 |
0 |
case ']': |
882 |
0 |
case '>': |
883 |
0 |
case '<': |
884 |
0 |
case 'A': |
885 |
0 |
case 'a': |
886 |
0 |
case 'B': |
887 |
0 |
case 'b': |
888 |
0 |
case 'C': |
889 |
0 |
case 'c': |
890 |
0 |
case 'D': |
891 |
0 |
case 'd': |
892 |
0 |
case 'e': |
893 |
0 |
case 'F': |
894 |
0 |
case 'f': |
895 |
0 |
case 'G': |
896 |
0 |
case 'g': |
897 |
0 |
case 'h': |
898 |
0 |
case 'I': |
899 |
0 |
case 'i': |
900 |
0 |
case 'J': |
901 |
0 |
case 'j': |
902 |
0 |
case 'K': |
903 |
0 |
case 'k': |
904 |
0 |
case 'L': |
905 |
0 |
case 'l': |
906 |
0 |
case 'M': |
907 |
0 |
case 'm': |
908 |
0 |
case 'N': |
909 |
0 |
case 'n': |
910 |
0 |
case 'O': |
911 |
0 |
case 'o': |
912 |
0 |
case 'P': |
913 |
0 |
case 'p': |
914 |
0 |
case 'Q': |
915 |
0 |
case 'q': |
916 |
0 |
case 'R': |
917 |
0 |
case 'r': |
918 |
0 |
case 'S': |
919 |
0 |
case 's': |
920 |
0 |
case 'T': |
921 |
0 |
case 't': |
922 |
0 |
case 'U': |
923 |
0 |
case 'u': |
924 |
0 |
case 'V': |
925 |
0 |
case 'v': |
926 |
0 |
case 'W': |
927 |
0 |
case 'w': |
928 |
0 |
case 'X': |
929 |
0 |
case 'x': |
930 |
0 |
case 'Y': |
931 |
0 |
case 'y': |
932 |
0 |
case 'Z': |
933 |
0 |
case 'z': |
934 |
|
|
935 |
0 |
Color nonCanColor = getNotCanonicalColor(lastSS); |
936 |
0 |
drawNotCanonicalAnnot(g, nonCanColor, row_annotations, |
937 |
|
lastSSX, x, y, iconOffset, startRes, column, |
938 |
|
validRes, validEnd); |
939 |
|
|
940 |
0 |
break; |
941 |
30136 |
default: |
942 |
30136 |
if (isVectorRendering()) |
943 |
|
{ |
944 |
|
|
945 |
0 |
drawGlyphLine(g, lastSSX, endRes - x, y, iconOffset); |
946 |
|
|
947 |
0 |
this.glyphLineDrawn = true; |
948 |
|
} |
949 |
|
else |
950 |
|
{ |
951 |
30136 |
drawGlyphLine(g, lastSSX, x, y, iconOffset); |
952 |
|
} |
953 |
30136 |
break; |
954 |
|
} |
955 |
|
} |
956 |
33793 |
if (validRes) |
957 |
|
{ |
958 |
3305 |
lastSS = ss; |
959 |
|
} |
960 |
|
else |
961 |
|
{ |
962 |
30488 |
lastSS = ' '; |
963 |
|
} |
964 |
33793 |
if (x > -1) |
965 |
|
{ |
966 |
33360 |
lastSSX = (x * charWidth); |
967 |
|
} |
968 |
|
} |
969 |
|
} |
970 |
417682 |
column++; |
971 |
417682 |
x++; |
972 |
|
} |
973 |
8498 |
if (column >= row_annotations.length) |
974 |
|
{ |
975 |
1560 |
column = row_annotations.length - 1; |
976 |
1560 |
validEnd = false; |
977 |
|
} |
978 |
|
else |
979 |
|
{ |
980 |
6938 |
validEnd = true; |
981 |
|
} |
982 |
8498 |
if ((row_annotations == null) || (row_annotations.length <= column) |
983 |
|
|| (row_annotations[column] == null)) |
984 |
|
{ |
985 |
1422 |
validRes = false; |
986 |
|
} |
987 |
|
else |
988 |
|
{ |
989 |
7076 |
validRes = true; |
990 |
|
} |
991 |
|
|
992 |
|
|
993 |
8498 |
if (row.hasIcons) |
994 |
|
{ |
995 |
713 |
switch (lastSS) |
996 |
|
{ |
997 |
|
|
998 |
0 |
case 'H': |
999 |
0 |
if (!isRNA) |
1000 |
|
{ |
1001 |
0 |
drawHelixAnnot(g, row_annotations, lastSSX, x, y, iconOffset, |
1002 |
|
startRes, column, validRes, validEnd); |
1003 |
0 |
break; |
1004 |
|
} |
1005 |
|
|
1006 |
|
|
1007 |
81 |
case 'E': |
1008 |
81 |
if (!isRNA) |
1009 |
|
{ |
1010 |
81 |
drawSheetAnnot(g, row_annotations, lastSSX, x, y, iconOffset, |
1011 |
|
startRes, column, validRes, validEnd); |
1012 |
81 |
break; |
1013 |
|
} |
1014 |
|
|
1015 |
|
|
1016 |
0 |
case '(': |
1017 |
0 |
case ')': |
1018 |
|
|
1019 |
0 |
drawStemAnnot(g, row_annotations, lastSSX, x, y, iconOffset, |
1020 |
|
startRes, column, validRes, validEnd); |
1021 |
|
|
1022 |
0 |
break; |
1023 |
0 |
case '{': |
1024 |
0 |
case '}': |
1025 |
0 |
case '[': |
1026 |
0 |
case ']': |
1027 |
0 |
case '>': |
1028 |
0 |
case '<': |
1029 |
0 |
case 'A': |
1030 |
0 |
case 'a': |
1031 |
0 |
case 'B': |
1032 |
0 |
case 'b': |
1033 |
0 |
case 'C': |
1034 |
0 |
case 'c': |
1035 |
0 |
case 'D': |
1036 |
0 |
case 'd': |
1037 |
0 |
case 'e': |
1038 |
0 |
case 'F': |
1039 |
0 |
case 'f': |
1040 |
0 |
case 'G': |
1041 |
0 |
case 'g': |
1042 |
0 |
case 'h': |
1043 |
0 |
case 'I': |
1044 |
0 |
case 'i': |
1045 |
0 |
case 'J': |
1046 |
0 |
case 'j': |
1047 |
0 |
case 'K': |
1048 |
0 |
case 'k': |
1049 |
0 |
case 'L': |
1050 |
0 |
case 'l': |
1051 |
0 |
case 'M': |
1052 |
0 |
case 'm': |
1053 |
0 |
case 'N': |
1054 |
0 |
case 'n': |
1055 |
0 |
case 'O': |
1056 |
0 |
case 'o': |
1057 |
0 |
case 'P': |
1058 |
0 |
case 'p': |
1059 |
0 |
case 'Q': |
1060 |
0 |
case 'q': |
1061 |
0 |
case 'R': |
1062 |
0 |
case 'r': |
1063 |
0 |
case 'T': |
1064 |
0 |
case 't': |
1065 |
0 |
case 'U': |
1066 |
0 |
case 'u': |
1067 |
0 |
case 'V': |
1068 |
0 |
case 'v': |
1069 |
0 |
case 'W': |
1070 |
0 |
case 'w': |
1071 |
0 |
case 'X': |
1072 |
0 |
case 'x': |
1073 |
0 |
case 'Y': |
1074 |
0 |
case 'y': |
1075 |
0 |
case 'Z': |
1076 |
0 |
case 'z': |
1077 |
|
|
1078 |
0 |
Color nonCanColor = getNotCanonicalColor(lastSS); |
1079 |
0 |
drawNotCanonicalAnnot(g, nonCanColor, row_annotations, lastSSX, |
1080 |
|
x, y, iconOffset, startRes, column, validRes, validEnd); |
1081 |
0 |
break; |
1082 |
632 |
default: |
1083 |
632 |
if (isVectorRendering()) |
1084 |
|
{ |
1085 |
|
|
1086 |
0 |
drawGlyphLine(g, lastSSX, endRes - x, y, iconOffset); |
1087 |
|
|
1088 |
0 |
this.glyphLineDrawn = true; |
1089 |
|
} |
1090 |
|
else |
1091 |
|
{ |
1092 |
632 |
drawGlyphLine(g, lastSSX, x, y, iconOffset); |
1093 |
|
} |
1094 |
632 |
break; |
1095 |
|
} |
1096 |
|
} |
1097 |
|
|
1098 |
8498 |
if (row.graph > 0 && row.graphHeight > 0) |
1099 |
|
{ |
1100 |
7370 |
if (row.graph == AlignmentAnnotation.LINE_GRAPH) |
1101 |
|
{ |
1102 |
484 |
if (row.graphGroup > -1 && !graphGroupDrawn.get(row.graphGroup)) |
1103 |
|
{ |
1104 |
|
|
1105 |
|
|
1106 |
0 |
float groupmax = -999999, groupmin = 9999999; |
1107 |
0 |
for (int gg = 0; gg < aa.length; gg++) |
1108 |
|
{ |
1109 |
0 |
if (aa[gg].graphGroup != row.graphGroup) |
1110 |
|
{ |
1111 |
0 |
continue; |
1112 |
|
} |
1113 |
|
|
1114 |
0 |
if (aa[gg] != row) |
1115 |
|
{ |
1116 |
0 |
aa[gg].visible = false; |
1117 |
|
} |
1118 |
0 |
if (aa[gg].graphMax > groupmax) |
1119 |
|
{ |
1120 |
0 |
groupmax = aa[gg].graphMax; |
1121 |
|
} |
1122 |
0 |
if (aa[gg].graphMin < groupmin) |
1123 |
|
{ |
1124 |
0 |
groupmin = aa[gg].graphMin; |
1125 |
|
} |
1126 |
|
} |
1127 |
|
|
1128 |
0 |
for (int gg = 0; gg < aa.length; gg++) |
1129 |
|
{ |
1130 |
0 |
if (aa[gg].graphGroup == row.graphGroup) |
1131 |
|
{ |
1132 |
0 |
drawLineGraph(g, aa[gg], aa[gg].annotations, startRes, |
1133 |
|
endRes, y, groupmin, groupmax, row.graphHeight); |
1134 |
|
} |
1135 |
|
} |
1136 |
|
|
1137 |
0 |
graphGroupDrawn.set(row.graphGroup); |
1138 |
|
} |
1139 |
|
else |
1140 |
|
{ |
1141 |
484 |
drawLineGraph(g, row, row_annotations, startRes, endRes, y, |
1142 |
|
row.graphMin, row.graphMax, row.graphHeight); |
1143 |
|
} |
1144 |
|
} |
1145 |
6886 |
else if (row.graph == AlignmentAnnotation.BAR_GRAPH) |
1146 |
|
{ |
1147 |
6759 |
drawBarGraph(g, row, row_annotations, startRes, endRes, |
1148 |
|
row.graphMin, row.graphMax, y, renderHistogram, |
1149 |
|
renderProfile, normaliseProfile); |
1150 |
|
} |
1151 |
|
else |
1152 |
|
{ |
1153 |
127 |
AnnotationRowRendererI renderer = rendererFactoryI |
1154 |
|
.getRendererFor(row); |
1155 |
127 |
if (renderer != null) |
1156 |
|
{ |
1157 |
127 |
renderer.renderRow(g, charWidth, charHeight, hasHiddenColumns, |
1158 |
|
av, hiddenColumns, columnSelection, row, |
1159 |
|
row_annotations, startRes, endRes, row.graphMin, |
1160 |
|
row.graphMax, y); |
1161 |
|
} |
1162 |
127 |
if (debugRedraw) |
1163 |
|
{ |
1164 |
0 |
if (renderer == null) |
1165 |
|
{ |
1166 |
0 |
System.err |
1167 |
|
.println("No renderer found for " + row.toString()); |
1168 |
|
} |
1169 |
|
else |
1170 |
|
{ |
1171 |
0 |
Console.warn( |
1172 |
|
"rendered with " + renderer.getClass().toString()); |
1173 |
|
} |
1174 |
|
} |
1175 |
|
|
1176 |
|
} |
1177 |
|
} |
1178 |
|
} |
1179 |
|
else |
1180 |
|
{ |
1181 |
0 |
if (clipst && !clipend) |
1182 |
|
{ |
1183 |
0 |
clipend = true; |
1184 |
|
} |
1185 |
|
} |
1186 |
8497 |
if (row.graph > 0 && row.hasText) |
1187 |
|
{ |
1188 |
6759 |
y += charHeight; |
1189 |
|
} |
1190 |
|
|
1191 |
8497 |
if (row.graph == 0) |
1192 |
|
{ |
1193 |
1128 |
y += aa[i].height; |
1194 |
|
} |
1195 |
|
} |
1196 |
1831 |
if (debugRedraw) |
1197 |
|
{ |
1198 |
0 |
if (canClip) |
1199 |
|
{ |
1200 |
0 |
if (clipst) |
1201 |
|
{ |
1202 |
0 |
Console.warn("Start clip at : " + yfrom + " (index " + f_i + ")"); |
1203 |
|
} |
1204 |
0 |
if (clipend) |
1205 |
|
{ |
1206 |
0 |
Console.warn("End clip at : " + yto + " (index " + f_to + ")"); |
1207 |
|
} |
1208 |
|
} |
1209 |
0 |
; |
1210 |
0 |
Console.warn("Annotation Rendering time:" |
1211 |
|
+ (System.currentTimeMillis() - stime)); |
1212 |
|
} |
1213 |
1831 |
; |
1214 |
|
|
1215 |
1831 |
return !usedFaded; |
1216 |
|
} |
1217 |
|
|
1218 |
|
public static final Color GLYPHLINE_COLOR = Color.gray; |
1219 |
|
|
1220 |
|
public static final Color SHEET_COLOUR = Color.green; |
1221 |
|
|
1222 |
|
public static final Color HELIX_COLOUR = Color.red; |
1223 |
|
|
1224 |
|
public static final Color STEM_COLOUR = Color.blue; |
1225 |
|
|
1226 |
|
|
1227 |
|
|
|
|
| 71.4% |
Uncovered Elements: 2 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
1228 |
34070 |
void drawGlyphLine(Graphics g, int lastSSX, int x, int y, int iconOffset)... |
1229 |
|
{ |
1230 |
34070 |
if (glyphLineDrawn) |
1231 |
|
{ |
1232 |
|
|
1233 |
|
|
1234 |
0 |
return; |
1235 |
|
} |
1236 |
34070 |
unsetAntialias(g); |
1237 |
34070 |
g.setColor(GLYPHLINE_COLOR); |
1238 |
34070 |
g.fillRect(lastSSX, y + 6 + iconOffset, (x * charWidth) - lastSSX, 2); |
1239 |
|
} |
1240 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 6 |
Complexity Density: 0.86 |
|
1241 |
2800 |
void drawSheetAnnot(Graphics g, Annotation[] row,... |
1242 |
|
|
1243 |
|
int lastSSX, int x, int y, int iconOffset, int startRes, |
1244 |
|
int column, boolean validRes, boolean validEnd) |
1245 |
|
{ |
1246 |
2800 |
if (!validEnd || !validRes || row == null || row[column] == null |
1247 |
|
|| row[column].secondaryStructure != 'E') |
1248 |
|
{ |
1249 |
|
|
1250 |
2797 |
drawGlyphLine(g, lastSSX, x, y, iconOffset); |
1251 |
|
|
1252 |
2797 |
g.setColor(SHEET_COLOUR); |
1253 |
2797 |
fillRect(g, lastSSX, y + 4 + iconOffset, |
1254 |
|
(x * charWidth) - lastSSX - 4, 6); |
1255 |
2797 |
fillPolygon(g, |
1256 |
|
new int[] |
1257 |
|
{ (x * charWidth) - 6, (x * charWidth) - 6, |
1258 |
|
(x * charWidth - 1) }, |
1259 |
|
new int[] |
1260 |
|
{ y + iconOffset + 1, y + 13 + iconOffset, |
1261 |
|
y + 7 + iconOffset }, |
1262 |
|
3); |
1263 |
|
} |
1264 |
|
else |
1265 |
|
{ |
1266 |
3 |
g.setColor(SHEET_COLOUR); |
1267 |
3 |
fillRect(g, lastSSX, y + 4 + iconOffset, (x * charWidth) - lastSSX, |
1268 |
|
6); |
1269 |
|
} |
1270 |
|
} |
1271 |
|
|
|
|
| 52.6% |
Uncovered Elements: 18 (38) |
Complexity: 13 |
Complexity Density: 0.5 |
|
1272 |
505 |
void drawHelixAnnot(Graphics g, Annotation[] row, int lastSSX, int x,... |
1273 |
|
int y, int iconOffset, int startRes, int column, boolean validRes, |
1274 |
|
boolean validEnd) |
1275 |
|
{ |
1276 |
505 |
int sCol = (lastSSX / charWidth) |
1277 |
|
+ hiddenColumns.visibleToAbsoluteColumn(startRes); |
1278 |
505 |
int x1 = lastSSX; |
1279 |
505 |
int x2 = (x * charWidth); |
1280 |
|
|
1281 |
505 |
if (USE_FILL_ROUND_RECT || isVectorRendering()) |
1282 |
|
{ |
1283 |
|
|
1284 |
0 |
drawGlyphLine(g, lastSSX, x, y, iconOffset); |
1285 |
|
|
1286 |
0 |
g.setColor(HELIX_COLOUR); |
1287 |
0 |
setAntialias(g); |
1288 |
0 |
int ofs = charWidth / 2; |
1289 |
|
|
1290 |
|
|
1291 |
0 |
fillRoundRect(g, lastSSX, y + 3 + iconOffset, x2 - x1 - 1, 8, 8, 8); |
1292 |
0 |
if (sCol == 0 || row[sCol - 1] == null |
1293 |
|
|| row[sCol - 1].secondaryStructure != 'H') |
1294 |
|
{ |
1295 |
|
} |
1296 |
|
else |
1297 |
|
{ |
1298 |
0 |
fillRoundRect(g, lastSSX, y + 3 + iconOffset, x2 - x1 - ofs, 8, 0, |
1299 |
|
0); |
1300 |
|
} |
1301 |
0 |
if (!validRes || row[column] == null |
1302 |
|
|| row[column].secondaryStructure != 'H') |
1303 |
|
{ |
1304 |
|
|
1305 |
|
} |
1306 |
|
else |
1307 |
|
{ |
1308 |
0 |
fillRoundRect(g, lastSSX + ofs, y + 3 + iconOffset, x2 - x1 - ofs, |
1309 |
|
8, 0, 0); |
1310 |
|
} |
1311 |
|
|
1312 |
0 |
return; |
1313 |
|
} |
1314 |
|
|
1315 |
505 |
boolean leftEnd = sCol == 0 || row[sCol - 1] == null |
1316 |
|
|| row[sCol - 1].secondaryStructure != 'H'; |
1317 |
505 |
boolean rightEnd = !validRes || row[column] == null |
1318 |
|
|| row[column].secondaryStructure != 'H'; |
1319 |
|
|
1320 |
505 |
if (leftEnd || rightEnd) |
1321 |
|
{ |
1322 |
505 |
drawGlyphLine(g, lastSSX, x, y, iconOffset); |
1323 |
|
} |
1324 |
505 |
g.setColor(HELIX_COLOUR); |
1325 |
|
|
1326 |
505 |
if (leftEnd) |
1327 |
|
{ |
1328 |
505 |
fillArc(g, lastSSX, y + 3 + iconOffset, charWidth, 8, 90, 180); |
1329 |
505 |
x1 += charWidth / 2; |
1330 |
|
} |
1331 |
|
|
1332 |
505 |
if (rightEnd) |
1333 |
|
{ |
1334 |
505 |
fillArc(g, ((x - 1) * charWidth), y + 3 + iconOffset, charWidth, 8, |
1335 |
|
270, 180); |
1336 |
505 |
x2 -= charWidth / 2; |
1337 |
|
} |
1338 |
|
|
1339 |
505 |
fillRect(g, x1, y + 3 + iconOffset, x2 - x1, 8); |
1340 |
|
} |
1341 |
|
|
|
|
| 84.4% |
Uncovered Elements: 12 (77) |
Complexity: 15 |
Complexity Density: 0.28 |
|
1342 |
484 |
void drawLineGraph(Graphics g, AlignmentAnnotation _aa,... |
1343 |
|
Annotation[] aa_annotations, int sRes, int eRes, int y, float min, |
1344 |
|
float max, int graphHeight) |
1345 |
|
{ |
1346 |
484 |
if (sRes > aa_annotations.length) |
1347 |
|
{ |
1348 |
6 |
return; |
1349 |
|
} |
1350 |
478 |
Stroke roundStroke = new BasicStroke(1, BasicStroke.CAP_ROUND, |
1351 |
|
BasicStroke.JOIN_ROUND); |
1352 |
478 |
Stroke squareStroke = new BasicStroke(1, BasicStroke.CAP_SQUARE, |
1353 |
|
BasicStroke.JOIN_MITER); |
1354 |
478 |
Graphics2D g2d = (Graphics2D) g; |
1355 |
478 |
Stroke prevStroke = g2d.getStroke(); |
1356 |
478 |
g2d.setStroke(roundStroke); |
1357 |
|
|
1358 |
478 |
int x = 0; |
1359 |
|
|
1360 |
|
|
1361 |
478 |
if (eRes < endRes) |
1362 |
|
{ |
1363 |
0 |
eRes++; |
1364 |
|
} |
1365 |
|
|
1366 |
478 |
eRes = Math.min(eRes, aa_annotations.length); |
1367 |
|
|
1368 |
478 |
if (sRes == 0) |
1369 |
|
{ |
1370 |
466 |
x++; |
1371 |
|
} |
1372 |
|
|
1373 |
478 |
int y1 = y, y2 = y; |
1374 |
478 |
float range = max - min; |
1375 |
|
|
1376 |
|
|
1377 |
478 |
if (min < 0) |
1378 |
|
{ |
1379 |
0 |
y2 = y - (int) ((0 - min / range) * graphHeight); |
1380 |
|
} |
1381 |
|
|
1382 |
478 |
g.setColor(Color.gray); |
1383 |
478 |
drawLine(g, squareStroke, x * charWidth - charWidth, y2, |
1384 |
|
(eRes - sRes) * charWidth, y2); |
1385 |
|
|
1386 |
478 |
eRes = Math.min(eRes, aa_annotations.length); |
1387 |
|
|
1388 |
478 |
int column; |
1389 |
478 |
int aaMax = aa_annotations.length - 1; |
1390 |
|
|
1391 |
22820 |
while (x < eRes - sRes) |
1392 |
|
{ |
1393 |
22343 |
column = sRes + x; |
1394 |
22343 |
if (hasHiddenColumns) |
1395 |
|
{ |
1396 |
5920 |
column = hiddenColumns.visibleToAbsoluteColumn(column); |
1397 |
|
} |
1398 |
|
|
1399 |
22343 |
if (column > aaMax) |
1400 |
|
{ |
1401 |
0 |
break; |
1402 |
|
} |
1403 |
|
|
1404 |
22343 |
if (aa_annotations[column] == null) |
1405 |
|
{ |
1406 |
7530 |
x++; |
1407 |
7530 |
continue; |
1408 |
|
} |
1409 |
|
|
1410 |
14813 |
if (aa_annotations[column].colour == null) |
1411 |
|
{ |
1412 |
6209 |
g.setColor(Color.black); |
1413 |
|
} |
1414 |
|
else |
1415 |
|
{ |
1416 |
8604 |
g.setColor(aa_annotations[column].colour); |
1417 |
|
} |
1418 |
|
|
1419 |
14813 |
if (aa_annotations[column - 1] == null |
1420 |
|
&& aa_annotations.length > column + 1 |
1421 |
|
&& aa_annotations[column + 1] == null) |
1422 |
|
{ |
1423 |
|
|
1424 |
1528 |
y1 = y - (int) (((aa_annotations[column].value - min) / range) |
1425 |
|
* graphHeight); |
1426 |
1528 |
drawLine(g, x * charWidth + charWidth / 4, y1, |
1427 |
|
x * charWidth + 3 * charWidth / 4, y1); |
1428 |
1528 |
x++; |
1429 |
1528 |
continue; |
1430 |
|
} |
1431 |
|
|
1432 |
13285 |
if (aa_annotations[column - 1] == null) |
1433 |
|
{ |
1434 |
197 |
x++; |
1435 |
197 |
continue; |
1436 |
|
} |
1437 |
|
|
1438 |
13088 |
y1 = y - (int) (((aa_annotations[column - 1].value - min) / range) |
1439 |
|
* graphHeight); |
1440 |
13088 |
y2 = y - (int) (((aa_annotations[column].value - min) / range) |
1441 |
|
* graphHeight); |
1442 |
|
|
1443 |
13088 |
drawLine(g, (x - 1) * charWidth + charWidth / 2, y1, |
1444 |
|
x * charWidth + charWidth / 2, y2); |
1445 |
13087 |
x++; |
1446 |
|
} |
1447 |
|
|
1448 |
477 |
if (_aa.threshold != null) |
1449 |
|
{ |
1450 |
0 |
g.setColor(_aa.threshold.colour); |
1451 |
0 |
Graphics2D g2 = (Graphics2D) g; |
1452 |
0 |
Stroke s = new BasicStroke(1, BasicStroke.CAP_SQUARE, |
1453 |
|
BasicStroke.JOIN_ROUND, 3f, new float[] |
1454 |
|
{ 5f, 3f }, 0f); |
1455 |
|
|
1456 |
0 |
y2 = (int) (y - ((_aa.threshold.value - min) / range) * graphHeight); |
1457 |
0 |
drawLine(g, s, 0, y2, (eRes - sRes) * charWidth, y2); |
1458 |
|
} |
1459 |
477 |
g2d.setStroke(prevStroke); |
1460 |
|
} |
1461 |
|
|
|
|
| 69.3% |
Uncovered Elements: 43 (140) |
Complexity: 27 |
Complexity Density: 0.3 |
|
1462 |
6759 |
@SuppressWarnings("unused")... |
1463 |
|
void drawBarGraph(Graphics g, AlignmentAnnotation _aa, |
1464 |
|
Annotation[] aa_annotations, int sRes, int eRes, float min, |
1465 |
|
float max, int y, boolean renderHistogram, boolean renderProfile, |
1466 |
|
boolean normaliseProfile) |
1467 |
|
{ |
1468 |
6759 |
if (sRes > aa_annotations.length) |
1469 |
|
{ |
1470 |
0 |
return; |
1471 |
|
} |
1472 |
6759 |
Font ofont = g.getFont(); |
1473 |
6759 |
eRes = Math.min(eRes, aa_annotations.length); |
1474 |
|
|
1475 |
6759 |
int x = 0, y1 = y, y2 = y; |
1476 |
|
|
1477 |
6759 |
float range = max - min; |
1478 |
|
|
1479 |
6759 |
if (min < 0) |
1480 |
|
{ |
1481 |
0 |
y2 = y - (int) ((0 - min / (range)) * _aa.graphHeight); |
1482 |
|
} |
1483 |
|
|
1484 |
6759 |
g.setColor(Color.gray); |
1485 |
|
|
1486 |
6759 |
drawLine(g, x, y2, (eRes - sRes) * charWidth, y2); |
1487 |
|
|
1488 |
6759 |
int column; |
1489 |
6759 |
int aaMax = aa_annotations.length - 1; |
1490 |
324548 |
while (x < eRes - sRes) |
1491 |
|
{ |
1492 |
317790 |
column = sRes + x; |
1493 |
317791 |
if (hasHiddenColumns) |
1494 |
|
{ |
1495 |
89269 |
column = hiddenColumns.visibleToAbsoluteColumn(column); |
1496 |
|
} |
1497 |
|
|
1498 |
317791 |
if (column > aaMax) |
1499 |
|
{ |
1500 |
0 |
break; |
1501 |
|
} |
1502 |
|
|
1503 |
317793 |
if (aa_annotations[column] == null) |
1504 |
|
{ |
1505 |
1488 |
x++; |
1506 |
1488 |
continue; |
1507 |
|
} |
1508 |
316305 |
if (aa_annotations[column].colour == null) |
1509 |
|
{ |
1510 |
105058 |
g.setColor(Color.black); |
1511 |
|
} |
1512 |
|
else |
1513 |
|
{ |
1514 |
211248 |
g.setColor(aa_annotations[column].colour); |
1515 |
|
} |
1516 |
|
|
1517 |
316305 |
y1 = y - (int) (((aa_annotations[column].value - min) / (range)) |
1518 |
|
* _aa.graphHeight); |
1519 |
|
|
1520 |
316305 |
if (renderHistogram) |
1521 |
|
{ |
1522 |
316305 |
if (y1 - y2 > 0) |
1523 |
|
{ |
1524 |
0 |
fillRect(g, x * charWidth, y2, charWidth, y1 - y2); |
1525 |
|
} |
1526 |
|
else |
1527 |
|
{ |
1528 |
316306 |
fillRect(g, x * charWidth, y1, charWidth, y2 - y1); |
1529 |
|
} |
1530 |
|
} |
1531 |
|
|
1532 |
316305 |
if (renderProfile) |
1533 |
|
{ |
1534 |
|
|
1535 |
|
|
1536 |
|
|
1537 |
|
|
1538 |
69866 |
int profl[] = getProfileFor(_aa, column); |
1539 |
|
|
1540 |
|
|
1541 |
69866 |
if (profl != null && profl[2] != 0) |
1542 |
|
{ |
1543 |
69866 |
boolean isStructureProfile = profl[0] == AlignmentAnnotation.STRUCTURE_PROFILE; |
1544 |
69866 |
boolean isCdnaProfile = profl[0] == AlignmentAnnotation.CDNA_PROFILE; |
1545 |
69866 |
float ht = normaliseProfile ? y - _aa.graphHeight : y1; |
1546 |
69866 |
final double normaliseFactor = normaliseProfile ? _aa.graphHeight |
1547 |
|
: (y2 - y1); |
1548 |
|
|
1549 |
|
|
1550 |
|
|
1551 |
|
|
1552 |
|
|
1553 |
69866 |
char[] dc = new char[isStructureProfile ? 2 |
1554 |
69866 |
: (isCdnaProfile ? 3 : 1)]; |
1555 |
|
|
1556 |
|
|
1557 |
|
|
1558 |
|
|
1559 |
|
|
1560 |
|
|
1561 |
|
|
1562 |
|
|
1563 |
69866 |
double asc = fm.getAscent(); |
1564 |
69866 |
double dec = fm.getDescent(); |
1565 |
69866 |
double fht = fm.getHeight(); |
1566 |
|
|
1567 |
69866 |
double scale = 1f / (normaliseProfile ? profl[2] : 100f); |
1568 |
|
|
1569 |
|
|
1570 |
|
|
1571 |
|
|
1572 |
|
|
1573 |
|
|
1574 |
69866 |
float ht2 = ht; |
1575 |
|
|
1576 |
|
|
1577 |
200993 |
for (int i = 0, c = 3, last = profl[1]; i < last; i++) |
1578 |
|
{ |
1579 |
|
|
1580 |
131127 |
String s; |
1581 |
131127 |
if (isStructureProfile) |
1582 |
|
{ |
1583 |
|
|
1584 |
0 |
dc[0] = (char) profl[c++]; |
1585 |
0 |
dc[1] = (char) profl[c++]; |
1586 |
0 |
s = new String(dc); |
1587 |
|
} |
1588 |
131127 |
else if (isCdnaProfile) |
1589 |
|
{ |
1590 |
0 |
CodingUtils.decodeCodon2(profl[c++], dc); |
1591 |
0 |
s = new String(dc); |
1592 |
|
} |
1593 |
|
else |
1594 |
|
{ |
1595 |
131127 |
dc[0] = (char) profl[c++]; |
1596 |
131127 |
s = new String(dc); |
1597 |
|
} |
1598 |
|
|
1599 |
|
|
1600 |
131126 |
int percent = profl[c++]; |
1601 |
131126 |
if (percent == 0) |
1602 |
|
{ |
1603 |
|
|
1604 |
0 |
continue; |
1605 |
|
} |
1606 |
131127 |
double newHeight = normaliseFactor * scale * percent; |
1607 |
|
|
1608 |
|
|
1609 |
|
|
1610 |
|
|
1611 |
|
|
1612 |
131127 |
Color colour = null; |
1613 |
131127 |
if (isCdnaProfile) |
1614 |
|
{ |
1615 |
0 |
final String codonTranslation = ResidueProperties |
1616 |
|
.codonTranslate(s); |
1617 |
0 |
colour = profcolour.findColour(codonTranslation.charAt(0), |
1618 |
|
column, null); |
1619 |
|
} |
1620 |
131127 |
if (_aa.label == MessageManager |
1621 |
|
.getString("label.ssconsensus_label")) |
1622 |
|
{ |
1623 |
0 |
colour = AlignmentUtils |
1624 |
|
.getSecondaryStructureAnnotationColour(dc[0]); |
1625 |
|
} |
1626 |
|
else |
1627 |
|
{ |
1628 |
|
|
1629 |
131127 |
colour = profcolour.findColour(dc[0], column, null); |
1630 |
|
|
1631 |
|
} |
1632 |
131127 |
g.setColor(colour == Color.white ? Color.lightGray : colour); |
1633 |
|
|
1634 |
|
|
1635 |
|
|
1636 |
|
|
1637 |
|
|
1638 |
|
|
1639 |
|
|
1640 |
131127 |
double sx = 1f * charWidth / fm.charsWidth(dc, 0, dc.length); |
1641 |
131127 |
double sy = newHeight / asc; |
1642 |
131127 |
double newAsc = asc * sy; |
1643 |
131127 |
double newDec = dec * sy; |
1644 |
|
|
1645 |
|
|
1646 |
|
|
1647 |
|
|
1648 |
|
|
1649 |
|
|
1650 |
131127 |
if (Platform.isJS()) |
1651 |
|
{ |
1652 |
|
|
1653 |
|
|
1654 |
|
|
1655 |
|
|
1656 |
|
|
1657 |
0 |
final int hght = (int) (ht2 + (newAsc - newDec)); |
1658 |
0 |
Graphics2D gg = (Graphics2D) g; |
1659 |
0 |
int xShift = (int) Math.round(x * charWidth / sx); |
1660 |
0 |
int yShift = (int) Math.round(hght / sy); |
1661 |
0 |
gg.transform(AffineTransform.getScaleInstance(sx, sy)); |
1662 |
0 |
gg.drawString(s, xShift, yShift); |
1663 |
0 |
gg.transform( |
1664 |
|
AffineTransform.getScaleInstance(1D / sx, 1D / sy)); |
1665 |
0 |
ht2 += newHeight; |
1666 |
|
} |
1667 |
|
else |
1668 |
|
|
1669 |
|
|
1670 |
|
|
1671 |
|
|
1672 |
|
|
1673 |
|
{ |
1674 |
|
|
1675 |
|
|
1676 |
131127 |
final int hght = (int) (ht + (newAsc - newDec)); |
1677 |
131127 |
Font font = ofont |
1678 |
|
.deriveFont(AffineTransform.getScaleInstance(sx, sy)); |
1679 |
131127 |
g.setFont(font); |
1680 |
131127 |
g.drawChars(dc, 0, dc.length, x * charWidth, hght); |
1681 |
131127 |
g.setFont(ofont); |
1682 |
|
|
1683 |
131127 |
ht += newHeight; |
1684 |
|
} |
1685 |
|
} |
1686 |
|
} |
1687 |
|
} |
1688 |
316300 |
x++; |
1689 |
|
} |
1690 |
6759 |
if (_aa.threshold != null) |
1691 |
|
{ |
1692 |
0 |
g.setColor(_aa.threshold.colour); |
1693 |
0 |
Stroke s = new BasicStroke(1, BasicStroke.CAP_SQUARE, |
1694 |
|
BasicStroke.JOIN_ROUND, 3f, new float[] |
1695 |
|
{ 5f, 3f }, 0f); |
1696 |
|
|
1697 |
0 |
y2 = (int) (y |
1698 |
|
- ((_aa.threshold.value - min) / range) * _aa.graphHeight); |
1699 |
0 |
drawLine(g, s, 0, y2, (eRes - sRes) * charWidth, y2); |
1700 |
|
} |
1701 |
|
} |
1702 |
|
|
1703 |
|
|
|
|
| 0% |
Uncovered Elements: 23 (23) |
Complexity: 5 |
Complexity Density: 0.33 |
|
1704 |
0 |
public void drawGraph(Graphics g, AlignmentAnnotation _aa,... |
1705 |
|
Annotation[] aa_annotations, int width, int y, int sRes, int eRes) |
1706 |
|
{ |
1707 |
0 |
eRes = Math.min(eRes, aa_annotations.length); |
1708 |
0 |
g.setColor(Color.white); |
1709 |
0 |
fillRect(g, 0, 0, width, y); |
1710 |
0 |
g.setColor(new Color(0, 0, 180)); |
1711 |
|
|
1712 |
0 |
int x = 0, height; |
1713 |
|
|
1714 |
0 |
for (int j = sRes; j < eRes; j++) |
1715 |
|
{ |
1716 |
0 |
if (aa_annotations[j] != null) |
1717 |
|
{ |
1718 |
0 |
if (aa_annotations[j].colour == null) |
1719 |
|
{ |
1720 |
0 |
g.setColor(Color.black); |
1721 |
|
} |
1722 |
|
else |
1723 |
|
{ |
1724 |
0 |
g.setColor(aa_annotations[j].colour); |
1725 |
|
} |
1726 |
|
|
1727 |
0 |
height = (int) ((aa_annotations[j].value / _aa.graphMax) * y); |
1728 |
0 |
if (height > y) |
1729 |
|
{ |
1730 |
0 |
height = y; |
1731 |
|
} |
1732 |
|
|
1733 |
0 |
fillRect(g, x, y - height, charWidth, height); |
1734 |
|
} |
1735 |
0 |
x += charWidth; |
1736 |
|
} |
1737 |
|
} |
1738 |
|
|
|
|
| 0% |
Uncovered Elements: 91 (91) |
Complexity: 59 |
Complexity Density: 0.65 |
|
1739 |
0 |
Color getNotCanonicalColor(char lastss)... |
1740 |
|
{ |
1741 |
0 |
switch (lastss) |
1742 |
|
{ |
1743 |
0 |
case '{': |
1744 |
0 |
case '}': |
1745 |
0 |
return new Color(255, 125, 5); |
1746 |
|
|
1747 |
0 |
case '[': |
1748 |
0 |
case ']': |
1749 |
0 |
return new Color(245, 115, 10); |
1750 |
|
|
1751 |
0 |
case '>': |
1752 |
0 |
case '<': |
1753 |
0 |
return new Color(235, 135, 15); |
1754 |
|
|
1755 |
0 |
case 'A': |
1756 |
0 |
case 'a': |
1757 |
0 |
return new Color(225, 105, 20); |
1758 |
|
|
1759 |
0 |
case 'B': |
1760 |
0 |
case 'b': |
1761 |
0 |
return new Color(215, 145, 30); |
1762 |
|
|
1763 |
0 |
case 'C': |
1764 |
0 |
case 'c': |
1765 |
0 |
return new Color(205, 95, 35); |
1766 |
|
|
1767 |
0 |
case 'D': |
1768 |
0 |
case 'd': |
1769 |
0 |
return new Color(195, 155, 45); |
1770 |
|
|
1771 |
0 |
case 'E': |
1772 |
0 |
case 'e': |
1773 |
0 |
return new Color(185, 85, 55); |
1774 |
|
|
1775 |
0 |
case 'F': |
1776 |
0 |
case 'f': |
1777 |
0 |
return new Color(175, 165, 65); |
1778 |
|
|
1779 |
0 |
case 'G': |
1780 |
0 |
case 'g': |
1781 |
0 |
return new Color(170, 75, 75); |
1782 |
|
|
1783 |
0 |
case 'H': |
1784 |
0 |
case 'h': |
1785 |
0 |
return new Color(160, 175, 85); |
1786 |
|
|
1787 |
0 |
case 'I': |
1788 |
0 |
case 'i': |
1789 |
0 |
return new Color(150, 65, 95); |
1790 |
|
|
1791 |
0 |
case 'J': |
1792 |
0 |
case 'j': |
1793 |
0 |
return new Color(140, 185, 105); |
1794 |
|
|
1795 |
0 |
case 'K': |
1796 |
0 |
case 'k': |
1797 |
0 |
return new Color(130, 55, 110); |
1798 |
|
|
1799 |
0 |
case 'L': |
1800 |
0 |
case 'l': |
1801 |
0 |
return new Color(120, 195, 120); |
1802 |
|
|
1803 |
0 |
case 'M': |
1804 |
0 |
case 'm': |
1805 |
0 |
return new Color(110, 45, 130); |
1806 |
|
|
1807 |
0 |
case 'N': |
1808 |
0 |
case 'n': |
1809 |
0 |
return new Color(100, 205, 140); |
1810 |
|
|
1811 |
0 |
case 'O': |
1812 |
0 |
case 'o': |
1813 |
0 |
return new Color(90, 35, 150); |
1814 |
|
|
1815 |
0 |
case 'P': |
1816 |
0 |
case 'p': |
1817 |
0 |
return new Color(85, 215, 160); |
1818 |
|
|
1819 |
0 |
case 'Q': |
1820 |
0 |
case 'q': |
1821 |
0 |
return new Color(75, 25, 170); |
1822 |
|
|
1823 |
0 |
case 'R': |
1824 |
0 |
case 'r': |
1825 |
0 |
return new Color(65, 225, 180); |
1826 |
|
|
1827 |
0 |
case 'S': |
1828 |
0 |
case 's': |
1829 |
0 |
return new Color(55, 15, 185); |
1830 |
|
|
1831 |
0 |
case 'T': |
1832 |
0 |
case 't': |
1833 |
0 |
return new Color(45, 235, 195); |
1834 |
|
|
1835 |
0 |
case 'U': |
1836 |
0 |
case 'u': |
1837 |
0 |
return new Color(35, 5, 205); |
1838 |
|
|
1839 |
0 |
case 'V': |
1840 |
0 |
case 'v': |
1841 |
0 |
return new Color(25, 245, 215); |
1842 |
|
|
1843 |
0 |
case 'W': |
1844 |
0 |
case 'w': |
1845 |
0 |
return new Color(15, 0, 225); |
1846 |
|
|
1847 |
0 |
case 'X': |
1848 |
0 |
case 'x': |
1849 |
0 |
return new Color(10, 255, 235); |
1850 |
|
|
1851 |
0 |
case 'Y': |
1852 |
0 |
case 'y': |
1853 |
0 |
return new Color(5, 150, 245); |
1854 |
|
|
1855 |
0 |
case 'Z': |
1856 |
0 |
case 'z': |
1857 |
0 |
return new Color(0, 80, 255); |
1858 |
|
|
1859 |
0 |
default: |
1860 |
0 |
Console.info("This is not a interaction : " + lastss); |
1861 |
0 |
return null; |
1862 |
|
|
1863 |
|
} |
1864 |
|
} |
1865 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1866 |
2797 |
private void fillPolygon(Graphics g, int[] xpoints, int[] ypoints, int n)... |
1867 |
|
{ |
1868 |
2797 |
setAntialias(g); |
1869 |
2797 |
g.fillPolygon(xpoints, ypoints, n); |
1870 |
|
} |
1871 |
|
|
1872 |
|
|
1873 |
|
|
1874 |
|
|
1875 |
|
|
1876 |
|
|
1877 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1878 |
319611 |
private void fillRect(Graphics g, int a, int b, int c, int d)... |
1879 |
|
{ |
1880 |
319611 |
unsetAntialias(g); |
1881 |
319608 |
g.fillRect(a, b, c, d); |
1882 |
|
} |
1883 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1884 |
0 |
private void fillRoundRect(Graphics g, int a, int b, int c, int d, int e,... |
1885 |
|
int f) |
1886 |
|
{ |
1887 |
0 |
setAntialias(g); |
1888 |
0 |
g.fillRoundRect(a, b, c, d, e, f); |
1889 |
|
} |
1890 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1891 |
1010 |
private void fillArc(Graphics g, int a, int b, int c, int d, int e, int f)... |
1892 |
|
{ |
1893 |
1010 |
setAntialias(g); |
1894 |
1010 |
g.fillArc(a, b, c, d, e, f); |
1895 |
|
} |
1896 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
1897 |
478 |
private void drawLine(Graphics g, Stroke s, int a, int b, int c, int d)... |
1898 |
|
{ |
1899 |
478 |
Graphics2D g2d = (Graphics2D) g; |
1900 |
478 |
Stroke p = g2d.getStroke(); |
1901 |
478 |
g2d.setStroke(s); |
1902 |
478 |
drawLine(g, a, b, c, d); |
1903 |
478 |
g2d.setStroke(p); |
1904 |
|
} |
1905 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1906 |
21853 |
private void drawLine(Graphics g, int a, int b, int c, int d)... |
1907 |
|
{ |
1908 |
21853 |
setAntialias(g); |
1909 |
21853 |
g.drawLine(a, b, c, d); |
1910 |
|
} |
1911 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
1912 |
272099 |
private void setAntialias(Graphics g)... |
1913 |
|
{ |
1914 |
272099 |
if (isVectorRendering()) |
1915 |
|
{ |
1916 |
|
|
1917 |
6650 |
return; |
1918 |
|
} |
1919 |
265449 |
if (Cache.getDefault("ANTI_ALIAS", true)) |
1920 |
|
{ |
1921 |
46014 |
Graphics2D g2d = (Graphics2D) g; |
1922 |
46014 |
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, |
1923 |
|
RenderingHints.VALUE_ANTIALIAS_ON); |
1924 |
|
} |
1925 |
|
} |
1926 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
1927 |
768457 |
private void unsetAntialias(Graphics g)... |
1928 |
|
{ |
1929 |
768459 |
if (isVectorRendering()) |
1930 |
|
{ |
1931 |
|
|
1932 |
17584 |
return; |
1933 |
|
} |
1934 |
750875 |
Graphics2D g2d = (Graphics2D) g; |
1935 |
750876 |
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, |
1936 |
|
RenderingHints.VALUE_ANTIALIAS_OFF); |
1937 |
|
} |
1938 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1939 |
14 |
public void setVectorRendering(boolean b)... |
1940 |
|
{ |
1941 |
14 |
renderingVectors = b; |
1942 |
|
} |
1943 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1944 |
1071804 |
public boolean isVectorRendering()... |
1945 |
|
{ |
1946 |
1071803 |
return renderingVectors; |
1947 |
|
} |
1948 |
|
} |