ucar.visad.display
Class Displayable

java.lang.Object
  extended by ucar.visad.display.Displayable
Direct Known Subclasses:
Animation, CompositeDisplayable, DisplayableData, DisplayableDataRef, SelectRangeDisplayable

public abstract class Displayable
extends Object

Provides support for encapsulating one or more displayed data objects together with their display-dependent state.

Instances of this class have the following bound properties:
Name Type Access Default Description
display visad.LocalDisplay set/get null The VisAD display associated with this instance
scalarMapSet ScalarMapSet get empty set The set of non-spatial or unique ScalarMap-s associated with this instance

This implementation conserves memory by delaying storage allocation for PropertyChangeListener-s until the first one is registered.

Version:
$Revision: 1.76 $
Author:
Steven R. Emmerson
See Also:
ScalarMapSet

Field Summary
static String DISPLAY
          The name of the VisAD display property.
protected  CompositeDisplayable parent
          The parent.
static String SCALAR_MAP_SET
          The name of the set of ScalarMapSet property.
 
Constructor Summary
protected Displayable()
          Constructs from nothing.
protected Displayable(Displayable that)
          Constructs from another instance.
protected Displayable(LocalDisplay display)
          Constructs from an initial VisAD display.
 
Method Summary
 ConstantMap addConstantMap(ConstantMap constantMap)
          Adds a ConstantMap to this instance.
 void addConstantMaps(ConstantMap[] maps)
          Adds ConstantMaps to this instance.
 void addDataReferences()
          Requests that this instance's DataReferences be added to the associated VisAD display as soon as feasible.
 void addPropertyChangeListener(PropertyChangeListener listener)
          Adds a PropertyChangeListener to this instance.
 void addPropertyChangeListener(String name, PropertyChangeListener listener)
          Adds a PropertyChangeListener for a named property to this instance.
protected  boolean addRefsInvoked()
          Returns whether or not the client has requested that this instance's DataReferences be added to the display.
protected  void addScalarMap(ScalarMap map)
          Adds a ScalarMap to this instance's set of ScalarMap-s.
protected  void addScalarMaps(ScalarMapSet maps)
          Adds a set of ScalarMap-s to this instance's set of ScalarMap-s.
protected  void applyColorUnit(ScalarMap map, RealType realType)
          If the colorUnit is not compatible with the unit of the given real type then clear the colorUnit and set the override unit of the given ScalarMap to the default Unit of the realType.
protected  void applyDisplayUnit(ScalarMap map, RealType realType)
          If the displayUnit is not compatible with the unit of the given RealType then clear the displayUnit and set the override unit of the given ScalarMap to the default Unit of the realType.
protected  void checkUnit(RealType realType, Unit unit)
          Check if the given unit is compatible with the unit of the given realtype.
abstract  Displayable cloneForDisplay()
          Returns a clone of this instance suitable for another VisAD display.
protected  ConstantMap[] combineConstantMaps(ConstantMapSet maps)
          Combines this instance's ConstantMap-s with another set of ConstantMap-s and returns a copy of the set.
protected  void destroy()
          Called when the displayable is removed from a display master
 void destroyDisplayable()
          Destroy this instance
protected  void firePropertyChange(PropertyChangeEvent event)
          Calls firePropertyChangeEventInThread so we break up potential deadlocks
protected  void firePropertyChange(String propertyName, Object oldValue, Object newValue)
          Fires a PropertyChangeEvent.
protected  void fireScalarMapSetChange()
          Fires a PropertyChangeEvent for the SCALAR_MAP_SET property with the value of the SCALAR_MAP_SET at the time of the last firing as the old value.
 Set getAnimationSet(RealType aniType, boolean force)
          Returns the set of values for the given aniType if the contained Data objects adapted by this Displayable have any data of that type.
 Unit getColorUnit()
          Return the color Unit.
 ConstantMap[] getConstantMaps()
          Returns copies of the ConstantMap-s of this instance.
 Data getData()
          Returns the single, VisAD data object adapted by this Displayable, if one exists.
 boolean getDestroyed()
          Are we destroyed?
 LocalDisplay getDisplay()
          Returns the associated VisAD display.
 DisplayMaster getDisplayMaster()
          Get the display master.
 Unit getDisplayUnit()
          Returns the unit that is being used by the VisAD display subsystem for rendering this instance or null if no such unit exists.
 boolean getPointMode()
          Get whether or not to render data as points
