beakedWhaleProtocol
Class BeakedGraphics

java.lang.Object
  extended by beakedWhaleProtocol.BeakedGraphics
All Implemented Interfaces:
PanelOverlayDraw

public class BeakedGraphics
extends java.lang.Object
implements PanelOverlayDraw

Draws the beaked whale protocol graphics on the map

Author:
Douglas Gillespie

Field Summary
(package private)  BeakedControl beakedControl
           
(package private)  PamSymbol experimentSymbol
           
(package private)  PamSymbol symbol
           
 
Constructor Summary
BeakedGraphics(BeakedControl beakedControl)
           
 
Method Summary
 boolean canDraw(GeneralProjector generalProjector)
           
 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.
 java.awt.Rectangle drawDataUnit(java.awt.Graphics g, PamDataUnit pamDataUnit, GeneralProjector generalProjector)
           
private  java.awt.Rectangle drawExperimentData(java.awt.Graphics g, GeneralProjector generalProjector)
           
 java.awt.Rectangle drawOnMap(java.awt.Graphics g, PamDataUnit pamDataUnit, GeneralProjector generalProjector)
           
private  java.lang.String getExperimentHoverText(GeneralProjector generalProjector, PamDataUnit dataUnit, int iSide)
           
 java.lang.String getHoverText(GeneralProjector generalProjector, PamDataUnit dataUnit, int iSide)
          Provides text for popup hover windows on displays.
private  java.lang.String getLocationHoverText(GeneralProjector generalProjector, PamDataUnit dataUnit, int iSide)
           
private  boolean isCurrentExperiment(PamDataUnit pamDataUnit)
           
private  boolean isLastLocation(PamDataUnit pamDataUnit)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

beakedControl

BeakedControl beakedControl

symbol

PamSymbol symbol

experimentSymbol

PamSymbol experimentSymbol
Constructor Detail

BeakedGraphics

public BeakedGraphics(BeakedControl beakedControl)
Method Detail

canDraw

public boolean canDraw(GeneralProjector generalProjector)
Specified by:
canDraw in interface PanelOverlayDraw
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 PamKeyItem createKeyItem(GeneralProjector generalProjector,
                                int keyType)
Description copied from interface: PanelOverlayDraw
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 !

Specified by:
createKeyItem in interface PanelOverlayDraw
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:
WhistleGraphics, PamSymbol

drawDataUnit

public java.awt.Rectangle drawDataUnit(java.awt.Graphics g,
                                       PamDataUnit pamDataUnit,
                                       GeneralProjector generalProjector)
Specified by:
drawDataUnit in interface PanelOverlayDraw
Parameters:
g - Graphics handle to draw on
pamDataUnit - PamDataUnit to draw
generalProjector - Projector to use when drawing.
Returns:
A rectange surrouding whatever has just been drawn.

drawOnMap

public java.awt.Rectangle drawOnMap(java.awt.Graphics g,
                                    PamDataUnit pamDataUnit,
                                    GeneralProjector generalProjector)

drawExperimentData

private java.awt.Rectangle drawExperimentData(java.awt.Graphics g,
                                              GeneralProjector generalProjector)

isLastLocation

private boolean isLastLocation(PamDataUnit pamDataUnit)

isCurrentExperiment

private boolean isCurrentExperiment(PamDataUnit pamDataUnit)

getHoverText

public java.lang.String getHoverText(GeneralProjector generalProjector,
                                     PamDataUnit dataUnit,
                                     int iSide)
Description copied from interface: PanelOverlayDraw
Provides text for popup hover windows on displays.

Specified by:
getHoverText in interface PanelOverlayDraw
Parameters:
generalProjector - Projector associated with the display requiring the text
dataUnit - Data unit the mouse hovered over
Returns:
Text to display

getLocationHoverText

private java.lang.String getLocationHoverText(GeneralProjector generalProjector,
                                              PamDataUnit dataUnit,
                                              int iSide)

getExperimentHoverText

private java.lang.String getExperimentHoverText(GeneralProjector generalProjector,
                                                PamDataUnit dataUnit,
                                                int iSide)