X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Frenderer%2FContactMapRenderer.java;fp=src%2Fjalview%2Frenderer%2FContactMapRenderer.java;h=a504b4dcae59ecf00f22c895b619f36551a92260;hb=cd9c7864b10bfc0917dfbbfbe11b3af086c9fc4d;hp=313e3dbe07100eb921ed48a9ef30961a7f293761;hpb=a81d5dedad0d679f576a7c0f165d99dbc6cdb63b;p=jalview.git diff --git a/src/jalview/renderer/ContactMapRenderer.java b/src/jalview/renderer/ContactMapRenderer.java index 313e3db..a504b4d 100644 --- a/src/jalview/renderer/ContactMapRenderer.java +++ b/src/jalview/renderer/ContactMapRenderer.java @@ -82,25 +82,29 @@ public class ContactMapRenderer implements AnnotationRowRendererI } - int scale = Math - .max(1, _aa.graphHeight / contacts.getContactHeight()); - int step = _aa.graphHeight / scale; - int valuesProcessed = 0; + // cell height to render + 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++) + for (int stp = 0, ht = y2, eht = y2 - _aa.graphHeight; ht > eht; ht -= scale, stp++) { - valuesProcessed = stp * step; - g.setColor(contacts.getColorForScore(stp * step)); + g.setColor(contacts + .getColorForScore((int) (stp * step * ((double) _aa.graphHeight / (double) contacts + .getContactHeight())))); if (scale > 1) { - g.fillRect(x * charWidth, ht, charWidth, scale); + g.fillRect(x * charWidth, ht, charWidth, 1 + (int) scale); } else { g.drawLine(x * charWidth, ht, (x + 1) * charWidth, ht); } } + x++; } - x++; } }