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 String
The name of theScalarMap
property.static final String
The name of theScalarType
property. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ScalarMapAdapter
(ScalarType st, DisplayRealType drt, DisplayAdapter displayAdapter) Constructs. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addScalarMapListener
(ScalarMapListener listener) Adds aScalarMapListener
to the underlyingScalarMap
.int
Compares this instance to another object.boolean
Indicates if this instance is semantically identical to another object.protected Control
Returns the control of the underlyingScalarMap
.Returns theDisplayRealType
of the underlyingScalarMap
.Returns theScalarType
of the underlyingScalarMap
.int
hashCode()
Returns the hash code of this instance.void
removeScalarMapListener
(ScalarMapListener listener) Removes aScalarMapListener
from the underlyingScalarMap
.protected void
Handles a change to the underlyingScalarMap
.protected abstract void
Sets the control of the underlyingScalarMap
.void
Explicitly sets the range ofRealType
data values that is mapped to the natural range ofDisplayRealType
display values.protected void
setScalarType
(ScalarType scalarType) Sets theScalarType
that 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 theScalarType
property.- See Also:
-
SCALAR_MAP
The name of theScalarMap
property.- 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 ofRealType
data values that is mapped to the natural range ofDisplayRealType
display 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 theScalarType
that is mapped to the associatedDisplayRealType
. If the newScalarType
differs from the previousScalarType
, then the underlyingScalarMap
is changed to conform. AllScalarMapListener
s registered with this instance are removed from the previous, underlyingScalarMap
and transferred to the new, underlyingScalarType
. This method firesPropertyChangeEvent
s forSCALAR_TYPE
andSCALAR_MAP
with 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 theScalarType
of the underlyingScalarMap
.- Returns:
- The
ScalarType
of the underlyingScalarMap
.
-
getDisplayType
Returns theDisplayRealType
of the underlyingScalarMap
.- Returns:
- The
DisplayRealType
of the underlyingScalarMap
.
-
addScalarMapListener
Adds aScalarMapListener
to the underlyingScalarMap
. If the underlyingScalarMap
changes, then theScalarMapListener
s added by this instance are removed from the previous, underlyingScalarType
and transferred to the new, underlyingScalarType
.- Parameters:
listener
- TheScalarMapListener
to be added to the underlyingScalarMap
.
-
removeScalarMapListener
Removes aScalarMapListener
from the underlyingScalarMap
.- Parameters:
listener
- TheScalarMapListener
to 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.
-