# Class MultiPointForm

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

All Implemented Interfaces:
  `ModePlotter.Form, ShapeForm`

Direct Known Subclasses:
  `CartesianMultiPointForm, SkyMultiPointForm`

public abstract class MultiPointForm extends Object implements ShapeForm
ShapeForm implementation that draws shapes based on a single main position, and a number of additional positions supplied as `extra` coordinates. The extra coordinates required (defining one or more non-central data positions) are defined by a supplied `MultiPointCoordSet` and those coordinates are then plotted by a corresponding `MultiPointShape`.

Since:
  18 Feb 2013
Author:
  Mark Taylor

## Field Summary

Fields
Modifier and Type
Field
Description
`static final int`
`AUTOSCALE_PIXELS`
Size of longest/characteristic shape in pixels when autoscaled.

## Constructor Summary

Constructors
Constructor
Description
`MultiPointForm(String name, Icon icon, String description, MultiPointCoordSet extraCoordSet, MultiPointConfigKey shapeKey, ConfigKey<Double> scaleKey, ConfigKey<?>[] otherKeys)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`DataGeom`
`adjustGeom(DataGeom geom, DataSpec dataSpec, ShapeStyle style)`
Provides a DataGeom to be used by the layer this form makes, given a DataGeom that characterises the plotting environment.
`Outliner`
`createOutliner(ConfigMap config)`
Returns an object which will do the work of drawing shapes when supplied with the appropriate style information and data.
`protected abstract MultiPointReader`
`createReader(ConfigMap config)`
Returns an object that can read shapes for use by this form.
`static ConfigKey<Integer>`
`createThicknessKey(MultiPointConfigKey shapeKey)`
Creates a config key for line thickness to be used with MultiPointShapes.
`int`
`getBasicPositionCount()`
Returns the number of basic data positions per tuple used by this form.
`ConfigKey<?>[]`
`getConfigKeys()`
Returns style configuration keys specific to this form.
`static String`
`getDefaultScalingDescription(String shapename)`
Returns XML text suitable for inclusion in a MultiPointForm description explaining how the scaling of marker sizes is controlled.
`Coord[]`
`getExtraCoords()`
Returns data coordinates additional to the basic position which are required to plot a point.
`int`
`getExtraPositionCount()`
Returns the number of extra coordinates that can be interpreted as positions.
`static int`
`getExtrasCoordIndex(DataGeom geom)`
Returns the column index in a tuple sequence at which the extra (multi-point) coordinates start.
`String`
`getFormDescription()`
Returns a description of this mode as an XML string.
`Icon`
`getFormIcon()`
Returns an icon to identify this form in the GUI.
`String`
`getFormName()`
Returns the user-directed name for this form.

### Methods inherited from class Object

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

## Field Details

### AUTOSCALE_PIXELS

public static final int AUTOSCALE_PIXELS
Size of longest/characteristic shape in pixels when autoscaled.

See Also:
  - Constant Field Values

## Constructor Details

### MultiPointForm

public MultiPointForm(String name, Icon icon, String description, MultiPointCoordSet extraCoordSet, MultiPointConfigKey shapeKey, ConfigKey<Double> scaleKey, ConfigKey<?>[] otherKeys)
Constructor.

Parameters:
  `name` - shapeform name
  `icon` - shapeform icon
  `description` - XML description
  `extraCoordSet` - defines the extra positional coordinates used to plot multipoint shapes
  `shapeKey` - config key for the shape; provides option to vary the shape, but any shape specified by it must be expecting data corresponding to the `extraCoordSet` parameter
  `scaleKey` - config key for scaling graphical display, or null if no scaling is available
  `otherKeys` - additional config keys

## Method Details

### createReader

protected abstract MultiPointReader createReader(ConfigMap config)
Returns an object that can read shapes for use by this form.

Parameters:
  `config` - configuration options
Returns:
  reader

### getBasicPositionCount

public int getBasicPositionCount()
Description copied from interface: `ShapeForm`
Returns the number of basic data positions per tuple used by this form.

Specified by:
  `getBasicPositionCount` in interface `ShapeForm`
Returns:
  number of basic sets of positional coordinates

### getFormName

public String getFormName()
Description copied from interface: `ModePlotter.Form`
Returns the user-directed name for this form.

Specified by:
  `getFormName` in interface `ModePlotter.Form`
Returns:
  form name

### getFormIcon

public Icon getFormIcon()
Description copied from interface: `ModePlotter.Form`
Returns an icon to identify this form in the GUI.

Specified by:
  `getFormIcon` in interface `ModePlotter.Form`
Returns:
  form icon

### getFormDescription

public String getFormDescription()
Description copied from interface: `ShapeForm`
Returns a description of this mode as an XML string. The return value should be one or more <p> elements.

Specified by:
  `getFormDescription` in interface `ShapeForm`
Returns:
  XML description of form

### getExtraCoords

public Coord[] getExtraCoords()
Description copied from interface: `ShapeForm`
Returns data coordinates additional to the basic position which are required to plot a point.

Specified by:
  `getExtraCoords` in interface `ShapeForm`
Returns:
  additional plot coordinates

### getExtraPositionCount

public int getExtraPositionCount()
Description copied from interface: `ShapeForm`
Returns the number of extra coordinates that can be interpreted as positions.

Specified by:
  `getExtraPositionCount` in interface `ShapeForm`
Returns:
  number of positional extra coordinates

### adjustGeom

public DataGeom adjustGeom(DataGeom geom, DataSpec dataSpec, ShapeStyle style)
Description copied from interface: `ShapeForm`
Provides a DataGeom to be used by the layer this form makes, given a DataGeom that characterises the plotting environment. The output should be similar to the input, for instance implementing the same plotType-specific DataGeom subtype.

In most cases the supplied DataGeom instance can be returned unchanged, but instances with special requirements may want to adjust how the data is interpreted.

Specified by:
  `adjustGeom` in interface `ShapeForm`
Parameters:
  `geom` - context geom
  `dataSpec` - data specification with which the geom will be used
  `style` - style with which the geom will be used
Returns:
  geom to use for data interpretation, the same or similar to the input

### getConfigKeys

public ConfigKey<?>[] getConfigKeys()
Description copied from interface: `ShapeForm`
Returns style configuration keys specific to this form. These keys will be used in the config map supplied to `ShapeForm.createOutliner(ConfigMap)`.

Specified by:
  `getConfigKeys` in interface `ShapeForm`
Returns:
  config keys

### createOutliner

public Outliner createOutliner(ConfigMap config)
Description copied from interface: `ShapeForm`
Returns an object which will do the work of drawing shapes when supplied with the appropriate style information and data. The significant keys in the supplied config map are those given by `ShapeForm.getConfigKeys()`.

Specified by:
  `createOutliner` in interface `ShapeForm`
Parameters:
  `config` - configuration map from which values for this form's config keys will be extracted
Returns:
  new outliner object

### getDefaultScalingDescription

public static String getDefaultScalingDescription(String shapename)
Returns XML text suitable for inclusion in a MultiPointForm description explaining how the scaling of marker sizes is controlled.

Parameters:
  `shapename` - human-readable name of the shape being plotted by this form
Returns:
  description text <p> element

### createThicknessKey

public static ConfigKey<Integer> createThicknessKey(MultiPointConfigKey shapeKey)
Creates a config key for line thickness to be used with MultiPointShapes.

Parameters:
  `shapeKey` - configured shape to which this relates
Returns:
  key for line thickness

### getExtrasCoordIndex

public static int getExtrasCoordIndex(DataGeom geom)
Returns the column index in a tuple sequence at which the extra (multi-point) coordinates start.

Parameters:
  `geom` - data position geometry
Returns:
  first non-central position coordinate index (others follow contiguously)