ucar.visad.display
Class DisplayMaster

java.lang.Object
  extended by ucar.visad.display.DisplayMaster
Direct Known Subclasses:
AerologicalDisplay, NavigatedDisplay, WindProfileDisplay, XYDisplay

public abstract class DisplayMaster
extends Object

Manages a VisAD DisplayImpl and a list of Displayables.

Instances of this class have the following bound properties:

Name Type Access Default Description
pointMode boolean set/is false Whether or not the VisAD display associated with this instance displays 1-D manifold data as points or lines.

Version:
$Revision: 1.132 $
Author:
Steven R. Emmerson

Field Summary
protected  KeyboardBehavior behavior
          The keyboard behavior
static int[][][] defaultMouseFunctions
          The default mouse function map
static LogUtil.LogCategory log_
          Use this member to log messages (through calls to LogUtil)
static String POINT_MODE
          The name of the "point mode" property.
 
Constructor Summary
DisplayMaster()
          Parameterless ctor.
DisplayMaster(DisplayImpl display)
          Constructs from a Display.
DisplayMaster(DisplayImpl display, int initialCapacity)
          Constructs from a VisAD display and an anticipated number of Displayables.
 
Method Summary
 void addDisplayable(Displayable displayable)
          Adds a Displayable to the Displayable-s managed by this instance.
 void addDisplayListener(DisplayListener listener)
          Adds a VisAD DisplayListener to this instance's Display.
 void addKeyboardBehavior(KeyboardBehavior behavior)
          Adds a KeyboardBehavior to the display that this DisplayMaster manages.
 void addPropertyChangeListener(PropertyChangeListener listener)
          Adds a PropertyChangeListener.
 void addPropertyChangeListener(String name, PropertyChangeListener listener)
          Adds a named PropertyChangeListener.
protected  void addScalarMap(ScalarMap map)
          Adds a ScalarMap to this instance.
protected  void addScalarMaps(ScalarMapSet mapSet)
          Adds ScalarMaps to this instance.
 void addVetoableChangeListener(String name, VetoableChangeListener listener)
          Adds a named VetoableChangeListener.
 void addVetoableChangeListener(VetoableChangeListener listener)
          Adds a VetoableChangeListener.
protected  Set buildAnimationSet()
          Build the animation set
protected  void dataChange()
          Handles a change to the data in the displayables.
 void destroy()
          Destroys this instance, releasing any resources.
 void draw()
          Causes the Displayable-s managed by this instance to be rendered to the VisAD display.
 boolean ensureInactive()
          Deprecated. This will become private in the future. You should use setDisplayInactive() and setDisplayActive()
 boolean equals(Object obj)
          Indicates if this instance if semantically identical to another object.
protected  void finalize()
          Finalizes this instance.
protected  void firePropertyChange(PropertyChangeEvent event)
          Fires a PropertyChangeEvent.
protected  void firePropertyChange(String propertyName, Object oldValue, Object newValue)
          Fires a PropertyChangeEvent.
protected  Set getAnimationSetFromDisplayables()
          Collect the animation set that is the union of all data
 boolean getAnimationStringVisible()
          Return whether the animation string is visible or not
 Color getBackground()
          Returns the background color being used
 Component getComponent()
          Gets the associated AWT Component.
 LocalDisplay getDisplay()
          Returns the associated VisAD display.
 int getDisplayableCount()
          Returns the number of Displayable-s.
 Displayable[] getDisplayables()
          Returns the Displayables of this instance as an array.
 Displayable getDisplayables(int index)
          Returns the Displayable at a given position in the list of Displayables.
 double[] getDisplayAspect()
          Gets the current display aspect.
 Component getDisplayComponent()
          Returns the component of the display.
 Color getForeground()
          Returns the foreground color being used for the cursor and box
 BufferedImage getImage(boolean doSync)
          Get a buffered image of the Display
protected  MouseBehavior getMouseBehavior()
          Get the current mouse behavior
protected  Dimension getOffscreenDimension()
          Get the off screen dimension
 double[] getProjectionMatrix()
          Gets the current display projection.
 double[] getSavedProjectionMatrix()
          Returns the saved projection Matrix.
 Rectangle getScreenBounds()
          Helper to get the screen bounds
 boolean getStereoAvailable()
          Determine if this MapDisplay can do stereo.
 boolean getWaitMessageVisible()
          Get the state of the "Please wait.." string visibility.
