Package clickDetector

Class ClickControl

All Implemented Interfaces:
LocalisationAlgorithm, PamSettings, SettingsNameProvider
Direct Known Subclasses:
STClickControl

public class ClickControl extends PamControlledUnit implements PamSettings, LocalisationAlgorithm
Main Controller for click detection.

ClickControl contains both the detector and the display panel. It also contains information on Detection and Display menus which will get added to the main PamGuard menu.

Author:
Doug Gillespie
  • Field Details

  • Constructor Details

    • ClickControl

      public ClickControl(String name)
      Old style constructor which only gets a name
      Parameters:
      name -
    • ClickControl

      public ClickControl(PamConfiguration pamConfiguration, String name)
      New style constructor which get a configuraiton and a name.
      Parameters:
      pamConfiguration -
      name -
  • Method Details

    • getClickTypeMasterManager

      public ClickTypeMasterManager getClickTypeMasterManager()
      Get the click type master manager. This manages all possible click species type, including those of downstream processes.
      Returns:
      the clickTypeMasterManager
    • removeUnit

      public boolean removeUnit()
      Description copied from class: PamControlledUnit
      Called to remove a unit.
      Overrides:
      removeUnit in class PamControlledUnit
      Returns:
      try (not used)
    • getClickDataBlock

      public ClickDataBlock getClickDataBlock()
      Get the datablock containing click data
      Returns:
      Click data block
    • isViewerMode

      public boolean isViewerMode()
      Speedier way of knowing if it's viewer mode than going back to the controller every time
      Returns:
    • secondTimer

      public void secondTimer(long sampleNumber)
    • getTrueChannelNumber

      public int getTrueChannelNumber(int iCh)
    • displayTriggerHistogram

      public void displayTriggerHistogram(TriggerHistogram[] triggerHistogram)
    • notifyNewStorage

      public void notifyNewStorage(String storageName)
    • createDetectionMenu

      public JMenu createDetectionMenu(Frame parentFrame)
      Description copied from class: PamControlledUnit
      Create a JMenu object containing MenuItems associated with PamProcesses
      Overrides:
      createDetectionMenu in class PamControlledUnit
      Parameters:
      parentFrame - The owner frame of the menu
      Returns:
      reference to a JMenu which can be added to an existing menu or menu bar

      Note that if multiple views are to use the same menu, then they should each create a new menu (by setting Create to true) the first time they call this method.

    • createDisplayMenu

      public JMenu createDisplayMenu(Frame parentFrame)
      Description copied from class: PamControlledUnit
      Create a JMenu object containing MenuItems associated with the view
      Overrides:
      createDisplayMenu in class PamControlledUnit
      Returns:
      reference to a JMenu which can be added to an existing menu or menu bar

      Note that if multiple views are to use the same menu, then they should each create a new menu (by setting Create to true) the first time they call this method.

    • 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
    • classificationDialog

      public boolean classificationDialog(Frame pf)
      Opens the offline click dialog.
      Parameters:
      pf - frame
      Returns:
      Returns true if settings have changed
    • batchConvertClickDatabase

      public void batchConvertClickDatabase(Frame parentFrame)
    • getClickDetector

      public ClickDetector getClickDetector()
    • pamStart

      public void pamStart()
    • pamStop

      public void pamStop()
    • canClose

      public boolean canClose()
      Description copied from class: PamControlledUnit
      Called before Pamguard shuts down. Rather than returning false, this function can be used as a final oportunity to save settings, write to the database, etc.
      Overrides:
      canClose in class PamControlledUnit
      Returns:
      true if OK for Pamguard to shut down, false otherwise.
    • getSettingsVersion

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

      public Serializable getSettingsReference()
      Specified by:
      getSettingsReference in interface PamSettings
      Returns:
      The serialisable object that will be stored
    • 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
    • getTabSpecificMenuBar

      public JMenuBar getTabSpecificMenuBar(Frame parentFrame, JMenuBar standardMenu, PamGui pamGui)
      Description copied from class: PamControlledUnit
      Create a tab specific menu to go with this PamControlledUnit.

      Default is to throw back the standard menu to be used. This function should clone the standard menu and then modify the clone (usually by replacing the Display sub menu)

      Overrides:
      getTabSpecificMenuBar in class PamControlledUnit
      Parameters:
      standardMenu - the standard menu for the Pam GUI.
      Returns:
      a complete menu bar to be shown while a particular tab is selected
    • addOtherRelatedMenuItems

      public void addOtherRelatedMenuItems(Frame parentFrame, JMenu menu, String name)
      Overrides:
      addOtherRelatedMenuItems in class PamControlledUnit
    • setupControlledUnit

      public void setupControlledUnit()
      Description copied from class: PamControlledUnit
      called for all PamControlledUnits after all units have been created. This is a good time for the controlled units and processes to find and check their source data and the configuration generally since most onjects (i.e. output data blocks) should be in place
      Overrides:
      setupControlledUnit in class PamControlledUnit
    • getClickIdentifier

      public ClickIdentifier getClickIdentifier()
    • setClickIdentifier

      public void setClickIdentifier(ClickIdentifier clickIdentifier)
    • setClassifierManager

      public void setClassifierManager(ClickClassifierManager classifierManager)
      Parameters:
      classifierManager - the classifierManager to set
    • getClassifierManager

      public ClickClassifierManager getClassifierManager()
      Returns:
      the classifierManager
    • getClickParameters

      public ClickParameters getClickParameters()
    • setClickParameters

      public void setClickParameters(ClickParameters clickParameters)
    • offlineDataChanged

      public void offlineDataChanged()
      Called from clicksOffline when data have changed (eg from re doing click id). Needs to notify the display and maybe some other classes.
    • getOfflineToolbar

      public OfflineToolbar getOfflineToolbar()
    • getClicksOffline

      public ClicksOffline getClicksOffline()
      Returns:
      the clicksOffline
    • getLatestOfflineEvent

      public OfflineEventDataUnit getLatestOfflineEvent()
      Returns:
      the latestOfflineEvent
    • setLatestOfflineEvent

      public void setLatestOfflineEvent(OfflineEventDataUnit latestOfflineEvent)
      Parameters:
      latestOfflineEvent - the latestOfflineEvent to set
    • showOfflineEvents

      public void showOfflineEvents(Frame frame)
      Show a list of offline events. Later on will add more functionality to it.
      Parameters:
      frame -
    • gotoEvent

      public void gotoEvent(OfflineEventDataUnit event, int beforeTime)
      Scrolls the display to a specific event.
      Parameters:
      event - event to scroll to
      beforeTime -
    • deleteEvent

      public void deleteEvent(OfflineEventDataUnit event)
      Delete an offline event. Un-assign all clicks and delete from datablock, ready for deletion from database.
      Parameters:
      event - event to delete.
    • canPlayViewerSound

      public boolean canPlayViewerSound()
      Overrides:
      canPlayViewerSound in class PamControlledUnit
      Returns:
      true if this module can play sound in response to a play command from the top toolbar.
    • playViewerSound

      public void playViewerSound()
      Description copied from class: PamControlledUnit
      Start playing sound in reponse to a call from the viewer top toolbar.
      Overrides:
      playViewerSound in class PamControlledUnit
    • playClicks

      public void playClicks()
    • getEchoDetectionSystem

      public EchoDetectionSystem getEchoDetectionSystem()
      Returns:
      the echoDetectionSystem
    • setEchoDetectionSystem

      public void setEchoDetectionSystem(EchoDetectionSystem echoDetectionSystem)
      Parameters:
      echoDetectionSystem - the echoDetectionSystem to set
    • displayActivated

      public void displayActivated(ClickDisplay clickDisplay)
    • getDisplayManager

      public ClickDisplayManager getDisplayManager()
    • getDataBlockPrefix

      public String getDataBlockPrefix()
      Solve problems with all click data blocks being called the same thing if multiple click detectors are in the system.
      Returns:
      a name, defaulting to "" if it's the first created click detector.
    • getModuleSummary

      public String getModuleSummary()
      Description copied from class: PamControlledUnit
      Get a module summary text string for shorthand output to anyting wanting a short summary of data state / numbers of detections.
      You should not override this version of the function, but instead override getModuleSummary(boolean clear) which allows for optional clearing of summary data.
      Overrides:
      getModuleSummary in class PamControlledUnit
      Returns:
      module summary string - goings on since the last call to this function
    • getShortUnitType

      public Object getShortUnitType()
      Overrides:
      getShortUnitType in class PamControlledUnit
      Returns:
      a shortened version of the unit type for use in module summary strings.
    • getAlarmCounterProvider

      public AlarmCounterProvider getAlarmCounterProvider()
      Get the counting system for the click alarm.
      Parameters:
      alarmControl -
      Returns:
    • getTargetMotionLocaliser

      public TargetMotionLocaliser<GroupDetection> getTargetMotionLocaliser()
    • removeFromEvents

      public void removeFromEvents(List<PamDataUnit> markedClicks)
      Remove clicks from existing events, if they have any. They may not. This is called whenever clicks are assigned to a new event to make sure that they don't end up in two events.
      Parameters:
      markedClicks -
    • reassignEventClicks

      public void reassignEventClicks(OfflineEventDataUnit clickEvent, OfflineEventDataUnit reassignEvent)
      Reassign all the clicks on one event to a different event
      Parameters:
      clickEvent - event to take the clicks from
      reassignEvent - event to add the clicks to.
    • findRawDataBlock

      public PamRawDataBlock findRawDataBlock()
      Returns the raw data block
      Returns:
    • getClickTrainDetector

      public ClickTrainDetector getClickTrainDetector()
      Get the click train detector.
      Returns:
      the clickTrainDetector
    • getGUI

      public PamControlledUnitGUI getGUI(int flag)
      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.
    • getFFTDataOrganiser

      public FFTDataOrganiser getFFTDataOrganiser()
      Returns:
      a master data organiser.
    • getAlgorithmInfo

      public LocalisationAlgorithmInfo getAlgorithmInfo()
      Description copied from interface: LocalisationAlgorithm
      Get information about the localisation algorithm.
      Specified by:
      getAlgorithmInfo in interface LocalisationAlgorithm
      Returns:
      algorithm information.
    • getTethysCreator

      public LocalizationCreator getTethysCreator()
      Description copied from interface: LocalisationAlgorithm
      Get something that can make LocalisationType objects of a form a bit bespoke to the type of localiser. This may be better than having the standard functions in LocalizationBuilder guess what's best.
      Specified by:
      getTethysCreator in interface LocalisationAlgorithm
      Returns:
      can be null in which case standard functions will do the best they can.