# Class GridPlotter

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

All Implemented Interfaces:
  `Plotter<GridPlotter.GridStyle>`

public class GridPlotter extends Object implements Plotter<GridPlotter.GridStyle>
Plotter that plots a genuine density map (2-d histogram) on a regular grid. It presents a single Decal, no glyph.

Since:
  13 Jan 2017
Author:
  Mark Taylor

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static class`
`GridPlotter.GridStyle`
Style for configuring the grid plot.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final ConfigKey<Combiner>`
`COMBINER_KEY`
Config key for combination mode.
`static final ReportKey<uk.ac.starlink.table.StarTable>`
`GRIDTABLE_KEY`
ReportKey for exported grid table.
`static final ConfigKey<Double>`
`TRANSPARENCY_KEY`
`static final ConfigKey<BinSizer>`
`XBINSIZER_KEY`
Config key for X bin size configuration.
`static final ReportKey<Double>`
`XBINWIDTH_KEY`
ReportKey for actual X bin extent.
`static final ConfigKey<Double>`
`XPHASE_KEY`
Config key for X bin phase.
`static final ConfigKey<BinSizer>`
`YBINSIZER_KEY`
Config key for Y bin size configuration.
`static final ReportKey<Double>`
`YBINWIDTH_KEY`
ReportKey for actual Y bin extent.
`static final ConfigKey<Double>`
`YPHASE_KEY`
Config key for Y bin phase.

## Constructor Summary

