From cd9c7864b10bfc0917dfbbfbe11b3af086c9fc4d Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Sun, 4 Dec 2016 12:23:05 +0000 Subject: [PATCH] =?utf8?q?JAL-2349=20contact=20renderer=20prototype=20(that=20?= =?utf8?q?doesn=E2=80=99t=20hang!)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/jalview/renderer/ContactMapRenderer.java | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) 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++; } } -- 1.7.10.2