ucar.unidata.view.geoloc
Class TransectDisplay

java.lang.Object
  extended by ucar.visad.display.DisplayMaster
      extended by ucar.unidata.view.geoloc.NavigatedDisplay
          extended by ucar.unidata.view.geoloc.TransectDisplay
All Implemented Interfaces:
EventListener, ControlListener, DisplayListener

public class TransectDisplay
extends NavigatedDisplay
implements DisplayListener, ControlListener

Provides a navigated globe for displaying meteorological data. Any displayable data must be able to map to RealType.Latitude, RealType.Longitude and/or RealType.Altitude.

Version:
$Revision: 1.41 $ $Date: 2007/08/09 20:46:19 $
Author:
Don Murray

Nested Class Summary
protected  class TransectDisplay.TransectCoordinateSystem
          Class for converting from lat/lon/alt to xyz
 
Nested classes/interfaces inherited from class ucar.unidata.view.geoloc.NavigatedDisplay
NavigatedDisplay.VerticalMapSet
 
Field Summary
static String[] DEFAULT_PRESSURE_LABELS
          default pressure labels
static float DEFAULT_Z
          default z value
 
Fields inherited from class ucar.unidata.view.geoloc.NavigatedDisplay
BOTTOM_VIEW, BOTTOM_VIEW_NAME, CURSOR_ALTITUDE, CURSOR_LATITUDE, CURSOR_LONGITUDE, EAST_VIEW, EAST_VIEW_NAME, MODE_2D, MODE_2Din3D, MODE_3D, NORTH_VIEW, NORTH_VIEW_NAME, SOUTH_VIEW, SOUTH_VIEW_NAME, TOP_VIEW, TOP_VIEW_NAME, WEST_VIEW, WEST_VIEW_NAME
 
Fields inherited from class ucar.visad.display.DisplayMaster
behavior, defaultMouseFunctions, log_, POINT_MODE
 
Constructor Summary
TransectDisplay()
          Constructs a new TransectDisplay to display data as an XY plot along a lat/lon transect.
TransectDisplay(Gridded2DSet line)
          Constructs a new TransectDisplay to display data as an XY plot along a lat/lon transect.
TransectDisplay(Gridded2DSet line, boolean offscreen, Dimension dimension)
          Constructs a new TransectDisplay to display data as an XY plot along a lat/lon transect.
 
Method Summary
 void addKeyboardBehavior(KeyboardBehavior behavior)
          Add a keyboard behavior for this display
 void addVerticalMap(RealType newVertType)
          Add a new mapping of this type to the vertical coordinate
 void controlChanged(ControlEvent ce)
          Handle a change to the control
protected  void cursorChange()
          Handles a change to the cursor position.
protected  void cursorMoved()
          Handles a change to the cursor position.
 void displayChanged(DisplayEvent event)
          Handle a DisplayEvent
 void enableClipping(boolean clip)
          Enable clipping of data at the scale edges
 void extendTransect(double amount)
          Extend (or condense) the displayed transect.
 void extendVerticalRange(double amount)
          Extend (or condense) the displayed transect.
protected  ScalarMap getAltitudeMap()
          Accessor method for the ScalarMap for Altitude
 DisplayRealType getDisplayAltitudeType()
          Accessor method for the DisplayAltitudeType
 CoordinateSystem getDisplayCoordinateSystem()
          Get the display coordinate system that turns lat/lon/alt to x/y/z
 DisplayRealType getDisplayLatitudeType()
          Accessor method for the DisplayLatitudeType
 DisplayRealType getDisplayLongitudeType()
          Accessor method for the DisplayLongitudeType
 DisplayTupleType getDisplayTupleType()
          Accessor method for the DisplayTupleType.
 EarthLocation getEarthLocation(double x, double y, double z, boolean setZToZeroIfOverhead)
          Get the earth location from the VisAD xyz coodinates
 Unit getHorizontalRangeUnit()
          Get the Unit of the horizontal range
 Real getMaxDataDistance()
          Set the maximum distance away from the transect for data to be displayed.
 EarthLocation[] getScaleEndPoints()
          Get the scale end points
 boolean getScalesVisible()
          Get the box visibility.
 RealTuple getSpatialCoordinates(EarthLocation el)
          Returns the spatial (XYZ) coordinates of the particular EarthLocation
 double[] getSpatialCoordinates(EarthLocation el, double[] xyz)
          Returns the spatial (XYZ) coordinates of the particular EarthLocation
 boolean getStereoAvailable()
          Determine if this MapDisplay can do stereo.
