PamView
Class PamDetectionOverlayGraphics

java.lang.Object
  extended by PamView.PamDetectionOverlayGraphics
All Implemented Interfaces:
ManagedSymbol, PanelOverlayDraw
Direct Known Subclasses:
AISGraphics, ClickTrainGraphics, ClickTrainLocalisationGraphics, CROverlayGraphics, CROverlayGraphics, IshOverlayGraphics, MapCommentOverlayGraphics, NewClickOverlayGraphics, OfflineEventGraphics, RoccaGraphics, TowedArray3DOverlayGraphics, TrackedClickGraphics, WhistleEventGraphics, WhistleGraphics, WhistleLocalisationGraphics, WhistleToneLocalisationGraphics, WorkshopOverlayGraphics

public class PamDetectionOverlayGraphics
extends java.lang.Object
implements PanelOverlayDraw, ManagedSymbol


Field Summary
private  double defaultRange
          Default range for detections with bearing and no range information in metres.
private static int DEFSYMBOLSIZE
           
private  boolean drawLineToLocations
           
private  boolean isDetectionData
           
protected  java.awt.Color lineColour
           
private  PamSymbol pamSymbol
           
private  PamDataBlock<PamDataUnit> parentDataBlock
           
 
Constructor Summary
PamDetectionOverlayGraphics(PamDataBlock parentDataBlock)
          Constructor for standard overlay graphics class.
 
Method Summary
 boolean canDraw(GeneralProjector generalProjector)
          Used to tell the various displays whether or not the data in the parentDataBlock can be drawn on each of those displays.
protected  boolean canDrawOnMap()
           
protected  boolean canDrawOnRadar(GeneralProjector.ParameterType radialParameter)
           
protected  boolean canDrawOnSpectrogram()
           
 PamKeyItem createKeyItem(GeneralProjector generalProjector, int keyType)
          Gets information for making up a key on various displays.
protected  java.awt.Rectangle drawAmplitudeOnRadar(java.awt.Graphics g, PamDataUnit pamDataUnit, GeneralProjector generalProjector)
           
 java.awt.Rectangle drawDataUnit(java.awt.Graphics g, PamDataUnit pamDataUnit, GeneralProjector generalProjector)
          Draw a PamDataUnit on a display.
protected  java.awt.Rectangle drawLineAndSymbol(java.awt.Graphics g, PamDataUnit pamDataUnit, GeneralProjector generalProjector, LatLong LL1, LatLong LL2, PamSymbol symbol)
           
protected  java.awt.Rectangle drawLineAndSymbol(java.awt.Graphics g, PamDataUnit pamDataUnit, java.awt.Point p1, java.awt.Point p2, PamSymbol symbol)
           
protected  java.awt.Rectangle drawLineOnly(java.awt.Graphics g, PamDataUnit pamDataUnit, java.awt.Point p1, java.awt.Point p2, PamSymbol symbol)
           
protected  java.awt.Rectangle drawOnMap(java.awt.Graphics g, PamDataUnit pamDetection, GeneralProjector generalProjector)
           
protected  java.awt.Rectangle drawOnSpectrogram(java.awt.Graphics g, PamDataUnit pamDataUnit, GeneralProjector generalProjector)
          Draw on spectrogram changed March 2010 so that the default time unit is milliseconds (Jave time from 1970) rather than samples.
protected  java.awt.Rectangle drawRangeOnRadar(java.awt.Graphics g, PamDataUnit pamDataUnit, GeneralProjector generalProjector)
           
 double getDefaultRange()
           
 java.lang.String getHoverText(GeneralProjector generalProjector, PamDataUnit dataUnit, int iSide)
          Provides text for popup hover windows on displays.
protected  int getHydrophones(PamDataUnit pamDetection)
           
 java.awt.Color getLineColor()
           
 java.awt.Color getLineColour()
           
 PamKeyItem getMenuKeyItem()
           
 PamSymbol getPamSymbol()
           
 PamSymbol getPamSymbol(PamDataUnit pamDataUnit)
           
 PamDataBlock<PamDataUnit> getParentDataBlock()
           
 ManagedSymbolInfo getSymbolInfo()
           
 boolean isDetectionData()
           
 boolean isDrawLineToLocations()
           
private  java.awt.Rectangle plotErrors(java.awt.Graphics g, java.awt.Color col, LatLong refPoint, double refAngle, double err1, double err2, GeneralProjector generalProjector)
           
 void setDefaultRange(double defaultRange)
           
 void setDetectionData(boolean isDetectionData)
           
 void setDrawLineToLocations(boolean drawLineToLocations)
           
 void setLineColor(java.awt.Color c)
           
 void setLineColour(java.awt.Color lineColour)
           
 void setPamSymbol(PamSymbol pamSymbol)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parentDataBlock

private PamDataBlock<PamDataUnit> parentDataBlock

pamSymbol

private PamSymbol pamSymbol

DEFSYMBOLSIZE

private static final int DEFSYMBOLSIZE
See Also:
Constant Field Values

lineColour

protected java.awt.Color lineColour

drawLineToLocations

private boolean drawLineToLocations

defaultRange

private double defaultRange
Default range for detections with bearing and no range information in metres.


isDetectionData

private boolean isDetectionData
Constructor Detail

PamDetectionOverlayGraphics

public PamDetectionOverlayGraphics(PamDataBlock parentDataBlock)
Constructor for standard overlay graphics class. Requires parent data block as a parameter.

Parameters:
parentDataBlock -
Method Detail

getParentDataBlock

