visad
Class DataRenderer

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

public abstract class DataRenderer
extends Object
implements 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
          flag for visibility of Data depictions
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()
          construct a DataRenderer
 
Method Summary
 void addException(Exception error)
          add a BadMappingException or UnimplementedException to Vector of Exceptions generated during doAction()
 void addPoint(float[] x)
          add point for temporary rendering; intended to be over-ridden by graphics-API-specific extensions of DataRenderer
 boolean checkAction()
           
 float checkClose(double[] origin, double[] direction)
          find minimum distance from ray to spatialValues; save index of point with minimum distance in closeIndex; reset lastIndex to -1 (Field domain index of Field range value last modified by drag_direct())
 void checkDirect()
          set isDirectManipulation = true if this DataRenderer supports direct manipulation for the MathType of its linked Data, and for its ScalarMaps; intended to be over-ridden by extensions of DataRenderer
 void clearAVControls()
          clear all information associated with AnimationControls and ValueControls created by this DataRenderer
abstract  void clearBranch()
          clear part of Display scene graph generated by this DataRenderer
 void clearExceptions()
          clear Vector of Exceptions generated during doAction()
 void clearScene()
          clear any scene graph created by this DataRenderer, and clear all instance variables
abstract  Object clone()
           
 DataShadow computeRanges(Data data, ShadowType type, DataShadow shadow)
          Compute ranges of values for each RealType in DisplayImpl.RealTypeVector.
 void constrainDragPoint(float[] dragPoint)
          jeffmc: new method that provides a hook so derived classes can easily constrain the position of a drag point
