|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.Observable
spv.spectrum.SpectrumDecorator
spv.glue.PlottableSpectrum
public class PlottableSpectrum
This class acts as "glue" between the Spectrum and
Plottable interfaces. It uses the Decorator design
pattern to add Plottable responsibilities to a
Spectrum object.
Spectrum object. The dependent variable is limited to the
intensity and error arrays.
| Field Summary | |
|---|---|
private int[] |
deldata
|
protected Units |
display_xunits
|
protected Units |
display_yunits
|
private int[] |
dqdata
|
protected boolean |
edited
|
private double[] |
errdata
|
private static int |
HEIGHT
|
protected int |
size
|
protected Units |
spectrum_xunits
|
protected Units |
spectrum_yunits
|
protected java.awt.Stroke |
stroke
|
protected Symbol |
symbol
|
(package private) static java.awt.Dimension |
TABLE_SIZE
|
protected SpectrumVisualEditor |
visual_editor
|
private static int |
WIDTH
|
private java.lang.String |
x_id
|
private double[] |
xdata
|
private java.lang.String |
y_id
|
private double[] |
ydata
|
| Fields inherited from class spv.spectrum.SpectrumDecorator |
|---|
notify, sp |
| Fields inherited from interface spv.spectrum.Spectrum |
|---|
REST_SUFFIX |
| Constructor Summary | |
|---|---|
PlottableSpectrum(Spectrum sp)
Constructor. |
|
| Method Summary | |
|---|---|
java.lang.Object |
clone()
Creates a clone copy of this object. |
protected void |
finishDataSetBuild(Spectrum csp,
java.lang.Object spid,
DataSet ds)
|
void |
forceSetChanged()
|
java.lang.String |
getDefaultXID()
Gets the array that is used by default as the source of the independet variable. |
int[] |
getDQ()
Returns an array with data quality flags. |
java.util.Enumeration |
getDQList()
Returns an Enumeration with the ids of all
arrays that can be used as data quality. |
Command |
getDragProcessor()
|
double[] |
getErrors()
Returns an array with plottable error values. |
java.util.Map |
getGraphicsAttributes()
Gets a map of graphics attributes associated with each element of the composite. |
(package private) java.awt.Stroke |
getLineType(java.lang.Object id)
Gets the line type. |
(package private) LineTypeSelector |
getLineTypeSelector(java.lang.Object id)
Gets a LineTypeSelector object appropriate for this. |
int |
getNBins()
Returns the maximum number of plottable bins. |
java.lang.Object |
getRootObject()
Returns a reference to the underlying Spectrum object
that is decorated by PlottableSpectrum. |
java.lang.String |
getRootObjectCommonName()
Returns a ID of the underlying object decorated by this interface, used to identify the object in the plot in a human-friendly way. |
java.lang.String |
getRootObjectID()
Returns the ID of the underlying object decorated by this interface |
java.lang.String |
getSelectedDQID()
Gets the ID of the array which is the source of the data quality flags. |
private double[] |
getSelectedXArray(Spectrum sp)
Returns the X array. |
java.lang.String |
getSelectedXID()
Gets the ID of the array which is the source of the independent variable. |
java.lang.String |
getSelectedYID()
Gets the ID of the array which is the source of the dependent variable. |
Command |
getSpectrumNormalizer()
Returns a Command object that implements a spectrum
normalizer. |
(package private) Symbol |
getSymbol(java.lang.Object id)
Gets the symbol. |
(package private) int |
getSymbolSize(java.lang.Object id)
Gets the symbol size. |
Command |
getVisualEditor()
Returns a Command object that implements a spectrum
screen editor. |
double[] |
getX()
Returns an array with plottable independent variable values. |
java.util.Enumeration |
getXList()
Returns an Enumeration with the ids of all
arrays that can be used as independent variable for plotting. |
double |
getXMax()
Returns the maximum value of the independent variable. |
double |
getXMin()
Returns the minimum value of the independent variable. |
Units |
getXUnits()
Returns the current display units from the selected independent variable array. |
double[] |
getY()
Returns an array with plottable dependent variable values. |
java.util.Enumeration |
getYList()
Returns an Enumeration with the ids of all
arrays that can be used as dependent variable for plotting. |
Units |
getYUnits()
Returns the current display units from the selected dependent variable array. |
boolean |
isEvenlySampled()
Returns true if the X array is evenly sampled,
false otherwise. |
private void |
notifyListeners()
|
protected DataSet |
prepareDataSet(double[] xval,
double[] yval,
double[] eval,
Spectrum csp,
java.util.Enumeration id_list)
Execute routine activities when preparing a DataSet
object to be plotted. |
void |
selectDQ(java.lang.String arrayid)
Selects the array to be the source of data quality flags. |
void |
selectX(java.lang.String arrayid)
Selects the array to be the source of the independent variable. |
void |
selectY(java.lang.String arrayid)
Selects the array to be the source of the dependent variable. |
void |
setBothUnits(Units xunits,
Units yunits)
Sets the current display units in both arrays. |
void |
setGraphicsAttributes(java.util.Map attributes)
Sets a list of graphics attributes. |
(package private) void |
setLineType(java.awt.Stroke stroke,
java.lang.Object id)
Sets the line type. |
(package private) void |
setSymbol(Symbol symbol,
java.lang.Object id)
Sets the symbol. |
(package private) void |
setSymbolSize(int size,
java.lang.Object id)
Sets the symbol size. |
void |
setXUnits(Units newunits)
Sets the current display units in the currently selected independent variable array. |
void |
setXUnitsSilently(Units newunits)
Sets the current display units in the curently selected independent variable array. |
void |
setYUnits(Units newunits)
Sets the current display units in the currently selected dependent variable array. |
void |
setYUnitsSilently(Units newunits)
Sets the current display units in the curently selected dependent variable array. |
void |
updateArrays()
Builds the arrays that are returned by the get... |
java.util.ArrayList<DataSet> |
updateDataSets(java.util.ArrayList<DataSet> al)
This method updates an ArrayList which stores data
set objects, with additional objects built from the input arrays. |
protected void |
updateGraphicsAttributes(GraphicsAttributes pa,
Spectrum sp,
java.lang.Object id)
Updates a GraphicsAttributes object. |
java.util.ArrayList |
updateValidDataRanges(java.util.ArrayList al)
This method updates an ArrayList which stores range
objects. |
| Methods inherited from class java.util.Observable |
|---|
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface spv.spectrum.Spectrum |
|---|
addObserver, deleteObserver |
| Field Detail |
|---|
private static final int WIDTH
private static final int HEIGHT
static final java.awt.Dimension TABLE_SIZE
protected SpectrumVisualEditor visual_editor
protected Units spectrum_xunits
protected Units spectrum_yunits
protected Units display_xunits
protected Units display_yunits
protected java.awt.Stroke stroke
protected Symbol symbol
protected int size
protected boolean edited
private java.lang.String x_id
private java.lang.String y_id
private double[] xdata
private double[] ydata
private double[] errdata
private int[] dqdata
private int[] deldata
| Constructor Detail |
|---|
public PlottableSpectrum(Spectrum sp)
sp - the Spectrum instance to receive
additional plotting responsibilities| Method Detail |
|---|
LineTypeSelector getLineTypeSelector(java.lang.Object id)
LineTypeSelector object appropriate for this.
id - the id of the spectrum in a composite. Ignored in this class.
LineTypeSelector objectpublic java.lang.Object getRootObject()
Spectrum object
that is decorated by PlottableSpectrum.
getRootObject in interface PlottableSpectrum objectpublic java.lang.String getRootObjectID()
getRootObjectID in interface Plottablepublic java.lang.String getRootObjectCommonName()
getRootObjectCommonName in interface Plottablepublic int getNBins()
getNBins in interface SpectrumgetNBins in interface PlottablegetNBins in class SpectrumDecoratorpublic java.util.Enumeration getXList()
Enumeration with the ids of all
arrays that can be used as independent variable for plotting.
The returned Enumeration has its first element set
to whatever string is defined by method sp.getWavelengthID().
If the spectrum provides a non-null return from its
getSelectedRadialVelocity()method, the second element will
indicate a rest wavelength array by appending an appropriate suffix
to the wavelength ID string used in the firts element.
The third element of the enumaration, or the second if there is no
valid radial velocity object, will be the string defined by
Units.BIN_NUMBER.toString(), but only if the spectrum
is a member of the SingleSpectrum class.
Subsequent enumeration elements will be taken from the enumeration
provided by the getIntensityList() method in the
component (decorated object). THIS FEATURE WAS REMOVED ON DEC 13, 2006.
The reason the "bin number" entry only appears if the input spectrum
is an instance of the SingleSpectrum class is due
partially to a design bug in the way the bin number concept
was defined, and partially due to the questionable use of the
bin number concept in spectra comprised of several "independent"
stretches of data. Overplotting these stretches onto a common
WCS canvas may be a sensible operation to perform, arguabily,
only in wavelength space.
getXList in interface Plottablepublic java.util.Enumeration getYList()
Enumeration with the ids of all
arrays that can be used as dependent variable for plotting.
getYList in interface Plottablepublic java.util.Enumeration getDQList()
Enumeration with the ids of all
arrays that can be used as data quality.
getDQList in interface SpectrumgetDQList in interface PlottablegetDQList in class SpectrumDecoratorpublic void selectX(java.lang.String arrayid)
selectX in interface Plottablearrayid - the array identification namepublic void selectY(java.lang.String arrayid)
selectY in interface Plottablearrayid - the array identification namepublic void selectDQ(java.lang.String arrayid)
selectDQ in interface SpectrumselectDQ in interface PlottableselectDQ in class SpectrumDecoratorarrayid - the array identification namepublic java.lang.String getSelectedXID()
getSelectedXID in interface Plottablepublic java.lang.String getDefaultXID()
getDefaultXID in interface Plottablepublic java.lang.String getSelectedYID()
getSelectedYID in interface Plottablepublic java.lang.String getSelectedDQID()
getSelectedDQID in interface SpectrumgetSelectedDQID in interface PlottablegetSelectedDQID in class SpectrumDecoratorpublic double[] getX()
updateArrays
method.
getX in interface Plottablepublic double[] getY()
updateArrays
method.
getY in interface Plottablepublic int[] getDQ()
updateArrays
method.
getDQ in interface SpectrumgetDQ in interface PlottablegetDQ in class SpectrumDecoratorIINDEF-filled array.public double[] getErrors()
updateArrays
method.
getErrors in interface SpectrumgetErrors in interface PlottablegetErrors in class SpectrumDecoratorNaN-filled array.public void updateArrays()
Spectrum objects can always return some
non-null array from their getValues()
method. getErrors() and getDQ() can
return null though.
This method must be called prior to a sequence of calls to the
getter methods to ensure consistency. This architecture leads to
faster execution but is not thread-safe.
updateArrays in interface Plottablepublic Units getXUnits()
getXUnits in interface Plottablepublic Units getYUnits()
getYUnits in interface Plottablepublic void setXUnits(Units newunits)
setXUnits in interface Plottablenewunits - the new display unitspublic void setYUnits(Units newunits)
setYUnits in interface Plottablenewunits - the new display units
public void setBothUnits(Units xunits,
Units yunits)
setBothUnits in interface Plottablexunits - the new X unitsyunits - the new Y unitsprivate void notifyListeners()
public void setXUnitsSilently(Units newunits)
setXUnitsSilently in interface Plottablenewunits - the new display unitspublic void setYUnitsSilently(Units newunits)
setYUnitsSilently in interface Plottablenewunits - the new display unitspublic double getXMin()
getXMin in interface Plottablepublic double getXMax()
getXMax in interface Plottablepublic boolean isEvenlySampled()
true if the X array is evenly sampled,
false otherwise.
isEvenlySampled in interface SpectrumisEvenlySampled in interface PlottableisEvenlySampled in class SpectrumDecoratortrue if the X array is evenly sampled
false otherwise.private double[] getSelectedXArray(Spectrum sp)
sp - the decorated component Spectrum
public java.util.ArrayList<DataSet> updateDataSets(java.util.ArrayList<DataSet> al)
throws ViewException
ArrayList which stores data
set objects, with additional objects built from the input arrays.
Data sets are built from the DataSet class.
updateDataSets in interface Plottableal - the ArrayList to be updated. If set
to null, the method creates a new
ArrayList instance.
ArrayList object
ViewException
protected DataSet prepareDataSet(double[] xval,
double[] yval,
double[] eval,
Spectrum csp,
java.util.Enumeration id_list)
throws ViewException
DataSet
object to be plotted. This method is responsible for setting
the plot attributes of the data set, based on the type of
spectral data supplied to it.
xval - array with independent variable valuesyval - array with dependent variable valueseval - array with error valuescsp - the original, possibly composite, spectrumid_list - the enumeration with IDs. This enumeration
is bumped by one element each time this
method is called.
ViewException
protected void finishDataSetBuild(Spectrum csp,
java.lang.Object spid,
DataSet ds)
protected void updateGraphicsAttributes(GraphicsAttributes pa,
Spectrum sp,
java.lang.Object id)
GraphicsAttributes object. This method does nothing
here; it is up to the subclasses to implement custom behavior.
pa - the object to be updatedsp - the spectrum where to get information fromid - the id that identifies the subspectrum within a composite
void setLineType(java.awt.Stroke stroke,
java.lang.Object id)
stroke - the stroke to change toid - the id that identifies the subspectrum within a composite
void setSymbol(Symbol symbol,
java.lang.Object id)
symbol - the symbol to change toid - the id that identifies the subspectrum within a composite
void setSymbolSize(int size,
java.lang.Object id)
size - the symbol size to change toid - the id that identifies the subspectrum within a compositejava.awt.Stroke getLineType(java.lang.Object id)
id - the id that identifies the subspectrum within a composite
Symbol getSymbol(java.lang.Object id)
null.
Subclasses should override it in case custom behavior is required.
id - the id that identifies the subspectrum within a composite
nullint getSymbolSize(java.lang.Object id)
id - the id that identifies the subspectrum within a composite
public java.util.ArrayList updateValidDataRanges(java.util.ArrayList al)
throws ViewException
ArrayList which stores range
objects. In the case of a regular spectrum object, the concept of
valid data ranges is meaningless, thus this method returns the
unaltered input list.
updateValidDataRanges in interface Plottableal - the ArrayList to be updated. If set
to null, code>null is returned.
ArrayList input object
ViewExceptionpublic java.util.Map getGraphicsAttributes()
GraphicsAttributes
instances are built. It is up to the subclasses to implememnt
custom behavior.
getGraphicsAttributes in interface Plottablepublic void setGraphicsAttributes(java.util.Map attributes)
setGraphicsAttributes in interface Plottableattributes - ignoredpublic Command getVisualEditor()
Command object that implements a spectrum
screen editor.
getVisualEditor in interface Plottablepublic Command getSpectrumNormalizer()
Command object that implements a spectrum
normalizer.
public Command getDragProcessor()
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in interface Spectrumclone in class SpectrumDecoratorjava.lang.CloneNotSupportedExceptionpublic void forceSetChanged()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||