Package PamView

Class PanelOverlayDraw

java.lang.Object
PamView.PanelOverlayDraw
Direct Known Subclasses:
AirgunGraphics, AutecGraphics, GPSOverlayGraphics, GridOverlayDraw, IshmaelGraphics, LandmarkGraphics, ListeningEffortGraphics, LoggerFormGraphics, MarkOverlayDraw, MeygenGraphics, NetworkGPSDrawing, PamDetectionOverlayGraphics, PeakGraphics, SequenceOverlayDraw, SimGraphics, StreamerOverlayGraphics, ThingHeardGraphics

public abstract class PanelOverlayDraw extends Object
Author:
Doug Gillespie

Used by PamDataBlocks to draw PamDataUnits on display objects (maps, spectrograms, etc)

If a PanelOverlayDraw object is instantiated for a PamObservable, then any display (usually an observer of that PamObservable) will call the PamObservable function PamObservable.DrawDataUnit(...), parsing it a Graphics2d handle, a PamDataUnit, and a concrete instance of a GeneralProjector. The DrawDataUnit function in PanelOverlayDraw may then use the Projector to convert data in the PamDatablock into screen coordinates and then draw them (in any way it likes) on the graphics handle.

If the Observable may be drawn on multiple types of display, then DrawDataUnit should check the ParameterTypes and ParameterUnits required by the Projector and then draw whatever is appropriate for that Projector (e.g. The Whistle DataBlock draws contours on the display that has TIME and FREQUENCY as ParameterTypes and a single triangular symbol on the display that has LATITUDE and LONGITUDE as it's parameter types).

See Also:
  • Constructor Details

    • PanelOverlayDraw

      public PanelOverlayDraw(PamSymbol defaultSymbol)
  • Method Details

    • drawDataUnit

      public abstract Rectangle drawDataUnit(Graphics g, PamDataUnit pamDataUnit, GeneralProjector generalProjector)
      Parameters:
      g - Graphics handle to draw on
      pamDataUnit - PamDataUnit to draw
      generalProjector - Projector to use when drawing.
      Returns:
      A rectangle surrouding whatever has just been drawn.
    • canDraw

      public boolean canDraw(GeneralProjector generalProjector)
      Parameters:
      generalProjector -
      Returns:
      Returns whether or not the object can be drawn using the given projector. The implementation of CanDraw should examine the parameter types in GeneralProjector and check that it will know how to prvide those parameters before returning true, or false otherwise.
    • preDrawAnything

      public boolean preDrawAnything(Graphics g, PamDataBlock pamDataBlock, GeneralProjector projector)
      Extra function so that a datablock can do entirely it's own thing (introduced for drawing gemini data overlays where we only want to draw on thing and one thing only.
      Parameters:
      g -
      pamDataBlock -
      projector -
      Returns:
      true if normal drawing should proceed after this, otherwise return false and drawing will stop
    • canDraw

      public abstract boolean canDraw(GeneralProjector.ParameterType[] parameterTypes, GeneralProjector.ParameterUnits[] parameterUnits)
      Parameters:
      parameterTypes -
      parameterUnits -
      Returns:
      Returns whether or not the object can be drawn using the given projector. The implementation of CanDraw should examine the parameter types in GeneralProjector and check that it will know how to prvide those parameters before returning true, or false otherwise.
    • createKeyItem

      public abstract PamKeyItem createKeyItem(GeneralProjector generalProjector, int keyType)
      provide a graphics component (probably a JPanel) that can be incorporated into a key panel for maps, and anything else that uses overlay graphics.

      Since multiple keys may be created in various displays, new ones should normally be created each time this is called.

      The GeneralProjector reference is passed as a parameter since the type of symbol or shape drawn on a particular plot may depend on the type of coordinate system. For example, whistles are drawn as a contour on the spectrogram display, but as a point (PamSymbol) on the map.

      It is possible that some PanelOverlayDraw implementations will be rather complicated and the keys consequently quite large. The extendedKey parameter may therefore be used to draw a full or a cut down version of the key. It is expected that most implementations will ignore this parameter !

      Parameters:
      generalProjector - Reference to a GeneralProjector responsible for drawing with the PAnelOverlayDraw implementation
      keyType - Draw a more complicated key, giving more detail
      Returns:
      java.awt compnent (usually a JPanel).
      See Also:
    • getHoverText

      public abstract String getHoverText(GeneralProjector generalProjector, PamDataUnit dataUnit, int iSide)
      Provides text for popup hover windows on displays.
      Parameters:
      generalProjector - Projector associated with the display requiring the text
      dataUnit - Data unit the mouse hovered over
      Returns:
      Text to display
    • hasOptionsDialog

      public boolean hasOptionsDialog(GeneralProjector generalProjector)
      Parameters:
      generalProjector - projector
      Returns:
      true if the drawing methods have options relevant to this projection which can be shown in a dialog of some sort (see showOptions)
    • showOptions

      public boolean showOptions(Window parentWindow, GeneralProjector generalProjector)
      Show an options dialog for a particular projector.
      Parameters:
      parentWindow - parent window or frame
      generalProjector - projector
      Returns:
    • getPamSymbol

      public PamSymbol getPamSymbol(PamDataUnit pamDataUnit, GeneralProjector projector)
    • getDefaultSymbol

      public PamSymbol getDefaultSymbol()
    • setDefaultSymbol

      public void setDefaultSymbol(PamSymbol defaultSymbol)
      Parameters:
      defaultSymbol - the defaultSymbol to set