ucar.unidata.view.geoloc
Class GlobeDisplay

java.lang.Object
  extended by ucar.visad.display.DisplayMaster
      extended by ucar.unidata.view.geoloc.NavigatedDisplay
          extended by ucar.unidata.view.geoloc.GlobeDisplay

public class GlobeDisplay
extends NavigatedDisplay

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

Version:
$Revision: 1.49 $ $Date: 2007/07/31 15:11:25 $
Author:
Don Murray

Nested Class Summary
 
Nested classes/interfaces inherited from class ucar.unidata.view.geoloc.NavigatedDisplay
NavigatedDisplay.VerticalMapSet
 
Field Summary
static String BOTTOM_VIEW_NAME
          Bottom View name
static double EARTH_RADIUS
          Earth Radius (m)
static String EAST_VIEW_NAME
          East View name
static String NORTH_VIEW_NAME
          North View name
static String SOUTH_VIEW_NAME
          South View name
static String TOP_VIEW_NAME
          Top View name
static String WEST_VIEW_NAME
          West View name
 
Fields inherited from class ucar.unidata.view.geoloc.NavigatedDisplay
BOTTOM_VIEW, CLIP_BACK_DEFAULT, CLIP_BACK_PERSPECTIVE, CLIP_FRONT_DEFAULT, CLIP_FRONT_PERSPECTIVE, CURSOR_ALTITUDE, CURSOR_LATITUDE, CURSOR_LONGITUDE, EAST_VIEW, MODE_2D, MODE_2Din3D, MODE_3D, NORTH_VIEW, SOUTH_VIEW, TOP_VIEW, WEST_VIEW
 
Fields inherited from class ucar.visad.display.DisplayMaster
behavior, defaultMouseFunctions, log_, POINT_MODE
 
Constructor Summary
GlobeDisplay()
          Constructs a new GlobeDisplay.
GlobeDisplay(boolean offscreen, Dimension dimension, GraphicsDevice screen)
          Constructs a new GlobeDisplay.
 
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 centerAndZoom(EarthLocation el, Real altitude, double zoomFactor, boolean animated, boolean northUp)
          Center and zoom to a particular point
 void checkClipDistance()
          If we are in perspective view then set the clip distance shorter
protected  void cursorChange()
          Handles a change to the cursor position.
protected  void cursorMoved()
          Handles a change to the cursor position.
 void enableClipping(boolean clip)
          Enable clipping of data at the box edges
protected  ScalarMap getAltitudeMap()
          Accessor method for the ScalarMap for Altitude
 String getBottomViewName()
          Accessor method.
 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 EarthLocation of a point in XYZ space
 String getEastViewName()
          Accessor method.
 Rectangle2D.Double getLatLonBox()
          Get the latlon box of the displayed area.
 String getNorthViewName()
          Accessor method.
 String getSouthViewName()
          Accessor method.
 RealTuple getSpatialCoordinates(EarthLocation el)
          Returns the spatial (XYZ) coordinates of the particular EarthLocation
 double[] getSpatialCoordinates(EarthLocation el, double[] xyz, double altitude)
          Returns the spatial (XYZ) coordinates of the particular EarthLocation
 double[] getSpatialCoordinatesFromScreen(int x, int y, double zDepth)
          Get spatial coordinates from screen
 boolean getStereoAvailable()
          Determine if this MapDisplay can do stereo.
 String getTopViewName()
          Accessor method.
 javax.media.j3d.View getView()
          Get the View
 EarthLocation getViewPointEarthLocation()
          Get the viewpoint earth location
 String getWestViewName()
          Accessor method.
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 resetScaleTranslate()
          Reset the scale translate
 EarthLocation screenToEarthLocation(int x, int y)
          Get the earth coordinates from the screen coordinates
 void setClipDistanceFront(double value)
          Set the front clip distance
 void setEyePosition(double position)
          Method for setting the eye position for a 3D stereo view.
 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 setPerspectiveView(boolean perspectiveView)
          Set the view to perspective or parallel if this is a 3D 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, animateMatrix, animateMatrix, animateMatrix, applyRotation, center, center, center, center, centerAndZoom, destroy, enableRubberBanding, getAnimationStringOn, getAutoRotate, getBoxVisible, getCenterPoint, getClipDistanceBack, getClipDistanceFront, getCursorAltitude, getCursorLatitude, getCursorLongitude, getDisplayMode, getEarthLocation, getEarthLocation, getEarthLocation, getIsAnimating, getLatLonBox, getLatLonRect, getLatLonScaleInfo, getNavigationToolBar, getNavigationToolBar, getRay, getRayDirection, getRayPositionAtZ, getRotation, getRubberBandBox, getScaledValue, getScalesVisible, getScreenCenter, getScreenCoordinates, getScreenCoordinates, getScreenLowerLeft, getScreenLowerRight, getScreenUpperLeft, getScreenUpperRight, getSpatialCoordinates, getSpatialCoordinatesFromScreen, getVerticalRange, getVerticalRangeUnit, getVisadBox, init, isClippingEnabled, isPerspectiveView, moveToScreen, moveToScreen, moveToScreen, rotateFaster, rotateSlower, rotateView, rotateView, setAnimationStringOn, setAutoRotate, setBoxVisible, setClipDistanceBack, setCursorAltitude, setCursorLatitude, setCursorLongitude, setCursorStringOn, setForeground, setLatLonScaleInfo, setMapProjection, setPolygonOffset, setPolygonOffsetFactor, setRotateDelay, setRotationMultiplierMatrix, setRubberBandBox, setScalesVisible, setVerticalMapUnit, setView, updateLocation
 
