visad
Class DisplayRenderer

java.lang.Object
  extended by visad.DisplayRenderer
All Implemented Interfaces:
java.util.EventListener, ControlListener
Direct Known Subclasses:
DisplayRendererJ2D, DisplayRendererJ3D

public abstract class DisplayRenderer
extends java.lang.Object
implements ControlListener

DisplayRenderer is the VisAD abstract super-class for background and metadata rendering algorithms. These complement depictions of Data objects created by DataRenderer objects.

DisplayRenderer also manages the overall relation of DataRenderer output to the graphics library.

DisplayRenderer is not Serializable and should not be copied between JVMs.


Constructor Summary
DisplayRenderer()
          Construct a new DisplayRenderer.
 
Method Summary
abstract  boolean anyDirects()
           
abstract  void clearScale(AxisScale axisScale)
          Remove a particular scale being rendered.
abstract  void clearScales()
          Remove all the scales being rendered.
abstract  void depth_cursor(VisADRay ray)
           
abstract  void drag_cursor(VisADRay ray, boolean first)
           
abstract  void drag_depth(float diff)
           
abstract  DataRenderer findDirect(VisADRay ray, int mouseModifiers)
          Returns a direct manipulation renderer if one is close to the specified ray.
 java.lang.String[] getAnimationString()
           
 boolean getBoxOn()
          Get the box visibility.
abstract  double[] getCursor()
          Return an array giving the cursor location as (XAxis, YAxis, ZAxis) coordinates
 float[] getCursorColor()
          Get the cursor color.
 java.util.Vector getCursorStringVector()
          Return Vector of Strings describing the cursor location.
 java.util.Vector getCursorStringVectorUnconditional()
           
 double getDirectAxisValue(RealType type)
           
 double getDirectAxisValue(java.lang.String name)
           
 DisplayImpl getDisplay()
          Get the Display associated with this renderer.
abstract  java.awt.image.BufferedImage getImage()
          Get a snapshot of the displayed image.
 boolean getMode2D()
          Return true if this is a 2-D DisplayRenderer.
abstract  MouseBehavior getMouseBehavior()
           
 float getPickThreshhold()
           
 RendererControl getRendererControl()
          Get the Control which holds the "shared" data for this renderer.
 boolean getWaitFlag()
          Get the wait flag state.
abstract  void initControl(RendererControl ctl)
          Internal method used to initialize newly created RendererControl with current renderer settings before it is actually connected to the renderer.
abstract  boolean legalDataRenderer(DataRenderer renderer)
           
 boolean legalDisplayScalar(DisplayRealType type)
          Return true if type is legal for this DisplayRenderer; for example, 2-D DisplayRenderers use this to disallow mappings to ZAxis and Latitude.
abstract  Control makeControl(ScalarMap map)
          Factory for constructing a subclass of Control appropriate for the graphics API and for this DisplayRenderer; invoked by ScalarMap when it is addMap()ed to a Display.
abstract  DataRenderer makeDefaultRenderer()
          Factory for constructing the default subclass of DataRenderer for this DisplayRenderer.
 void prepareAction(java.util.Vector temp, java.util.Vector tmap, boolean go, boolean initialize)
           
 void render_trigger()
           
 void setAnimationString(java.lang.String[] animation)
           
 void setBackgroundColor(float r, float g, float b)
          Set the background color.
abstract  void setBoxAspect(double[] aspect)
           
 void setBoxColor(float r, float g, float b)
          Set the box color.
 void setBoxOn(boolean on)
          Set the box visibility.
 void setCursorColor(float r, float g, float b)
          Set the cursor color.
abstract  void setCursorOn(boolean on)
           
 void setCursorStringOn(boolean on)
           
 void setCursorStringVector()
          Set Vector of Strings describing the cursor location from the cursor location; this is invoked when the cursor location changes or the cursor display status changes
 void setCursorStringVector(java.util.Vector vect)
          Set Vector of Strings describing the cursor location by copy; this is invoked by direct manipulation renderers.
abstract  void setDirectOn(boolean on)
           
 void setDisplay(DisplayImpl d)
          Specify DisplayImpl to be rendered.
 void setForegroundColor(float r, float g, float b)
          Set the foreground color (box, cursor and scales).
 void setPickThreshhold(float pt)
           
abstract  void setScale(AxisScale axisScale)
          Set the scale for the appropriate axis.
abstract  void setScale(int axis, int axis_ordinal, VisADLineArray array, float[] scale_color)
          Set the scale for the appropriate axis.
abstract  void setScale(int axis, int axis_ordinal, VisADLineArray array, VisADTriangleArray labels, float[] scale_color)
          Set the scale for the appropriate axis.
abstract  void setScaleOn(boolean on)
          Allow scales to be displayed if they are set on.
 void setWaitFlag(boolean b)
          Set the wait flag to the specified value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface visad.ControlListener
