* Find the colour of a sequence at a specified column position
*/
private int getColumnColourFromSequence(jalview.datamodel.SequenceI seq,
- boolean isHidden, int lastcol, FeatureColourFinder finder)
+ boolean isHidden, int lastcol, FeatureColourFinder fcfinder)
{
Color color = Color.white;
if ((seq != null) && (seq.getLength() > lastcol))
{
- color = sr.getResidueColour(seq, lastcol, finder);
+ color = sr.getResidueColour(seq, lastcol, fcfinder);
}
if (isHidden)
return color.getRGB();
}
- public void drawGraph(Graphics g, AlignmentAnnotation _aa, int charWidth,
+ /**
+ * Draw the alignment annotation in the overview panel
+ *
+ * @param g
+ * 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)
{
- Annotation[] aa_annotations = _aa.annotations;
+ Annotation[] annotations = anno.annotations;
g.setColor(Color.white);
g.fillRect(0, 0, miniMe.getWidth(), y);
- // g.setColor(new Color(0, 0, 180));
int height;
-
int colIndex = 0;
int pixelCol = 0;
for (int alignmentCol : cols)
{
- int endCol = Math.min(Math.round((colIndex + 1) * pixelsPerCol) - 1,
- miniMe.getWidth() - 1);
-
- if (alignmentCol < aa_annotations.length
- && aa_annotations[alignmentCol] != null)
+ if (alignmentCol >= annotations.length)
{
- if (aa_annotations[alignmentCol].colour == null)
- {
- g.setColor(Color.black);
- }
- else
- {
- g.setColor(aa_annotations[alignmentCol].colour);
- }
+ break; // no more annotations to draw here
+ }
+ else
+ {
+ int endCol = Math.min(
+ Math.round((colIndex + 1) * pixelsPerCol) - 1,
+ miniMe.getWidth() - 1);
- height = (int) ((aa_annotations[alignmentCol].value / _aa.graphMax) * y);
- if (height > y)
+ if (annotations[alignmentCol] != null)
{
- height = y;
- }
+ if (annotations[alignmentCol].colour == null)
+ {
+ g.setColor(Color.black);
+ }
+ else
+ {
+ g.setColor(annotations[alignmentCol].colour);
+ }
- g.fillRect(pixelCol, y - height, endCol - pixelCol + 1, height);
+ height = (int) ((annotations[alignmentCol].value / anno.graphMax) * y);
+ if (height > y)
+ {
+ height = y;
+ }
+
+ g.fillRect(pixelCol, y - height, endCol - pixelCol + 1, height);
+ }
+ pixelCol = endCol + 1;
+ colIndex++;
}
- pixelCol = endCol + 1;
- colIndex++;
}
}
}