DTEDFrameCacheHandler (OpenMap API)
Date: 2016-12-09

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.dataAccess.dted
Class DTEDFrameCacheHandler

    java.lang.Object
      com.bbn.openmap.util.cacheHandler.CacheHandler
          com.bbn.openmap.dataAccess.dted.DTEDFrameCacheHandler

All Implemented Interfaces:
  DTEDConstants, PropertyConsumer, java.beans.PropertyChangeListener, java.util.EventListener

    public class DTEDFrameCacheHandler

extends CacheHandler
implements DTEDConstants, PropertyConsumer, java.beans.PropertyChangeListener

The DTEDFrameCacheHandler is a cache for objects being rendered on the map as a result of reading in DTED data. It communicates with a DTEDFrameCache to get OMGrid data from the actual DTED data files, and then sets OMGridGenerators on those OMGrids to create representations of the DTED.

The DTEDFrameCacheHandler uses GeneratorLoaders to create OMGridGenerators for its OMGrids. The GeneratorLoaders provide a GUI for controlling those OMGridGenerator parameters. The list of GeneratorLoaders can be set via Properties. In general, properties being set for a DTEDFrameCacheHandler:

        markerName.generators=greys colors
        markerName.greys.class=com.bbn.openmap.omGraphics.grid.SlopeGeneratorLoader
        markerName.greys.prettyName=Slope Shading
        markerName.greys.colorsClass=com.bbn.openmap.omGraphics.grid.GreyscaleSlopeColors
        markerName.colors.class=com.bbn.openmap.omGraphics.grid.SlopeGeneratorLoader
        markerName.colors.prettyName=Elevation Shading
        markerName.colors.colorsClass=com.bbn.openmap.omGraphics.grid.ColoredShadingColors

The only properties that are required for the DTEDFrameCacheHandler are the generators property, and then the .class properties for the generator loader class names. All of the other generator loader properties are sent to the generator loader for interpretation.

The markerName is generally provided by the parent component of the DTEDFrameCacheHandler, like the DTEDFrameCacheLayer.

Field Summary
`protected GeneratorLoader` | `activeGeneratorLoader` The active GeneratorLoader providing OMGridGenerators to the OMGrids.
`protected int` | `dtedLevel`
`protected boolean` | `firstImageReturned`
`protected DTEDFrameCache` | `frameCache` The real frame cache.
`protected double` | `frameDown`
`protected double` | `frameLat`
`protected double` | `frameLeft`
`protected double` | `frameLon`
`protected double` | `frameRight`
`protected double` | `frameUp`
`protected java.util.List<GeneratorLoader>` | `generatorLoaders` The list of GeneratorLoaders.
`static java.lang.String` | `GeneratorLoadersProperty`
`protected boolean` | `newframe`
`protected java.lang.String` | `propertyPrefix` Token uniquely identifying this component in the application properties.

Fields inherited from class com.bbn.openmap.util.cacheHandler.CacheHandler
`DEFAULT_MAX_CACHE_SIZE, logger, logicalClock, objs`

Fields inherited from interface com.bbn.openmap.dataAccess.dted.DTEDConstants
`BANDSHADING, BOUNDARYSHADING, COLOREDSHADING, DEFAULT_BANDHEIGHT, DEFAULT_SLOPE_ADJUST, LEVEL_0, LEVEL_1, LEVEL_2, NOSHADING, SLOPESHADING`

Fields inherited from interface com.bbn.openmap.PropertyConsumer
`EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty`

Constructor Summary
`protected` | `DTEDFrameCacheHandler()` The DTEDFrameCache must be set at some point.
`` | `DTEDFrameCacheHandler(DTEDFrameCache dfc)` Create a handler for the DTEDFrameCache.

