JAL-4411 store class of provider in PDBEntry
[jalview.git] / src / jalview / renderer / AnnotationRenderer.java
index be65eb7..015db5c 100644 (file)
@@ -88,6 +88,8 @@ public class AnnotationRenderer
   private HiddenColumns hiddenColumns;
 
   private ProfilesI hconsensus;
+  
+  private ProfilesI hSSconsensus;
 
   private Hashtable<String, Object>[] complementConsensus;
 
@@ -95,7 +97,7 @@ public class AnnotationRenderer
 
   private boolean av_ignoreGapsConsensus;
 
-  private boolean vectorRendition = false;
+  private boolean renderingVectors = false;
 
   private boolean glyphLineDrawn = false;
 
@@ -164,6 +166,7 @@ public class AnnotationRenderer
   {
     hiddenColumns = null;
     hconsensus = null;
+    hSSconsensus = null;
     complementConsensus = null;
     hStrucConsensus = null;
     fadedImage = null;
@@ -184,7 +187,8 @@ public class AnnotationRenderer
             : row_annotations[column - 1].secondaryStructure;
 
     boolean diffupstream = sCol == 0 || row_annotations[sCol - 1] == null
-            || dc != row_annotations[sCol - 1].secondaryStructure;
+            || dc != row_annotations[sCol - 1].secondaryStructure
+            || !validEnd;
     boolean diffdownstream = !validRes || !validEnd
             || row_annotations[column] == null
             || dc != row_annotations[column].secondaryStructure;
@@ -260,7 +264,8 @@ public class AnnotationRenderer
             : row_annotations[column - 1].displayCharacter;
 
     boolean diffupstream = sCol == 0 || row_annotations[sCol - 1] == null
-            || !dc.equals(row_annotations[sCol - 1].displayCharacter);
+            || !dc.equals(row_annotations[sCol - 1].displayCharacter)
+            || !validEnd;
     boolean diffdownstream = !validRes || !validEnd
             || row_annotations[column] == null
             || !dc.equals(row_annotations[column].displayCharacter);
@@ -375,6 +380,7 @@ public class AnnotationRenderer
     columnSelection = av.getColumnSelection();
     hiddenColumns = av.getAlignment().getHiddenColumns();
     hconsensus = av.getSequenceConsensusHash();
+    hSSconsensus = av.getSequenceSSConsensusHash();
     complementConsensus = av.getComplementConsensusHash();
     hStrucConsensus = av.getRnaStructureConsensusHash();
     av_ignoreGapsConsensus = av.isIgnoreGapsConsensus();
@@ -423,6 +429,15 @@ public class AnnotationRenderer
         }
       }
     }
+    
+    else if(aa.autoCalculated && aa.label.startsWith("SecondaryStructureConsensus")) 
+    {
+      return AAFrequency.extractProfile(
+              hSSconsensus.get(column),
+              av_ignoreGapsConsensus);
+      
+    }
+    
     else
     {
       if (aa.autoCalculated && aa.label.startsWith("StrucConsensus"))
@@ -478,7 +493,7 @@ public class AnnotationRenderer
   {
     if (g instanceof EpsGraphics2D || g instanceof SVGGraphics2D)
     {
-      this.setVectorRendition(true);
+      this.setVectorRendering(true);
     }
     Graphics2D g2d = (Graphics2D) g;
 
@@ -512,6 +527,8 @@ public class AnnotationRenderer
             .getAlignmentStrucConsensusAnnotation();
     final AlignmentAnnotation complementConsensusAnnot = av
             .getComplementConsensusAnnotation();
+    final AlignmentAnnotation ssConsensusAnnot = av
+            .getAlignmentSecondaryStructureConsensusAnnotation();
 
     BitSet graphGroupDrawn = new BitSet();
     int charOffset = 0; // offset for a label
@@ -538,7 +555,7 @@ public class AnnotationRenderer
         normaliseProfile = row.groupRef.isNormaliseSequenceLogo();
       }
       else if (row == consensusAnnot || row == structConsensusAnnot
-              || row == complementConsensusAnnot)
+              || row == complementConsensusAnnot || row == ssConsensusAnnot)
       {
         renderHistogram = av_renderHistogram;
         renderProfile = av_renderProfile;
@@ -920,7 +937,7 @@ public class AnnotationRenderer
                   // temp = x;
                   break;
                 default:
-                  if (isVectorRendition())
+                  if (isVectorRendering())
                   {
                     // draw single full width glyphline
                     drawGlyphLine(g, lastSSX, endRes - x, y, iconOffset);
@@ -1061,7 +1078,7 @@ public class AnnotationRenderer
                     x, y, iconOffset, startRes, column, validRes, validEnd);
             break;
           default:
-            if (isVectorRendition())
+            if (isVectorRendering())
             {
               // draw single full width glyphline
               drawGlyphLine(g, lastSSX, endRes - x, y, iconOffset);
@@ -1259,7 +1276,7 @@ public class AnnotationRenderer
     int x1 = lastSSX;
     int x2 = (x * charWidth);
 
-    if (USE_FILL_ROUND_RECT || isVectorRendition())
+    if (USE_FILL_ROUND_RECT || isVectorRendering())
     {
       // draw glyph line behind helix (visible in EPS or SVG output)
       drawGlyphLine(g, lastSSX, x, y, iconOffset);
@@ -1517,6 +1534,8 @@ public class AnnotationRenderer
          * {profile type, #values, total count, char1, pct1, char2, pct2...}
          */
         int profl[] = getProfileFor(_aa, column);
+        
+        
 
         // just try to draw the logo if profl is not null
         if (profl != null && profl[2] != 0)
@@ -1600,7 +1619,9 @@ public class AnnotationRenderer
             }
             else
             {
+              
               colour = profcolour.findColour(dc[0], column, null);
+
             }
             g.setColor(colour == Color.white ? Color.lightGray : colour);
 
@@ -1884,7 +1905,7 @@ public class AnnotationRenderer
 
   private void setAntialias(Graphics g)
   {
-    if (isVectorRendition())
+    if (isVectorRendering())
     {
       // no need to antialias vector drawings
       return;
@@ -1899,7 +1920,7 @@ public class AnnotationRenderer
 
   private void unsetAntialias(Graphics g)
   {
-    if (isVectorRendition())
+    if (isVectorRendering())
     {
       // no need to antialias vector drawings
       return;
@@ -1909,13 +1930,13 @@ public class AnnotationRenderer
             RenderingHints.VALUE_ANTIALIAS_OFF);
   }
 
-  public void setVectorRendition(boolean b)
+  public void setVectorRendering(boolean b)
   {
-    vectorRendition = b;
+    renderingVectors = b;
   }
 
-  public boolean isVectorRendition()
+  public boolean isVectorRendering()
   {
-    return vectorRendition;
+    return renderingVectors;
   }
 }