ucar.visad.display
Class Grid2DDisplayable

java.lang.Object
  extended by ucar.visad.display.Displayable
      extended by ucar.visad.display.DisplayableData
          extended by ucar.visad.display.RGBDisplayable
              extended by ucar.visad.display.Grid2DDisplayable
All Implemented Interfaces:
GridDisplayable
Direct Known Subclasses:
ImageSequenceDisplayable

public class Grid2DDisplayable
extends RGBDisplayable
implements GridDisplayable

A class to support showing 2D gridded data as color on a plane in a DisplayMaster.

Version:
$Revision: 1.33 $
Author:
Stuart Wier

Field Summary
 
Fields inherited from class ucar.visad.display.RGBDisplayable
COLOR_PALETTE, POLYGON_FILL, POLYGON_LINE, POLYGON_POINT, RGB_REAL_TYPE
 
Fields inherited from class ucar.visad.display.DisplayableData
LINE_WIDTH, MANIPULABLE, VISIBLE
 
Fields inherited from class ucar.visad.display.Displayable
DISPLAY, parent, SCALAR_MAP_SET
 
Constructor Summary
protected Grid2DDisplayable(Grid2DDisplayable that)
          Constructs from another instance.
  Grid2DDisplayable(String name, boolean alphaflag)
          Constructs an instance with the supplied name.
  Grid2DDisplayable(String name, RealType rgbRealType, float[][] colorPalette, boolean alphaflag)
          Constructs from a name for the Displayable and the type of the RGB parameter.
 
Method Summary
 Displayable cloneForDisplay()
          Returns a clone of this instance suitable for another VisAD display.
 int getCurvedSize()
          Get the default texture curve size
protected  DataRenderer getDataRenderer()
          Obtains the DataRenderer for this displayable.
 boolean getMissingTransparent()
          Get whether this is textured or smoothed
 boolean getTextureEnable()
          Get whether this is textured or smoothed
 boolean getUseDefaultRenderer()
          Get whether to always use default renderer instead of specialized one.
 void loadData(FieldImpl field)
          Set the data into the Displayable; set RGB Type
protected  ConstantMap makeTextureMap(boolean enable)
          Create a ConstantMap for texture mapping
protected  void myAddConstantMaps(ConstantMap[] newMaps)
          Adds this instance's data references to the associated VisAD display if possible.
 void setColoredByAnother(boolean yesno)
          Set whether this GridDisplayable should have the data colored by another parameter.
 void setCurvedSize(int size)
          Set the default texture curve size
 void setGrid2D(FieldImpl field)
          Deprecated. Should use setData now.
 void setMissingTransparent(boolean enable)
          Set whether missing values should be shown as transparent or not
 void setTextureEnable(boolean enable)
          Set whether this should be shown as color shading or as a texture map.
 void setTextureProperties(FieldImpl grid)
          A method that subclasses can call to set the texture properties on a Grid2DDisplayable.
 void setUseDefaultRenderer(boolean use)
          Set whether to always use default renderer instead of specialized one.
 
Methods inherited from class ucar.visad.display.RGBDisplayable
getAutoScaleColorRange, getColorPalette, getPolygonMode, getRangeforColor, getRangeForColor, getRGBRealType, getSelectRealType, getUseRGBTypeForSelect, hasRange, hasSelectedRange, makeCurvedSizeMap, setAutoScaleColorRange, setColor, setColorPalette, setColorUnit, setDisplayUnit, setGreyPalette, setPolygonMode, setRange, setRangeForColor, setRangeForSelect, setRGBRealType, setScalarMaps, setSelectedRange, setSelectRealType, setUseRGBTypeForSelect, setVisADPalette, useDisplayUnitForColor
 
Methods inherited from class ucar.visad.display.DisplayableData
addAction, dataChange, destroy, getActive, getAnimationSet, getData, getLineWidth, getName, getPointSize, hasData, hasDataObject, isManipulable, isPickable, myAddDataReferences, myRemoveDataReferences, removeAction, setActive, setData, setDataReference, setLineWidth, setManipulable, setPickable, setPointMode, setPointSize, setUseFastRendering, setVisible, toString
 
Methods inherited from class ucar.visad.display.Displayable
addConstantMap, addConstantMaps, addDataReferences, addPropertyChangeListener, addPropertyChangeListener, addRefsInvoked, addScalarMap, addScalarMaps, applyColorUnit, applyDisplayUnit, checkUnit, combineConstantMaps, firePropertyChange, firePropertyChange, fireScalarMapSetChange, getColorUnit, getConstantMaps, getDisplay, getDisplayMaster, getDisplayUnit, getPointMode, getScalarMap, getScalarMap, getScalarMap, getScalarMapSet, getUseFastRendering, getUseTimesInAnimation, getVisible, isActive, isUnitCompatible, isVisible, logException, removeConstantMap, removeDataReferences, removePropertyChangeListener, removePropertyChangeListener, removeScalarMap, replaceScalarMap, setAdjustFlow, setColorPalette, setConstantPosition, setContourInfo, setDisplay, setDisplayActive, setDisplayInactive, setDisplayMaster, setOverrideAnimationSet, setOverrideAnimationSet, setParent, setRangeForColor, setScalarMapSet, setSelectedRange, setUseTimesInAnimation, toFront
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Grid2DDisplayable