controlChanged
 

Constructor Detail

DisplayRenderer

public DisplayRenderer()
Construct a new DisplayRenderer.

Method Detail

getPickThreshhold

public float getPickThreshhold()

setPickThreshhold

public void setPickThreshhold(float pt)

setBoxAspect

public abstract void setBoxAspect(double[] aspect)

setDisplay

public void setDisplay(DisplayImpl d)
                throws VisADException
Specify DisplayImpl to be rendered.

Parameters:
d - Display to render.
Throws:
VisADException - If a DisplayImpl has already been specified.

initControl

public abstract void initControl(RendererControl ctl)
Internal method used to initialize newly created RendererControl with current renderer settings before it is actually connected to the renderer. This means that changes will not generate MonitorEvents.


getDisplay

public DisplayImpl getDisplay()
Get the Display associated with this renderer.

Returns:
The Display being rendered.

getRendererControl

public RendererControl getRendererControl()
Get the Control which holds the "shared" data for this renderer.

Returns:
The renderer Control.

setWaitFlag

public void setWaitFlag(boolean b)
Set the wait flag to the specified value. (When the wait flag is enabled, the user is informed that the application is busy, typically by displaying a Please wait . . . message at the bottom of the Display.) DisplayEvent.WAIT_ON and DisplayEvent.WAIT_OFF events are fired based on value of b.

Parameters:
b - Boolean value to which wait flag is set.

getWaitFlag

public boolean getWaitFlag()
Get the wait flag state.

Returns:
true if the wait flag is enabled.

getImage

public abstract java.awt.image.BufferedImage getImage()
Get a snapshot of the displayed image.

Returns:
The current image being displayed.

setScale

public abstract void setScale(AxisScale axisScale)
                       throws VisADException
Set the scale for the appropriate axis.

Parameters:
axisScale - AxisScale for this scale
Throws:
VisADException - couldn't set the scale

setScale

public abstract void setScale(int axis,
                              int axis_ordinal,
                              VisADLineArray array,
                              float[] scale_color)
                       throws VisADException
Set the scale for the appropriate axis.

Parameters:
axis - axis for this scale (0 = XAxis, 1 = YAxis, 2 = ZAxis)
axis_ordinal - position along the axis
array - VisADLineArray representing the scale plot
scale_color - array (dim 3) representing the red, green and blue color values.
Throws:
VisADException - couldn't set the scale

setScale

public abstract void setScale(int axis,
                              int axis_ordinal,
                              VisADLineArray array,
                              VisADTriangleArray labels,
                              float[] scale_color)
                       throws VisADException
Set the scale for the appropriate axis.

Parameters:
axis - axis for this scale (0 = XAxis, 1 = YAxis, 2 = ZAxis)
axis_ordinal - position along the axis
array - VisADLineArray representing the scale plot
labels - VisADTriangleArray representing the labels created using a font (can be null)
scale_color - array (dim 3) representing the red, green and blue color values.
Throws:
VisADException - couldn't set the scale

clearScales

public abstract void clearScales()
Remove all the scales being rendered.


clearScale

public abstract void clearScale(AxisScale axisScale)
Remove a particular scale being rendered.

Parameters:
axisScale - scale to remove

setScaleOn

public abstract void setScaleOn(boolean on)
Allow scales to be displayed if they are set on. This should not be called programmatically, since it does not update collaborative displays. Applications should use GraphicsModeControl.setScaleEnable instead of this method.

Parameters:
on - true to turn them on, false to set them invisible

getMode2D

public boolean getMode2D()
Return true if this is a 2-D DisplayRenderer.

Returns:
true if this is a 2-D renderer.

setBackgroundColor

public void setBackgroundColor(float r,
                               float g,
                               float b)
                        throws java.rmi.RemoteException,
                               VisADException
Set the background color. All specified values should be in the range [0.0f - 1.0f].

Parameters:
r - Red value.
g - Green value.
b - Blue value.
Throws:
java.rmi.RemoteException - If there was a problem making this change in a remote collaborative DisplayRenderer.
VisADException - If this renderer as not yet been assigned to a Display.

setForegroundColor

public void setForegroundColor(float r,
                               float g,
                               float b)
                        throws java.rmi.RemoteException,
                               VisADException
Set the foreground color (box, cursor and scales). All specified values should be in the range [0.0f - 1.0f].

Parameters:
r - Red value.
g - Green value.
b - Blue value.
Throws:
java.rmi.RemoteException - If there was a problem making this change in a remote collaborative DisplayRenderer.
VisADException - If this renderer as not yet been assigned to a Display.

getBoxOn

public boolean getBoxOn()
                 throws java.rmi.RemoteException,
                        VisADException
Get the box visibility.

Returns:
true if the box is visible.
Throws:
java.rmi.RemoteException
VisADException

setBoxColor