abstract  boolean doAction()
          transform linked Data objects into a scene graph depiction, 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()
 void drag_direct(VisADRay ray, boolean first, int mouseModifiers)
          modify Data values based on direct manipulation mouse actions
 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)
          convert (lat, lon) or (lat, lon, other) values to display (x, y, z)
 float findRayManifoldIntersection(boolean first, double[] origin, double[] direction, DisplayTupleType tuple, int otherindex, float othervalue)
          find intersection of a ray and a 2-D manifold, using Newton's method
 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.
 Vector getExceptionVector()
          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 by ShadowFunctionOrSetType for transform time-out hack
 DataDisplayLink[] getLinks()
           
 boolean getPickCrawlToCursor()
           
 double[] getRanges()
           
 RealVectorType getRealVectorTypes(int index)
           
 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 method for constructing a subclass of ShadowType appropriate for the graphics API, that also adapts ShadowFunctionType; ShadowType trees are constructed that 'shadow' the MathType trees of Data to be depicted, via recursive calls to buildShadowType() methods of MathType sub-classes, to DataRenderer.makeShadow*Type() methods, to Shadow*Type constructors, then back to buildShadowType() methods; the recursive call chain is initiated by DataDisplayLink.prepareData() calls to buildShadowType() methods of MathType sub-classes;
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; ShadowType trees are constructed that 'shadow' the MathType trees of Data to be depicted, via recursive calls to buildShadowType() methods of MathType sub-classes, to DataRenderer.makeShadow*Type() methods, to Shadow*Type constructors, then back to buildShadowType() methods; the recursive call chain is initiated by DataDisplayLink.prepareData() calls to buildShadowType() methods of MathType sub-classes;
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; ShadowType trees are constructed that 'shadow' the MathType trees of Data to be depicted, via recursive calls to buildShadowType() methods of MathType sub-classes, to DataRenderer.makeShadow*Type() methods, to Shadow*Type constructors, then back to buildShadowType() methods; the recursive call chain is initiated by DataDisplayLink.prepareData() calls to buildShadowType() methods of MathType sub-classes;
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; ShadowType trees are constructed that 'shadow' the MathType trees of Data to be depicted, via recursive calls to buildShadowType() methods of MathType sub-classes, to DataRenderer.makeShadow*Type() methods, to Shadow*Type constructors, then back to buildShadowType() methods; the recursive call chain is initiated by DataDisplayLink.prepareData() calls to buildShadowType() methods of MathType sub-classes;
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; ShadowType trees are constructed that 'shadow' the MathType trees of Data to be depicted, via recursive calls to buildShadowType() methods of MathType sub-classes, to DataRenderer.makeShadow*Type() methods, to Shadow*Type constructors, then back to buildShadowType() methods; the recursive call chain is initiated by DataDisplayLink.prepareData() calls to buildShadowType() methods of MathType sub-classes;
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; ShadowType trees are constructed that 'shadow' the MathType trees of Data to be depicted, via recursive calls to buildShadowType() methods of MathType sub-classes, to DataRenderer.makeShadow*Type() methods, to Shadow*Type constructors, then back to buildShadowType() methods; the recursive call chain is initiated by DataDisplayLink.prepareData() calls to buildShadowType() methods of MathType sub-classes;
 DataShadow prepareAction(boolean go, boolean initialize, DataShadow shadow)
          check if re-transform is needed; if initialize is true then compute ranges for RealTypes and Animation sampling
 void realCheckDirect()
          determine if direct manipulation is feasible for the Data objects rendered by this, and for the ScalarMaps linked to the associated DisplayImpl; "returns" its result by calls to setIsDirectManipulation() called by checkDirect() method of DirectManipulationRendererJ2D and DirectManipulationRendererJ3D, basically just to share code between those two classes
 void release_direct()
          called when mouse button is released ending direct manipulation; intended to be over-ridden by DataRenderer extensions that need to act on this event
 void removeLink(DataDisplayLink link)
          WARNING!
 void set_all_feasible(boolean b)
          set flag indicating whether depiction generation is feasible for all linked Data
 void setDisplay(DisplayImpl d)
          set DisplayImpl associated with this DataRenderer
 void setDisplayRenderer(DisplayRenderer r)
          set DisplayRenderer associated with this DataRenderer
 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)
          save information about relation between earth and display spatial coordinates, IF the arguments do define the relation
 void setEarthSpatialDisplay(CoordinateSystem coord, DisplayTupleType t, DisplayImpl display, int[] indices, float[] default_values, double[] r)
          save information from ShadowType.assembleSpatial() about relation between earth and display spatial coordinates
 void setIsDirectManipulation(boolean b)
          set value of isDirectManipulation flag (indicating whether this DataRenderer supports direct manipulation for its MathType and ScalarMaps)
 void setLastMouseModifiers(int mouseModifiers)
          called by MouseHelper.processEvent() to set LastMouseModifiers
 void setLatLonIndices(int[] indices)
           
 void setLinks(DataDisplayLink[] links)
          set DataDisplayLinks for linked Data, including constructing arrays of booleans associated with DataDisplayLinks; called by setLinks(DataDisplayLink[], DisplayImpl)
abstract  void setLinks(DataDisplayLink[] links, DisplayImpl d)
          set DataDisplayLinks for linked Data, and set associated DisplayImpl
 void setPickCrawlToCursor(boolean b)
          set pickCrawlToCursor flag indicating whether Data points being manipulated should "crawl" toward the cursor instead of jumping to it immediately
 void setSpatialValues(float[][] spatial_values)
          set spatial values for Data depiction; used to detect when direct manipulation mouse selects a point of a Data depiction
 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)
          convert display (x, y, z) to (lat, lon) or (lat, lon, other) values
 void stop_direct()
          discontinue manipulating Data values for current mouse drag; (this only applies to the current mouse drag and is not a general disable)
 void suppressExceptions(boolean suppress)
          set a flag indicating whether to suppress Exceptions generated during doAction()
 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
flag for visibility of Data depictions


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()
construct a DataRenderer

Method Detail

clearExceptions

public void clearExceptions()
clear Vector of Exceptions generated during doAction()


suppressExceptions

public void suppressExceptions(boolean suppress)
set a flag indicating whether to suppress Exceptions generated during doAction()


