+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
package jalview.renderer;
import jalview.analysis.AAFrequency;
/**
* Render the annotation rows associated with an alignment.
+ *
* @param annotPanel
* container frame
* @param av
* first column that will be drawn
* @param endRes
* last column that will be drawn
- * @return true if the fadedImage was used for any alignment annotation rows currently being calculated
+ * @return true if the fadedImage was used for any alignment annotation rows
+ * currently being calculated
*/
- public boolean drawComponent(AwtRenderPanelI annotPanel, AlignViewportI av,
- Graphics g, int activeRow, int startRes, int endRes)
+ public boolean drawComponent(AwtRenderPanelI annotPanel,
+ AlignViewportI av, Graphics g, int activeRow, int startRes,
+ int endRes)
{
- boolean usedFaded=false;
+ boolean usedFaded = false;
// NOTES:
// AnnotationPanel needs to implement: ImageObserver, access to
// AlignViewport
for (int i = 0; i < aa.length; i++)
{
AlignmentAnnotation row = aa[i];
- Annotation[] row_annotations=row.annotations;
+ Annotation[] row_annotations = row.annotations;
if (!row.visible)
{
continue;
if (row.autoCalculated && av.isCalculationInProgress(row))
{
y += charHeight;
- usedFaded=true;
+ usedFaded = true;
g.drawImage(fadedImage, 0, y - row.height, imgWidth, y, 0, y
- row.height, imgWidth, y, annotationPanel);
g.setColor(Color.black);
/*
* else if (annotationPanel.av.updatingConservation &&
* aa[i].label.equals("Conservation")) {
- *
+ *
* y += charHeight; g.drawImage(annotationPanel.fadedImage, 0, y -
* row.height, annotationPanel.imgWidth, y, 0, y - row.height,
* annotationPanel.imgWidth, y, annotationPanel);
- *
+ *
* g.setColor(Color.black); //
* g.drawString("Calculating Conservation.....",20, y-row.height/2);
- *
+ *
* continue; } else if (annotationPanel.av.updatingConservation &&
* aa[i].label.equals("Quality")) {
- *
+ *
* y += charHeight; g.drawImage(annotationPanel.fadedImage, 0, y -
* row.height, annotationPanel.imgWidth, y, 0, y - row.height,
* annotationPanel.imgWidth, y, annotationPanel); g.setColor(Color.black);
* // / g.drawString("Calculating Quality....",20, y-row.height/2);
- *
+ *
* continue; }
*/
// first pass sets up state for drawing continuation from left-hand column
switch (lastSS)
{
case 'H':
- drawHelixAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes,
- column, validRes, validEnd);
+ drawHelixAnnot(g, row_annotations, lastSSX, x, y,
+ iconOffset, startRes, column, validRes, validEnd);
break;
case 'E':
- drawSheetAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes,
- column, validRes, validEnd);
+ drawSheetAnnot(g, row_annotations, lastSSX, x, y,
+ iconOffset, startRes, column, validRes, validEnd);
break;
case 'S': // Stem case for RNA secondary structure
case 's': // and opposite direction
- drawStemAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes,
- column, validRes, validEnd);
+ drawStemAnnot(g, row_annotations, lastSSX, x, y,
+ iconOffset, startRes, column, validRes, validEnd);
break;
default:
switch (lastSS)
{
case 'H':
- drawHelixAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes,
- column, validRes, validEnd);
+ drawHelixAnnot(g, row_annotations, lastSSX, x, y, iconOffset,
+ startRes, column, validRes, validEnd);
break;
case 'E':
- drawSheetAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes,
- column, validRes, validEnd);
+ drawSheetAnnot(g, row_annotations, lastSSX, x, y, iconOffset,
+ startRes, column, validRes, validEnd);
break;
case 's':
case 'S': // Stem case for RNA secondary structure
- drawStemAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes,
- column, validRes, validEnd);
+ drawStemAnnot(g, row_annotations, lastSSX, x, y, iconOffset,
+ startRes, column, validRes, validEnd);
break;
default:
- drawGlyphLine(g, row_annotations, lastSSX, x, y, iconOffset, startRes,
- column, validRes, validEnd);
+ drawGlyphLine(g, row_annotations, lastSSX, x, y, iconOffset,
+ startRes, column, validRes, validEnd);
break;
}
}
{
if (aa[gg].graphGroup == row.graphGroup)
{
- drawLineGraph(g, aa[gg], aa[gg].annotations, startRes, endRes, y, groupmin,
- groupmax, row.graphHeight);
+ drawLineGraph(g, aa[gg], aa[gg].annotations, startRes,
+ endRes, y, groupmin, groupmax, row.graphHeight);
}
}
}
else
{
- drawLineGraph(g, row, row_annotations, startRes, endRes, y, row.graphMin,
- row.graphMax, row.graphHeight);
+ drawLineGraph(g, row, row_annotations, startRes, endRes, y,
+ row.graphMin, row.graphMax, row.graphHeight);
}
}
else if (row.graph == AlignmentAnnotation.BAR_GRAPH)
{
- drawBarGraph(g, row, row_annotations, startRes, endRes, row.graphMin,
- row.graphMax, y);
+ drawBarGraph(g, row, row_annotations, startRes, endRes,
+ row.graphMin, row.graphMax, y);
}
}
private final Color STEM_COLOUR = Color.blue;
- public void drawGlyphLine(Graphics g, Annotation[] row,
- int lastSSX, int x, int y, int iconOffset, int startRes,
- int column, boolean validRes, boolean validEnd)
+ public void drawGlyphLine(Graphics g, Annotation[] row, int lastSSX,
+ int x, int y, int iconOffset, int startRes, int column,
+ boolean validRes, boolean validEnd)
{
g.setColor(GLYPHLINE_COLOR);
g.fillRect(lastSSX, y + 6 + iconOffset, (x * charWidth) - lastSSX, 2);
}
- public void drawSheetAnnot(Graphics g, Annotation[] row,
- int lastSSX, int x, int y, int iconOffset, int startRes,
- int column, boolean validRes, boolean validEnd)
+ public void drawSheetAnnot(Graphics g, Annotation[] row, int lastSSX,
+ int x, int y, int iconOffset, int startRes, int column,
+ boolean validRes, boolean validEnd)
{
g.setColor(SHEET_COLOUR);
- if (!validEnd || !validRes || row==null || row[column] == null
+ if (!validEnd || !validRes || row == null || row[column] == null
|| row[column].secondaryStructure != 'E')
{
g.fillRect(lastSSX, y + 4 + iconOffset,
}
- public void drawHelixAnnot(Graphics g, Annotation[] row,
- int lastSSX, int x, int y, int iconOffset, int startRes,
- int column, boolean validRes, boolean validEnd)
+ public void drawHelixAnnot(Graphics g, Annotation[] row, int lastSSX,
+ int x, int y, int iconOffset, int startRes, int column,
+ boolean validRes, boolean validEnd)
{
g.setColor(HELIX_COLOUR);
g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 8);
}
- public void drawLineGraph(Graphics g, AlignmentAnnotation _aa, Annotation[] aa_annotations, int sRes,
- int eRes, int y, float min, float max, int graphHeight)
+ public void drawLineGraph(Graphics g, AlignmentAnnotation _aa,
+ Annotation[] aa_annotations, int sRes, int eRes, int y,
+ float min, float max, int graphHeight)
{
if (sRes > aa_annotations.length)
{
}
}
- public void drawBarGraph(Graphics g, AlignmentAnnotation _aa, Annotation[] aa_annotations, int sRes,
- int eRes, float min, float max, int y)
+ public void drawBarGraph(Graphics g, AlignmentAnnotation _aa,
+ Annotation[] aa_annotations, int sRes, int eRes, float min,
+ float max, int y)
{
if (sRes > aa_annotations.length)
{
// g.drawRect(x*av.charWidth, (int)ht, av.charWidth,
// (int)(scl));
// g.setColor(profcolour.findColour(dc[0]).darker());
- g.setColor(profcolour.findColour(dc[0], column,null));
+ g.setColor(profcolour.findColour(dc[0], column, null));
hght = (ht + (scl - lm.getDescent() - lm.getBaselineOffsets()[lm
.getBaselineIndex()]));
BasicStroke.JOIN_ROUND, 3f, new float[]
{ 5f, 3f }, 0f));
- y2 = (int) (y - ((_aa.threshold.value - min) / range) * _aa.graphHeight);
+ y2 = (int) (y - ((_aa.threshold.value - min) / range)
+ * _aa.graphHeight);
g.drawLine(0, y2, (eRes - sRes) * charWidth, y2);
g2.setStroke(new BasicStroke());
}
}
// used by overview window
- public void drawGraph(Graphics g, AlignmentAnnotation _aa, Annotation[] aa_annotations, int width,
- int y, int sRes, int eRes)
+ public void drawGraph(Graphics g, AlignmentAnnotation _aa,
+ Annotation[] aa_annotations, int width, int y, int sRes, int eRes)
{
eRes = Math.min(eRes, aa_annotations.length);
g.setColor(Color.white);