public class ReadoutProbe extends SharableImpl implements PropertyChangeListener
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
ReadoutProbe(DisplayMaster master,
FlatField field,
Color color,
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 TextDisplayable |
createValueDisplay(Color color) |
protected void |
fireProbeColorChanged(Color previous,
Color current)
Notifies the registered
ProbeListeners that this
probe's color has changed. |
protected void |
fireProbeFormatPatternChanged(String previous,
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. |
Color |
getColor() |
float |
getDisplayScale()
Get the scaling factor for probes and such.
|
EarthLocationTuple |
getEarthPosition() |
String |
getFormatPattern()
Returns the number format string current being used.
|
private static RealTuple |
getInitialLinePosition() |
double |
getLatitude() |
double |
getLongitude() |
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(PropertyChangeEvent e)
Called whenever the probe fires off a
PropertyChangeEvent . |
void |
quietlySetColor(Color newColor) |
void |
quietlySetFormatPattern(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(Color color) |
private void |
setColor(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(String pattern)
Update the location format pattern for the current probe.
|
private void |
setFormatPattern(String pattern,
boolean quietly)
Update the location format pattern for the current probe and optionally
fire off an update event.
|
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) |
applySharableProperties, doShare, doShare, doShareExternal, doShareInternal, getReceiveShareTime, getSharablePropertiesComponent, getShareGroup, getSharing, getUniqueId, initSharable, receiveShareData, removeSharable, setReceiveShareTime, setShareGroup, setSharing, setUniqueId, showSharableDialog
public static final String SHARE_PROFILE
public static final String SHARE_POSITION
private static final Color DEFAULT_COLOR
private final CopyOnWriteArrayList<ProbeListener> listeners
private final TextDisplayable valueDisplay
private final DisplayMaster master
private Color currentColor
private String currentValue
private double currentLatitude
private double currentLongitude
private float pointSize
private static final DecimalFormat numFmt
public ReadoutProbe(DisplayMaster master, FlatField field, Color color, String pattern, boolean visible) throws VisADException, 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.NullPointerException
- if any of the given parameters are null
.VisADException
- if VisAD had problems.RemoteException
- if VisAD had problems.public void propertyChange(PropertyChangeEvent e)
PropertyChangeEvent
. Only
handles position changes right now, all other events are discarded.propertyChange
in interface PropertyChangeListener
e
- Object that describes the property change.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.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.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(Color previous, 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(String previous, String current)
ProbeListeners
that this
probe's location format pattern has changed.previous
- Previous location format pattern.current
- Current location format pattern.private void setColor(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 double getLatitude()
public double getLongitude()
public void quietlySetVisible(boolean visibility)
public void quietlySetColor(Color newColor)
public void setFormatPattern(String pattern)
pattern
- New location format pattern. Cannot be null
.public void quietlySetFormatPattern(String pattern)
pattern
- New location format pattern. Cannot be null
.private void setFormatPattern(String pattern, boolean quietly)
pattern
- New location format pattern. Cannot be null
.quietly
- Whether or not to fire a format pattern change update.public 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 TextDisplayable createValueDisplay(Color color)
private static TupleType makeTupleType()