Methods inherited from class ucar.visad.display.DisplayMaster
addDisplayable, addDisplayListener, addPropertyChangeListener, addPropertyChangeListener, addScalarMap, addScalarMaps, addVetoableChangeListener, addVetoableChangeListener, buildAnimationSet, dataChange, draw, ensureInactive, equals, finalize, firePropertyChange, firePropertyChange, getAnimationSetFromDisplayables, getAnimationStringVisible, getBackground, getComponent, getDestroyed, getDisplay, getDisplayableCount, getDisplayables, getDisplayables, getDisplayAspect, getDisplayComponent, getDisplayScale, getForeground, getImage, getMouseBehavior, getMouseFunctionMap, getOffscreenDimension, getProjectionMatrix, getSavedProjectionMatrix, getScale, 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, setDisplayAspect, setDisplayInactive, 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

BOTTOM_VIEW_NAME

public static String BOTTOM_VIEW_NAME
Bottom View name


NORTH_VIEW_NAME

public static String NORTH_VIEW_NAME
North View name


EAST_VIEW_NAME

public static String EAST_VIEW_NAME
East View name


TOP_VIEW_NAME

public static String TOP_VIEW_NAME
Top View name


SOUTH_VIEW_NAME

public static String SOUTH_VIEW_NAME
South View name


WEST_VIEW_NAME

public static String WEST_VIEW_NAME
West View name


EARTH_RADIUS

public static final double EARTH_RADIUS
Earth Radius (m)

See Also:
Constant Field Values
Constructor Detail

GlobeDisplay

public GlobeDisplay()
             throws VisADException,
                    RemoteException
Constructs a new GlobeDisplay.

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

GlobeDisplay

public GlobeDisplay(boolean offscreen,
                    Dimension dimension,
                    GraphicsDevice screen)
             throws VisADException,
                    RemoteException
Constructs a new GlobeDisplay.

Parameters:
offscreen - true for an offscreen display
dimension - size of the display
screen - screen device
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

getTopViewName

public String getTopViewName()
Accessor method.

Overrides:
getTopViewName in class NavigatedDisplay
Returns:
name for this view

getBottomViewName

public String getBottomViewName()
Accessor method.

Overrides:
getBottomViewName in class NavigatedDisplay
Returns:
name for this view

getNorthViewName

public String getNorthViewName()
Accessor method.

Overrides:
getNorthViewName in class NavigatedDisplay
Returns:
name for this view

getEastViewName

public String getEastViewName()
Accessor method.

Overrides:
getEastViewName in class NavigatedDisplay
Returns:
name for this view

getSouthViewName

public String getSouthViewName()
Accessor method.

Overrides:
getSouthViewName in class NavigatedDisplay
Returns:
name for this view

