import jalview.renderer.api.AnnotationRowRendererI;
import java.awt.Color;
-import java.awt.Font;
import java.awt.Graphics;
/**
*/
public class ContactMapRenderer implements AnnotationRowRendererI
{
- /*
- *
- * // TODO Auto-generated method stub
- void drawProfileDensity(Graphics g, AlignmentAnnotation _aa,
- Annotation[] aa_annotations, int sRes, int eRes, float min,
- float max, int y)
- {
- *
- *
- */
@Override
public void renderRow(Graphics g, int charWidth, int charHeight,
boolean hasHiddenColumns, AlignViewportI viewport,
{
return;
}
- Font ofont = g.getFont();
eRes = Math.min(eRes, aa_annotations.length);
int x = 0, y2 = y;
return;
}
-
- int scale = Math
- .max(1, _aa.graphHeight / contacts.getContactHeight());
- int step = _aa.graphHeight / scale;
- int valuesProcessed = 0;
- // 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++)
+ // cell height to render
+ double scale = (_aa.graphHeight < contacts.getContactHeight()) ? 1
+ : (((double) _aa.graphHeight) / (double) contacts
+ .getContactHeight());
+ int cstart, cend = -1;
+ for (int ht = y2, eht = y2 - _aa.graphHeight; ht >= eht; ht -= scale)
{
- valuesProcessed = stp * step;
- g.setColor(contacts.getColorForScore(stp * step));
+ 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.getColorForRange(cstart, cend));
if (scale > 1)
{
- g.fillRect(x * charWidth, ht, charWidth, scale);
- } else {
+ g.fillRect(x * charWidth, ht, charWidth, 1 + (int) scale);
+ }
+ else
+ {
g.drawLine(x * charWidth, ht, (x + 1) * charWidth, ht);
}
}
+ x++;
}
- x++;
}
}