# Class ShapeMode

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

All Implemented Interfaces:
  `ModePlotter.Mode`

public abstract class ShapeMode extends Object implements ModePlotter.Mode
Defines how outlines defined by a ShapeForm are coloured in a plot. This abstract class contains several implementations (inner classes). It's rather crowded, should possibly be split into several files.

Since:
  19 Feb 2013
Author:
  Mark Taylor

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static class`
`ShapeMode.AutoTransparentStamper`
Stamper implementation for auto transparency.
`static class`
`ShapeMode.DensityStamper`
Stamper implementation for density mode.
`static class`
`ShapeMode.FlatStamper`
Stamper implementation for flat colouring.
`static class`
`ShapeMode.ShadeStamper`
Stamper implementation for use with AuxShadingMode.
`static class`
`ShapeMode.WeightStamper`
Stamper implementation for use with WeightedShadingMode.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final ShapeMode`
`AUTO`
Auto density mode, no user settings.
`static final ShapeMode`
`AUX`
Aux variable colouring mode with global colour map.
`static final ShapeMode`
`AUX_PRIVATE`
`static final ShapeMode`
`DENSITY`
Configurable density mode.
`static final ShapeMode`
`FLAT2D`
Simple flat mode for use with 2D plots.
`static final ShapeMode`
`FLAT3D`
Simple flat mode for use with 3D plots.
`static final ShapeMode`
`IRGB`
Flat RGB mode.
`static final ShapeMode[]`
`MODES_2D`
List of modes suitable for use with 2D plotting.
`static final ShapeMode[]`
`MODES_3D`
List of modes suitable for use with 3D plotting.
`static final ReportKey<Double>`
`REPKEY_SKYPIX`
Report key for nominal pixel size in square degrees.
`static final ReportKey<Double>`
`REPKEY_XPIX`
Report key for pixel X dimension in data coordinates.
`static final ReportKey<Double>`
`REPKEY_YPIX`
Report key for pixel Y dimension in data coordinates.
`static final ShapeMode`
`TRANSLUCENT`
Transparency with automatic adjustment of opacity level.
`static final ShapeMode`
`TRANSPARENT2D`
Transparency with explicit opacity setting, suitable for 2D plots.
`static final ShapeMode`
`TRANSPARENT3D`
Transparency with explicit opacity setting, suitable for 3D plots.
`static final ShapeMode`
`WEIGHTED`
Weighted density mode with global colour map.
`static final ShapeMode`
`WEIGHTED_PRIVATE`

## Constructor Summary

