Map
Class MapPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by PamView.PamPanel
                      extended by PamView.JPanelWithPamKey
                          extended by Map.MapPanel
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, PamObserver, ColorManaged

public class MapPanel
extends JPanelWithPamKey
implements PamObserver, ColorManaged

This is the actual map display, with the bluebackground, the gps track, etc. IT sits inside the SimpleMap along with the right hand controls.

See Also:
Serialized Form

Nested Class Summary
(package private)  class MapPanel.DetectorPopupListener
           
(package private)  class MapPanel.ManagedDisplaySelection
           
(package private)  class MapPanel.OverlayOptions
           
(package private)  class MapPanel.SettingsAction
           
(package private)  class MapPanel.ShowGpsMenu
           
(package private)  class MapPanel.ShowKey
           
(package private)  class MapPanel.ShowPanZoom
           
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
(package private)  Coordinate3d[] arraygeom
           
(package private)  Coordinate3d[] arrayPanelOffsets
           
(package private)  Coordinate3d[] arrayPanelPositions
           
private  java.awt.image.BufferedImage baseDrawing
           
private  java.awt.geom.AffineTransform baseXform
           
private  java.awt.Color coastColour
           
private  java.awt.Color[] contourColours
           
private  int[] contourDepths
           
private  java.awt.Color deepestColour
           
(package private)  javax.swing.JPopupMenu detectorMenu
           
(package private)  java.awt.event.MouseAdapter detectorPopupListener
           
(package private)  StraightLineGrid grid
           
private  int imageHeight
           
private  int imageWidth
           
private  PamArray lastArray
           
private  GpsDataUnit lastDrawGpsDataUnit
           
private  Coordinate3d lastGpsCoodinate
           
private  int lastHeight
           
private  LatLong lastMapCentreDegrees
           
private  int lastMapRangeMetres
           
private  double lastMapRotationDegrees
           
private  int lastWidth
           
private  LatLong mapCentreDegrees
           
(package private)  MapContourGraphics mapContourGraphics
           
(package private)  MapController mapController
           
private  int mapRangeMetres
           
private  double mapRotationDegrees
           
(package private)  PamSymbol measureSymbol
           
 Compass myCompass
           
(package private)  javax.swing.JCheckBoxMenuItem panZoomMenu
           
private  double pixelsPerMetre
           
(package private)  javax.swing.JPopupMenu plotDetectorMenu
           
(package private)  java.awt.event.MouseAdapter popupListener
           
private  MapRectProjector rectProj
           
private  boolean repaintBase
           
private static long serialVersionUID
           
private  java.awt.Color shallowColour
           
 Vessel ship
           
(package private)  javax.swing.JCheckBoxMenuItem showGpsMenu
           
(package private)  javax.swing.JCheckBoxMenuItem showKeyMenu
           
(package private)  SimpleMap simpleMapRef
           
(package private)  TransformUtilities trans
           
private  boolean[] wantedContours
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
MapPanel(MapController mapController)
           
 
Method Summary
private  PamKeyItem createContourKeyItem(int depth, java.awt.Color colour)
           
protected  void createKey()
           
 PamColors.PamColor getColorId()
          The components colour scheme.
private  java.awt.Color getContourColour(int listPos, int nContours)
           
 LatLong getMapCentreDegrees()
           
 int getMapRangeMetres()
           
 double getMapRotationDegrees()
           
(package private)  long getMapStartTime()
           
 java.lang.String getObserverName()
           
 PamObserver getObserverObject()
           
 double getPixelsPerMetre()
           
 MapRectProjector getRectProj()
           
 long getRequiredDataHistory(PamObservable o, java.lang.Object arg)
           
 GpsData getShipGpsData(boolean predict)
           
 LatLong getShipLLD()
           
 SimpleMap getSimpleMapRef()
           
 void masterClockUpdate(long milliSeconds, long sampleNumber)
           
protected  void newGpsData(GpsDataUnit newGpsDataUnit)
          Called from simple map when new gps data arrive.
 void newShipLLD()
           
 void newViewTime(GpsDataUnit gpsDataUnit)
           
 void noteNewSettings()
           
 void paintComponent(java.awt.Graphics g)
           
private  void paintContour(java.awt.Graphics g, MapContour mapContour)
           
private  void paintContours(java.awt.Graphics g)
           
private  void paintDetectorData(java.awt.Graphics g)
           
private  void paintHydrophones(java.awt.Graphics g)
           
private  void paintNewGPSData(GpsDataUnit newGpsDataUnit)
          Paint the new GPS data onto the base image, starting from the previous coordinate.
private  void paintNewGPSData(java.awt.Graphics g, GpsDataUnit newGpsDataUnit)
          Pint new gps data on the given graphics handle
private  void paintPredictedGPS(java.awt.Graphics g)
           
private  void paintShip(java.awt.Graphics g)
           
private  void paintTrack(java.awt.Graphics g)
           
private  void paintTrack(java.awt.Graphics g, PamDataUnit lastDrawnUnit)
           
