From: Jim Procter Date: Mon, 12 Dec 2016 21:06:05 +0000 (+0000) Subject: JAL-2349 method to get display colour to represent a range of contacts X-Git-Tag: Release_2_11_4_0~562^2~9^2~20 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=10c287e10560169a80c575b7d1f6fd7f4695cf49;p=jalview.git JAL-2349 method to get display colour to represent a range of contacts --- diff --git a/src/jalview/datamodel/ContactListI.java b/src/jalview/datamodel/ContactListI.java index 4d5142a..0459732 100644 --- a/src/jalview/datamodel/ContactListI.java +++ b/src/jalview/datamodel/ContactListI.java @@ -11,6 +11,14 @@ public interface ContactListI Color getColorForScore(int column); + /** + * return colour representing contacts from i through to j for this site + * + * @param i + * @param j + * @return + */ + Color getColorForRange(int i, int j); /** * get a value representing contact at column for this site diff --git a/src/jalview/datamodel/ContactMatrixTest.java b/src/jalview/datamodel/ContactMatrixTest.java index b978d8f..96eb783 100644 --- a/src/jalview/datamodel/ContactMatrixTest.java +++ b/src/jalview/datamodel/ContactMatrixTest.java @@ -25,6 +25,14 @@ public class ContactMatrixTest implements ContactMatrixI return jalview.util.ColorUtils.getGraduatedColour(Math.abs(column-p), 0, Color.white, width, Color.magenta); } @Override + public Color getColorForRange(int i, int j) + { + return jalview.util.ColorUtils.getGraduatedColour( + Math.abs(j + i - 2 * p) / 2, 0, Color.white, width, + Color.magenta); + } + + @Override public int getColumnWidth() { return 1;