public class ReadoutProbe extends ucar.unidata.collab.SharableImpl implements java.beans.PropertyChangeListener
Modifier and Type | Field and Description |
---|---|
private java.awt.Color |
currentColor |
private double |
currentLatitude |
private double |
currentLongitude |
private java.lang.String |
currentValue |
private static java.awt.Color |
DEFAULT_COLOR |
private FlatField |
field |
private java.util.concurrent.CopyOnWriteArrayList<ProbeListener> |
listeners |
private ucar.visad.display.DisplayMaster |
master |
private static java.text.DecimalFormat |
numFmt |
private float |
pointSize |
private RealTuple |
prevPos |
private ucar.visad.display.LineProbe |
probe |
static java.lang.String |
SHARE_POSITION |
static java.lang.String |
SHARE_PROFILE |
private static TupleType |
TUPTYPE |
private ucar.visad.display.TextDisplayable |
valueDisplay
Displays the value of the data at the current position.
|
Constructor and Description |
---|
ReadoutProbe(ucar.visad.display.DisplayMaster master,
FlatField field,
java.awt.Color color,
java.lang.String pattern,
boolean visible)
Create a "HYDRA" probe that allows for displaying things like
value at current position, current color, and location.
|
Modifier and Type | Method and Description |
---|---|
void |
addProbeListener(ProbeListener listener)
Adds a
ProbeListener to the listener list so that it can be
notified when the probe is changed. |
private static ucar.visad.display.TextDisplayable |
createValueDisplay(java.awt.Color color) |
protected void |
fireProbeColorChanged(java.awt.Color previous,
java.awt.Color current)
Notifies the registered
ProbeListeners that this
probe's color has changed. |
protected void |
fireProbeFormatPatternChanged(java.lang.String previous,
java.lang.String current)
Notifies the registered
ProbeListeners that this
probe's location format pattern 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. |
java.awt.Color |
getColor() |
float |
getDisplayScale()
Get the scaling factor for probes and such.
|
EarthLocationTuple |
getEarthPosition() |
java.lang.String |
getFormatPattern()
Returns the number format string current being used.
|
private static RealTuple |
getInitialLinePosition() |
double |
getLatitude() |
double |
getLongitude() |
java.lang.String |
getValue() |
RealTuple |
getXYPosition() |
void |
handleProbeRemoval() |
void |
handleProbeUpdate() |
boolean |
hasListener(ProbeListener listener)
Determine whether or not a given
ProbeListener is listening to
the current probe. |
private static TupleType |
makeTupleType() |
void |
propertyChange(java.beans.PropertyChangeEvent e)
Called whenever the probe fires off a
PropertyChangeEvent . |
void |
quietlySetColor(java.awt.Color newColor) |
void |
quietlySetFormatPattern(java.lang.String pattern)
Update the location format pattern for the current probe, but
do not fire off any events.
|
void |
quietlySetVisible(boolean visibility) |
void |
removeProbeListener(ProbeListener listener)
Removes a
ProbeListener from the notification list. |
void |
setColor(java.awt.Color color) |
private void |
setColor(java.awt.Color color,
boolean quietly)
Note that if
color is the same as currentColor ,
nothing will happen (the method exits early). |
void |
setField(FlatField field)
Sets the
FlatField associated with this probe to the given
field . |
void |
setFormatPattern(java.lang.String pattern)
Update the location format pattern for the current probe.
|
private void |
setFormatPattern(java.lang.String pattern,
boolean quietly)
Update the location format pattern for the current probe and optionally
fire off an update event.
|
void |
setLatLon(java.lang.Double latitude,
java.lang.Double longitude) |
void |
setXYPosition(RealTuple position) |
java.lang.String |
toString()
Returns a brief summary of a ReadoutProbe.
|
private Tuple |
valueAtPosition(RealTuple position,
FlatField imageData) |
applySharableProperties, doShare, doShare, doShareExternal, doShareInternal, getReceiveShareTime, getSharablePropertiesComponent, getShareGroup, getSharing, getUniqueId, initSharable, receiveShareData, removeSharable, setReceiveShareTime, setShareGroup, setSharing, setUniqueId, showSharableDialog
public static final java.lang.String SHARE_PROFILE
public static final java.lang.String SHARE_POSITION
private static final java.awt.Color DEFAULT_COLOR
private final java.util.concurrent.CopyOnWriteArrayList<ProbeListener> listeners
private final ucar.visad.display.TextDisplayable valueDisplay
private final ucar.visad.display.LineProbe probe
private final ucar.visad.display.DisplayMaster master
private java.awt.Color currentColor
private java.lang.String currentValue
private double currentLatitude
private double currentLongitude
private float pointSize
private static final java.text.DecimalFormat numFmt
public ReadoutProbe(ucar.visad.display.DisplayMaster master, FlatField field, java.awt.Color color, java.lang.String pattern, boolean visible) throws VisADException, java.rmi.RemoteException
Note: none of the parameters permit null
values.
master
- DisplayMaster
containing the probe.field
- Data to probe.color
- Color
of the probe.pattern
- Format string to use with probe's location values.visible
- Whether or not the probe is visible.java.lang.NullPointerException
- if any of the given parameters are null
.VisADException
- if VisAD had problems.java.rmi.RemoteException
- if VisAD had problems.public void propertyChange(java.beans.PropertyChangeEvent e)
PropertyChangeEvent
. Only
handles position changes right now, all other events are discarded.propertyChange
in interface java.beans.PropertyChangeListener
e
- Object that describes the property change.java.lang.NullPointerException
- if passed a null
PropertyChangeEvent
.public void setField(FlatField field)
FlatField
associated with this probe to the given
field
.field
- New FlatField
for this probe.java.lang.NullPointerException
- if passed a null
field
.public void addProbeListener(ProbeListener listener)
ProbeListener
to the listener list so that it can be
notified when the probe is changed.listener
- ProbeListener
to register. null
listeners are not allowed.java.lang.NullPointerException
- if listener
is null.public void removeProbeListener(ProbeListener listener)
ProbeListener
from the notification list.listener
- ProbeListener
to remove. null
values
are permitted, but since they are not allowed to be added...public boolean hasListener(ProbeListener listener)
ProbeListener
is listening to
the current probe.listener
- ProbeListener
to check. null
values are
permitted.true
if listener
has been added to the list of
ProbeListener
objects, false
otherwise.protected void fireProbePositionChanged(RealTuple previous, RealTuple current)
ProbeListeners
that this
probe's position has changed.previous
- Previous position.current
- Current position.protected void fireProbeColorChanged(java.awt.Color previous, java.awt.Color current)
ProbeListeners
that this
probe's color has changed.previous
- Previous color.current
- Current color.protected void fireProbeVisibilityChanged(boolean previous)
ProbeListeners
that this
probe's visibility has changed. Only takes a "previous"
value, which is negated to form the "current" value.previous
- Visibility before change.protected void fireProbeFormatPatternChanged(java.lang.String previous, java.lang.String current)
ProbeListeners
that this
probe's location format pattern has changed.previous
- Previous location format pattern.current
- Current location format pattern.public void setColor(java.awt.Color color)
color
- private void setColor(java.awt.Color color, boolean quietly)
Note that if color
is the same as currentColor
,
nothing will happen (the method exits early).
color
- New color for this probe. Cannot be null
.quietly
- Whether or not to notify the list of
ProbeListeners
of a color change.public java.awt.Color getColor()
public java.lang.String getValue()
public double getLatitude()
public double getLongitude()
public void setLatLon(java.lang.Double latitude, java.lang.Double longitude)
public void quietlySetVisible(boolean visibility)
public void quietlySetColor(java.awt.Color newColor)
public void setFormatPattern(java.lang.String pattern)
pattern
- New location format pattern. Cannot be null
.public void quietlySetFormatPattern(java.lang.String pattern)
pattern
- New location format pattern. Cannot be null
.private void setFormatPattern(java.lang.String pattern, boolean quietly)
pattern
- New location format pattern. Cannot be null
.quietly
- Whether or not to fire a format pattern change update.public java.lang.String getFormatPattern()
public void handleProbeUpdate()
public void handleProbeRemoval()
public float getDisplayScale()
public void setXYPosition(RealTuple position)
public RealTuple getXYPosition()
public EarthLocationTuple getEarthPosition()
private Tuple valueAtPosition(RealTuple position, FlatField imageData)
private static RealTuple getInitialLinePosition()
private static ucar.visad.display.TextDisplayable createValueDisplay(java.awt.Color color)
private static TupleType makeTupleType()
public java.lang.String toString()
toString
in class java.lang.Object
[ReadProbe@HASHCODE: color=...,
latitude=..., longitude=..., value=...]