(package private)  javax.swing.JPopupMenu plotDetectorMenu()
           
private  void prepareBaseImage()
           
private  boolean prepareContourData()
          Need to make two lists, one is a list of depth numbers and colours, the other is a list of contours that should actually be plotted.
 void removeObservable(PamObservable o)
          called when an Observable (PamDataBlock) is removed from the system
 void repaint(boolean baseToo)
           
 void repaintBaseDrawing()
          Instruct map to redraw it's base image next time anything is redrawn.
 void setBackground(java.awt.Color bg)
           
 void setMapCentreCoords(Coordinate3d c)
           
 void setMapCentreDegrees(LatLong mapCentreDegrees)
           
 void setMapRangeMetres(int mapRangeMetres)
           
 void setMapRotationDegrees(double mapRotationDegrees)
           
 void setMapZoom(float zoomFactor)
           
 void setPixelsPerMetre(double pixelsPerMetre)
           
 void setRectProj(MapRectProjector rectProj)
           
 void setSampleRate(float sampleRate, boolean notify)
          New sample rate
 void setSimpleMapRef(SimpleMap simpleMapRef)
           
private  boolean shouldPlot(PamDataBlock pamDataBlock)
           
private  boolean shouldPlot(PamDataUnit pamDataUnit, MapDetectionData mapDetectionData, long now)
           
 void update(PamObservable o, PamDataUnit arg)
          Informs the PamObserver that new data have been added to the Observable class
protected  void updateObservers()
           
 
Methods inherited from class PamView.JPanelWithPamKey
drawKeyOnTop, getKeyPanel, getKeyPosition, setKeyPanel, setKeyPosition, setLayout
 
Methods inherited from class PamView.PamPanel
getDefaultColor, setDefaultColor
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

detectorMenu

javax.swing.JPopupMenu detectorMenu

plotDetectorMenu

javax.swing.JPopupMenu plotDetectorMenu

mapRotationDegrees

private double mapRotationDegrees

rectProj

private MapRectProjector rectProj

mapCentreDegrees

private LatLong mapCentreDegrees

mapRangeMetres

private int mapRangeMetres

trans

TransformUtilities trans

pixelsPerMetre

private double pixelsPerMetre

ship

public Vessel ship

myCompass

public Compass myCompass

grid

StraightLineGrid grid

popupListener

java.awt.event.MouseAdapter popupListener

detectorPopupListener

java.awt.event.MouseAdapter detectorPopupListener

mapController

MapController mapController

mapContourGraphics

MapContourGraphics mapContourGraphics

simpleMapRef

SimpleMap simpleMapRef

arraygeom

Coordinate3d[] arraygeom

arrayPanelOffsets

Coordinate3d[] arrayPanelOffsets

arrayPanelPositions

Coordinate3d[] arrayPanelPositions

coastColour

private java.awt.Color coastColour

shallowColour

private java.awt.Color shallowColour

deepestColour

private java.awt.Color deepestColour

baseXform

private java.awt.geom.AffineTransform baseXform

repaintBase

private boolean repaintBase

lastArray

private PamArray lastArray

lastMapCentreDegrees

private LatLong lastMapCentreDegrees

lastMapRangeMetres

private int lastMapRangeMetres

lastMapRotationDegrees

private double lastMapRotationDegrees

lastHeight

private int lastHeight

lastWidth

private int lastWidth

baseDrawing

private java.awt.image.BufferedImage baseDrawing

imageWidth

private int imageWidth

imageHeight

private int imageHeight

measureSymbol

PamSymbol measureSymbol

wantedContours

private boolean[] wantedContours

contourColours

private java.awt.Color[] contourColours

contourDepths

private int[] contourDepths

lastDrawGpsDataUnit

private GpsDataUnit lastDrawGpsDataUnit

lastGpsCoodinate

private Coordinate3d lastGpsCoodinate

panZoomMenu

javax.swing.JCheckBoxMenuItem panZoomMenu

showGpsMenu

javax.swing.JCheckBoxMenuItem showGpsMenu

showKeyMenu

javax.swing.JCheckBoxMenuItem showKeyMenu
Constructor Detail

MapPanel

public MapPanel(MapController mapController)
Method Detail

getObserverObject

public PamObserver getObserverObject()
Specified by:
getObserverObject in interface PamObserver
Returns:
the actual observer. In most cases concrete classes will just return 'this' in response. The exception is the Threaded observer, which will return the single thread observer.

getColorId

public PamColors.PamColor getColorId()
Description copied from interface: ColorManaged
The components colour scheme.

Specified by:
getColorId in interface ColorManaged
Overrides:
getColorId in class PamPanel
Returns:
PamColor

newViewTime

public void newViewTime(GpsDataUnit gpsDataUnit)

newGpsData

protected void newGpsData(GpsDataUnit newGpsDataUnit)
Called from simple map when new gps data arrive.

Parameters:
newGpsDataUnit -

paintComponent

