## com.bbn.openmap.layer.dted
Class DTEDCacheHandler

    java.lang.Object
      com.bbn.openmap.layer.dted.DTEDCacheHandler

public class DTEDCacheHandler
extends java.lang.Object

The DTEDCacheHandler controls the real cache of DTED frames. It is managed by the DTEDCacheManager, and the manager asks it for frames. The DTEDCacheHandler goes to its cache for the images, but it also manages the configuration of the frames, and figures out what frames are needed, given a projection.

Field Summary
`protected DTEDFrameColorTable` `colortable` The colors used by the frames to create the images.
`protected int` `currentFrameCacheSize`
`protected DTEDFrameSubframeInfo` `dfsi` A description of the drawing attributes of the images.
`protected boolean` `firstImageReturned`
`protected DTEDFrame` `frame`
`static int` `FRAME_CACHE_SIZE` Default frame cache size.
`protected DTEDFrameCache` `frameCache` The real frame cache.
`protected int` `frameCacheSize`
`protected double` `frameDown`
`protected double` `frameLat`
`protected double` `frameLeft`
`protected double` `frameLon`
`protected double` `frameRight`
`protected double` `frameUp`
`protected int` `lastSubframeHeight`
`protected int` `lastSubframeWidth`
`protected LatLonPoint` `lrCoords`
`protected boolean` `newframe`
`protected int` `numXSubframes`
`protected int` `numYSubframes`
`protected java.lang.String[]` `paths` The DTED level 0, 1 directory paths.
`protected java.lang.String[]` `paths2` The DTED level 2 directory paths.
`static int` `SF_PIXEL_HW` Subframe pixel height and width.
`protected int` `subx`
`protected int` `suby`
`protected LatLonPoint` `ulCoords`
`protected double` `xPixInterval`
`protected double` `yPixInterval`

Constructor Summary
`DTEDCacheHandler()`
`DTEDCacheHandler(java.lang.String[] dataPaths, int numColors, int opaque)`
`DTEDCacheHandler(java.lang.String[] dataPaths, int numColors, int opaqueness, int subframe_cache_size)`
`DTEDCacheHandler(java.lang.String[] dataPaths, java.lang.String[] data2Paths, int numColors, int opaque)`
`DTEDCacheHandler(java.lang.String[] dataPaths, java.lang.String[] data2Paths, int numColors, int opaqueness, int subframe_cache_size)`

Method Summary
`int` `getElevation(float lat, float lon)` Get an elevation at a point.
`int` `getFrameCacheSize()` Get the limit imposed on the number of frames used in the cache.
`OMRaster` `getNextImage()` Returns the next OMRaster image.
`void` `setFrameCacheSize(int size)` Normally, the cache grows and shrinks as appropriate according to the number of frames needed to cover the screen.
`void` `setProjection(EqualArc proj)` The method to call to let the cache handler know what the projection looks like so it can figure out which frames (and subframes) will be needed.
`void` `setProjection(EqualArc proj, float lat1, float lon1, float lat2, float lon2)` The method to call to let the cache handler know what the projection looks like so it can figure out which frames (and subframes) will be needed.
`void` `setSubframeInfo(DTEDFrameSubframeInfo new_dfsi)` Setting the subframe attributes.

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

Field Detail

### FRAME_CACHE_SIZE

    public static final int FRAME_CACHE_SIZE

  Default frame cache size.

  See Also:
    Constant Field Values

### SF_PIXEL_HW

    public static final int SF_PIXEL_HW

  Subframe pixel height and width.

  See Also:
    Constant Field Values

### paths

    protected java.lang.String[] paths

  The DTED level 0, 1 directory paths.

### paths2

    protected java.lang.String[] paths2

  The DTED level 2 directory paths.

### frameCache

    protected DTEDFrameCache frameCache

  The real frame cache.

### frameCacheSize

    protected int frameCacheSize

### colortable

    protected DTEDFrameColorTable colortable

  The colors used by the frames to create the images.