protected static ScalarMap getScalarMap(LocalDisplay display, ScalarMap template)
          Finds the ScalarMap of a VisAD display that matches a given ScalarMap in the sense that it has the same ScalarType and DisplayRealType.
protected static ScalarMap getScalarMap(LocalDisplay display, ScalarType scalarType, DisplayRealType displayRealType)
          Finds the ScalarMap of a VisAD display that has the given ScalarType and DisplayRealType.
protected  ScalarMap getScalarMap(ScalarMap template)
          Returns the ScalarMap in this instance's set of ScalarMaps that matches a template or null if no such ScalarMap is found.
 ScalarMapSet getScalarMapSet()
          Returns the set of ScalarMap-s associated with this instance.
 boolean getUseFastRendering()
          Get whether or not to use fast rendering.
 boolean getUseTimesInAnimation()
          Get the UseTimesInAnimation property.
 boolean getVisible()
          Gets the visibility property.
 boolean hasDataObject()
          Indicates whether or not this Displayable adapts a single, VisAD data object.
 boolean isActive()
          Is the DisplayMaster this displayable is part of active
protected  boolean isUnitCompatible(RealType realType, Unit unit)
          Is the given unit compatible (i.e., is either null or can convert to the defaultUnit) with the the given real type.
 boolean isVisible()
          Returns the visibility property.
 void logException(String msg, Exception exc)
          A wrapper around LogUtil.logException
protected  void myAddConstantMaps(ConstantMap[] newMaps)
          Adds this instance's data references to the associated VisAD display if possible.
protected abstract  void myAddDataReferences()
          Adds this instance's data references to the associated VisAD display if possible.
protected abstract  void myRemoveDataReferences()
          Removes this instance's data references from the associated VisAD display.
 ConstantMap removeConstantMap(DisplayRealType displayRealType)
          Removes a ConstantMap from this instance.
 void removeDataReferences()
          Removes this instance's data references from the associated VisAD display.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Removes a PropertyChangeListener from this instance.
 void removePropertyChangeListener(String name, PropertyChangeListener listener)
          Removes a PropertyChangeListener for a named property from this instance.
protected  void removeScalarMap(ScalarMap map)
          Removes a ScalarMap from this instance's set of ScalarMap-s.
protected  void replaceScalarMap(ScalarMap oldMap, ScalarMap newMap)
          Replaces a ScalarMap in this instance's set of ScalarMap-s.
 void setAdjustFlow(boolean adjust)
          A no-op method so we can have a consistent api with the composite pattern.
 void setColor(Color c)
          A no-op method so we can have a consistent api with the composite pattern.
 void setColorPalette(ColorTable colorTable)
          A wrapper method calling setColorPalette (float[][] c)
 void setColorPalette(float[][] c)
          A no-op method so we can have a consistent api with the composite pattern.
 void setColorUnit(Unit unit)
          A hook to allow sub-classes to set their color unit.
 void setConstantPosition(double value, DisplayRealType type)
          Set the z position to given value
 void setContourInfo(ContourInfo contourInfo)
          A no-op method for setting contour information
 void setDisplay(LocalDisplay display)
          Associates this instance with a given VisAD display.
 void setDisplayActive()
          A wrapper arount DisplayMaster.setDisplayActive.
 void setDisplayInactive()
          A wrapper arount DisplayMaster.setDisplayInactive.
protected  void setDisplayMaster(DisplayMaster master)
          Set the display master.
 void setDisplayUnit(Unit unit)
          Sets the unit for use by the VisAD display subsystem.
 void setLineWidth(float size)
          A no-op method so we can have a consistent api with the composite pattern.
 void setManipulable(boolean manipulable)
          Sets the manipulable value of this Displayable.
 void setOverrideAnimationSet(List times)
          Set the animation set with a list of DateTimes
 void setOverrideAnimationSet(Set set)
          Set an alternate animation set