protected  void handleMouseWheelMoved(MouseWheelEvent e)
          Handle when the mouse scroll wheel has been moved
 int hashCode()
          Gets the hash-code of this instance.
 int indexOf(Displayable displayable)
          Returns the index of a particular Displayable.
 void init(DisplayImpl display, int initialCapacity)
          Initialize this display master
protected  boolean is3D()
          Are we in 3D.
 boolean isActive()
          Indicates if this instance is active (i.e will immediately rebuild the display when appropriate).
 boolean isPointMode()
          Gets the point-mode of the VisAD display.
 void printMatrix(String name, double[] matrix)
          Print out the matrix.
 void printMe()
          Print out a message
protected  void rebuild()
          Rebuild the display when needed.
 void rebuildDisplay()
          Rebuilds the display if appropriate.
protected  void reDisplayAll()
          Tells the Display to retransform all data objects.
 boolean removeDisplayable(Displayable displayable)
          Removes a Displayable from this instance.
 void removeDisplayables()
          Removes all Displayables from this instance.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Removes a PropertyChangeListener.
 void removePropertyChangeListener(String name, PropertyChangeListener listener)
          Removes a named PropertyChangeListener.
protected  boolean removeScalarMap(ScalarMap map)
          Removes a ScalarMap from this instance.
protected  void removeScalarMaps(ScalarMapSet mapSet)
          Removes given ScalarMaps from this instance.
 void removeVetoableChangeListener(String name, VetoableChangeListener listener)
          Removes a named VetoableChangeListener.
 void removeVetoableChangeListener(VetoableChangeListener listener)
          Removes a VetoableChangeListener.
protected  void replaceScalarMap(ScalarMap oldMap, ScalarMap newMap)
          Replaces a ScalarMap in this instance.
 void reScale()
          Autoscale the axes of the display that have not had a range set on them.
 void resetMouseFunctions()
          Reset the mouse functions to the default.
 void resetProjection()
          Restores to projection at time of last saveProjection() call -- if one was made -- or to initial projection otherwise.
 void rotate(double anglex, double angley, double anglez)
          rotate some angle
 void rotateX(double angle)
          rotate some angle
 void rotateY(double angle)
          rotate some angle
 void rotateZ(double angle)
          rotate some angle
 void saveCurrentDisplay(File toFile)
          Capture the display's current image and save it to a file as an image (e.g., JPEG, png).
 void saveCurrentDisplay(File toFile, boolean doSync, boolean block)
          Capture the display's current image and save it to a file as an image (eg, JPEG, png).
 void saveCurrentDisplay(File toFile, boolean doSync, boolean block, float quality)
          Capture the display's current image and save it to a file as an image (eg, JPEG, png).
 void saveProjection()
          Saves the current display projection.
 void setActive(boolean newActiveValue)
          Deprecated. This will become private in the future. You should use setDisplayInactive() and setDisplayActive()
 void setAnimation(Animation animation, AnimationWidget animationWidget)
          Set the Animation for this DisplayMaster
 void setAnimationStringVisible(boolean visible)
          Toggle the animation string visibility.
 void setBackground(Color color)
          Sets the background color of this VisAD display.
static void setDefaultMouseFunctions(DisplayImpl display)
          A general utility method that sets the default mouse functions on the given display.
 void setDisplayables(Displayable[] displayables)
          Sets the Displayables managed by this instance.
 void setDisplayables(int index, Displayable displayable)
          Sets the Displayable managed by this instance at a given point in the list of Displayable-s.
 void setDisplayActive()
          Activate the display if there is one or fewer pending inactive calls
 void setDisplayAspect(double[] newAspect)
          Sets the display aspect ratio.
 void setDisplayInactive()
          Sets this instance inactive (ie: that it will not automatically rebuild the display when appropriate).
 void setEyePosition(double position)
          Set the eye position of each eye for a stereo view.
 void setForeground(Color color)
          Sets the "foreground" color of this VisAD display
