com.bbn.openmap.layer.dted
Class DTEDCacheManager

java.lang.Object
  extended by com.bbn.openmap.layer.dted.DTEDCacheManager

public class DTEDCacheManager
extends java.lang.Object

The DTEDCacheManager is the object you need if you want to retrieve DTED files en masse for display. You set it up with the paths to the files, and then ask it for an OMGraphicList that contains the frames for a geographical area.

The DTEDCacheManager also manages objects called DTEDCacheHandlers. Cache handlers have their own set of frames, figure out which frames are needed to fill the screen, and ask each frame for the rasters (subframes). The situation gets pretty tricky when the screen has the equator and/or the dateline on it, and a different cache handler is needed for each quadrant of the earth. This situation is relatively rare, though, and the DTEDCacheManager automatically checks for these situations and creates the cache handlers needed.

There are two calls to the Cache that you need to use. The constructor sets up the cache with the location of the data on your system. The getRectangle() call returns an OMGraphicList of objects to draw, that cover the area asked for.


Field Summary
protected  DTEDCacheHandler[] caches
          The cache handlers needed to cover the screen.
protected  int cacheSize
           
protected  java.lang.String[] dtedDirPaths
           
static int MAX_NUM_BOXES
          A box is a earth quadrant.
protected  int numColors
           
protected  int opaqueness
           
static int SMALL_CACHE_SIZE
          The size of the smaller caches, when more cachehandlers are needed to cover the equator and the dateline.
protected  DTEDFrameSubframeInfo subframeInfo
           
 
Constructor Summary
DTEDCacheManager()
          Constructor that uses the default paths and the default number of colors.
DTEDCacheManager(java.lang.String[] DTEDPaths)
          Constructor that lets you set the paths of the DTED directories, where the data is located.
DTEDCacheManager(java.lang.String[] DTEDPaths, int num_colors, int opaque)
          Constructor that lets you set the paths of the DTED directories, where the data is located, as well as the number of colors you want used in the graphics.
 
Method Summary
 DTEDCacheHandler[] getCaches()
          The DTEDCacheManager uses four DTEDCacheHandlers to create frame from DTED files.
 int getCacheSize()
          Get the number of frames that the caches should contain.
 int getElevation(float lat, float lon)
          Get an elevation at a point.
 int getNumColors()
           
 int getOpaqueness()
           
 OMGraphicList getRectangle(Projection proj)
          The call to the cache that lets you choose what kind of information is returned.
 DTEDFrameSubframeInfo getSubframeInfo()
           
 void resetCaches()
          Reset the DTEDCacheHandler array so the handlers will get created on the next frame request.
 void setCacheSize(int size)
          Set the number of frames that the caches should contain.
 void setDtedDirPaths(java.lang.String[] paths)
          Used to set the DTED directory paths.
 void setNumColors(int numberOfColors)
           
 void setOpaqueness(int setting)
           
 void setSubframeInfo(DTEDFrameSubframeInfo dfsi)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SMALL_CACHE_SIZE

public static final int SMALL_CACHE_SIZE
The size of the smaller caches, when more cachehandlers are needed to cover the equator and the dateline.

See Also:
Constant Field Values

MAX_NUM_BOXES

public static final int MAX_NUM_BOXES
A box is a earth quadrant.

See Also:
Constant Field Values

caches

protected DTEDCacheHandler[] caches
The cache handlers needed to cover the screen. Need one for each earth quadrant, and for each DTED directory, in case coverage is spread out over different sources.


subframeInfo

protected DTEDFrameSubframeInfo subframeInfo

dtedDirPaths

protected java.lang.String[] dtedDirPaths

numColors

protected int numColors

opaqueness

protected int opaqueness

cacheSize

protected int cacheSize
Constructor Detail

DTEDCacheManager

public DTEDCacheManager()
Constructor that uses the default paths and the default number of colors.


DTEDCacheManager

public DTEDCacheManager(java.lang.String[] DTEDPaths)
Constructor that lets you set the paths of the DTED directories, where the data is located.

Parameters:
DTEDPaths - pathnames to the DTED directories.

DTEDCacheManager

public DTEDCacheManager(java.lang.String[] DTEDPaths,
                        int num_colors,
                        int opaque)
Constructor that lets you set the paths of the DTED directories, where the data is located, as well as the number of colors you want used in the graphics.

Parameters:
DTEDPaths - pathnames to the DTED level 0 and 1 directories.
num_colors - number of colors to be used in the graphics.
opaque - the opaqueness of the dted images, 0 - 255 (0 is clear)
Method Detail

setDtedDirPaths

public void setDtedDirPaths(java.lang.String[] paths)
Used to set the DTED directory paths.

Parameters:
paths - DTED Level 0 and 1 directory paths.

resetCaches

public void resetCaches()
Reset the DTEDCacheHandler array so the handlers will get created on the next frame request.


setCacheSize

public void setCacheSize(int size)
Set the number of frames that the caches should contain. If negative or zero, the cache calculates the cache size based on the projection.


getCacheSize

public int getCacheSize()
Get the number of frames that the caches should contain. If negative or zero, the cache is calculating the cache size based on the projection.


getElevation

public int getElevation(float lat,
                        float lon)
Get an elevation at a point. Always uses the main cache to load the frame and get the data.

Parameters:
lat - latitude of point in decimal degrees.
lon - longitude of point in decimal degrees.

setSubframeInfo

public void setSubframeInfo(DTEDFrameSubframeInfo dfsi)

getSubframeInfo

public DTEDFrameSubframeInfo getSubframeInfo()

getRectangle

public OMGraphicList getRectangle(Projection proj)
The call to the cache that lets you choose what kind of information is returned. This function also figures out what part of the earth is covered on the screen, and creates auxillary cache handlers as needed.

Parameters:
proj - The projection of the screen (CADRG).
Returns:
List of rasters to display.

setNumColors

public void setNumColors(int numberOfColors)

getNumColors

public int getNumColors()

setOpaqueness

public void setOpaqueness(int setting)

getOpaqueness

public int getOpaqueness()

getCaches

public DTEDCacheHandler[] getCaches()
The DTEDCacheManager uses four DTEDCacheHandlers to create frame from DTED files. The one at postion 0 is the main one. The one at index 1 is used when the map cross the equator. The other two are used when the map crosses the dateline.

Returns:
gets the array of DTEDCacheHandlers.


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