protected  Gridded2DSet getTransect()
          Get the transect for this display
 double[] getVerticalRange()
          Get the range of the vertical coordinate (Altitude)
 double[][] getXAxisEndPoints()
          Get the coordinates of the left and right ends of the the horizontal axis.
 double[][] getYAxisEndPoints()
          Get the coordinates of the left and right ends of the the horizontal axis.
protected  void initializeClass()
          Initialize the class.
static void main(String[] args)
          test by running java ucar.unidata.view.geoloc.NavigatedDisplay
protected  void pointerMoved(int x, int y)
          Handles a change in the position of the mouse-pointer.
 void removeVerticalMap(RealType vertType)
          Remove a new mapping of this type to the vertical coordinate
 void setDisplayAspect(double[] aspect)
          Override super method
 void setGridLinesVisible(boolean on)
          Set the visibility of the axis grid lines.
 void setHorizontalRangeUnit(Unit newUnit)
          Set the Unit of the horizontal range
 void setMapArea(ucar.unidata.geoloc.ProjectionRect mapArea)
          Set the map area to be displayed in the box.
 void setMapProjection(MapProjection mapProjection)
          Define the map projection using a MapProjection type CoordinateSystem.
 void setMapRegion(Gridded2DSet region)
          Set the map region to be displayed.
 void setMaxDataDistance(double distance)
          Set the maximum distance away from the transect for data to be displayed.
 void setMaxDataDistance(Real r)
          Set the maximum distance away from the transect for data to be displayed.
 void setPerspectiveView(boolean perspective)
          Set the view to perspective or parallel if this is a 3D display.
 void setPressureLabels(String[] labels)
          Set the labels for the pressure axis
 void setScaleFont(Font f)
          Set the fonts for the axis scales
 void setTransect(Gridded2DSet newLine)
          Set the transect for this display
 void setVerticalRange(double min, double max)
          Set the range of the vertical coordinate
 void setVerticalRangeUnit(Unit newUnit)
          Set the Unit of the vertical range
 void setView(int view)
          Set the view for 3D.
 
Methods inherited from class ucar.unidata.view.geoloc.NavigatedDisplay
animateMatrix, center, center, center, center, centerAndZoom, centerAndZoomTo, enableRubberBanding, flythrough, getAnimationStringOn, getAutoRotate, getBottomViewName, getBoxVisible, getCenterPoint, getCursorAltitude, getCursorLatitude, getCursorLongitude, getDisplayMode, getEarthLocation, getEarthLocation, getEarthLocation, getEastViewName, getIsAnimating, getLatLonBox, getLatLonRect, getNavigationToolBar, getNorthViewName, getRay, getRayDirection, getRayPositionAtZ, getRubberBandBox, getScaledValue, getScreenCenter, getScreenCoordinates, getScreenCoordinates, getScreenLowerLeft, getScreenLowerRight, getScreenUpperLeft, getScreenUpperRight, getSouthViewName, getSpatialCoordinatesFromScreen, getSpatialCoordinatesFromScreen, getTopViewName, getVerticalRangeUnit, getVisadBox, getWestViewName, init, isClippingEnabled, isPerspectiveView, moveToScreen, moveToScreen, moveToScreen, rotateView, rotateView, setAnimationStringOn, setAutoRotate, setBoxVisible, setCursorAltitude, setCursorLatitude, setCursorLongitude, setCursorStringOn, setForeground, setMapProjection, setRotateDelay, setRubberBandBox, setScalesVisible, setVerticalMapUnit, updateLocation
 