public Grid2DDisplayable(String name,
                         boolean alphaflag)
                  throws VisADException,
                         RemoteException
Constructs an instance with the supplied name.

Parameters:
name - a String identifier
alphaflag - boolean flag whether to use transparency
Throws:
VisADException - from construction of super class
RemoteException - from construction of super class

Grid2DDisplayable

public Grid2DDisplayable(String name,
                         RealType rgbRealType,
                         float[][] colorPalette,
                         boolean alphaflag)
                  throws VisADException,
                         RemoteException
Constructs from a name for the Displayable and the type of the RGB parameter.

Parameters:
name - The name for the displayable.
rgbRealType - The type of the RGB parameter. May be null.
colorPalette - The initial colorPalette to use. May be null (Vis5D palette used as default).
alphaflag - boolean - use Display.RBGA if true
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

Grid2DDisplayable

protected Grid2DDisplayable(Grid2DDisplayable that)
                     throws VisADException,
                            RemoteException
Constructs from another instance. The following attributes are set from the other instance: color palette, the color RealType.

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

setGrid2D

public void setGrid2D(FieldImpl field)
               throws VisADException,
                      RemoteException
Deprecated. Should use setData now.

Set the data into the Displayable

Parameters:
field - a VisAD FlatField with a 2D nature
Throws:
VisADException - from construction of VisAd objects
RemoteException - from construction of VisAD objects

loadData

public void loadData(FieldImpl field)
              throws VisADException,
                     RemoteException
Set the data into the Displayable; set RGB Type

Specified by:
loadData in interface GridDisplayable
Parameters:
field - a VisAD FlatField with a 2D nature
Throws:
VisADException - from construction of VisAd objects
RemoteException - from construction of VisAD objects

cloneForDisplay

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

Overrides:
cloneForDisplay in class DisplayableData
Returns:
A semi-deep clone of this instance.
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

getDataRenderer

protected DataRenderer getDataRenderer()
                                throws VisADException
Obtains the DataRenderer for this displayable.

Overrides:
getDataRenderer in class DisplayableData
Returns:
The DataRenderer for this displayable.
Throws:
VisADException - VisAD failure.

setTextureEnable

public void setTextureEnable(boolean enable)
                      throws VisADException,
                             RemoteException
Set whether this should be shown as color shading or as a texture map.

Parameters:
enable - true to enable texturing
Throws:
RemoteException
VisADException

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.

Overrides:
myAddConstantMaps in class DisplayableData
Parameters:
newMaps - new maps
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

makeTextureMap

protected ConstantMap makeTextureMap(boolean enable)
                              throws VisADException,
                                     RemoteException
Create a ConstantMap for texture mapping

Parameters:
enable - true to enable texture mapping
Returns:
ConstantMap for Texture mapping based on enable
Throws:
RemoteException - Java RMI error
VisADException - problem creating VisAD object

getTextureEnable

public boolean getTextureEnable()
Get whether this is textured or smoothed

Returns:
true is textured

setMissingTransparent

public void setMissingTransparent(boolean enable)
                           throws VisADException,
                                  RemoteException
Set whether missing values should be shown as transparent or not

Parameters:
enable - true enable missing transparency
Throws:
RemoteException
VisADException

getMissingTransparent

public boolean getMissingTransparent()
Get whether this is textured or smoothed

Returns:
true is textured

setUseDefaultRenderer

public void setUseDefaultRenderer(boolean use)
Set whether to always use default renderer instead of specialized one.

Parameters:
use - true to always use the default renderer

getUseDefaultRenderer

public boolean getUseDefaultRenderer()
Get whether to always use default renderer instead of specialized one.

Returns:
true to always use the default renderer

setTextureProperties

public void setTextureProperties(FieldImpl grid)
                          throws VisADException,
                                 RemoteException
A method that subclasses can call to set the texture properties on a Grid2DDisplayable. Checks to see if the grid is too big to not do texture mapping.

Parameters:
grid - grid to use to set the properties. Can be null.
Throws:
RemoteException
VisADException

setColoredByAnother

public void setColoredByAnother(boolean yesno)
Set whether this GridDisplayable should have the data colored by another parameter. This implementation is a no-op.

Specified by:
setColoredByAnother in interface GridDisplayable
Parameters:
yesno - true if colored by another

setCurvedSize

public void setCurvedSize(int size)
Set the default texture curve size

Overrides:
setCurvedSize in class RGBDisplayable
Parameters:
size - size of texture

getCurvedSize

public int getCurvedSize()
Get the default texture curve size

Overrides:
getCurvedSize in class RGBDisplayable
Returns:
size of curved texture