ucar.visad.display
Class FlowDisplayable

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.FlowDisplayable
All Implemented Interfaces:
GridDisplayable
Direct Known Subclasses:
WindBarbDisplayable

public class FlowDisplayable
extends RGBDisplayable
implements GridDisplayable

Provides support for a Displayable displays wind data (u,v) or (spd, dir) as wind vectors.

Version:
$Revision: 1.40 $
Author:
Don Murray

Field Summary
static String COLOR
          The name of the color property.
static String FLOW_TYPE
          The name of the "real-type" property.
static int NH_ORIENTATION
          Value for Northern Hemisphere orientation
static int SH_ORIENTATION
          Value for Southern Hemisphere orientation
 
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 FlowDisplayable(FlowDisplayable that)
          Constructs from another instance.
  FlowDisplayable(String name, RealTupleType rTT)
          Constructs from a name for the Displayable and the type of the parameter.
  FlowDisplayable(String name, RealTupleType rTT, float flowscale)
          Constructs from a name for the Displayable and the type of the parameter, and the desired size of "scale"
 
Method Summary
 Displayable cloneForDisplay()
          Returns a clone of this instance suitable for another VisAD display.
 boolean get3DFlow()
          Check to see if this is 3D flow
 boolean getAdjustFlow()
          Returns indicator whether the flow should be adjusted to the earth
 int getBarbOrientation()
          Returns indicator whether wind barb style is that used in the northern hemisphere or the southern hemisphere.
 RealTupleType getFlowTuple()
          Returns the RealTupleType of the parameter.
 boolean getStreamlinesEnabled()
          Returns boolean whether streamlines are enabled.
 boolean isCartesianWind()
          Check to see if the wind data is cartesian (u,v) or if it's polar (spd, dir).
 void loadData(FieldImpl field)
          Set the data into the Displayable
 void set3DFlow(boolean threeD)
          Set to use 3D flow
 void setAdjustFlow(boolean adjust)
          Set indicator whether winds should be adusted or not
 void setBarbOrientation(int style)
          Set indicator whether wind barb style is that used in the northern hemisphere or the southern hemisphere.
 void setColor(Color color)
          Sets the color of the vectors.
 void setColoredByAnother(boolean yesno)
          Set whether this GridDisplayable should have the data colored by another parameter.
protected  void setFlowMaps()
          Make ScalarMaps for flow, for 1st and 2nd components of wind vector input data.
 void setFlowRange(double min, double max)
          Set the range of the flow maps
 void setFlowRange(Range flowRange)
          Set the range of the flow maps
 void setFlowScale(float scale)
          Set the length of shaft on vector or on wind barb.
 void setGrid3D(FieldImpl field)
          Set the 3d grid (a FlatField) data into the Displayable
protected  void setScalarMaps(ScalarMapSet maps)
          Sets the set of ScalarMap-s of this instance.
 void setStreamlineDensity(float density)
          Set the density of the streamlines
 void setStreamlinesEnabled(boolean enable)
          Sets whether streamlines are enabled.
protected  void setType(RealTupleType rTT)
          Sets the RealType of the parameter.
protected  boolean useDisplayUnitForColor()
          Does this object use the displayUnit (or the colorUnit) for its display unit.
 
Methods inherited from class ucar.visad.display.RGBDisplayable
getAutoScaleColorRange, getColorPalette, getCurvedSize, getPolygonMode, getRangeforColor, getRangeForColor, getRGBRealType, getSelectRealType, getUseRGBTypeForSelect, hasRange, hasSelectedRange, makeCurvedSizeMap, setAutoScaleColorRange, setColorPalette, setColorUnit, setCurvedSize, setDisplayUnit, setGreyPalette, setPolygonMode, setRange, setRangeForColor, setRangeForSelect, setRGBRealType, setSelectedRange, setSelectRealType, setUseRGBTypeForSelect, setVisADPalette
 
Methods inherited from class ucar.visad.display.DisplayableData
addAction, dataChange, destroy, getActive, getAnimationSet, getData, getDataRenderer, getLineWidth, getName, getPointSize, hasData, hasDataObject, isManipulable, isPickable, myAddConstantMaps, 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, 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
 

Field Detail

FLOW_TYPE

public static final String FLOW_TYPE
The name of the "real-type" property.

See Also:
Constant Field Values

COLOR

public static String COLOR
The name of the color property.


NH_ORIENTATION

public static final int NH_ORIENTATION
Value for Northern Hemisphere orientation

See Also:
Constant Field Values

SH_ORIENTATION

public static final int SH_ORIENTATION
Value for Southern Hemisphere orientation

See Also:
Constant Field Values
Constructor Detail

FlowDisplayable

public FlowDisplayable(String name,
                       RealTupleType rTT,
                       float flowscale)
                throws VisADException,
                       RemoteException
Constructs from a name for the Displayable and the type of the parameter, and the desired size of "scale"

Parameters:
name - The name for the displayable.
flowscale - A float size for the "flow scale".
rTT - The VisAD RealTupleType of the parameter. May be null.
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

FlowDisplayable

public FlowDisplayable(String name,
                       RealTupleType rTT)
                throws VisADException,
                       RemoteException
