uk.ac.starlink.ttools.plot2.task
Class TypedPlot2Task

java.lang.Object
  extended by uk.ac.starlink.ttools.plot2.task.AbstractPlot2Task
      extended by uk.ac.starlink.ttools.plot2.task.TypedPlot2Task
All Implemented Interfaces:
Task, DynamicTask
Direct Known Subclasses:
CubePlot2Task, PlanePlot2Task, SkyPlot2Task, SpherePlot2Task, TimePlot2Task

public class TypedPlot2Task
extends AbstractPlot2Task

Plot2 task specialised for a fixed PlotType. Knowing the PlotType up front doesn't make it more capable, but it allows much more parameter auto-documentation to be done than if the PlotType is determined only from the Environment.

Since:
3 Sep 2014
Author:
Mark Taylor

Field Summary
 
Fields inherited from class uk.ac.starlink.ttools.plot2.task.AbstractPlot2Task
EXAMPLE_LAYER_SUFFIX, LAYER_PREFIX
 
Constructor Summary
TypedPlot2Task(PlotType plotType, Map<ConfigKey<String>,Input> axlabelMap)
          Constructs a plot task with a default plot context.
TypedPlot2Task(PlotType plotType, Map<ConfigKey<String>,Input> axlabelMap, PlotContext context)
          Constructs a plot task with a supplied PlotContext.
 
Method Summary
protected
<T> ConfigParameter<T>
createConfigParameter(Environment env, ConfigKey<T> key, String[] suffixes)
          Returns a config parameter for a given config key that may be sensitive to the content of the execution environment.
 Parameter[] getParameters()
          Returns the list of parameters which may be used by this task.
 PlotContext getPlotContext()
          Returns the fixed plot context for this task.
 PlotContext getPlotContext(Environment env)
          Concrete subclasses must implement this method to provide the PlotType and other information from the environment that may not be available at construction time.
 String getPurpose()
          Returns a short (one-line) description of the purpose of this task.
 
Methods inherited from class uk.ac.starlink.ttools.plot2.task.AbstractPlot2Task
createDataParameter, createExecutable, createFilterParameter, createLabelParameter, createLayerTypeParameter, createPlotComponent, createPlotIcon, createPlotIcon, createTableParameter, getBasicParameters, getContextParameters, getKeyParams, getParameterByName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TypedPlot2Task

public TypedPlot2Task(PlotType plotType,
                      Map<ConfigKey<String>,Input> axlabelMap,
                      PlotContext context)
Constructs a plot task with a supplied PlotContext.

The axlabelMap parameter gives the chance to set up a correspondence between axis label config keys and the coordinates to which they correspond. If this is done, then the names of the data values actually supplied to the task can be used as defaults for the axis labels.

Parameters:
plotType - fixed plot type
axlabelMap - mapping from axis label keys to corresponding common data input coordinates, or null
context - fixed plot context

TypedPlot2Task

public TypedPlot2Task(PlotType plotType,
                      Map<ConfigKey<String>,Input> axlabelMap)
Constructs a plot task with a default plot context. If the plot type has only a single DataGeom no geom selection is allowed, otherwise there is a per-layer geom selection parameter.

The axlabelMap parameter gives the chance to set up a correspondence between axis label config keys and the coordinates to which they correspond. If this is done, then the names of the data values actually supplied to the task can be used as defaults for the axis labels.

Parameters:
plotType - fixed plot type
axlabelMap - mapping from axis label keys to corresponding common data input coordinates, or null
Method Detail

getPurpose

public String getPurpose()
Description copied from interface: Task
Returns a short (one-line) description of the purpose of this task.

Returns:
plain text description of this task's purpose

getParameters

public Parameter[] getParameters()
Description copied from interface: Task
Returns the list of parameters which may be used by this task.

Returns:
an array of the Parameter objects this task may request values for during its invocation

getPlotContext

public PlotContext getPlotContext(Environment env)
Description copied from class: AbstractPlot2Task
Concrete subclasses must implement this method to provide the PlotType and other information from the environment that may not be available at construction time.

Specified by:
getPlotContext in class AbstractPlot2Task
Parameters:
env - execution environment
Returns:
context

getPlotContext

public PlotContext getPlotContext()
Returns the fixed plot context for this task.

Returns:
plot context

createConfigParameter

protected <T> ConfigParameter<T> createConfigParameter(Environment env,
                                                       ConfigKey<T> key,
                                                       String[] suffixes)
                                            throws TaskException
Description copied from class: AbstractPlot2Task
Returns a config parameter for a given config key that may be sensitive to the content of the execution environment. This is here to provide a hook for subclasses to set up defaults for some config parameters on the basis of what layers are present.

Specified by:
createConfigParameter in class AbstractPlot2Task
Parameters:
env - execution environment
key - config key for which a parameter is required
suffixes - ordered list of the plot layer suffixes in use for the plot being performed
Returns:
parameter to get the value of key
Throws:
TaskException


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.