# Class MultiPointShape

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

public abstract class MultiPointShape extends Object
Defines a graphical shape with coordinates supplied by a number of offset points.

This code is a reworked version of the class `ErrorRenderer`, originally intended for drawing error bars, but the usage is more general than that.

Since:
  21 Sep 2021
Author:
  Mark Taylor

## Field Summary

Fields
Modifier and Type
Field
Description
`static final MultiPointShape`
`DEFAULT`
General purpose multi-point shape.
`static final MultiPointShape`
`EXAMPLE`
Shape suitable for use in user controls.
`static final MultiPointShape`
`NONE`
Multi-point shape which draws nothing.

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`MultiPointShape(String name, int iconDim, boolean canThick)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`canThick()`
Indicates whether variants of this shape with different line thicknesses are available.
`abstract MultiPointScribe`
`createScribe(int nthick)`
Returns an object that can turn offset arrays into painted shapes with configurable line thickness.
`Icon`
`getLegendIcon()`
Returns an icon giving a general example of what this shape looks like.
`Icon`
`getLegendIcon(MultiPointScribe scribe, ErrorMode[] modes, int width, int height, int xpad, int ypad)`
Returns an icon giving an example of what this shape looks like in a detailed context.
`String`
`getName()`
Returns a user-readable name for this shape.
`static MultiPointShape[]`
`getOptionsEllipse()`
Returns an array of instances which is suitable for 2d ellipse-like applications.
`static MultiPointShape[]`
`getOptionsError1d()`
Returns an array of instances which can render 1-dimensional (vertical) errors.
`static MultiPointShape[]`
`getOptionsError2d()`
Returns an array of instances which can render 2-dimensional errors.
`static MultiPointShape[]`
`getOptionsError3d()`
Returns an array of instances which can render 3-dimensional errors.
`static MultiPointShape[]`
`getOptionsVector()`
Returns an array of instances which is suitable for vector-like applications.
`abstract boolean`
`supportsDimensionality(int ndim)`
Reports whether this shape can be used in a given dimensionality.
`String`
`toString()`

### Methods inherited from class Object

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

## Field Details

### NONE

public static final MultiPointShape NONE
Multi-point shape which draws nothing.

### DEFAULT

public static final MultiPointShape DEFAULT
General purpose multi-point shape.

### EXAMPLE

public static final MultiPointShape EXAMPLE
Shape suitable for use in user controls.

## Constructor Details

### MultiPointShape

protected MultiPointShape(String name, int iconDim, boolean canThick)
Constructor.

Parameters:
  `name` - user-directed shape name
  `iconDim` - dimensionality to use for basic icon generation
  `canThick` - true iff this shape is available in different line thicknesses

## Method Details

### getLegendIcon

public Icon getLegendIcon()
Returns an icon giving a general example of what this shape looks like.

Returns:
  example icon

### getLegendIcon

public Icon getLegendIcon(MultiPointScribe scribe, ErrorMode[] modes, int width, int height, int xpad, int ypad)
Returns an icon giving an example of what this shape looks like in a detailed context.

Parameters:
  `scribe` - shape painter
  `modes` - array of ErrorModes, one per error dimension (x, y, ...)
  `width` - total width of icon
  `height` - total height of icon
  `xpad` - internal horizontal padding of icon
  `ypad` - internal vertical padding of icon

### supportsDimensionality

public abstract boolean supportsDimensionality(int ndim)
Reports whether this shape can be used in a given dimensionality.

Parameters:
  `ndim` - number of error dimensions to be used
Returns:
  true iff this object can do rendering

### createScribe

public abstract MultiPointScribe createScribe(int nthick)
Returns an object that can turn offset arrays into painted shapes with configurable line thickness. If `canThick()` returns false, the parameter makes no difference.

Parameters:
  `nthick` - non-negative line thickness, 0 is single-pixel
Returns:
  shape painter

### canThick

public boolean canThick()
Indicates whether variants of this shape with different line thicknesses are available. For some shapes, for instance filled rectangles, the line thickness makes no difference.

Returns:
  true iff the argument to `createScribe(int)` makes any difference

### getName

public String getName()
Returns a user-readable name for this shape.

Returns:
  shape name

### toString

public String toString()

Overrides:
  `toString` in class `Object`

### getOptionsError1d

public static MultiPointShape[] getOptionsError1d()
Returns an array of instances which can render 1-dimensional (vertical) errors.

Returns:
  selection of shapes

### getOptionsError2d

public static MultiPointShape[] getOptionsError2d()
Returns an array of instances which can render 2-dimensional errors.

Returns:
  selection of shapes

### getOptionsError3d

public static MultiPointShape[] getOptionsError3d()
Returns an array of instances which can render 3-dimensional errors.

Returns:
  selection of shapes

### getOptionsEllipse

public static MultiPointShape[] getOptionsEllipse()
Returns an array of instances which is suitable for 2d ellipse-like applications.

Returns:
  selection of shapes

### getOptionsVector

public static MultiPointShape[] getOptionsVector()
Returns an array of instances which is suitable for vector-like applications.

Returns:
  selection of shapes