Package edu.wisc.ssec.mcidasv.probes
Class ReadoutProbe
java.lang.Object
ucar.unidata.collab.SharableImpl
edu.wisc.ssec.mcidasv.probes.ReadoutProbe
- All Implemented Interfaces:
PropertyChangeListener,EventListener,Sharable,DisplayListener
ReadoutProbe is a probe that combines a "pickable" probe
widget with an adjacent text "readout" of the data value at the
probe's current location.
Primarily used with
MultiSpectralControl.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThis class is a reimplementation ofPointProbethat whose mouse movement is limited to the x- and y- axes. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Colorprivate doubleprivate doubleprivate Stringprivate static final Colorprivate FlatFieldprivate floatUsed to keep track of the last zoom "level".private final List<ProbeListener> private static final org.slf4j.Loggerprivate final DisplayMasterprivate static final DecimalFormatprivate final ReadoutProbe.PointSelectorprivate floatstatic final Stringstatic final Stringprivate static final TupleTypeprivate final TextDisplayableDisplays the value of the data at the current position. -
Constructor Summary
ConstructorsConstructorDescriptionReadoutProbe(DisplayControlImpl control, FlatField flatField, Color color, String pattern, boolean visible) Create a "HYDRA" probe that allows for displaying things like value at current position, current color, and location. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidAdd this probe instance to the relevant listeners.voidaddProbeListener(ProbeListener listener) Adds aProbeListenerto the listener list so that it can be notified when the probe is changed.private static TextDisplayablecreateValueDisplay(Color color) voidCalled for events happening in theDisplayImplassociated withDisplayMaster.protected voidfireProbeColorChanged(Color previous, Color current) Notifies the registeredProbeListenersthat this probe's color has changed.protected voidfireProbeFormatPatternChanged(String previous, String current) Notifies the registeredProbeListenersthat this probe's location format pattern has changed.protected voidfireProbePositionChanged(RealTuple previous, RealTuple current) Notifies the registeredProbeListenersthat this probe's position has changed.protected voidfireProbeVisibilityChanged(boolean previous) Notifies registeredProbeListenersthat this probe's visibility has changed.getColor()Get the current color of thisReadoutProbeinstance.final floatGet the scaling factor for probes and such.Get the current "earth location" of the probe.Returns the number format string current being used.private static RealTupledoubleGet the current latitude of thisReadoutProbeinstance.doubleGet the current longitude of thisReadoutProbeinstance.getValue()Get the current "readout value" of thisReadoutProbeinstance.voidCalled when this probe has been removed.voidbooleanhasListener(ProbeListener listener) Determine whether or not a givenProbeListeneris listening to the current probe.static RealTuplemakeEarth2dTuple(double lat, double lon) Returns aSpatialEarth2DTuplefor the given latitude and longitude.private static TupleTypevoidprojectionChanged(MapProjection newProjection) Respond to the projection having been changed.voidCalled whenever the probe fires off aPropertyChangeEvent.voidquietlySetColor(Color newColor) voidquietlySetFormatPattern(String pattern) Update the location format pattern for the current probe, but do not fire off any events.voidquietlySetVisible(boolean visibility) voidremoveProbeListener(ProbeListener listener) Removes aProbeListenerfrom the notification list.voidChange the color of thisReadoutProbeinstance.private voidChange the color of thisReadoutProbeinstance and control whether or not listeners should be notified.voidSets theFlatFieldassociated with this probe to the givenfield.voidsetFormatPattern(String pattern) Update the location format pattern for the current probe.private voidsetFormatPattern(String pattern, boolean quietly) Update the location format pattern for the current probe and optionally fire off an update event.voidsetLatLon(double latitude, double longitude) voidsetXYPosition(RealTuple position) toString()Returns a brief summary of a ReadoutProbe.private TuplevalueAtPosition(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
-
Field Details
-
SHARE_PROFILE
- See Also:
-
SHARE_POSITION
- See Also:
-
DEFAULT_COLOR
-
TUPTYPE
-
logger
-
listeners
-
valueDisplay
Displays the value of the data at the current position. -
pointSelector
-
master
-
currentColor
-
currentValue
-
currentLatitude
-
currentLongitude
-
pointSize
-
field
-
numFmt
-
lastScale
Used to keep track of the last zoom "level".
-
-
Constructor Details
-
ReadoutProbe
public ReadoutProbe(DisplayControlImpl control, FlatField flatField, Color color, String pattern, boolean visible) throws VisADException, RemoteException Create a "HYDRA" probe that allows for displaying things like value at current position, current color, and location.Note: none of the parameters permit
nullvalues.- Parameters:
control- "Layer" that will be probed.flatField- Data to probe.color-Colorof the probe.pattern- Format string to use with probe's location values.visible- Whether or not the probe is visible.- Throws:
NullPointerException- if any of the given parameters arenull.VisADException- if VisAD had problems.RemoteException- if VisAD had problems.
-
-
Method Details
-
addListeners
Add this probe instance to the relevant listeners. -
propertyChange
Called whenever the probe fires off aPropertyChangeEvent.Only handles position changes right now, all other events are discarded.
- Specified by:
propertyChangein interfacePropertyChangeListener- Parameters:
e- Object that describes the property change.- Throws:
NullPointerException- if passed anullPropertyChangeEvent.
-
displayChanged
Called for events happening in theDisplayImplassociated withDisplayMaster.The only event that is actually handled is
DisplayEvent.FRAME_DONE, which allows us to snap the text value displayable to the actual "pickable" probe.- Specified by:
displayChangedin interfaceDisplayListener- Parameters:
e- Event to handle.
-
setField
Sets theFlatFieldassociated with this probe to the givenfield.- Parameters:
flatField- NewFlatFieldfor this probe.- Throws:
NullPointerException- if passed anullfield.
-
addProbeListener
Adds aProbeListenerto the listener list so that it can be notified when the probe is changed.- Parameters:
listener-ProbeListenerto register.nulllisteners are not allowed.- Throws:
NullPointerException- iflisteneris null.
-
removeProbeListener
Removes aProbeListenerfrom the notification list.- Parameters:
listener-ProbeListenerto remove.nullvalues are permitted, but since they are not allowed to be added...
-
hasListener
Determine whether or not a givenProbeListeneris listening to the current probe.- Parameters:
listener-ProbeListenerto check.nullvalues are permitted.- Returns:
trueiflistenerhas been added to the list ofProbeListenerobjects,falseotherwise.
-
fireProbePositionChanged
Notifies the registeredProbeListenersthat this probe's position has changed.- Parameters:
previous- Previous position. Cannot benull.current- Current position. Cannot benull.
-
fireProbeColorChanged
Notifies the registeredProbeListenersthat this probe's color has changed.- Parameters:
previous- Previous color. Cannot benull.current- Current color. Cannot benull.
-
fireProbeVisibilityChanged
Notifies registeredProbeListenersthat this probe's visibility has changed. Only takes a "previous" value, which is negated to form the "current" value.- Parameters:
previous- Visibility before change.
-
fireProbeFormatPatternChanged
Notifies the registeredProbeListenersthat this probe's location format pattern has changed.- Parameters:
previous- Previous location format pattern.current- Current location format pattern.
-
setColor
Change the color of thisReadoutProbeinstance.- Parameters:
color- New color. Cannot benull.
-
getPointSelector
-
getValueDisplay
-
setColor
Change the color of thisReadoutProbeinstance and control whether or not listeners should be notified.Note that if
coloris the same ascurrentColor, nothing will happen (the method exits early).- Parameters:
color- New color for this probe. Cannot benull.quietly- Whether or not to notify the list ofProbeListenersof a color change.
-
getColor
Get the current color of thisReadoutProbeinstance.- Returns:
Colorof thisReadoutProbe.
-
getValue
Get the current "readout value" of thisReadoutProbeinstance.- Returns:
- The value of the data at the probe's current location.
-
getLatitude
Get the current latitude of thisReadoutProbeinstance.- Returns:
- Current latitude of the probe.
-
getLongitude
Get the current longitude of thisReadoutProbeinstance.- Returns:
- Current longitude of the probe.
-
setLatLon
-
quietlySetVisible
-
quietlySetColor
-
setFormatPattern
Update the location format pattern for the current probe.- Parameters:
pattern- New location format pattern. Cannot benull.
-
quietlySetFormatPattern
Update the location format pattern for the current probe, but do not fire off any events.- Parameters:
pattern- New location format pattern. Cannot benull.
-
setFormatPattern
Update the location format pattern for the current probe and optionally fire off an update event.- Parameters:
pattern- New location format pattern. Cannot benull.quietly- Whether or not to fire a format pattern change update.
-
getFormatPattern
Returns the number format string current being used.- Returns:
- Location format pattern string.
-
handleProbeUpdate
-
handleProbeRemoval
Called when this probe has been removed. -
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
-
getXYPosition
-
getEarthPosition
Get the current "earth location" of the probe.Note: this method will attempt to change the
currentLatitudeandcurrentLongitudefields.- Returns:
- Location of
pointSelector, ornullif the location could not be determined.
-
projectionChanged
Respond to the projection having been changed.- Parameters:
newProjection- New projection. Can benull.
-
valueAtPosition
-
makeEarth2dTuple
public static RealTuple makeEarth2dTuple(double lat, double lon) throws VisADException, RemoteException Returns aSpatialEarth2DTuplefor the given latitude and longitude.Be aware that for whatever reason VisAD wants the longitude first, then the latitude.
- Parameters:
lat- Latitude of the position.lon- Longitude of the position.- Returns:
SpatialEarth2DTuplecontaininglatandlon.- Throws:
VisADException- Problem creating VisAD object.RemoteException- Java RMI error.
-
getInitialProbePosition
-
createValueDisplay
-
makeTupleType
-
toString
Returns a brief summary of a ReadoutProbe. Please note that this format is subject to change.
-