public void paintComponent(java.awt.Graphics g)
Overrides:
paintComponent in class javax.swing.JComponent

prepareBaseImage

private void prepareBaseImage()

prepareContourData

private boolean prepareContourData()
Need to make two lists, one is a list of depth numbers and colours, the other is a list of contours that should actually be plotted.

Returns:
true if there is anything at all to plot.

paintContours

private void paintContours(java.awt.Graphics g)

getContourColour

private java.awt.Color getContourColour(int listPos,
                                        int nContours)

paintContour

private void paintContour(java.awt.Graphics g,
                          MapContour mapContour)

paintTrack

private void paintTrack(java.awt.Graphics g)

getMapStartTime

long getMapStartTime()

paintTrack

private void paintTrack(java.awt.Graphics g,
                        PamDataUnit lastDrawnUnit)

paintPredictedGPS

private void paintPredictedGPS(java.awt.Graphics g)

paintNewGPSData

private void paintNewGPSData(GpsDataUnit newGpsDataUnit)
Paint the new GPS data onto the base image, starting from the previous coordinate.

Parameters:
newGpsDataUnit - new Gps data

paintNewGPSData

private void paintNewGPSData(java.awt.Graphics g,
                             GpsDataUnit newGpsDataUnit)
Pint new gps data on the given graphics handle

Parameters:
g - graphics handle
newGpsDataUnit - gps data unit.

paintShip

private void paintShip(java.awt.Graphics g)

paintHydrophones

private void paintHydrophones(java.awt.Graphics g)

paintDetectorData

private void paintDetectorData(java.awt.Graphics g)

repaintBaseDrawing

public void repaintBaseDrawing()
Instruct map to redraw it's base image next time anything is redrawn.


repaint

public void repaint(boolean baseToo)

getMapRotationDegrees

public double getMapRotationDegrees()

setMapRotationDegrees

public void setMapRotationDegrees(double mapRotationDegrees)

getMapCentreDegrees

public LatLong getMapCentreDegrees()

setMapCentreDegrees

public void setMapCentreDegrees(LatLong mapCentreDegrees)

setMapCentreCoords

public void setMapCentreCoords(Coordinate3d c)

getMapRangeMetres

public int getMapRangeMetres()

setMapRangeMetres

public void setMapRangeMetres(int mapRangeMetres)

getShipLLD

public LatLong getShipLLD()

getShipGpsData

public GpsData getShipGpsData(boolean predict)

newShipLLD

public void newShipLLD()

getRectProj

public MapRectProjector getRectProj()

setRectProj

public void setRectProj(MapRectProjector rectProj)

update

public void update(PamObservable o,
                   PamDataUnit arg)
Description copied from interface: PamObserver
Informs the PamObserver that new data have been added to the Observable class

Specified by:
update in interface PamObserver
Parameters:
o - Reference to the Observable (a PamDataBlock)
arg - Reference to the new PamDataUnit

getObserverName

public java.lang.String getObserverName()
Specified by:
getObserverName in interface PamObserver

setSampleRate

public void setSampleRate(float sampleRate,
                          boolean notify)
Description copied from interface: PamObserver
New sample rate

Specified by:
setSampleRate in interface PamObserver
notify - Notify other PamObservers and PamObservables in the chain.

masterClockUpdate

public void masterClockUpdate(long milliSeconds,
                              long sampleNumber)
Specified by:
masterClockUpdate in interface PamObserver

getPixelsPerMetre

public double getPixelsPerMetre()

setPixelsPerMetre

public void setPixelsPerMetre(double pixelsPerMetre)

updateObservers

protected void updateObservers()

createKey

protected void createKey()

createContourKeyItem

private PamKeyItem createContourKeyItem(int depth,
                                        java.awt.Color colour)

plotDetectorMenu

javax.swing.JPopupMenu plotDetectorMenu()

shouldPlot

private boolean shouldPlot(PamDataBlock pamDataBlock)

shouldPlot

private boolean shouldPlot(PamDataUnit pamDataUnit,
                           MapDetectionData mapDetectionData,
                           long now)

getRequiredDataHistory

public long getRequiredDataHistory(PamObservable o,
                                   java.lang.Object arg)
Specified by:
getRequiredDataHistory in interface PamObserver
Parameters:
o - PamObservable class requiring the data
arg - optional argument from PamObservable
Returns:
time in milliseconds requried by data held in PamObservable

noteNewSettings

public void noteNewSettings()
Specified by:
noteNewSettings in interface PamObserver

setMapZoom

public void setMapZoom(float zoomFactor)

removeObservable

public void removeObservable(PamObservable o)
Description copied from interface: PamObserver
called when an Observable (PamDataBlock) is removed from the system

Specified by:
removeObservable in interface PamObserver

getSimpleMapRef

public SimpleMap getSimpleMapRef()

setSimpleMapRef

public void setSimpleMapRef(SimpleMap simpleMapRef)

setBackground

public void setBackground(java.awt.Color bg)
Overrides:
setBackground in class javax.swing.JComponent