visad
Class DataRenderer

java.lang.Object
  extended by visad.DataRenderer
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
RendererJ2D, RendererJ3D

public abstract class DataRenderer
extends java.lang.Object
implements java.lang.Cloneable

DataRenderer is the VisAD abstract super-class for graphics rendering algorithms. These transform Data objects into 3-D (or 2-D) depictions in a Display window.

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


Field Summary
protected  boolean enabled
           
protected  boolean pickCrawlToCursor
          flag indicating whether points affected by direct manipulation should "crawl" toward the cursor instead of jumping to it immediately.
 
Constructor Summary
DataRenderer()
           
 
Method Summary
 void addException(java.lang.Exception error)
          add message from BadMappingException or UnimplementedException to exceptionVector
 void addPoint(float[] x)
           
 boolean checkAction()
           
 float checkClose(double[] origin, double[] direction)
          find minimum distance from ray to spatialValues
 void checkDirect()
          set isDirectManipulation = true if this DataRenderer supports direct manipulation for its linked Data
 void clearAVControls()
           
abstract  void clearBranch()
          clear scene graph component
 void clearExceptions()
           
abstract  void clearScene()
          clear any display list created by the most recent doAction invocation
abstract  java.lang.Object clone()
           
 DataShadow computeRanges(Data data, ShadowType type, DataShadow shadow)
           
abstract  boolean doAction()
          transform linked Data objects into a display list, if any Data object values have changed or relevant Controls have changed; DataRenderers that assume the default implementation of DisplayImpl.doAction can determine whether re-transform is needed by: (get_all_feasible() && (get_any_changed() || get_any_transform_control())); these flags are computed by the default DataRenderer implementation of prepareAction; the return boolean is true if the transform was done successfully
 void drag_direct(VisADRay ray, boolean first, int mouseModifiers)
           
 float[][] earthToSpatial(float[][] locs, float[] vert)
          convert (lat, lon) or (lat, lon, other) values to display (x, y, z)
 float[][] earthToSpatial(float[][] locs, float[] vert, float[][] base_spatial_locs)
           
 float findRayManifoldIntersection(boolean first, double[] origin, double[] direction, DisplayTupleType tuple, int otherindex, float othervalue)
           
 boolean get_all_feasible()
           
 boolean get_any_changed()
           
 boolean get_any_transform_control()
           
 boolean getBadScale(boolean anyBadMap)
           
 DisplayImpl getDisplay()
           
 CoordinateSystem getDisplayCoordinateSystem()
           
 DisplayRenderer getDisplayRenderer()
           
 int getEarthDimension()
           
 Unit[] getEarthUnits()
           
 boolean getEnabled()
          Returns the visibility of the data being rendered by this instance.
 java.util.Vector getExceptionVector()
          this returns a Vector of Strings from the BadMappingExceptions and UnimplementedExceptions generated during the last invocation of this DataRenderer's doAction method; there is no need to over-ride this method, but it may be invoked by DisplayRenderer; gets a clone of exceptionVector to avoid concurrent access by Display thread
 boolean getIsDirectManipulation()
           
 int getLastMouseModifiers()
           
 int[] getLatLonIndices()
           
 float getLatLonRange()
           
 DataDisplayLink getLink()
          used for transform time-out hack
 DataDisplayLink[] getLinks()
          return an array of links to Data objects to be rendered; Data objects are accessed by DataDisplayLink.getData()
 boolean getPickCrawlToCursor()
          gets whether points affected by direct manipulation should "crawl" toward the cursor instead of jumping to it immediately.
 double[] getRanges()
           
 RealVectorType getRealVectorTypes(int index)
           
 java.lang.String getWhyNotDirect()
           
 boolean isLegalTextureMap()
           
 boolean isTransformControl(Control control, DataDisplayLink link)
          DataRenderer-specific decision about which Controls require re-transform; may be over-ridden by DataRenderer sub-classes; this decision may use some values computed by link.prepareData
abstract  ShadowType makeShadowFunctionType(FunctionType type, DataDisplayLink link, ShadowType parent)
          factory for constructing a subclass of ShadowType appropriate for the graphics API, that also adapts ShadowFunctionType; these factories are invoked by the buildShadowType methods of the MathType subclasses, which are invoked by DataDisplayLink.prepareData, which is invoked by DataRenderer.prepareAction
