Merge branch 'develop' into features/JAL-4134_use_annotation_row_for_colours_and_groups
[jalview.git] / src / jalview / renderer / ContactMapRenderer.java
index 00a6169..a8f6c1b 100644 (file)
@@ -25,6 +25,7 @@ public abstract class ContactMapRenderer implements AnnotationRowRendererI
 {
   /**
    * bean holding colours for shading
+   * 
    * @author jprocter
    *
    */
@@ -66,6 +67,7 @@ public abstract class ContactMapRenderer implements AnnotationRowRendererI
 
   /**
    * build an EBI-AlphaFold style renderer of PAE matrices
+   * 
    * @return
    */
   public static ContactMapRenderer newPAERenderer()
@@ -147,16 +149,18 @@ public abstract class ContactMapRenderer implements AnnotationRowRendererI
         continue;
       }
       // ContactListI from viewport can map column -> group
-      Color gpcol = (cm==null) ? Color.white: contacts.getColourForGroup(); // cm.getColourForGroup(cm.getGroupsFor(column));
-      
+      Color gpcol = (cm == null) ? Color.white
+              : contacts.getColourForGroup(); // cm.getColourForGroup(cm.getGroupsFor(column));
       // feature still in development - highlight or omit regions hidden in
       // the alignment - currently marks them as red rows
       boolean maskHiddenCols = false;
-      // TODO: optionally pass visible column mask to the ContactGeometry object so it maps
+      // TODO: optionally pass visible column mask to the ContactGeometry object
+      // so it maps
       // only visible contacts to geometry
       // Bean holding mapping from contact list to pixels
-      // TODO: allow bracketing/limiting of range on contacts to render (like visible column mask but more flexible?)
-      
+      // TODO: allow bracketing/limiting of range on contacts to render (like
+      // visible column mask but more flexible?)
+
       // COntactListI provides mapping for column -> cm-groupmapping
       final ContactGeometry cgeom = new ContactGeometry(contacts,
               _aa.graphHeight);
@@ -164,7 +168,6 @@ public abstract class ContactMapRenderer implements AnnotationRowRendererI
       for (int ht = y2, eht = y2
               - _aa.graphHeight; ht >= eht; ht -= cgeom.pixels_step)
       {
-        
         ContactGeometry.contactInterval ci = cgeom.mapFor(y2 - ht,
                 y2 - ht + cgeom.pixels_step);
         // cstart = (int) Math.floor(((double) y2 - ht) * contacts_per_pixel);
@@ -175,7 +178,8 @@ public abstract class ContactMapRenderer implements AnnotationRowRendererI
         boolean rowsel = false, containsHidden = false;
         if (columnSelection != null)
         {
-          rowsel = cgeom.intersects(ci, columnSelection, hiddenColumns, maskHiddenCols);
+          rowsel = cgeom.intersects(ci, columnSelection, hiddenColumns,
+                  maskHiddenCols);
         }
         // TODO: show selected region
         if (colsel || rowsel)
@@ -200,14 +204,16 @@ public abstract class ContactMapRenderer implements AnnotationRowRendererI
         {
           col = shade.hidden;
         }
-        if (gpcol!=null && gpcol!=Color.white) {
+        if (gpcol != null && gpcol != Color.white)
+        {
           // todo - could overlay group as a transparent rectangle ?
-          col = new Color((int)(((float)(col.getRed()+gpcol.getRed()))/2f),
-                  (int)(((float)(col.getGreen()+gpcol.getGreen()))/2f),
-                  (int)(((float)(col.getBlue()+gpcol.getBlue()))/2f));
+          col = new Color(
+                  (int) (((float) (col.getRed() + gpcol.getRed())) / 2f),
+                  (int) (((float) (col.getGreen() + gpcol.getGreen()))
+                          / 2f),
+                  (int) (((float) (col.getBlue() + gpcol.getBlue())) / 2f));
         }
         g.setColor(col);
-        
         if (cgeom.pixels_step > 1)
         {
           g.fillRect(x * charWidth, ht, charWidth, 1 + cgeom.pixels_step);
@@ -224,8 +230,8 @@ public abstract class ContactMapRenderer implements AnnotationRowRendererI
 
   Color shadeFor(float min, float max, float value)
   {
-    return jalview.util.ColorUtils.getGraduatedColour(value, 0, shade.minColor,
-            max, shade.maxColor);
+    return jalview.util.ColorUtils.getGraduatedColour(value, 0,
+            shade.minColor, max, shade.maxColor);
   }
 
   public Color getColorForRange(float min, float max, ContactListI cl,