Package uk.ac.starlink.ttools.plot2.task
Class PlotContext<P,A>
- java.lang.Object
-
- uk.ac.starlink.ttools.plot2.task.PlotContext<P,A>
-
public abstract class PlotContext<P,A> extends java.lang.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
Constructors Modifier Constructor Description protected
PlotContext(PlotType<P,A> plotType, DataGeom[] exampleGeoms, GangerFactory<P,A> gangerFact)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static <P,A>
PlotContext<P,A>createFixedContext(PlotType<P,A> plotType, DataGeom geom, GangerFactory<P,A> gangerFact)
Constructs a PlotContext which always uses a fixed given DataGeom.static <P,A>
PlotContext<P,A>createStandardContext(PlotType<P,A> plotType, GangerFactory<P,A> gangerFact)
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.GangerFactory<P,A>
getGangerFactory()
Returns the ganger factory used by this context.abstract DataGeom
getGeom(uk.ac.starlink.task.Environment env, java.lang.String layerSuffix)
Returns the DataGeom to use for a given layer in the context of a given execution environment.abstract uk.ac.starlink.task.Parameter<?>[]
getGeomParameters(java.lang.String layerSuffix)
Returns an array of parameters associated with a particular layer required for determining DataGeom at runtime.PlotType<P,A>
getPlotType()
Returns the plot type.
-
-
-
Constructor Detail
-
PlotContext
protected PlotContext(PlotType<P,A> plotType, DataGeom[] exampleGeoms, GangerFactory<P,A> gangerFact)
Constructor. Information that is not dependent on other variables (environment, layer suffix) is specified here.- Parameters:
plotType
- plot typeexampleGeoms
- example data geomsgangerFact
- defines plot grouping
-
-
Method Detail
-
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
-
getGangerFactory
public GangerFactory<P,A> getGangerFactory()
Returns the ganger factory used by this context.- Returns:
- gangerFact
-
getGeomParameters
public abstract uk.ac.starlink.task.Parameter<?>[] getGeomParameters(java.lang.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(uk.ac.starlink.task.Environment env, java.lang.String layerSuffix) throws uk.ac.starlink.task.TaskException
Returns the DataGeom to use for a given layer in the context of a given execution environment.- Parameters:
env
- execution environmentlayerSuffix
- parameter suffix string identifying a plot layer- Returns:
- datageom
- Throws:
uk.ac.starlink.task.TaskException
-
createStandardContext
public static <P,A> PlotContext<P,A> createStandardContext(PlotType<P,A> plotType, GangerFactory<P,A> gangerFact)
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 typegangerFact
- defines plot grouping- Returns:
- standard plot context
-
createFixedContext
public static <P,A> PlotContext<P,A> createFixedContext(PlotType<P,A> plotType, DataGeom geom, GangerFactory<P,A> gangerFact)
Constructs a PlotContext which always uses a fixed given DataGeom. No DataGeom-specific parameters are required or provided.- Parameters:
plotType
- plot typegeom
- data geom used in all casesgangerFact
- defines plot grouping- Returns:
- fixed-geom plot context
-
-