4 package jalview.renderer;
6 import jalview.api.AlignViewportI;
7 import jalview.datamodel.AlignmentAnnotation;
8 import jalview.datamodel.Annotation;
9 import jalview.datamodel.ColumnSelection;
10 import jalview.datamodel.ContactListI;
11 import jalview.renderer.api.AnnotationRowRendererI;
13 import java.awt.Color;
15 import java.awt.Graphics;
21 public class ContactMapRenderer implements AnnotationRowRendererI
25 * // TODO Auto-generated method stub
26 void drawProfileDensity(Graphics g, AlignmentAnnotation _aa,
27 Annotation[] aa_annotations, int sRes, int eRes, float min,
35 public void renderRow(Graphics g, int charWidth, int charHeight,
36 boolean hasHiddenColumns, AlignViewportI viewport,
37 ColumnSelection columnSelection, AlignmentAnnotation _aa,
38 Annotation[] aa_annotations, int sRes, int eRes, float min,
41 if (sRes > aa_annotations.length)
45 Font ofont = g.getFont();
46 eRes = Math.min(eRes, aa_annotations.length);
50 g.setColor(Color.pink);
52 g.drawLine(x, y2, (eRes - sRes) * charWidth, y2);
55 int aaMax = aa_annotations.length - 1;
56 while (x < eRes - sRes)
61 column = columnSelection.adjustForHiddenColumns(column);
69 if (aa_annotations[column] == null)
75 * {profile type, #values, total count, char1, pct1, char2, pct2...}
77 ContactListI contacts = viewport.getContactList(_aa, column);
86 .max(1, _aa.graphHeight / contacts.getContactHeight());
87 int step = _aa.graphHeight / scale;
88 int valuesProcessed = 0;
89 // profl[1] is the number of values in the profile
90 for (int stp = 0, ht = y2, eht = y2 + _aa.graphHeight; ht < eht; ht += scale, stp++)
92 valuesProcessed = stp * step;
93 g.setColor(contacts.getColorForScore(stp * step));
97 g.fillRect(x * charWidth, ht, charWidth, scale);
99 g.drawLine(x * charWidth, ht, (x + 1) * charWidth, ht);