protected  void setKeyboardBehavior(KeyboardBehavior behavior)
          Set the keyboard behavior to use
 void setKeyboardEventMap(int[][] map)
          Set the key to function map on the current keyboard behavior
static void setKeyboardEventMap(int[][] map, KeyboardBehavior behavior)
          Set the key to function map on the given behavior
 void setMouseFunctions(int[][][] map)
          Set the mouse functions for this display.
protected  void setOffscreenDimension(Dimension dim)
          For offscreen rendering
 void setPointMode(boolean usePoints)
          Sets the point-mode of the VisAD display.
 void setProjectionMatrix(double[] newMatrix)
          Sets the current display projection.
 void setRebuildNecessary()
          Deprecated.  
 void setWaitMessageVisible(boolean visible)
          Toggle the "Please wait.." string visibility.
 void setWheelEventMap(int[][] map)
          Set the mapping between mouse wheel event and function
 void translate(double xFactor, double yFactor)
          Translate (X,Y position) of the display
 void zoom(double factor)
          Zoom in on the display
 void zoom(double xfactor, double yfactor, double zfactor)
          Zoom in on the display
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log_

public static LogUtil.LogCategory log_
Use this member to log messages (through calls to LogUtil)


POINT_MODE

public static String POINT_MODE
The name of the "point mode" property.


behavior

protected KeyboardBehavior behavior
The keyboard behavior


defaultMouseFunctions

public static final int[][][] defaultMouseFunctions
The default mouse function map

Constructor Detail

DisplayMaster

public DisplayMaster(DisplayImpl display)
              throws VisADException,
                     RemoteException
Constructs from a Display.

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

DisplayMaster

public DisplayMaster()
Parameterless ctor. Note: If you instantiate a DisplayMaster through this constructor you must also call the init method.


DisplayMaster

public DisplayMaster(DisplayImpl display,
                     int initialCapacity)
              throws VisADException,
                     RemoteException
Constructs from a VisAD display and an anticipated number of Displayables.

Parameters:
display - The VisAD display.
initialCapacity - The anticipated number of Displayable-s.
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.
Method Detail

setWheelEventMap

public void setWheelEventMap(int[][] map)
Set the mapping between mouse wheel event and function

Parameters:
map - The mapping

setOffscreenDimension

protected void setOffscreenDimension(Dimension dim)
For offscreen rendering

Parameters:
dim - The screen dimension

getOffscreenDimension

protected Dimension getOffscreenDimension()
Get the off screen dimension

Returns:
off screen dimension

getDisplayComponent

public Component getDisplayComponent()
Returns the component of the display. If in offscreen mode returns the offscreenComponent

Returns:
Display component

getScreenBounds

public Rectangle getScreenBounds()
Helper to get the screen bounds

Returns:
Bounds

init

public void init(DisplayImpl display,
                 int initialCapacity)
          throws VisADException,
                 RemoteException
Initialize this display master

Parameters:
display - The display
initialCapacity - Initial capacity of the displayables list
Throws:
RemoteException - On badness
VisADException - On badness

destroy

public void destroy()
Destroys this instance, releasing any resources. This method should be invoked when this instance is no longer needed. The client should not try to use this instance after invoking this method. Subclasses that override this method should invoke super.destroy().


finalize

protected void finalize()
                 throws Throwable
Finalizes this instance.

Overrides:
finalize in class Object
Throws:
Throwable - if an error occurs during finalization.

getComponent

public Component getComponent()
Gets the associated AWT Component.

Returns:
The associated AWT Component.

reDisplayAll

protected void reDisplayAll()
Tells the Display to retransform all data objects.


reScale

public void reScale()
Autoscale the axes of the display that have not had a range set on them.


rebuildDisplay

public void rebuildDisplay()
                    throws VisADException,
                           RemoteException
Rebuilds the display if appropriate. If this instance is active and the display has been marked for a future rebuild, then the display is rebuilt.

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

rebuild

protected void rebuild()
                throws VisADException,
                       RemoteException
Rebuild the display when needed.

Throws:
RemoteException - Java RMI error
VisADException - problem creating VisAD object

setAnimation

public void setAnimation(Animation animation,
                         AnimationWidget animationWidget)
                  throws VisADException,
                         RemoteException
