- /*
- * Build the overview panel image
- */
- private void buildImage(float sampleRow, float sampleCol)
- {
- int lastcol = -1;
- int lastrow = -1;
- int color = Color.white.getRGB();
-
- SequenceI seq = null;
-
- final boolean 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
- for (int row = 0; row < od.getSequencesHeight() && !resizeAgain; row++)
- {
- boolean doCopy = true;
- int currentrow = (int) (row * sampleRow);
- if (currentrow != lastrow)
- {
- doCopy = false;
-
- lastrow = currentrow;
-
- // get the sequence which would be at alignment index 'lastrow' if no
- // rows were hidden, and determine whether it is hidden or not
- hiddenRow = av.getAlignment().isHidden(lastrow);
- seq = av.getAlignment().getSequenceAtAbsoluteIndex(lastrow);
- }
-
- for (int col = 0; col < od.getWidth() && !resizeAgain; col++)
- {
- if (doCopy)
- {
- color = miniMe.getRGB(col, row - 1);
- }
- else if ((int) (col * sampleCol) != lastcol
- || (int) (row * sampleRow) != lastrow)
- {
- lastcol = (int) (col * sampleCol);
- color = getColumnColourFromSequence(seq, hiddenRow, hasHiddenCols,
- lastcol);
- }
- // else we just use the color we already have , so don't need to set it
-
- miniMe.setRGB(col, row, color);
- }
- }
- }
-
- /*
- * Find the colour of a sequence at a specified column position
- */
- private int getColumnColourFromSequence(jalview.datamodel.SequenceI seq,
- boolean hiddenRow, boolean hasHiddenCols, int lastcol)
- {
- int color;
-
- if (seq == null)
- {
- color = Color.white.getRGB();
- }
- else if (seq.getLength() > lastcol)
- {
- color = sr.getResidueBoxColour(seq, lastcol).getRGB();
-
- if (av.isShowSequenceFeatures())
- {
- color = fr.findFeatureColour(color, seq, lastcol);
- }
- }
- else
- {
- color = Color.white.getRGB();
- }
-
- if (hiddenRow
- || (hasHiddenCols && !av.getColumnSelection()
- .isVisible(lastcol)))
- {
- color = new Color(color).darker().darker().getRGB();
- }
-
- return color;
- }
-