# Class PolygonShape

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

@Equality public abstract class PolygonShape extends Object
Object that knows how to draw a polygon.

Since:
  5 Oct 2021
Author:
  Mark Taylor

## Field Summary

Fields
Modifier and Type
Field
Description
`static final PolygonShape[]`
`POLYSHAPES`
Array of known shape instances.

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`PolygonShape(String name, String description)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`abstract Glyph`
`createPolygonGlyph(int x0, int y0, int[] xs, int[] ys, int np)`
Returns a glyph representing a polygon with the given vertices.
`String`
`getDescription()`
Returns a short description for this shape.
`String`
`getName()`
Returns this shape's name.
`String`
`toString()`
`abstract PolygonShape`
`toThicker(int nthick)`
Returns a version of this shape with thicker lines; may be this object if line thickening would have no effect.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Field Details

### POLYSHAPES

public static final PolygonShape[] POLYSHAPES
Array of known shape instances.

## Constructor Details

### PolygonShape

protected PolygonShape(String name, String description)
Constructor.

Parameters:
  `name` - name
  `description` - short human-readable description

## Method Details

### createPolygonGlyph

public abstract Glyph createPolygonGlyph(int x0, int y0, int[] xs, int[] ys, int np)
Returns a glyph representing a polygon with the given vertices.

Parameters:
  `x0` - X coordinate of nominal center
  `y0` - Y coordinate of nominal center
  `xs` - X coordinates of vertices
  `ys` - Y coordinates of vertices
  `np` - number of vertices

### toThicker

public abstract PolygonShape toThicker(int nthick)
Returns a version of this shape with thicker lines; may be this object if line thickening would have no effect.

Parameters:
  `nthick` - line thickness index >=0
Returns:
  thicker shape

### getName

public String getName()
Returns this shape's name.

Returns:
  name

### getDescription

public String getDescription()
Returns a short description for this shape.

Returns:
  human-readable plain-text description

### toString

public String toString()

Overrides:
  `toString` in class `Object`