001package org.biojava.bio.gui.sequence;
002
003import java.awt.Graphics2D;
004import java.awt.Shape;
005import java.awt.geom.AffineTransform;
006import java.util.Iterator;
007
008import org.biojava.bio.seq.Feature;
009
010/**
011 *
012 *
013 * @author Matthew Pocock
014 */
015public class CircularFeaturesRenderer
016implements CircularRenderer {
017  private CircularFeatureRenderer renderer;
018
019  public CircularFeaturesRenderer() {}
020
021  public CircularFeaturesRenderer(CircularFeatureRenderer renderer) {
022    this.renderer = renderer;
023  }
024
025  public CircularFeatureRenderer getRenderer() {
026    return renderer;
027  }
028
029  public void setRenderer(CircularFeatureRenderer renderer) {
030    this.renderer = renderer;
031  }
032
033  public double getDepth(CircularRendererContext crc) {
034    return renderer.getDepth(crc);
035  }
036
037  public void paint(Graphics2D g2, CircularRendererContext crc) {
038    for (Iterator i = crc.getFeatures().features(); i.hasNext();) {
039      Shape clip = g2.getClip();
040      AffineTransform at = g2.getTransform();
041
042      Feature f = (Feature) i.next();
043      renderer.renderFeature(g2, f, crc);
044
045      g2.setTransform(at);
046      g2.setClip(clip);
047    }
048  }
049}