Set the Animation for this DisplayMaster

Parameters:
animation - Animation object
animationWidget - the associated widget
Throws:
RemoteException - Java RMI error
VisADException - problem creating VisAD object

getDisplay

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

Returns:
The VisAD display.

getDisplayableCount

public final int getDisplayableCount()
Returns the number of Displayable-s.

Returns:
The number of Displayable-s.

addDisplayable

public final void addDisplayable(Displayable displayable)
                          throws RemoteException,
                                 VisADException
Adds a Displayable to the Displayable-s managed by this instance.

Parameters:
displayable - The Displayable to be added.
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

setDisplayables

public final void setDisplayables(int index,
                                  Displayable displayable)
                           throws VisADException,
                                  RemoteException
Sets the Displayable managed by this instance at a given point in the list of Displayable-s.

Parameters:
index - The position in the list of Displayable-s.
displayable - The Displayable to be in the given position.
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

setDisplayables

public final void setDisplayables(Displayable[] displayables)
                           throws VisADException,
                                  RemoteException
Sets the Displayables managed by this instance.

Parameters:
displayables - The Displayable-s to be managed by this instance.
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

removeDisplayable

public boolean removeDisplayable(Displayable displayable)
                          throws VisADException,
                                 RemoteException
Removes a Displayable from this instance. Invokes the Displayable's removeDataReferences() method if and only if the Displayable is in this instance's list of Displayable-s. NOTE: If the Displayable is in this instance's list of Displayable-s, then this instance must be active or be made active before the Displayable is can be successfully added to another display. The display might be rebuilt or marked for a rebuild.

Parameters:
displayable - The Displayable to be removed.
Returns:
true if and only if the Displayable was in this instance's list of Displayable-s.
Throws:
VisADException - if an error occurs in core VisAD
RemoteException - if a Java RMI failure occurs.
See Also:
Displayable.removeDataReferences()

removeDisplayables

public void removeDisplayables()
                        throws VisADException,
                               RemoteException
Removes all Displayables from this instance.

Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.
See Also:
removeDisplayable(ucar.visad.display.Displayable)

setBackground

public void setBackground(Color color)
Sets the background color of this VisAD display.

Parameters:
color - a Java Color to become the background color.

getBackground

public Color getBackground()
Returns the background color being used

Returns:
color being used or null if it couldn't be determined

getForeground

public Color getForeground()
Returns the foreground color being used for the cursor and box

Returns:
color being used or null if it couldn't be determined

setForeground

public void setForeground(Color color)
Sets the "foreground" color of this VisAD display

Parameters:
color - color to use

getDisplayables

public final Displayable getDisplayables(int index)
Returns the Displayable at a given position in the list of Displayables.

Parameters:
index - The position in the list to get the Displayable.
Returns:
The Displayable at the given position.

getDisplayables

public final Displayable[] getDisplayables()
Returns the Displayables of this instance as an array.

Returns:
The array of Displayable-s.

indexOf

public int indexOf(Displayable displayable)
Returns the index of a particular Displayable.

Parameters:
displayable - The Displayable to look for.
Returns:
The index of the Displayable in this composite or -1 if this CompositeDisplayable does not contain this Displayable.

setPointMode

public void setPointMode(boolean usePoints)
                  throws VisADException,
                         RemoteException
Sets the point-mode of the VisAD display.

Parameters:
usePoints - True if the display should use points rather than connected line segments.
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

isPointMode

public boolean isPointMode()
Gets the point-mode of the VisAD display.

Returns:
True if the display is using points rather than connected line segments.

saveProjection

public void saveProjection()
Saves the current display projection. The projection may later be restored by the method resetProjection().

See Also:
resetProjection()

setDisplayAspect

public void setDisplayAspect(double[] newAspect)
                      throws VisADException,
                             RemoteException
Sets the display aspect ratio. The argument is passed unaltered to ProjectionControl.setAspect(double[]).

Parameters:
newAspect - The new aspect ratio.
Throws:
VisADException - if a VisAD failure occurs.
RemoteException - if a Java RMI failure occurs.

is3D

protected boolean is3D()
Are we in 3D. This is rudimentary and just checks the type of the display

Returns:
is the display 3D

