public abstract class AbstractPlot2Task extends Object implements Task, DynamicTask
As currently implemented, this will only work with single-zone plots or multi-zone plots with per-zone trimmings and shade axes. Multi-zone plots with global trimming or shade axes must be handled using custom code.
Modifier and Type | Field and Description |
---|---|
static String |
DOC_ZONE_SUFFIX |
static String |
DOMAINMAPPER_SUFFIX |
static String |
EXAMPLE_LAYER_SUFFIX |
static String |
EXAMPLE_ZONE_SUFFIX |
static String |
LAYER_PREFIX |
static String |
ZONE_PREFIX |
Modifier | Constructor and Description |
---|---|
protected |
AbstractPlot2Task(boolean allowAnimate,
boolean hasZoneSuffixes)
Constructor with explicit animation capability.
|
Modifier and Type | Method and Description |
---|---|
DoubleParameter |
createAuxCrowdParameter(String suffix)
Returns a parameter for determining crowding on the aux axis.
|
StringParameter |
createAuxLabelParameter(String suffix)
Returns a parameter for acquiring the aux ramp label.
|
BooleanParameter |
createAuxVisibleParameter(String suffix)
Returns a parameter for determining whether the aux colour ramp
is painted for a given plot zone.
|
IntegerParameter |
createAuxWidthParameter(String suffix)
Returns a parameter for determining aux colour ramp lateral size
in pixels.
|
static ConfigMap |
createBasicConfigMap(Environment env,
ConfigKey<?>[] keys)
Returns a config map based on given keys with values derived from
the execution environment.
|
Captioner |
createCaptioner(Environment env,
String zoneSuffix)
Acquires a captioner from the environment.
|
static ConfigMap |
createConfigMap(Environment env,
ConfigKey<?>[] configKeys,
ConfigParameterFactory cpFact)
Returns a ConfigMap derived from the assignments made in a given
execution environment.
|
ConfigMap |
createCustomConfigMap(Environment env)
Provides any additional config keys (beyond layer style and aux map)
that should be provided for layer creation.
|
static StringParameter |
createDataParameter(Input input,
String suffix,
boolean fullDetail)
Returns a parameter for acquiring a column of data.
|
static Parameter<DomainMapper> |
createDomainMapperParameter(Input input,
String suffix)
Returns a parameter for specifying the DomainMapper associated
with a given Input.
|
Executable |
createExecutable(Environment env)
Creates an executable object which will do the work of this task
in the given Environment.
|
static FilterParameter |
createFilterParameter(String suffix,
InputTableParameter tableParam)
Returns a parameter for acquiring a filter applied to the table input
for a given layer.
|
static Parameter<String> |
createLabelParameter(String suffix)
Returns a parameter to get a textual label corresponding to the layer
identified by a given layer suffix.
|
static ConfigMap |
createLayerSuffixedConfigMap(Environment env,
ConfigKey<?>[] configKeys,
String layerSuffix)
Returns a ConfigMap specific to a given layer derived from the
assignments made in a given execution environment,
based on config keys and a layer identifier.
|
static LayerTypeParameter |
createLayerTypeParameter(String suffix,
PlotContext<?,?> context)
Returns a parameter for acquiring a plotter.
|
Icon |
createLegend(Environment env,
Map<String,PlotLayer> layerMap,
String zoneSuffix,
String[] layerSuffixSeq)
Turns the map of defined layers into a legend icon.
|
DoubleArrayParameter |
createLegendPositionParameter(String suffix)
Returns a parameter to get the legend position for the zone identified
by a given zone suffix.
|
static PaintModeParameter |
createPaintModeParameter()
Returns a parameter for specifying a paint mode.
|
PlotDisplay<?,?> |
createPlotComponent(Environment env,
boolean caching)
Returns a graphical component that displays an interactive view of
the plot described by a value-bearing execution environment.
|
protected <P,A> PlotConfiguration<P,A> |
createPlotConfiguration(Environment env,
PlotContext<P,A> context)
Turns an execution environment (containing value-bearing parameters)
into an object with all the required plot configuration information.
|
Icon |
createPlotIcon(Environment env)
Returns an Icon that paints the plot described
by a value-bearing execution environment.
|
static <P,A> Icon |
createPlotIcon(Ganger<P,A> ganger,
SurfaceFactory<P,A> surfFact,
ZoneContent<P,A>[] contents,
Trimming[] trimmings,
ShadeAxisKit[] shadeKits,
PaperTypeSelector ptSel,
Compositor compositor,
DataStore dataStore,
int xpix,
int ypix,
boolean forceBitmap)
Creates an icon which will paint the content of a plot.
|
ShadeAxisFactory |
createShadeAxisFactory(Environment env,
PlotLayer[] layers,
String zoneSuffix)
Acquires a ShadeAxisFactory from the environment for a given plot zone.
|
static InputTableParameter |
createTableParameter(String suffix)
Returns a parameter for acquiring a data table.
|
Parameter<String> |
createTitleParameter(String suffix)
Returns a parameter to get a plot title for the zone identified
by a given zone suffix.
|
static Parameter<String> |
createZoneParameter(String layerSuffix)
Returns a parameter for associating a zone identifier with a given
layer.
|
Parameter<?>[] |
getBasicParameters()
Returns the list of parameters supplied by the AbstractPlot2Task
implementation.
|
BooleanParameter |
getBitmapParameter()
Returns the parameter used to force bitmap output.
|
Parameter<Compositor> |
getCompositorParameter()
Returns the parameter for configuring the compositor.
|
protected abstract <T> String |
getConfigParamDefault(Environment env,
ConfigKey<T> key,
String[] suffixes)
May provide a default value for a given config parameter that is
sensitive to the content of the execution environment.
|
Parameter<?>[] |
getContextParameters(Environment env)
Returns the parameters for this task in the context of a given
execution environment.
|
static CoordValue |
getCoordValue(Environment env,
Coord coord,
String suffix)
Turns a coord into a CoordValue.
|
Parameter<DataStoreFactory> |
getDataStoreParameter()
Returns the parameter for configurig the data storage.
|
static StarTable |
getInputTable(Environment env,
String suffix)
Returns a table from the environment.
|
Parameter<Boolean> |
getLegendBorderParameter()
Returns the parameter for indicating whether the legend border will
be visible.
|
Parameter<Boolean> |
getLegendOpaqueParameter()
Returns the parameter for indicating whether the legend background
will be opaque.
|
Parameter<Boolean> |
getLegendParameter()
Returns the parameter for indicating whether the legend will be visible.
|
Parameter<String[]> |
getLegendSequenceParameter()
Returns the parameter for determining the sequence and inclusion
of layers in the legend.
|
Parameter<Padding> |
getPaddingParameter()
Returns the parameter for assigning the plot external padding.
|
Parameter<?> |
getParameterByName(Environment env,
String paramName)
Attempts to find a parameter with a given name that might be used
by this task in the content of the given environment.
|
abstract 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.
|
static Map<String,Plotter<?>> |
getPlotters(Environment env,
PlotContext<?,?> context)
Returns a map of suffix strings to Plotter objects.
|
Parameter<String[]> |
getSequenceParameter()
Returns the parameter for determining the sequence of layers
appearing in the plot.
|
IntegerParameter |
getXpixParameter()
Returns the parameter for assigning the external horizontal
extent of the plot.
|
IntegerParameter |
getYpixParameter()
Returns the parameter for assigning the external vertical
extent of the plot.
|
List<Parameter<?>> |
getZoneKeyParams(ConfigKey<?>[] keys)
Returns a list of parameters suffixed by zone based on a list of
ConfigKeys.
|
static boolean |
hasDomainMappers(Input input)
Indicates whether a DomainMapper should be sought for a given Input.
|
boolean |
hasZoneSuffixes()
Indicates whether relevant parameters can be suffixed by zone label
for explicit control of per-zone characteristics.
|
void |
testEnv(Environment env)
Prepares a plot for this task as specified by a given environment,
but does not run any of the actual plotting code.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getParameters, getPurpose
public static final String LAYER_PREFIX
public static final String ZONE_PREFIX
public static final String DOMAINMAPPER_SUFFIX
public static final String EXAMPLE_LAYER_SUFFIX
public static final String EXAMPLE_ZONE_SUFFIX
public static final String DOC_ZONE_SUFFIX
protected AbstractPlot2Task(boolean allowAnimate, boolean hasZoneSuffixes)
allowAnimate
- true iff animation options should be providedhasZoneSuffixes
- true iff zone content can be controlled
explicitly by use of parameter suffixespublic abstract PlotContext<?,?> getPlotContext(Environment env) throws TaskException
env
- execution environmentTaskException
protected abstract <T> String getConfigParamDefault(Environment env, ConfigKey<T> key, String[] suffixes) throws TaskException
env
- execution environmentkey
- config key for which a parameter is requiredsuffixes
- ordered list of the plot layer suffixes
in use for the plot being performedkey
,
or null if none is obviousTaskException
public final Parameter<?>[] getBasicParameters()
public Executable createExecutable(Environment env) throws TaskException
Task
env
, though this is not
absolutely prohibited.createExecutable
in interface Task
env
- the environment in which the task will operateTaskException
- if no executable can be created;
this should usually be a UsageException
or
some subclasspublic boolean hasZoneSuffixes()
public IntegerParameter getXpixParameter()
public IntegerParameter getYpixParameter()
public Parameter<String[]> getSequenceParameter()
public Parameter<Boolean> getLegendParameter()
public Parameter<Boolean> getLegendBorderParameter()
public Parameter<Boolean> getLegendOpaqueParameter()
public Parameter<String[]> getLegendSequenceParameter()
public Parameter<Padding> getPaddingParameter()
public Parameter<DataStoreFactory> getDataStoreParameter()
public BooleanParameter getBitmapParameter()
public Parameter<Compositor> getCompositorParameter()
public ConfigMap createCustomConfigMap(Environment env) throws TaskException
env
- execution environmentTaskException
public Icon createPlotIcon(Environment env) throws TaskException, IOException, InterruptedException
env
- execution environmentTaskException
IOException
InterruptedException
public void testEnv(Environment env) throws TaskException
env
- populated environmentTaskException
- in case of errorpublic PlotDisplay<?,?> createPlotComponent(Environment env, boolean caching) throws TaskException, IOException, InterruptedException
env
- execution environmentcaching
- whether data and plot should be cached or re-read
at every repaintTaskException
IOException
InterruptedException
public Parameter<?>[] getContextParameters(Environment env) throws TaskException
DynamicTask
Task.getParameters()
, but found
settings of parameters in the presented environment may lead to
parameters being added to or removed from the list.
This ought not to result in additional prompts to the user.
getContextParameters
in interface DynamicTask
env
- execution environmentTaskException
public Parameter<?> getParameterByName(Environment env, String paramName) throws TaskException
DynamicTask
This ought not to result in additional prompts to the user.
getParameterByName
in interface DynamicTask
env
- execution environmentparamName
- requested parameter nameTaskException
protected <P,A> PlotConfiguration<P,A> createPlotConfiguration(Environment env, PlotContext<P,A> context) throws TaskException
env
- execution environmentcontext
- plot contextTaskException
public Icon createLegend(Environment env, Map<String,PlotLayer> layerMap, String zoneSuffix, String[] layerSuffixSeq) throws TaskException
env
- execution environmentlayerMap
- suffix->layer map for all defined layerszoneSuffix
- suffix identifying zone if anylayerSuffixSeq
- ordered array of suffixes for layers plottedTaskException
public static Map<String,Plotter<?>> getPlotters(Environment env, PlotContext<?,?> context) throws TaskException
env
- execution environmentcontext
- plot contextTaskException
public Captioner createCaptioner(Environment env, String zoneSuffix) throws TaskException
env
- execution environmentzoneSuffix
- suffix for zone to which the caption will apply,
may be the empty string for globalTaskException
public ShadeAxisFactory createShadeAxisFactory(Environment env, PlotLayer[] layers, String zoneSuffix) throws TaskException
env
- execution environmentlayers
- layers that will be plottedzoneSuffix
- identifier for zone whose shader is to be calculatedTaskException
public static ConfigMap createBasicConfigMap(Environment env, ConfigKey<?>[] keys) throws TaskException
env
- execution environmentkeys
- config keysTaskException
public static CoordValue getCoordValue(Environment env, Coord coord, String suffix) throws TaskException
env
- execution environmentcoord
- coordinate definitionsuffix
- suffix to append to parameter nameTaskException
public static ConfigMap createLayerSuffixedConfigMap(Environment env, ConfigKey<?>[] configKeys, String layerSuffix) throws TaskException
env
- execution environment bearing the parameter valuesconfigKeys
- layer-specific configuration keys to find values forlayerSuffix
- layer identifier string appended to config key
shortnames to make env parameter namesTaskException
public static ConfigMap createConfigMap(Environment env, ConfigKey<?>[] configKeys, ConfigParameterFactory cpFact) throws TaskException
env
- execution environment bearing the parameter valuesconfigKeys
- configuration keys to find values forcpFact
- turns config keys into ParametersTaskException
public static StarTable getInputTable(Environment env, String suffix) throws TaskException
env
- execution environmentsuffix
- parameter suffixTaskException
public static InputTableParameter createTableParameter(String suffix)
suffix
- layer-specific suffixpublic static FilterParameter createFilterParameter(String suffix, InputTableParameter tableParam)
suffix
- layer-specific suffixtableParam
- input table parameter associated with the layerpublic static Parameter<String> createLabelParameter(String suffix)
suffix
- layer suffixpublic Parameter<String> createTitleParameter(String suffix)
suffix
- zone suffix, or either null or empty string for all zonespublic StringParameter createAuxLabelParameter(String suffix)
suffix
- zone suffixpublic BooleanParameter createAuxVisibleParameter(String suffix)
suffix
- zone suffixpublic DoubleParameter createAuxCrowdParameter(String suffix)
suffix
- zone suffixpublic IntegerParameter createAuxWidthParameter(String suffix)
suffix
- zone suffixpublic DoubleArrayParameter createLegendPositionParameter(String suffix)
suffix
- zone suffix, or either null or empty string for all zonespublic static boolean hasDomainMappers(Input input)
input
- input specifierpublic static LayerTypeParameter createLayerTypeParameter(String suffix, PlotContext<?,?> context)
suffix
- parameter name suffixcontext
- plot contextpublic static Parameter<String> createZoneParameter(String layerSuffix)
layerSuffix
- identifier for the layer whose zone is to be
determinedpublic static StringParameter createDataParameter(Input input, String suffix, boolean fullDetail)
input
- specifies input value required from usersuffix
- layer-specific suffixfullDetail
- if true, extra detail is appended to the descriptionpublic static Parameter<DomainMapper> createDomainMapperParameter(Input input, String suffix)
input
- coordinate specifiersuffix
- layer suffixpublic static PaintModeParameter createPaintModeParameter()
public static <P,A> Icon createPlotIcon(Ganger<P,A> ganger, SurfaceFactory<P,A> surfFact, ZoneContent<P,A>[] contents, Trimming[] trimmings, ShadeAxisKit[] shadeKits, PaperTypeSelector ptSel, Compositor compositor, DataStore dataStore, int xpix, int ypix, boolean forceBitmap)
The contents array must have a number of entries that
matches the zone count of the ganger.
The trimmings and shadeKits are supplied as arrays, and in each case
may be either a 1- or nzone-element array depending on the Ganger's
Ganger.isTrimmingGlobal()
/Ganger.isShadingGlobal()
flags.
ganger
- defines plot surface groupingsurfFact
- surface factorycontents
- zone contents (nz-element array)trimmings
- zone trimmings
(nz- or 1-element array, elements may be null)shadeKits
- shader axis kits by zone
(nz- or 1-element array, elements may be null)ptSel
- paper type selectorcompositor
- compositor for pixel compositiondataStore
- data storage objectxpix
- horizontal size of icon in pixelsypix
- vertical size of icon in pixelsforceBitmap
- true to force bitmap output of vector graphics,
false to use default behaviourCopyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.