Constructors
Constructor
Description
`ShapeMode(String name, Icon icon, Coord[] extraCoords, boolean hasReports)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`static Icon`
`createColoredIcon(Icon base, Shader shader, float value)`
Returns a wrapped icon whose painting is done in the context of a forground colour got by applying a given shader and shading value.
`abstract PlotLayer`
`createLayer(ShapePlotter plotter, ShapeForm form, DataGeom geom, DataSpec dataSpec, Outliner outliner, Stamper stamper)`
Creates a plot layer.
`abstract Stamper`
`createStamper(ConfigMap config)`
Returns an object which will do the work of colouring in shapes when supplied with the appropriate style information and data.
`abstract ConfigKey<?>[]`
`getConfigKeys()`
Returns style configuration keys associated with this mode.
`Coord[]`
`getExtraCoords()`
Returns the additional coordinates associated with this mode.
`abstract String`
`getModeDescription()`
Returns a description of this mode as an XML string.
`Icon`
`getModeIcon()`
Returns an icon to identify this mode in the GUI.
`String`
`getModeName()`
Returns the user-directed name for this mode.
`boolean`
`hasReports()`
Indicates whether the drawing produced by this mode willl return general interest report information to upstream plotting code.
`static String`
`modeRef(ShapeMode mode)`
Returns an XML reference to the given mode.

### Methods inherited from class Object

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

## Field Details

### AUTO

public static final ShapeMode AUTO
Auto density mode, no user settings.

### FLAT2D

public static final ShapeMode FLAT2D
Simple flat mode for use with 2D plots.

### FLAT3D

public static final ShapeMode FLAT3D
Simple flat mode for use with 3D plots.

### TRANSLUCENT

public static final ShapeMode TRANSLUCENT
Transparency with automatic adjustment of opacity level.

### TRANSPARENT2D

public static final ShapeMode TRANSPARENT2D
Transparency with explicit opacity setting, suitable for 2D plots.

### TRANSPARENT3D

public static final ShapeMode TRANSPARENT3D
Transparency with explicit opacity setting, suitable for 3D plots.

### DENSITY

public static final ShapeMode DENSITY
Configurable density mode.

### AUX

public static final ShapeMode AUX
Aux variable colouring mode with global colour map.

### WEIGHTED

public static final ShapeMode WEIGHTED
Weighted density mode with global colour map.

### AUX_PRIVATE

public static final ShapeMode AUX_PRIVATE

### WEIGHTED_PRIVATE

public static final ShapeMode WEIGHTED_PRIVATE

### IRGB

public static final ShapeMode IRGB
Flat RGB mode.

### MODES_2D

public static final ShapeMode[] MODES_2D
List of modes suitable for use with 2D plotting.

### MODES_3D

public static final ShapeMode[] MODES_3D
List of modes suitable for use with 3D plotting.

### REPKEY_XPIX

public static final ReportKey<Double> REPKEY_XPIX
Report key for pixel X dimension in data coordinates.

### REPKEY_YPIX

public static final ReportKey<Double> REPKEY_YPIX
Report key for pixel Y dimension in data coordinates.

### REPKEY_SKYPIX

public static final ReportKey<Double> REPKEY_SKYPIX
Report key for nominal pixel size in square degrees.

## Constructor Details

### ShapeMode

public ShapeMode(String name, Icon icon, Coord[] extraCoords, boolean hasReports)
Constructor.

Parameters:
  `name` - mode name
  `icon` - mode icon
  `extraCoords` - data coordinates associated with this mode (not positional ones)
  `hasReports` - whether plot reports containing genera-interest plot information are generated

## Method Details

### getModeName

public String getModeName()
Description copied from interface: `ModePlotter.Mode`
Returns the user-directed name for this mode.

Specified by:
  `getModeName` in interface `ModePlotter.Mode`
Returns:
  mode name

### getModeIcon

public Icon getModeIcon()
Description copied from interface: `ModePlotter.Mode`
Returns an icon to identify this mode in the GUI.

Specified by:
  `getModeIcon` in interface `ModePlotter.Mode`
Returns:
  mode icon

### hasReports

public boolean hasReports()
Indicates whether the drawing produced by this mode willl return general interest report information to upstream plotting code.

Returns:
  true if the plot report may contain interesting information

### getModeDescription

public abstract String getModeDescription()
Returns a description of this mode as an XML string. The return value should be one or more <p> elements.

Returns:
  XML description of mode

### getExtraCoords

public Coord[] getExtraCoords()
Returns the additional coordinates associated with this mode.

Returns:
  array of non-positional coordinates associated with colouring

### getConfigKeys

public abstract ConfigKey<?>[] getConfigKeys()
Returns style configuration keys associated with this mode. These keys will be used in the config map supplied to `createStamper(ConfigMap)`.

Returns:
  array of config keys for mode

### createStamper

public abstract Stamper createStamper(ConfigMap config)
Returns an object which will do the work of colouring in shapes when supplied with the appropriate style information and data. The significant keys in the supplied config map are those given by `getConfigKeys()`.

Parameters:
  `config` - configuration map from which values for this mode's config keys will be extracted
Returns:
  new stamper object

### createLayer

public abstract PlotLayer createLayer(ShapePlotter plotter, ShapeForm form, DataGeom geom, DataSpec dataSpec, Outliner outliner, Stamper stamper)
Creates a plot layer.

Parameters:
  `plotter` - plotter
  `form` - shape form
  `geom` - data coordinate specification
  `dataSpec` - data specification
  `outliner` - shape outliner
  `stamper` - shape stamper
Returns:
  new layer

### createColoredIcon

public static Icon createColoredIcon(Icon base, Shader shader, float value)
Returns a wrapped icon whose painting is done in the context of a forground colour got by applying a given shader and shading value.

Parameters:
  `base` - base icon
  `shader` - colour shader
  `value` - value in range 0-1 at which shader should be applied
Returns:
  coloured icon

### modeRef

public static String modeRef(ShapeMode mode)
Returns an XML reference to the given mode.

Parameters:
  `mode` - shape mode
Returns:
  <ref> element with content `mode.getModeName()`