public void setBoxColor(float r,
                        float g,
                        float b)
                 throws java.rmi.RemoteException,
                        VisADException
Set the box color. All specified values should be in the range [0.0f - 1.0f].

Parameters:
r - Red value.
g - Green value.
b - Blue value.
Throws:
java.rmi.RemoteException - If there was a problem making this change in a remote collaborative DisplayRenderer.
VisADException - If this renderer as not yet been assigned to a Display.

setBoxOn

public void setBoxOn(boolean on)
              throws java.rmi.RemoteException,
                     VisADException
Set the box visibility.

Parameters:
on - true if the box should be visible.
Throws:
java.rmi.RemoteException - If there was a problem making this change in a remote collaborative DisplayRenderer.
VisADException - If this renderer as not yet been assigned to a Display.

getCursorColor

public float[] getCursorColor()
                       throws java.rmi.RemoteException,
                              VisADException
Get the cursor color.

Returns:
A 3 element array of float values in the range [0.0f - 1.0f] in the order (Red, Green, Blue).
Throws:
java.rmi.RemoteException - If there was a problem making this change in a remote collaborative DisplayRenderer.
VisADException - If this renderer as not yet been assigned to a Display.

setCursorColor

public void setCursorColor(float r,
                           float g,
                           float b)
                    throws java.rmi.RemoteException,
                           VisADException
Set the cursor color. All specified values should be in the range [0.0f - 1.0f].

Parameters:
r - Red value.
g - Green value.
b - Blue value.
Throws:
java.rmi.RemoteException - If there was a problem making this change in a remote collaborative DisplayRenderer.
VisADException - If this renderer as not yet been assigned to a Display.

makeControl

public abstract Control makeControl(ScalarMap map)
Factory for constructing a subclass of Control appropriate for the graphics API and for this DisplayRenderer; invoked by ScalarMap when it is addMap()ed to a Display.

Parameters:
map - The ScalarMap for which a Control should be built.
Returns:
The appropriate Control.

makeDefaultRenderer

public abstract DataRenderer makeDefaultRenderer()
Factory for constructing the default subclass of DataRenderer for this DisplayRenderer.

Returns:
The default DataRenderer.

legalDataRenderer

public abstract boolean legalDataRenderer(DataRenderer renderer)

getAnimationString

public java.lang.String[] getAnimationString()

setAnimationString

public void setAnimationString(java.lang.String[] animation)

getCursor

public abstract double[] getCursor()
Return an array giving the cursor location as (XAxis, YAxis, ZAxis) coordinates

Returns:
3 element double array of cursor coordinates.

setCursorOn

public abstract void setCursorOn(boolean on)

depth_cursor

public abstract void depth_cursor(VisADRay ray)

drag_cursor

public abstract void drag_cursor(VisADRay ray,
                                 boolean first)

setDirectOn

public abstract void setDirectOn(boolean on)

drag_depth

public abstract void drag_depth(float diff)

anyDirects

public abstract boolean anyDirects()

getMouseBehavior

public abstract MouseBehavior getMouseBehavior()

findDirect

public abstract DataRenderer findDirect(VisADRay ray,
                                        int mouseModifiers)
Returns a direct manipulation renderer if one is close to the specified ray.

Parameters:
ray - The ray used to look for a nearby direct manipulation renderer.
mouseModifiers - Value of InputEvent.getModifiers().
Returns:
DataRenderer or null.

setCursorStringOn

public void setCursorStringOn(boolean on)

getCursorStringVector

public java.util.Vector getCursorStringVector()
Return Vector of Strings describing the cursor location.

Returns:
The cursor location description.

getCursorStringVectorUnconditional

public java.util.Vector getCursorStringVectorUnconditional()

getDirectAxisValue

public double getDirectAxisValue(RealType type)

getDirectAxisValue

public double getDirectAxisValue(java.lang.String name)

setCursorStringVector

public void setCursorStringVector(java.util.Vector vect)
Set Vector of Strings describing the cursor location by copy; this is invoked by direct manipulation renderers.

Parameters:
vect - String descriptions of cursor location.

setCursorStringVector

public void setCursorStringVector()
Set Vector of Strings describing the cursor location from the cursor location; this is invoked when the cursor location changes or the cursor display status changes


render_trigger

public void render_trigger()

legalDisplayScalar

public boolean legalDisplayScalar(DisplayRealType type)
Return true if type is legal for this DisplayRenderer; for example, 2-D DisplayRenderers use this to disallow mappings to ZAxis and Latitude.

Parameters:
type - The mapping type to check.
Returns:
true if type is legal.

prepareAction

public void prepareAction(java.util.Vector temp,
                          java.util.Vector tmap,
                          boolean go,
                          boolean initialize)
                   throws VisADException,
                          java.rmi.RemoteException
Throws:
VisADException
java.rmi.RemoteException