edu.wisc.ssec.mcidasv.probes
Class ReadoutProbe

java.lang.Object
  extended by ucar.unidata.collab.SharableImpl
      extended by edu.wisc.ssec.mcidasv.probes.ReadoutProbe
All Implemented Interfaces:
PropertyChangeListener, EventListener, Sharable

public class ReadoutProbe
extends SharableImpl
implements PropertyChangeListener


Field Summary
private  Color currentColor
           
private  double currentLatitude
           
private  double currentLongitude
           
private  String currentValue
           
private static Color DEFAULT_COLOR
           
private  FlatField field
           
private  CopyOnWriteArrayList<ProbeListener> listeners
           
private  DisplayMaster master
           
private static DecimalFormat numFmt
           
private  float pointSize
           
private  RealTuple prevPos
           
private  LineProbe probe
           
static String SHARE_POSITION
           
static String SHARE_PROFILE
           
private static TupleType TUPTYPE
           
private  TextDisplayable valueDisplay
          Displays the value of the data at the current position.
 
Constructor Summary
ReadoutProbe(DisplayMaster master, FlatField field, Color color, boolean visible)
           
 
Method Summary
 void addProbeListener(ProbeListener listener)
          Adds a ProbeListener to the listener list so that it can be notified when the probe is changed.
private static TextDisplayable createValueDisplay(Color color)
           
protected  void fireProbeColorChanged(Color previous, Color current)
          Notifies the registered ProbeListeners that this probe's color has changed.
protected  void fireProbePositionChanged(RealTuple previous, RealTuple current)
          Notifies the registered ProbeListeners that this probe's position has changed.
protected  void fireProbeVisibilityChanged(boolean previous)
          Notifies registered ProbeListeners that this probe's visibility has changed.
 Color getColor()
           
 float getDisplayScale()
          Get the scaling factor for probes and such.
 EarthLocationTuple getEarthPosition()
           
private static RealTuple getInitialLinePosition()
           
 double getLatitude()
           
 double getLongitude()
           
 String getValue()
           
 RealTuple getXYPosition()
           
 void handleProbeRemoval()
           
 void handleProbeUpdate()
           
 boolean hasListener(ProbeListener listener)
           
private static TupleType makeTupleType()
           
 void propertyChange(PropertyChangeEvent e)
          Called whenever the probe fires off a PropertyChangeEvent.
 void quietlySetColor(Color newColor)
           
 void quietlySetVisible(boolean visibility)
           
 void removeProbeListener(ProbeListener listener)
          Removes a ProbeListener from the notification list.
 void setColor(Color color)
           
private  void setColor(Color color, boolean quietly)
           
 void setField(FlatField field)
           
 void setLatLon(Double latitude, Double longitude)
           
 void setXYPosition(RealTuple position)
           
 String toString()
          Returns a brief summary of a ReadoutProbe.
private  Tuple valueAtPosition(RealTuple position, FlatField imageData)
           
 
Methods inherited from class ucar.unidata.collab.SharableImpl
applySharableProperties, doShare, doShare, doShareExternal, doShareInternal, getReceiveShareTime, getSharablePropertiesComponent, getShareGroup, getSharing, getUniqueId, initSharable, receiveShareData, removeSharable, setReceiveShareTime, setShareGroup, setSharing, setUniqueId, showSharableDialog
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SHARE_PROFILE

public static final String SHARE_PROFILE
See Also:
Constant Field Values

SHARE_POSITION

public static final String SHARE_POSITION
See Also:
Constant Field Values

DEFAULT_COLOR

private static final Color DEFAULT_COLOR

TUPTYPE

private static final TupleType TUPTYPE

listeners

private final CopyOnWriteArrayList<ProbeListener> listeners

valueDisplay

private final TextDisplayable valueDisplay
Displays the value of the data at the current position.


probe

private final LineProbe probe

master

private final DisplayMaster master

currentColor

private Color currentColor

currentValue

private String currentValue

currentLatitude

private double currentLatitude

currentLongitude

private double currentLongitude

pointSize

private float pointSize

field

private FlatField field

numFmt

private static final DecimalFormat numFmt

prevPos

private RealTuple prevPos
Constructor Detail

ReadoutProbe

public ReadoutProbe(DisplayMaster master,
                    FlatField field,
                    Color color,
                    boolean visible)
             throws VisADException,
                    RemoteException
Throws:
VisADException
RemoteException
Method Detail

propertyChange

public void propertyChange(PropertyChangeEvent e)
Called whenever the probe fires off a PropertyChangeEvent. Only handles position changes right now, all other events are discarded.

Specified by:
propertyChange in interface PropertyChangeListener
Parameters:
e - Object that describes the property change.
Throws:
NullPointerException - if passed a null PropertyChangeEvent.

setField

public void setField(FlatField field)

addProbeListener

public void addProbeListener(ProbeListener listener)
Adds a ProbeListener to the listener list so that it can be notified when the probe is changed.

Parameters:
listener - ProbeListener to register. null listeners are not allowed.
Throws:
NullPointerException - if listener is null.

removeProbeListener

public void removeProbeListener(ProbeListener listener)
Removes a ProbeListener from the notification list.

Parameters:
listener - ProbeListener to remove. null values are permitted, but since they are not allowed to be added...

hasListener

public boolean hasListener(ProbeListener listener)

fireProbePositionChanged

protected void fireProbePositionChanged(RealTuple previous,
                                        RealTuple current)
Notifies the registered ProbeListeners that this probe's position has changed.

Parameters:
previous - Previous position.
current - Current position.

fireProbeColorChanged

protected void fireProbeColorChanged(Color previous,
                                     Color current)
Notifies the registered ProbeListeners that this probe's color has changed.

Parameters:
previous - Previous color.
current - Current color.

fireProbeVisibilityChanged

protected void fireProbeVisibilityChanged(boolean previous)
Notifies registered ProbeListeners that this probe's visibility has changed. Only takes a "previous" value, which is negated to form the "current" value.

Parameters:
previous - Visibility before change.

setColor

public void setColor(Color color)

setColor

private void setColor(Color color,
                      boolean quietly)

getColor

public Color getColor()

getValue

public String getValue()

getLatitude

public double getLatitude()

getLongitude

public double getLongitude()

setLatLon

public void setLatLon(Double latitude,
                      Double longitude)

quietlySetVisible

public void quietlySetVisible(boolean visibility)

quietlySetColor

public void quietlySetColor(Color newColor)

handleProbeUpdate

public void handleProbeUpdate()

handleProbeRemoval

public void handleProbeRemoval()

getDisplayScale

public float getDisplayScale()
Get the scaling factor for probes and such. The scaling is the parameter that gets passed to TextControl.setSize() and ShapeControl.setScale().

Returns:
ratio of the current matrix scale factor to the saved matrix scale factor.

setXYPosition

public void setXYPosition(RealTuple position)

getXYPosition

public RealTuple getXYPosition()

getEarthPosition

public EarthLocationTuple getEarthPosition()

valueAtPosition

private Tuple valueAtPosition(RealTuple position,
                              FlatField imageData)

getInitialLinePosition

private static RealTuple getInitialLinePosition()

createValueDisplay

private static TextDisplayable createValueDisplay(Color color)

makeTupleType

private static TupleType makeTupleType()

toString

public String toString()
Returns a brief summary of a ReadoutProbe. Please note that this format is subject to change.

Overrides:
toString in class Object
Returns:
String that looks like [ReadProbe@HASHCODE: color=..., latitude=..., longitude=..., value=...]