Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bbn.openmap.layer.etopo
Class ETOPOLayer

    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.etopo.ETOPOLayer

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

Direct Known Subclasses:
  ETOPOJarLayer

public class ETOPOLayer
extends OMGraphicHandlerLayer
implements java.awt.event.ActionListener

ETOPOLayer extends Layer to provide rendering of the ETOPO5 world elevation data set. The ETOPO5 data consists of terrain altitude and ocean depth measurements at 5 minute intervals for the entire globe. Rendering is allowed in any projection that implements the inverse(int,int) method. Two types of rendering are provided: grayscale slope-shaded and colored slope-shaded.

The distribution consists of the following:

- 1. ETOPOLayer.java
- 2. ETOPO5 (5 minute spacing data set, 4320x2160 shorts, ~18MB)
- 3. ETOPO10 (10 minute spacing data set, sampled from ETOPO5, ~4.6MB)
- 4. ETOPO15 (15 minute spacing data set, sampled from ETOPO5, ~2MB)
- 5. ETOPOLayer.properties (example properties for openmap.properties)

The sampled ETOPO data sets are provided to speed up the loading of data to compute the slope shading. The algorithm inverse projects the x/y screen coords (for the entire projection screen space) to get the corresponding lat/lon coords then samples the database to get altitude/depth and slope values. While this method is slower than the forward projection method, it does provide a more attractive screen presentation and will support all projections (not just the equidistant cylindrical). A palette provides the ability to choose between the 5,10, or 15 minute resolutions, as well as color or grayscale selection, transparency, and slope contrast.

The ETOPOLayer also relies on properties to set its variables, such as the etopo frame paths (there can be several at a time), the opaqueness of the frame images, number of colors to use, and some other display variables. The ETOPOLayer properties look something like this:

#------------------------------
# Properties for ETOPOLayer
#------------------------------
# This property should reflect the paths to the etopo directory
etopo.path=c:/openmap/share
# Number between 0-255: 0 is transparent, 255 is opaque
etopo.opaque=255
# Number of colors to use on the maps - 16, 32, 216
etopo.number.colors=216
# Type of display for the data
# 0 = grayscale slope shading
# 1 = colored slope shading
etopo.view.type=1
# Contrast setting, 1-5
etopo.contrast=3
# lat/lon spacing in minutes
# must be 5, 10, or 15
etopo.minute.spacing=10
#-------------------------------------
# End of properties for ETOPOLayer
#-------------------------------------

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 int` | `bandHeight` The elevation range to use for each color in band shading.
`protected static int[]` | `blueElev`
`protected int` | `bufferHeight`
`protected int` | `bufferWidth`
`static int` | `COLOREDSHADING` Colorized slope shading.
`protected short[]` | `dataBuffer` The etopo elevation data
`static int` | `DEFAULT_MINUTE_SPACING` Default minute spacing
`static int` | `DEFAULT_OPAQUENESS` for colorizing
`static int` | `DEFAULT_SLOPE_ADJUST` Default contrast setting for slope shading.
`protected static int[]` | `elevLimit` elevation bands
`protected static int` | `elevLimitCnt` number of elevation bands
`protected static java.lang.String[]` | `etopoFileNames` ETOPO elevation files
`protected static int[]` | `etopoHeights`
`static java.lang.String` | `ETOPOMinuteSpacingProperty`
`static java.lang.String` | `ETOPOPathProperty` property suffixes
`static java.lang.String` | `ETOPOPixelSpacerProperty`
`static java.lang.String` | `ETOPOSlopeAdjustProperty`
`protected static double[]` | `etopoSpacings` Spacings (in meters) between adjacent lon points at the equater.
`static java.lang.String` | `ETOPOViewTypeProperty`
`protected static int[]` | `etopoWidths` dimensions of the ETOPO files (don't mess with these!)
`protected static int[]` | `greenElev`
`protected int` | `minuteSpacing` The current resolution (in minutes)
`protected int` | `opaqueness` transparency control
`static java.lang.String` | `OpaquenessProperty`
`protected javax.swing.Box` | `palette` The user interface palette for the ETOPO layer.
`protected java.lang.String` | `path` The paths to the ETOPO directory, telling where the data is.
`protected static int[]` | `redElev` elevation band colors (one for each elevation band)
`protected int` | `slopeAdjust` A contrast adjustment, for slope shading (1-5).
`protected static java.awt.Color[][]` | `slopeColors` for slope shading colors, indexed by elevation band then slope
`protected byte[]` | `slopeMap` Holds the slope values, updated when the resolution changes or the slope adjustment (contrast) is changed.
`protected boolean` | `slopeReset`
`static int` | `SLOPESHADING` Gray scale slope shading, sun from the Northwest.
`protected int` | `spacer` Number of pixel spacers that should be added to a data file, per line, to adjust for skewing.
`protected boolean` | `spacingReset`
`protected int` | `viewType` The display type for the etopo images.

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, 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
`ETOPOLayer()` The default constructor for the Layer.
`ETOPOLayer(java.lang.String pathToETOPODir)` The default constructor for the Layer.

Method Summary
`void` | `actionPerformed(java.awt.event.ActionEvent e)` Used just for the redraw button.
`protected OMRaster` | `buildRaster()`
`protected void` | `buildSlopeMap()` Builds the slope index map.
`protected java.awt.Color` | `getColor(short elevation, byte slopeVal)`
`protected int` | `getElevIndex(short el)`
`java.awt.Component` | `getGUI()` Creates the interface palette.
`protected void` | `loadBuffer()` Loads the database from the appropriate file based on the current resolution.
`OMGraphicList` | `prepare()` Prepares the graphics for the layer.
`protected void` | `setDefaultValues()`
`void` | `setPath(java.lang.String pathToETOPODir)`
`void` | `setProperties(java.lang.String prefix, java.util.Properties properties)` Set all the ETOPO properties from a properties object.

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, getMapMouseListener, getMouseEventInterpreter, getMouseModeIDsForEvents, getProjectionChangePolicy, getProperties, getPropertyInfo, 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
`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

