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
RectangularImapRendereris a decorator forRectangularBeadRendererwhich adds the ability to create HTML image map coordinates which correspond to the feature rendering produced by theRectangularBeadRenderer.- Since:
- 1.3
- Author:
- Keith James
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description RectangularImapRenderer(RectangularBeadRenderer renderer, ImageMap imageMap, URLFactory urlFactory)Creates a newRectangularImapRenderer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublegetBeadDepth()getBeadDepthreturns the depth of a single bead produced by the renderer.doublegetBeadDisplacement()getBeadDisplacementreturns the displacement of beads from the centre line of the renderer.doublegetDepth(SequenceRenderContext context)booleangetHeightScaling()getHeightScalingreturns the state of the height scaling policy.ImageMapgetImageMap()getImageMapreturns the current image map.FeatureHolderprocessMouseEvent(FeatureHolder holder, SequenceRenderContext context, MouseEvent mEvent)voidrenderBead(Graphics2D g2, Feature f, SequenceRenderContext context)renderBeadshould implement rendering for this bead type only.voidrenderFeature(Graphics2D g2, Feature f, SequenceRenderContext context)voidrenderImageMap(Graphics2D g2, Feature f, SequenceRenderContext context)renderImageMapwrites a set of image map coordinates corresponding to the rectangle drawn by the renderer.voidsetDelegateRenderer(OptimizableFilter filter, BeadFeatureRenderer renderer)setDelegateRendererfor the specified filter.voidsetHeightScaling(boolean isEnabled)setHeightScalingsets the height scaling policy.voidsetImageMap(ImageMap imageMap)setImageMapsets the current image map.
-
-
-
Constructor Detail
-
RectangularImapRenderer
public RectangularImapRenderer(RectangularBeadRenderer renderer, ImageMap imageMap, URLFactory urlFactory)
Creates a newRectangularImapRenderer.- Parameters:
renderer- aRectangularBeadRenderer.imageMap- anImageMap.urlFactory- aURLFactorywhich should be capable of creating a suitable URL from eachFeatureon theSequenceto be rendered.
-
-
Method Detail
-
getImageMap
public ImageMap getImageMap()
getImageMapreturns the current image map.- Returns:
- an
ImageMap.
-
setImageMap
public void setImageMap(ImageMap imageMap)
setImageMapsets the current image map.- Parameters:
imageMap- anImageMap.
-
setDelegateRenderer
public void setDelegateRenderer(OptimizableFilter filter, BeadFeatureRenderer renderer)
setDelegateRendererfor the specified filter.- Specified by:
setDelegateRendererin interfaceBeadFeatureRenderer- Parameters:
filter- anOptimizableFilter.renderer- aBeadFeatureRenderer.
-
renderImageMap
public void renderImageMap(Graphics2D g2, Feature f, SequenceRenderContext context)
renderImageMapwrites a set of image map coordinates corresponding to the rectangle drawn by the renderer. The hotspots created by this method have the renderedFeatureset as their user object.This method is called by
renderFeaturewhen a raster image is rendered.- Specified by:
renderImageMapin interfaceImageMapRenderer- Parameters:
g2- aGraphics2D.f- aFeature.context- aSequenceRenderContext.
-
renderFeature
public void renderFeature(Graphics2D g2, Feature f, SequenceRenderContext context)
- Specified by:
renderFeaturein interfaceFeatureRenderer
-
renderBead
public void renderBead(Graphics2D g2, Feature f, SequenceRenderContext context)
Description copied from interface:BeadFeatureRendererrenderBeadshould implement rendering for this bead type only. TherenderFeaturemethod is expected to handle the calls to delegate renderers.- Specified by:
renderBeadin interfaceBeadFeatureRenderer- Parameters:
g2- aGraphics2D.f- aFeatureto render.context- aSequenceRenderContextcontext.
-
getDepth
public double getDepth(SequenceRenderContext context)
- Specified by:
getDepthin interfaceFeatureRenderer
-
getBeadDepth
public double getBeadDepth()
Description copied from interface:BeadFeatureRenderergetBeadDepthreturns the depth of a single bead produced by the renderer.- Specified by:
getBeadDepthin interfaceBeadFeatureRenderer- Returns:
- a
double.
-
getBeadDisplacement
public double getBeadDisplacement()
Description copied from interface:BeadFeatureRenderergetBeadDisplacementreturns 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:
getBeadDisplacementin interfaceBeadFeatureRenderer- Returns:
- a
double.
-
getHeightScaling
public boolean getHeightScaling()
getHeightScalingreturns the state of the height scaling policy.- Returns:
- a
booleantrue if height scaling is enabled.
-
setHeightScaling
public void setHeightScaling(boolean isEnabled) throws ChangeVetoException
setHeightScalingsets 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 thebeadDepthset in the constructor. If disabled, features will always be drawn at the maximum height allowed by thebeadDepthparameter.- Parameters:
isEnabled- aboolean.- Throws:
ChangeVetoException- if an error occurs.
-
processMouseEvent
public FeatureHolder processMouseEvent(FeatureHolder holder, SequenceRenderContext context, MouseEvent mEvent)
- Specified by:
processMouseEventin interfaceFeatureRenderer
-
-