Package org.biojava.bio.gui.sequence
Class RectangularImapRenderer
java.lang.Object
org.biojava.bio.gui.sequence.RectangularImapRenderer
- All Implemented Interfaces:
Serializable
,BeadFeatureRenderer
,FeatureRenderer
,ImageMapRenderer
public class RectangularImapRenderer
extends Object
implements BeadFeatureRenderer, ImageMapRenderer, Serializable
RectangularImapRenderer
is a decorator for
RectangularBeadRenderer
which adds the ability to
create HTML image map coordinates which correspond to the feature
rendering produced by the RectangularBeadRenderer
.- Since:
- 1.3
- Author:
- Keith James
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionRectangularImapRenderer
(RectangularBeadRenderer renderer, ImageMap imageMap, URLFactory urlFactory) Creates a newRectangularImapRenderer
. -
Method Summary
Modifier and TypeMethodDescriptiondouble
getBeadDepth
returns the depth of a single bead produced by the renderer.double
getBeadDisplacement
returns the displacement of beads from the centre line of the renderer.double
getDepth
(SequenceRenderContext context) boolean
getHeightScaling
returns the state of the height scaling policy.getImageMap
returns the current image map.processMouseEvent
(FeatureHolder holder, SequenceRenderContext context, MouseEvent mEvent) void
renderBead
(Graphics2D g2, Feature f, SequenceRenderContext context) renderBead
should implement rendering for this bead type only.void
renderFeature
(Graphics2D g2, Feature f, SequenceRenderContext context) void
renderImageMap
(Graphics2D g2, Feature f, SequenceRenderContext context) renderImageMap
writes a set of image map coordinates corresponding to the rectangle drawn by the renderer.void
setDelegateRenderer
(OptimizableFilter filter, BeadFeatureRenderer renderer) setDelegateRenderer
for the specified filter.void
setHeightScaling
(boolean isEnabled) setHeightScaling
sets the height scaling policy.void
setImageMap
(ImageMap imageMap) setImageMap
sets the current image map.
-
Constructor Details
-
RectangularImapRenderer
public RectangularImapRenderer(RectangularBeadRenderer renderer, ImageMap imageMap, URLFactory urlFactory) Creates a newRectangularImapRenderer
.- Parameters:
renderer
- aRectangularBeadRenderer
.imageMap
- anImageMap
.urlFactory
- aURLFactory
which should be capable of creating a suitable URL from eachFeature
on theSequence
to be rendered.
-
-
Method Details
-
getImageMap
getImageMap
returns the current image map.- Returns:
- an
ImageMap
.
-
setImageMap
setImageMap
sets the current image map.- Parameters:
imageMap
- anImageMap
.
-
setDelegateRenderer
setDelegateRenderer
for the specified filter.- Specified by:
setDelegateRenderer
in interfaceBeadFeatureRenderer
- Parameters:
filter
- anOptimizableFilter
.renderer
- aBeadFeatureRenderer
.
-
renderImageMap
renderImageMap
writes a set of image map coordinates corresponding to the rectangle drawn by the renderer. The hotspots created by this method have the renderedFeature
set as their user object.This method is called by
renderFeature
when a raster image is rendered.- Specified by:
renderImageMap
in interfaceImageMapRenderer
- Parameters:
g2
- aGraphics2D
.f
- aFeature
.context
- aSequenceRenderContext
.
-
renderFeature
- Specified by:
renderFeature
in interfaceFeatureRenderer
-
renderBead
Description copied from interface:BeadFeatureRenderer
renderBead
should implement rendering for this bead type only. TherenderFeature
method is expected to handle the calls to delegate renderers.- Specified by:
renderBead
in interfaceBeadFeatureRenderer
- Parameters:
g2
- aGraphics2D
.f
- aFeature
to render.context
- aSequenceRenderContext
context.
-
getDepth
- Specified by:
getDepth
in interfaceFeatureRenderer
-
getBeadDepth
Description copied from interface:BeadFeatureRenderer
getBeadDepth
returns the depth of a single bead produced by the renderer.- Specified by:
getBeadDepth
in interfaceBeadFeatureRenderer
- Returns:
- a
double
.
-
getBeadDisplacement
Description copied from interface:BeadFeatureRenderer
getBeadDisplacement
returns the displacement of beads from the centre line of the renderer. A positive value indicates displacment downwards (for horizontal renderers) or to the right (for vertical renderers).- Specified by:
getBeadDisplacement
in interfaceBeadFeatureRenderer
- 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.
-
processMouseEvent
public FeatureHolder processMouseEvent(FeatureHolder holder, SequenceRenderContext context, MouseEvent mEvent) - Specified by:
processMouseEvent
in interfaceFeatureRenderer
-