public PamDataBlock<PamDataUnit> getParentDataBlock()
Returns:
parent PamDataBlock for this PanelOverlayDraw.

canDraw

public boolean canDraw(GeneralProjector generalProjector)
Used to tell the various displays whether or not the data in the parentDataBlock can be drawn on each of those displays. This is based purely on the axis types of the displays and whether or not the parentDataBlock's data untits are likely to have data which can transform into those axis types.

For simplicity I've broken it up into the three main display types currently existing in Pamguard.

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.

canDrawOnMap

protected boolean canDrawOnMap()
Returns:
true if these data can be drawn on the map.

Thsi shoudl always be true, since it's always possible to draw a symbol at the hydrophone location even if no range or bearing information are available.


canDrawOnSpectrogram

protected boolean canDrawOnSpectrogram()
Returns:
true if these data can be drawn on the spectrogram.

Generally, this is always true since it will just draw a rectangle with the time and frequency limits of the sound. If it is not the case, then override this function and return false.


canDrawOnRadar

protected boolean canDrawOnRadar(GeneralProjector.ParameterType radialParameter)
Parameters:
radialParameter -
Returns:
true if these data can be drawn on the radar. The detection will always need a bearing. The radial parameter is either amplitude (which all detections should have) or range which may or may not be there.

createKeyItem

public PamKeyItem createKeyItem(GeneralProjector generalProjector,
                                int keyType)
Gets information for making up a key on various displays. PamKeyItem is not yet implemented.

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)
Draw a PamDataUnit on a display.

This is split into separate routines for the three main display types for simplicity both of reading this code and for overriding the various functions.

If display types are added to PAMGUARD, these functions will need to be added to.

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

protected java.awt.Rectangle drawOnMap(java.awt.Graphics g,
                                       PamDataUnit pamDetection,
                                       GeneralProjector generalProjector)

plotErrors

private java.awt.Rectangle plotErrors(java.awt.Graphics g,
                                      java.awt.Color col,
                                      LatLong refPoint,
                                      double refAngle,
                                      double err1,
                                      double err2,
                                      GeneralProjector generalProjector)

drawLineAndSymbol

protected java.awt.Rectangle drawLineAndSymbol(java.awt.Graphics g,
                                               PamDataUnit pamDataUnit,
                                               GeneralProjector generalProjector,
                                               LatLong LL1,
                                               LatLong LL2,
                                               PamSymbol symbol)

drawLineAndSymbol

protected java.awt.Rectangle drawLineAndSymbol(java.awt.Graphics g,
                                               PamDataUnit pamDataUnit,
                                               java.awt.Point p1,
                                               java.awt.Point p2,
                                               PamSymbol symbol)

drawLineOnly

protected java.awt.Rectangle drawLineOnly(java.awt.Graphics g,
                                          PamDataUnit pamDataUnit,
                                          java.awt.Point p1,
                                          java.awt.Point p2,
                                          PamSymbol symbol)

getHydrophones

protected int getHydrophones(PamDataUnit pamDetection)
Parameters:
pamDetection - PamDetection
Returns:
a map of hydrophones associated with this detection.

drawOnSpectrogram

protected java.awt.Rectangle drawOnSpectrogram(java.awt.Graphics g,
                                               PamDataUnit pamDataUnit,
                                               GeneralProjector generalProjector)
Draw on spectrogram changed March 2010 so that the default time unit is milliseconds (Jave time from 1970) rather than samples. This makes it posible to work with data colected over multiple files when operating in viewer mode.

Parameters:
g -
pamDataUnit -
generalProjector -
Returns:

drawAmplitudeOnRadar

protected java.awt.Rectangle drawAmplitudeOnRadar(java.awt.Graphics g,
                                                  PamDataUnit pamDataUnit,
                                                  GeneralProjector generalProjector)

drawRangeOnRadar

protected java.awt.Rectangle drawRangeOnRadar(java.awt.Graphics g,
                                              PamDataUnit pamDataUnit,
                                              GeneralProjector generalProjector)

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

getLineColour

public java.awt.Color getLineColour()

setLineColour

public void setLineColour(java.awt.Color lineColour)

getPamSymbol

public PamSymbol getPamSymbol(PamDataUnit pamDataUnit)
Parameters:
pamDataUnit -
Returns:
PamSymbol to use in plotting. Generally this is just the set symbol for the overlay, but can be overridden if a detector has some complicated way of using different symbols for different dataUnits.

getPamSymbol

public PamSymbol getPamSymbol()
Specified by:
getPamSymbol in interface ManagedSymbol

setPamSymbol

public void setPamSymbol(PamSymbol pamSymbol)
Specified by:
setPamSymbol in interface ManagedSymbol

getDefaultRange

public double getDefaultRange()

setDefaultRange

public void setDefaultRange(double defaultRange)

isDetectionData

public boolean isDetectionData()
Returns:
true if the datablock associated with this overlay contians data units subclassed from PamDetection - in which case they might have Localisation information.

setDetectionData

public void setDetectionData(boolean isDetectionData)

isDrawLineToLocations

public boolean isDrawLineToLocations()

setDrawLineToLocations

public void setDrawLineToLocations(boolean drawLineToLocations)

getSymbolInfo

public ManagedSymbolInfo getSymbolInfo()
Specified by:
getSymbolInfo in interface ManagedSymbol

getMenuKeyItem

public PamKeyItem getMenuKeyItem()

setLineColor

public void setLineColor(java.awt.Color c)

getLineColor

public java.awt.Color getLineColor()