Package uk.ac.starlink.ttools.plot2.task
Class StiltsPlotFormatter
java.lang.Object
uk.ac.starlink.ttools.plot2.task.StiltsPlotFormatter
Handles export of StiltsPlot objects to external serialization formats.
- Since:
- 15 Sep 2017
- Author:
- Mark Taylor
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionStiltsPlotFormatter
(CredibleString invocation, Suffixer zoneSuffixer, Suffixer layerSuffixer, boolean includeDflts, LineEnder lineEnder, int levelIndent, int cwidth, TableNamer tableNamer) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic StyledDocument
Utility method returning a StyledDocument instance with some supplied plain text.uk.ac.starlink.task.Executable
createExecutable
(StiltsPlot plot) Creates a task Executable based on the state of this PlotSpec.PlotDisplay
<?, ?> createPlotComponent
(StiltsPlot plot, boolean caching) Attempts to create a PlotDisplay that re-creates the plot specified by this object.Returns a Document, suitable for use with a JTextPane, formatting the given plot specification.Returns the invocation used to introduce the STILTS command.Returns the policy for selecting per-layer parameter suffixes.Returns the file naming policy.Returns the policy for selecting per-zone parameter suffixes.void
setForceError
(boolean forceError) Sets whether the generated stilts commands will be made to produce a gratuitous error.
-
Field Details
-
ZONE_SUFFIXERS
List of suffixers suitable for per-zone parameters. -
LAYER_SUFFIXERS
List of suffixers suitable for per-layer parameters.
-
-
Constructor Details
-
StiltsPlotFormatter
public StiltsPlotFormatter(CredibleString invocation, Suffixer zoneSuffixer, Suffixer layerSuffixer, boolean includeDflts, LineEnder lineEnder, int levelIndent, int cwidth, TableNamer tableNamer) Constructor.- Parameters:
invocation
- display text to introduce the STILTS commandzoneSuffixer
- defines how per-zone parameter suffixes are generatedlayerSuffixer
- defines how per-layer parameter suffixes are generatedincludeDflts
- if true, all parameters are included; if false, only those with non-default valueslineEnder
- line end presentation policylevelIndent
- number of spaces per indentation levelcwidth
- nominal formatting width in characters; this affects line wrapping, but actual wrapping may depend on other factors tootableNamer
- determines how tables are named
-
-
Method Details
-
getInvocation
Returns the invocation used to introduce the STILTS command.- Returns:
- STILTS invocation string
-
getZoneSuffixer
Returns the policy for selecting per-zone parameter suffixes.- Returns:
- zone suffixer
-
getLayerSuffixer
Returns the policy for selecting per-layer parameter suffixes.- Returns:
- layer suffixer
-
getTableNamer
Returns the file naming policy.- Returns:
- table namer
-
setForceError
public void setForceError(boolean forceError) Sets whether the generated stilts commands will be made to produce a gratuitous error. This is only useful for debugging purposes.- Parameters:
forceError
- true to force an error from generated commands
-
createExecutable
public uk.ac.starlink.task.Executable createExecutable(StiltsPlot plot) throws uk.ac.starlink.task.TaskException Creates a task Executable based on the state of this PlotSpec. Various exceptions may be thrown if there is some error. Such errors are quite possible.If this method returns without error there is a fair chance that the serializations prodiced from this object will produce a faithful reproduction of the specified plot.
- Returns:
- executable
- Throws:
uk.ac.starlink.task.TaskException
- if there is some other error in setting up the executable; probably incorrect parameter assignments of some kind
-
createPlotComponent
public PlotDisplay<?,?> createPlotComponent(StiltsPlot plot, boolean caching) throws uk.ac.starlink.task.TaskException, IOException, InterruptedException Attempts to create a PlotDisplay that re-creates the plot specified by this object.- Parameters:
caching
- whether the plotted image is to be cached- Returns:
- plot display component
- Throws:
uk.ac.starlink.task.TaskException
IOException
InterruptedException
- See Also:
-
createShellDocument
Returns a Document, suitable for use with a JTextPane, formatting the given plot specification. This may include coloured highlighting etc. depending on configuration.- Parameters:
plot
- plot speicification
-
createBasicDocument
Utility method returning a StyledDocument instance with some supplied plain text.- Parameters:
txt
- text content- Returns:
- document
-