### ulCoords

    protected LatLonPoint ulCoords

### lrCoords

    protected LatLonPoint lrCoords

### frameUp

    protected double frameUp

### frameDown

    protected double frameDown

### frameLeft

    protected double frameLeft

### frameRight

    protected double frameRight

### xPixInterval

    protected double xPixInterval

### yPixInterval

    protected double yPixInterval

### numXSubframes

    protected int numXSubframes

### numYSubframes

    protected int numYSubframes

### lastSubframeWidth

    protected int lastSubframeWidth

### lastSubframeHeight

    protected int lastSubframeHeight

### currentFrameCacheSize

    protected int currentFrameCacheSize

### firstImageReturned

    protected boolean firstImageReturned

### frameLon

    protected double frameLon

### frameLat

    protected double frameLat

### subx

    protected int subx

### suby

    protected int suby

### newframe

    protected boolean newframe

### frame

    protected DTEDFrame frame

### dfsi

    protected DTEDFrameSubframeInfo dfsi

  A description of the drawing attributes of the images.

Constructor Detail

### DTEDCacheHandler

    public DTEDCacheHandler()

### DTEDCacheHandler

    public DTEDCacheHandler(java.lang.String[] dataPaths,
                            int numColors,
                            int opaque)

### DTEDCacheHandler

    public DTEDCacheHandler(java.lang.String[] dataPaths,
                            java.lang.String[] data2Paths,
                            int numColors,
                            int opaque)

### DTEDCacheHandler

    public DTEDCacheHandler(java.lang.String[] dataPaths,
                            int numColors,
                            int opaqueness,
                            int subframe_cache_size)

### DTEDCacheHandler

    public DTEDCacheHandler(java.lang.String[] dataPaths,
                            java.lang.String[] data2Paths,
                            int numColors,
                            int opaqueness,
                            int subframe_cache_size)

Method Detail

### setFrameCacheSize

    public void setFrameCacheSize(int size)

  Normally, the cache grows and shrinks as appropriate according to the number of frames needed to cover the screen. If you want to limit the size it can grow, set the size. If it's negative, then there will be no limit.

### getFrameCacheSize

    public int getFrameCacheSize()

  Get the limit imposed on the number of frames used in the cache.

### getElevation

    public int getElevation(float lat,
                            float lon)

  Get an elevation at a point. Always uses the cache to load the frame and get the data.

### setSubframeInfo

    public void setSubframeInfo(DTEDFrameSubframeInfo new_dfsi)

  Setting the subframe attributes.

### setProjection

    public void setProjection(EqualArc proj)

  The method to call to let the cache handler know what the projection looks like so it can figure out which frames (and subframes) will be needed.

  Parameters:
    `proj` - the EqualArc projection of the screen.

### setProjection

    public void setProjection(EqualArc proj,
                              float lat1,
                              float lon1,
                              float lat2,
                              float lon2)

  The method to call to let the cache handler know what the projection looks like so it can figure out which frames (and subframes) will be needed. Should be called when the CacheHandler is dealing with just a part of the map, such as when the map covers the dateline or equator.

  Parameters:
    `proj` - the EqualArc projection of the screen.
    `lat1` - latitude of the upper left corner of the window, in decimal degrees.
    `lon1` - longitude of the upper left corner of the window, in decimal degrees.
    `lat2` - latitude of the lower right corner of the window, in decimal degrees.
    `lon2` - longitude of the lower right corner of the window, in decimal degrees.

### getNextImage

    public OMRaster getNextImage()

  Returns the next OMRaster image. When setProjection() is called, the cache sets the projection parameters it needs, and also resets this popping mechanism. When this mechanism is reset, you can keep calling this method to get another subframe image. When it returns a null value, it is done. It will automatically skip over window frames it doesn't have, and return the next one it does have. It traverses from the top left to right frames, and top to bottom for each column of frames. It handles all the subframes for a frame at one time.

  Returns:
    OMRaster image.

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