protected  void setParent(CompositeDisplayable parent)
          Set the parent.
 void setPointMode(boolean usePoints)
          Set the flags for whether the Displayable displays data as points.
 void setPointSize(float size)
          A no-op method so we can have a consistent api with the composite pattern.
 void setRangeForColor(double low, double hi)
          A no-op method so we can have a consistent api with the composite pattern.
 void setRangeForColor(Range r)
          Just a wrapper around the other setRangeForColor(double, double)
 void setScalarMapSet(ScalarMapSet maps)
          Sets the set of ScalarMap-s of this instance.
 void setSelectedRange(double low, double hi)
          A no-op method so we can have a consistent api with the composite pattern.
 void setSelectedRange(Range r)
          Just a wrapper around the other setSelectedRange(double, double)
 void setUseFastRendering(boolean fastRender)
          Set the flags for whether the renderer should use fast (but perhaps inaccurate) rendering (ie, not account for projection seams)
 void setUseTimesInAnimation(boolean value)
          Set the UseTimesInAnimation property.
 void setVisible(boolean visible)
          Sets the visibility property.
 void toFront()
          Bring the displayable to the front.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DISPLAY

public static final String DISPLAY
The name of the VisAD display property.

See Also:
Constant Field Values

SCALAR_MAP_SET

public static final String SCALAR_MAP_SET
The name of the set of ScalarMapSet property.

See Also:
Constant Field Values

parent

protected CompositeDisplayable parent
The parent. May be null.

Constructor Detail

Displayable

protected Displayable()
               throws RemoteException,
                      VisADException
Constructs from nothing.

Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

Displayable

protected Displayable(LocalDisplay display)
               throws RemoteException,
                      VisADException
Constructs from an initial VisAD display.

Parameters:
display - The VisAD display. May be null.
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

Displayable

protected Displayable(Displayable that)
               throws RemoteException,
                      VisADException
Constructs from another instance. The ConstantMap-s and ScalarMap-s are copied from the other instance. The list of PropertyChangeListener-s is empty, however, and the display is unset.

Parameters:
that - The other instance.
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.
Method Detail

toFront

public void toFront()
             throws RemoteException,
                    VisADException
Bring the displayable to the front. Basically this removes it from the display and re-adds it.

Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

getDisplayMaster

public DisplayMaster getDisplayMaster()
Get the display master. If none set on this displayable then, if there is a parent composite, ask the parent. Else return null.

Returns:
The DisplayMaster this displayable is part of.

setDisplayMaster

protected void setDisplayMaster(DisplayMaster master)
                         throws VisADException,
                                RemoteException
Set the display master. This may be null.

Parameters:
master - The DisplayMaster this displayable is part of.
Throws:
RemoteException - Java RMI Exception
VisADException - VisAD Exception

setUseFastRendering

public void setUseFastRendering(boolean fastRender)
                         throws VisADException,
                                RemoteException
Set the flags for whether the renderer should use fast (but perhaps inaccurate) rendering (ie, not account for projection seams)

Parameters:
fastRender - true to render quickly
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

getUseFastRendering

public boolean getUseFastRendering()
Get whether or not to use fast rendering.

Returns:
true to use fast rendering

setPointMode

public void setPointMode(boolean usePoints)
                  throws VisADException,
                         RemoteException
Set the flags for whether the Displayable displays data as points.

Parameters:
usePoints - true to display as points
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

getPointMode

public boolean getPointMode()
Get whether or not to render data as points

Returns:
true to display as points

setParent

protected void setParent(CompositeDisplayable parent)
Set the parent.

Parameters:
parent - The parent composite.

setConstantPosition

public void setConstantPosition(double value,
                                DisplayRealType type)
                         throws VisADException,
                                RemoteException
Set the z position to given value

Parameters:
value - The value
type - The type
Throws:
RemoteException - On badness
VisADException - On badness

setDisplayInactive

public void setDisplayInactive()
                        throws RemoteException,
                               VisADException
A wrapper arount DisplayMaster.setDisplayInactive. This must be followed by a corresponding call to setDisplayActive

Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

setDisplayActive

public void setDisplayActive()
                      throws RemoteException,
                             VisADException