addException

public void addException(Exception error)
add a BadMappingException or UnimplementedException to Vector of Exceptions generated during doAction()

Parameters:
error - Exception to add

getExceptionVector

public Vector getExceptionVector()
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

Returns:
a Vector of Strings from the BadMappingExceptions and UnimplementedExceptions generated during the last invocation of this DataRenderer's doAction method;

get_all_feasible

public boolean get_all_feasible()
Returns:
flag indicating whether depiction generation is feasible for all linked Data

get_any_changed

public boolean get_any_changed()
Returns:
flag indicating whether any linked Data have changed since last invocation of prepareAction()

get_any_transform_control

public boolean get_any_transform_control()
Returns:
flag indicating whether any Controls associated with ScalarMaps applying to any linked Data have changed and require re-transform

set_all_feasible

public void set_all_feasible(boolean b)
set flag indicating whether depiction generation is feasible for all linked Data

Parameters:
b - value to set in flag

setLinks

public abstract void setLinks(DataDisplayLink[] links,
                              DisplayImpl d)
                       throws VisADException
set DataDisplayLinks for linked Data, and set associated DisplayImpl

Parameters:
links - array of DataDisplayLinks to set
d - associated DisplayImpl to set
Throws:
VisADException - a VisAD error occurred

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)
set DataDisplayLinks for linked Data, including constructing arrays of booleans associated with DataDisplayLinks; called by setLinks(DataDisplayLink[], DisplayImpl)

Parameters:
links - array of DataDisplayLinks to set

getLinks

public DataDisplayLink[] getLinks()
Returns:
an array of DataDisplayLinks to Data objects to be rendered (Data objects are accessed by DataDisplayLink.getData())

getDisplay

public DisplayImpl getDisplay()
Returns:
DisplayImpl associated with this DataRenderer

setDisplay

public void setDisplay(DisplayImpl d)
set DisplayImpl associated with this DataRenderer

Parameters:
d - DisplayImpl to set

getDisplayRenderer

public DisplayRenderer getDisplayRenderer()
Returns:
associated with this DataRenderer

setDisplayRenderer

public void setDisplayRenderer(DisplayRenderer r)
set DisplayRenderer associated with this DataRenderer

Parameters:
r - DisplayRenderer to set

checkAction

public boolean checkAction()
Returns:
flag indicating whether there is any pending need for re-transform for this DataRenderer

prepareAction

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

Parameters:
go - flag indicating that re-transform is required for at least one DataRenderer linked to DisplayImpl
initialize - flag indicating that initialization (i.e., auto-scaling) is required
shadow - DataShadow shared by prepareAction() method of all DataRenderers linked to DisplayImpl
Returns:
DataShadow containing ranges and animation sampling Set (return null if no need for initialization)
Throws:
VisADException - a VisAD error occurred
RemoteException - an RMI error occurred

computeRanges

public DataShadow computeRanges(Data data,
                                ShadowType type,
                                DataShadow shadow)
                         throws VisADException,
                                RemoteException
Compute ranges of values for each RealType in DisplayImpl.RealTypeVector.

Parameters:
data - Data object in which to compute ranges of RealType values
type - ShadowType generated for MathType of data
shadow - DataShadow instance whose contained double[][] array and animation sampling Set are modified according to RealType values in data, and used as return value
Returns:
DataShadow instance containing double[][] array of RealType ranges, and an animation sampling Set
Throws:
VisADException - a VisAD error occurred
RemoteException - an RMI error occurred

clearBranch

public abstract void clearBranch()
clear part of Display scene graph generated by this DataRenderer


doAction

public abstract boolean doAction()
                          throws VisADException,
                                 RemoteException
transform linked Data objects into a scene graph depiction, 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()

Returns:
flag indicating if the transform was done successfully
Throws:
VisADException - a VisAD error occurred
RemoteException - an RMI error occurred

getBadScale

