X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Frenderer%2FAnnotationRenderer.java;h=e58ba02b06cd14651bdca1be42bc2e6378e644c8;hb=e60cc5ef2185356035706a6b7130a4c697674188;hp=634b1e4ad0d27b0868679fc26e0967c694986ac8;hpb=566041d3e8ca1d8783b4572a695e83784c0b6bc7;p=jalview.git diff --git a/src/jalview/renderer/AnnotationRenderer.java b/src/jalview/renderer/AnnotationRenderer.java index 634b1e4..e58ba02 100644 --- a/src/jalview/renderer/AnnotationRenderer.java +++ b/src/jalview/renderer/AnnotationRenderer.java @@ -30,6 +30,7 @@ import jalview.datamodel.Annotation; import jalview.datamodel.ColumnSelection; import jalview.schemes.ColourSchemeI; import jalview.schemes.ResidueProperties; +import jalview.util.Platform; import java.awt.BasicStroke; import java.awt.Color; @@ -57,6 +58,70 @@ public class AnnotationRenderer */ private final boolean debugRedraw; + private int charWidth, endRes, charHeight; + + private boolean validCharWidth, hasHiddenColumns; + + private FontMetrics fm; + + private final boolean MAC = Platform.isAMac(); + + boolean av_renderHistogram = true, av_renderProfile = true, + av_normaliseProfile = false; + + ColourSchemeI profcolour = null; + + private ColumnSelection columnSelection; + + private Hashtable[] hconsensus; + + private Hashtable[] complementConsensus; + + private Hashtable[] hStrucConsensus; + + private boolean av_ignoreGapsConsensus; + + /** + * attributes set from AwtRenderPanelI + */ + /** + * old image used when data is currently being calculated and cannot be + * rendered + */ + private Image fadedImage; + + /** + * panel being rendered into + */ + private ImageObserver annotationPanel; + + /** + * width of image to render in panel + */ + private int imgWidth; + + /** + * offset to beginning of visible area + */ + private int sOffset; + + /** + * offset to end of visible area + */ + private int visHeight; + + /** + * indicate if the renderer should only render the visible portion of the + * annotation given the current view settings + */ + private boolean useClip = true; + + /** + * master flag indicating if renderer should ever try to clip. not enabled for + * jalview 2.8.1 + */ + private boolean canClip = false; + public AnnotationRenderer() { this(false); @@ -74,6 +139,18 @@ public class AnnotationRenderer this.debugRedraw = debugRedraw; } + /** + * Remove any references and resources when this object is no longer required + */ + public void dispose() + { + hconsensus = null; + complementConsensus = null; + hStrucConsensus = null; + fadedImage = null; + annotationPanel = null; + } + void drawStemAnnot(Graphics g, Annotation[] row_annotations, int lastSSX, int x, int y, int iconOffset, int startRes, int column, boolean validRes, boolean validEnd) @@ -134,70 +211,6 @@ public class AnnotationRenderer g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 7); } - private int charWidth, endRes, charHeight; - - private boolean validCharWidth, hasHiddenColumns; - - private FontMetrics fm; - - private final boolean MAC = jalview.util.Platform.isAMac(); - - boolean av_renderHistogram = true, av_renderProfile = true, - av_normaliseProfile = false; - - ColourSchemeI profcolour = null; - - private ColumnSelection columnSelection; - - private Hashtable[] hconsensus; - - private Hashtable[] complementConsensus; - - private Hashtable[] hStrucConsensus; - - private boolean av_ignoreGapsConsensus; - - /** - * attributes set from AwtRenderPanelI - */ - /** - * old image used when data is currently being calculated and cannot be - * rendered - */ - private Image fadedImage; - - /** - * panel being rendered into - */ - private ImageObserver annotationPanel; - - /** - * width of image to render in panel - */ - private int imgWidth; - - /** - * offset to beginning of visible area - */ - private int sOffset; - - /** - * offset to end of visible area - */ - private int visHeight; - - /** - * indicate if the renderer should only render the visible portion of the - * annotation given the current view settings - */ - private boolean useClip = true; - - /** - * master flag indicating if renderer should ever try to clip. not enabled for - * jalview 2.8.1 - */ - private boolean canClip = false; - void drawNotCanonicalAnnot(Graphics g, Color nonCanColor, Annotation[] row_annotations, int lastSSX, int x, int y, int iconOffset, int startRes, int column, boolean validRes, @@ -220,7 +233,7 @@ public class AnnotationRenderer || !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 && Rna.isClosingParenthesis(dc.charAt(0))) + if (column > 0 && Rna.isClosingParenthesis(dc)) { if (diffupstream) @@ -751,7 +764,7 @@ public class AnnotationRenderer validEnd); break; } - + // no break if isRNA - falls through to drawNotCanonicalAnnot! case 'E': if (!isRNA) { @@ -760,6 +773,7 @@ public class AnnotationRenderer validEnd); break; } + // no break if isRNA - fall through to drawNotCanonicalAnnot! case '{': case '}': @@ -867,7 +881,6 @@ public class AnnotationRenderer { validRes = true; } - // x ++; if (row.hasIcons) @@ -882,6 +895,7 @@ public class AnnotationRenderer startRes, column, validRes, validEnd); break; } + // no break if isRNA - fall through to drawNotCanonicalAnnot! case 'E': if (!isRNA) @@ -890,6 +904,7 @@ public class AnnotationRenderer startRes, column, validRes, validEnd); break; } + // no break if isRNA - fall through to drawNotCanonicalAnnot! case '(': case ')': // Stem case for RNA secondary structure