Class ArrayShapePlotter
- java.lang.Object
-
- uk.ac.starlink.ttools.plot2.layer.AbstractPlotter<ShapeStyle>
-
- uk.ac.starlink.ttools.plot2.layer.ShapePlotter
-
- uk.ac.starlink.ttools.plot2.layer.ArrayShapePlotter
-
- All Implemented Interfaces:
ModePlotter<ShapeStyle>
,ShapeModePlotter
,Plotter<ShapeStyle>
public class ArrayShapePlotter extends ShapePlotter
ShapePlotter subclass that plots multiple shapes for each row, based on array-valued coordinates. This class provides some additional functionality specific to array-valued positions.This plotter does not report positions and point clouds in the usual way, since each row typically corresponds to a large region of the plot surface, and reporting a single point is not very helpful. Instead, the PlotLayers it supplies are doctored to adjust the coordinate ranges to cover the whole of the relevant area for the plotted rows.
- Since:
- 27 Jan 2021
- Author:
- Mark Taylor
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface uk.ac.starlink.ttools.plot2.layer.ModePlotter
ModePlotter.Form, ModePlotter.Mode
-
-
Constructor Summary
Constructors Constructor Description ArrayShapePlotter(java.lang.String name, ShapeForm form, ShapeMode mode)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ArrayShapePlotter[]
createArrayShapePlotters(ShapeForm[] forms, ShapeMode[] modes)
Creates an array of ArrayShapePlotters, using all combinations of the specified list of ShapeForms and ShapeModes.PlotLayer
createLayer(DataGeom pointDataGeom, DataSpec dataSpec, ShapeStyle style)
Creates a PlotLayer based on the given geometry, data and style.static java.util.function.Function<Tuple,XYArrayData>
createXYArrayReader(FloatingArrayCoord xsCoord, FloatingArrayCoord ysCoord, int icXs, int icYs, DataSpec dataSpec)
Returns a reader for matched X/Y array data for use with array plotters.int
getModeCoordsIndex(DataGeom geom)
Returns the index into a dataspec used by this plotter at which the first of its ShapeMode's "extra" coordinates is found.static boolean
matchesAxis(java.lang.String axName, Input input)
Utility method that identifies whether an Input corresponds to a named axis.-
Methods inherited from class uk.ac.starlink.ttools.plot2.layer.ShapePlotter
createFlat2dPlotter, createShapePlotters, createStyle, getForm, getMode, getPlotterDescription, getStyleKeys
-
Methods inherited from class uk.ac.starlink.ttools.plot2.layer.AbstractPlotter
getCoordGroup, getPlotterIcon, getPlotterName, getRangeStyleKey, hasReports
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface uk.ac.starlink.ttools.plot2.Plotter
getCoordGroup, getPlotterIcon, getPlotterName, getRangeStyleKey, hasReports
-
-
-
-
Method Detail
-
getModeCoordsIndex
public int getModeCoordsIndex(DataGeom geom)
Description copied from class:ShapePlotter
Returns the index into a dataspec used by this plotter at which the first of its ShapeMode's "extra" coordinates is found.- Overrides:
getModeCoordsIndex
in classShapePlotter
- Parameters:
geom
- data position coordinate description- Returns:
- index of first mode-specific coordinate
-
createLayer
public PlotLayer createLayer(DataGeom pointDataGeom, DataSpec dataSpec, ShapeStyle 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 toPlotter.createStyle(uk.ac.starlink.ttools.plot2.config.ConfigMap)
.The
dataSpec
parameter must contain the coordinates defined by this plotter's CoordGroup.The
pointDataGeom
parameter is only used ifgetCoordGroup()
.getPositionCount
returns 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 interfacePlotter<ShapeStyle>
- Overrides:
createLayer
in classShapePlotter
- Parameters:
pointDataGeom
- indicates base position coordinates and their mapping to points in the data space; if non-null, the data geom'sDataGeom.hasPosition()
method will return truedataSpec
- specifies the data required for the plotstyle
- data style as obtained fromcreateStyle
- Returns:
- new plot layer, or null if no drawing will take place
-
createArrayShapePlotters
public static ArrayShapePlotter[] createArrayShapePlotters(ShapeForm[] forms, ShapeMode[] modes)
Creates an array of ArrayShapePlotters, using all combinations of the specified list of ShapeForms and ShapeModes. Since these implement theModePlotter
interface, other parts of the UI may be able to group them.- Parameters:
forms
- array of shape formsmodes
- array of shape modes- Returns:
forms.length*modes.length
-element array of plotters
-
matchesAxis
public static boolean matchesAxis(java.lang.String axName, Input input)
Utility method that identifies whether an Input corresponds to a named axis. This is an ad hoc method put in place to assist in working out how to annotate axes on which array plots are represented.- Parameters:
axName
- geometric axis name, e.g. "X"input
- coordinate input specification- Returns:
- true iff the input corresponds to an array value specifier intended for the named axis
-
createXYArrayReader
public static java.util.function.Function<Tuple,XYArrayData> createXYArrayReader(FloatingArrayCoord xsCoord, FloatingArrayCoord ysCoord, int icXs, int icYs, DataSpec dataSpec)
Returns a reader for matched X/Y array data for use with array plotters. If null is returned from this function, no plotting should be done.- Parameters:
xsCoord
- coordinate for X arrayysCoord
- coordinate for Y arrayicXs
- X array coordinate index in groupicYs
- Y array coordinate index in groupdataSpec
- data specification- Returns:
- thread-safe function to map tuples to XYArrayData; the function returns null for tuples that should not be plotted/accumulated
-
-