public boolean getBadScale(boolean anyBadMap)
Returns:
flag indicating whether initialization (i.e., auto-scale) is needed on next re-transform

clearScene

public void clearScene()
clear any scene graph created by this DataRenderer, and clear all instance variables


clearAVControls

public void clearAVControls()
clear all information associated with AnimationControls and ValueControls created by this DataRenderer


makeShadowFunctionType

public abstract ShadowType makeShadowFunctionType(FunctionType type,
                                                  DataDisplayLink link,
                                                  ShadowType parent)
                                           throws VisADException,
                                                  RemoteException
factory method for constructing a subclass of ShadowType appropriate for the graphics API, that also adapts ShadowFunctionType; ShadowType trees are constructed that 'shadow' the MathType trees of Data to be depicted, via recursive calls to buildShadowType() methods of MathType sub-classes, to DataRenderer.makeShadow*Type() methods, to Shadow*Type constructors, then back to buildShadowType() methods; the recursive call chain is initiated by DataDisplayLink.prepareData() calls to buildShadowType() methods of MathType sub-classes;

Parameters:
type - FunctionType that returned ShadowType will shadow
link - DataDisplayLink linking Data to be depicted
parent - parent in ShadowType tree structure
Returns:
constructed ShadowType
Throws:
VisADException - a VisAD error occurred
RemoteException - an RMI error occurred

makeShadowRealTupleType

public abstract ShadowType makeShadowRealTupleType(RealTupleType type,
                                                   DataDisplayLink link,
                                                   ShadowType parent)
                                            throws VisADException,
                                                   RemoteException
factory for constructing a subclass of ShadowType appropriate for the graphics API, that also adapts ShadowRealTupleType; ShadowType trees are constructed that 'shadow' the MathType trees of Data to be depicted, via recursive calls to buildShadowType() methods of MathType sub-classes, to DataRenderer.makeShadow*Type() methods, to Shadow*Type constructors, then back to buildShadowType() methods; the recursive call chain is initiated by DataDisplayLink.prepareData() calls to buildShadowType() methods of MathType sub-classes;

Parameters:
type - FunctionType that returned ShadowType will shadow
link - DataDisplayLink linking Data to be depicted
parent - parent in ShadowType tree structure
Returns:
constructed ShadowType
Throws:
VisADException - a VisAD error occurred
RemoteException - an RMI error occurred

makeShadowRealType

public abstract ShadowType makeShadowRealType(RealType type,
                                              DataDisplayLink link,
                                              ShadowType parent)
                                       throws VisADException,
                                              RemoteException
factory for constructing a subclass of ShadowType appropriate for the graphics API, that also adapts ShadowRealType; ShadowType trees are constructed that 'shadow' the MathType trees of Data to be depicted, via recursive calls to buildShadowType() methods of MathType sub-classes, to DataRenderer.makeShadow*Type() methods, to Shadow*Type constructors, then back to buildShadowType() methods; the recursive call chain is initiated by DataDisplayLink.prepareData() calls to buildShadowType() methods of MathType sub-classes;

Parameters:
type - FunctionType that returned ShadowType will shadow
link - DataDisplayLink linking Data to be depicted
parent - parent in ShadowType tree structure
Returns:
constructed ShadowType
Throws:
VisADException - a VisAD error occurred
RemoteException - an RMI error occurred

makeShadowSetType

public abstract ShadowType makeShadowSetType(SetType type,
                                             DataDisplayLink link,
                                             ShadowType parent)
                                      throws VisADException,
                                             RemoteException
factory for constructing a subclass of ShadowType appropriate for the graphics API, that also adapts ShadowSetType; ShadowType trees are constructed that 'shadow' the MathType trees of Data to be depicted, via recursive calls to buildShadowType() methods of MathType sub-classes, to DataRenderer.makeShadow*Type() methods, to Shadow*Type constructors, then back to buildShadowType() methods; the recursive call chain is initiated by DataDisplayLink.prepareData() calls to buildShadowType() methods of MathType sub-classes;

