com.bbn.openmap.layer.dted
Class DTEDLayer

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by com.bbn.openmap.Layer
                  extended by com.bbn.openmap.layer.OMGraphicHandlerLayer
                      extended by com.bbn.openmap.layer.dted.DTEDLayer
All Implemented Interfaces:
ProjectionListener, GestureResponsePolicy, OMGraphicHandler, ProjectionPainter, PropertyConsumer, java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.io.Serializable, java.util.EventListener

public class DTEDLayer
extends OMGraphicHandlerLayer

The DTEDLayer fills the screen with DTED data. To view the DTED images, the projection has to be set in a Equal ARC projection, which OpenMap calls the CADRG projection or the LLXY projection. In Gesture mode, clicking on the map will cause the DTEDLayer to place a point on the window and show the elevation of that point. The Gesture response is not dependent on the scale or projection of the screen.

The DTEDLayer uses the DTEDCacheManager to get the images it needs. The DTEDLayer receives projection change events, and then asks the cache manager for the images it needs based on the new projection. The DTEDLayer also relies on properties to set its variables, such as the dted 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 DTEDLayer properties look something like this:

NOTE: Make sure your DTED file and directory names are in lower case. You can use the com.bbn.openmap.util.wanderer.ChangeCase class to make modifications if necessary.

 
     #------------------------------
     # Properties for DTEDLayer
     #------------------------------
     # This property should reflect the paths to the dted level 0, 1 and newer 2 (file extension .dt2) data directories, separated by a semicolon.
     dted.paths=/usr/local/matt/data/dted;/cdrom/cdrom0/dted
     
     # Number between 0-255: 0 is transparent, 255 is opaque
     dted.opaque=255
     
     # Number of colors to use on the maps - 16, 32, 216
     dted.number.colors=216
     
     # Level of DTED data to use 0, 1, 2
     dted.level=0
     
     # Type of display for the data
     # 0 = no shading at all
     # 1 = greyscale slope shading
     # 2 = band shading, in meters
     # 3 = band shading, in feet
     # 4 = subframe testing
     # 5 = elevation, colored
     dted.view.type=5
     
     # Contrast setting, 1-5
     dted.contrast=3
     
     # height (meters or feet) between color changes in band shading
     dted.band.height=25
     
     # Minumum scale to display images. Larger numbers mean smaller scale, 
     # and are more zoomed out.
     dted.min.scale=20000000
     
     # Delete the cache if the layer is removed from the map.
     dted.kill.cache=true
     # Number of frames to hold in the cache. The default is 
     # DTEDFrameCache.FRAME_CACHE_SIZE, which is 15 to help smaller systems.  Better
     # caching happens, the larger the number.
     dted.cacheSize=40
     #-------------------------------------
     # End of properties for DTEDLayer
     #-------------------------------------
 
 

See Also:
ChangeCase, Serialized Form

Nested Class Summary
 
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
protected  int bandHeight
          The elevation range to use for each color in band shading.
protected  DTEDCacheManager cache
          The cache manager.
protected  int cacheSize
          The number of frames held by the cache objects.
protected  boolean cancelled
          Set when the projection has changed while a swing worker is gathering graphics, and we want him to stop early.
static java.lang.String DTED2PathsProperty
           
static java.lang.String DTEDBandHeightProperty
           
static java.lang.String DTEDFrameCacheSizeProperty
           
static java.lang.String DTEDKillCacheProperty
           
protected  int dtedLevel
          The level of DTED to use.
static java.lang.String DTEDLevelProperty
           
static java.lang.String DTEDMinScaleProperty
           
static java.lang.String DTEDPathsProperty
           
static java.lang.String DTEDSlopeAdjustProperty
           
static java.lang.String DTEDViewTypeProperty
           
protected  boolean killCache
          Flag to delete the cache if the layer is removed from the map.
protected  int numColors
           
static java.lang.String NumColorsProperty
           
protected  int opaqueness
           
static java.lang.String OpaquenessProperty
           
protected  javax.swing.Box paletteBox
          The user interface palette for the DTED layer.
protected  java.lang.String[] paths
          The paths to the DTED Level 0, 1 directories, telling where the data is.
protected  int slopeAdjust
          A contrast adjustment, for slope shading (1-5).
protected  int viewType
          The display type for the dted images.
 
Fields inherited from class com.bbn.openmap.layer.OMGraphicHandlerLayer
consumeEvents, ConsumeEventsProperty, filter, interruptable, InterruptableProperty, layerWorker, LAYERWORKER_LOCK, layerWorkerQueue, logger, 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, coordTransform, DataPathPrefixProperty, DisplayPaletteCmd, DisplayPropertiesCmd, doHack, HidePaletteCmd, i18n, localHackList, maxScale, MaxScaleProperty, minScale, MinScaleProperty, palette, paletteListener, PrettyNameProperty, propertyPrefix, readyToPaint, RedrawCmd, removable, RemovableProperty, SWING_PACKAGE, TransformProperty, 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
DTEDLayer()
          The default constructor for the Layer.
