X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Frenderer%2FAnnotationRenderer.java;h=eb83f31945e3cc5f6f0f61a253cb8bd4dbd7ba1a;hb=6860179ce5f69173f230c05bd5fe6e85c73886a3;hp=548291c599b6724aeaae22925a0d7a325f7337d5;hpb=577b0bf651763fe609eb6d6343754662023b3eac;p=jalview.git diff --git a/src/jalview/renderer/AnnotationRenderer.java b/src/jalview/renderer/AnnotationRenderer.java index 548291c..eb83f31 100644 --- a/src/jalview/renderer/AnnotationRenderer.java +++ b/src/jalview/renderer/AnnotationRenderer.java @@ -30,6 +30,8 @@ import jalview.datamodel.Annotation; 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; @@ -80,9 +82,9 @@ public class AnnotationRenderer private ProfilesI hconsensus; - private Hashtable[] complementConsensus; + private Hashtable[] complementConsensus; - private Hashtable[] hStrucConsensus; + private Hashtable[] hStrucConsensus; private boolean av_ignoreGapsConsensus; @@ -149,11 +151,13 @@ public class AnnotationRenderer */ 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, @@ -312,6 +316,7 @@ public class AnnotationRenderer useClip = false; } + rendererFactoryI = AnnotationRendererFactory.getRendererFactory(); updateFromAlignViewport(av); } @@ -416,6 +421,10 @@ public class AnnotationRenderer return null; } + boolean rna = false; + + private AnnotationRendererFactoryI rendererFactoryI; + /** * Render the annotation rows associated with an alignment. * @@ -446,7 +455,7 @@ public class AnnotationRenderer updateFromAwtRenderPanel(annotPanel, av); fm = g.getFontMetrics(); AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation(); - int temp = 0; + // int temp = 0; if (aa == null) { return false; @@ -459,8 +468,8 @@ public class AnnotationRenderer 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(); @@ -506,7 +515,7 @@ public class AnnotationRenderer { continue; } - centreColLabels = row.centreColLabels || centreColLabelsDef; + // centreColLabels = row.centreColLabels || centreColLabelsDef; labelAllCols = row.showAllColLabels; scaleColLabel = row.scaleColLabel; lastSS = ' '; @@ -774,7 +783,7 @@ public class AnnotationRenderer if (x > -1) { - int nb_annot = x - temp; + // int nb_annot = x - temp; // System.out.println("\t type :"+lastSS+"\t x :"+x+"\t nbre // annot :"+nb_annot); switch (lastSS) @@ -783,7 +792,7 @@ public class AnnotationRenderer case ')': // and opposite direction drawStemAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes, column, validRes, validEnd); - temp = x; + // temp = x; break; case 'H': @@ -866,13 +875,13 @@ public class AnnotationRenderer drawNotCanonicalAnnot(g, nonCanColor, row_annotations, lastSSX, x, y, iconOffset, startRes, column, validRes, validEnd); - temp = x; + // temp = x; break; default: g.setColor(Color.gray); g.fillRect(lastSSX, y + 6 + iconOffset, (x * charWidth) - lastSSX, 2); - temp = x; + // temp = x; break; } } @@ -1062,6 +1071,32 @@ public class AnnotationRenderer 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 @@ -1113,7 +1148,7 @@ public class AnnotationRenderer public static final Color STEM_COLOUR = Color.blue; - private Color sdNOTCANONICAL_COLOUR; + // private Color sdNOTCANONICAL_COLOUR; void drawGlyphLine(Graphics g, Annotation[] row, int lastSSX, int x, int y, int iconOffset, int startRes, int column, boolean validRes, @@ -1515,6 +1550,8 @@ public class AnnotationRenderer .deriveFont(AffineTransform.getScaleInstance(sx, sy)); g.setFont(font); g.drawChars(dc, 0, dc.length, x * charWidth, hght); + g.setFont(ofont); + ht += newHeight; } }