## com.bbn.openmap.layer
Class EarthquakeLayer

    java.lang.Object
      java.awt.Component
          java.awt.Container
              javax.swing.JComponent
                  com.bbn.openmap.Layer
                      com.bbn.openmap.layer.OMGraphicHandlerLayer
                          com.bbn.openmap.layer.EarthquakeLayer

All Implemented Interfaces:
  java.awt.event.ActionListener, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.util.EventListener, GestureResponsePolicy, java.awt.image.ImageObserver, MapMouseListener, java.awt.MenuContainer, ProjectionListener, ProjectionPainter, PropertyConsumer, java.io.Serializable

public class EarthquakeLayer
extends OMGraphicHandlerLayer
implements MapMouseListener

Get data about recent earthquakes from the USGS finger sites and display it.

Debugging information is printed when the OpenMap Viewer is launch with -Ddebug.earthquake flag.

       # Properties for the Earthquake Layer
       earthquake.sites=<finger site> <finger site> ...
       # in seconds
       earthquake.queryinterval=300

See Also:
  Serialized Form

Nested Class Summary

Nested classes inherited from class javax.swing.JComponent
`javax.swing.JComponent.AccessibleJComponent`

Nested classes inherited from class java.awt.Container
`java.awt.Container.AccessibleAWTContainer`

Nested classes inherited from class java.awt.Component
`java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy`

Field Summary
`protected boolean[]` `activeSites` Sites that are actively being queried.
`protected java.lang.String[]` `drillData`
`protected java.lang.String[]` `fingerSites` Sites to finger user the user `quake'.
`static java.lang.String` `fingerSitesProperty`
`protected javax.swing.JPanel` `gui` The layer GUI.
`protected java.lang.String[]` `infoData`
`protected java.awt.Color` `lineColor`
`protected float[]` `llData`
`static java.lang.String` `queryIntervalProperty`
`protected boolean` `showingInfoLine`

Fields inherited from class com.bbn.openmap.layer.OMGraphicHandlerLayer
`consumeEvents, ConsumeEventsProperty, filter, interruptable, InterruptableProperty, layerWorker, LAYERWORKER_LOCK, mouseEventInterpreter, mouseModeIDs, MouseModesProperty, projectionChangePolicy, ProjectionChangePolicyProperty, renderPolicy, RenderPolicyProperty, selectedList, TransparencyProperty`

Fields inherited from class com.bbn.openmap.Layer

`addAsBackground, AddAsBackgroundProperty, addToBeanContext, AddToBeanContextProperty, attributes, autoPalette, AutoPaletteProperty, beanContextChildSupport, DisplayPaletteCmd, DisplayPropertiesCmd, doHack, HidePaletteCmd, i18n, IDListeners, localHackList, lsListeners, maxScale, MaxScaleProperty, minScale, MinScaleProperty, palette, paletteListener, PrettyNameProperty, propertyPrefix, RedrawCmd, removable, RemovableProperty, SWING_PACKAGE, windowSupport`

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 com.bbn.openmap.PropertyConsumer
`EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty`

Fields inherited from interface java.awt.image.ImageObserver
`ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH`

Constructor Summary
`EarthquakeLayer()` Construct an EarthquakeLayer.

Method Summary
`protected OMGraphicList` `generateGraphics()` Create the graphics.
`protected java.util.Vector` `getEarthquakeData()` Get the earthquake data from the USGS.
`java.awt.Component` `getGUI()` Gets the gui controls associated with the layer.
`MapMouseListener` `getMapMouseListener()` Returns the MapMouseListener object that handles the mouse events.
`java.lang.String[]` `getMouseModeServiceList()` Return a list of the modes that are interesting to the MapMouseListener.
`java.util.Properties` `getProperties(java.util.Properties props)` Get the associated properties object.
`java.util.Properties` `getProperties(java.lang.String prefix, java.util.Properties props)` Get the associated properties object.
`java.util.Properties` `getPropertyInfo(java.util.Properties info)` Supplies the propertiesInfo object associated with this EarthquakeLayer object.
`boolean` `mouseClicked(java.awt.event.MouseEvent e)` Invoked when the mouse has been clicked on a component.
`boolean` `mouseDragged(java.awt.event.MouseEvent e)` Invoked when a mouse button is pressed on a component and then dragged.
`void` `mouseEntered(java.awt.event.MouseEvent e)` Invoked when the mouse enters a component.
`void` `mouseExited(java.awt.event.MouseEvent e)` Invoked when the mouse exits a component.
`void` `mouseMoved()` Handle a mouse cursor moving without the button being pressed.
`boolean` `mouseMoved(java.awt.event.MouseEvent e)` Invoked when the mouse button has been moved on a component (with no buttons down).
`boolean` `mousePressed(java.awt.event.MouseEvent e)` Invoked when a mouse button has been pressed on a component.
`boolean` `mouseReleased(java.awt.event.MouseEvent e)` Invoked when a mouse button has been released on a component.
`protected boolean` `needToRefetchData()` Fetches data if it hasn't been fetched in a while.
`protected void` `parseData(java.util.Vector data)` Parse the finger site data.
`OMGraphicList` `prepare()` Fetch data from finger sites, if needed, generate the OMGraphics with the current projection regardless.
`void` `setProperties(java.lang.String prefix, java.util.Properties props)` Set the properties of the EarthquakeLayer.

Methods inherited from class com.bbn.openmap.layer.OMGraphicHandlerLayer

`canSetList, copy, createLayerWorker, cut, deselect, doAction, doPrepare, filter, filter, filter, getConsumeEvents, getFilter, getInfoText, getItemsForMapMenu, getItemsForOMGraphicMenu, getLayerWorker, getList, getMouseEventInterpreter, getMouseModeIDsForEvents, getProjectionChangePolicy, getRenderPolicy, getSelected, getToolTipTextFor, getTransparency, getTransparencyAdjustmentPanel, highlight, interrupt, isCancelled, isHighlightable, isInterruptable, isSelectable, isWorking, leftClick, mouseOver, paint, paste, projectionChanged, receivesMapEvents, renderDataForProjection, resetFiltering, select, setCancelled, setConsumeEvents, setFilter, setInterruptable, setLayerWorker, setList, setMouseEventInterpreter, setMouseModeIDsForEvents, setProjectionChangePolicy, setRenderPolicy, setTransparency, supportsSQL, unhighlight, workerComplete`

Methods inherited from class com.bbn.openmap.Layer

`actionPerformed, addComponentListener, added, addInfoDisplayListener, addLayerStatusListener, addMouseListener, addVetoableChangeListener, childrenAdded, childrenRemoved, clearListeners, connectToBeanContext, createWindowSupport, finalize, findAndInit, findAndInit, findAndUndo, fireHideToolTip, firePaletteEvent, fireRequestBrowserContent, fireRequestBrowserContent, fireRequestCursor, fireRequestInfoLine, fireRequestInfoLine, fireRequestInfoLine, fireRequestMessage, fireRequestMessage, fireRequestToolTip, fireRequestToolTip, fireRequestURL, fireRequestURL, fireStatusUpdate, fireStatusUpdate, fireVetoableChange, getAddAsBackground, getAddToBeanContext, getAttribute, getBeanContext, getIcon, getMaxScale, getMinScale, getPackage, getPalette, getProjection, getPropertyPrefix, getWindowSupport, hasGUI, hidePalette, isAutoPalette, isProjectionOK, isRemovable, notifyHideHack, putAttribute, removeComponentListener, removeConfirmed, removed, removeInfoDisplayListener, removeLayerStatusListener, removeVetoableChangeListener, repaint, resetPalette, setAddAsBackground, setAddToBeanContext, setAutoPalette, setBeanContext, setIcon, setMaxScale, setMinScale, setName, setPaletteVisible, setProjection, setProjection, setProperties, setPropertyPrefix, setRemovable, setVisible, setWindowSupport, showPalette`

Methods inherited from class javax.swing.JComponent

`addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, update, updateUI`

Methods inherited from class java.awt.Container

`add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree`

Methods inherited from class java.awt.Component

`action, add, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle`

Methods inherited from class java.lang.Object
`clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface java.beans.beancontext.BeanContextChild
`addPropertyChangeListener, removePropertyChangeListener`