abstract  ShadowType makeShadowRealTupleType(RealTupleType type, DataDisplayLink link, ShadowType parent)
          factory for constructing a subclass of ShadowType appropriate for the graphics API, that also adapts ShadowRealTupleType
abstract  ShadowType makeShadowRealType(RealType type, DataDisplayLink link, ShadowType parent)
          factory for constructing a subclass of ShadowType appropriate for the graphics API, that also adapts ShadowRealType
abstract  ShadowType makeShadowSetType(SetType type, DataDisplayLink link, ShadowType parent)
          factory for constructing a subclass of ShadowType appropriate for the graphics API, that also adapts ShadowSetType
abstract  ShadowType makeShadowTextType(TextType type, DataDisplayLink link, ShadowType parent)
          factory for constructing a subclass of ShadowType appropriate for the graphics API, that also adapts ShadowTextType
abstract  ShadowType makeShadowTupleType(TupleType type, DataDisplayLink link, ShadowType parent)
          factory for constructing a subclass of ShadowType appropriate for the graphics API, that also adapts ShadowTupleType
 DataShadow prepareAction(boolean go, boolean initialize, DataShadow shadow)
          check if re-transform is needed; if initialize is true then compute ranges for RealType-s and Animation sampling
 void realCheckDirect()
           
 void release_direct()
          mouse button released, ending direct manipulation
 void removeLink(DataDisplayLink link)
          WARNING! Do NOT use this routine unless you know what you are doing!
 void set_all_feasible(boolean b)
           
 void setDisplay(DisplayImpl d)
           
 void setDisplayRenderer(DisplayRenderer r)
           
 void setEarthSpatialData(ShadowRealTupleType s_d_i, ShadowRealTupleType s_d_o, RealTupleType d_o, Unit[] d_u_o, RealTupleType d_i, CoordinateSystem[] d_c_i, Unit[] d_u_i)
           
 void setEarthSpatialDisplay(CoordinateSystem coord, DisplayTupleType t, DisplayImpl display, int[] indices, float[] default_values, double[] r)
           
 void setIsDirectManipulation(boolean b)
           
 void setLastMouseModifiers(int mouseModifiers)
           
 void setLatLonIndices(int[] indices)
           
 void setLinks(DataDisplayLink[] links)
           
abstract  void setLinks(DataDisplayLink[] links, DisplayImpl d)
           
 void setPickCrawlToCursor(boolean b)
          sets whether points affected by direct manipulation should "crawl" toward the cursor instead of jumping to it immediately.
 void setSpatialValues(float[][] spatial_values)
          set spatialValues from ShadowType.doTransform
 float[][] spatialToEarth(float[][] spatial_locs)
          convert display (x, y, z) to (lat, lon) or (lat, lon, other) values
 float[][] spatialToEarth(float[][] spatial_locs, float[][] base_spatial_locs)
           
 void stop_direct()
          discontinue dragging this DataRenderer; this method is not a general disable
 void suppressExceptions(boolean suppress)
           
 void toggle(boolean on)
          Sets the visibility of the data being rendered by this instance.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

enabled

protected boolean enabled

pickCrawlToCursor

protected boolean pickCrawlToCursor
flag indicating whether points affected by direct manipulation should "crawl" toward the cursor instead of jumping to it immediately.

Constructor Detail

DataRenderer

public DataRenderer()
Method Detail

clearExceptions

public void clearExceptions()

suppressExceptions

public void suppressExceptions(boolean suppress)

addException

public void addException(java.lang.Exception error)
add message from BadMappingException or UnimplementedException to exceptionVector


getExceptionVector

public java.util.Vector getExceptionVector()
this returns a Vector of Strings from the BadMappingExceptions and UnimplementedExceptions generated during the last invocation of this DataRenderer's doAction method; there is no need to over-ride this method, but it may be invoked by DisplayRenderer; gets a clone of exceptionVector to avoid concurrent access by Display thread


get_all_feasible

public boolean get_all_feasible()

get_any_changed

public boolean get_any_changed()

get_any_transform_control

public boolean get_any_transform_control()

set_all_feasible

public void set_all_feasible(boolean b)

setLinks

public abstract void setLinks(DataDisplayLink[] links,
                              DisplayImpl d)
                       throws VisADException
Throws:
VisADException

toggle

public void toggle(boolean on)
Sets the visibility of the data being rendered by this instance.

Parameters:
on - Whether or not to render the data.

getEnabled

public boolean getEnabled()
Returns the visibility of the data being rendered by this instance.