Parameters:
type - FunctionType that returned ShadowType will shadow
link - DataDisplayLink linking Data to be depicted
parent - parent in ShadowType tree structure
Returns:
constructed ShadowType
Throws:
VisADException - a VisAD error occurred
RemoteException - an RMI error occurred

makeShadowTextType

public abstract ShadowType makeShadowTextType(TextType type,
                                              DataDisplayLink link,
                                              ShadowType parent)
                                       throws VisADException,
                                              RemoteException
factory for constructing a subclass of ShadowType appropriate for the graphics API, that also adapts ShadowTextType; ShadowType trees are constructed that 'shadow' the MathType trees of Data to be depicted, via recursive calls to buildShadowType() methods of MathType sub-classes, to DataRenderer.makeShadow*Type() methods, to Shadow*Type constructors, then back to buildShadowType() methods; the recursive call chain is initiated by DataDisplayLink.prepareData() calls to buildShadowType() methods of MathType sub-classes;

Parameters:
type - FunctionType that returned ShadowType will shadow
link - DataDisplayLink linking Data to be depicted
parent - parent in ShadowType tree structure
Returns:
constructed ShadowType
Throws:
VisADException - a VisAD error occurred
RemoteException - an RMI error occurred

makeShadowTupleType

public abstract ShadowType makeShadowTupleType(TupleType type,
                                               DataDisplayLink link,
                                               ShadowType parent)
                                        throws VisADException,
                                               RemoteException
factory for constructing a subclass of ShadowType appropriate for the graphics API, that also adapts ShadowTupleType; ShadowType trees are constructed that 'shadow' the MathType trees of Data to be depicted, via recursive calls to buildShadowType() methods of MathType sub-classes, to DataRenderer.makeShadow*Type() methods, to Shadow*Type constructors, then back to buildShadowType() methods; the recursive call chain is initiated by DataDisplayLink.prepareData() calls to buildShadowType() methods of MathType sub-classes;

Parameters:
type - FunctionType that returned ShadowType will shadow
link - DataDisplayLink linking Data to be depicted
parent - parent in ShadowType tree structure
Returns:
constructed ShadowType
Throws:
VisADException - a VisAD error occurred
RemoteException - an RMI error occurred

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()

Parameters:
control - Control being judged whether it needs re-transform
link - DataDisplayLink possibly involved in decision
Returns:
flag indicating whether re-transform is needed

getLink

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

Returns:
single DataDisplayLink (over-ridden by sub-classes)

isLegalTextureMap

public boolean isLegalTextureMap()
Returns:
flag indicating whether texture mapping is legal for this DataRenderer

getRealVectorTypes

public RealVectorType getRealVectorTypes(int index)
Parameters:
index - 0 or 1 for flow1 and flow2
Returns:
RealVectorType (extends RealTupleType) mapped to flow1 or flow2 (values will be either data_in, data_out or null)

getLatLonIndices

public int[] getLatLonIndices()
Returns:
indices of RealType.Latitude and RealType.Longitude in data_in, data_out, or just spatial value array

setLatLonIndices

public void setLatLonIndices(int[] indices)
Parameters:
indices - indices of RealType.Latitude and RealType.Longitude in data_in, data_out, or just spatial value array

getEarthDimension

public int getEarthDimension()
Returns:
earth dimension, either 2, 3 or -1 (for none)

getEarthUnits

public Unit[] getEarthUnits()
Returns:
Units of earth coordinates used in Data

getLatLonRange

public float getLatLonRange()
Returns:
maximum of display ranges of latitude and longitude

earthToSpatial

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

