|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
com.bbn.openmap.Layer
com.bbn.openmap.layer.dted.DTEDLayer
The DTEDLayer fills the screen with DTED data. To view the DTED iamges, 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 # This property should reflect the paths to old dted level 2 data directories (file extension .dt1) dted.level2.paths=/usr/local/matt/data/dted_level2 # 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 #-------------------------------------
ChangeCase
,
Serialized FormNested 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 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 OMGraphicList |
omGraphics
The graphics list used for display. |
protected int |
opaqueness
|
static java.lang.String |
OpaquenessProperty
|
protected javax.swing.Box |
palette
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 java.lang.String[] |
paths2
Because older DTED Level 2 data has the same name extension as Level 1 data, a separate array of pathnames is available for that old data. |
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 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. |
|
DTEDLayer(java.lang.String[] pathsToDTEDDirs,
java.lang.String[] pathsToDTED2Dirs)
The default constructor for the Layer. |
Method Summary | |
void |
actionPerformed(java.awt.event.ActionEvent e)
Used just for the redraw button. |
void |
doPrepare()
Method to trigger the layer to recreate the graphics and paint them. |
int |
getBandHeight()
Get the value for the interval between band colors for meter and feet shading view types. |
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. |
OMGraphicList |
getGraphicList()
Retrieves the current graphics list. |
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. |
java.lang.String[] |
getLevel2Paths()
Get the paths to the Level 2 DTED directories. |
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. |
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 |
isCancelled()
Check to see if the cancelled flag has been set. |
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. |
void |
paint(java.awt.Graphics g)
Paints the layer. |
OMGraphicList |
prepare()
Prepares the graphics for the layer. |
void |
projectionChanged(ProjectionEvent e)
From the ProjectionListener interface. |
void |
removed(java.awt.Container cont)
Called when the layer is no longer part of the map. |
void |
renderDataForProjection(Projection proj,
java.awt.Graphics g)
Implementing the ProjectionPainter interface. |
void |
setBandHeight(int bh)
|
void |
setCacheSize(int cs)
|
void |
setCancelled(boolean set)
Used to set the cancelled flag in the layer. |
protected void |
setDefaultValues()
|
void |
setDtedLevel(int level)
|
void |
setGraphicList(OMGraphicList aList)
Sets the current graphics list to the given list. |
void |
setKillCache(boolean kc)
|
void |
setNumColors(int nc)
|
void |
setOpaqueness(int o)
|
void |
setPaths(java.lang.String[] pathsToDTEDDirs,
java.lang.String[] pathsToDTED2Dirs)
Set the paths to the DTED directories. |
void |
setProperties(java.util.Properties properties)
Set all the DTED properties from a properties object. |
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)
|
protected void |
workerComplete(com.bbn.openmap.layer.dted.DTEDLayer.DTEDWorker worker)
The DTEDWorker calls this method on the layer when it is done working. |
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 |
protected transient DTEDCacheManager cache
protected OMGraphicList omGraphics
protected boolean cancelled
protected java.lang.String[] paths
protected java.lang.String[] paths2
protected int dtedLevel
protected int viewType
protected int bandHeight
protected int slopeAdjust
protected int numColors
protected int opaqueness
protected boolean killCache
protected int cacheSize
public static final java.lang.String DTEDPathsProperty
public static final java.lang.String DTED2PathsProperty
public static final java.lang.String OpaquenessProperty
public static final java.lang.String NumColorsProperty
public static final java.lang.String DTEDLevelProperty
public static final java.lang.String DTEDViewTypeProperty
public static final java.lang.String DTEDSlopeAdjustProperty
public static final java.lang.String DTEDBandHeightProperty
public static final java.lang.String DTEDMinScaleProperty
public static final java.lang.String DTEDKillCacheProperty
public static final java.lang.String DTEDFrameCacheSizeProperty
protected javax.swing.Box palette
Constructor Detail |
public DTEDLayer()
public DTEDLayer(java.lang.String[] pathsToDTEDDirs)
pathsToDTEDDirs
- paths to the DTED directories that hold
level 0 and 1 data.public DTEDLayer(java.lang.String[] pathsToDTEDDirs, java.lang.String[] pathsToDTED2Dirs)
pathsToDTEDDirs
- paths to the DTED directories that hold
level 0 and 1 data.pathsToDTED2Dirs
- paths to the DTED directories that hold
level 2 data.Method Detail |
public void setPaths(java.lang.String[] pathsToDTEDDirs, java.lang.String[] pathsToDTED2Dirs)
public java.lang.String[] getPaths()
public java.lang.String[] getLevel2Paths()
protected void setDefaultValues()
public void setGraphicList(OMGraphicList aList)
aList
- a list of OMGraphicspublic OMGraphicList getGraphicList()
public void setProperties(java.util.Properties properties)
setProperties
in interface PropertyConsumer
setProperties
in class Layer
properties
- the Properties
object.public void setProperties(java.lang.String prefix, java.util.Properties properties)
setProperties
in interface PropertyConsumer
setProperties
in class Layer
prefix
- the token to prefix the property namesproperties
- the Properties
objectpublic void removed(java.awt.Container cont)
removed
in class Layer
cont
- Containerpublic void setCancelled(boolean set)
public boolean isCancelled()
public void renderDataForProjection(Projection proj, java.awt.Graphics g)
renderDataForProjection
in interface ProjectionPainter
renderDataForProjection
in class Layer
proj
- Projection of the map.g
- java.awt.Graphics to draw into.public void projectionChanged(ProjectionEvent e)
projectionChanged
in interface ProjectionListener
e
- ProjectionEventprotected void workerComplete(com.bbn.openmap.layer.dted.DTEDLayer.DTEDWorker worker)
worker
- the worker that has the graphics.public void doPrepare()
public OMGraphicList prepare()
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.
public void paint(java.awt.Graphics g)
g
- the Graphics context for paintingpublic int getViewType()
0: DTEDFrameSubframe.NOSHADING 1: DTEDFrameSubframe.SLOPESHADING 2: DTEDFrameSubframe.COLOREDSHADING 3: DTEDFrameSubframe.METERSHADING 4: DTEDFrameSubframe.FEETSHADING
public void setViewType(int vt)
public int getBandHeight()
public void setBandHeight(int bh)
public int getSlopeAdjust()
public void setSlopeAdjust(int sa)
public int getDtedLevel()
public void setDtedLevel(int level)
public int getOpaqueness()
public void setOpaqueness(int o)
public boolean getKillCache()
public void setKillCache(boolean kc)
public int getCacheSize()
public void setCacheSize(int cs)
public int getNumColors()
public void setNumColors(int nc)
public java.awt.Component getGUI()
getGUI
in class Layer
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
actionPerformed
in class Layer
public MapMouseListener getMapMouseListener()
Layer
public MapMouseListener getMapMouseListener() {
return this;
}
public String[] getMouseModeServiceList() {
return new String[] { SelectMouseMode.modeID };
}
getMapMouseListener
in class Layer
public java.lang.String[] getMouseModeServiceList()
MapMouseListener
return new String[] { SelectMouseMode.modeID };
- Specified by:
getMouseModeServiceList
in interface MapMouseListener
- Returns:
- String[] of modeID's
- See Also:
NavMouseMode.modeID
,
SelectMouseMode.modeID
,
NullMouseMode.modeID
public boolean mousePressed(java.awt.event.MouseEvent e)
MapMouseListener
mousePressed
in interface MapMouseListener
e
- MouseEvent
public boolean mouseReleased(java.awt.event.MouseEvent e)
MapMouseListener
mouseReleased
in interface MapMouseListener
e
- MouseEvent
public boolean mouseClicked(java.awt.event.MouseEvent e)
MapMouseListener
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.
NOTE: We have noticed that this method can sometimes be
erroneously invoked. It seems to occur when a light-weight AWT
component (like an internal window or menu) closes (removes
itself from the window hierarchy). A specific OpenMap example
is when you make a menu selection when the MenuItem you select
is above the MapBean canvas. After making the selection, the
mouseClicked() gets invoked on the MouseDelegator, which passes
it to the appropriate listeners depending on the MouseMode. The
best way to avoid this problem is to not implement anything
crucial in this method. Use a combination of
mousePressed()
and mouseReleased()
instead.
mouseClicked
in interface MapMouseListener
e
- MouseEvent
public void mouseEntered(java.awt.event.MouseEvent e)
MapMouseListener
mouseEntered
in interface MapMouseListener
e
- MouseEventpublic void mouseExited(java.awt.event.MouseEvent e)
MapMouseListener
mouseExited
in interface MapMouseListener
e
- MouseEventpublic boolean mouseDragged(java.awt.event.MouseEvent e)
MapMouseListener
mouseDragged
in interface MapMouseListener
e
- MouseEvent
public boolean mouseMoved(java.awt.event.MouseEvent e)
MapMouseListener
mouseMoved
in interface MapMouseListener
e
- MouseEvent
public void mouseMoved()
MapMouseListener
mouseMoved
in interface MapMouseListener
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |