Package ucar.unidata.view.geoloc
Class GlobeDisplay
java.lang.Object
ucar.visad.display.DisplayMaster
ucar.unidata.view.geoloc.NavigatedDisplay
ucar.unidata.view.geoloc.GlobeDisplay
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
FieldsModifier and TypeFieldDescriptionstatic String
Bottom View namestatic final double
Earth Radius (m)static String
East View namestatic String
North View namestatic String
South View namestatic String
Top View namestatic String
West View nameFields 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, defaultClipDistanceBack, defaultClipDistanceFront, 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
ConstructorsConstructorDescriptionConstructs a new GlobeDisplay.GlobeDisplay
(boolean offscreen, Dimension dimension, GraphicsDevice screen) Constructs a new GlobeDisplay. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addKeyboardBehavior
(KeyboardBehavior behavior) Add a keyboard behavior for this displayvoid
addVerticalMap
(RealType newVertType) Add a new mapping of this type to the vertical coordinatevoid
centerAndZoom
(EarthLocation el, Real altitude, double zoomFactor, boolean animated, boolean northUp) Center and zoom to a particular pointvoid
If we are in perspective view then set the clip distance shorterprotected void
Handles a change to the cursor position.protected void
Handles a change to the cursor position.void
enableClipping
(boolean clip) Enable clipping of data at the box edgesprotected ScalarMap
Accessor method for the ScalarMap for AltitudeAccessor method.Accessor method for the DisplayAltitudeTypeGet the display coordinate system that turns lat/lon/alt to x/y/zAccessor method for the DisplayLatitudeTypeAccessor method for the DisplayLongitudeTypeAccessor method for the DisplayTupleType.getEarthLocation
(double x, double y, double z, boolean setZToZeroIfOverhead) Get the EarthLocation of a point in XYZ spaceAccessor method.Get the latlon box of the displayed area.Accessor method.Accessor method.Returns the spatial (XYZ) coordinates of the particular EarthLocationdouble[]
getSpatialCoordinates
(EarthLocation el, double[] xyz, double altitude) Returns the spatial (XYZ) coordinates of the particular EarthLocationdouble[]
getSpatialCoordinatesFromScreen
(int x, int y, double zDepth) Get spatial coordinates from screenboolean
Determine if this MapDisplay can do stereo.Accessor method.javax.media.j3d.View
getView()
Get the ViewGet the viewpoint earth locationAccessor method.protected void
Initialize the class.static void
test by running java ucar.unidata.view.geoloc.NavigatedDisplayprotected 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 coordinatevoid
resetClipDistance
(double scale) Zoom in on the displayvoid
Reset the scale translatescreenToEarthLocation
(int x, int y) Get the earth coordinates from the screen coordinatesvoid
setClipDistanceFront
(double value) Set the front clip distancevoid
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 coordinatevoid
setVerticalRangeUnit
(Unit newUnit) Set the Unit of the vertical rangevoid
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, getNavigationToolBar, getNavigationToolBar, getRay, getRayDirection, getRayPositionAtZ, getRotation, getRubberBandBox, getScaledValue, getScalesVisible, getScreenCenter, getScreenCenterBottom, getScreenCenterLeft, getScreenCenterRight, getScreenCenterTop, getScreenCoordinates, getScreenCoordinates, getScreenLowerLeft, getScreenLowerRight, getScreenSidesCoordinates, getScreenUpperLeft, getScreenUpperRight, getSpatialCoordinates, getSpatialCoordinatesFromScreen, getVerticalRange, getVerticalRangeUnit, getVerticalRangeVisible, getVisadBox, init, isClippingEnabled, isPerspectiveView, moveToScreen, moveToScreen, moveToScreen, rotateFaster, rotateSlower, rotateView, rotateView, setAnimationStringOn, setAutoRotate, setBoxVisible, setClipDistanceBack, setCursorAltitude, setCursorLatitude, setCursorLongitude, setCursorStringOn, setForeground, setMapProjection, setPolygonOffset, setPolygonOffsetFactor, setRotateDelay, setRotationMultiplierMatrix, setRubberBandBox, setScalesVisible, setVerticalMapUnit, setVerticalRangeVisible, setView, updateLocation
Methods inherited from class ucar.visad.display.DisplayMaster
addDisplayable, addDisplayListener, addPropertyChangeListener, addPropertyChangeListener, addScalarMap, addScalarMaps, addVetoableChangeListener, addVetoableChangeListener, buildAnimationSet, dataChange, draw, ensureInactive, equals, 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
-
Field Details
-
BOTTOM_VIEW_NAME
Bottom View name -
NORTH_VIEW_NAME
North View name -
EAST_VIEW_NAME
East View name -
TOP_VIEW_NAME
Top View name -
SOUTH_VIEW_NAME
South View name -
WEST_VIEW_NAME
West View name -
EARTH_RADIUS
public static final double EARTH_RADIUSEarth Radius (m)- See Also:
-
-
Constructor Details
-
GlobeDisplay
Constructs a new GlobeDisplay.- Throws:
VisADException
- Couldn't create necessary VisAD objectRemoteException
- 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 displaydimension
- size of the displayscreen
- screen device- Throws:
VisADException
- Couldn't create necessary VisAD objectRemoteException
- Couldn't create a remote object
-
-
Method Details
-
initializeClass
Initialize the class.- Overrides:
initializeClass
in classNavigatedDisplay
- Throws:
RemoteException
- Java RMI problemVisADException
- VisAD problem
-
getTopViewName
Accessor method.- Overrides:
getTopViewName
in classNavigatedDisplay
- Returns:
- name for this view
-
getBottomViewName
Accessor method.- Overrides:
getBottomViewName
in classNavigatedDisplay
- Returns:
- name for this view
-
getNorthViewName
Accessor method.- Overrides:
getNorthViewName
in classNavigatedDisplay
- Returns:
- name for this view
-
getEastViewName
Accessor method.- Overrides:
getEastViewName
in classNavigatedDisplay
- Returns:
- name for this view
-
getSouthViewName
Accessor method.- Overrides:
getSouthViewName
in classNavigatedDisplay
- Returns:
- name for this view
-
getWestViewName
Accessor method.- Overrides:
getWestViewName
in classNavigatedDisplay
- Returns:
- name for this view
-
addKeyboardBehavior
Add a keyboard behavior for this display- Overrides:
addKeyboardBehavior
in classDisplayMaster
- Parameters:
behavior
- behavior to add
-
cursorMoved
Handles a change to the cursor position.- Overrides:
cursorMoved
in classNavigatedDisplay
- Throws:
VisADException
- VisAD failure.RemoteException
- Java RMI failure.
-
screenToEarthLocation
Get the earth coordinates from the screen coordinates- Overrides:
screenToEarthLocation
in classNavigatedDisplay
- Parameters:
x
- screen x positiony
- screen y position- Returns:
- corresponding earth location
- Throws:
VisADException
- problem getting coordinates
-
pointerMoved
Handles a change in the position of the mouse-pointer. For this implementation, it will only list the- Overrides:
pointerMoved
in classNavigatedDisplay
- Parameters:
x
- x mouse locationy
- y mouse location- Throws:
RemoteException
- Java RMI problemUnitException
- Unit conversion problemVisADException
- VisAD problem
-
resetClipDistance
public void resetClipDistance(double scale) Zoom in on the display- Overrides:
resetClipDistance
in classNavigatedDisplay
- Parameters:
scale
- x zoom factor ( > 1 = zoom in, 1 > zoom > 0 = zoom out). using 2.0 and .5 seems to work well.
-
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 classNavigatedDisplay
- Parameters:
mapArea
- ProjectionRect describing the map area to be displayed- Throws:
VisADException
- invalid navigation or VisAD errorRemoteException
- Couldn't create a remote object
-
setMapProjection
Define the map projection using a MapProjection type CoordinateSystem. Implementation will be subclass dependent.- Specified by:
setMapProjection
in classNavigatedDisplay
- Parameters:
mapProjection
- map projection coordinate system- Throws:
VisADException
- Couldn't create necessary VisAD objectRemoteException
- Couldn't create a remote object
-
getDisplayLatitudeType
Accessor method for the DisplayLatitudeType- Specified by:
getDisplayLatitudeType
in classNavigatedDisplay
- Returns:
- DisplayRealType for Latitude mapping
-
getDisplayLongitudeType
Accessor method for the DisplayLongitudeType- Specified by:
getDisplayLongitudeType
in classNavigatedDisplay
- Returns:
- DisplayRealType for Longitude mapping
-
getDisplayAltitudeType
Accessor method for the DisplayAltitudeType- Specified by:
getDisplayAltitudeType
in classNavigatedDisplay
- Returns:
- DisplayRealType for Altitude mapping
-
getDisplayTupleType
Accessor method for the DisplayTupleType.- Returns:
- the tuple of DisplayRealTypes
-
getAltitudeMap
Accessor method for the ScalarMap for Altitude- Specified by:
getAltitudeMap
in classNavigatedDisplay
- Returns:
- the altitude ScalarMap
-
cursorChange
Handles a change to the cursor position.- Throws:
VisADException
- VisAD failure.RemoteException
- Java RMI failure.
-
resetScaleTranslate
Reset the scale translate- Overrides:
resetScaleTranslate
in classNavigatedDisplay
- Throws:
RemoteException
- Java RMI problemVisADException
- 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 classNavigatedDisplay
- 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 classNavigatedDisplay
- Parameters:
clip
- true to turn clipping on, otherwise off
-
getView
public javax.media.j3d.View getView()Get the View- Overrides:
getView
in classNavigatedDisplay
- 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 classNavigatedDisplay
- Parameters:
perspectiveView
- true for perspective view
-
getEarthLocation
Get the EarthLocation of a point in XYZ space- Specified by:
getEarthLocation
in classNavigatedDisplay
- 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 classNavigatedDisplay
- Parameters:
el
- the earth locationaltitude
- the altitudezoomFactor
- zoom factoranimated
- true to animatenorthUp
- rotate so north is up- Throws:
RemoteException
- Couldn't create a remote objectVisADException
- Couldn't create necessary VisAD object
-
getSpatialCoordinatesFromScreen
public double[] getSpatialCoordinatesFromScreen(int x, int y, double zDepth) Get spatial coordinates from screen- Overrides:
getSpatialCoordinatesFromScreen
in classNavigatedDisplay
- Parameters:
x
- screen Xy
- screen YzDepth
- the z depth- Returns:
- the coordinates
-
getSpatialCoordinates
Returns the spatial (XYZ) coordinates of the particular EarthLocation- Specified by:
getSpatialCoordinates
in classNavigatedDisplay
- 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 classNavigatedDisplay
- Parameters:
el
- earth location (lat/lon/alt) to translatexyz
- Where to put the valuealtitude
- the altitude- Returns:
- The xyz array
- Throws:
RemoteException
- On badnessVisADException
- On badness
-
addVerticalMap
Add a new mapping of this type to the vertical coordinate- Overrides:
addVerticalMap
in classNavigatedDisplay
- Parameters:
newVertType
- RealType of map- Throws:
RemoteException
- Java RMI problemVisADException
- VisAD problem
-
removeVerticalMap
Remove a new mapping of this type to the vertical coordinate- Overrides:
removeVerticalMap
in classNavigatedDisplay
- Parameters:
vertType
- RealType of map- Throws:
RemoteException
- Java RMI problemVisADException
- VisAD problem
-
setVerticalRangeUnit
Set the Unit of the vertical range- Overrides:
setVerticalRangeUnit
in classNavigatedDisplay
- Parameters:
newUnit
- unit of range- Throws:
RemoteException
- Java RMI problemVisADException
- VisAD problem
-
setVerticalRange
Set the range of the vertical coordinate- Overrides:
setVerticalRange
in classNavigatedDisplay
- Parameters:
min
- minimum value for vertical axismax
- maximum value for vertical axis- Throws:
RemoteException
- Java RMI problemVisADException
- VisAD problem
-
getStereoAvailable
public boolean getStereoAvailable()Determine if this MapDisplay can do stereo.- Overrides:
getStereoAvailable
in classDisplayMaster
- 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 classDisplayMaster
- Parameters:
position
- x position of each eye (left negative, right positive).
-
getLatLonBox
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 classNavigatedDisplay
- Returns:
- lat lon box or null if it can't be determined
- Throws:
RemoteException
- On badnessVisADException
- On badness
-
getDisplayCoordinateSystem
Get the display coordinate system that turns lat/lon/alt to x/y/z- Overrides:
getDisplayCoordinateSystem
in classNavigatedDisplay
- Returns:
- the coordinate system (may be null)
-
getViewPointEarthLocation
Get the viewpoint earth location- Returns:
- the location
-
main
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 classNavigatedDisplay
- Parameters:
value
- clip distance
-
checkClipDistance
public void checkClipDistance()If we are in perspective view then set the clip distance shorter
-