Methods inherited from class ucar.visad.display.DisplayMaster
addDisplayable, addDisplayListener, addPropertyChangeListener, addPropertyChangeListener, addScalarMap, addScalarMaps, addVetoableChangeListener, addVetoableChangeListener, buildAnimationSet, dataChange, destroy, draw, ensureInactive, equals, finalize, firePropertyChange, firePropertyChange, getAnimationSetFromDisplayables, getAnimationStringVisible, getBackground, getComponent, getDisplay, getDisplayableCount, getDisplayables, getDisplayables, getDisplayAspect, getDisplayComponent, getForeground, getImage, getMouseBehavior, getOffscreenDimension, getProjectionMatrix, getSavedProjectionMatrix, getScreenBounds, getWaitMessageVisible, handleMouseWheelMoved, hashCode, indexOf, init, is3D, isActive, isPointMode, printMatrix, printMe, rebuild, rebuildDisplay, reDisplayAll, removeDisplayable, removeDisplayables, removePropertyChangeListener, removePropertyChangeListener, removeScalarMap, removeScalarMaps, removeVetoableChangeListener, removeVetoableChangeListener, replaceScalarMap, reScale, resetMouseFunctions, resetProjection, rotate, rotateX, rotateY, rotateZ, saveCurrentDisplay, saveCurrentDisplay, saveCurrentDisplay, saveProjection, setActive, setAnimation, setAnimationStringVisible, setBackground, setDefaultMouseFunctions, setDisplayables, setDisplayables, setDisplayActive, setDisplayInactive, setEyePosition, setKeyboardBehavior, setKeyboardEventMap, setKeyboardEventMap, setMouseFunctions, setOffscreenDimension, setPointMode, setProjectionMatrix, setRebuildNecessary, setWaitMessageVisible, setWheelEventMap, translate, zoom, zoom
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_Z

public static final float DEFAULT_Z
default z value

See Also:
Constant Field Values

DEFAULT_PRESSURE_LABELS

public static String[] DEFAULT_PRESSURE_LABELS
default pressure labels

Constructor Detail

TransectDisplay

public TransectDisplay()
                throws VisADException,
                       RemoteException
Constructs a new TransectDisplay to display data as an XY plot along a lat/lon transect. The transect can have multiple segments.

Throws:
VisADException - Couldn't create necessary VisAD object
RemoteException - Couldn't create a remote object

TransectDisplay

public TransectDisplay(Gridded2DSet line)
                throws VisADException,
                       RemoteException
Constructs a new TransectDisplay to display data as an XY plot along a lat/lon transect. The transect can have multiple segments.

Parameters:
line - the lat/lon transect line
Throws:
VisADException - Couldn't create necessary VisAD object
RemoteException - Couldn't create a remote object

TransectDisplay

public TransectDisplay(Gridded2DSet line,
                       boolean offscreen,
                       Dimension dimension)
                throws VisADException,
                       RemoteException
Constructs a new TransectDisplay to display data as an XY plot along a lat/lon transect. The transect can have multiple segments.

Parameters:
line - the lat/lon transect line
offscreen - true if offscreen
dimension - Dimension of the screen
Throws:
VisADException - Couldn't create necessary VisAD object
RemoteException - Couldn't create a remote object
Method Detail

initializeClass

protected void initializeClass()
                        throws VisADException,
                               RemoteException
Initialize the class.

Overrides:
initializeClass in class NavigatedDisplay
Throws:
RemoteException - Java RMI problem
VisADException - VisAD problem

getScaleEndPoints

public EarthLocation[] getScaleEndPoints()
Get the scale end points

Returns:
the end points of the scale

addKeyboardBehavior

public void addKeyboardBehavior(KeyboardBehavior behavior)
Add a keyboard behavior for this display

Overrides:
addKeyboardBehavior in class DisplayMaster
Parameters:
behavior - behavior to add

displayChanged

public void displayChanged(DisplayEvent event)
                    throws VisADException,
                           RemoteException
Handle a DisplayEvent

Specified by:
displayChanged in interface DisplayListener
Parameters:
event - event to handle
Throws:
RemoteException - Java RMI problem
VisADException - VisAD problem

controlChanged

public void controlChanged(ControlEvent ce)
Handle a change to the control

Specified by:
controlChanged in interface ControlListener
Parameters:
ce - ControlEvent

cursorMoved

protected void cursorMoved()
                    throws VisADException,
                           RemoteException
Handles a change to the cursor position.

Overrides:
cursorMoved in class NavigatedDisplay
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

pointerMoved

protected void pointerMoved(int x,
                            int y)
                     throws UnitException,
                            VisADException,
                            RemoteException
Handles a change in the position of the mouse-pointer.

Overrides:
pointerMoved in class NavigatedDisplay
Parameters:
x - x mouse position
y - y mouse position
Throws:
RemoteException - Java RMI problem
UnitException - Unit conversion problem
VisADException - VisAD problem

addVerticalMap

public void addVerticalMap(RealType newVertType)
                    throws VisADException,
                           RemoteException
Add a new mapping of this type to the vertical coordinate

Overrides:
addVerticalMap in class NavigatedDisplay
Parameters:
newVertType - RealType of map
Throws:
RemoteException - Java RMI problem
VisADException - VisAD problem

removeVerticalMap

public void removeVerticalMap(RealType vertType)
                       throws VisADException,
                              RemoteException
Remove a new mapping of this type to the vertical coordinate

Overrides:
removeVerticalMap in class NavigatedDisplay
Parameters:
vertType - RealType of map
Throws:
RemoteException - Java RMI problem
VisADException - VisAD problem

setVerticalRangeUnit

public void setVerticalRangeUnit(Unit newUnit)
                          throws VisADException,
                                 RemoteException
Set the Unit of the vertical range

Overrides:
setVerticalRangeUnit in class NavigatedDisplay
Parameters:
newUnit - unit of range
Throws:
RemoteException - Java RMI problem
VisADException - VisAD problem

setVerticalRange

public void setVerticalRange(double min,
                             double max)
                      throws VisADException,
                             RemoteException
Set the range of the vertical coordinate

Overrides:
setVerticalRange in class NavigatedDisplay
Parameters:
min - minimum value for vertical axis
max - maximum value for vertical axis
Throws:
RemoteException - Java RMI problem
VisADException - VisAD problem

getVerticalRange

public double[] getVerticalRange()
Get the range of the vertical coordinate (Altitude)

Overrides:
getVerticalRange in class NavigatedDisplay
Returns:
array of {min, max} range.

setHorizontalRangeUnit

public void setHorizontalRangeUnit(Unit newUnit)
                            throws VisADException,
                                   RemoteException
Set the Unit of the horizontal range

Parameters:
newUnit - unit of range
Throws:
RemoteException - Java RMI problem
VisADException - VisAD problem

getHorizontalRangeUnit

public Unit getHorizontalRangeUnit()
Get the Unit of the horizontal range

Returns:
unit of horizontal range

setMaxDataDistance

public void setMaxDataDistance(Real r)
                        throws VisADException
Set the maximum distance away from the transect for data to be displayed.

Parameters:
r - value of distance
Throws:
VisADException - incompatible unit

setMaxDataDistance

public void setMaxDataDistance(double distance)
                        throws VisADException
Set the maximum distance away from the transect for data to be displayed.

Parameters:
distance - distance in horizontal range units
Throws:
VisADException - unable to create the VisAD object or incompatible units.

getMaxDataDistance