Method Summary
`void` | `addGeneratorLoader(GeneratorLoader gl)`
`void` | `clearGeneratorLoaders()`
`OMGraphic` | `get(double lat, double lon, int level)` Return an OMGraphic for the Dted Frame, given A lat, lon and dted level.
`int` | `getDtedLevel()` Get the DTED level being retrieved from the DTEDFrameCache.
`int` | `getElevation(float lat, float lon)` Get an elevation at a point.
`DTEDFrameCache` | `getFrameCache()` Get the DTEDFrameCache.
`OMGridGenerator` | `getGenerator()` Get a new OMGridGenerator from the active GeneratorLoader.
`java.util.List<GeneratorLoader>` | `getGeneratorLoaders()`
`java.awt.Component` | `getGUI()` Get the GUI for the GeneratorLoaders.
`OMGraphic` | `getNextImage()` Returns the next OMGraphic image.
`java.util.Properties` | `getProperties(java.util.Properties props)` PropertyConsumer method, to fill in a Properties object, reflecting the current values of the OMComponent.
`java.util.Properties` | `getPropertyInfo(java.util.Properties list)` Method to fill in a Properties object with values reflecting the properties able to be set on this PropertyConsumer.
`java.lang.String` | `getPropertyPrefix()` Get the property key prefix that is being used to prepend to the property keys for Properties lookups.
`OMGraphicList` | `getRectangle(Projection proj)` The call to the cache that lets you choose what kind of information is returned.
`CacheObject` | `load(java.lang.Object key)` Called from get if the key doesn't exist, to "load" the new object into the cache before returning it.
`CacheObject` | `load(java.lang.String key, double lat, double lon, int level)` Load a dted frame into the cache, based on the path of the frame as a key.
`protected OMGraphicList` | `loadListFromHandler(OMGraphicList graphics)` Method that pings the cache for images based on the projection that has been set on it.
`void` | `propertyChange(java.beans.PropertyChangeEvent pce)` The DTEDFrameCacheHandler needs to sign up as a PropertyChangeListener so if anything on the GeneratorLoader GUI changes, it knows to dump the current representations so they can be rebuild with the current GUI settings.
`boolean` | `removeGeneratorLoader(GeneratorLoader gl)`
`void` | `setActiveGeneratorLoader(java.lang.String active)` Set the active GeneratorLoader based on a pretty name from one of the loaders.
`void` | `setDtedLevel(int level)` Set the DTED level to get from the DTEDFrameCache.
`void` | `setFrameCache(DTEDFrameCache dfc)` Set the DTEDFrameCache.
`void` | `setGeneratorLoaders(java.util.List<GeneratorLoader> generatorLoaders)`
`void` | `setProjection(Projection 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(Projection proj, double lat1, double lon1, double lat2, double 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` | `setProperties(java.util.Properties props)` Sets the properties for the OMComponent.
`void` | `setProperties(java.lang.String prefix, java.util.Properties props)` Sets the properties for the OMComponent.
`void` | `setPropertyPrefix(java.lang.String prefix)` Set the property key prefix that should be used by the PropertyConsumer.

Methods inherited from class com.bbn.openmap.util.cacheHandler.CacheHandler
`clear, get, getCacheSize, listIterator, replaceLeastUsed, resetCache, resetCache, searchCache`

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

Field Detail

### GeneratorLoadersProperty

    public static final java.lang.String GeneratorLoadersProperty

See Also:
  Constant Field Values

### frameCache

    protected DTEDFrameCache frameCache

  The real frame cache.

### frameUp

    protected double frameUp

### frameDown

    protected double frameDown

### frameLeft

    protected double frameLeft

### frameRight

    protected double frameRight

### firstImageReturned

    protected boolean firstImageReturned

### frameLon

    protected double frameLon

### frameLat

    protected double frameLat

### newframe

    protected boolean newframe

### dtedLevel

    protected int dtedLevel

### activeGeneratorLoader

    protected GeneratorLoader activeGeneratorLoader

  The active GeneratorLoader providing OMGridGenerators to the OMGrids.

### generatorLoaders

    protected java.util.List<GeneratorLoader> generatorLoaders

  The list of GeneratorLoaders.

### propertyPrefix

    protected java.lang.String propertyPrefix

  Token uniquely identifying this component in the application properties.

Constructor Detail

### DTEDFrameCacheHandler

    protected DTEDFrameCacheHandler()

  The DTEDFrameCache must be set at some point.

### DTEDFrameCacheHandler

    public DTEDFrameCacheHandler(DTEDFrameCache dfc)

  Create a handler for the DTEDFrameCache.

Method Detail

### setFrameCache

    public void setFrameCache(DTEDFrameCache dfc)

  Set the DTEDFrameCache.

### getFrameCache

    public DTEDFrameCache getFrameCache()

  Get the DTEDFrameCache.

### 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. DTED data is in meters.

### setDtedLevel

    public void setDtedLevel(int level)

  Set the DTED level to get from the DTEDFrameCache.

### getDtedLevel

    public int getDtedLevel()

  Get the DTED level being retrieved from the DTEDFrameCache.

### setActiveGeneratorLoader

    public void setActiveGeneratorLoader(java.lang.String active)

  Set the active GeneratorLoader based on a pretty name from one of the loaders.

### getGenerator

    public OMGridGenerator getGenerator()

  Get a new OMGridGenerator from the active GeneratorLoader.

### getGUI

    public java.awt.Component getGUI()

  Get the GUI for the GeneratorLoaders.

### 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.

### loadListFromHandler

    protected OMGraphicList loadListFromHandler(OMGraphicList graphics)

  Method that pings the cache for images based on the projection that has been set on it. If the cache returns null from getNextImage(), it's done. Method creates and returns a graphics list if the one passed in is null, otherwise it returns the one passed in.

