-
- int alwidth = av.getAlignment().getWidth();
- int alheight = av.getAlignment().getHeight()
- + av.getAlignment().getHiddenSequences().getSize();
-
- setPreferredSize(new Dimension(width, sequencesHeight + graphHeight));
-
- int fullsizeWidth = alwidth * av.getCharWidth();
- int fullsizeHeight = alheight * av.getCharHeight();
-
- scalew = (float) width / (float) fullsizeWidth;
- scaleh = (float) sequencesHeight / (float) fullsizeHeight;
-
- miniMe = new BufferedImage(width, sequencesHeight + graphHeight,
- BufferedImage.TYPE_INT_RGB);
-
- Graphics mg = miniMe.getGraphics();
- mg.setColor(Color.orange);
- mg.fillRect(0, 0, width, miniMe.getHeight());
-
- float sampleCol = (float) alwidth / (float) width;
- float sampleRow = (float) alheight / (float) sequencesHeight;
-
- int lastcol = -1, lastrow = -1;
- Color color = Color.white;
- int row, col;
- jalview.datamodel.SequenceI seq;
- final boolean hasHiddenRows = av.hasHiddenRows(), hasHiddenCols = av
- .hasHiddenColumns();
- boolean hiddenRow = false;
- // get hidden row and hidden column map once at beginning.
- // clone featureRenderer settings to avoid race conditions... if state is
- // updated just need to refresh again
-
- FeatureColourFinder finder = new FeatureColourFinder(fr);
-
- for (row = 0; row < sequencesHeight; row++)
- {
- if (resizeAgain)
- {
- break;
- }
- if ((int) (row * sampleRow) == lastrow)
- {
- // No need to recalculate the colours,
- // Just copy from the row above
- for (col = 0; col < width; col++)
- {
- if (resizeAgain)
- {
- break;
- }
- miniMe.setRGB(col, row, miniMe.getRGB(col, row - 1));
- }
- continue;
- }
-
- lastrow = (int) (row * sampleRow);
-
- hiddenRow = false;
- if (hasHiddenRows)
- {
- seq = av.getAlignment().getHiddenSequences()
- .getHiddenSequence(lastrow);
- if (seq == null)
- {
- int index = av.getAlignment().getHiddenSequences()
- .findIndexWithoutHiddenSeqs(lastrow);
-
- seq = av.getAlignment().getSequenceAt(index);
- }
- else
- {
- hiddenRow = true;
- }
- }
- else
- {
- seq = av.getAlignment().getSequenceAt(lastrow);
- }
-
- if (seq == null)
- {
- System.out.println(lastrow + " null");
- continue;
- }
-
- for (col = 0; col < width; col++)
- {
- if (resizeAgain)
- {
- break;
- }
- if ((int) (col * sampleCol) == lastcol
- && (int) (row * sampleRow) == lastrow)
- {
- miniMe.setRGB(col, row, color.getRGB());
- continue;
- }
-
- lastcol = (int) (col * sampleCol);
-
- if (seq.getLength() > lastcol)
- {
- color = sr.getResidueBoxColour(seq, lastcol);
-
- if (av.isShowSequenceFeatures())
- {
- color = finder.findFeatureColour(color, seq, lastcol);
- }
- }
- else
- {
- color = Color.WHITE;
- }
-
- if (hiddenRow
- || (hasHiddenCols && !av.getColumnSelection().isVisible(
- lastcol)))
- {
- color = color.darker().darker();
- }
-
- miniMe.setRGB(col, row, color.getRGB());
-
- }
- }
-
- if (av.getAlignmentConservationAnnotation() != null)
- {
- renderer.updateFromAlignViewport(av);
- for (col = 0; col < width; col++)
- {
- if (resizeAgain)
- {
- break;
- }
- lastcol = (int) (col * sampleCol);
- {
- mg.translate(col, sequencesHeight);
- renderer.drawGraph(mg, av.getAlignmentConservationAnnotation(),
- av.getAlignmentConservationAnnotation().annotations,
- (int) (sampleCol) + 1, graphHeight,
- (int) (col * sampleCol), (int) (col * sampleCol) + 1);
- mg.translate(-col, -sequencesHeight);
- }
- }
- }
- System.gc();
-
- resizing = false;
-
- if (resizeAgain)
- {
- resizeAgain = false;
- updateOverviewImage();
- }
- else
- {
- lastMiniMe = miniMe;
- }
-
- setBoxPosition();