Class 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 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 type
        exampleGeoms - example data geoms
        gangerFact - defines plot grouping
    • Method Detail

      • getPlotType

        public PlotType<P,​A> 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
      • 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 environment
        layerSuffix - 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 type
        gangerFact - 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 type
        geom - data geom used in all cases
        gangerFact - defines plot grouping
        Returns:
        fixed-geom plot context