// transparency of hidden cols/seqs overlay
private final float TRANSPARENCY = 0.5f;
- private final Color HIDDEN_COLOUR = Color.DARK_GRAY.darker();
-
public static final String UPDATE = "OverviewUpdate";
private static final int MAX_PROGRESS = 100;
private OverviewResColourFinder resColFinder;
public OverviewRenderer(FeatureRenderer fr, OverviewDimensions od,
- AlignmentI alignment,
- ResidueShaderI resshader, OverviewResColourFinder colFinder)
+ AlignmentI alignment, ResidueShaderI resshader,
+ OverviewResColourFinder colFinder)
{
finder = new FeatureColourFinder(fr);
resColFinder = colFinder;
int totalPixels = miniMe.getWidth() * alignmentHeight;
int lastRowUpdate = 0;
+ int lastUpdate = 0;
changeSupport.firePropertyChange(UPDATE, -1, 0);
for (int alignmentRow : rows)
{
break;
}
-
+
// get details of this alignment row
SequenceI seq = rows.getSequence(alignmentRow);
// calculate where this row extends to in pixels
int endRow = Math.min(Math.round((seqIndex + 1) * pixelsPerSeq) - 1,
miniMe.getHeight() - 1);
-
+
int colIndex = 0;
int pixelCol = 0;
for (int alignmentCol : cols)
{
break;
}
-
+
// calculate where this column extends to in pixels
int endCol = Math.min(Math.round((colIndex + 1) * pixelsPerCol) - 1,
miniMe.getWidth() - 1);
-
+
// don't do expensive colour determination if we're not going to use it
// NB this is important to avoid performance issues in the overview
// panel
if (pixelCol <= endCol)
{
rgbcolor = getColumnColourFromSequence(allGroups, seq,
- alignmentCol, finder);
-
+ alignmentCol);
+
// fill in the appropriate number of pixels
for (int row = pixelRow; row <= endRow; ++row)
{
}
}
- sendProgressUpdate((pixelCol + 1) * (endRow - pixelRow),
- totalPixels, lastRowUpdate);
+ // store last update value
+ lastUpdate = sendProgressUpdate(
+ (pixelCol + 1) * (endRow - pixelRow), totalPixels,
+ lastRowUpdate, lastUpdate);
pixelCol = endCol + 1;
}
if (pixelRow != endRow + 1)
{
- lastRowUpdate = sendProgressUpdate(endRow + 1, alignmentHeight, 0);
+ // store row offset and last update value
+ lastRowUpdate = sendProgressUpdate(endRow + 1, alignmentHeight, 0,
+ lastUpdate);
+ lastUpdate = lastRowUpdate;
pixelRow = endRow + 1;
}
seqIndex++;
// final update to progress bar if present
if (redraw)
{
- sendProgressUpdate(pixelRow - 1, alignmentHeight, 0);
+ sendProgressUpdate(pixelRow - 1, alignmentHeight, 0, 0);
}
else
{
- sendProgressUpdate(alignmentHeight, miniMe.getHeight(), 0);
+ sendProgressUpdate(alignmentHeight, miniMe.getHeight(), 0, 0);
}
return miniMe;
}
/*
* Calculate progress update value and fire event
+ * @param rowOffset number of rows to offset calculation by
+ * @return new rowOffset - return value only to be used when at end of a row
*/
- private int sendProgressUpdate(int position, int maximum, int offset)
+ private int sendProgressUpdate(int position, int maximum, int rowOffset,
+ int lastUpdate)
{
- int newUpdate = offset
+ int newUpdate = rowOffset
+ Math.round(MAX_PROGRESS * ((float) position / maximum));
- if (newUpdate > offset)
+ if (newUpdate > lastUpdate)
{
- changeSupport.firePropertyChange(UPDATE, offset, newUpdate);
+ changeSupport.firePropertyChange(UPDATE, rowOffset, newUpdate);
return newUpdate;
}
- return offset;
+ return newUpdate;
}
/*
- * Find the colour of a sequence at a specified column position
+ * Find the RGB value of the colour of a sequence at a specified column position
*
* @param seq
* sequence to get colour for
* @param lastcol
* column position to get colour for
- * @param fcfinder
- * FeatureColourFinder to use
* @return colour of sequence at this position, as RGB
*/
- private int getColumnColourFromSequence(SequenceGroup[] allGroups,
- jalview.datamodel.SequenceI seq,
- int lastcol, FeatureColourFinder fcfinder)
+ int getColumnColourFromSequence(SequenceGroup[] allGroups, SequenceI seq,
+ int lastcol)
{
- Color color = Color.white;
+ Color color = resColFinder.gapColour;
if ((seq != null) && (seq.getLength() > lastcol))
{
color = resColFinder.getResidueColour(true, shader, allGroups, seq,
- lastcol,
- fcfinder);
+ lastcol, finder);
}
return color.getRGB();
Graphics2D g2d = (Graphics2D) hiddenImage.getGraphics();
// set background to transparent
- g2d.setComposite(AlphaComposite.Clear);
- g2d.fillRect(0, 0, width, height);
+ // g2d.setComposite(AlphaComposite.Clear);
+ // g2d.fillRect(0, 0, width, height);
// set next colour to opaque
g2d.setComposite(AlphaComposite.Src);
* the graphics object to draw on
* @param anno
* alignment annotation information
- * @param charWidth
- * alignment character width value
* @param y
* y-position for the annotation graph
* @param cols
* the collection of columns used in the overview panel
*/
- public void drawGraph(Graphics g, AlignmentAnnotation anno, int charWidth,
- int y, AlignmentColsCollectionI cols)
+ public void drawGraph(Graphics g, AlignmentAnnotation anno, int y,
+ AlignmentColsCollectionI cols)
{
Annotation[] annotations = anno.annotations;
g.setColor(Color.white);