getDisplayAspect

public double[] getDisplayAspect()
Gets the current display aspect.

Returns:
The current display aspect ratio.

getProjectionMatrix

public double[] getProjectionMatrix()
Gets the current display projection. The object returned from ProjectionControl.getMatrix() is returned.

Returns:
The current display projection.

setProjectionMatrix

public void setProjectionMatrix(double[] newMatrix)
                         throws VisADException,
                                RemoteException
Sets the current display projection. The argument is passed, unaltered, to ProjectionControl.setMatrix(double[]).

Parameters:
newMatrix - The new projection matrix.
Throws:
VisADException - if a VisAD failure occurs.
RemoteException - if a Java RMI failure occurs.

getSavedProjectionMatrix

public double[] getSavedProjectionMatrix()
Returns the saved projection Matrix. The object returned from ProjectionControl.getSavedProjectionMatrix() is returned.

Returns:
The saved projection matrix.

resetProjection

public void resetProjection()
                     throws VisADException,
                            RemoteException
Restores to projection at time of last saveProjection() call -- if one was made -- or to initial projection otherwise.

Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.
See Also:
saveProjection()

addKeyboardBehavior

public void addKeyboardBehavior(KeyboardBehavior behavior)

Adds a KeyboardBehavior to the display that this DisplayMaster manages.

This implementation does nothing but check to see if this instance has been destroyed.

Parameters:
behavior - The keyboard behavior to be added.

setKeyboardBehavior

protected void setKeyboardBehavior(KeyboardBehavior behavior)
Set the keyboard behavior to use

Parameters:
behavior - the keyboard behavior

setKeyboardEventMap

public void setKeyboardEventMap(int[][] map)
Set the key to function map on the current keyboard behavior

Parameters:
map - the map

setKeyboardEventMap

public static void setKeyboardEventMap(int[][] map,
                                       KeyboardBehavior behavior)
Set the key to function map on the given behavior

Parameters:
map - the map
behavior - behavior to set

setMouseFunctions

public void setMouseFunctions(int[][][] map)
                       throws VisADException
Set the mouse functions for this display.

Parameters:
map - array of mouse functions to buttons
Throws:
VisADException
See Also:
for info.

getMouseBehavior

protected MouseBehavior getMouseBehavior()
Get the current mouse behavior

Returns:
mouse behavior

rotateX

public void rotateX(double angle)
rotate some angle

Parameters:
angle - rotate angle

rotateY

public void rotateY(double angle)
rotate some angle

Parameters:
angle - rotate angle

rotateZ

public void rotateZ(double angle)
rotate some angle

Parameters:
angle - rotate angle

handleMouseWheelMoved

protected void handleMouseWheelMoved(MouseWheelEvent e)
Handle when the mouse scroll wheel has been moved

Parameters:
e - event

zoom

public void zoom(double factor)
Zoom in on the display

Parameters:
factor - zoom factor ( > 1 = zoom in, 1 > zoom > 0 = zoom out). using 2.0 and .5 seems to work well.

zoom

public void zoom(double xfactor,
                 double yfactor,
                 double zfactor)
Zoom in on the display

Parameters:
xfactor - x zoom factor
yfactor - y zoom factor
zfactor - z zoom factor ( > 1 = zoom in, 1 > zoom > 0 = zoom out). using 2.0 and .5 seems to work well.

translate

public void translate(double xFactor,
                      double yFactor)
Translate (X,Y position) of the display

Parameters:
xFactor - X translation factor
yFactor - Y translation factor

rotate

public void rotate(double anglex,
                   double angley,
                   double anglez)
rotate some angle

Parameters:
anglex - rotate angle
angley - rotate angle
anglez - rotate angle

resetMouseFunctions

public void resetMouseFunctions()
                         throws VisADException
Reset the mouse functions to the default.

Throws:
VisADException

setDefaultMouseFunctions

public static void setDefaultMouseFunctions(DisplayImpl display)
                                     throws VisADException
A general utility method that sets the default mouse functions on the given display.

Parameters:
display - Display to set functions for
Throws:
VisADException

setWaitMessageVisible

public void setWaitMessageVisible(boolean visible)
Toggle the "Please wait.." string visibility.

