Package ucar.unidata.view.geoloc
Class MapProjectionDisplay
java.lang.Object
ucar.visad.display.DisplayMaster
ucar.unidata.view.geoloc.NavigatedDisplay
ucar.unidata.view.geoloc.MapProjectionDisplay
- Direct Known Subclasses:
MapProjectionDisplayJ2D
,MapProjectionDisplayJ3D
Provides a navigated VisAD DisplayImpl for displaying data.
The Projection or MapProjection provides the transformation from
lat/lon space to xy space. There are three modes that can be used
with this display - MODE_3D (Java 3D), MODE_2Din3D (2D in Java 3D),
MODE_2D (Java 2D). Performance is better in Java 3D modes. In the 3D
mode, RealType.Altitude is mapped to the display Z axis.
Any displayable data must be able to map to RealType.Latitude, RealType.Longitude and/or RealType.Altitude.
- Author:
- Don Murray
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected class
An adapter for visad.georef.MapProjection coordinate systems (ie: ones with * a reference of Lat/Lon).Nested classes/interfaces inherited from class ucar.unidata.view.geoloc.NavigatedDisplay
NavigatedDisplay.VerticalMapSet
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The name of the bearing from center property.static RealType
The bearing from center RealType.static final String
The name of the range from center property.static RealType
The range from center RealType.static boolean
flag for forcing 2DFields inherited from class ucar.unidata.view.geoloc.NavigatedDisplay
BOTTOM_VIEW, BOTTOM_VIEW_NAME, CLIP_BACK_DEFAULT, CLIP_BACK_PERSPECTIVE, CLIP_FRONT_DEFAULT, CLIP_FRONT_PERSPECTIVE, CURSOR_ALTITUDE, CURSOR_LATITUDE, CURSOR_LONGITUDE, defaultClipDistanceBack, defaultClipDistanceFront, 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, POINT_MODE
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Constructs an instance with the specified MapProjectionprotected
MapProjectionDisplay
(MapProjection projection, DisplayImpl display) Constructs an instance with the specified MapProjection CoordinateSystem and display. -
Method Summary
Modifier and TypeMethodDescriptionabstract void
addKeyboardBehavior
(KeyboardBehavior behavior) Add a KeyboardBehavior to this classvoid
addVerticalMap
(RealType newVertType) Add a new mapping of this type to the vertical coordinateprotected void
Handles a change to the cursor position.void
destroy()
Destroy this classprotected ScalarMap
Accessor method for the vertical coordinate ScalarMap (i.e., what getDisplayAltitudeType is mapped from).Gets the cursor bearing from center property.Gets the cursor range from center property.Accessor method for the DisplayAltitudeType (i.e., what RealType.Altitude is mapped to).Get the display coordinate system that turns lat/lon/alt to x/y/zAccessor method for the DisplayLatitudeType (i.e., what RealType.Latitude is mapped to).Accessor method for the DisplayLongitudeType (i.e., what RealType.Longitude is mapped to).getEarthLocation
(double x, double y, double z, boolean setZToZeroIfOverhead) Get the earth location from the VisAD xyz coodinatesstatic MapProjectionDisplay
getInstance
(int mode) Get an instance of a MapProjectionDisplay using the mode specified and the default projection.static MapProjectionDisplay
getInstance
(MapProjection p, int mode) Get an instance of a MapProjectionDisplay using the mode specified and the MapProjection.static MapProjectionDisplay
getInstance
(MapProjection p, int mode, boolean offscreen, Dimension dimension) Get an instance of a MapProjectionDisplay using the mode specified and the MapProjection.static MapProjectionDisplay
getInstance
(MapProjection p, int mode, boolean offscreen, Dimension dimension, GraphicsDevice screen) Get an instance of a MapProjectionDisplay using the mode specified and the MapProjection.Gets the lat scale info.Gets the lon scale info.Get the MapProjection that defines the xy mapping of this MapProjectionDisplay.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[]
Get the range of the vertical coordinate (Altitude)Gets the vertical scale info.protected void
init
(MapProjection projection, DisplayImpl display) Initializes an instance with the specified MapProjection CoordinateSystem and display.protected void
Set up the display.static void
test by running java ucar.unidata.view.geoloc.MapProjectionDisplayprotected static MapProjection
Make the default projection.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 coordinatefloat[]
scaleVerticalValues
(float[] altValues) Scale vertical values using the range of the vertical scalar map.protected void
setCursorBearing
(Real bearing) Sets the cursor bearing (degrees) from center property.protected void
setCursorRange
(Real range) Sets the cursor range from center property.void
setLatScaleInfo
(LatLonAxisScaleInfo axisScaleInfo) Sets the lat scale info.void
setLonScaleInfo
(LatLonAxisScaleInfo axisScaleInfo) Sets the lon scale info.void
setMapArea
(ucar.unidata.geoloc.ProjectionRect mapArea) Set the map area from the projection rectanglevoid
setMapProjection
(ucar.unidata.geoloc.ProjectionImpl projection) Define the map projection using a Projection interfacevoid
setMapProjection
(MapProjection mapProjection) Define the map projection using a MapProjection type CoordinateSystemvoid
setMapProjection
(MapProjection mapProjection, boolean resetDisplayProjMatrix) Define the map projection using a MapProjection type CoordinateSystemvoid
setMapRegion
(Gridded2DSet region) Set the map region to be displayed.void
setVerticalRange
(double min, double max) Set the range of the vertical coordinatevoid
setVerticalRangeUnit
(Unit newUnit) Set the Unit of the vertical rangevoid
setVertScaleInfo
(VertScaleInfo vertScaleInfo) Sets the vertical scale info.void
setView
(int view) Set the view for 3D.protected void
Update lat/lon/alt properties with the EarthLocation.Methods inherited from class ucar.unidata.view.geoloc.NavigatedDisplay
animateMatrix, animateMatrix, animateMatrix, animateMatrix, applyRotation, center, center, center, center, centerAndZoom, centerAndZoom, enableClipping, enableRubberBanding, getAnimationStringOn, getAutoRotate, getBottomViewName, getBoxVisible, getCenterPoint, getClipDistanceBack, getClipDistanceFront, getCursorAltitude, getCursorLatitude, getCursorLongitude, getDisplayMode, getEarthLocation, getEarthLocation, getEarthLocation, getEastViewName, getIsAnimating, getLatLonBox, getLatLonBox, getLatLonRect, getNavigationToolBar, getNavigationToolBar, getNorthViewName, getRay, getRayDirection, getRayPositionAtZ, getRotation, getRubberBandBox, getScaledValue, getScalesVisible, getScreenCenter, getScreenCenterBottom, getScreenCenterLeft, getScreenCenterRight, getScreenCenterTop, getScreenCoordinates, getScreenCoordinates, getScreenLowerLeft, getScreenLowerRight, getScreenSidesCoordinates, getScreenUpperLeft, getScreenUpperRight, getSouthViewName, getSpatialCoordinates, getSpatialCoordinatesFromScreen, getSpatialCoordinatesFromScreen, getTopViewName, getVerticalRangeUnit, getVerticalRangeVisible, getView, getVisadBox, getWestViewName, init, isClippingEnabled, isPerspectiveView, moveToScreen, moveToScreen, moveToScreen, resetClipDistance, resetScaleTranslate, rotateFaster, rotateSlower, rotateView, rotateView, screenToEarthLocation, setAnimationStringOn, setAutoRotate, setBoxVisible, setClipDistanceBack, setClipDistanceFront, setCursorAltitude, setCursorLatitude, setCursorLongitude, setCursorStringOn, setForeground, setPerspectiveView, setPolygonOffset, setPolygonOffsetFactor, setRotateDelay, setRotationMultiplierMatrix, setRubberBandBox, setScalesVisible, setVerticalMapUnit, setVerticalRangeVisible, setView
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, getStereoAvailable, 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, setEyePosition, setKeyboardBehavior, setKeyboardEventMap, setKeyboardEventMap, setMouseFunctions, setOffscreenDimension, setPointMode, setProjectionMatrix, setRebuildNecessary, setWaitMessageVisible, setWheelEventMap, translate, zoom, zoom
-
Field Details
-
CURSOR_BEARING
The name of the bearing from center property.- See Also:
-
CURSOR_RANGE
The name of the range from center property.- See Also:
-
force2D
public static boolean force2Dflag for forcing 2D -
CURSOR_RANGE_TYPE
The range from center RealType. -
CURSOR_BEARING_TYPE
The bearing from center RealType.
-
-
Constructor Details
-
MapProjectionDisplay
protected MapProjectionDisplay()Constructs an instance with the specified MapProjection -
MapProjectionDisplay
protected MapProjectionDisplay(MapProjection projection, DisplayImpl display) throws VisADException, RemoteException Constructs an instance with the specified MapProjection CoordinateSystem and display.- Parameters:
projection
- map projection CSdisplay
- display to use- Throws:
VisADException
- Couldn't create necessary VisAD objectRemoteException
- Couldn't create a remote object
-
-
Method Details
-
init
protected void init(MapProjection projection, DisplayImpl display) throws VisADException, RemoteException Initializes an instance with the specified MapProjection CoordinateSystem and display.- Parameters:
projection
- map projection CSdisplay
- display to use- Throws:
VisADException
- Couldn't create necessary VisAD objectRemoteException
- Couldn't create a remote object
-
initializeClass
Set up the display. Any additional work should be done in a subclass's intializeClass() method, which should call super.initializeClass() first.- Overrides:
initializeClass
in classNavigatedDisplay
- Throws:
RemoteException
- Java RMI problemVisADException
- VisAD problem
-
getInstance
Get an instance of a MapProjectionDisplay using the mode specified and the default projection.- Parameters:
mode
- mode to use- Returns:
- a MapProjectionDisplay
- Throws:
VisADException
- problem creating some VisAD objectRemoteException
- problem creating remote object
-
getInstance
public static MapProjectionDisplay getInstance(MapProjection p, int mode) throws VisADException, RemoteException Get an instance of a MapProjectionDisplay using the mode specified and the MapProjection.- Parameters:
p
- initial MapProjection for displaymode
- mode to use- Returns:
- a MapProjection display of the correct mode and projection
- Throws:
VisADException
- problem creating some VisAD objectRemoteException
- problem creating remote object
-
getInstance
public static MapProjectionDisplay getInstance(MapProjection p, int mode, boolean offscreen, Dimension dimension) throws VisADException, RemoteException Get an instance of a MapProjectionDisplay using the mode specified and the MapProjection.- Parameters:
p
- map projectionmode
- modeoffscreen
- true if offscreendimension
- dimension of display- Returns:
- the instance
- Throws:
RemoteException
- Java RMI problemVisADException
- problem creating the display or some component
-
getInstance
public static MapProjectionDisplay getInstance(MapProjection p, int mode, boolean offscreen, Dimension dimension, GraphicsDevice screen) throws VisADException, RemoteException Get an instance of a MapProjectionDisplay using the mode specified and the MapProjection.- Parameters:
p
- map projectionmode
- modeoffscreen
- true if offscreendimension
- dimension of displayscreen
- screen to display it on- Returns:
- the instance
- Throws:
RemoteException
- Java RMI problemVisADException
- problem creating the display or some component
-
destroy
public void destroy()Destroy this class- Overrides:
destroy
in classNavigatedDisplay
-
addKeyboardBehavior
Add a KeyboardBehavior to this class- Overrides:
addKeyboardBehavior
in classDisplayMaster
- Parameters:
behavior
- behavior to add
-
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
-
setLatScaleInfo
public void setLatScaleInfo(LatLonAxisScaleInfo axisScaleInfo) throws RemoteException, VisADException Sets the lat scale info.- Parameters:
axisScaleInfo
- the new lat scale info- Throws:
RemoteException
- the remote exceptionVisADException
- the vis ad exception
-
setLonScaleInfo
public void setLonScaleInfo(LatLonAxisScaleInfo axisScaleInfo) throws RemoteException, VisADException Sets the lon scale info.- Parameters:
axisScaleInfo
- the new lon scale info- Throws:
RemoteException
- the remote exceptionVisADException
- the vis ad exception
-
getLatScaleInfo
Gets the lat scale info.- Returns:
- the lat scale info
-
getVertScaleInfo
Gets the vertical scale info.- Returns:
- the vertical scale info
-
setVertScaleInfo
Sets the vertical scale info.- Parameters:
vertScaleInfo
- the new vertical scale info- Throws:
RemoteException
- the remote exceptionVisADException
- the vis ad exception
-
getLonScaleInfo
Gets the lon scale info.- Returns:
- the lon scale info
-
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
-
getVerticalRange
public double[] getVerticalRange()Get the range of the vertical coordinate (Altitude)- Overrides:
getVerticalRange
in classNavigatedDisplay
- Returns:
- array of {min, max} range.
-
setCursorRange
Sets the cursor range from center property.- Parameters:
range
- The cursor range from center.- Throws:
RemoteException
- Java RMI problemVisADException
- VisAD problem
-
getCursorRange
Gets the cursor range from center property.- Returns:
- The currently-selected range. May be
null
.
-
setCursorBearing
Sets the cursor bearing (degrees) from center property. This implementation uses a great circle distance.- Parameters:
bearing
- The cursor bearing from center.- Throws:
RemoteException
- Java RMI problemVisADException
- VisAD problem
-
getCursorBearing
Gets the cursor bearing from center property.- Returns:
- The currently-selected bearing. May be
null
.
-
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 | | S T |_______| T SOUTH
- Specified by:
setView
in classNavigatedDisplay
- Parameters:
view
- one of the static view fields (NORTH_VIEW, SOUTH_VIEW, .. etc).
-
getDisplayLatitudeType
Accessor method for the DisplayLatitudeType (i.e., what RealType.Latitude is mapped to).- Specified by:
getDisplayLatitudeType
in classNavigatedDisplay
- Returns:
- the DisplayRealType that RealType.Latitude is mapped to
-
getDisplayLongitudeType
Accessor method for the DisplayLongitudeType (i.e., what RealType.Longitude is mapped to).- Specified by:
getDisplayLongitudeType
in classNavigatedDisplay
- Returns:
- the DisplayRealType that RealType.Longitude is mapped to
-
getDisplayAltitudeType
Accessor method for the DisplayAltitudeType (i.e., what RealType.Altitude is mapped to).- Specified by:
getDisplayAltitudeType
in classNavigatedDisplay
- Returns:
- the DisplayRealType that RealType.Altitude is mapped to
-
getAltitudeMap
Accessor method for the vertical coordinate ScalarMap (i.e., what getDisplayAltitudeType is mapped from).- Specified by:
getAltitudeMap
in classNavigatedDisplay
- Returns:
- the ScalarMap that the vertical coordinate is mapped to
-
setMapProjection
public void setMapProjection(ucar.unidata.geoloc.ProjectionImpl projection) throws VisADException, RemoteException Define the map projection using a Projection interface- Overrides:
setMapProjection
in classNavigatedDisplay
- Parameters:
projection
- Projection to use- Throws:
VisADException
- Couldn't create necessary VisAD objectRemoteException
- Couldn't create a remote object
-
setMapProjection
Define the map projection using a MapProjection type CoordinateSystem- 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
-
setMapProjection
public void setMapProjection(MapProjection mapProjection, boolean resetDisplayProjMatrix) throws VisADException, RemoteException Define the map projection using a MapProjection type CoordinateSystem- Parameters:
mapProjection
- map projection coordinate systemresetDisplayProjMatrix
- yes/no change the current VisAD Display projection matrix when the map projection is changed.- Throws:
VisADException
- Couldn't create necessary VisAD objectRemoteException
- Couldn't create a remote object
-
getMapProjection
Get the MapProjection that defines the xy mapping of this MapProjectionDisplay.- Returns:
- MapProjection being used.
-
setMapArea
public void setMapArea(ucar.unidata.geoloc.ProjectionRect mapArea) throws VisADException, RemoteException Set the map area from the projection rectangle- Overrides:
setMapArea
in classNavigatedDisplay
- Parameters:
mapArea
- map area as lat/lon lines- Throws:
RemoteException
- problem setting remote dataVisADException
- problem creating VisAD data object
-
setMapRegion
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 setRemoteException
- Couldn't create a remote object
-
scaleVerticalValues
public float[] scaleVerticalValues(float[] altValues) Scale vertical values using the range of the vertical scalar map.- Parameters:
altValues
- altitude map values- Returns:
- z values (may transform in place);
-
cursorMoved
Handles a change to the cursor position.- Overrides:
cursorMoved
in classNavigatedDisplay
- Throws:
VisADException
- VisAD failure.RemoteException
- Java RMI failure.
-
updateLocation
Update lat/lon/alt properties with the EarthLocation.- Overrides:
updateLocation
in classNavigatedDisplay
- Parameters:
el
- EarthLocation to use.- Throws:
RemoteException
- Java RMI problemVisADException
- VisAD problem
-
pointerMoved
Handles a change in the position of the mouse-pointer.- Overrides:
pointerMoved
in classNavigatedDisplay
- Parameters:
x
- x mouse positiony
- y mouse position- Throws:
RemoteException
- Java RMI problemUnitException
- Unit conversion problemVisADException
- VisAD problem
-
getEarthLocation
Get the earth location from the VisAD xyz coodinates- Specified by:
getEarthLocation
in classNavigatedDisplay
- Parameters:
x
- xy
- yz
- zsetZToZeroIfOverhead
- If in the overhead view then set Z to 0- Returns:
- corresponding EarthLocation
-
getSpatialCoordinates
Returns the spatial (XYZ) coordinates of the particular EarthLocation- Specified by:
getSpatialCoordinates
in classNavigatedDisplay
- Parameters:
el
- earth location to transform- 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 to transformxyz
- The in value to set. May be null.altitude
- altitude value- Returns:
- xyz array
- Throws:
RemoteException
- Java RMI problemVisADException
- VisAD problem
-
makeDefaultMapProjection
Make the default projection.- Returns:
- Default projectcion
- Throws:
VisADException
- couldn't create MapProjection
-
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)
-
main
test by running java ucar.unidata.view.geoloc.MapProjectionDisplay- Parameters:
args
- include an argument for a 3D display- Throws:
Exception
- problem creating the display
-