A wrapper arount DisplayMaster.setDisplayActive. This must be preceded by a call to setDisplayInactive

Throws:
RemoteException - On badness
VisADException - On badness

isActive

public boolean isActive()
                 throws RemoteException,
                        VisADException
Is the DisplayMaster this displayable is part of active

Returns:
Is active
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

setDisplay

public void setDisplay(LocalDisplay display)
                throws RemoteException,
                       VisADException
Associates this instance with a given VisAD display. If this instance was previously associated with a VisAD display, then it is first removed from that display. This method fires a PropertyChangeEvent for DISPLAY with the old and new values. This method will not cause this instance to be rendered in the display. This method may be overridden in subclasses; the overriding method should invoke super.setDisplay(display).

Parameters:
display - The VisAD display.
Throws:
VisADException - if a core VisAD failure occurs.
RemoteException - if Java RMI failure occurs.
See Also:
removeDataReferences()

getDisplay

public final LocalDisplay getDisplay()
Returns the associated VisAD display.

Returns:
The associated VisAD display. Will be null if this instance hasn't been associated with a VisAD display yet.

getScalarMapSet

public final ScalarMapSet getScalarMapSet()
Returns the set of ScalarMap-s associated with this instance.

Returns:
The set of ScalarMap-s associated with this instance.

addRefsInvoked

protected final boolean addRefsInvoked()
Returns whether or not the client has requested that this instance's DataReferences be added to the display.

Returns:
true if and only if addDataReferences() has been called without an intervening removeDataReferences().

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener to this instance.

Parameters:
listener - The PropertyChangeListener to be added.

addPropertyChangeListener

public void addPropertyChangeListener(String name,
                                      PropertyChangeListener listener)
Adds a PropertyChangeListener for a named property to this instance.

Parameters:
name - The name of the property.
listener - The PropertyChangeListener to be added.

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Removes a PropertyChangeListener from this instance.

Parameters:
listener - The PropertyChangeListener to be removed.

removePropertyChangeListener

public void removePropertyChangeListener(String name,
                                         PropertyChangeListener listener)
Removes a PropertyChangeListener for a named property from this instance.

Parameters:
name - The name of the property.
listener - The PropertyChangeListener to be removed.

addConstantMap

public ConstantMap addConstantMap(ConstantMap constantMap)
                           throws RemoteException,
                                  VisADException
Adds a ConstantMap to this instance.

Parameters:
constantMap - The ConstantMap to be added.
Returns:
The previous constant map or null.
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

addConstantMaps

public void addConstantMaps(ConstantMap[] maps)
                     throws RemoteException,
                            VisADException
Adds ConstantMaps to this instance.

Parameters:
maps - The ConstantMaps to be added.
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

removeConstantMap

public ConstantMap removeConstantMap(DisplayRealType displayRealType)
Removes a ConstantMap from this instance.

Parameters:
displayRealType - The DisplayRealType to have its ConstantMap removed.
Returns:
The associated ConstantMap or null.

setRangeForColor

public void setRangeForColor(double low,
                             double hi)
                      throws VisADException,
                             RemoteException

A no-op method so we can have a consistent api with the composite pattern. This method is overwritten in CompositeDisplayable, which iterates through its children composite calling setRangeForColor. This method is overwritten in RGBDisplayable to actually setRangeForColor.

There is a fundamental problem with the Composite pattern (of which the Displayable class serves as the abstract root class) in that you want to have the Composite class (e.g., CompositeDisplayable) to be able to have methods which are recursively applied to its children. However, not all methods are shared by all potential children classes. There is a tension between having methods defined for objects that make sense and having the utility of applying methods to a group of objects through the composite.

With these no-op methods here (e.g., setColorPalette, setColor, setPointSize) we leaned towards utility vs. method signature correctness.

Of course, one way around this is to have a general setProperty (propertyName, value) method which is used.

Parameters:
low - The minimum value of the range for the color.
hi - The maximum value of the range for the color.
Throws:
VisADException - if a VisADFailure occurs.
RemoteException - if a Java RMI failure occurs.

setRangeForColor

public void setRangeForColor(Range r)
                      throws VisADException,
                             RemoteException