Parameters:
visible - true to make it visible

getWaitMessageVisible

public boolean getWaitMessageVisible()
Get the state of the "Please wait.." string visibility.

Returns:
true if visible

setAnimationStringVisible

public void setAnimationStringVisible(boolean visible)
Toggle the animation string visibility.

Parameters:
visible - true to make it visible

getAnimationStringVisible

public boolean getAnimationStringVisible()
Return whether the animation string is visible or not

Returns:
true if visible

getStereoAvailable

public boolean getStereoAvailable()
Determine if this MapDisplay can do stereo. Subclasses that support this should override this method

Returns:
false (unless overriden)

setEyePosition

public void setEyePosition(double position)
Set the eye position of each eye for a stereo view. Subclasses that support this should override this method

Parameters:
position - x position of each eye (left negative, right positive).

addVetoableChangeListener

public void addVetoableChangeListener(VetoableChangeListener listener)
Adds a VetoableChangeListener.

Parameters:
listener - The VetoableChangeListener to add.

addVetoableChangeListener

public void addVetoableChangeListener(String name,
                                      VetoableChangeListener listener)
Adds a named VetoableChangeListener.

Parameters:
name - The name of the property.
listener - The VetoableChangeListener to add.

removeVetoableChangeListener

public void removeVetoableChangeListener(VetoableChangeListener listener)
Removes a VetoableChangeListener.

Parameters:
listener - The VetoableChangeListener to be removed.

removeVetoableChangeListener

public void removeVetoableChangeListener(String name,
                                         VetoableChangeListener listener)
Removes a named VetoableChangeListener.

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

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener.

Parameters:
listener - The PropertyChangeListener to add.

addPropertyChangeListener

public void addPropertyChangeListener(String name,
                                      PropertyChangeListener listener)
Adds a named PropertyChangeListener.

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

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Removes a PropertyChangeListener.

Parameters:
listener - The PropertyChangeListener to be removed.

removePropertyChangeListener

public void removePropertyChangeListener(String name,
                                         PropertyChangeListener listener)
Removes a named PropertyChangeListener.

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

draw

public void draw()
          throws VisADException,
                 RemoteException
Causes the Displayable-s managed by this instance to be rendered to the VisAD display.

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

equals

public boolean equals(Object obj)
Indicates if this instance if semantically identical to another object.

Overrides:
equals in class Object
Parameters:
obj - The other object.
Returns:
true if and only if this instance is semantically identical to obj.

hashCode

public int hashCode()
Gets the hash-code of this instance.

Overrides:
hashCode in class Object
Returns:
The hash-code of this instance.

addDisplayListener

public void addDisplayListener(DisplayListener listener)
Adds a VisAD DisplayListener to this instance's Display.

Parameters:
listener - The VisAD DisplayListener to be added.

firePropertyChange

protected void firePropertyChange(PropertyChangeEvent event)
Fires a PropertyChangeEvent.

Parameters:
event - The PropertyChangeEvent to be fired.

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.

addScalarMap

protected void addScalarMap(ScalarMap map)
                     throws VisADException,
                            RemoteException

Adds a ScalarMap to this instance. The display might be rebuilt or marked for a rebuild.

This implementation invokes addScalarMaps(ScalarMapSet) with the given ScalarMap as the only member of the set.

Parameters:
map - The ScalarMap to add.
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

addScalarMaps

protected void addScalarMaps(ScalarMapSet mapSet)
                      throws VisADException,
                             RemoteException
Adds ScalarMaps to this instance.

Parameters:
mapSet - The ScalarMap-s to add.
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

removeScalarMaps

protected void removeScalarMaps(ScalarMapSet mapSet)
                         throws VisADException,
                                RemoteException
Removes given ScalarMaps from this instance. The display might be rebuilt or marked for a rebuild.

Parameters:
mapSet - The ScalarMap-s to remove.
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

removeScalarMap

protected boolean removeScalarMap(ScalarMap map)
                           throws VisADException,
                                  RemoteException
Removes a ScalarMap from this instance. The display might be rebuilt or marked for a rebuild. true is returned if and only if the ScalarMap had been added via a previous addScalarMap(ScalarMap) or addScalarMaps(ScalarMapSet).

