Class PanelOverlayDraw
- Direct Known Subclasses:
AirgunGraphics
,AutecGraphics
,GPSOverlayGraphics
,GridOverlayDraw
,IshmaelGraphics
,LandmarkGraphics
,ListeningEffortGraphics
,LoggerFormGraphics
,MarkOverlayDraw
,MeygenGraphics
,NetworkGPSDrawing
,PamDetectionOverlayGraphics
,PeakGraphics
,SequenceOverlayDraw
,SimGraphics
,StreamerOverlayGraphics
,ThingHeardGraphics
- 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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canDraw
(GeneralProjector generalProjector) abstract boolean
canDraw
(GeneralProjector.ParameterType[] parameterTypes, GeneralProjector.ParameterUnits[] parameterUnits) 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.abstract Rectangle
drawDataUnit
(Graphics g, PamDataUnit pamDataUnit, GeneralProjector generalProjector) abstract String
getHoverText
(GeneralProjector generalProjector, PamDataUnit dataUnit, int iSide) Provides text for popup hover windows on displays.getPamSymbol
(PamDataUnit pamDataUnit, GeneralProjector projector) boolean
hasOptionsDialog
(GeneralProjector generalProjector) 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.void
setDefaultSymbol
(PamSymbol defaultSymbol) boolean
showOptions
(Window parentWindow, GeneralProjector generalProjector) Show an options dialog for a particular projector.
-
Constructor Details
-
PanelOverlayDraw
-
-
Method Details
-
drawDataUnit
public abstract Rectangle drawDataUnit(Graphics g, PamDataUnit pamDataUnit, GeneralProjector generalProjector) - Parameters:
g
- Graphics handle to draw onpamDataUnit
- PamDataUnit to drawgeneralProjector
- Projector to use when drawing.- Returns:
- A rectangle surrouding whatever has just been drawn.
-
canDraw
- 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
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
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 implementationkeyType
- 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 textdataUnit
- Data unit the mouse hovered over- Returns:
- Text to display
-
hasOptionsDialog
- 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
Show an options dialog for a particular projector.- Parameters:
parentWindow
- parent window or framegeneralProjector
- projector- Returns:
-
getPamSymbol
-
getDefaultSymbol
-
setDefaultSymbol
- Parameters:
defaultSymbol
- the defaultSymbol to set
-