Parameters:
locs - (lat, lon) or (lat, lon, other) coordinates
vert - vertical flow component (if non-null, used to adjust non-lat/lon spatial_locs
Returns:
display (x, y, z) coordinates
Throws:
VisADException - a VisAD error occurred

earthToSpatial

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

Parameters:
locs - (lat, lon) or (lat, lon, other) coordinates
vert - vertical flow component (if non-null, used to adjust non-lat/lon spatial_locs
base_spatial_locs - saved spatial_locs argument from spatialToEarth() call used to fill in any null members of return array
Returns:
display (x, y, z) coordinates
Throws:
VisADException - a VisAD error occurred

spatialToEarth

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

Parameters:
spatial_locs - display (x, y, z) coordinates
Returns:
(lat, lon) or (lat, lon, other) coordinates
Throws:
VisADException - a VisAD error occurred

spatialToEarth

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

Parameters:
spatial_locs - display (x, y, z) coordinates
base_spatial_locs - float[3][] array used to return member arrays of spatial_locs argument
Returns:
(lat, lon) or (lat, lon, other) coordinates
Throws:
VisADException - a VisAD error occurred

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
save information about relation between earth and display spatial coordinates, IF the arguments do define the relation

Parameters:
s_d_i - candidate shadow_data_in (Shadow of RealTupleType with reference in Data)
s_d_o - candidate shadow_data_out (Shadow of reference RealTupleType in Data)
d_o - candidate data_out (reference RealTupleType in Data)
d_u_o - candidate data_units_out (Units of reference RealTupleType in Data)
d_i - candidate data_in (RealTupleType with reference in Data)
d_c_i - candidate data_coord_in (CoordinateSystems relating data_in to data_out)
d_u_i - candidate data_units_in (Units of RealTupleType with reference in Data)
Throws:
VisADException - a VisAD error occurred

getRanges

public double[] getRanges()
Returns:
array of normalized (i.e., max = 1.0) ranges for spatial ScalarMaps, for flow adjustment

getDisplayCoordinateSystem

public CoordinateSystem getDisplayCoordinateSystem()
Returns:
CoordinateSystem for spatial DisplayTupleType (null if DisplaySpatialCartesianTuple)

setEarthSpatialDisplay

public void setEarthSpatialDisplay(CoordinateSystem coord,
                                   DisplayTupleType t,
                                   DisplayImpl display,
                                   int[] indices,
                                   float[] default_values,
                                   double[] r)
                            throws VisADException
save information from ShadowType.assembleSpatial() about relation between earth and display spatial coordinates

Parameters:
coord - CoordinateSystem for spatial DisplayTupleType (null if DisplaySpatialCartesianTuple)
t - spatial DisplayTupleType
display - the DisplayImpl
indices - indices in display_values array for 3 spatial coordinates
default_values - default values for 3 spatial coordinates
r - double[3] array of normalized (i.e., max = 1.0) ranges for spatial ScalarMaps, for flow adjustment
Throws:
VisADException - a VisAD error occurred

realCheckDirect

public void realCheckDirect()
                     throws VisADException,
                            RemoteException
determine if direct manipulation is feasible for the Data objects rendered by this, and for the ScalarMaps linked to the associated DisplayImpl; "returns" its result by calls to setIsDirectManipulation() called by checkDirect() method of DirectManipulationRendererJ2D and DirectManipulationRendererJ3D, basically just to share code between those two classes

Throws:
VisADException - a VisAD error occurred
RemoteException - an RMI error occurred

getWhyNotDirect

public String getWhyNotDirect()
Returns:
String with reason MathType and ScalarMaps do not qualify for direct manipulation

setSpatialValues

public void setSpatialValues(float[][] spatial_values)
set spatial values for Data depiction; used to detect when direct manipulation mouse selects a point of a Data depiction

Parameters:
spatial_values - float[3][number_of_points] of 3-D locations of depiction points

checkClose

public float checkClose(double[] origin,
                        double[] direction)
find minimum distance from ray to spatialValues; save index of point with minimum distance in closeIndex; reset lastIndex to -1 (Field domain index of Field range value last modified by drag_direct())

Parameters:
origin - 3-D origin of ray
direction - 3-D direction of ray
Returns:
minimum distance of ray to any point in spatialValues (spatial values for Data depiction)

release_direct

public void release_direct()
called when mouse button is released ending direct manipulation; intended to be over-ridden by DataRenderer extensions that need to act on this event


stop_direct

public void stop_direct()
discontinue manipulating Data values for current mouse drag; (this only applies to the current mouse drag and is not a general disable)


getLastMouseModifiers

public int getLastMouseModifiers()
Returns:
value of InputEvent.getModifiers() from most recent direct manipulation mouse click

setLastMouseModifiers

public void setLastMouseModifiers(int mouseModifiers)
called by MouseHelper.processEvent() to set LastMouseModifiers

Parameters:
mouseModifiers - value of InputEvent.getModifiers() from last direct manipulation mouse click

drag_direct

public void drag_direct(VisADRay ray,
                        boolean first,
                        int mouseModifiers)
modify Data values based on direct manipulation mouse actions

Parameters:
ray - 3-D graphics coordinates of ray corresponding to mouse screen location
first - flag if this is first call (for MouseEvent.MOUSE_PRESSED, not for MouseEvent.MOUSE_DRAGGED)
mouseModifiers - value of InputEvent.getModifiers() from most recent direct manipulation mouse click

constrainDragPoint

public void constrainDragPoint(float[] dragPoint)
jeffmc: new method that provides a hook so derived classes can easily constrain the position of a drag point

Parameters:
dragPoint - The position of the drag point

addPoint

public void addPoint(float[] x)
              throws VisADException
add point for temporary rendering; intended to be over-ridden by graphics-API-specific extensions of DataRenderer

Parameters:
x - 3-D graphics coordinates of point to render
Throws:
VisADException - a VisAD error occurred

checkDirect

public void checkDirect()
                 throws VisADException,
                        RemoteException
set isDirectManipulation = true if this DataRenderer supports direct manipulation for the MathType of its linked Data, and for its ScalarMaps; intended to be over-ridden by extensions of DataRenderer

Throws:
VisADException - a VisAD error occurred
RemoteException - an RMI error occurred

setIsDirectManipulation

public void setIsDirectManipulation(boolean b)
set value of isDirectManipulation flag (indicating whether this DataRenderer supports direct manipulation for its MathType and ScalarMaps)

Parameters:
b - value to set in isDirectManipulation

getIsDirectManipulation

public boolean getIsDirectManipulation()
Returns:
value of isDirectManipulation flag (indicating whether this DataRenderer supports direct manipulation for its MathType and ScalarMaps)

setPickCrawlToCursor

public void setPickCrawlToCursor(boolean b)
set pickCrawlToCursor flag indicating whether Data points being manipulated should "crawl" toward the cursor instead of jumping to it immediately

Parameters:
b - value to set in pickCrawlToCursor

getPickCrawlToCursor

public boolean getPickCrawlToCursor()
Returns:
pickCrawlToCursor flag indicating whether Data points being manipulated 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
find intersection of a ray and a 2-D manifold, using Newton's method

Parameters:
first - flag requesting to generate a first guess ray position by brute force search
origin - 3-D graphics coordinates of ray origin
direction - 3-D graphics coordinates of ray direction
tuple - spatial DisplayTupleType used to define 2-D manifold (manifold is defined by fixing value of one component of 3-D tuple)
otherindex - index of tuple component to be fixed
othervalue - value at which to fix otherindex tuple component
Returns:
parameter of point along ray of ray-manifold intersection (point = origin + parameter * direction)
Throws:
VisADException - a VisAD error occurred

removeLink

public void removeLink(DataDisplayLink link)
WARNING! Do NOT use this routine unless you know what you are doing! remove link from Links[] array when remote connection fails

Parameters:
link - DataDisplayLink to remove

clone

public abstract Object clone()
                      throws CloneNotSupportedException
Overrides:
clone in class Object
Returns:
a copy of this DataRenderer
Throws:
CloneNotSupportedException