*/
package jalview.renderer;
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Image;
+import java.awt.geom.AffineTransform;
+import java.awt.image.ImageObserver;
+import java.util.BitSet;
+import java.util.Hashtable;
+
import jalview.analysis.AAFrequency;
import jalview.analysis.CodingUtils;
import jalview.analysis.Rna;
import jalview.datamodel.ColumnSelection;
import jalview.datamodel.HiddenColumns;
import jalview.datamodel.ProfilesI;
+import jalview.renderer.api.AnnotationRendererFactoryI;
+import jalview.renderer.api.AnnotationRowRendererI;
import jalview.schemes.ColourSchemeI;
import jalview.schemes.NucleotideColourScheme;
import jalview.schemes.ResidueProperties;
import jalview.schemes.ZappoColourScheme;
import jalview.util.Platform;
-import java.awt.BasicStroke;
-import java.awt.Color;
-import java.awt.Font;
-import java.awt.FontMetrics;
-import java.awt.Graphics;
-import java.awt.Graphics2D;
-import java.awt.Image;
-import java.awt.geom.AffineTransform;
-import java.awt.image.ImageObserver;
-import java.util.BitSet;
-import java.util.Hashtable;
-
public class AnnotationRenderer
{
private static final int UPPER_TO_LOWER = 'a' - 'A'; // 32
*/
public void dispose()
{
+ hiddenColumns = null;
hconsensus = null;
complementConsensus = null;
hStrucConsensus = null;
fadedImage = null;
annotationPanel = null;
+ rendererFactoryI = null;
}
void drawStemAnnot(Graphics g, Annotation[] row_annotations, int lastSSX,
useClip = false;
}
+ rendererFactoryI = AnnotationRendererFactory.getRendererFactory();
updateFromAlignViewport(av);
}
return null;
}
+ boolean rna = false;
+
+ private AnnotationRendererFactoryI rendererFactoryI;
+
/**
* Render the annotation rows associated with an alignment.
*
boolean validRes = false;
boolean validEnd = false;
boolean labelAllCols = false;
-// boolean centreColLabels;
-// boolean centreColLabelsDef = av.isCentreColumnLabels();
+ // boolean centreColLabels;
+ // boolean centreColLabelsDef = av.isCentreColumnLabels();
boolean scaleColLabel = false;
final AlignmentAnnotation consensusAnnot = av
.getAlignmentConsensusAnnotation();
{
continue;
}
-// centreColLabels = row.centreColLabels || centreColLabelsDef;
+ // centreColLabels = row.centreColLabels || centreColLabelsDef;
labelAllCols = row.showAllColLabels;
scaleColLabel = row.scaleColLabel;
lastSS = ' ';
row.graphMin, row.graphMax, y, renderHistogram,
renderProfile, normaliseProfile);
}
+ else
+ {
+ AnnotationRowRendererI renderer = rendererFactoryI
+ .getRendererFor(row);
+ if (renderer != null)
+ {
+ renderer.renderRow(g, charWidth, charHeight, hasHiddenColumns,
+ av, hiddenColumns, columnSelection, row,
+ row_annotations, startRes, endRes, row.graphMin,
+ row.graphMax, y);
+ }
+ if (debugRedraw)
+ {
+ if (renderer == null)
+ {
+ System.err
+ .println("No renderer found for " + row.toString());
+ }
+ else
+ {
+ System.err.println(
+ "rendered with " + renderer.getClass().toString());
+ }
+ }
+
+ }
}
}
else
break;
}
- if (aa_annotations[column] == null
- || aa_annotations[column - 1] == null)
+ if (aa_annotations[column] == null)
{
x++;
continue;
g.setColor(aa_annotations[column].colour);
}
+ if (aa_annotations[column - 1] == null
+ && aa_annotations.length > column + 1
+ && aa_annotations[column + 1] == null)
+ {
+ // standalone value
+ y1 = y - (int) (((aa_annotations[column].value - min) / range)
+ * graphHeight);
+ g.drawLine(x * charWidth + charWidth / 4, y1,
+ x * charWidth + 3 * charWidth / 4, y1);
+ x++;
+ continue;
+ }
+
+ if (aa_annotations[column - 1] == null)
+ {
+ x++;
+ continue;
+ }
+
y1 = y - (int) (((aa_annotations[column - 1].value - min) / range)
* graphHeight);
y2 = y - (int) (((aa_annotations[column].value - min) / range)
.deriveFont(AffineTransform.getScaleInstance(sx, sy));
g.setFont(font);
g.drawChars(dc, 0, dc.length, x * charWidth, hght);
+ g.setFont(ofont);
+
ht += newHeight;
}
}