# Class LabelStyle

java.lang.Object
uk.ac.starlink.ttools.plot2.layer.LabelStyle

All Implemented Interfaces:
  `Style`

@Equality public class LabelStyle extends Object implements Style
Style for LabelPlotter.

Since:
  15 Feb 2013
Author:
  Mark Taylor

## Constructor Summary

Constructors
Constructor
Description
`LabelStyle(Captioner captioner, Anchor anchor, Color color, int spacing, byte crowdLimit, Point offset)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`void`
`drawLabel(Graphics g, Caption label)`
Draws the label at the origin without colouring it.
`boolean`
`equals(Object o)`
`Anchor`
`getAnchor()`
Returns the positioning anchor used by this style.
`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.
`Color`
`getColor()`
Returns the colour used by this style.
`byte`
`getCrowdLimit()`
Returns the number of labels allowed within spacing pixels.
`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 Object

`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### LabelStyle

public LabelStyle(Captioner captioner, Anchor anchor, Color color, int spacing, byte crowdLimit, 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 Details

### getLegendIcon

public 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 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(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 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(Object o)

Overrides:
  `equals` in class `Object`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`