Just a wrapper around the other setRangeForColor(double, double)

Parameters:
r - The range for the color.
Throws:
VisADException - if a VisADFailure occurs.
RemoteException - if a Java RMI failure occurs.

setSelectedRange

public void setSelectedRange(Range r)
                      throws VisADException,
                             RemoteException
Just a wrapper around the other setSelectedRange(double, double)

Parameters:
r - The range for the color.
Throws:
VisADException - if a VisADFailure occurs.
RemoteException - if a Java RMI failure occurs.

setSelectedRange

public void setSelectedRange(double low,
                             double hi)
                      throws VisADException,
                             RemoteException
A no-op method so we can have a consistent api with the composite pattern. This method is overwritten in CompositeDisplayable

Parameters:
low - The minimum value of the selected range
hi - The maximum value of the selected range
Throws:
VisADException - if a VisADFailure occurs.
RemoteException - if a Java RMI failure occurs.

setColorPalette

public void setColorPalette(float[][] c)
                     throws RemoteException,
                            VisADException
A no-op method so we can have a consistent api with the composite pattern. This method is overwritten in CompositeDisplayable, which iterates through its children composite calling setColorPalette.

Parameters:
c - color palette
Throws:
RemoteException - Java RMI failure.
VisADException - VisAD failure.

setContourInfo

public void setContourInfo(ContourInfo contourInfo)
                    throws VisADException,
                           RemoteException
A no-op method for setting contour information

Parameters:
contourInfo - Contains contour and labeling information
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

setColorPalette

public void setColorPalette(ColorTable colorTable)
                     throws RemoteException,
                            VisADException
A wrapper method calling setColorPalette (float[][] c)

Parameters:
colorTable - ColorTable that defines the palette
Throws:
RemoteException - Java RMI failure.
VisADException - VisAD failure.

setColor

public void setColor(Color c)
              throws RemoteException,
                     VisADException
A no-op method so we can have a consistent api with the composite pattern. This method is overwritten in CompositeDisplayable, which iterates through its children composite calling setColor. This method is overwritten in LineDrawing.

Parameters:
c - the Color
Throws:
RemoteException - Java RMI failure.
VisADException - VisAD failure.

setPointSize

public void setPointSize(float size)
                  throws RemoteException,
                         VisADException
A no-op method so we can have a consistent api with the composite pattern. This method is overwritten in CompositeDisplayable, which iterates through its children composite calling setColor. This method is overwritten in LineDrawing.

Parameters:
size - point size
Throws:
RemoteException - Java RMI failure.
VisADException - VisAD failure.

setLineWidth

public void setLineWidth(float size)
                  throws RemoteException,
                         VisADException
A no-op method so we can have a consistent api with the composite pattern. This method is overwritten in CompositeDisplayable, which iterates through its children composite calling setColor. This method is overwritten in LineDrawing.

Parameters:
size - line width size (pixels)
Throws:
RemoteException - Java RMI failure.
VisADException - VisAD failure.

setVisible

public void setVisible(boolean visible)
                throws RemoteException,
                       VisADException
Sets the visibility property.

Parameters:
visible - Whether or not this instance should be displayed.
Throws:
RemoteException - Java RMI failure.
VisADException - VisAD failure.

setManipulable

public void setManipulable(boolean manipulable)
                    throws VisADException,
                           RemoteException
Sets the manipulable value of this Displayable. This is a no-op and is here for the CompositeDisplayable

Parameters:
manipulable - value
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

getVisible

public boolean getVisible()
Gets the visibility property.

Returns:
Whether or not this instance is visible.

isVisible

public boolean isVisible()
Returns the visibility property.

Returns:
Whether or not this instance should be displayed.

addDataReferences

public final void addDataReferences()
                             throws DisplayException,
                                    VisADException,
                                    RemoteException
Requests that this instance's DataReferences be added to the associated VisAD display as soon as feasible. This might or might not happen during the invocation of this method (a DataReference might not be added if, for example, it contains no data). Invoking this method will cause all subsequent addRefsInvoked() invocations to return true until removeDataReferences() is invoked. This method is idempotent: it may be invoked multiple times.