Returns:
Whether or not the data is being rendered.

setLinks

public void setLinks(DataDisplayLink[] links)

getLinks

public DataDisplayLink[] getLinks()
return an array of links to Data objects to be rendered; Data objects are accessed by DataDisplayLink.getData()


getDisplay

public DisplayImpl getDisplay()

setDisplay

public void setDisplay(DisplayImpl d)

getDisplayRenderer

public DisplayRenderer getDisplayRenderer()

setDisplayRenderer

public void setDisplayRenderer(DisplayRenderer r)

checkAction

public boolean checkAction()

prepareAction

public DataShadow prepareAction(boolean go,
                                boolean initialize,
                                DataShadow shadow)
                         throws VisADException,
                                java.rmi.RemoteException
check if re-transform is needed; if initialize is true then compute ranges for RealType-s and Animation sampling

Throws:
VisADException
java.rmi.RemoteException

computeRanges

public DataShadow computeRanges(Data data,
                                ShadowType type,
                                DataShadow shadow)
                         throws VisADException,
                                java.rmi.RemoteException
Throws:
VisADException
java.rmi.RemoteException

clearBranch

public abstract void clearBranch()
clear scene graph component


doAction

public abstract boolean doAction()
                          throws VisADException,
                                 java.rmi.RemoteException
transform linked Data objects into a display list, if any Data object values have changed or relevant Controls have changed; DataRenderers that assume the default implementation of DisplayImpl.doAction can determine whether re-transform is needed by: (get_all_feasible() && (get_any_changed() || get_any_transform_control())); these flags are computed by the default DataRenderer implementation of prepareAction; the return boolean is true if the transform was done successfully

Throws:
VisADException
java.rmi.RemoteException

getBadScale

public boolean getBadScale(boolean anyBadMap)

clearScene

public abstract void clearScene()
clear any display list created by the most recent doAction invocation


clearAVControls

public void clearAVControls()

makeShadowFunctionType

public abstract ShadowType makeShadowFunctionType(FunctionType type,
                                                  DataDisplayLink link,
                                                  ShadowType parent)
                                           throws VisADException,
                                                  java.rmi.RemoteException
factory for constructing a subclass of ShadowType appropriate for the graphics API, that also adapts ShadowFunctionType; these factories are invoked by the buildShadowType methods of the MathType subclasses, which are invoked by DataDisplayLink.prepareData, which is invoked by DataRenderer.prepareAction

Throws:
VisADException
java.rmi.RemoteException

makeShadowRealTupleType

public abstract ShadowType makeShadowRealTupleType(RealTupleType type,
                                                   DataDisplayLink link,
                                                   ShadowType parent)
                                            throws VisADException,
                                                   java.rmi.RemoteException
factory for constructing a subclass of ShadowType appropriate for the graphics API, that also adapts ShadowRealTupleType

Throws:
VisADException
java.rmi.RemoteException

makeShadowRealType

public abstract ShadowType makeShadowRealType(RealType type,
                                              DataDisplayLink link,
                                              ShadowType parent)
                                       throws VisADException,
                                              java.rmi.RemoteException
factory for constructing a subclass of ShadowType appropriate for the graphics API, that also adapts ShadowRealType

Throws:
VisADException
java.rmi.RemoteException

makeShadowSetType

public abstract ShadowType makeShadowSetType(SetType type,
                                             DataDisplayLink link,
                                             ShadowType parent)
                                      throws VisADException,
                                             java.rmi.RemoteException
factory for constructing a subclass of ShadowType appropriate for the graphics API, that also adapts ShadowSetType

Throws:
VisADException
java.rmi.RemoteException

makeShadowTextType

public abstract ShadowType makeShadowTextType(TextType type,
                                              DataDisplayLink link,
                                              ShadowType parent)
                                       throws VisADException,
                                              java.rmi.RemoteException
factory for constructing a subclass of ShadowType appropriate for the graphics API, that also adapts ShadowTextType

Throws:
VisADException
java.rmi.RemoteException

makeShadowTupleType

public abstract ShadowType makeShadowTupleType(TupleType type,
                                               DataDisplayLink link,
                                               ShadowType parent)
                                        throws VisADException,
                                               java.rmi.RemoteException
factory for constructing a subclass of ShadowType appropriate for the graphics API, that also adapts ShadowTupleType

Throws:
VisADException
java.rmi.RemoteException

isTransformControl

public boolean isTransformControl(Control control,
                                  DataDisplayLink link)