public Real getMaxDataDistance()
Set the maximum distance away from the transect for data to be displayed.

Returns:
the maximum distance

setGridLinesVisible

public void setGridLinesVisible(boolean on)
                         throws VisADException,
                                RemoteException
Set the visibility of the axis grid lines.

Parameters:
on - true if the grid lines should be visible
Throws:
VisADException - Couldn't create the necessary VisAD object
RemoteException - If there was a problem making this change in a remote collaborative display.

getScalesVisible

public boolean getScalesVisible()
Get the box visibility.

Overrides:
getScalesVisible in class NavigatedDisplay
Returns:
true if box is visible, otherwise false.

setMapArea

public void setMapArea(ucar.unidata.geoloc.ProjectionRect mapArea)
                throws VisADException,
                       RemoteException
Set the map area to be displayed in the box. Does nothing at this point.

Overrides:
setMapArea in class NavigatedDisplay
Parameters:
mapArea - ProjectionRect describing the map area to be displayed
Throws:
VisADException - invalid navigation or VisAD error
RemoteException - Couldn't create a remote object

setMapRegion

public void setMapRegion(Gridded2DSet region)
                  throws VisADException,
                         RemoteException
Set the map region to be displayed. The MathType of the domain of the set must be either RealTupleType.SpatialCartesian2DTuple, RealTupleType.SpatialEarth2DTuple, or RealTupleType.LatitudeLongitudeTuple.

Parameters:
region - Gridded2DSet containing the range of for the axis.
Throws:
VisADException - invalid domain or null set
RemoteException - Couldn't create a remote object

setMapProjection

public void setMapProjection(MapProjection mapProjection)
                      throws VisADException,
                             RemoteException
Define the map projection using a MapProjection type CoordinateSystem. Implementation will be subclass dependent.

Specified by:
setMapProjection in class NavigatedDisplay
Parameters:
mapProjection - map projection coordinate system
Throws:
VisADException - Unable to set projection
RemoteException - Couldn't create a remote object

getDisplayLatitudeType

public DisplayRealType getDisplayLatitudeType()
Accessor method for the DisplayLatitudeType

Specified by:
getDisplayLatitudeType in class NavigatedDisplay
Returns:
DisplayRealType for Latitude mapping

getDisplayLongitudeType

public DisplayRealType getDisplayLongitudeType()
Accessor method for the DisplayLongitudeType

Specified by:
getDisplayLongitudeType in class NavigatedDisplay
Returns:
DisplayRealType for Longitude mapping

getDisplayAltitudeType

public DisplayRealType getDisplayAltitudeType()
Accessor method for the DisplayAltitudeType

Specified by:
getDisplayAltitudeType in class NavigatedDisplay
Returns:
DisplayRealType for Altitude mapping

getDisplayTupleType

public DisplayTupleType getDisplayTupleType()
Accessor method for the DisplayTupleType.

Returns:
the tuple of DisplayRealTypes

getAltitudeMap

protected ScalarMap getAltitudeMap()
Accessor method for the ScalarMap for Altitude

Specified by:
getAltitudeMap in class NavigatedDisplay
Returns:
the altitude ScalarMap

getTransect

protected Gridded2DSet getTransect()
Get the transect for this display

Returns:
the transect as a list of points

setTransect

public void setTransect(Gridded2DSet newLine)
                 throws VisADException,
                        RemoteException
Set the transect for this display

Parameters:
newLine - the transect as a rectangle
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

cursorChange

protected void cursorChange()
                     throws VisADException,
                            RemoteException
Handles a change to the cursor position.

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

setView

public void setView(int view)
Set the view for 3D. The views are based on the original display as follows:
                        NORTH
                      _________
                    W |       | E
                    E |  TOP  | A
                    S | MOTTOB| S
                    T |_______| T
                        SOUTH
 