DTEDLayer(java.lang.String[] pathsToDTEDDirs)
          The default constructor for the Layer.
 
Method Summary
 boolean determineLocation(java.awt.event.MouseEvent e)
           
 int getBandHeight()
          Get the value for the interval between band colors for meter and feet shading view types.
 DTEDCacheManager getCache()
           
 int getCacheSize()
          Get the cache size, or how many DTED frames are held in memory.
 int getDtedLevel()
          Get the value set for which DTED level is being used, 0-2.
 java.awt.Component getGUI()
          Creates the interface palette.
 boolean getKillCache()
          Get whether the cache will be killed when the layer is removed from the map.
 MapMouseInterpreter getMouseEventInterpreter()
          Overridden to modify the MapMouseInterpreter used by the layer.
 int getNumColors()
          Get the number of colors used in the DTED images.
 int getOpaqueness()
          Get the opaqueness value used for the images, 0-255.
 java.lang.String[] getPaths()
          Get the paths to the DTED directories.
 int getSlopeAdjust()
          Get the value for contrast adjustments, 1-5.
 int getViewType()
          Get the view type set for creating images.
 boolean isHighlightable(OMGraphic omg)
          Don't need DTEDFrames highlighting themselves.
 void paint(java.awt.Graphics g)
          Paints the layer.
 OMGraphicList prepare()
          Prepares the graphics for the layer.
 void removed(java.awt.Container cont)
          Called when the layer is no longer part of the map.
 void setBandHeight(int bh)
           
 void setCache(DTEDCacheManager cache)
           
 void setCacheSize(int cs)
           
protected  void setDefaultValues()
           
 void setDtedLevel(int level)
           
 void setKillCache(boolean kc)
           
 void setNumColors(int nc)
           
 void setOpaqueness(int o)
           
 void setPaths(java.lang.String[] pathsToDTEDDirs)
          Set the paths to the DTED directories.
 void setProperties(java.lang.String prefix, java.util.Properties properties)
          Set all the DTED properties from a properties object.
 void setSlopeAdjust(int sa)
           
 void setViewType(int vt)
           
 
Methods inherited from class com.bbn.openmap.layer.OMGraphicHandlerLayer
actionPerformed, canSetList, copy, createLayerWorker, cut, deselect, dispose, doAction, doPrepare, filter, filter, filter, getConsumeEvents, getDefaultSettingsPanel, getFilter, getInfoText, getItemsForMapMenu, getItemsForOMGraphicMenu, getLayerWorker, getList, getMapMouseListener, getMouseModeIDsForEvents, getProjectionChangePolicy, getProperties, getPropertyInfo, getRedrawButton, getRenderPolicy, getSelected, getSettingsButton, getToolTipTextFor, getTransparency, getTransparencyAdjustmentPanel, highlight, isCancelled, isInterruptable, isSelectable, isWorking, leftClick, mouseOver, paste, projectionChanged, receivesMapEvents, renderDataForProjection, resetFiltering, select, 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, disconnectFromBeanContext, 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, getCoordTransform, getIcon, getMaxScale, getMinScale, getPackage, getPalette, getProjection, getPropertyPrefix, getWindowSupport, hasGUI, hidePalette, isAutoPalette, isProjectionOK, isReadyToPaint, isRemovable, notifyHideHack, prependDataPathPrefix, putAttribute, removeComponentListener, removeConfirmed, removeInfoDisplayListener, removeLayerStatusListener, removeVetoableChangeListener, repaint, resetPalette, setAddAsBackground, setAddToBeanContext, setAutoPalette, setBeanContext, setCoordTransform, setIcon, setLayerProperties, setMaxScale, setMinScale, setName, setPaletteVisible, setProjection, setProjection, setProperties, setPropertyPrefix, setReadyToPaint, setRemovable, setVisible, setWindowSupport, showPalette
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, 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, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, update, updateUI
 
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, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, 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, 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, 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

cache

protected transient DTEDCacheManager cache
The cache manager.


cancelled

protected boolean cancelled
Set when the projection has changed while a swing worker is gathering graphics, and we want him to stop early.


paths

protected java.lang.String[] paths
The paths to the DTED Level 0, 1 directories, telling where the data is. Newer level 2 data, with the .dt2 file extensions, should be set in this path property.


dtedLevel

protected int dtedLevel
The level of DTED to use. Level 0 is 1km post spacing, Level 1 is 100m post spacing. Level 2 is 30m post spacing


viewType

protected int viewType
The display type for the dted images. Slope shading is greyscale 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).


numColors

protected int numColors

opaqueness

protected int opaqueness

killCache

protected boolean killCache
Flag to delete the cache if the layer is removed from the map.


cacheSize

protected int cacheSize
The number of frames held by the cache objects.


DTEDPathsProperty

