001package org.biojava.bio.gui.sequence;
002
003import java.awt.Graphics2D;
004
005/**
006 *
007 *
008 * @author Matthew Pocock
009 */
010public class CircularPaddedRenderer
011implements CircularRenderer {
012  private CircularRenderer delegate;
013  private double prePadding;
014  private double postPadding;
015
016  public CircularPaddedRenderer() {
017    this(null, 0.0, 0.0);
018  }
019
020  public CircularPaddedRenderer(CircularRenderer delegate) {
021    this(delegate, 0.0, 0.0);
022  }
023
024  public CircularPaddedRenderer(double prePadding, double postPadding) {
025    this(null, prePadding, postPadding);
026  }
027
028  public CircularPaddedRenderer(CircularRenderer delegate,
029                                double prePadding,
030                                double postPadding)
031  {
032    this.delegate = delegate;
033    this.prePadding = prePadding;
034    this.postPadding = postPadding;
035  }
036
037  public double getDepth(CircularRendererContext crc) {
038    CircularRendererContext subCtxt = new SubCircularRendererContext(
039            crc,
040            null,
041            null,
042            crc.getRadius() + prePadding);
043    return prePadding + delegate.getDepth(subCtxt) + postPadding;
044  }
045
046  public void paint(Graphics2D g2, CircularRendererContext crc) {
047    CircularRendererContext subCtxt = new SubCircularRendererContext(
048            crc,
049            null,
050            null,
051            crc.getRadius() + prePadding);
052    delegate.paint(g2, subCtxt);
053  }
054}