int lastSSX, int x, int y, int iconOffset, int startRes,
int column, boolean validRes, boolean validEnd)
{
+
g.setColor(STEM_COLOUR);
int sCol = (lastSSX / charWidth) + startRes;
int x1 = lastSSX;
// If a closing base pair half of the stem, display a backward arrow
if (column > 0 && closeparen.search(dc))
{
+
if (diffupstream)
// if (validRes && column>1 && row_annotations[column-2]!=null &&
// dc.equals(row_annotations[column-2].displayCharacter))
}
else
{
+
// display a forward arrow
if (diffdownstream)
{
*/
private int imgWidth;
+
+ public void drawNotCanonicalAnnot(Graphics g, Annotation[] row_annotations,
+ int lastSSX, int x, int y, int iconOffset, int startRes,
+ int column, boolean validRes, boolean validEnd)
+ {
+
+ g.setColor(NOTCANONICAL_COLOUR);
+ int sCol = (lastSSX / charWidth) + startRes;
+ int x1 = lastSSX;
+ int x2 = (x * charWidth);
+ Regex closeparen = new Regex("(}|]|a|b|c|d)");
+
+ String dc = (column == 0 || row_annotations[column - 1] == null) ? ""
+ : row_annotations[column - 1].displayCharacter;
+
+ boolean diffupstream = sCol == 0 || row_annotations[sCol - 1] == null
+ || !dc.equals(row_annotations[sCol - 1].displayCharacter);
+ boolean diffdownstream = !validRes || !validEnd
+ || row_annotations[column] == null
+ || !dc.equals(row_annotations[column].displayCharacter);
+ // System.out.println("Column "+column+" diff up: "+diffupstream+" down:"+diffdownstream);
+ // If a closing base pair half of the stem, display a backward arrow
+ if (column > 0 && closeparen.search(dc))// closeletter_b.search(dc)||closeletter_c.search(dc)||closeletter_d.search(dc)||closecrochet.search(dc)) )
+ {
+
+ if (diffupstream)
+ // if (validRes && column>1 && row_annotations[column-2]!=null &&
+ // dc.equals(row_annotations[column-2].displayCharacter))
+ {
+ g.fillPolygon(new int[]
+ { lastSSX + 5, lastSSX + 5, lastSSX }, new int[]
+ { y + iconOffset, y + 14 + iconOffset, y + 8 + iconOffset }, 3);
+ x1 += 5;
+ }
+ if (diffdownstream)
+ {
+ x2 -= 1;
+ }
+ }
+ else
+ {
+
+ // display a forward arrow
+ if (diffdownstream)
+ {
+ g.fillPolygon(new int[]
+ { x2 - 5, x2 - 5, x2 }, new int[]
+ { y + iconOffset, y + 14 + iconOffset, y + 8 + iconOffset }, 3);
+ x2 -= 5;
+ }
+ if (diffupstream)
+ {
+ x1 += 1;
+ }
+ }
+ // draw arrow body
+ g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 7);
+ }
// public void updateFromAnnotationPanel(FontMetrics annotFM, AlignViewportI
// av)
public void updateFromAwtRenderPanel(AwtRenderPanelI annotPanel,
}
/**
- * DOCUMENT ME!
- *
- * @param annotationPanel
- * TODO
+ * Render the annotation rows associated with an alignment.
+ * @param annotPanel
+ * container frame
+ * @param av
+ * data and view settings to render
* @param g
- * DOCUMENT ME!
+ * destination for graphics
+ * @param activeRow
+ * row where a mouse event occured (or -1)
* @param startRes
- * DOCUMENT ME!
+ * first column that will be drawn
* @param endRes
- * DOCUMENT ME!
+ * last column that will be drawn
+ * @return true if the fadedImage was used for any alignment annotation rows currently being calculated
*/
- public void drawComponent(AwtRenderPanelI annotPanel, AlignViewportI av,
+ public boolean drawComponent(AwtRenderPanelI annotPanel, AlignViewportI av,
Graphics g, int activeRow, int startRes, int endRes)
{
+ boolean usedFaded=false;
// NOTES:
// AnnotationPanel needs to implement: ImageObserver, access to
// AlignViewport
iconOffset = 0;
}
- if (aa[i].autoCalculated && av.isCalculationInProgress(aa[i]))
+ if (row.autoCalculated && av.isCalculationInProgress(row))
{
y += charHeight;
-
+ usedFaded=true;
g.drawImage(fadedImage, 0, y - row.height, imgWidth, y, 0, y
- row.height, imgWidth, y, annotationPanel);
g.setColor(Color.black);
{
char ss = validRes ? row_annotations[column].secondaryStructure
: ' ';
+
if (ss == 'S')
{
// distinguish between forward/backward base-pairing
if (row_annotations[column].displayCharacter.indexOf(')') > -1)
{
ss = 's';
+
+ }
+ }
+ if (ss == 'C')
+ {
+ if ((row_annotations[column].displayCharacter.indexOf(']') > -1) || (row_annotations[column].displayCharacter.indexOf('}') > -1))
+ {
+ ss = 'c';
+
}
}
if (!validRes || (ss != lastSS))
drawStemAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes,
column, validRes, validEnd);
break;
-
+ case 'C':
+ case 'c':
+ drawNotCanonicalAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes,
+ column, validRes, validEnd);
+ break;
default:
g.setColor(Color.gray);
g.fillRect(lastSSX, y + 6 + iconOffset, (x * charWidth)
drawStemAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes,
column, validRes, validEnd);
break;
+ case 'c':
+ case 'C':
+ drawNotCanonicalAnnot(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);
y += aa[i].height;
}
}
+ return !usedFaded;
}
private final Color GLYPHLINE_COLOR = Color.gray;
private final Color HELIX_COLOUR = Color.red;
private final Color STEM_COLOUR = Color.blue;
+
+ private final Color NOTCANONICAL_COLOUR = Color.red;
public void drawGlyphLine(Graphics g, Annotation[] row,
int lastSSX, int x, int y, int iconOffset, int startRes,
}
public void drawSheetAnnot(Graphics g, Annotation[] row,
+
int lastSSX, int x, int y, int iconOffset, int startRes,
int column, boolean validRes, boolean validEnd)
{