public class PlotStateFactory extends Object
PlotState and associated
PlotData from the execution environment.
It sets up and interrogates a lot of parameters which describe how the
plot should be done, and organises this information into a single
object, a PlotState. It is subclassed for different plot types.| Modifier and Type | Field and Description |
|---|---|
static String |
AUX_VARIABLE
Symbolic suffix representing an auxiliary axis in per-aux
parameter names.
|
static String |
SUBSET_VARIABLE
Symbolic suffix representing a subset in per-subset parameter names.
|
static String |
TABLE_VARIABLE
Symbolic suffix representing a table in per-table parameter names.
|
| Constructor and Description |
|---|
PlotStateFactory(String[] dimNames,
boolean useAux,
boolean useLabel,
int errNdim)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
Style |
adjustFromData(Style style,
int iset,
DataBounds bounds)
Updates a plotting style generated by this factory with information
generated from a first pass through the data.
|
DataBounds |
calculateBounds(PlotState state,
TablePlot plot)
Calculates data bounds for a given data set as appropriate for the
given plot.
|
protected void |
configureFromBounds(PlotState state,
DataBounds bounds)
Updates a plot state generated by this factory with information
generated from a first pass through the data.
|
void |
configureFromData(PlotState state,
TablePlot plot)
Performs additional plot state configuration which may require
a pass through the data.
|
protected void |
configurePlotState(PlotState state,
Environment env)
Configures a PlotState object by examining parameter values in a
given execution environment.
|
protected TablePlotData |
createPlotData(Environment env,
String tLabel,
StarTable table,
String[] setExprs,
String[] setNames,
Style[] setStyles,
String labelExpr,
String[] coordExprs,
String[] errExprs)
Constructs a PlotData object.
|
protected PlotState |
createPlotState()
Creates a new unconfigured PlotState object suitable for configuration
by this factory.
|
protected StyleFactory |
createStyleFactory(String prefix)
Constructs a style factory which can retrieve a plotting style suitable
for use with this factory from the environment.
|
Parameter<?>[] |
getParameters()
Returns the parameters associated with this object.
|
PlotState |
getPlotState(Environment env)
Returns a configured PlotState obtained from parameter values
specified by the given execution environment.
|
boolean |
requiresAdjustFromData(Style style)
Indicates whether a given style generated by this factory needs
to be updated with information from a first pass through the data.
|
protected boolean |
requiresConfigureFromBounds(PlotState state)
Indicates whether it is necessary to calculate the DataBounds for a
given PlotState before it is ready to be used.
|
public static final String TABLE_VARIABLE
public static final String SUBSET_VARIABLE
public static final String AUX_VARIABLE
public PlotStateFactory(String[] dimNames, boolean useAux, boolean useLabel, int errNdim)
dimNames - names of main plot dimensions (typically "X", "Y", etc);useAux - whether auxiliary axes are useduseLabel - whether point text labelling is usederrNdim - number of axes for which errors can be plottedpublic Parameter<?>[] getParameters()
public PlotState getPlotState(Environment env) throws TaskException
env - execution environmentTaskExceptionprotected PlotState createPlotState()
protected void configurePlotState(PlotState state, Environment env) throws TaskException
createPlotState().state - plot state to configureenv - execution environmentTaskExceptionprotected TablePlotData createPlotData(Environment env, String tLabel, StarTable table, String[] setExprs, String[] setNames, Style[] setStyles, String labelExpr, String[] coordExprs, String[] errExprs) throws TaskException, gnu.jel.CompilationException
configurePlotState(uk.ac.starlink.ttools.plot.PlotState, uk.ac.starlink.task.Environment); may be overridden by subclasses.env - execution environmenttLabel - table identifier suffixtable - input tablesetExprs - nset-element JEL boolean-valued expression array
for set inclusionsetNames - nset-element set name arraysetStyles - nset-elemnt set style arraylabelExpr - JEL expression for text labelcoordExprs - ndim-element JEL double-valued expression array
for coordinate valueserrExprs - nerr-element expression(s) array for error valuesTaskExceptiongnu.jel.CompilationExceptionpublic void configureFromData(PlotState state, TablePlot plot) throws TaskException, IOException
state - plot state whose ranges will to be configuredplot - table plot for which configuration is to be doneTaskExceptionIOExceptionpublic DataBounds calculateBounds(PlotState state, TablePlot plot)
state - plot stateplot - plot objectprotected boolean requiresConfigureFromBounds(PlotState state)
configureFromBounds(uk.ac.starlink.ttools.plot.PlotState, uk.ac.starlink.ttools.plot.DataBounds) will be called
later.state - plot stateprotected void configureFromBounds(PlotState state, DataBounds bounds) throws TaskException
state - plot state to updatebounds - data bounds calculated by a pass through the dataTaskExceptionpublic boolean requiresAdjustFromData(Style style)
adjustFromData(uk.ac.starlink.ttools.plot.Style, int, uk.ac.starlink.ttools.plot.DataBounds) will be called later.style - plot style to considerstylepublic Style adjustFromData(Style style, int iset, DataBounds bounds)
style - plot style to updateiset - set index for which style is usedbounds - data bounds calculated by a pass through the dataprotected StyleFactory createStyleFactory(String prefix)
prefix - prefix to use for all style-type variablesCopyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.