Parameters:
map - The ScalarMap to remove.
Returns:
true if the ScalarMap existed.
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

replaceScalarMap

protected void replaceScalarMap(ScalarMap oldMap,
                                ScalarMap newMap)
                         throws VisADException,
                                RemoteException
Replaces a ScalarMap in this instance. The display might be rebuilt or marked for a rebuild.

Parameters:
oldMap - The ScalarMap to remove.
newMap - The ScalarMap to add.
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

setRebuildNecessary

public void setRebuildNecessary()
Deprecated. 

Sets the "rebuild necessary" property.


isActive

public boolean isActive()
Indicates if this instance is active (i.e will immediately rebuild the display when appropriate).

Returns:
true if and only if the display master is active.

printMe

public void printMe()
Print out a message


setDisplayInactive

public void setDisplayInactive()
Sets this instance inactive (ie: that it will not automatically rebuild the display when appropriate).

This implementation invokes setActive(boolean).


setDisplayActive

public void setDisplayActive()
                      throws RemoteException,
                             VisADException
Activate the display if there is one or fewer pending inactive calls

Throws:
RemoteException - On badness
VisADException - On badness

setActive

public void setActive(boolean newActiveValue)
               throws RemoteException,
                      VisADException
Deprecated. This will become private in the future. You should use setDisplayInactive() and setDisplayActive()

Determines whether or not this instance will automatically rebuild the display when appropriate. If the argument is true and the display has been marked for a rebuild, then the display will be rebuilt. This method is idempotent.

Parameters:
newActiveValue - true will cause an immediate rebuld if appropriate and ensure future, automatic rebuilds.
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

ensureInactive

public boolean ensureInactive()
Deprecated. This will become private in the future. You should use setDisplayInactive() and setDisplayActive()

Ensures that this instance is inactive (ie: that it will not automatically rebuild the display when appropriate).

This implementation invokes setActive(boolean).

Returns:
The previous value of the "active" property.

saveCurrentDisplay

public void saveCurrentDisplay(File toFile)

Capture the display's current image and save it to a file as an image (e.g., JPEG, png). No blocking occurs and the currently rendered display is captured.

This implementation simply calls saveCurrentDisplay(File, boolean, boolean) with doSync=false.

Parameters:
toFile - The file to which to save the current image.

getAnimationSetFromDisplayables

protected Set getAnimationSetFromDisplayables()
                                       throws VisADException,
                                              RemoteException
Collect the animation set that is the union of all data

Returns:
Set of animation samplings
Throws:
RemoteException - problem computing set from remote data objects
VisADException - problem computing set from local Data objects

buildAnimationSet

protected Set buildAnimationSet()
                         throws VisADException,
                                RemoteException
Build the animation set

Returns:
the animation set
Throws:
RemoteException - problem computing set from remote data objects
VisADException - problem computing set from local Data objects

dataChange

protected void dataChange()
                   throws VisADException,
                          RemoteException

Handles a change to the data in the displayables.

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

saveCurrentDisplay

public void saveCurrentDisplay(File toFile,
                               boolean doSync,
                               boolean block)
Capture the display's current image and save it to a file as an image (eg, JPEG, png). If doSync is true, then the calling thread will block until rendering is complete.

Parameters:
toFile - The file to which to save the current image.
doSync - Whether or not to wait until the display is stable.
block - Whether or not to wait until the image is saved.

saveCurrentDisplay

public void saveCurrentDisplay(File toFile,
                               boolean doSync,
                               boolean block,
                               float quality)
Capture the display's current image and save it to a file as an image (eg, JPEG, png). If doSync is true, then the calling thread will block until rendering is complete.

Parameters:
toFile - The file to which to save the current image.
doSync - Whether or not to wait until the display is stable.
block - Whether or not to wait until the image is saved.
quality - JPEG quality

getImage

public BufferedImage getImage(boolean doSync)
                       throws Exception
Get a buffered image of the Display

Parameters:
doSync - true to wait until display is done
Returns:
BufferedImage
Throws:
Exception - problem getting the image

printMatrix

public void printMatrix(String name,
                        double[] matrix)
Print out the matrix.

Parameters:
name - the name of the matrix
matrix - the matrix to print