### setProjection

    public void setProjection(Projection 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 projection of the screen.

### setProjection

    public void setProjection(Projection proj,
                              double lat1,
                              double lon1,
                              double lat2,
                              double 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 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 OMGraphic getNextImage()

  Returns the next OMGraphic 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:
    OMGraphic image.

### get

    public OMGraphic get(double lat,
                         double lon,
                         int level)

  Return an OMGraphic for the Dted Frame, given A lat, lon and dted level.

  Parameters:
    `lat` - latitude of point
    `lon` - longitude of point
    `level` - the dted level wanted (0, 1, 2)
  Returns:
    OMGraphic, most likely an OMGrid.

### load

    public CacheObject load(java.lang.String key,
                            double lat,
                            double lon,
                            int level)

  Load a dted frame into the cache, based on the path of the frame as a key. Implements abstract CacheHandler method.

  Parameters:
    `key` - key to remember raster created for DTED frame.
  Returns:
    DTED frame, hidden as a CacheObject.

### load

    public CacheObject load(java.lang.Object key)

  Description copied from class: `CacheHandler`
  Called from get if the key doesn't exist, to "load" the new object into the cache before returning it. This function should define how a CacheObject is created, or loaded from the file system, or whatever.

  Specified by:
    `load` in class `CacheHandler`

### setProperties

    public void setProperties(java.util.Properties props)

  Sets the properties for the OMComponent.

  Specified by:
    `setProperties` in interface `PropertyConsumer`
  Parameters:
    `props` - the `Properties` object.

### setProperties

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

  Sets the properties for the OMComponent.

  Specified by:
    `setProperties` in interface `PropertyConsumer`
  Parameters:
    `prefix` - the token to prefix the property names
    `props` - the `Properties` object

### getProperties

    public java.util.Properties getProperties(java.util.Properties props)

  PropertyConsumer method, to fill in a Properties object, reflecting the current values of the OMComponent. If the component has a propertyPrefix set, the property keys should have that prefix plus a separating '.' prepended to each property key it uses for configuration.

  Specified by:
    `getProperties` in interface `PropertyConsumer`
  Parameters:
    `props` - a Properties object to load the PropertyConsumer properties into. If props equals null, then a new Properties object should be created.
  Returns:
    Properties object containing PropertyConsumer property values. If getList was not null, this should equal getList. Otherwise, it should be the Properties object created by the PropertyConsumer.

### getPropertyInfo

    public java.util.Properties getPropertyInfo(java.util.Properties list)

  Method to fill in a Properties object with values reflecting the properties able to be set on this PropertyConsumer. The key for each property should be the raw property name (without a prefix) with a value that is a String that describes what the property key represents, along with any other information about the property that would be helpful (range, default value, etc.). For Layer, this method should at least return the 'prettyName' property.

  Specified by:
    `getPropertyInfo` in interface `PropertyConsumer`
  Parameters:
    `list` - a Properties object to load the PropertyConsumer properties into. If getList equals null, then a new Properties object should be created.
  Returns:
    Properties object containing PropertyConsumer property values. If getList was not null, this should equal getList. Otherwise, it should be the Properties object created by the PropertyConsumer.

### setPropertyPrefix

    public void setPropertyPrefix(java.lang.String prefix)

  Set the property key prefix that should be used by the PropertyConsumer. The prefix, along with a '.', should be prepended to the property keys known by the PropertyConsumer.

  Specified by:
    `setPropertyPrefix` in interface `PropertyConsumer`
  Parameters:
    `prefix` - the prefix String.

### getPropertyPrefix

    public java.lang.String getPropertyPrefix()

  Get the property key prefix that is being used to prepend to the property keys for Properties lookups.

  Specified by:
    `getPropertyPrefix` in interface `PropertyConsumer`
  Returns:
    the property prefix string

### propertyChange

    public void propertyChange(java.beans.PropertyChangeEvent pce)

  The DTEDFrameCacheHandler needs to sign up as a PropertyChangeListener so if anything on the GeneratorLoader GUI changes, it knows to dump the current representations so they can be rebuild with the current GUI settings.

  Specified by:
    `propertyChange` in interface `java.beans.PropertyChangeListener`

### getGeneratorLoaders

    public java.util.List<GeneratorLoader> getGeneratorLoaders()

### setGeneratorLoaders

    public void setGeneratorLoaders(java.util.List<GeneratorLoader> generatorLoaders)

### clearGeneratorLoaders

    public void clearGeneratorLoaders()

### addGeneratorLoader

    public void addGeneratorLoader(GeneratorLoader gl)

### removeGeneratorLoader

    public boolean removeGeneratorLoader(GeneratorLoader gl)

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