Throws:
DisplayException - if setDisplay(LocalDisplay) has not been invoked.
VisADException - if a VisAD failure occurs.
RemoteException - if a Java RMI failure occurs.

removeDataReferences

public final void removeDataReferences()
                                throws DisplayException,
                                       VisADException,
                                       RemoteException
Removes this instance's data references from the associated VisAD display. Invoking this method will cause all subsequent addRefsInvoked() invocations to return false until addDataReferences() is invoked. This method is idempotent: it may be invoked multiple times.

Throws:
DisplayException - if setDisplay(LocalDisplay) hasn't been invoked.
VisADException - VisAD failure.
RemoteException - Java RMI failure.

myAddDataReferences

protected abstract void myAddDataReferences()
                                     throws VisADException,
                                            RemoteException
Adds this instance's data references to the associated VisAD display if possible. This method does not verify that the VisAD display has been set. This method is idempotent.

Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

myRemoveDataReferences

protected abstract void myRemoveDataReferences()
                                        throws VisADException,
                                               RemoteException
Removes this instance's data references from the associated VisAD display. This method does not verify that the VisAD display has been set. This method is idempotent.

Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

myAddConstantMaps

protected void myAddConstantMaps(ConstantMap[] newMaps)
                          throws VisADException,
                                 RemoteException
Adds this instance's data references to the associated VisAD display if possible. This method does not verify that the VisAD display has been set. This method is idempotent.

Parameters:
newMaps - new maps
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

destroyDisplayable

public void destroyDisplayable()
                        throws RemoteException,
                               VisADException
Destroy this instance

Throws:
RemoteException - Java RMI Exception
VisADException - VisAD Exception

getDestroyed

public boolean getDestroyed()
Are we destroyed?

Returns:
true if we are

destroy

protected void destroy()
                throws RemoteException,
                       VisADException
Called when the displayable is removed from a display master

Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

setScalarMapSet

public void setScalarMapSet(ScalarMapSet maps)
Sets the set of ScalarMap-s of this instance. This method invokes fireScalarMapSetChange(). Intermediate subclasses that have their own ScalarMap-s should override this method and invoke super.setScalarMaps(ScalarMapSet).

Parameters:
maps - The set of ScalarMap-s to be added.
See Also:
fireScalarMapSetChange()

hasDataObject

public boolean hasDataObject()

Indicates whether or not this Displayable adapts a single, VisAD data object.

This implementation always returns false.

Returns:
True if and only if this instance adapts a single, VisAD data object.

getData

public Data getData()
             throws VisADException,
                    RemoteException

Returns the single, VisAD data object adapted by this Displayable, if one exists. null will be returned if this instance adapts such an object but the object is unset, or if this instance is not capable of adapting a single, VisAD data object. To distinguish these cases, use hasDataObject().

This implementation always returns null.

Returns:
The single, adapted, VisAD data object if one exists. Not a copy. May be null.
Throws:
VisADException - if a VisAD failure occurs.
RemoteException - if a Java RMI failure occurs.
See Also:
hasDataObject()

addScalarMaps

protected void addScalarMaps(ScalarMapSet maps)
                      throws BadMappingException
Adds a set of ScalarMap-s to this instance's set of ScalarMap-s. This method invokes fireScalarMapSetChange().

Parameters:
maps - The set of ScalarMap-s to be added.
Throws:
BadMappingException - Duplicate ScalarMap.
See Also:
fireScalarMapSetChange()

addScalarMap

protected void addScalarMap(ScalarMap map)
                     throws BadMappingException
Adds a ScalarMap to this instance's set of ScalarMap-s. After a series of invocations of this method, concrete subclass should invoke fireScalarMapSetChange().

Parameters:
map - The ScalarMap to be added.
Throws:
BadMappingException - Duplicate ScalarMap.
See Also:
fireScalarMapSetChange()

getScalarMap

protected ScalarMap getScalarMap(ScalarMap template)
Returns the ScalarMap in this instance's set of ScalarMaps that matches a template or null if no such ScalarMap is found.

Parameters:
template - The template.
Returns:
The matching ScalarMap or null.

removeScalarMap