### SLOPESHADING

    public static final int SLOPESHADING

  Gray scale slope shading, sun from the Northwest.

  See Also:
    Constant Field Values

### COLOREDSHADING

    public static final int COLOREDSHADING

  Colorized slope shading. Color basnds are based on elevation, and are accented by shaded indications.

  See Also:
    Constant Field Values

### DEFAULT_SLOPE_ADJUST

    public static final int DEFAULT_SLOPE_ADJUST

  Default contrast setting for slope shading.

  See Also:
    Constant Field Values

### DEFAULT_MINUTE_SPACING

    public static final int DEFAULT_MINUTE_SPACING

  Default minute spacing

  See Also:
    Constant Field Values

### DEFAULT_OPAQUENESS

    public static final int DEFAULT_OPAQUENESS

  for colorizing

  See Also:
    Constant Field Values

### path

    protected java.lang.String path

  The paths to the ETOPO directory, telling where the data is.

### dataBuffer

    protected short[] dataBuffer

  The etopo elevation data

### bufferWidth

    protected int bufferWidth

### bufferHeight

    protected int bufferHeight

### minuteSpacing

    protected int minuteSpacing

  The current resolution (in minutes)

### etopoFileNames

    protected static final java.lang.String[] etopoFileNames

  ETOPO elevation files

