org.biojava.bio.gui.sequence
Class EllipticalBeadRenderer

java.lang.Object
  extended byorg.biojava.utils.AbstractChangeable
      extended byorg.biojava.bio.gui.sequence.AbstractBeadRenderer
          extended byorg.biojava.bio.gui.sequence.EllipticalBeadRenderer
All Implemented Interfaces:
BeadFeatureRenderer, Changeable, FeatureRenderer, java.io.Serializable

public class EllipticalBeadRenderer
extends AbstractBeadRenderer

EllipticalBeadRenderer renders features as simple ellipses. Their outline and fill Paint, Stroke, feature depth, Y-axis displacement are configurable. Also configurable is the minimum ratio of long axis to short axis of the ellipse - this prevents long features also becoming ever wider and obscuring neighbours.

Since:
1.2
Author:
Keith James
See Also:
Serialized Form

Field Summary
protected  double dimensionRatio
           
static ChangeType RATIO
          Constant RATIO indicating a change to the minimum allowed ratio of long axis to short axis of the features.
 
Fields inherited from class org.biojava.bio.gui.sequence.AbstractBeadRenderer
beadDepth, beadDisplacement, beadFill, beadOutline, beadStroke, delegates, delegationCache, DEPTH, DISPLACEMENT, FILL, OUTLINE, STROKE
 
Constructor Summary
EllipticalBeadRenderer()
          Creates a new EllipticalBeadRenderer object with the default settings.
EllipticalBeadRenderer(double beadDepth, double beadDisplacement, java.awt.Paint beadOutline, java.awt.Paint beadFill, java.awt.Stroke beadStroke, double dimensionRatio)
          Creates a new EllipticalBeadRenderer.
 
Method Summary
 double getDepth(SequenceRenderContext context)
          getDepth calculates the depth required by this renderer to display its beads.
 double getDimensionRatio()
          getDimensionRatio returns the maximum ratio of long dimension to short dimension of the bead.
 void renderBead(java.awt.Graphics2D g2, Feature f, SequenceRenderContext context)
          renderBead renders features as simple ellipse.
 void setDimensionRatio(double ratio)
          setDimensionRatio sets the minimum ratio of long dimension to short dimension of the bead.
 
Methods inherited from class org.biojava.bio.gui.sequence.AbstractBeadRenderer
getBeadDepth, getBeadDisplacement, getBeadFill, getBeadOutline, getBeadStroke, processMouseEvent, removeDelegateRenderer, renderFeature, setBeadDepth, setBeadDisplacement, setBeadFill, setBeadOutline, setBeadStroke, setDelegateRenderer
 
Methods inherited from class org.biojava.utils.AbstractChangeable
addChangeListener, addChangeListener, generateChangeSupport, getChangeSupport, hasListeners, isUnchanging, removeChangeListener, removeChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RATIO

public static final ChangeType RATIO
Constant RATIO indicating a change to the minimum allowed ratio of long axis to short axis of the features.


dimensionRatio

protected double dimensionRatio
Constructor Detail

EllipticalBeadRenderer

public EllipticalBeadRenderer()
Creates a new EllipticalBeadRenderer object with the default settings.


EllipticalBeadRenderer

public EllipticalBeadRenderer(double beadDepth,
                              double beadDisplacement,
                              java.awt.Paint beadOutline,
                              java.awt.Paint beadFill,
                              java.awt.Stroke beadStroke,
                              double dimensionRatio)
Creates a new EllipticalBeadRenderer.

Parameters:
beadDepth - a double.
beadDisplacement - a double.
beadOutline - a Paint.
beadFill - a Paint.
beadStroke - a Stroke.
dimensionRatio - a double.
Method Detail

renderBead

public void renderBead(java.awt.Graphics2D g2,
                       Feature f,
                       SequenceRenderContext context)
renderBead renders features as simple ellipse.

Specified by:
renderBead in interface BeadFeatureRenderer
Specified by:
renderBead in class AbstractBeadRenderer
Parameters:
f - a Feature to render.
context - a SequenceRenderContext context.
g2 - a Graphics2D.

getDepth

public double getDepth(SequenceRenderContext context)
getDepth calculates the depth required by this renderer to display its beads.

Specified by:
getDepth in interface FeatureRenderer
Overrides:
getDepth in class AbstractBeadRenderer
Parameters:
context - a SequenceRenderContext object.
Returns:
a double.

getDimensionRatio

public double getDimensionRatio()
getDimensionRatio returns the maximum ratio of long dimension to short dimension of the bead. This should be equal, or greater than 1.

Returns:
a double.

setDimensionRatio

public void setDimensionRatio(double ratio)
                       throws ChangeVetoException
setDimensionRatio sets the minimum ratio of long dimension to short dimension of the bead. This should be equal, or greater than 1.

Throws:
ChangeVetoException - if an error occurs.