uk.ac.starlink.splat.iface
Class ModelLine

java.lang.Object
  extended by uk.ac.starlink.splat.iface.ModelLine
All Implemented Interfaces:
EventListener, uk.ac.starlink.diva.FigureListener

public class ModelLine
extends Object
implements uk.ac.starlink.diva.FigureListener

ModelLine defines a class for creating and interacting (in a DivaPlot sense) with an interpolated curve that displays a model spectral line of some kind. The interpolated line is created on a DivaPlot's DivaPlotGraphicsPane. Provision to convert between the graphics coordinates of the DivaPlot and the natural (in this case the spectral line position, width and scale) physical units of a spectrum are provided.


Field Summary
protected  Color colour
          Colour of the rendered model line.
protected  uk.ac.starlink.diva.DrawActions drawActions
          DivaPlot DrawActions.
protected  uk.ac.starlink.diva.InterpolatedCurveFigure figure
          Reference to the InterpolatedCurveFigure (used to access it via DivaPlotGraphicsPane).
protected  uk.ac.starlink.diva.FigureListener figureListener
          Listener for changes to the figure.
protected  diva.canvas.event.LayerListener listener
          Listener for creation events.
protected  ModelLineTableModel model
          The JTable model that stores references to figures used by this object.
protected  DivaPlotGraphicsPane pane
          The DivaPlotGraphicsPane.
protected  DivaPlot plot
          The DivaPlot on which the model line is drawn.
 
Constructor Summary
ModelLine(DivaPlot plot, ModelLineTableModel model, Color colour, uk.ac.starlink.diva.interp.Interpolator interpolator, boolean interactive)
          Create a range.
ModelLine(DivaPlot plot, ModelLineTableModel model, Color colour, uk.ac.starlink.diva.interp.Interpolator interpolator, double[] props)
          Create a range non-interactively.
 
Method Summary
protected  void createFigure(uk.ac.starlink.diva.interp.Interpolator interp)
          Create the figure with the given Interpolator.
 void delete()
          Delete the associated figure.
 void figureChanged(uk.ac.starlink.diva.FigureChangedEvent e)
          Sent when the figure is changed (i.e.
 void figureCreated(uk.ac.starlink.diva.FigureChangedEvent e)
          Sent when the figure is created.
 void figureRemoved(uk.ac.starlink.diva.FigureChangedEvent e)
          Sent when the figure is removed elsewhere.
 double[] getProps()
          Return the physical properties of the figure.
 boolean isFigure(uk.ac.starlink.diva.InterpolatedCurveFigure extFigure)
          Report if a InterpolatedCurveFigure is the one being used here.
protected  void registerFigure(uk.ac.starlink.diva.InterpolatedCurveFigure figure)
          Register the Figure after it has been created.
protected  void setPlot(DivaPlot plot)
          Set the DivaPlot used for drawing and interactions.
 void setProps(double[] props)
          Set the physical properties of the figure.
protected  void startInteraction(uk.ac.starlink.diva.interp.Interpolator interpolator)
          Configure the DivaPlot DrawActions instance to create an InterpolatedCurveFigure with the correct Interpolator.
 String toString()
          Return a description of the figure.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

plot

protected DivaPlot plot
The DivaPlot on which the model line is drawn.


pane

protected DivaPlotGraphicsPane pane
The DivaPlotGraphicsPane.


drawActions

protected uk.ac.starlink.diva.DrawActions drawActions
DivaPlot DrawActions.


figure

protected uk.ac.starlink.diva.InterpolatedCurveFigure figure
Reference to the InterpolatedCurveFigure (used to access it via DivaPlotGraphicsPane).


listener

protected diva.canvas.event.LayerListener listener
Listener for creation events.


figureListener

protected uk.ac.starlink.diva.FigureListener figureListener
Listener for changes to the figure.


model

protected ModelLineTableModel model
The JTable model that stores references to figures used by this object. Also provides a view of the current states and the ability to edit values.


colour

protected Color colour
Colour of the rendered model line.

Constructor Detail

ModelLine

public ModelLine(DivaPlot plot,
                 ModelLineTableModel model,
                 Color colour,
                 uk.ac.starlink.diva.interp.Interpolator interpolator,
                 boolean interactive)
Create a range. Can be interactively created or non-interactively.

Parameters:
plot - DivaPlot that is to display the range.
model - model that arranges to have the properties of the figure displayed (may be null).
colour - the colour of any figures.
interpolator - an Interpolator to use for creating the figure.
interactive - whether to create figure interactively, otherwise it just uses the properties of the interpolator.

ModelLine

public ModelLine(DivaPlot plot,
                 ModelLineTableModel model,
                 Color colour,
                 uk.ac.starlink.diva.interp.Interpolator interpolator,
                 double[] props)
Create a range non-interactively.

Parameters:
plot - DivaPlot that is to display the range.
model - model that arranges to have the properties of the figure displayed (may be null).
colour - the colour of any figures.
interpolator - an Interpolator to use for creating thge figure.
Method Detail

setPlot

protected void setPlot(DivaPlot plot)
Set the DivaPlot used for drawing and interactions.

Parameters:
plot - The new plot value

toString

public String toString()
Return a description of the figure.

Overrides:
toString in class Object

isFigure

public boolean isFigure(uk.ac.starlink.diva.InterpolatedCurveFigure extFigure)
Report if a InterpolatedCurveFigure is the one being used here.

Parameters:
extFigure - figure to check

getProps

public double[] getProps()
Return the physical properties of the figure. This depends on the figure type, but can be assumed to be the X coordinate of the line centre, the scale of the line, followed by up to two widths, the Gaussian and Lorentzian widths, whichever are appropriate. These are indexed by the CENTRE, SCALE, GWIDTH and LWIDTH constants of the LineInterpolator class.


setProps

public void setProps(double[] props)
Set the physical properties of the figure. This should be an array of values indexed by the CENTRE, SCALE, GWIDTH and LWIDTH constants of the LineInterpolator class.


startInteraction

protected void startInteraction(uk.ac.starlink.diva.interp.Interpolator interpolator)
Configure the DivaPlot DrawActions instance to create an InterpolatedCurveFigure with the correct Interpolator.


createFigure

protected void createFigure(uk.ac.starlink.diva.interp.Interpolator interp)
Create the figure with the given Interpolator.

Parameters:
limits - Description of the Parameter

registerFigure

protected void registerFigure(uk.ac.starlink.diva.InterpolatedCurveFigure figure)
Register the Figure after it has been created.


delete

public void delete()
Delete the associated figure.


figureCreated

public void figureCreated(uk.ac.starlink.diva.FigureChangedEvent e)
Sent when the figure is created.

Specified by:
figureCreated in interface uk.ac.starlink.diva.FigureListener

figureRemoved

public void figureRemoved(uk.ac.starlink.diva.FigureChangedEvent e)
Sent when the figure is removed elsewhere.

Specified by:
figureRemoved in interface uk.ac.starlink.diva.FigureListener
Parameters:
e - Description of the Parameter

figureChanged

public void figureChanged(uk.ac.starlink.diva.FigureChangedEvent e)
Sent when the figure is changed (i.e. moved or transformed).

Specified by:
figureChanged in interface uk.ac.starlink.diva.FigureListener


Copyright © 2017 Central Laboratory of the Research Councils. All Rights Reserved.