Constructors
Constructor
Description
`GridPlotter(boolean transparent)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`PlotLayer`
`createLayer(DataGeom geom, DataSpec dataSpec, GridPlotter.GridStyle style)`
Creates a PlotLayer based on the given geometry, data and style.
`GridPlotter.GridStyle`
`createStyle(ConfigMap config)`
Creates a style that can be used when creating a plot layer.
`CoordGroup`
`getCoordGroup()`
Returns an object describing which data coordinates are used for this plotter and how they are arranged in supplied DataSpec objects.
`String`
`getPlotterDescription()`
Returns an XML description of this plotter.
`Icon`
`getPlotterIcon()`
Returns an icon for this plotter for use in user interface.
`String`
`getPlotterName()`
Returns the name of this plotter for use in user interface.
`Object`
`getRangeStyleKey(GridPlotter.GridStyle style)`
Returns an opaque object characterising the region of the plot surface covered when using a given plotter style.
`ConfigKey<?>[]`
`getStyleKeys()`
Returns the configuration keys used to configure style for this plotter.
`boolean`
`hasReports()`
Indicates whether the drawings produced by this plotter will return general interest report information to upstream plotting code.

### Methods inherited from class Object

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

## Field Details

### XBINWIDTH_KEY

public static final ReportKey<Double> XBINWIDTH_KEY
ReportKey for actual X bin extent.

### YBINWIDTH_KEY

public static final ReportKey<Double> YBINWIDTH_KEY
ReportKey for actual Y bin extent.

### GRIDTABLE_KEY

public static final ReportKey<uk.ac.starlink.table.StarTable> GRIDTABLE_KEY
ReportKey for exported grid table.

### XBINSIZER_KEY

public static final ConfigKey<BinSizer> XBINSIZER_KEY
Config key for X bin size configuration.

### YBINSIZER_KEY

public static final ConfigKey<BinSizer> YBINSIZER_KEY
Config key for Y bin size configuration.

### XPHASE_KEY

public static final ConfigKey<Double> XPHASE_KEY
Config key for X bin phase.

### YPHASE_KEY

public static final ConfigKey<Double> YPHASE_KEY
Config key for Y bin phase.

### COMBINER_KEY

public static final ConfigKey<Combiner> COMBINER_KEY
Config key for combination mode.

### TRANSPARENCY_KEY

public static final ConfigKey<Double> TRANSPARENCY_KEY

## Constructor Details

### GridPlotter

public GridPlotter(boolean transparent)
Constructor.

Parameters:
  `transparent` - if true, there will be a config option for setting the alpha value of the whole layer

## Method Details

### getPlotterName

public String getPlotterName()
Description copied from interface: `Plotter`
Returns the name of this plotter for use in user interface.

Specified by:
  `getPlotterName` in interface `Plotter<GridPlotter.GridStyle>`
Returns:
  user-directed plotter name

### getPlotterIcon

public Icon getPlotterIcon()
Description copied from interface: `Plotter`
Returns an icon for this plotter for use in user interface.

Specified by:
  `getPlotterIcon` in interface `Plotter<GridPlotter.GridStyle>`
Returns:
  plotter icon

### getCoordGroup

public CoordGroup getCoordGroup()
Description copied from interface: `Plotter`
Returns an object describing which data coordinates are used for this plotter and how they are arranged in supplied DataSpec objects.

Specified by:
  `getCoordGroup` in interface `Plotter<GridPlotter.GridStyle>`
Returns:
  coordinate group

### hasReports

public boolean hasReports()
Description copied from interface: `Plotter`
Indicates whether the drawings produced by this plotter will return general interest report information to upstream plotting code.

Specified by:
  `hasReports` in interface `Plotter<GridPlotter.GridStyle>`
Returns:
  true if the plot report may return interesting information
See Also:
  - `Drawing.getReport(Object)`

### getPlotterDescription

public String getPlotterDescription()
Description copied from interface: `Plotter`
Returns an XML description of this plotter.

Note: really this should appear at the LayerType level.

Specified by:
  `getPlotterDescription` in interface `Plotter<GridPlotter.GridStyle>`
Returns:
  one or more <p> elements

### getStyleKeys

public ConfigKey<?>[] getStyleKeys()
Description copied from interface: `Plotter`
Returns the configuration keys used to configure style for this plotter. The keys in the return value are used in the map supplied to the `Plotter.createStyle(ConfigMap)` method.

Specified by:
  `getStyleKeys` in interface `Plotter<GridPlotter.GridStyle>`
Returns:
  keys used when creating a style for this plotter.

### createStyle

public GridPlotter.GridStyle createStyle(ConfigMap config)
Description copied from interface: `Plotter`
Creates a style that can be used when creating a plot layer. The keys that are significant in the supplied config map are those returned by `Plotter.getStyleKeys()`. The return value can be used as input to `Plotter.createLayer(DataGeom, DataSpec, S)`.

Specified by:
  `createStyle` in interface `Plotter<GridPlotter.GridStyle>`
Parameters:
  `config` - map of style configuration items
Returns:
  plotter-specific plot style

### getRangeStyleKey

public Object getRangeStyleKey(GridPlotter.GridStyle style)
Description copied from interface: `Plotter`
Returns an opaque object characterising the region of the plot surface covered when using a given plotter style. If this object changes between layers produced by this plotter, it provides a hint that it may be necessary to redetermine the axis ranges (using `extendCoordinateRanges`).

In many cases, such as scatter-plot-like plotters, the range is determined only by the coordinate data (managed by `DataSpec` inputs) so a null value may be returned. This method is chiefly required by histogram-like plotters for which the region on the plot surface is not the union of the input positions.

Specified by:
  `getRangeStyleKey` in interface `Plotter<GridPlotter.GridStyle>`
Parameters:
  `style` - plot style to assess
Returns:
  opaque object with equality semantics, or null if axis range is not a function of style

### createLayer

public PlotLayer createLayer(DataGeom geom, DataSpec dataSpec, GridPlotter.GridStyle style)
Description copied from interface: `Plotter`
Creates a PlotLayer based on the given geometry, data and style.

The `style` parameter is the result of a call to `Plotter.createStyle(ConfigMap)`.

The `dataSpec` parameter must contain the coordinates defined by this plotter's CoordGroup.

The `pointDataGeom` parameter is only used if the `CoordGroup.getBasicPositionCount()` or `CoordGroup.getExtraPositionCount()` method from this plotter's CoordGroup return a non-zero value, otherwise the plot does not have point positions.

It is legal to supply null for any of the parameters; if insufficient data is supplied to generate a plot, then the method should return null.

Creating a layer should be cheap; layers may be created and not used.

Specified by:
  `createLayer` in interface `Plotter<GridPlotter.GridStyle>`
Parameters:
  `geom` - indicates base position coordinates and their mapping to points in the data space
  `dataSpec` - specifies the data required for the plot
  `style` - data style as obtained from `createStyle`
Returns:
  new plot layer, or null if no drawing will take place