### etopoWidths

    protected static final int[] etopoWidths

  dimensions of the ETOPO files (don't mess with these!)

### etopoHeights

    protected static final int[] etopoHeights

### etopoSpacings

    protected static final double[] etopoSpacings

  Spacings (in meters) between adjacent lon points at the equater. The values here were aesthetically defined (they are not the actual spacings)

### viewType

    protected int viewType

  The display type for the etopo images. Slope shading is grayscale terrain modeling with highlights and shading, with the 'sun' being in the NorthWest. Colored Elevation shading is the same thing, except colors are added to indicate the elevation. Band shading colors the pixels according to a range of elevations.

### bandHeight

    protected int bandHeight

  The elevation range to use for each color in band shading.

### slopeAdjust

    protected int slopeAdjust

  A contrast adjustment, for slope shading (1-5).

### opaqueness

    protected int opaqueness

  transparency control

### spacer

    protected int spacer

  Number of pixel spacers that should be added to a data file, per line, to adjust for skewing.

### ETOPOPathProperty

    public static final java.lang.String ETOPOPathProperty

  property suffixes

  See Also:
    Constant Field Values

### OpaquenessProperty

    public static final java.lang.String OpaquenessProperty

See Also:
  Constant Field Values

### ETOPOViewTypeProperty

    public static final java.lang.String ETOPOViewTypeProperty

See Also:
  Constant Field Values

### ETOPOSlopeAdjustProperty

    public static final java.lang.String ETOPOSlopeAdjustProperty

See Also:
  Constant Field Values

### ETOPOMinuteSpacingProperty

    public static final java.lang.String ETOPOMinuteSpacingProperty

See Also:
  Constant Field Values

### ETOPOPixelSpacerProperty

    public static final java.lang.String ETOPOPixelSpacerProperty

See Also:
  Constant Field Values

### slopeMap

    protected byte[] slopeMap

  Holds the slope values, updated when the resolution changes or the slope adjustment (contrast) is changed. Slope values are scaled between -127 to 127.

### elevLimit

    protected static final int[] elevLimit

  elevation bands

### elevLimitCnt

    protected static final int elevLimitCnt

  number of elevation bands

  See Also:
    Constant Field Values

### redElev

    protected static final int[] redElev

  elevation band colors (one for each elevation band)

### greenElev

    protected static final int[] greenElev

### blueElev

    protected static final int[] blueElev

### slopeColors

    protected static java.awt.Color[][] slopeColors

  for slope shading colors, indexed by elevation band then slope

### slopeReset

    protected boolean slopeReset

### spacingReset

    protected boolean spacingReset

### palette

    protected javax.swing.Box palette

  The user interface palette for the ETOPO layer.

Constructor Detail

### ETOPOLayer

    public ETOPOLayer()

  The default constructor for the Layer. All of the attributes are set to their default values.

### ETOPOLayer

    public ETOPOLayer(java.lang.String pathToETOPODir)

  The default constructor for the Layer. All of the attributes are set to their default values.

Parameters:
  `pathToETOPODir` - path to the directory holding the ETOPO data

Method Detail

### setPath

    public void setPath(java.lang.String pathToETOPODir)

### setDefaultValues

    protected void setDefaultValues()

### getElevIndex

    protected int getElevIndex(short el)

### getColor

    protected java.awt.Color getColor(short elevation,
                                      byte slopeVal)

### setProperties

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

  Set all the ETOPO properties from a properties object.

  Specified by:
    `setProperties` in interface `PropertyConsumer`
  Overrides:
    `setProperties` in class `OMGraphicHandlerLayer`
  Parameters:
    `prefix` - the token to prefix the property names
    `properties` - the `Properties` object

### buildSlopeMap

    protected void buildSlopeMap()

  Builds the slope index map. This method is called when the ETOPO resolution changes and when the slope contrast changes. The slope of the terrain is cliped; slopes are between the range of +/- 45 deg. The calculated slope value is then linearly scaled to the range +/- 127.

### loadBuffer

    protected void loadBuffer()

  Loads the database from the appropriate file based on the current resolution. The data files are in INTEL format (must call BinaryBufferedFile.byteOrder(true)).

### buildRaster

    protected OMRaster buildRaster()

### prepare

    public OMGraphicList prepare()

  Prepares the graphics for the layer. This is where the getRectangle() method call is made on the etopo.

  Occasionally it is necessary to abort a prepare call. When this happens, the map will set the cancel bit in the LayerThread, (the thread that is running the prepare). If this Layer needs to do any cleanups during the abort, it should do so, but return out of the prepare asap.

  Overrides:
    `prepare` in class `OMGraphicHandlerLayer`

### getGUI

    public java.awt.Component getGUI()

  Creates the interface palette.

  Overrides:
    `getGUI` in class `Layer`
  Returns:
    java.awt.Component or null

### actionPerformed

    public void actionPerformed(java.awt.event.ActionEvent e)

  Used just for the redraw button.

  Specified by:
    `actionPerformed` in interface `java.awt.event.ActionListener`
  Overrides:
    `actionPerformed` in class `Layer`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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