Class GridDisplayControl

All Implemented Interfaces:
ActionListener, ItemListener, PropertyChangeListener, EventListener, HyperlinkListener, Sharable, DataChangeListener, DisplayControl, Prototypable, ControlListener, DisplayListener
Direct Known Subclasses:
BaseImageControl, ColorRadarVolumeControl, CrossSectionControl, Grid2DReadoutProbe, GridTableControl, GridTrajectoryControlNew.MyTrajectoryControl, HovmollerControl, JythonControl, LineProbeControl, PlanViewControl, TemplateControl, ThreeDSurfaceControl, TrackControl, VolumeRenderControl, VolumeVectorControl

public abstract class GridDisplayControl extends DisplayControlImpl
Class with methods used by a DisplayControlImpl. For gridded data.
Version:
$Revision: 1.107 $
Author:
Unidata Development Team
  • Field Details

    • CMD_SETLEVELS

      public static final String CMD_SETLEVELS
      flag for the set levels command
      See Also:
    • CMD_CONTOURDIALOG

      public static final String CMD_CONTOURDIALOG
      command for showing cont level dialog
      See Also:
    • log_

      protected static LogUtil.LogCategory log_
      logging category
    • settingLevel

      protected boolean settingLevel
      flag for setting levels
    • INITIAL_PROBE_EARTHLOCATION

      public static final String INITIAL_PROBE_EARTHLOCATION
      Key for setting intial probe position
      See Also:
    • gridDataInstance

      protected GridDataInstance gridDataInstance
      For legacy code. deprecated Should use getGridDataInstance
  • Constructor Details

    • GridDisplayControl

      public GridDisplayControl()
      cstr does nothing yet; usually made from a subclass.
  • Method Details

    • canDoProgressiveResolution

      protected boolean canDoProgressiveResolution()
      Description copied from class: DisplayControlImpl
      Does this control support progressive resolution? Subclasses should override.
      Overrides:
      canDoProgressiveResolution in class DisplayControlImpl
      Returns:
      false
    • getGridDataInstance

      public GridDataInstance getGridDataInstance()
      A utility to cast the getDataInstance as a GridDataInstance
      Returns:
      the GridDataInstance
    • getCursorReadoutData

      protected Data getCursorReadoutData() throws Exception
      Get the cursor readout data
      Returns:
      the data
      Throws:
      Exception - problem getting data
    • getCursorReadoutInner

      protected List getCursorReadoutInner(EarthLocation el, Real animationValue, int animationStep, List<ReadoutInfo> samples) throws Exception
      Get cursor readout
      Overrides:
      getCursorReadoutInner in class DisplayControlImpl
      Parameters:
      el - earth location
      animationValue - animation value
      animationStep - animation step
      samples - the list of samples
      Returns:
      list of values
      Throws:
      Exception - problem getting values
    • getInitialColorTable

      protected ColorTable getInitialColorTable()
      Override superclass method to get the initial color table.
      Overrides:
      getInitialColorTable in class DisplayControlImpl
      Returns:
      color table for the parameter
    • haveMultipleFields

      protected boolean haveMultipleFields()
      Return whether the Data held by this display control contains multiple fields (e.g., for the isosurface colored by another parameter
      Returns:
      true if there are multiple fields
    • isDisplayUnitAlsoColorUnit

      protected boolean isDisplayUnitAlsoColorUnit()
      See if the display unit is also the color unit
      Overrides:
      isDisplayUnitAlsoColorUnit in class DisplayControlImpl
      Returns:
      true if the units are the same
    • getColorParamName

      protected String getColorParamName()
      Get the parameter name for color.
      Returns:
      color parameter name
    • getInitialRange

      protected Range getInitialRange() throws RemoteException, VisADException
      Return the default range
      Overrides:
      getInitialRange in class DisplayControlImpl
      Returns:
      the default range.
      Throws:
      RemoteException - Java RMI error
      VisADException - VisAD Error
    • getDataRangeInColorUnits

      protected Range getDataRangeInColorUnits() throws RemoteException, VisADException
      Get the range of the data in color units.
      Returns:
      the range or null
      Throws:
      RemoteException - Java RMI error
      VisADException - VisAD Error
    • doMakeDataInstance

      protected DataInstance doMakeDataInstance(DataChoice dataChoice) throws RemoteException, VisADException
      Create the GridDataInstance from the dataChoice. Set the dataInstance and its paramName in the superclass member data. Returns whether the dataInstance is ok.
      Overrides:
      doMakeDataInstance in class DisplayControlImpl
      Parameters:
      dataChoice - data choice defining the data
      Returns:
      the data instance
      Throws:
      RemoteException - Java RMI error
      VisADException - VisAD Error
    • getColorRangeIndex

      protected int getColorRangeIndex()
      Returns the index to use in the GridDataInstance array of ranges for color ranges. The default is 1 though if there is not more than one field in the range then we end up with the 0th value.
      Returns:
      1
    • getRawDataUnit

      public Unit getRawDataUnit()
      Get the raw data unit.
      Overrides:
      getRawDataUnit in class DisplayControlImpl
      Returns:
      unit for the data values
    • getDefaultContourInfo

      protected ContourInfo getDefaultContourInfo()
      Get the default contour info to use
      Returns:
      default contour info to use
    • initializeDefaultContourInfo

      protected void initializeDefaultContourInfo(ContourInfo contourInfo)
      A hook for derived classes to set any state. ex: color filled contours turn off labels
      Parameters:
      contourInfo - The contour info to initialize
    • getContourInfo

      public ContourInfo getContourInfo()
      Get the contour information for any contours
      Overrides:
      getContourInfo in class DisplayControlImpl
      Returns:
      the contour information
    • getColorUnit

      protected Unit getColorUnit()
      By default we color by the second index (if it is defined)
      Overrides:
      getColorUnit in class DisplayControlImpl
      Returns:
      the unit for the color parameter
    • getDisplayUnit

      public Unit getDisplayUnit()
      Get the unit for the data display.
      Overrides:
      getDisplayUnit in class DisplayControlImpl
      Returns:
      unit to use for displaying the data
    • setLevel

      public void setLevel(Object r)
      Does nothing yet. Subclasses should override
      Parameters:
      r - level for data
    • setLevelFromUser

      protected void setLevelFromUser(Object pl) throws VisADException, RemoteException
      The user has changed the level
      Parameters:
      pl - The new level
      Throws:
      RemoteException - On badness
      VisADException - On badness
    • getColorRangeFromData

      public Range getColorRangeFromData()
      Return the range attribute of the colorTable (if non-null) else return null;
      Returns:
      The range from the color table attribute
    • convertColorRange

      public Range convertColorRange(Range rawRange)
      Utility to convert the given raw data range into the display units
      Parameters:
      rawRange - Raw data range
      Returns:
      Converted range
    • setLevel

      public void setLevel(Object l, JComboBox levelBox)
      Set the value "l" in the level combo box "levelBox."
      Parameters:
      l - the level
      levelBox - the level box
    • doMakeContourLevelControl

      public JButton doMakeContourLevelControl()
      Make and return a JButton which will summon a ContlevelDialog; deprecated Don't use this, rely on the
      Returns:
      the action button
    • doMakeLevelControl

      public JComboBox doMakeLevelControl()
      Make and return a JComboBox with all native raw grid levels to choose, from the current getGridDataInstance(), if any.
      Returns:
      the combobox
    • doMakeLevelControl

      public JComboBox doMakeLevelControl(Object[] levels)
      Make and return a JComboBox with the supplied "levels" to choose from; see action commmand "levels".
      Parameters:
      levels - the levels to populat the combo box with
      Returns:
      the combo box
    • addTopographyMap

      protected void addTopographyMap(int typeIndex) throws VisADException, RemoteException
      Add a topography map for the parameter at the specified index
      Parameters:
      typeIndex - index of the RealType to use
      Throws:
      RemoteException - Java RMI problem
      VisADException - Unable to set the ScalarMap
    • addTopographyMap

      protected void addTopographyMap(RealType type) throws VisADException, RemoteException
      Add a topography map for the parameter at the specified index
      Parameters:
      type - the RealType to use
      Throws:
      RemoteException - Java RMI problem
      VisADException - Unable to set the ScalarMap
    • actionPerformed

      public void actionPerformed(ActionEvent event)
      Deal with action event commands from the levels and contours buttons made by this class.
      Specified by:
      actionPerformed in interface ActionListener
      Overrides:
      actionPerformed in class DisplayControlImpl
      Parameters:
      event - event to handle
    • getDataProjection

      public MapProjection getDataProjection()
      Get MapProjection of data to display. Override the superclass method because we have more info for this type of data
      Specified by:
      getDataProjection in interface DisplayControl
      Overrides:
      getDataProjection in class DisplayControlImpl
      Returns:
      The native projection of the data
    • normalizeRectangle

      public Rectangle2D normalizeRectangle(Rectangle2D bb)
    • exportDisplayedData

      public void exportDisplayedData(String type)
      Export displayed data to file
      Overrides:
      exportDisplayedData in class DisplayControlImpl
      Parameters:
      type - type of data
    • doExport

      public void doExport(String what, String filename) throws Exception
      Export displayed data to file
      Overrides:
      doExport in class DisplayControlImpl
      Parameters:
      what - type of data netcdf
      filename - To what file
      Throws:
      Exception - problem exporting
    • shouldAddDisplayListener

      protected boolean shouldAddDisplayListener()
      _more_
      Overrides:
      shouldAddDisplayListener in class DisplayControlImpl
      Returns:
      _more_
    • shouldAddControlListener

      protected boolean shouldAddControlListener()
      Signal base class to add this as a control listener
      Overrides:
      shouldAddControlListener in class DisplayControlImpl
      Returns:
      Add as control listener
    • applyForecastHourMacro

      protected String applyForecastHourMacro(String t, DateTime currentTime)
      Apply the forecast hour macro
      Overrides:
      applyForecastHourMacro in class DisplayControlImpl
      Parameters:
      t - label string
      currentTime - first time
      Returns:
      modified string