Package Array

Class ArrayManager

All Implemented Interfaces:
PamSettings, PositionReference, SettingsNameProvider, PamObserver

public class ArrayManager extends PamControlledUnit implements PamSettings, PamObserver, PositionReference
Manager for different array configurations. Each array configuration is stored in it's own serialised file, which is separate from other Pam Settings so that they can be stored, emailed around, etc. In it' main serialised file controlled by PamSettingsManager, Pamguard keeps a list of recently used arrays.

The dialog ArrayDialog allows the user to load arrays from file, create new arrays, edit arrays, etc.

Author:
Doug Gillespie
See Also:
  • Field Details

    • ARRAY_TYPE_NONE

      public static final int ARRAY_TYPE_NONE
      No array specified
      See Also:
    • ARRAY_TYPE_POINT

      public static final int ARRAY_TYPE_POINT
      Point array (single phone or multiple phones at same point)
      See Also:
    • ARRAY_TYPE_LINE

      public static final int ARRAY_TYPE_LINE
      Line array of two or more elements
      See Also:
    • ARRAY_TYPE_PLANE

      public static final int ARRAY_TYPE_PLANE
      Three or more Hydrophones all in the same plane
      See Also:
    • ARRAY_TYPE_VOLUME

      public static final int ARRAY_TYPE_VOLUME
      Four or more hydrophones not in the same plane.
      See Also:
    • arrayManagerType

      public static String arrayManagerType
      The array manager.
    • DEFAULT_HYDROPHONE_SENSITIVITY

      public static final double DEFAULT_HYDROPHONE_SENSITIVITY
      See Also:
    • DEFAULT_PREAMP_GAIN

      public static final double DEFAULT_PREAMP_GAIN
      See Also:
  • Method Details

    • getObserverObject

      public PamObserver getObserverObject()
      Specified by:
      getObserverObject in interface PamObserver
      Returns:
      the actual observer. In most cases concrete classes will just return 'this' in response. The exception is the Threaded observer, which will return the single thread observer.
    • getArrayManager

      public static ArrayManager getArrayManager()
    • notifyModelChanged

      public void notifyModelChanged(int changeType)
      Description copied from class: PamControlledUnit
      General notification when the PAMGAURD model changes.
      Overrides:
      notifyModelChanged in class PamControlledUnit
      Parameters:
      changeType - type of change
    • getArrayFileType

      public static String getArrayFileType()
      Returns:
      Returns the arrayFileType.
    • getRecentArrays

      public ArrayList<PamArray> getRecentArrays()
      Returns:
      Returns the recentArrays.
    • getArrayCount

      public int getArrayCount()
    • showArrayDialog

      public void showArrayDialog(Frame parentFrame)
    • addArray

      public void addArray(PamArray newArray)
    • setCurrentArray

      public void setCurrentArray(PamArray array)
    • removeArray

      public boolean removeArray(PamArray newArray)
    • 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
    • getUnitName

      public String getUnitName()
      Description copied from class: PamControlledUnit
      Returns the name of the unit
      Specified by:
      getUnitName in interface SettingsNameProvider
      Overrides:
      getUnitName in class PamControlledUnit
      Returns:
      the name of the unit
    • getUnitType

      public String getUnitType()
      Specified by:
      getUnitType in interface PamSettings
      Overrides:
      getUnitType in class PamControlledUnit
      Returns:
      A Name specific to the type, e.g. Click detector
    • 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
    • getCurrentArray

      public PamArray getCurrentArray()
      Returns:
      Returns the currentArray.
    • loadArrayFromFile

      public static PamArray loadArrayFromFile(String fileName)
    • saveArrayToFile

      public static boolean saveArrayToFile(PamArray array)
    • getObserverName

      public String getObserverName()
      Specified by:
      getObserverName in interface PamObserver
    • getRequiredDataHistory

      public long getRequiredDataHistory(PamObservable o, Object arg)
      Specified by:
      getRequiredDataHistory in interface PamObserver
      Parameters:
      arg - optional argument from PamObservable
      Returns:
      time in milliseconds required by data held in PamObservable
    • noteNewSettings

      public void noteNewSettings()
      Specified by:
      noteNewSettings in interface PamObserver
    • removeObservable

      public void removeObservable(PamObservable o)
      Description copied from interface: PamObserver
      called when an Observable (PamDataBlock) is removed from the system
      Specified by:
      removeObservable in interface PamObserver
    • setSampleRate

      public void setSampleRate(float sampleRate, boolean notify)
      Description copied from interface: PamObserver
      New sample rate
      Specified by:
      setSampleRate in interface PamObserver
      Parameters:
      notify - Notify other PamObservers and PamObservables in the chain.
    • masterClockUpdate

      public void masterClockUpdate(long milliSeconds, long sampleNumber)
      Specified by:
      masterClockUpdate in interface PamObserver
    • addData

      public void addData(PamObservable o, PamDataUnit arg)
      Description copied from interface: PamObserver
      Informs the PamObserver that new data have been added to the Observable class
      Specified by:
      addData in interface PamObserver
    • updateData

      public void updateData(PamObservable o, PamDataUnit arg)
      Description copied from interface: PamObserver
      Informs the PamObserver that existing data have been updated
      Specified by:
      updateData in interface PamObserver
    • getArrayType

      public int getArrayType()
      Returns:
      the type of the current array (point, planar, line, etc)
    • getArrayType

      public int getArrayType(int phones)
      Parameters:
      phones -
      Returns:
      the type of a sub array of the current array (point, planar, line, etc)
    • getArrayShape

      public int getArrayShape(PamArray array)
      Parameters:
      array - a PAMGUARD array
      Returns:
      the type of an array (point, plane, etc)
    • getArrayShape

      public int getArrayShape(PamArray array, int phones)
      Parameters:
      array - a PAMGUARD array
      phones - a sub array of phones in the pam array.
      Returns:
      the type of an array (point, plane, etc)
    • getSpatiallyUniquePhones

      public int getSpatiallyUniquePhones(PamArray array, int phones)
      Take a list of phones and return a list of ones which are at unique positions.
      Parameters:
      array - hydrophone array
      phones - bitmap of hydrophone numbers
      Returns:
      bitmap of hydrophones which have a unique position.
    • getArrayDirections

      public PamVector[] getArrayDirections()
      Get the principle direction vectors for the current array
      Returns:
      Array of vectors pointing along the array principle axes.
    • getArrayDirection

      public PamVector[] getArrayDirection(int phones)
      Get the principle direction vectors for a sub set of hydrophones within the current array
      Parameters:
      phones - bitmap of hydrophones
      Returns:
      Array of vectors pointing along the array principle axes.
    • getArrayDirections

      public PamVector[] getArrayDirections(PamArray array)
      Get a set of vectors which define the principle coordinates of an array
      Parameters:
      array - array
      Returns:
      array of vectors
    • getArrayDirections

      public PamVector[] getArrayDirections(PamArray array, int phones)
      Get a set of vectors which define the principle components of an array.

      For a point array, null is returned

      For a line array a vector pointing along the array in the direction closest to the y axis

      For a planar array a vector pointing as closely as possible to the y axis and a second vector, perpendicular to the first, obeying a right hand rule, in the plane will be returned.

      For a volumetric array, the above + the third vector (vec product of the other two).

      Parameters:
      array - Pamguard array
      phones - phones included in a sub array.
      Returns:
      up to three vectors defining the components of the array.
    • getArrayVectors

      public PamVector[] getArrayVectors(PamArray array, int phones)
    • getArrayTypeString

      public static String getArrayTypeString(int arrayType)
    • getHydrophoneDataBlock

      public HydrophoneDataBlock getHydrophoneDataBlock()
      Called from the network receiver to create and assign some specific hydrophone streamer within an array and to clone a streamer to make a new one if necessary
      Parameters:
      buoyStats -
    • getStreamerDatabBlock

      public StreamerDataBlock getStreamerDatabBlock()
    • getHydrophoneSQLLogging

      public HydrophoneSQLLogging getHydrophoneSQLLogging()
    • getGPSDataBlock

      public static GPSDataBlock getGPSDataBlock()
      Gets the GPS data block, if there is one. If no datablock is present then returns null;
      Returns:
      reference to the gps data block (if there is one)
    • showHydrophoneImportDialog

      public void showHydrophoneImportDialog(JFrame guiFrame)
    • showStreamerImportDialog

      public void showStreamerImportDialog(JFrame guiFrame)
    • getSnapshotGeometry

      public SnapshotGeometry getSnapshotGeometry(int hydrophoneMap, long timeMillis)
      Make an ordered set of geometry data for the given hydrophones. data rows will be null if a hydrophone isn't used. Geometry is all returned in cartesian coordinates relative to the reference point which is the position of the first hydrophone streamer. All individual hydrophones have their pitch, roll and everything else added within this function.
      Parameters:
      hydrophoneMap - bitmap of used hydrophones
      Returns:
      geometry data.
    • getGUI

      public PamControlledUnitGUI getGUI(int flag)
      Description copied from class: PamControlledUnit
      Get the GUI for the PAMControlled unit. This has multiple GUI options which are instantiated depending on the view type.
      Overrides:
      getGUI in class PamControlledUnit
      Parameters:
      flag - . The GUI type flag defined in PAMGuiManager.
      Returns:
      the GUI for the PamControlledUnit unit.
    • getReferencePosition

      public GpsData getReferencePosition(long timeMillis)
      Description copied from interface: PositionReference
      Get position data, with heading information if possible.
      Specified by:
      getReferencePosition in interface PositionReference
      Parameters:
      timeMillis - time for position (will usually be latest)
      Returns:
      GPS position with heading
    • getReferenceName

      public String getReferenceName()
      Description copied from interface: PositionReference
      Name of the reference.
      Specified by:
      getReferenceName in interface PositionReference
      Returns:
    • receiveSourceNotification

      public void receiveSourceNotification(int type, Object object)
      Description copied from interface: PamObserver
      Receive a notification from the data source - typically a change in DAQ status. See the constants listed in AcquisitionProcess for potential change types.
      Specified by:
      receiveSourceNotification in interface PamObserver
      Parameters:
      type - the type of change
      object - generic object added here so that we can include anything in the future