Class 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
  • Field Details

    • DEFAULT_Z

      public static final float DEFAULT_Z
      default z value
      See Also:
    • DEFAULT_PRESSURE_LABELS

      public static String[] DEFAULT_PRESSURE_LABELS
      default pressure labels
  • Constructor Details

    • 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 Details

    • 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, double altitude) 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.
      altitude - _more_
      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, 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

      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