Class LabelStyle

  • All Implemented Interfaces:
    Style

    @Equality
    public class LabelStyle
    extends java.lang.Object
    implements Style
    Style for LabelPlotter.
    Since:
    15 Feb 2013
    Author:
    Mark Taylor
    • Constructor Summary

      Constructors 
      Constructor Description
      LabelStyle​(Captioner captioner, Anchor anchor, java.awt.Color color, int spacing, byte crowdLimit, java.awt.Point offset)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void drawLabel​(java.awt.Graphics g, Caption label)
      Draws the label at the origin without colouring it.
      boolean equals​(java.lang.Object o)  
      Anchor getAnchor()
      Returns the positioning anchor used by this style.
      java.awt.Rectangle getCaptionBounds​(Caption label)
      Returns a rectangle within which all of the given label will fall.
      Captioner getCaptioner()
      Returns the captioner used by this style.
      java.awt.Color getColor()
      Returns the colour used by this style.
      byte getCrowdLimit()
      Returns the number of labels allowed within spacing pixels.
      javax.swing.Icon getLegendIcon()
      Returns an icon suitable for displaying in a legend for this style.
      int getSpacing()
      Returns the minimum pixel spacing permitted between labels.
      int hashCode()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LabelStyle

        public LabelStyle​(Captioner captioner,
                          Anchor anchor,
                          java.awt.Color color,
                          int spacing,
                          byte crowdLimit,
                          java.awt.Point offset)
        Constructor.
        Parameters:
        captioner - renders text to graphics
        anchor - positions text relative to plot point
        color - text colour
        spacing - minimum pixel distance between labels
        crowdLimit - number of labels allowed within spacing
        offset - pixel offset for label positioning
    • Method Detail

      • getLegendIcon

        public javax.swing.Icon getLegendIcon()
        Description copied from interface: Style
        Returns an icon suitable for displaying in a legend for this style.
        Specified by:
        getLegendIcon in interface Style
      • getCaptioner

        public Captioner getCaptioner()
        Returns the captioner used by this style.
        Returns:
        captioner
      • getAnchor

        public Anchor getAnchor()
        Returns the positioning anchor used by this style.
        Returns:
        anchor
      • getColor

        public java.awt.Color getColor()
        Returns the colour used by this style.
        Returns:
        colour
      • getSpacing

        public int getSpacing()
        Returns the minimum pixel spacing permitted between labels.
        Returns:
        label spacing in pixels
      • getCrowdLimit

        public byte getCrowdLimit()
        Returns the number of labels allowed within spacing pixels.
        Returns:
        crowd limit
      • drawLabel

        public void drawLabel​(java.awt.Graphics g,
                              Caption label)
        Draws the label at the origin without colouring it. The drawing is therefore in the default colour of the graphics context.
        Parameters:
        g - graphics context
        label - text content
      • getCaptionBounds

        public java.awt.Rectangle getCaptionBounds​(Caption label)
        Returns a rectangle within which all of the given label will fall.
        Parameters:
        label - text content
        Returns:
        bounding box
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object