Class OverlayMarker

java.lang.Object
PamView.paneloverlay.overlaymark.ExtMouseAdapter
PamView.paneloverlay.overlaymark.OverlayMarker
All Implemented Interfaces:
MarkManager
Direct Known Subclasses:
BTOverlayMarker, ClipDisplayMarker, SpectrogramMarker, StandardOverlayMarker

public abstract class OverlayMarker extends ExtMouseAdapter implements MarkManager
Receive mouse actions made on the map, turn them into regions displayed as an overlay on the map and send the region information off to any observers who might be interested in those data.

In some ways this class behaves in a very similar manner to the spectrogram mark observer system.

Author:
Doug Gillespie
  • Constructor Details

  • Method Details

    • getProjector

      public GeneralProjector<PamCoordinate> getProjector()
      Returns:
      the projector
    • getMarkerName

      public abstract String getMarkerName()
    • isCanMark

      public boolean isCanMark(javafx.scene.input.MouseEvent e)
    • mousePressed

      public boolean mousePressed(javafx.scene.input.MouseEvent e)
      Overrides:
      mousePressed in class ExtMouseAdapter
    • mouseReleased

      public boolean mouseReleased(javafx.scene.input.MouseEvent e)
      Overrides:
      mouseReleased in class ExtMouseAdapter
    • showNoObserverPopup

      public boolean showNoObserverPopup(javafx.scene.input.MouseEvent e)
      An optional additional popup that can occur even if there were no observers of the popup This get's used on displays that are starting to label data units using generic annotations, thereby avoiding the need for more advanced marks and groupers.
      Parameters:
      e - Mouse event (needed for popup coordinates)
      Returns:
      true if a menu was shown.
    • createJPopMenu

      public JPopupMenu createJPopMenu(javafx.scene.input.MouseEvent e)
      Create the JPopupMenu. this is a composite menu made up from all observers of a particular marker.
      Returns:
      the jpop up menu with overlay options.
    • getPopupMenuItems

      public List<javafx.scene.control.MenuItem> getPopupMenuItems(javafx.scene.input.MouseEvent e)
      Overrides:
      getPopupMenuItems in class ExtMouseAdapter
    • showObserverPopups

      public boolean showObserverPopups(javafx.scene.input.MouseEvent e)
      Show any popup menus form the mark observers in response to the mouse going down with a right click.

      If a mark has been made, and is in existence, then

      Parameters:
      e - Mouse event
      Returns:
      true if a menu was shown.
    • findClosestData

      public ClosestDataInfo findClosestData(javafx.scene.input.MouseEvent e, double maxDistance)
      Find the closest data unit to the mouse point.
      Parameters:
      e - Mouse informatoin
      maxDistance - Maximum distance to consider.
      Returns:
    • destroyCurrentMark

      public void destroyCurrentMark(javafx.scene.input.MouseEvent e)
      Destroy the current mark.
    • mouseClicked

      public boolean mouseClicked(javafx.scene.input.MouseEvent e)
      Overrides:
      mouseClicked in class ExtMouseAdapter
    • needPaused

      public boolean needPaused()
      Returns:
      true if whatever is going on makes it desirable to pause display scrolling.
    • canDestroyMark

      public boolean canDestroyMark(javafx.scene.input.MouseEvent e)
      Check whether a current mark can be destroyed.
      Parameters:
      e - - the mouse event
      Returns:
      true if mark can be destroyed. False otherwise.
    • addObserver

      public void addObserver(OverlayMarkObserver observer)
    • removeObserver

      public void removeObserver(OverlayMarkObserver observer)
    • getObserverCount

      public int getObserverCount()
      Get the number of observers.
      Returns:
      The number of things observing this marker.
    • getObservers

      public ArrayList<OverlayMarkObserver> getObservers()
      Get the list of observers.
      Returns:
      the observers
    • notifyObservers

      public boolean notifyObservers(int markStatus, javafx.scene.input.MouseEvent mouseEvent, OverlayMarker overlayMarker, OverlayMark overlayMark)
    • mouseMoved

      public boolean mouseMoved(javafx.scene.input.MouseEvent e)
      Overrides:
      mouseMoved in class ExtMouseAdapter
    • isMarkComplete

      public boolean isMarkComplete()
    • mouseDragged

      public boolean mouseDragged(javafx.scene.input.MouseEvent e)
      Overrides:
      mouseDragged in class ExtMouseAdapter
    • getCurrentMark

      public OverlayMark getCurrentMark()
      Specified by:
      getCurrentMark in interface MarkManager
    • getSelectedMarkedDataUnits

      public List<PamDataUnit> getSelectedMarkedDataUnits(OverlayMark overlayMark, MarkDataSelector markDataSelector)
      Get a list of marked and selected data units. For now, work off the hover data within the projector, but feel free to override or use a totally different system of working out what's in the mark - that's the responsibility of whatever display has the mark. The MarkDataSelector comes from the Mark Observer, i.e. the thing that uses the data.
      Parameters:
      overlayMark -
      markDataSelector -
      Returns:
    • getSelectedMarkedDataUnits

      public List<PamDataUnit> getSelectedMarkedDataUnits(OverlayMark overlayMark, MarkDataSelector markDataSelector, int minOverlap)
    • canMark

      public boolean canMark(OverlayMarkObserver markObserver)
      Parameters:
      markObserver -
      Returns:
      true if this marker can send marks to this observer.
    • isNowMarking

      public boolean isNowMarking()
      Now marking
      Returns:
      true if now marking.
    • setProjector

      public void setProjector(GeneralProjector<PamCoordinate> projector)
      Parameters:
      projector - the projector to set
    • updateMarkedDisplay

      public void updateMarkedDisplay()
      Update the marked display. This can be called after the mark has been used to repaint the owner display. Forcing a repaint will generally make the mark disappear and may also recolour any changed dataunits.
    • isMouseContained

      public boolean isMouseContained(javafx.scene.input.MouseEvent e)
      Check whether a mouse event is contained within the current mark shape
      Parameters:
      e - - the mouse event
      Returns:
      true if the mouse event is cointained within the shape.
    • setNowMarking

      public void setNowMarking(boolean nowMarking)
      Set if marking
    • setCurrentMark

      public void setCurrentMark(OverlayMark currentMark)
      Set the current mark.
      Parameters:
      currentMark - - set the current mark
    • getMarkWarning

      public PamWarning getMarkWarning()
      Get the current mark warning. Can be null.
      Returns:
      the current mark warning.