Specified by:
setView in class NavigatedDisplay
Parameters:
view - one of the static view fields (NORTH_VIEW, SOUTH_VIEW, .. etc). In this display, NORTH is the Western Hemisphere, SOUTH is the Eastern Hemisphere, EAST is the Pacific region and WEST is the Atlantic Region

enableClipping

public void enableClipping(boolean clip)
Enable clipping of data at the scale edges

Overrides:
enableClipping in class NavigatedDisplay
Parameters:
clip - true to turn clipping on, otherwise off

getXAxisEndPoints

public double[][] getXAxisEndPoints()
Get the coordinates of the left and right ends of the the horizontal axis.

Returns:
axis points [left/right][x/y]

getYAxisEndPoints

public double[][] getYAxisEndPoints()
Get the coordinates of the left and right ends of the the horizontal axis.

Returns:
axis points [left/right][x/y]

setDisplayAspect

public void setDisplayAspect(double[] aspect)
                      throws VisADException,
                             RemoteException
Override super method

Overrides:
setDisplayAspect in class DisplayMaster
Parameters:
aspect - the new aspect
Throws:
RemoteException - Java RMI problem
VisADException - VisAD problem

setPerspectiveView

public void setPerspectiveView(boolean perspective)
Set the view to perspective or parallel if this is a 3D display.

Overrides:
setPerspectiveView in class NavigatedDisplay
Parameters:
perspective - true for perspective view

getEarthLocation

public EarthLocation getEarthLocation(double x,
                                      double y,
                                      double z,
                                      boolean setZToZeroIfOverhead)
Get the earth location from the VisAD xyz coodinates

Specified by:
getEarthLocation in class NavigatedDisplay
Parameters:
x - x
y - y
z - z
setZToZeroIfOverhead - If in the overhead view then set Z to 0
Returns:
corresponding EarthLocation

getSpatialCoordinates

public RealTuple getSpatialCoordinates(EarthLocation el)
Returns the spatial (XYZ) coordinates of the particular EarthLocation

Specified by:
getSpatialCoordinates in class NavigatedDisplay
Parameters:
el - earth location to transform
Returns:
RealTuple of display coordinates.

getSpatialCoordinates

public double[] getSpatialCoordinates(EarthLocation el,
                                      double[] xyz)
                               throws VisADException,
                                      RemoteException
Returns the spatial (XYZ) coordinates of the particular EarthLocation

Specified by:
getSpatialCoordinates in class NavigatedDisplay
Parameters:
el - earth location to transform
xyz - The in value to set. May be null.
Returns:
xyz array
Throws:
RemoteException - Java RMI problem
VisADException - VisAD problem

getStereoAvailable

public boolean getStereoAvailable()
Determine if this MapDisplay can do stereo.

Overrides:
getStereoAvailable in class DisplayMaster
Returns:
true if the graphics device can do stereo

getDisplayCoordinateSystem

public CoordinateSystem getDisplayCoordinateSystem()
Get the display coordinate system that turns lat/lon/alt to x/y/z

Overrides:
getDisplayCoordinateSystem in class NavigatedDisplay
Returns:
the coordinate system (may be null)

setScaleFont

public void setScaleFont(Font f)
Set the fonts for the axis scales

Parameters:
f - Font to use

extendTransect

public void extendTransect(double amount)
Extend (or condense) the displayed transect.

Parameters:
amount - (%) to extend or contract > 1 to expand, < 1 to contract

extendVerticalRange

public void extendVerticalRange(double amount)
Extend (or condense) the displayed transect.

Parameters:
amount - (%) to extend or contract > 1 to expand, < 1 to contract

setPressureLabels

public void setPressureLabels(String[] labels)
                       throws VisADException
Set the labels for the pressure axis

Parameters:
labels - array of labels
Throws:
VisADException - unable to set the labels on the Axis

main

public static void main(String[] args)
                 throws Exception
test by running java ucar.unidata.view.geoloc.NavigatedDisplay

Parameters:
args - not used
Throws:
Exception - problem creating the display