getWestViewName

public String getWestViewName()
Accessor method.

Overrides:
getWestViewName in class NavigatedDisplay
Returns:
name for this view

addKeyboardBehavior

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

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

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.

screenToEarthLocation

public EarthLocation screenToEarthLocation(int x,
                                           int y)
                                    throws VisADException
Get the earth coordinates from the screen coordinates

Overrides:
screenToEarthLocation in class NavigatedDisplay
Parameters:
x - screen x position
y - screen y position
Returns:
corresponding earth location
Throws:
VisADException - problem getting coordinates

pointerMoved

protected void pointerMoved(int x,
                            int y)
                     throws UnitException,
                            VisADException,
                            RemoteException
Handles a change in the position of the mouse-pointer. For this implementation, it will only list the

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

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

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 - Couldn't create necessary VisAD object
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

cursorChange

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

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

resetScaleTranslate

public void resetScaleTranslate()
                         throws VisADException,
                                RemoteException
Reset the scale translate

Overrides:
resetScaleTranslate in class NavigatedDisplay
Throws:
RemoteException - Java RMI problem
VisADException - matrix problem

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 box edges

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

getView

public javax.media.j3d.View getView()
Get the View

Overrides:
getView in class NavigatedDisplay
Returns:
the View

setPerspectiveView

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

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

getEarthLocation

public EarthLocation getEarthLocation(double x,
                                      double y,
                                      double z,
                                      boolean setZToZeroIfOverhead)
Get the EarthLocation of a point in XYZ space

Specified by:
getEarthLocation in class NavigatedDisplay
Parameters:
x - x coord.
y - y coord.
z - z coord.
setZToZeroIfOverhead - If in the overhead view then set Z to 0
Returns:
point in lat/lon/alt space.

centerAndZoom

public void centerAndZoom(EarthLocation el,
                          Real altitude,
                          double zoomFactor,
                          boolean animated,
                          boolean northUp)
                   throws VisADException,
                          RemoteException
Center and zoom to a particular point

Overrides:
centerAndZoom in class NavigatedDisplay
Parameters:
el - the earth location
altitude - the altitude
zoomFactor - zoom factor
animated - true to animate
northUp - rotate so north is up
Throws:
RemoteException - Couldn't create a remote object
VisADException - Couldn't create necessary VisAD object

getSpatialCoordinatesFromScreen

public double[] getSpatialCoordinatesFromScreen(int x,
                                                int y,
                                                double zDepth)
Get spatial coordinates from screen

Overrides:
getSpatialCoordinatesFromScreen in class NavigatedDisplay
Parameters:
x - screen X
y - screen Y
zDepth - the z depth
Returns:
the coordinates

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 (lat/lon/alt) to translate
Returns:
RealTuple of display coordinates.

getSpatialCoordinates

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

Specified by:
getSpatialCoordinates in class NavigatedDisplay
Parameters:
el - earth location (lat/lon/alt) to translate
xyz - Where to put the value
altitude - the altitude
Returns:
The xyz array
Throws:
RemoteException - On badness
VisADException - On badness

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

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

setEyePosition

public void setEyePosition(double position)
Method for setting the eye position for a 3D stereo view.

Overrides:
setEyePosition in class DisplayMaster
Parameters:
position - x position of each eye (left negative, right positive).

getLatLonBox

public Rectangle2D.Double getLatLonBox()
                                throws VisADException,
                                       RemoteException
Get the latlon box of the displayed area. This checks to see if the globe is sort of fully zoomed out. If it is then it returns an earth spanning bbox

Overrides:
getLatLonBox in class NavigatedDisplay
Returns:
lat lon box or null if it can't be determined
Throws:
RemoteException - On badness
VisADException - On badness

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)

getViewPointEarthLocation

public EarthLocation getViewPointEarthLocation()
Get the viewpoint earth location

Returns:
the location

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

setClipDistanceFront

public void setClipDistanceFront(double value)
Set the front clip distance

Overrides:
setClipDistanceFront in class NavigatedDisplay
Parameters:
value - clip distance

checkClipDistance

public void checkClipDistance()
If we are in perspective view then set the clip distance shorter