Class GlobalMediumManager

java.lang.Object
PamController.soundMedium.GlobalMediumManager
All Implemented Interfaces:
PamSettings, SettingsNameProvider

public class GlobalMediumManager extends Object implements PamSettings
Manages the global medium @see GlobalMedium
Author:
Jamie Macaulay
  • Field Details

    • warning

      public String warning
  • Constructor Details

    • GlobalMediumManager

      public GlobalMediumManager(PamController pamController)
  • Method Details

    • addGlobalMediumMenuItems

      public void addGlobalMediumMenuItems(JMenu menu, JFrame frame)
      Add menu items to the swing menu
      Parameters:
      menu - - the menu item to add to
    • setCurrentMedium

      public void setCurrentMedium(GlobalMedium.SoundMedium currentMedium)
      Set the current medium and notify all modules of the change.
      Parameters:
      currentMedium - - the current medium.
      notify - - notify of a medium change.
    • setCurrentMedium

      public void setCurrentMedium(GlobalMedium.SoundMedium currentMedium, boolean notify)
      Set the current medium
      Parameters:
      currentMedium - - the current medium.
      notify - - notify of a medium change.
    • getRecieverString

      public String getRecieverString(boolean caps)
      Get the string for the receiver type for the current medium e.g. hydrophone, microphone.
      Parameters:
      caps - - true to have the first letter capitalised
      Returns:
      the receiver name.
    • getRecieverString

      public String getRecieverString()
      Get the string for the receiver type for the current medium e.g. hydrophone, microphone.
      Returns:
      the reciever name.
    • getdBSensString

      public String getdBSensString()
      Get the string for the default dB reference unit for receiver sensitivity e.g. dB re 1V/uPa
      Returns:
      the string for sensitivity values.
    • getdBRefString

      public String getdBRefString()
      Get the string for the default dB reference unit e.g. dB re 1uPa.
      Returns:
      the string for dB values.
    • getZCoeff

      public double getZCoeff()
      Get the height coefficient value for displays. Heights are always stored so that +z points up (i.e. -g). In display height is input as depth as so must be multiplied by -1 before being stored. In air height is more sensible to think of as +z and so does not need multiplied (or multiplied by 1). The height coefficient is the value height inputs are multiplied before being stored. @see getZString
      Returns:
      the height coefficient.
    • getZString

      public String getZString()
      Get the z string for displays. Heights are always stored so that +z points up (i.e. -g). In display height is input as depth as so must be multiplied by -1 before being stored. In air height is more sensible to think of as +z and so does not need multiplied (or multiplied by 1). The height coefficient is the value height inputs are multiplied before being stored. @see getZString
      Returns:
      the height coefficient.
    • getZString

      public String getZString(boolean caps)
      Get the z string for displays. Heights are always stored so that +z points up (i.e. -g). In display height is input as depth as so must be multiplied by -1 before being stored. In air height is more sensible to think of as +z and so does not need multiplied (or multiplied by 1). The height coefficient is the value height inputs are multiplied before being stored. @see getZString
      Parameters:
      boolean - caps - true to capitalise the first letter.
      Returns:
      the height coefficient.
    • getDefaultSoundSpeed

      public double getDefaultSoundSpeed()
      Get the default sound speed for the current medium.
      Returns:
      the default sound speed in meters per second.
    • getDefaultRecieverSens

      public double getDefaultRecieverSens()
      Get the default sensitivity of receivers. This is a very variable value but will be a few tens of dB out instead of a few hundred.
      Returns:
      the default receiver sensitivity in getdBSensString() units.
    • getdBSensOffset

      public double getdBSensOffset()
      Get the dB offset to convert form sensitivity value units to received amplitude units. Sensitivity values in PG are always stored in the same reference as received amplitude. However they may be different units in the display because terrestrial acoustics is annoying.

      Add this to input from display to get stored unit. Subtract to get display units.

      Returns:
      the daB offset.
    • getDefaultdBHzScales

      public double[] getDefaultdBHzScales()
      Get default scales for dB/Hz. Typically this is used for spectrogram colour limits.
      Returns:
      the default minim and maximum scale in dB/Hz
    • getCurrentMedium

      public GlobalMedium.SoundMedium getCurrentMedium()
      Get the current medium sound is travelling through.
      Returns:
      the current soun medium.
    • getDefaultAmplitudeScales

      public double[] getDefaultAmplitudeScales()
    • getGlobalMediumParameters

      public GlobalMediumParams getGlobalMediumParameters()
      Returns:
      the globalMediumParameters
    • getUnitName

      public String getUnitName()
      Specified by:
      getUnitName in interface SettingsNameProvider
      Returns:
      A Name specific to this instance of the particular class, e.g. Sperm whale detector, Beaked whale detector, etc.
    • getUnitType

      public String getUnitType()
      Specified by:
      getUnitType in interface PamSettings
      Returns:
      A Name specific to the type, e.g. Click detector
    • getSettingsReference

      public Serializable getSettingsReference()
      Specified by:
      getSettingsReference in interface PamSettings
      Returns:
      The serialisable object that will be stored
    • getSettingsVersion

      public long getSettingsVersion()
      Specified by:
      getSettingsVersion in interface PamSettings
      Returns:
      An integer version number for the settings
    • restoreSettings

      public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings)
      Specified by:
      restoreSettings in interface PamSettings
      Returns:
      true if successful The object performs final checks (if needed) and then casts the settings data pamcontrolledunitSettings.settings into the correct type and uses as required