Package ucar.visad.display
Class ScalarMapAdapter
java.lang.Object
ucar.visad.display.MapAdapter
ucar.visad.display.ScalarMapAdapter
- All Implemented Interfaces:
Comparable,Propertied
- Direct Known Subclasses:
AxisScalarMap,IsoContourScalarMap,SelectRangeScalarMap,SelectValueScalarMap
Provides support for adapting VisAD ScalarMap-s to something that is
(hopefully) easier to use. Unlike instances of VisAD
ScalarMap, one
can modify the associated ScalarType of an instance of this class.
Instances of this class have the following, bound, JavaBean
properties:
| Name | Type | Access | Default | Description |
|---|---|---|---|---|
| scalarType | ScalarType |
set/get | construction-dependent | The ScalarType of the underlying ScalarMap
of this instance |
| scalarMap | ScalarMap |
construction-dependent | The underlying ScalarMap of this instance |
- Version:
- $Revision: 1.10 $
- Author:
- Steven R. Emmerson
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe name of theScalarMapproperty.static final StringThe name of theScalarTypeproperty. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedScalarMapAdapter(ScalarType st, DisplayRealType drt, DisplayAdapter displayAdapter) Constructs. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddScalarMapListener(ScalarMapListener listener) Adds aScalarMapListenerto the underlyingScalarMap.intCompares this instance to another object.booleanIndicates if this instance is semantically identical to another object.protected ControlReturns the control of the underlyingScalarMap.Returns theDisplayRealTypeof the underlyingScalarMap.Returns theScalarTypeof the underlyingScalarMap.inthashCode()Returns the hash code of this instance.voidremoveScalarMapListener(ScalarMapListener listener) Removes aScalarMapListenerfrom the underlyingScalarMap.protected voidHandles a change to the underlyingScalarMap.protected abstract voidSets the control of the underlyingScalarMap.voidExplicitly sets the range ofRealTypedata values that is mapped to the natural range ofDisplayRealTypedisplay values.protected voidsetScalarType(ScalarType scalarType) Sets theScalarTypethat is mapped to the associatedDisplayRealType.Methods inherited from class ucar.visad.display.MapAdapter
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, getDisplayRealType, removePropertyChangeListener, removePropertyChangeListener
-
Field Details
-
SCALAR_TYPE
The name of theScalarTypeproperty.- See Also:
-
SCALAR_MAP
The name of theScalarMapproperty.- See Also:
-
-
Constructor Details
-
ScalarMapAdapter
protected ScalarMapAdapter(ScalarType st, DisplayRealType drt, DisplayAdapter displayAdapter) throws VisADException, RemoteException Constructs.- Parameters:
st- The ScalarType to be associated with the DisplayRealType.drt- The DisplayRealType to be associated with the ScalarType.displayAdapter- The associated, adapted, VisAD display.- Throws:
VisADException- VisAD failure.RemoteException- Java RMI failure.
-
-
Method Details
-
setRange
Explicitly sets the range ofRealTypedata values that is mapped to the natural range ofDisplayRealTypedisplay values. This method is used to define a linear map from Scalar to DisplayScalar values.- Parameters:
lower- The data value to be mapped to the low end of the natural range of the DisplayRealType.upper- The data value to be mapped to the upper end of the natural range of the DisplayRealType.- Throws:
VisADException- VisAD failure.RemoteException- Java RMI failure.
-
scalarMapChange
protected void scalarMapChange()Handles a change to the underlyingScalarMap. This method should be overridden in subclasses when appropriate. -
setScalarType
Sets theScalarTypethat is mapped to the associatedDisplayRealType. If the newScalarTypediffers from the previousScalarType, then the underlyingScalarMapis changed to conform. AllScalarMapListeners registered with this instance are removed from the previous, underlyingScalarMapand transferred to the new, underlyingScalarType. This method firesPropertyChangeEvents forSCALAR_TYPEandSCALAR_MAPwith this instance as the source and the old and new values appropriately set. This is done synchronously -- so watch out for deadlock.- Parameters:
scalarType- The ScalarType to be mapped to the DisplayRealType.- Throws:
VisADException- VisAD failure.RemoteException- Java RMI failure.- See Also:
-
getScalarType
Returns theScalarTypeof the underlyingScalarMap.- Returns:
- The
ScalarTypeof the underlyingScalarMap.
-
getDisplayType
Returns theDisplayRealTypeof the underlyingScalarMap.- Returns:
- The
DisplayRealTypeof the underlyingScalarMap.
-
addScalarMapListener
Adds aScalarMapListenerto the underlyingScalarMap. If the underlyingScalarMapchanges, then theScalarMapListeners added by this instance are removed from the previous, underlyingScalarTypeand transferred to the new, underlyingScalarType.- Parameters:
listener- TheScalarMapListenerto be added to the underlyingScalarMap.
-
removeScalarMapListener
Removes aScalarMapListenerfrom the underlyingScalarMap.- Parameters:
listener- TheScalarMapListenerto be removed from the underlyingScalarMap.
-
compareTo
Compares this instance to another object. The comparison is based solely on the underlyingScalarMap.- Parameters:
obj- The other object.- Returns:
- A value less-than, equal-to, or greater-than zero depending on whether this instance is considered less-than, equal-to, or greater-than the other object.
-
equals
Indicates if this instance is semantically identical to another object. Two instances of this class are equal if their underlyingScalarMap-s are equal. -
hashCode
public int hashCode()Returns the hash code of this instance. -
getControl
Returns the control of the underlyingScalarMap.- Returns:
- The control of the underlying
ScalarMap.
-
setControl
Sets the control of the underlyingScalarMap.- Throws:
VisADException- VisAD failure.RemoteException- Java RMI failure.
-