Class PlanViewControl

All Implemented Interfaces:
ActionListener, ItemListener, PropertyChangeListener, EventListener, HyperlinkListener, Sharable, DataChangeListener, DisplayControl, Prototypable, ControlListener, DisplayListener
Direct Known Subclasses:
ColorPlanViewControl, ContourPlanViewControl, FlowPlanViewControl, ImagePlanViewControl, TopographyControl, ValuePlanViewControl

public abstract class PlanViewControl extends GridDisplayControl
Class to handle all kinds of PlanViews. A plan view is a horizontal slice at a level.
Version:
$Revision: 1.185 $
Author:
Unidata Development Team
  • Field Details

    • MACRO_LEVEL

      public static final String MACRO_LEVEL
      Macro for the level for the label
      See Also:
    • SHARE_LEVEL

      public static final String SHARE_LEVEL
      property for sharing levels
      See Also:
    • currentLevels

      protected Object[] currentLevels
      list of current levels
    • levelReadout

      protected JLabel levelReadout
      level readout label
    • currentSlice

      protected FieldImpl currentSlice
      current slice
    • currentLevel

      protected Object currentLevel
      current level
    • datachoice

      protected DataChoice datachoice
      data choice for the data
    • haveEnsemble

      protected boolean haveEnsemble
      flag for ensembles
  • Constructor Details

    • PlanViewControl

      public PlanViewControl()
      Cstr; does nothing. See init() for creation actions.
  • Method Details

    • getCursorReadoutData

      protected Data getCursorReadoutData() throws Exception
      Get the cursor readout data
      Overrides:
      getCursorReadoutData in class GridDisplayControl
      Returns:
      the data
      Throws:
      Exception - problem getting data
    • setCurrentSlice

      protected void setCurrentSlice(FieldImpl slice) throws Exception
      Set the current slice
      Parameters:
      slice - the slice
      Throws:
      Exception - problem setting the slice
    • getCurrentSlice

      protected FieldImpl getCurrentSlice() throws Exception
      Get the current slice
      Returns:
      the current data for the plan view
      Throws:
      Exception - problem getting the data
    • getForwardValue

      public float getForwardValue()
      Needed for bundles/persistence - pressure levels dwell rate slider and text box
      Returns:
    • setForwardValue

      public void setForwardValue(float forwardValue)
      Needed for bundles/persistence - pressure levels dwell rate slider and text box
      Parameters:
      forwardValue -
    • getCursorReadoutInner

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

      protected String getDataProjectionLabel()
      Get the Data projection label
      Overrides:
      getDataProjectionLabel in class DisplayControlImpl
      Returns:
      the label
    • addDisplaySettings

      protected void addDisplaySettings(DisplaySettingsDialog dsd)
      Add DisplaySettings appropriate for this display
      Overrides:
      addDisplaySettings in class DisplayControlImpl
      Parameters:
      dsd - the dialog to add to
    • addToRangeMenu

      public void addToRangeMenu(RangeWidget rw, List items)
      Add an entry into the range menu
      Overrides:
      addToRangeMenu in class DisplayControlImpl
      Parameters:
      rw - The widget that manages the range dialog
      items - List of menu items
    • getLevelColorRange

      protected Range getLevelColorRange()
      Get the range for the current slice.
      Returns:
      range or null
    • init

      public boolean init(DataChoice dataChoice) throws VisADException, RemoteException
      Called to make this kind of Display Control; also calls code to made the Displayable. This method is called from inside DisplayControlImpl init(several args).
      Overrides:
      init in class DisplayControlImpl
      Parameters:
      dataChoice - the DataChoice of the moment.
      Returns:
      true if successful
      Throws:
      RemoteException - Java RMI error
      VisADException - VisAD Error
    • initDone

      public void initDone()
      What to do when you are done.
      Overrides:
      initDone in class DisplayControlImpl
    • getPolyModeComboBox

      protected JComboBox getPolyModeComboBox()
      Create a jcombobox for setting the polygon mode.
      Returns:
      polygon mode combo box
    • propertyChange

      public void propertyChange(PropertyChangeEvent evt)
      Handle property change
      Specified by:
      propertyChange in interface PropertyChangeListener
      Overrides:
      propertyChange in class DisplayControlImpl
      Parameters:
      evt - The event
    • doRemove

      public void doRemove() throws RemoteException, VisADException
      Remove this control
      Specified by:
      doRemove in interface DisplayControl
      Overrides:
      doRemove in class DisplayControlImpl
      Throws:
      RemoteException - Java RMI problem
      VisADException - VisAD data problem
    • 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
      Overrides:
      haveMultipleFields in class GridDisplayControl
      Returns:
      true if there are multiple fields
    • getColorRangeIndex

      protected int getColorRangeIndex()
      Returns the index to use in the GridDataInstance array of ranges for color ranges. If we are being draped over topography then return 0. Else return the default value from the parent class.
      Overrides:
      getColorRangeIndex in class GridDisplayControl
      Returns:
      The index to be used for the color range.
    • setData

      protected boolean setData(DataChoice dataChoice) throws VisADException, RemoteException
      Called to initialize this control from the given dataChoice; sets levels controls to match data; make data slice at first level; set display's color table and display units.
      Overrides:
      setData in class DisplayControlImpl
      Parameters:
      dataChoice - choice that describes the data to be loaded.
      Returns:
      true if successful
      Throws:
      RemoteException - Java RMI error
      VisADException - VisAD Error
    • addTopographyMap

      protected void addTopographyMap() throws VisADException, RemoteException
      Wrapper around GridDisplayControl.addTopographyMap(int) to allow subclasses to set their own index.
      Throws:
      RemoteException - Java RMI error
      VisADException - VisAD error
    • addParameterTopographyMap

      protected void addParameterTopographyMap() throws VisADException, RemoteException
      Add a topography map for the parameter
      Throws:
      RemoteException - Java RMI problem
      VisADException - Unable to set the ScalarMap
    • setVerticalRange

      public void setVerticalRange(Range vertRange)
      Set the range on the parameter topography ScalarMap
      Parameters:
      vertRange - the vertical range
    • getVerticalRange

      public Range getVerticalRange()
      Get the vertical range
      Returns:
      the vertical range
    • haveLevels

      public boolean haveLevels()
      Determine whether the data in this PlanViewControl has levels or not.
      Returns:
      true if multi level data
    • setLevels

      public void setLevels(Object[] levels)
      If there are, or are not, some levels in the data, set the controls accordingly. If no levels exist, you do not enable the menu to set levels for example.
      Parameters:
      levels - array of levels
    • getEditMenuItems

      protected void getEditMenuItems(List items, boolean forMenuBar)
      Overwrite the base class method to add a Levels menu to the edit menu
      Overrides:
      getEditMenuItems in class DisplayControlImpl
      Parameters:
      items - Menu items to add to
      forMenuBar - Is this edit menu for the main menu bar
    • getPlanDisplay

      public DisplayableData getPlanDisplay()
      Return the displayable of the Plan View as a DisplayableData.
      Returns:
      DisplayableData that is being used for the main depiction of this PlanDisplay
    • getGridDisplayable

      public GridDisplayable getGridDisplayable()
      Return the Displayable of the Plan View as a GridDisplayable.
      Returns:
      Displayable cast to a GridDisplay
    • setPointSize

      public void setPointSize(float value)
      Set the point size
      Overrides:
      setPointSize in class DisplayControlImpl
      Parameters:
      value - the size
    • createPlanDisplay

      protected abstract DisplayableData createPlanDisplay() throws VisADException, RemoteException
      Method for creating the DisplayableData object that is the main depiction for the data controlled by this PlanViewControl; implemented by each subclass.
      Returns:
      DisplayableData for the data depiction.
      Throws:
      RemoteException - Java RMI error
      VisADException - VisAD Error
    • projectionChanged

      public void projectionChanged()
      Method to call if projection changes. Handle topography changes.
      Specified by:
      projectionChanged in interface DisplayControl
      Overrides:
      projectionChanged in class DisplayControlImpl
    • getLevel

      public Object getLevel()
      Return active level value.
      Returns:
      active level
    • setLevel

      public void setLevel(Object pl)
      Set the active level.
      Overrides:
      setLevel in class GridDisplayControl
      Parameters:
      pl - present level.
    • setSettingsLevel

      public void setSettingsLevel(Object level)
      Set the active level.
      Parameters:
      level - present level.
    • setDataSelectionLevel

      public void setDataSelectionLevel(Object level)
      Set the level in the data selection
      Parameters:
      level - The level
    • setLevelFromUser

      protected void setLevelFromUser(Object pl) throws VisADException, RemoteException
      Set the level from the user
      Overrides:
      setLevelFromUser in class GridDisplayControl
      Parameters:
      pl - level
      Throws:
      RemoteException - Java RMI error
      VisADException - VisAD Error
    • relocateDisplay

      public void relocateDisplay(ucar.unidata.geoloc.LatLonRect originalBounds, ucar.unidata.geoloc.LatLonRect newBounds, boolean useDataProjection)
      When we relocate a bundle this gets called to relocate the display This method gets overwritten by the probe and cross section displays so they can move their selection points to a new location
      Overrides:
      relocateDisplay in class DisplayControlImpl
      Parameters:
      originalBounds - The original bounds of the datasource
      newBounds - The relocated bounds of the datasource
    • loadDataAtLevel

      public void loadDataAtLevel(Object level) throws VisADException, RemoteException
      Load data at the level specified. Uses the working grid.
      Parameters:
      level - level to load at
      Throws:
      VisADException - illegal level or other VisAD error
      RemoteException - RMI error
    • getSliceForDisplay

      protected FieldImpl getSliceForDisplay(FieldImpl slice) throws VisADException
      Get the slice for the display
      Parameters:
      slice - slice to use
      Returns:
      slice with skip value applied
      Throws:
      VisADException - problem subsetting the slice
    • applySmoothing

      protected void applySmoothing() throws VisADException, RemoteException
      Use the value of the smoothing type and weight to subset the data.
      Overrides:
      applySmoothing in class DisplayControlImpl
      Throws:
      RemoteException - Java RMI problem
      VisADException - VisAD problem
    • checkFlag

      protected boolean checkFlag(int f)
      Test if the given flag is set in the attrbiuteFlags
      Overrides:
      checkFlag in class DisplayControlImpl
      Parameters:
      f - The flag to check
      Returns:
      Is the given flag set
    • getMacroNames

      protected void getMacroNames(List names, List labels)
      Add any macro name/label pairs
      Overrides:
      getMacroNames in class DisplayControlImpl
      Parameters:
      names - List of macro names
      labels - List of macro labels
    • addLabelMacros

      protected void addLabelMacros(String template, List patterns, List values)
      Add any macro name/value pairs.
      Overrides:
      addLabelMacros in class DisplayControlImpl
      Parameters:
      template - template
      patterns - The macro names
      values - The macro values
    • getLegendLabels

      public void getLegendLabels(List labels, int legendType)
      Append any label information to the list of labels.
      Overrides:
      getLegendLabels in class DisplayControlImpl
      Parameters:
      labels - in/out list of labels
      legendType - The type of legend, BOTTOM_LEGEND or SIDE_LEGEND
    • formatLevel

      protected String formatLevel(Object level)
      Format the level for labelling. If subclasses want to have different formatting, they can override this method. Check for 'currentLevel' to have a non-numeric: SFC, MSL, or TRO and if so, return just that String...
      Parameters:
      level - level to format
      Returns:
      formatted string for level
    • receiveShareData

      public void receiveShareData(Sharable from, Object dataId, Object[] data)
      Method called by other classes that share the selector.
      Specified by:
      receiveShareData in interface Sharable
      Overrides:
      receiveShareData in class DisplayControlImpl
      Parameters:
      from - other class.
      dataId - type of sharing
      data - Array of data being shared. In this case, the first (and only?) object in the array is the level
    • doMakeContents

      public Container doMakeContents()
      Make some Plan view controls for the UI.
      Overrides:
      doMakeContents in class DisplayControlImpl
      Returns:
      create the contents for the UI.
    • getControlWidgets

      public void getControlWidgets(List<ControlWidget> controlWidgets) throws VisADException, RemoteException
      Add in any special control widgets to the current list of widgets.
      Overrides:
      getControlWidgets in class DisplayControlImpl
      Parameters:
      controlWidgets - list of control widgets
      Throws:
      VisADException - VisAD error
      RemoteException - RMI error
    • displayUnitChanged

      protected void displayUnitChanged(Unit oldUnit, Unit newUnit)
      A hook that is called when the display unit is changed. Allows derived classes to act accordingly.
      Overrides:
      displayUnitChanged in class DisplayControlImpl
      Parameters:
      oldUnit - The old color unit
      newUnit - The new color unit
    • shouldShowLevelWidget

      protected boolean shouldShowLevelWidget()
      This allows for derived classes to turn this off. Subclasses should override if not true
      Returns:
      true
    • shouldShowZSelector

      protected boolean shouldShowZSelector()
      This allows for derived classes to turn this off. Subclasses should override if not true
      Returns:
      true
    • shouldUseZPosition

      protected boolean shouldUseZPosition()
      Determine if the display and gui should have a z position. This is only used when we are also not showing the level widget
      Returns:
      Should use z position
    • setIs2D

      public void setIs2D(boolean v)
      Set the property.
      Parameters:
      v - true if it is 2D
    • getIs2D

      public boolean getIs2D()
      Get the property.
      Returns:
      true if this is 2D data
    • setLevelReadoutLabel

      public void setLevelReadoutLabel(String text)
      Set the text for the level readout in the control window.
      Parameters:
      text - text for the level readout
    • setMultipleIsTopography

      public void setMultipleIsTopography(boolean v)
      Set the other is topography property.
      Parameters:
      v - true if second parameter is topography
    • getMultipleIsTopography

      public boolean getMultipleIsTopography()
      Get the multiple is topography property.
      Returns:
      true if multiple grid is topography
    • setParameterIsTopography

      public void setParameterIsTopography(boolean v)
      Set the parameter is topography property.
      Parameters:
      v - true if second parameter is topography
    • getParameterIsTopography

      public boolean getParameterIsTopography()
      Get the parameter is topography property.
      Returns:
      true if multiple grid is topography
    • setIgnoreVerticalDimension

      public void setIgnoreVerticalDimension(boolean v)
      Set the ignore Vertical Dimension property
      Parameters:
      v - true if vertical dimension should be ignored
    • getIgnoreVerticalDimension

      public boolean getIgnoreVerticalDimension()
      get the Ignore Vertical Dimension property
      Returns:
      true if vertical dimension should be ignored
    • getLevelsLabel

      public String getLevelsLabel()
      Get the label for the levels box.
      Returns:
      the label
    • canExportData

      public boolean canExportData()
      Can this display control write out data.
      Overrides:
      canExportData in class DisplayControlImpl
      Returns:
      true if it can
    • getDisplayedData

      protected Data getDisplayedData() throws VisADException, RemoteException
      Get the DisplayedData
      Overrides:
      getDisplayedData in class DisplayControlImpl
      Returns:
      the data or null
      Throws:
      RemoteException - problem reading remote data
      VisADException - problem gettting data
    • applySkipFactor

      protected void applySkipFactor()
      Use the value of the skip factor to subset the data.
      Overrides:
      applySkipFactor in class DisplayControlImpl
    • setPolygonMode

      public void setPolygonMode(int v)
      Set the type of depiction (solid, line, mesh) for this display
      Parameters:
      v - polygon mode. Used by XML persistence.
    • getPolygonMode

      public int getPolygonMode()
      Return the type of depiction for this display
      Returns:
      true if shading is smoothed.