Field Detail

### fingerSitesProperty

    public static final transient java.lang.String fingerSitesProperty

See Also:
  Constant Field Values

### queryIntervalProperty

    public static final transient java.lang.String queryIntervalProperty

See Also:
  Constant Field Values

### fingerSites

    protected java.lang.String[] fingerSites

  Sites to finger user the user `quake'.

### activeSites

    protected boolean[] activeSites

  Sites that are actively being queried.

### llData

    protected float[] llData

### infoData

    protected java.lang.String[] infoData

### drillData

    protected java.lang.String[] drillData

### lineColor

    protected java.awt.Color lineColor

### showingInfoLine

    protected boolean showingInfoLine

### gui

    protected javax.swing.JPanel gui

  The layer GUI.

Constructor Detail

### EarthquakeLayer

    public EarthquakeLayer()

  Construct an EarthquakeLayer.

Method Detail

### prepare

    public OMGraphicList prepare()

  Fetch data from finger sites, if needed, generate the OMGraphics with the current projection regardless.

  Overrides:
    `prepare` in class `OMGraphicHandlerLayer`

### needToRefetchData

    protected boolean needToRefetchData()

  Fetches data if it hasn't been fetched in a while.

### generateGraphics

    protected OMGraphicList generateGraphics()

  Create the graphics.

### parseData

    protected void parseData(java.util.Vector data)

  Parse the finger site data.

  Parameters:
    `data` - Vector

### getEarthquakeData

    protected java.util.Vector getEarthquakeData()

  Get the earthquake data from the USGS. Should be called in a SwingWorker thread, or you will freeze the application.

  Returns:
    Vector containing information from the websites.

### getGUI

    public java.awt.Component getGUI()

  Gets the gui controls associated with the layer.

  Overrides:
    `getGUI` in class `Layer`
  Returns:
    Component

### getMapMouseListener

    public MapMouseListener getMapMouseListener()

  Returns the MapMouseListener object that handles the mouse events.

  Overrides:
    `getMapMouseListener` in class `OMGraphicHandlerLayer`
  Returns:
    the MapMouseListener for the layer, or null if none

### getMouseModeServiceList

    public java.lang.String[] getMouseModeServiceList()

  Return a list of the modes that are interesting to the MapMouseListener. The source MouseEvents will only get sent to the MapMouseListener if the mode is set to one that the listener is interested in. Layers interested in receiving events should register for receiving events in "select" mode: `

       return new String[] { SelectMouseMode.modeID };

  `

  ``
  Specified by:
    `getMouseModeServiceList` in interface `MapMouseListener`
  Returns:
    String[] of modeID's
  See Also:
    `NavMouseMode.modeID`, `SelectMouseMode.modeID`, `NullMouseMode.modeID`

### mousePressed

    public boolean mousePressed(java.awt.event.MouseEvent e)

  Invoked when a mouse button has been pressed on a component.

  Specified by:
    `mousePressed` in interface `MapMouseListener`
  Parameters:
    `e` - MouseEvent
  Returns:
    true if the listener was able to process the event.

### mouseReleased

    public boolean mouseReleased(java.awt.event.MouseEvent e)

  Invoked when a mouse button has been released on a component.

  Specified by:
    `mouseReleased` in interface `MapMouseListener`
  Parameters:
    `e` - MouseEvent
  Returns:
    true if the listener was able to process the event.

### mouseClicked

    public boolean mouseClicked(java.awt.event.MouseEvent e)

  Invoked when the mouse has been clicked on a component. The listener will receive this event if it successfully processed `mousePressed()`, or if no other listener processes the event. If the listener successfully processes mouseClicked(), then it will receive the next mouseClicked() notifications that have a click count greater than one.

  Specified by:
    `mouseClicked` in interface `MapMouseListener`
  Parameters:
    `e` - MouseEvent
  Returns:
    true if the listener was able to process the event.

### mouseEntered

    public void mouseEntered(java.awt.event.MouseEvent e)

  Invoked when the mouse enters a component.

  Specified by:
    `mouseEntered` in interface `MapMouseListener`
  Parameters:
    `e` - MouseEvent

### mouseExited

    public void mouseExited(java.awt.event.MouseEvent e)

  Invoked when the mouse exits a component.

  Specified by:
    `mouseExited` in interface `MapMouseListener`
  Parameters:
    `e` - MouseEvent

### mouseDragged

    public boolean mouseDragged(java.awt.event.MouseEvent e)

  Invoked when a mouse button is pressed on a component and then dragged. The listener will receive these events if it successfully processes mousePressed(), or if no other listener processes the event.

  Specified by:
    `mouseDragged` in interface `MapMouseListener`
  Parameters:
    `e` - MouseEvent
  Returns:
    true if the listener was able to process the event.

### mouseMoved

    public boolean mouseMoved(java.awt.event.MouseEvent e)

  Invoked when the mouse button has been moved on a component (with no buttons down).

  Specified by:
    `mouseMoved` in interface `MapMouseListener`
  Parameters:
    `e` - MouseEvent
  Returns:
    true if the listener was able to process the event.

### mouseMoved

    public void mouseMoved()

  Handle a mouse cursor moving without the button being pressed. This event is intended to tell the listener that there was a mouse movement, but that the event was consumed by another layer. This will allow a mouse listener to clean up actions that might have happened because of another motion event response.

  Specified by:
    `mouseMoved` in interface `MapMouseListener`

### setProperties

    public void setProperties(java.lang.String prefix,
                              java.util.Properties props)

  Set the properties of the EarthquakeLayer.

  Specified by:
    `setProperties` in interface `PropertyConsumer`
  Overrides:
    `setProperties` in class `OMGraphicHandlerLayer`
  Parameters:
    `prefix` - String
    `props` - Properties

### getProperties

    public java.util.Properties getProperties(java.util.Properties props)

  Get the associated properties object.

  Specified by:
    `getProperties` in interface `PropertyConsumer`
  Overrides:
    `getProperties` in class `OMGraphicHandlerLayer`

### getProperties

    public java.util.Properties getProperties(java.lang.String prefix,
                                              java.util.Properties props)

  Get the associated properties object. This method creates a Properties object if necessary and fills it with the relevant data for this layer. Relevant properties for EarthquakeLayers are the sites to retrieve earth quake data from, and the interval in milliseconds (see class description.)

### getPropertyInfo

    public java.util.Properties getPropertyInfo(java.util.Properties info)

  Supplies the propertiesInfo object associated with this EarthquakeLayer object. Contains the human readable describtions of the properties and the `initPropertiesProperty` (see Inspector class.)

  Specified by:
    `getPropertyInfo` in interface `PropertyConsumer`
  Overrides:
    `getPropertyInfo` in class `OMGraphicHandlerLayer`

Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details