Package uk.ac.starlink.ttools.plot
Class PlotState
- java.lang.Object
-
- uk.ac.starlink.ttools.plot.PlotState
-
- Direct Known Subclasses:
DensityPlotState
,HistogramPlotState
,LinesPlotState
,Plot3DState
public class PlotState extends java.lang.Object
Characterises the details of how a plot is to be done. An instance of this class contains all the information which a plot component needs to draw a plot. There are specific subclasses for the various different plot types.Some of the items held by this object are arrays with one element per axis. Where appropriate these can be used to hold values for the main axes, followed by values for any visible auxiliary axes.
- Since:
- 21 Jun 2004
- Author:
- Mark Taylor (Starlink)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
PlotState.SimpleValueInfo
ValueInfo implementation which ignores information that's not relevant to plotting.
-
Constructor Summary
Constructors Constructor Description PlotState()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
compare(PlotState o)
Returns a string giving a list of items in which this state differs from a given stateo
.boolean
equals(java.lang.Object otherObject)
boolean
getAntialias()
Determines whether antialiasing is preferred for drawing lines.uk.ac.starlink.table.ValueInfo[]
getAxes()
Returns the metadata for the plotted axes.java.lang.String[]
getAxisLabels()
Returns the labels to use for annotating axes.ValueConverter[]
getConverters()
Returns the array of numeric converter objects, one for each axis.boolean[]
getFlipFlags()
Returns flags for which axes will be plotted inverted.boolean
getGrid()
Indicates whether a grid is to be plotted.boolean[]
getLogFlags()
Returns flags for which axes will be plotted logarithmically.int
getMainNdim()
Returns the number of non-auxiliary axes represented by this state.PlotData
getPlotData()
Returns the plot data object for this state.double[][]
getRanges()
Returns the data ranges for each axis.Shader[]
getShaders()
Returns the shader objects for using auxiliary axis data.boolean
getValid()
Indicates whether this state can be used to attempt a successful plot.int
hashCode()
void
setAntialias(boolean antialias)
Sets whether antialiasing hint is preferred for drawing lines.void
setAxes(uk.ac.starlink.table.ValueInfo[] axes)
Sets the metadata for axes to be plotted.void
setAxisLabels(java.lang.String[] labels)
Sets the text labels to use for annotating axes.void
setConverters(ValueConverter[] converters)
Sets an array of numeric converter objects, one for each axis.void
setFlipFlags(boolean[] flipFlags)
Sets flags for which axes will be plotted inverted.void
setGrid(boolean grid)
Sets whether a grid is to be plotted.void
setLogFlags(boolean[] logFlags)
Sets flags for which axes will be plotted logarithmically.void
setMainNdim(int mainNdim)
Sets the number of non-auxiliary axes represented by this state.void
setPlotData(PlotData plotData)
Sets the plot data object for this state.void
setRanges(double[][] ranges)
Sets data ranges for each axis.void
setShaders(Shader[] shaders)
Sets the shader objects to use for modifying the colour of plotted points according to auxiliary axis data.void
setValid(boolean valid)
Sets whether this state should be used to attempt a successful plot.
-
-
-
Method Detail
-
setValid
public void setValid(boolean valid)
Sets whether this state should be used to attempt a successful plot. If false, it is underspecified in some way.- Parameters:
valid
- validity flag
-
getValid
public boolean getValid()
Indicates whether this state can be used to attempt a successful plot. If false, it is underspecified in some way.- Returns:
- validity flag
-
setMainNdim
public void setMainNdim(int mainNdim)
Sets the number of non-auxiliary axes represented by this state.- Parameters:
mainNdim
- number of normal axes
-
getMainNdim
public int getMainNdim()
Returns the number of non-auxiliary axes represented by this state.- Returns:
- number of normal axes
-
setAxes
public void setAxes(uk.ac.starlink.table.ValueInfo[] axes)
Sets the metadata for axes to be plotted. Note the submittedaxes
array is not used directly, the relevant information is abstracted from it and stored (subsequent calls ofgetAxes()
will not return the same array or component objects).- Parameters:
axes
- axis metadata array
-
getAxes
public uk.ac.starlink.table.ValueInfo[] getAxes()
Returns the metadata for the plotted axes.- Returns:
- axis metadata array
-
setLogFlags
public void setLogFlags(boolean[] logFlags)
Sets flags for which axes will be plotted logarithmically.- Parameters:
logFlags
- log flags
-
getLogFlags
public boolean[] getLogFlags()
Returns flags for which axes will be plotted logarithmically.- Returns:
- log flags
-
setFlipFlags
public void setFlipFlags(boolean[] flipFlags)
Sets flags for which axes will be plotted inverted.- Parameters:
flipFlags
- flip flags
-
getFlipFlags
public boolean[] getFlipFlags()
Returns flags for which axes will be plotted inverted.- Returns:
- flip flags
-
setGrid
public void setGrid(boolean grid)
Sets whether a grid is to be plotted.- Parameters:
grid
- whether to draw a grid
-
getGrid
public boolean getGrid()
Indicates whether a grid is to be plotted.- Returns:
- grid whether to draw a grid
-
setAntialias
public void setAntialias(boolean antialias)
Sets whether antialiasing hint is preferred for drawing lines.- Parameters:
antialias
- true to antialias, false not
-
getAntialias
public boolean getAntialias()
Determines whether antialiasing is preferred for drawing lines.- Returns:
- true to antialias, false not
-
setRanges
public void setRanges(double[][] ranges)
Sets data ranges for each axis.ranges
is an N-element array of 2-element double arrays. Each of its elements gives (low,high) limits for one dimension of the region to be displayed.- Parameters:
ranges
- array of (low,high) fixed range limits
-
getRanges
public double[][] getRanges()
Returns the data ranges for each axis.- Returns:
- array of (low,high) fixed range limits
- See Also:
setRanges(double[][])
-
setAxisLabels
public void setAxisLabels(java.lang.String[] labels)
Sets the text labels to use for annotating axes.- Parameters:
labels
- axis annotation strings, one for each axis that needs labelling
-
getAxisLabels
public java.lang.String[] getAxisLabels()
Returns the labels to use for annotating axes.- Returns:
- axis annotation strings, one for each axis that needs labelling
-
setShaders
public void setShaders(Shader[] shaders)
Sets the shader objects to use for modifying the colour of plotted points according to auxiliary axis data. The length of this array defines the number of auxiliary axes in use.- Parameters:
shaders
- shaders, one per auxiliary axis
-
getShaders
public Shader[] getShaders()
Returns the shader objects for using auxiliary axis data.- Returns:
- shaders, one per auxiliary axis
-
setConverters
public void setConverters(ValueConverter[] converters)
Sets an array of numeric converter objects, one for each axis. TheValueConverter.unconvert(java.lang.Object)
method of these should convert a numeric value back to the formatted (text) version of a value on the corresponding axis. Any of the elements may be null if the value is numeric anyway.- Parameters:
converters
- numeric converter array, one for each axis
-
getConverters
public ValueConverter[] getConverters()
Returns the array of numeric converter objects, one for each axis.- Returns:
- numeric converter array
-
setPlotData
public void setPlotData(PlotData plotData)
Sets the plot data object for this state.- Parameters:
plotData
- plot data object
-
getPlotData
public PlotData getPlotData()
Returns the plot data object for this state.- Returns:
- plot data object
-
equals
public boolean equals(java.lang.Object otherObject)
- Overrides:
equals
in classjava.lang.Object
-
compare
public java.lang.String compare(PlotState o)
Returns a string giving a list of items in which this state differs from a given stateo
. This method is used only for debugging purposes, and may not be fully implemented at any given time.- Parameters:
o
- state for comparison with this one- Returns:
- text summary of differences
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-