Package org.biojava.bio.gui.sequence
Class RectangularBeadRenderer
java.lang.Object
org.biojava.utils.AbstractChangeable
org.biojava.bio.gui.sequence.AbstractBeadRenderer
org.biojava.bio.gui.sequence.RectangularBeadRenderer
- All Implemented Interfaces:
Serializable
,BeadFeatureRenderer
,FeatureRenderer
,Changeable
RectangularBeadRenderer
renders features as simple
rectangles. Their outline and fill Paint
,
Stroke
, feature depth, Y-axis displacement are
configurable. The height of the rectangle will be equal to half its
width, but not greater than the beadDepth
set in the
constructor.
An alternative bead height behaviour is available where the
rectangle height does not scale with its current width. The
setHeightScaling
method should be passed a boolean
value to change this. The default is to use height scaling.
- Since:
- 1.2
- Author:
- Keith James
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ChangeType
ConstantHEIGHTSCALING
indicating a change to the feature height scaling policy.protected Rectangle2D
protected boolean
Fields inherited from class org.biojava.bio.gui.sequence.AbstractBeadRenderer
beadDepth, beadDisplacement, beadFill, beadOutline, beadStroke, delegates, delegationCache, DEPTH, DISPLACEMENT, FILL, OUTLINE, STROKE
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a newRectangularBeadRenderer
with the default settings.RectangularBeadRenderer
(double beadDepth, double beadDisplacement, Paint beadOutline, Paint beadFill, Stroke beadStroke) Creates a newRectangularBeadRenderer
. -
Method Summary
Modifier and TypeMethodDescriptiondouble
getDepth
(SequenceRenderContext context) getDepth
calculates the depth required by this renderer to display its beads.boolean
getHeightScaling
returns the state of the height scaling policy.void
renderBead
(Graphics2D g2, Feature f, SequenceRenderContext context) renderBead
renders features as simple rectangle.void
setHeightScaling
(boolean isEnabled) setHeightScaling
sets the height scaling policy.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, hasListeners, isUnchanging, removeChangeListener, removeChangeListener
-
Field Details
-
HEIGHTSCALING
ConstantHEIGHTSCALING
indicating a change to the feature height scaling policy. -
rect
-
scaleHeight
-
-
Constructor Details
-
RectangularBeadRenderer
public RectangularBeadRenderer()Creates a newRectangularBeadRenderer
with the default settings. -
RectangularBeadRenderer
public RectangularBeadRenderer(double beadDepth, double beadDisplacement, Paint beadOutline, Paint beadFill, Stroke beadStroke) Creates a newRectangularBeadRenderer
.- Parameters:
beadDepth
- adouble
.beadDisplacement
- adouble
.beadOutline
- aPaint
.beadFill
- aPaint
.beadStroke
- aStroke
.
-
-
Method Details
-
renderBead
renderBead
renders features as simple rectangle.- Specified by:
renderBead
in interfaceBeadFeatureRenderer
- Specified by:
renderBead
in classAbstractBeadRenderer
- Parameters:
g2
- aGraphics2D
.f
- aFeature
to render.context
- aSequenceRenderContext
context.
-
getDepth
getDepth
calculates the depth required by this renderer to display its beads.- Specified by:
getDepth
in interfaceFeatureRenderer
- Overrides:
getDepth
in classAbstractBeadRenderer
- Parameters:
context
- aSequenceRenderContext
.- Returns:
- a
double
.
-
getHeightScaling
getHeightScaling
returns the state of the height scaling policy.- Returns:
- a
boolean
true if height scaling is enabled.
-
setHeightScaling
setHeightScaling
sets the height scaling policy. Default behaviour is for this to be enabled leading to features being drawn with a height equal to half their width, subject to a maximum height restriction equal to thebeadDepth
set in the constructor. If disabled, features will always be drawn at the maximum height allowed by thebeadDepth
parameter.- Parameters:
isEnabled
- aboolean
.- Throws:
ChangeVetoException
- if an error occurs.
-