Class 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 Details

  • Constructor Details

    • RectangularBeadRenderer

      Creates a new RectangularBeadRenderer with the default settings.
    • RectangularBeadRenderer

      public RectangularBeadRenderer(double beadDepth, double beadDisplacement, Paint beadOutline, Paint beadFill, Stroke beadStroke)
      Creates a new RectangularBeadRenderer.
      Parameters:
      beadDepth - a double.
      beadDisplacement - a double.
      beadOutline - a Paint.
      beadFill - a Paint.
      beadStroke - a Stroke.
  • Method Details

    • renderBead

      public void renderBead(Graphics2D g2, Feature f, SequenceRenderContext context)
      renderBead renders features as simple rectangle.
      Specified by:
      renderBead in interface BeadFeatureRenderer
      Specified by:
      renderBead in class AbstractBeadRenderer
      Parameters:
      g2 - a Graphics2D.
      f - a Feature to render.
      context - a SequenceRenderContext context.
    • getDepth

      public double getDepth(SequenceRenderContext context)
      getDepth calculates the depth required by this renderer to display its beads.
      Specified by:
      getDepth in interface FeatureRenderer
      Overrides:
      getDepth in class AbstractBeadRenderer
      Parameters:
      context - a SequenceRenderContext.
      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.