JAL-2349 fixed rendering method and switched to using color from contact range to...
[jalview.git] / src / jalview / renderer / ContactMapRenderer.java
index 1f235b3..809ced0 100644 (file)
@@ -73,17 +73,15 @@ public class ContactMapRenderer implements AnnotationRowRendererI
       double scale = (_aa.graphHeight < contacts.getContactHeight()) ? 1
               : (((double) _aa.graphHeight) / (double) contacts
                       .getContactHeight());
-      // distance between contact map per cell
-      int step = (int) ((contacts.getContactHeight()) * scale / _aa.graphHeight);
-
-      // profl[1] is the number of values in the profile
-      for (int stp = 0, ht = y2, eht = y2 - _aa.graphHeight; ht > eht; ht -= scale, stp++)
+      int cstart, cend = -1;
+      for (int ht = y2, eht = y2 - _aa.graphHeight; ht >= eht; ht -= scale)
       {
-        // TODO show maximum colour for range
+        cstart = cend + 1;
+        cend = -1
+                + (contacts.getContactHeight() * (ht - eht) / _aa.graphHeight);
+        // TODO show maximum colour for range - sort of done
         // also need a 'getMaxPosForRange(start,end)'
-        g.setColor(contacts
-                .getColorForScore((int) (stp * step * ((double) _aa.graphHeight / (double) contacts
-                        .getContactHeight()))));
+        g.setColor(contacts.getColorForRange(cstart, cend));
 
         if (scale > 1)
         {