1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.appletgui; |
22 |
|
|
23 |
|
import jalview.renderer.OverviewRenderer; |
24 |
|
import jalview.renderer.OverviewResColourFinder; |
25 |
|
import jalview.viewmodel.OverviewDimensions; |
26 |
|
|
27 |
|
import java.awt.Color; |
28 |
|
import java.awt.Component; |
29 |
|
import java.awt.Dimension; |
30 |
|
import java.awt.Frame; |
31 |
|
import java.awt.Graphics; |
32 |
|
import java.awt.Image; |
33 |
|
|
|
|
| 0% |
Uncovered Elements: 57 (57) |
Complexity: 13 |
Complexity Density: 0.34 |
|
34 |
|
public class OverviewCanvas extends Component |
35 |
|
{ |
36 |
|
|
37 |
|
|
38 |
|
private volatile boolean restart = false; |
39 |
|
|
40 |
|
private volatile boolean updaterunning = false; |
41 |
|
|
42 |
|
private OverviewDimensions od; |
43 |
|
|
44 |
|
private OverviewRenderer or = null; |
45 |
|
|
46 |
|
private Image miniMe; |
47 |
|
|
48 |
|
private Image offscreen; |
49 |
|
|
50 |
|
private AlignViewport av; |
51 |
|
|
52 |
|
private jalview.renderer.seqfeatures.FeatureRenderer fr; |
53 |
|
|
54 |
|
private Frame nullFrame; |
55 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
56 |
0 |
public OverviewCanvas(OverviewDimensions overviewDims,... |
57 |
|
AlignViewport alignvp) |
58 |
|
{ |
59 |
0 |
od = overviewDims; |
60 |
0 |
av = alignvp; |
61 |
|
|
62 |
0 |
nullFrame = new Frame(); |
63 |
0 |
nullFrame.addNotify(); |
64 |
|
|
65 |
0 |
fr = new jalview.renderer.seqfeatures.FeatureRenderer(av); |
66 |
|
} |
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
|
71 |
|
|
72 |
|
@param |
73 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
74 |
0 |
public void resetOviewDims(OverviewDimensions overviewDims)... |
75 |
|
{ |
76 |
0 |
od = overviewDims; |
77 |
|
} |
78 |
|
|
79 |
|
|
80 |
|
|
81 |
|
|
82 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 3 |
Complexity Density: 0.43 |
|
83 |
0 |
public boolean restartDraw()... |
84 |
|
{ |
85 |
0 |
synchronized (this) |
86 |
|
{ |
87 |
0 |
if (updaterunning) |
88 |
|
{ |
89 |
0 |
restart = true; |
90 |
0 |
if (or != null) |
91 |
|
{ |
92 |
0 |
or.setRedraw(true); |
93 |
|
} |
94 |
|
} |
95 |
|
else |
96 |
|
{ |
97 |
0 |
updaterunning = true; |
98 |
|
} |
99 |
0 |
return restart; |
100 |
|
} |
101 |
|
} |
102 |
|
|
|
|
| 0% |
Uncovered Elements: 23 (23) |
Complexity: 4 |
Complexity Density: 0.24 |
|
103 |
0 |
public void draw(boolean showSequenceFeatures, boolean showAnnotation,... |
104 |
|
FeatureRenderer transferRenderer) |
105 |
|
{ |
106 |
0 |
miniMe = null; |
107 |
|
|
108 |
0 |
if (showSequenceFeatures) |
109 |
|
{ |
110 |
0 |
fr.transferSettings(transferRenderer); |
111 |
|
} |
112 |
|
|
113 |
0 |
setPreferredSize(new Dimension(od.getWidth(), od.getHeight())); |
114 |
|
|
115 |
0 |
or = new OverviewRenderer(fr, od, av.getAlignment(), |
116 |
|
av.getResidueShading(), new OverviewResColourFinder()); |
117 |
0 |
miniMe = nullFrame.createImage(od.getWidth(), od.getHeight()); |
118 |
0 |
offscreen = nullFrame.createImage(od.getWidth(), od.getHeight()); |
119 |
|
|
120 |
0 |
miniMe = or.draw(od.getRows(av.getAlignment()), |
121 |
|
od.getColumns(av.getAlignment())); |
122 |
|
|
123 |
0 |
Graphics mg = miniMe.getGraphics(); |
124 |
|
|
125 |
|
|
126 |
|
|
127 |
0 |
if (showAnnotation) |
128 |
|
{ |
129 |
0 |
mg.translate(0, od.getSequencesHeight()); |
130 |
0 |
or.drawGraph(mg, av.getAlignmentConservationAnnotation(), |
131 |
|
od.getGraphHeight(), od.getColumns(av.getAlignment())); |
132 |
0 |
mg.translate(0, -od.getSequencesHeight()); |
133 |
|
} |
134 |
|
|
135 |
0 |
if (restart) |
136 |
|
{ |
137 |
0 |
restart = false; |
138 |
0 |
draw(showSequenceFeatures, showAnnotation, transferRenderer); |
139 |
|
} |
140 |
|
else |
141 |
|
{ |
142 |
0 |
updaterunning = false; |
143 |
|
} |
144 |
|
} |
145 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
146 |
0 |
@Override... |
147 |
|
public void update(Graphics g) |
148 |
|
{ |
149 |
0 |
paint(g); |
150 |
|
} |
151 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
152 |
0 |
@Override... |
153 |
|
public void paint(Graphics g) |
154 |
|
{ |
155 |
0 |
Graphics og = offscreen.getGraphics(); |
156 |
0 |
if (miniMe != null) |
157 |
|
{ |
158 |
0 |
og.drawImage(miniMe, 0, 0, this); |
159 |
0 |
og.setColor(Color.red); |
160 |
0 |
od.drawBox(og); |
161 |
0 |
g.drawImage(offscreen, 0, 0, this); |
162 |
|
} |
163 |
|
} |
164 |
|
|
165 |
|
|
166 |
|
|
167 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
168 |
0 |
void dispose()... |
169 |
|
{ |
170 |
0 |
od = null; |
171 |
|
} |
172 |
|
|
173 |
|
} |