Constructs from a name for the Displayable and the type of the parameter.

Parameters:
name - The name for the displayable.
rTT - The VisAD RealTupleType of the parameter. May be null.
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

FlowDisplayable

protected FlowDisplayable(FlowDisplayable that)
                   throws VisADException,
                          RemoteException
Constructs from another instance.

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

getFlowTuple

public RealTupleType getFlowTuple()
Returns the RealTupleType of the parameter.

Returns:
The RealTupleType of the parameter. May be null.

getStreamlinesEnabled

public boolean getStreamlinesEnabled()
Returns boolean whether streamlines are enabled.

Returns:
boolean whether streamlines are enabled.

setStreamlinesEnabled

public void setStreamlinesEnabled(boolean enable)
Sets whether streamlines are enabled.

Parameters:
enable - boolean whether streamlines are enabled.

getBarbOrientation

public int getBarbOrientation()
Returns indicator whether wind barb style is that used in the northern hemisphere or the southern hemisphere.

Returns:
NH_ORIENTATION or SH_ORIENTATION

setBarbOrientation

public void setBarbOrientation(int style)
Set indicator whether wind barb style is that used in the northern hemisphere or the southern hemisphere.

Parameters:
style - either NH_ORIENTATION or SH_ORIENTATION.

getAdjustFlow

public boolean getAdjustFlow()
Returns indicator whether the flow should be adjusted to the earth

Returns:
true to adjust

setAdjustFlow

public void setAdjustFlow(boolean adjust)
Set indicator whether winds should be adusted or not

Overrides:
setAdjustFlow in class Displayable
Parameters:
adjust - true to adjust

setStreamlineDensity

public void setStreamlineDensity(float density)
Set the density of the streamlines

Parameters:
density - typically roughly .1 to 2.

setFlowScale

public void setFlowScale(float scale)
Set the length of shaft on vector or on wind barb.

Parameters:
scale - typically roughly 0.05 to 0.15.

setScalarMaps

protected void setScalarMaps(ScalarMapSet maps)
                      throws BadMappingException
Sets the set of ScalarMap-s of this instance. The ScalarMap-s of this instance will be added to the set before the SCALAR_MAP_SET property is set. This method fires a PropertyChangeEvent for SCALAR_MAP_SET with null for the old value and the new set of ScalarMap-s for the new Value. Intermediate subclasses that have their own ScalarMap-s should override this method and invoke super.setScalarMaps(ScalarMapSet).

Overrides:
setScalarMaps in class RGBDisplayable
Parameters:
maps - The set of ScalarMap-s to be added.
Throws:
BadMappingException - The types of the maps have not been set or its ScalarMap is already in the set.

setFlowMaps

protected void setFlowMaps()
                    throws RemoteException,
                           VisADException
Make ScalarMaps for flow, for 1st and 2nd components of wind vector input data. If data is of form u,v (both components have units convertible with m/s) make map for 1st comp to Display.Flow1X and 2nd comp to Display.Flow1Y. If data is dir,spd or spd, dir, make map for dir comp to Display.Flow1Azimuth and spd comp to Display.Flow1Radial. Note - makes bad plot if data is v,u form

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

setFlowRange

public void setFlowRange(Range flowRange)
                  throws VisADException,
                         RemoteException
Set the range of the flow maps

Parameters:
flowRange - range for flow maps
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

setFlowRange

public void setFlowRange(double min,
                         double max)
                  throws VisADException,
                         RemoteException
Set the range of the flow maps

Parameters:
min - min value
max - max value
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

setGrid3D

public void setGrid3D(FieldImpl field)
               throws VisADException,
                      RemoteException
Set the 3d grid (a FlatField) data into the Displayable

Parameters:
field - a VisAD FlatField with a 3D 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

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

setColor

public void setColor(Color color)
              throws VisADException,
                     RemoteException
Sets the color of the vectors. Only overrides super.setColor to fire the property change event for backward compatibility.

Overrides:
setColor in class RGBDisplayable
Parameters:
color - color for the vectors.
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

setType

protected void setType(RealTupleType rTT)
                throws RemoteException,
                       VisADException
Sets the RealType of the parameter.

Parameters:
rTT - The new RealTupleType of the parameter. May not be null.
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

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.

isCartesianWind

public boolean isCartesianWind()
Check to see if the wind data is cartesian (u,v) or if it's polar (spd, dir).

Returns:
true if the wind is cartesian

get3DFlow

public boolean get3DFlow()
Check to see if this is 3D flow

Returns:
true if the flow is 3D

set3DFlow

public void set3DFlow(boolean threeD)
Set to use 3D flow

Parameters:
threeD - true if the flow is 3D

useDisplayUnitForColor

protected boolean useDisplayUnitForColor()
Does this object use the displayUnit (or the colorUnit) for its display unit. If we have the case where this wind field is colored by another field then this returns false.

Overrides:
useDisplayUnitForColor in class RGBDisplayable
Returns:
true if the display unit should be used for color

setColoredByAnother

public void setColoredByAnother(boolean yesno)
Set whether this GridDisplayable should have the data colored by another parameter.

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