Package Map

Class SimpleMap

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, PamSettings, SettingsNameProvider, PamObserver, PamScrollObserver, UserDisplayComponent

public class SimpleMap extends JPanel implements PamObserver, PamScrollObserver, PamSettings, UserDisplayComponent
Mainly a container for map objects, holding the main MapPanel and the right hand control items.
Originally written by Dave McLaren. Modified by Doug Gillespie to incorporate controls onto main panel to increase overall visible size.
See Also:
  • Constructor Details

    • SimpleMap

      public SimpleMap(MapController mapController, boolean isMainTab, MapPanel mapPanel)
    • SimpleMap

      public SimpleMap(MapController mapController, boolean isMainTab)
  • Method Details

    • getSelectorName

      public String getSelectorName()
      Name for data selectors and data filters.
      Returns:
    • 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()
      Settings manager for when there are multiple maps in user displays.
      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
    • 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.
    • getMapTime

      public long getMapTime()
      Get the time for the map (used when deciding what to plot)
      Returns:
      time from either the pamguard clock or the scroll bar.
    • shouldPlot

      public boolean shouldPlot(PamDataBlock pamDataBlock)
      ShouldPlot function for a datablock, moved here from mappanel so that we can override for a special map for Target motion (and other) dialogs
      Parameters:
      pamDataBlock -
      Returns:
      true if anything in that datablock should be displayed.
    • shouldPlot

      public boolean shouldPlot(PamDataUnit pamDataUnit, MapDetectionData mapDetectionData, long earliestToPlot, long now, DataSelector ds)
      Shouldplot function for individual data units.
      Parameters:
      pamDataUnit -
      mapDetectionData -
      earliestToPlot -
      now -
      ds -
      Returns:
    • getMapParameters

      public MapParameters getMapParameters()
      Returns:
      The map parameters object.
    • showMapObjects

      public void showMapObjects()
    • initMapPanel

      public void initMapPanel()
    • getMapPanel

      public MapPanel getMapPanel()
    • 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 observable, PamDataUnit pamDataUnit)
      Description copied from interface: PamObserver
      Informs the PamObserver that existing data have been updated
      Specified by:
      updateData in interface PamObserver
    • getObserverName

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

      public void noteNewSettings()
      Specified by:
      noteNewSettings 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
    • 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
    • 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
    • getDataBlocks

      public ArrayList<PamDataBlock> getDataBlocks()
    • getMousedDataUnit

      public PamDataUnit getMousedDataUnit()
      Gets a data unit currently hovered by the mouse. This only gets set if the mouse actually hovers and is then clicked.
      Returns:
      hovered data unit.
    • 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
    • getLastClickedMouseLatLong

      public LatLong getLastClickedMouseLatLong()
    • getMouseMotion

      public Map.SimpleMap.MapMouseMotionAdapter getMouseMotion()
    • getPanel

      public JComponent getPanel()
    • addMouseAdapterToMapPanel

      public void addMouseAdapterToMapPanel(MouseAdapter mouseAdapter)
    • mapCanScroll

      public void mapCanScroll(boolean b)
    • refreshDetectorList

      public void refreshDetectorList()
    • scrollRangeChanged

      public void scrollRangeChanged(AbstractPamScroller absPamScroller)
      Description copied from interface: PamScrollObserver
      Notification sent when a scroller or slider changes it's data range

      If data were loaded in a worker thread, this notification is sent after the new data have loaded.

      Specified by:
      scrollRangeChanged in interface PamScrollObserver
      Parameters:
      absPamScroller - reference to moved scroller.
    • scrollValueChanged

      public void scrollValueChanged(AbstractPamScroller abstractPamScroller)
      Description copied from interface: PamScrollObserver
      Notification sent when a scroller or slider changes it's position
      Specified by:
      scrollValueChanged in interface PamScrollObserver
      Parameters:
      abstractPamScroller - reference to moved scroller
    • subscribeViewerBlocks

      public boolean subscribeViewerBlocks()
      Subscribes a variety of data blocks to the scroll bar.
      Returns:
      returns true if the list has changes, indicating that it's probably necessary to call loadData in the scroll manager to get new data.
    • getViewerScroller

      public PamScrollSlider getViewerScroller()
    • createDisplayMenu

      public JMenu createDisplayMenu(Frame parentFrame)
    • getOptionsMenuItem

      public JMenuItem getOptionsMenuItem(Frame parentFrame)
    • showParametersDialog

      public boolean showParametersDialog(Window parentFrame)
    • getComponent

      public Component getComponent()
      Specified by:
      getComponent in interface UserDisplayComponent
      Returns:
      The Swing component to add to the frame
    • openComponent

      public void openComponent()
      Description copied from interface: UserDisplayComponent
      Called when the component is first displayed.
      Specified by:
      openComponent in interface UserDisplayComponent
    • closeComponent

      public void closeComponent()
      Description copied from interface: UserDisplayComponent
      Called when the component is removed from the display.
      Specified by:
      closeComponent in interface UserDisplayComponent
    • notifyModelChanged

      public void notifyModelChanged(int changeType)
      Description copied from interface: UserDisplayComponent
      Pick up model changed notifications from a parent user display.
      Specified by:
      notifyModelChanged in interface UserDisplayComponent
    • getHiddenSliderTime

      public Integer getHiddenSliderTime()
      Returns:
      the hiddenSliderTime
    • setHiddenSliderTime

      public void setHiddenSliderTime(Integer hiddenSliderTime)
      Parameters:
      hiddenSliderTime - the hiddenSliderTime to set
    • getFrameTitle

      public String getFrameTitle()
      Description copied from interface: UserDisplayComponent
      Get a title for the frame the component will be added to.
      Specified by:
      getFrameTitle in interface UserDisplayComponent
      Returns:
      a title for the components frame.
    • getUniqueName

      public String getUniqueName()
      Specified by:
      getUniqueName in interface UserDisplayComponent
      Returns:
      a unique name (across all of PAMGuard) which will be used for mark overlays and settings storage.
    • setUniqueName

      public void setUniqueName(String uniqueName)
      Description copied from interface: UserDisplayComponent
      Set a unique name for every display. This is important for saving settings and for managing things that need a unique name such as overlay marks and markers.
      Specified by:
      setUniqueName in interface UserDisplayComponent
    • getMapDetectionsManager

      public MapDetectionsManager getMapDetectionsManager()
    • getViewerControls

      public JPanel getViewerControls()
    • getMapMarker

      public Map.SimpleMap.MapOverlayMarker getMapMarker()