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

java.lang.Object
  extended by uk.ac.starlink.ttools.plot2.task.PlotContext

public abstract class PlotContext
extends Object

Aggregates some miscellaneous information required for a plot task that may not be available until execution time.

Since:
22 Aug 2014
Author:
Mark Taylor

Constructor Summary
protected PlotContext(PlotType plotType, DataGeom[] exampleGeoms)
          Constructor.
 
Method Summary
static PlotContext createFixedContext(PlotType plotType, DataGeom geom)
          Constructs a PlotContext which always uses a fixed given DataGeom.
static PlotContext createStandardContext(PlotType plotType)
          Constructs a PlotContext which allows per-layer choice between those known by a given plot type.
 DataGeom[] getExampleGeoms()
          Returns a list of one or more DataGeom objects to be used for example purposes.
abstract  DataGeom getGeom(Environment env, String layerSuffix)
          Returns the DataGeom to use for a given layer in the context of a given execution environment.
abstract  Parameter[] getGeomParameters(String layerSuffix)
          Returns an array of parameters associated with a particular layer required for determining DataGeom at runtime.
 PlotType getPlotType()
          Returns the plot type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlotContext

protected PlotContext(PlotType plotType,
                      DataGeom[] exampleGeoms)
Constructor. Information that is not dependent on other variables (environment, layer suffix) is specified here.

Parameters:
plotType - plot type
exampleGeoms - example data geoms
Method Detail

getPlotType

public PlotType getPlotType()
Returns the plot type.

Returns:
plot type

getExampleGeoms

public DataGeom[] getExampleGeoms()
Returns a list of one or more DataGeom objects to be used for example purposes. These may be used to construct parameter auto-documentation, which is needed in absence of an execution environment. The first item in the list is considered most important.

Returns:
one or more example data geoms

getGeomParameters

public abstract Parameter[] getGeomParameters(String layerSuffix)
Returns an array of parameters associated with a particular layer required for determining DataGeom at runtime.

Parameters:
layerSuffix - parameter suffix string identifying a plot layer
Returns:
list of zero or more parameters used for determining DataGeom

getGeom

public abstract DataGeom getGeom(Environment env,
                                 String layerSuffix)
                          throws TaskException
Returns the DataGeom to use for a given layer in the context of a given execution environment.

Parameters:
env - execution environment
layerSuffix - parameter suffix string identifying a plot layer
Returns:
datageom
Throws:
TaskException

createStandardContext

public static PlotContext createStandardContext(PlotType plotType)
Constructs a PlotContext which allows per-layer choice between those known by a given plot type. The choice is offered (a per-layer parameter is present) even if only a single DataGeom is known by the PlotType. This might conceivably be useful, in that it allows pluggable DataGeoms specified by classname.

Parameters:
plotType - plot type
Returns:
standard plot context

createFixedContext

public static PlotContext createFixedContext(PlotType plotType,
                                             DataGeom geom)
Constructs a PlotContext which always uses a fixed given DataGeom. No DataGeom-specific parameters are required or provided.

Parameters:
plotType - plot type
geom - data geom used in all cases
Returns:
fixed-geom plot context


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