public static final java.lang.String DTEDPathsProperty
See Also:
Constant Field Values

DTED2PathsProperty

public static final java.lang.String DTED2PathsProperty
See Also:
Constant Field Values

OpaquenessProperty

public static final java.lang.String OpaquenessProperty
See Also:
Constant Field Values

NumColorsProperty

public static final java.lang.String NumColorsProperty
See Also:
Constant Field Values

DTEDLevelProperty

public static final java.lang.String DTEDLevelProperty
See Also:
Constant Field Values

DTEDViewTypeProperty

public static final java.lang.String DTEDViewTypeProperty
See Also:
Constant Field Values

DTEDSlopeAdjustProperty

public static final java.lang.String DTEDSlopeAdjustProperty
See Also:
Constant Field Values

DTEDBandHeightProperty

public static final java.lang.String DTEDBandHeightProperty
See Also:
Constant Field Values

DTEDMinScaleProperty

public static final java.lang.String DTEDMinScaleProperty
See Also:
Constant Field Values

DTEDKillCacheProperty

public static final java.lang.String DTEDKillCacheProperty
See Also:
Constant Field Values

DTEDFrameCacheSizeProperty

public static final java.lang.String DTEDFrameCacheSizeProperty
See Also:
Constant Field Values

paletteBox

protected javax.swing.Box paletteBox
The user interface palette for the DTED layer.

Constructor Detail

DTEDLayer

public DTEDLayer()
The default constructor for the Layer. All of the attributes are set to their default values.


DTEDLayer

public DTEDLayer(java.lang.String[] pathsToDTEDDirs)
The default constructor for the Layer. All of the attributes are set to their default values.

Parameters:
pathsToDTEDDirs - paths to the DTED directories that hold level 0, 1 and 2 data.
Method Detail

setPaths

public void setPaths(java.lang.String[] pathsToDTEDDirs)
Set the paths to the DTED directories.


getPaths

public java.lang.String[] getPaths()
Get the paths to the DTED directories.


getCache

public DTEDCacheManager getCache()

setCache

public void setCache(DTEDCacheManager cache)

setDefaultValues

protected void setDefaultValues()

setProperties

public void setProperties(java.lang.String prefix,
                          java.util.Properties properties)
Set all the DTED 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

removed

public void removed(java.awt.Container cont)
Called when the layer is no longer part of the map. In this case, we should disconnect from the server if we have a link.

Overrides:
removed in class Layer
Parameters:
cont - Container

prepare

public OMGraphicList prepare()
Prepares the graphics for the layer. This is where the getRectangle() method call is made on the dted.

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

paint

public void paint(java.awt.Graphics g)
Paints the layer.

Overrides:
paint in class OMGraphicHandlerLayer
Parameters:
g - the Graphics context for painting

getViewType

public int getViewType()
Get the view type set for creating images.

 
 
 
 
     0: DTEDFrameSubframe.NOSHADING
     1: DTEDFrameSubframe.SLOPESHADING
     2: DTEDFrameSubframe.COLOREDSHADING
     3: DTEDFrameSubframe.METERSHADING
     4: DTEDFrameSubframe.FEETSHADING
 
 
 
 
 


setViewType

public void setViewType(int vt)

getBandHeight

public int getBandHeight()
Get the value for the interval between band colors for meter and feet shading view types.


setBandHeight

public void setBandHeight(int bh)

getSlopeAdjust

public int getSlopeAdjust()
Get the value for contrast adjustments, 1-5.


setSlopeAdjust

public void setSlopeAdjust(int sa)

getDtedLevel

public int getDtedLevel()
Get the value set for which DTED level is being used, 0-2.


setDtedLevel

public void setDtedLevel(int level)

getOpaqueness

public int getOpaqueness()
Get the opaqueness value used for the images, 0-255.


setOpaqueness

public void setOpaqueness(int o)

getKillCache

public boolean getKillCache()
Get whether the cache will be killed when the layer is removed from the map.


setKillCache

public void setKillCache(boolean kc)

getCacheSize

public int getCacheSize()
Get the cache size, or how many DTED frames are held in memory.


setCacheSize

public void setCacheSize(int cs)

getNumColors

public int getNumColors()
Get the number of colors used in the DTED images.


setNumColors

public void setNumColors(int nc)

getGUI

public java.awt.Component getGUI()
Creates the interface palette.

Overrides:
getGUI in class Layer
Returns:
java.awt.Component or null, null by default.

getMouseEventInterpreter

public MapMouseInterpreter getMouseEventInterpreter()
Overridden to modify the MapMouseInterpreter used by the layer.

Overrides:
getMouseEventInterpreter in class OMGraphicHandlerLayer

determineLocation

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

isHighlightable

public boolean isHighlightable(OMGraphic omg)
Don't need DTEDFrames highlighting themselves.

Specified by:
isHighlightable in interface GestureResponsePolicy
Overrides:
isHighlightable in class OMGraphicHandlerLayer


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