public class PairwiseDiagonalRenderer extends AbstractChangeable implements PairwiseSequenceRenderer, java.io.Serializable
PairwiseDiagonalRenderer renders a region of
similarity between two sequences as a straight line. The effect
produced is similar to a dotplot. This implementation requires that
these regions be represented by
SimilarityPairFeatures.
Drawing outside the visible area using a range of valid
doubles may cause Java to hang (Sun JDK 1.3.1 on
Linux, Compaq JDK 1.3.1 on Tru64, but not Sun JDK 1.4.0-beta2-b77
on Linux). I got round this by manual clipping of the lines to the
clip area. The code uses an implementation of the Cohen-Sutherland
line-clipping algorithm which clips lines to within a
rectangle.
The clipping code is taken from Computer Graphics for Java Programmers by Leen Ammeraal (1998, ISBN 0-471-98142-7) and cosmetically altered to support Java2D objects. Any bugs introduced are my responsibility.
PairwiseSequenceRenderer.PairwiseRendererForwarder| Modifier and Type | Field and Description |
|---|---|
protected java.awt.geom.Line2D.Float |
line
line is the line to be drawn for each feature. |
protected java.awt.Paint |
outline
outline is the line colour. |
static ChangeType |
OUTLINE
Constant
OUTLINE indicating a change to the fill of
the features. |
| Constructor and Description |
|---|
PairwiseDiagonalRenderer()
Creates a new
PairwiseDiagonalRenderer which will
draw black lines. |
PairwiseDiagonalRenderer(java.awt.Paint outline)
Creates a new
PairwiseDiagonalRenderer which will
draw lines using the specified Paint. |
| Modifier and Type | Method and Description |
|---|---|
java.awt.Paint |
getOutline()
getOutline returns the colour used to draw the
lines. |
void |
paint(java.awt.Graphics2D g2,
PairwiseRenderContext context)
paint renders the feature as a simple line. |
SequenceViewerEvent |
processMouseEvent(PairwiseRenderContext context,
java.awt.event.MouseEvent me,
java.util.List path)
processMouseEvent acts on a mouse gesture. |
void |
setOutline(java.awt.Paint outline)
setOutline sets the the colour used to draw the
lines. |
addChangeListener, addChangeListener, generateChangeSupport, getChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListenerpublic static final ChangeType OUTLINE
OUTLINE indicating a change to the fill of
the features.protected java.awt.geom.Line2D.Float line
line is the line to be drawn for each feature.protected java.awt.Paint outline
outline is the line colour.public PairwiseDiagonalRenderer()
PairwiseDiagonalRenderer which will
draw black lines.public PairwiseDiagonalRenderer(java.awt.Paint outline)
PairwiseDiagonalRenderer which will
draw lines using the specified Paint.outline - a Paint.public void paint(java.awt.Graphics2D g2,
PairwiseRenderContext context)
paint renders the feature as a simple line.paint in interface PairwiseSequenceRendererg2 - a Graphics2D.context - a PairwiseRenderContext.public java.awt.Paint getOutline()
getOutline returns the colour used to draw the
lines.Paint.public void setOutline(java.awt.Paint outline)
throws ChangeVetoException
setOutline sets the the colour used to draw the
lines.outline - a Paint.ChangeVetoException - if an error occurs.public SequenceViewerEvent processMouseEvent(PairwiseRenderContext context, java.awt.event.MouseEvent me, java.util.List path)
processMouseEvent acts on a mouse gesture. The
target object is a FeatureHolder containing the
features on the primary sequence which contain the mouse
pointer.processMouseEvent in interface PairwiseSequenceRenderercontext - a PairwiseRenderContext.me - a MouseEvent.path - a List.SequenceViewerEvent.Copyright © 2018 BioJava. All Rights Reserved.