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
.Constructor and Description |
---|
RectangularImapRenderer(RectangularBeadRenderer renderer,
ImageMap imageMap,
URLFactory urlFactory)
Creates a new
RectangularImapRenderer . |
Modifier and Type | Method and Description |
---|---|
double |
getBeadDepth()
getBeadDepth returns the depth of a single bead
produced by the renderer. |
double |
getBeadDisplacement()
getBeadDisplacement returns the displacement of
beads from the centre line of the renderer. |
double |
getDepth(SequenceRenderContext context) |
boolean |
getHeightScaling()
getHeightScaling returns the state of the height
scaling policy. |
ImageMap |
getImageMap()
getImageMap returns the current image map. |
FeatureHolder |
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. |
public RectangularImapRenderer(RectangularBeadRenderer renderer, ImageMap imageMap, URLFactory urlFactory)
RectangularImapRenderer
.renderer
- a RectangularBeadRenderer
.imageMap
- an ImageMap
.urlFactory
- a URLFactory
which should be
capable of creating a suitable URL from each
Feature
on the Sequence
to be
rendered.public ImageMap getImageMap()
getImageMap
returns the current image map.ImageMap
.public void setImageMap(ImageMap imageMap)
setImageMap
sets the current image map.imageMap
- an ImageMap
.public void setDelegateRenderer(OptimizableFilter filter, BeadFeatureRenderer renderer)
setDelegateRenderer
for the specified filter.setDelegateRenderer
in interface BeadFeatureRenderer
filter
- an OptimizableFilter
.renderer
- a BeadFeatureRenderer
.public void renderImageMap(Graphics2D g2, Feature f, SequenceRenderContext context)
renderImageMap
writes a set of image map
coordinates corresponding to the rectangle drawn by the
renderer. The hotspots created by this method have the rendered
Feature
set as their user object.
This method is called by renderFeature
when a
raster image is rendered.
renderImageMap
in interface ImageMapRenderer
g2
- a Graphics2D
.f
- a Feature
.context
- a SequenceRenderContext
.public void renderFeature(Graphics2D g2, Feature f, SequenceRenderContext context)
renderFeature
in interface FeatureRenderer
public void renderBead(Graphics2D g2, Feature f, SequenceRenderContext context)
BeadFeatureRenderer
renderBead
should implement rendering for this
bead type only. The renderFeature
method is
expected to handle the calls to delegate renderers.renderBead
in interface BeadFeatureRenderer
g2
- a Graphics2D
.f
- a Feature
to render.context
- a SequenceRenderContext
context.public double getDepth(SequenceRenderContext context)
getDepth
in interface FeatureRenderer
public double getBeadDepth()
BeadFeatureRenderer
getBeadDepth
returns the depth of a single bead
produced by the renderer.getBeadDepth
in interface BeadFeatureRenderer
double
.public double getBeadDisplacement()
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).getBeadDisplacement
in interface BeadFeatureRenderer
double
.public boolean getHeightScaling()
getHeightScaling
returns the state of the height
scaling policy.boolean
true if height scaling is
enabled.public void setHeightScaling(boolean isEnabled) throws ChangeVetoException
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 the
beadDepth
set in the constructor. If disabled,
features will always be drawn at the maximum height allowed by
the beadDepth
parameter.isEnabled
- a boolean
.ChangeVetoException
- if an error occurs.public FeatureHolder processMouseEvent(FeatureHolder holder, SequenceRenderContext context, MouseEvent mEvent)
processMouseEvent
in interface FeatureRenderer
Copyright © 2014 BioJava. All rights reserved.