protected void removeScalarMap(ScalarMap map)
Removes a ScalarMap from this instance's set of ScalarMap-s. After a series of invocations of this method, concrete subclass should invoke fireScalarMapSetChange().

Parameters:
map - The ScalarMap to be removed.
See Also:
fireScalarMapSetChange()

replaceScalarMap

protected void replaceScalarMap(ScalarMap oldMap,
                                ScalarMap newMap)
                         throws BadMappingException
Replaces a ScalarMap in this instance's set of ScalarMap-s. After a series of invocations of this method, concrete subclass should invoke fireScalarMapSetChange().

Parameters:
oldMap - The old ScalarMap to be removed. May be null.
newMap - The new ScalarMap to be added.
Throws:
BadMappingException - Duplicate ScalarMap.
See Also:
fireScalarMapSetChange()

getScalarMap

protected static ScalarMap getScalarMap(LocalDisplay display,
                                        ScalarType scalarType,
                                        DisplayRealType displayRealType)
                                 throws VisADException,
                                        RemoteException
Finds the ScalarMap of a VisAD display that has the given ScalarType and DisplayRealType.

Parameters:
display - The VisAD display.
scalarType - The ScalarType to match.
displayRealType - The DisplayRealType to match.
Returns:
The matching ScalarMap of the display. Will be null if no matching ScalarMap was found.
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

getScalarMap

protected static ScalarMap getScalarMap(LocalDisplay display,
                                        ScalarMap template)
                                 throws VisADException,
                                        RemoteException
Finds the ScalarMap of a VisAD display that matches a given ScalarMap in the sense that it has the same ScalarType and DisplayRealType.

Parameters:
display - The VisAD display.
template - The ScalarMap to match.
Returns:
The matching ScalarMap of the display. Will be null if no matching ScalarMap was found.
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

firePropertyChange

protected void firePropertyChange(PropertyChangeEvent event)
Calls firePropertyChangeEventInThread so we break up potential deadlocks

Parameters:
event - The PropertyChangeEvent.

firePropertyChange

protected void firePropertyChange(String propertyName,
                                  Object oldValue,
                                  Object newValue)
Fires a PropertyChangeEvent.

Parameters:
propertyName - The name of the property.
oldValue - The old value of the property.
newValue - The new value of the property.

getConstantMaps

public ConstantMap[] getConstantMaps()
Returns copies of the ConstantMap-s of this instance.

Returns:
The ConstantMap-s of this instance.

cloneForDisplay

public abstract Displayable cloneForDisplay()
                                     throws RemoteException,
                                            VisADException
Returns a clone of this instance suitable for another VisAD display. Underlying data objects are not cloned.

Returns:
A semi-deep clone of this instance.
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

combineConstantMaps

protected ConstantMap[] combineConstantMaps(ConstantMapSet maps)
Combines this instance's ConstantMap-s with another set of ConstantMap-s and returns a copy of the set.

Parameters:
maps - The set of ConstantMap-s to be combined with the ConstantMap-s of this instance.
Returns:
The union of ConstantMap-s.

fireScalarMapSetChange

protected void fireScalarMapSetChange()
Fires a PropertyChangeEvent for the SCALAR_MAP_SET property with the value of the SCALAR_MAP_SET at the time of the last firing as the old value. This method should be invoked by concrete subclasses after a sequence of changes to this instance's set of ScalarMap-s.

See Also:
addScalarMaps(ScalarMapSet), addScalarMap(ScalarMap), removeScalarMap(ScalarMap), replaceScalarMap(ScalarMap oldMap, ScalarMap newMap)

logException

public void logException(String msg,
                         Exception exc)
A wrapper around LogUtil.logException

Parameters:
msg - message for the exception
exc - exception that is being logged

setDisplayUnit

public void setDisplayUnit(Unit unit)
                    throws RemoteException,
                           VisADException
Sets the unit for use by the VisAD display subsystem.

Parameters:
unit - The display unit to use.
Throws:
RemoteException - Java RMI failure.
VisADException - VisAD failure.

getDisplayUnit

public Unit getDisplayUnit()
                    throws RemoteException,
                           VisADException
