Class RangeAndBearingControl

All Implemented Interfaces:
ActionListener, ItemListener, PropertyChangeListener, EventListener, HyperlinkListener, Sharable, DataChangeListener, DisplayControl, Prototypable, DisplayableData.DragAdapter, ControlListener, DisplayListener

public class RangeAndBearingControl extends DisplayControlImpl implements ActionListener, PropertyChangeListener, DisplayableData.DragAdapter
Class to make a dragable line with end points which computes the range and bearing between the end points. Also makes a JFrame with text display of range and bearing values, and control buttoms to remove the whole thing etc.
Version:
$Revision: 1.87 $
Author:
Jeff McWhirter
  • Field Details

  • Constructor Details

    • RangeAndBearingControl

      public RangeAndBearingControl()
      Default Constructor. Set the flags to tell that this display control wants a color widget.
  • Method Details

    • getCrossSectionSelector

      public CrossSectionSelector getCrossSectionSelector()
      Return the selector line with end points.
      Returns:
      a CrossSectionSelector the selector line with end points.
    • init

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

      protected void getEditMenuItems(List items, boolean forMenuBar)
      Add the relevant edit menu items into the list
      Overrides:
      getEditMenuItems in class DisplayControlImpl
      Parameters:
      items - List of menu items
      forMenuBar - Is this for the menu in the window's menu bar or for a popup menu in the legend
    • doRemove

      public void doRemove() throws VisADException, RemoteException
      Remove the display control
      Specified by:
      doRemove in interface DisplayControl
      Overrides:
      doRemove in class DisplayControlImpl
      Throws:
      RemoteException - Bad things
      VisADException - Bad things
    • doMakeContents

      public Container doMakeContents()
      Make the UI contents for this control.
      Overrides:
      doMakeContents in class DisplayControlImpl
      Returns:
      UI container
    • addPropertiesComponents

      protected void addPropertiesComponents(JTabbedPane jtp)
      Add the earth tab
      Overrides:
      addPropertiesComponents in class DisplayControlImpl
      Parameters:
      jtp - the tabbed pane
    • doApplyProperties

      public boolean doApplyProperties()
      apply the earth properties
      Overrides:
      doApplyProperties in class DisplayControlImpl
      Returns:
      ok
    • makeDefaultLinePosition

      public RealTuple[] makeDefaultLinePosition(NavigatedDisplay mapDisplay) throws VisADException, RemoteException
      A utility method to create the initial line position
      Parameters:
      mapDisplay - The display
      Returns:
      An array of size 2 that holds the start and end position
      Throws:
      RemoteException - On badness
      VisADException - On badness
    • constrainDragPoint

      public boolean constrainDragPoint(float[] position)
      Constrain the altitude of the drag point
      Specified by:
      constrainDragPoint in interface DisplayableData.DragAdapter
      Parameters:
      position - point position
      Returns:
      continue dragging
    • handleDragDirect

      public boolean handleDragDirect(VisADRay ray, boolean first, int mouseModifiers)
      method for dragadapter interface
      Specified by:
      handleDragDirect in interface DisplayableData.DragAdapter
      Parameters:
      ray - the ray
      first - first time
      mouseModifiers - event
      Returns:
      ok
    • handleAddPoint

      public boolean handleAddPoint(float[] x)
      method for dragadapter interface
      Specified by:
      handleAddPoint in interface DisplayableData.DragAdapter
      Parameters:
      x - points
      Returns:
      ok
    • getInitialZPosition

      protected double getInitialZPosition()
      get the initial z position to use. If in globe return 0
      Overrides:
      getInitialZPosition in class DisplayControlImpl
      Returns:
      z position
    • applyZPosition

      protected void applyZPosition() throws VisADException, RemoteException
      Override this and just force a change in position topickup the new z
      Overrides:
      applyZPosition in class DisplayControlImpl
      Throws:
      RemoteException - On badness
      VisADException - On badness
    • getSelectorAltitude

      public double getSelectorAltitude() throws VisADException, RemoteException
      Get the fixed altitude for the selector
      Returns:
      altitude
      Throws:
      RemoteException - On badness
      VisADException - On badness
    • propertyChange

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

      public void transectPositionChanged(boolean fromSelector)
      Method to perform what needs to be done when transect position changes.
      Parameters:
      fromSelector - true if from the selector
    • receiveShareData

      public void receiveShareData(Sharable from, Object dataId, Object[] data)
      Accept and check sharable data.
      Specified by:
      receiveShareData in interface Sharable
      Overrides:
      receiveShareData in class DisplayControlImpl
      Parameters:
      from - object sending shared data
      dataId - id for sharable data
      data - the data
    • setNewDisplayUnit

      protected boolean setNewDisplayUnit(Unit newUnit, boolean applyToDisplayable)
      Override base class method toact when the display unit has changed
      Overrides:
      setNewDisplayUnit in class DisplayControlImpl
      Parameters:
      newUnit - The new unit
      applyToDisplayable - Some parameter
      Returns:
      Was successful
    • getLegendLabels

      public void getLegendLabels(List labels, int legendType)
      Get the extra label used for the legend.
      Overrides:
      getLegendLabels in class DisplayControlImpl
      Parameters:
      labels - labels to append to
      legendType - The type of legend, BOTTOM_LEGEND or SIDE_LEGEND
    • actionPerformed

      public void actionPerformed(ActionEvent event)
      Deal with action events from the gui controls made by this class.
      Specified by:
      actionPerformed in interface ActionListener
      Overrides:
      actionPerformed in class DisplayControlImpl
      Parameters:
      event - action event to check
    • getPointOfSelector

      public RealTuple getPointOfSelector(int which) throws VisADException, RemoteException
      Return the x/y location of the given end point of the CrossSectionSelector
      Parameters:
      which - which end (start or end)
      Returns:
      position
      Throws:
      RemoteException - Java RMI error
      VisADException - VisAD Error
    • setStartLat

      public void setStartLat(float value)
      Set the starting latitude property. Used by XML persistence.
      Parameters:
      value - starting latitude
    • getStartLat

      public float getStartLat()
      Get the starting latitude property. Use by XML persistence.
      Returns:
      starting latitude
    • setStartLon

      public void setStartLon(float value)
      Set the starting longitude property. Used by XML persistence.
      Parameters:
      value - starting longitude
    • getStartLon

      public float getStartLon()
      Set the starting longitude property. Used by XML persistence.
      Returns:
      starting longitude
    • setEndLat

      public void setEndLat(float value)
      Set the ending latitude property. Used by XML persistence.
      Parameters:
      value - ending latitude
    • getEndLat

      public float getEndLat()
      Get the ending latitude property. Used by XML persistence.
      Returns:
      ending latitude
    • setEndLon

      public void setEndLon(float value)
      Set the ending longitude property. Used by XML persistence.
      Parameters:
      value - ending longitude
    • getEndLon

      public float getEndLon()
      Get the ending longitude property. Used by XML persistence.
      Returns:
      ending longitude
    • setStartPoint

      public void setStartPoint(RealTuple rt)
      Set the starting point
      Parameters:
      rt - start point
    • setEndPoint

      public void setEndPoint(RealTuple rt)
      Set the ending point
      Parameters:
      rt - end point
    • getStartStation

      public NamedStationImpl getStartStation()
      Get the starting station property.
      Returns:
      starting station
    • setStartStation

      public void setStartStation(NamedStationImpl n)
      Set the starting station property.
      Parameters:
      n - starting station
    • getEndStation

      public NamedStationImpl getEndStation()
      Get the ending station property.
      Returns:
      ending station
    • setEndStation

      public void setEndStation(NamedStationImpl n)
      Set the ending station property.
      Parameters:
      n - ending station
    • setStationTableName

      public void setStationTableName(String value)
      Set the StationTableName property.
      Parameters:
      value - The new value for StationTableName
    • getStationTableName

      public String getStationTableName()
      Get the StationTableName property.
      Returns:
      The StationTableName
    • setPlanet

      public void setPlanet(ucar.unidata.geoloc.Earth value)
      Set the Planet property.
      Parameters:
      value - The new value for Planet
    • getPlanet

      public ucar.unidata.geoloc.Earth getPlanet()
      Get the Planet property.
      Returns:
      The Planet