DataRenderer-specific decision about which Controls require re-transform; may be over-ridden by DataRenderer sub-classes; this decision may use some values computed by link.prepareData


getLink

public DataDisplayLink getLink()
used for transform time-out hack


isLegalTextureMap

public boolean isLegalTextureMap()

getRealVectorTypes

public RealVectorType getRealVectorTypes(int index)

getLatLonIndices

public int[] getLatLonIndices()

setLatLonIndices

public void setLatLonIndices(int[] indices)

getEarthDimension

public int getEarthDimension()

getEarthUnits

public Unit[] getEarthUnits()

getLatLonRange

public float getLatLonRange()

earthToSpatial

public float[][] earthToSpatial(float[][] locs,
                                float[] vert)
                         throws VisADException
convert (lat, lon) or (lat, lon, other) values to display (x, y, z)

Throws:
VisADException

earthToSpatial

public float[][] earthToSpatial(float[][] locs,
                                float[] vert,
                                float[][] base_spatial_locs)
                         throws VisADException
Throws:
VisADException

spatialToEarth

public float[][] spatialToEarth(float[][] spatial_locs)
                         throws VisADException
convert display (x, y, z) to (lat, lon) or (lat, lon, other) values

Throws:
VisADException

spatialToEarth

public float[][] spatialToEarth(float[][] spatial_locs,
                                float[][] base_spatial_locs)
                         throws VisADException
Throws:
VisADException

setEarthSpatialData

public void setEarthSpatialData(ShadowRealTupleType s_d_i,
                                ShadowRealTupleType s_d_o,
                                RealTupleType d_o,
                                Unit[] d_u_o,
                                RealTupleType d_i,
                                CoordinateSystem[] d_c_i,
                                Unit[] d_u_i)
                         throws VisADException
Throws:
VisADException

getRanges

public double[] getRanges()

getDisplayCoordinateSystem

public CoordinateSystem getDisplayCoordinateSystem()

setEarthSpatialDisplay

public void setEarthSpatialDisplay(CoordinateSystem coord,
                                   DisplayTupleType t,
                                   DisplayImpl display,
                                   int[] indices,
                                   float[] default_values,
                                   double[] r)
                            throws VisADException
Throws:
VisADException

realCheckDirect

public void realCheckDirect()
                     throws VisADException,
                            java.rmi.RemoteException
Throws:
VisADException
java.rmi.RemoteException

getWhyNotDirect

public java.lang.String getWhyNotDirect()

setSpatialValues

public void setSpatialValues(float[][] spatial_values)
set spatialValues from ShadowType.doTransform


checkClose

public float checkClose(double[] origin,
                        double[] direction)
find minimum distance from ray to spatialValues


release_direct

public void release_direct()
mouse button released, ending direct manipulation


stop_direct

public void stop_direct()
discontinue dragging this DataRenderer; this method is not a general disable


getLastMouseModifiers

public int getLastMouseModifiers()

setLastMouseModifiers

public void setLastMouseModifiers(int mouseModifiers)

drag_direct

public void drag_direct(VisADRay ray,
                        boolean first,
                        int mouseModifiers)

addPoint

public void addPoint(float[] x)
              throws VisADException
Throws:
VisADException

checkDirect

public void checkDirect()
                 throws VisADException,
                        java.rmi.RemoteException
set isDirectManipulation = true if this DataRenderer supports direct manipulation for its linked Data

Throws:
VisADException
java.rmi.RemoteException

setIsDirectManipulation

public void setIsDirectManipulation(boolean b)

getIsDirectManipulation

public boolean getIsDirectManipulation()

setPickCrawlToCursor

public void setPickCrawlToCursor(boolean b)
sets whether points affected by direct manipulation should "crawl" toward the cursor instead of jumping to it immediately.


getPickCrawlToCursor

public boolean getPickCrawlToCursor()
gets whether points affected by direct manipulation should "crawl" toward the cursor instead of jumping to it immediately.


findRayManifoldIntersection

public float findRayManifoldIntersection(boolean first,
                                         double[] origin,
                                         double[] direction,
                                         DisplayTupleType tuple,
                                         int otherindex,
                                         float othervalue)
                                  throws VisADException
Throws:
VisADException

removeLink

public void removeLink(DataDisplayLink link)
WARNING! Do NOT use this routine unless you know what you are doing!


clone

public abstract java.lang.Object clone()
                                throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException