Package Map
Class SimpleMap
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,Accessible
,PamSettings
,SettingsNameProvider
,PamObserver
,PamScrollObserver
,UserDisplayComponent
public class SimpleMap
extends JPanel
implements PamObserver, PamScrollObserver, PamSettings, UserDisplayComponent
Mainly a container for map objects, holding the main MapPanel and the right
hand control items.
Originally written by Dave McLaren. Modified by Doug Gillespie to incorporate controls onto main panel to increase overall visible size.
Originally written by Dave McLaren. Modified by Doug Gillespie to incorporate controls onto main panel to increase overall visible size.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Component
Component.BaselineResizeBehavior
-
Field Summary
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, 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
ConstructorDescriptionSimpleMap
(MapController mapController, boolean isMainTab) SimpleMap
(MapController mapController, boolean isMainTab, MapPanel mapPanel) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addData
(PamObservable o, PamDataUnit arg) Informs the PamObserver that new data have been added to the Observable classvoid
addMouseAdapterToMapPanel
(MouseAdapter mouseAdapter) void
Called when the component is removed from the display.createDisplayMenu
(Frame parentFrame) Get a title for the frame the component will be added to.Map.SimpleMap.MapOverlayMarker
long
Get the time for the map (used when deciding what to plot)Gets a data unit currently hovered by the mouse.Map.SimpleMap.MapMouseMotionAdapter
getOptionsMenuItem
(Frame parentFrame) getPanel()
long
Name for data selectors and data filters.long
Settings manager for when there are multiple maps in user displays.void
void
mapCanScroll
(boolean b) void
masterClockUpdate
(long milliSeconds, long sampleNumber) void
void
notifyModelChanged
(int changeType) Pick up model changed notifications from a parent user display.void
Called when the component is first displayed.void
receiveSourceNotification
(int type, Object object) Receive a notification from the data source - typically a change in DAQ status.void
void
called when an Observable (PamDataBlock) is removed from the systemboolean
restoreSettings
(PamControlledUnitSettings pamControlledUnitSettings) void
scrollRangeChanged
(AbstractPamScroller absPamScroller) Notification sent when a scroller or slider changes it's data rangevoid
scrollValueChanged
(AbstractPamScroller abstractPamScroller) Notification sent when a scroller or slider changes it's positionvoid
setHiddenSliderTime
(Integer hiddenSliderTime) void
setSampleRate
(float sampleRate, boolean notify) New sample ratevoid
setUniqueName
(String uniqueName) Set a unique name for every display.boolean
shouldPlot
(PamDataBlock pamDataBlock) ShouldPlot function for a datablock, moved here from mappanel so that we can override for a special map for Target motion (and other) dialogsboolean
shouldPlot
(PamDataUnit pamDataUnit, MapDetectionData mapDetectionData, long earliestToPlot, long now, DataSelector ds) Shouldplot function for individual data units.void
boolean
showParametersDialog
(Window parentFrame) boolean
Subscribes a variety of data blocks to the scroll bar.void
updateData
(PamObservable observable, PamDataUnit pamDataUnit) Informs the PamObserver that existing data have been updatedMethods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, 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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Constructor Details
-
SimpleMap
-
SimpleMap
-
-
Method Details
-
getSelectorName
Name for data selectors and data filters.- Returns:
-
getUnitName
- Specified by:
getUnitName
in interfaceSettingsNameProvider
- Returns:
- A Name specific to this instance of the particular class, e.g. Sperm whale detector, Beaked whale detector, etc.
-
getUnitType
Settings manager for when there are multiple maps in user displays.- Specified by:
getUnitType
in interfacePamSettings
- Returns:
- A Name specific to the type, e.g. Click detector
-
getSettingsReference
- Specified by:
getSettingsReference
in interfacePamSettings
- Returns:
- The serialisable object that will be stored
-
getSettingsVersion
public long getSettingsVersion()- Specified by:
getSettingsVersion
in interfacePamSettings
- Returns:
- An integer version number for the settings
-
restoreSettings
- Specified by:
restoreSettings
in interfacePamSettings
- Returns:
- true if successful The object performs final checks (if needed) and then casts the settings data pamcontrolledunitSettings.settings into the correct type and uses as required
-
getObserverObject
- Specified by:
getObserverObject
in interfacePamObserver
- 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.
-
getMapTime
public long getMapTime()Get the time for the map (used when deciding what to plot)- Returns:
- time from either the pamguard clock or the scroll bar.
-
shouldPlot
ShouldPlot function for a datablock, moved here from mappanel so that we can override for a special map for Target motion (and other) dialogs- Parameters:
pamDataBlock
-- Returns:
- true if anything in that datablock should be displayed.
-
shouldPlot
public boolean shouldPlot(PamDataUnit pamDataUnit, MapDetectionData mapDetectionData, long earliestToPlot, long now, DataSelector ds) Shouldplot function for individual data units.- Parameters:
pamDataUnit
-mapDetectionData
-earliestToPlot
-now
-ds
-- Returns:
-
getMapParameters
- Returns:
- The map parameters object.
-
showMapObjects
public void showMapObjects() -
initMapPanel
public void initMapPanel() -
getMapPanel
-
addData
Description copied from interface:PamObserver
Informs the PamObserver that new data have been added to the Observable class- Specified by:
addData
in interfacePamObserver
-
updateData
Description copied from interface:PamObserver
Informs the PamObserver that existing data have been updated- Specified by:
updateData
in interfacePamObserver
-
getObserverName
- Specified by:
getObserverName
in interfacePamObserver
-
noteNewSettings
public void noteNewSettings()- Specified by:
noteNewSettings
in interfacePamObserver
-
setSampleRate
public void setSampleRate(float sampleRate, boolean notify) Description copied from interface:PamObserver
New sample rate- Specified by:
setSampleRate
in interfacePamObserver
- Parameters:
notify
- Notify other PamObservers and PamObservables in the chain.
-
masterClockUpdate
public void masterClockUpdate(long milliSeconds, long sampleNumber) - Specified by:
masterClockUpdate
in interfacePamObserver
-
getRequiredDataHistory
- Specified by:
getRequiredDataHistory
in interfacePamObserver
- Parameters:
arg
- optional argument from PamObservable- Returns:
- time in milliseconds required by data held in PamObservable
-
receiveSourceNotification
Description copied from interface:PamObserver
Receive a notification from the data source - typically a change in DAQ status. See the constants listed in AcquisitionProcess for potential change types.- Specified by:
receiveSourceNotification
in interfacePamObserver
- Parameters:
type
- the type of changeobject
- generic object added here so that we can include anything in the future
-
getDataBlocks
-
getMousedDataUnit
Gets a data unit currently hovered by the mouse. This only gets set if the mouse actually hovers and is then clicked.- Returns:
- hovered data unit.
-
removeObservable
Description copied from interface:PamObserver
called when an Observable (PamDataBlock) is removed from the system- Specified by:
removeObservable
in interfacePamObserver
-
getLastClickedMouseLatLong
-
getMouseMotion
public Map.SimpleMap.MapMouseMotionAdapter getMouseMotion() -
getPanel
-
addMouseAdapterToMapPanel
-
mapCanScroll
public void mapCanScroll(boolean b) -
refreshDetectorList
public void refreshDetectorList() -
scrollRangeChanged
Description copied from interface:PamScrollObserver
Notification sent when a scroller or slider changes it's data rangeIf data were loaded in a worker thread, this notification is sent after the new data have loaded.
- Specified by:
scrollRangeChanged
in interfacePamScrollObserver
- Parameters:
absPamScroller
- reference to moved scroller.
-
scrollValueChanged
Description copied from interface:PamScrollObserver
Notification sent when a scroller or slider changes it's position- Specified by:
scrollValueChanged
in interfacePamScrollObserver
- Parameters:
abstractPamScroller
- reference to moved scroller
-
subscribeViewerBlocks
public boolean subscribeViewerBlocks()Subscribes a variety of data blocks to the scroll bar.- Returns:
- returns true if the list has changes, indicating that it's probably necessary to call loadData in the scroll manager to get new data.
-
getViewerScroller
-
createDisplayMenu
-
getOptionsMenuItem
-
showParametersDialog
-
getComponent
- Specified by:
getComponent
in interfaceUserDisplayComponent
- Returns:
- The Swing component to add to the frame
-
openComponent
public void openComponent()Description copied from interface:UserDisplayComponent
Called when the component is first displayed.- Specified by:
openComponent
in interfaceUserDisplayComponent
-
closeComponent
public void closeComponent()Description copied from interface:UserDisplayComponent
Called when the component is removed from the display.- Specified by:
closeComponent
in interfaceUserDisplayComponent
-
notifyModelChanged
public void notifyModelChanged(int changeType) Description copied from interface:UserDisplayComponent
Pick up model changed notifications from a parent user display.- Specified by:
notifyModelChanged
in interfaceUserDisplayComponent
-
getHiddenSliderTime
- Returns:
- the hiddenSliderTime
-
setHiddenSliderTime
- Parameters:
hiddenSliderTime
- the hiddenSliderTime to set
-
getFrameTitle
Description copied from interface:UserDisplayComponent
Get a title for the frame the component will be added to.- Specified by:
getFrameTitle
in interfaceUserDisplayComponent
- Returns:
- a title for the components frame.
-
getUniqueName
- Specified by:
getUniqueName
in interfaceUserDisplayComponent
- Returns:
- a unique name (across all of PAMGuard) which will be used for mark overlays and settings storage.
-
setUniqueName
Description copied from interface:UserDisplayComponent
Set a unique name for every display. This is important for saving settings and for managing things that need a unique name such as overlay marks and markers.- Specified by:
setUniqueName
in interfaceUserDisplayComponent
-
getMapDetectionsManager
-
getViewerControls
-
getMapMarker
public Map.SimpleMap.MapOverlayMarker getMapMarker()
-