Package ucar.unidata.view.geoloc
Class TransectDisplay
java.lang.Object
ucar.visad.display.DisplayMaster
ucar.unidata.view.geoloc.NavigatedDisplay
ucar.unidata.view.geoloc.TransectDisplay
- All Implemented Interfaces:
EventListener
,ControlListener
,DisplayListener
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
Nested ClassesModifier and TypeClassDescriptionprotected class
Class for converting from lat/lon/alt to xyzNested classes/interfaces inherited from class ucar.unidata.view.geoloc.NavigatedDisplay
NavigatedDisplay.VerticalMapSet
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic String[]
default pressure labelsstatic final float
default z valueFields 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, log_, POINT_MODE
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs 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
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
Handle a change to the controlprotected void
Handles a change to the cursor position.protected void
Handles a change to the cursor position.void
displayChanged
(DisplayEvent event) Handle a DisplayEventvoid
enableClipping
(boolean clip) Enable clipping of data at the scale edgesvoid
extendTransect
(double amount) Extend (or condense) the displayed transect.void
extendVerticalRange
(double amount) Extend (or condense) the displayed transect.protected ScalarMap
Accessor method for the ScalarMap for AltitudeAccessor 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 earth location from the VisAD xyz coodinatesGet the Unit of the horizontal rangeSet the maximum distance away from the transect for data to be displayed.Get the scale end pointsboolean
Get the box visibility.Returns the spatial (XYZ) coordinates of the particular EarthLocationdouble[]
getSpatialCoordinates
(EarthLocation el, double[] xyz, double altitude) Returns the spatial (XYZ) coordinates of the particular EarthLocationboolean
Determine if this MapDisplay can do stereo.protected Gridded2DSet
Get the transect for this displaydouble[]
Get the range of the vertical coordinate (Altitude)double[][]
Get the coordinates of the left and right ends of the the horizontal axis.double[][]
Get the coordinates of the left and right ends of the the horizontal axis.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
setDisplayAspect
(double[] aspect) Override super methodvoid
setGridLinesVisible
(boolean on) Set the visibility of the axis grid lines.void
setHorizontalRangeUnit
(Unit newUnit) Set the Unit of the horizontal rangevoid
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
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 axisvoid
setScaleFont
(Font f) Set the fonts for the axis scalesvoid
setTransect
(Gridded2DSet newLine) Set the transect for this displayvoid
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, centerAndZoom, destroy, 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, 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, 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, setDisplayInactive, setEyePosition, setKeyboardBehavior, setKeyboardEventMap, setKeyboardEventMap, setMouseFunctions, setOffscreenDimension, setPointMode, setProjectionMatrix, setRebuildNecessary, setWaitMessageVisible, setWheelEventMap, translate, zoom, zoom
-
Field Details
-
DEFAULT_Z
public static final float DEFAULT_Zdefault z value- See Also:
-
DEFAULT_PRESSURE_LABELS
default pressure labels
-
-
Constructor Details
-
TransectDisplay
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 objectRemoteException
- Couldn't create a remote object
-
TransectDisplay
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 objectRemoteException
- 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 lineoffscreen
- true if offscreendimension
- Dimension of the screen- 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
-
getScaleEndPoints
Get the scale end points- Returns:
- the end points of the scale
-
addKeyboardBehavior
Add a keyboard behavior for this display- Overrides:
addKeyboardBehavior
in classDisplayMaster
- Parameters:
behavior
- behavior to add
-
displayChanged
Handle a DisplayEvent- Specified by:
displayChanged
in interfaceDisplayListener
- Parameters:
event
- event to handle- Throws:
RemoteException
- Java RMI problemVisADException
- VisAD problem
-
controlChanged
Handle a change to the control- Specified by:
controlChanged
in interfaceControlListener
- Parameters:
ce
- ControlEvent
-
cursorMoved
Handles a change to the cursor position.- Overrides:
cursorMoved
in classNavigatedDisplay
- Throws:
VisADException
- VisAD failure.RemoteException
- Java RMI failure.
-
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
-
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
-
getVerticalRange
public double[] getVerticalRange()Get the range of the vertical coordinate (Altitude)- Overrides:
getVerticalRange
in classNavigatedDisplay
- Returns:
- array of {min, max} range.
-
setHorizontalRangeUnit
Set the Unit of the horizontal range- Parameters:
newUnit
- unit of range- Throws:
RemoteException
- Java RMI problemVisADException
- VisAD problem
-
getHorizontalRangeUnit
Get the Unit of the horizontal range- Returns:
- unit of horizontal range
-
setMaxDataDistance
Set the maximum distance away from the transect for data to be displayed.- Parameters:
r
- value of distance- Throws:
VisADException
- incompatible unit
-
setMaxDataDistance
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
Set the maximum distance away from the transect for data to be displayed.- Returns:
- the maximum distance
-
setGridLinesVisible
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 objectRemoteException
- If there was a problem making this change in a remote collaborative display.
-
getScalesVisible
public boolean getScalesVisible()Get the box visibility.- Overrides:
getScalesVisible
in classNavigatedDisplay
- 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 classNavigatedDisplay
- Parameters:
mapArea
- ProjectionRect describing the map area to be displayed- Throws:
VisADException
- invalid navigation or VisAD errorRemoteException
- Couldn't create a remote 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
-
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
- Unable to set projectionRemoteException
- 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
-
getTransect
Get the transect for this display- Returns:
- the transect as a list of points
-
setTransect
Set the transect for this display- Parameters:
newLine
- the transect as a rectangle- Throws:
VisADException
- VisAD failure.RemoteException
- Java RMI failure.
-
cursorChange
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 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 scale edges- Overrides:
enableClipping
in classNavigatedDisplay
- 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
Override super method- Overrides:
setDisplayAspect
in classDisplayMaster
- Parameters:
aspect
- the new aspect- Throws:
RemoteException
- Java RMI problemVisADException
- VisAD problem
-
setPerspectiveView
public void setPerspectiveView(boolean perspective) Set the view to perspective or parallel if this is a 3D display.- Overrides:
setPerspectiveView
in classNavigatedDisplay
- Parameters:
perspective
- true for perspective view
-
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
- _more_- Returns:
- xyz array
- 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
-
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)
-
setScaleFont
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, invalid input: '<' 1 to contract
-
extendVerticalRange
public void extendVerticalRange(double amount) Extend (or condense) the displayed transect.- Parameters:
amount
- (%) to extend or contract > 1 to expand, invalid input: '<' 1 to contract
-
setPressureLabels
Set the labels for the pressure axis- Parameters:
labels
- array of labels- Throws:
VisADException
- unable to set the labels on the Axis
-
main
test by running java ucar.unidata.view.geoloc.NavigatedDisplay- Parameters:
args
- not used- Throws:
Exception
- problem creating the display
-