Class RectangularImapRenderer

  • All Implemented Interfaces:
    java.io.Serializable, BeadFeatureRenderer, FeatureRenderer, ImageMapRenderer

    public class RectangularImapRenderer
    extends java.lang.Object
    implements BeadFeatureRenderer, ImageMapRenderer, java.io.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:
    Serialized Form
    • Constructor Detail

      • RectangularImapRenderer

        public RectangularImapRenderer​(RectangularBeadRenderer renderer,
                                       ImageMap imageMap,
                                       URLFactory urlFactory)
        Creates a new RectangularImapRenderer.
        Parameters:
        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.
    • Method Detail

      • getImageMap

        public ImageMap getImageMap()
        getImageMap returns the current image map.
        Returns:
        an ImageMap.
      • setImageMap

        public void setImageMap​(ImageMap imageMap)
        setImageMap sets the current image map.
        Parameters:
        imageMap - an ImageMap.
      • renderImageMap

        public void renderImageMap​(java.awt.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.

        Specified by:
        renderImageMap in interface ImageMapRenderer
        Parameters:
        g2 - a Graphics2D.
        f - a Feature.
        context - a SequenceRenderContext.
      • renderBead

        public void renderBead​(java.awt.Graphics2D g2,
                               Feature f,
                               SequenceRenderContext context)
        Description copied from interface: BeadFeatureRenderer
        renderBead should implement rendering for this bead type only. The renderFeature method is expected to handle the calls to delegate renderers.
        Specified by:
        renderBead in interface BeadFeatureRenderer
        Parameters:
        g2 - a Graphics2D.
        f - a Feature to render.
        context - a SequenceRenderContext context.
      • getBeadDepth

        public double getBeadDepth()
        Description copied from interface: BeadFeatureRenderer
        getBeadDepth returns the depth of a single bead produced by the renderer.
        Specified by:
        getBeadDepth in interface BeadFeatureRenderer
        Returns:
        a double.
      • getBeadDisplacement

        public 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 interface BeadFeatureRenderer
        Returns:
        a double.
      • getHeightScaling

        public boolean getHeightScaling()
        getHeightScaling returns the state of the height scaling policy.
        Returns:
        a boolean true if height scaling is enabled.
      • setHeightScaling

        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.
        Parameters:
        isEnabled - a boolean.
        Throws:
        ChangeVetoException - if an error occurs.