Returns the unit that is being used by the VisAD display subsystem for rendering this instance or null if no such unit exists.

Returns:
The display unit or null.
Throws:
RemoteException - Java RMI failure.
VisADException - VisAD failure.

setColorUnit

public void setColorUnit(Unit unit)
                  throws RemoteException,
                         VisADException
A hook to allow sub-classes to set their color unit.

Parameters:
unit - The color unit or null
Throws:
RemoteException - Java RMI failure.
VisADException - VisAD failure.

getColorUnit

public Unit getColorUnit()
                  throws RemoteException,
                         VisADException
Return the color Unit.

Returns:
color unit
Throws:
RemoteException - Java RMI failure.
VisADException - VisAD failure.

setAdjustFlow

public void setAdjustFlow(boolean adjust)
                   throws RemoteException,
                          VisADException
A no-op method so we can have a consistent api with the composite pattern. This method is overwritten in CompositeDisplayable, which iterates through its children composite calling setColorPalette. Set whether flow should be adjusted to earth coordinates

Parameters:
adjust - true to adjust
Throws:
RemoteException - Java RMI failure.
VisADException - VisAD failure.

isUnitCompatible

protected boolean isUnitCompatible(RealType realType,
                                   Unit unit)
Is the given unit compatible (i.e., is either null or can convert to the defaultUnit) with the the given real type.

Parameters:
realType - RealType to check
unit - Unit in question
Returns:
true if the unit is compatible with the RealType

checkUnit

protected void checkUnit(RealType realType,
                         Unit unit)
                  throws VisADException,
                         RemoteException
Check if the given unit is compatible with the unit of the given realtype. If not throw a VisADException.

Parameters:
realType - RealType to check
unit - Unit in question
Throws:
RemoteException - Java RMI failure.
VisADException - VisAD failure.

applyDisplayUnit

protected void applyDisplayUnit(ScalarMap map,
                                RealType realType)
                         throws VisADException,
                                RemoteException
If the displayUnit is not compatible with the unit of the given RealType then clear the displayUnit and set the override unit of the given ScalarMap to the default Unit of the realType. Else set the override unit of the ScalarMap to the displayUnit.

Parameters:
map - ScalarMap to modify
realType - RealType of default unit
Throws:
RemoteException - Java RMI failure.
VisADException - VisAD failure.

applyColorUnit

protected void applyColorUnit(ScalarMap map,
                              RealType realType)
                       throws VisADException,
                              RemoteException
If the colorUnit is not compatible with the unit of the given real type then clear the colorUnit and set the override unit of the given ScalarMap to the default Unit of the realType. Else set the override unit of the ScalarMap to the colorUnit.

Parameters:
map - ScalarMap to change
realType - RealType for default unit
Throws:
RemoteException - Java RMI failure.
VisADException - VisAD failure.

getAnimationSet

public Set getAnimationSet(RealType aniType,
                           boolean force)
                    throws VisADException,
                           RemoteException

Returns the set of values for the given aniType if the contained Data objects adapted by this Displayable have any data of that type. null will be returned if this instance adapts such an object but the object is unset, or if this instance does not support this type.

Parameters:
aniType - The type used for animation
force - force the calculation
Returns:
The set of times from all data May be null.
Throws:
VisADException - if a VisAD failure occurs.
RemoteException - if a Java RMI failure occurs.
See Also:
hasDataObject()

setOverrideAnimationSet

public void setOverrideAnimationSet(Set set)
Set an alternate animation set

Parameters:
set - the set

setOverrideAnimationSet

public void setOverrideAnimationSet(List times)
                             throws RemoteException,
                                    VisADException
Set the animation set with a list of DateTimes

Parameters:
times - the times
Throws:
RemoteException - Java RMI Exception
VisADException - VisAD Exception

setUseTimesInAnimation

public void setUseTimesInAnimation(boolean value)
                            throws RemoteException,
                                   VisADException
Set the UseTimesInAnimation property.

Parameters:
value - The new value for UseTimesInAnimation
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

getUseTimesInAnimation

public boolean getUseTimesInAnimation()
Get the UseTimesInAnimation property.

Returns:
The UseTimesInAnimation