## com.bbn.openmap.layer.rpf
Class RpfCacheManager

    java.lang.Object
      com.bbn.openmap.layer.rpf.RpfCacheManager

All Implemented Interfaces:
  java.io.Serializable

public class RpfCacheManager
extends java.lang.Object
implements java.io.Serializable

The RpfCacheManager is the object you need if you want to retrieve RPF files. You set it up with a RpfFrameProvider, and it gives that provider to the RpfCacheHandler it creates. The RpfCacheManager then handles working with the RpfCacheHandlers to get subframes to display.

RPF data comes with a Table of Contents, which sits at the root of the RPF file system structure and contains information about the frame files. When the RpfFrameProvider gets created, it creates an array of RpfTocHandlers. These Table of Contents readers know how to take a geographic area and figure out which frames and subframes are needed to put on the screen. An array of RpfTocHandlers are needed in case there are many places where there is RPF data.

The RpfCacheManager also manages objects called RpfCacheHandlers. Cache handlers take the information from a frame provider, and create a subframe cache for that zone and map type. 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 RpfCacheManager 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. The getRectangle() call returns an OMGraphicList of objects to draw, that cover the area asked for.

See Also:
  Serialized Form

Nested Class Summary
`class` `RpfCacheManager.RpfMaps`

Field Summary
`protected int` `auxCacheSize` The size of the aux caches, which are used when the map crosses the equator or dateline.
`protected RpfCacheHandler[]` `caches` The cache handlers needed to cover the screen.
`protected RpfFrameProvider` `frameProvider` The place to look for for image data.
`protected RpfCacheManager.RpfMaps` `graphics` A specialized OMGraphicList to handle the maps and info, and switching either/or on/off.
`static int` `MAX_NUM_BOXES` A box is a earth quadrant.
`static int` `SMALL_CACHE_SIZE` The size of the smaller caches, when more cachehandlers are needed to cover the equator and the dateline.
`protected RpfViewAttributes` `viewAttributes` Contains information about displaying the RPF data.

Constructor Summary
`RpfCacheManager()`
`RpfCacheManager(RpfFrameProvider fp)` Constructor that lets you set the RPF frame provider
`RpfCacheManager(RpfFrameProvider rfp, RpfViewAttributes rva)` Constructor that lets you set the RPF frame provider, the view attributes and the subframe cache size.
`RpfCacheManager(RpfFrameProvider rfp, RpfViewAttributes rva, int mainCacheSize, int auxSubframeCacheSize)` Constructor that lets you set the RPF frame provider, the view attributes and the subframe cache sizes.

Method Summary
`void` `clearCaches()` Reset the caches in the RpfCacheHandlers.
`java.util.Vector` `getCoverageBoxes()` Returns the Vector containing RpfCoverageBoxes from the primary RpfCacheHandler.
`RpfFrameProvider` `getFrameProvider()` Return RpfFrameProvider used by the layer.
`OMGraphicList` `getRectangle(Projection proj)` The call to the cache that lets you choose what kind of information is returned.
`protected OMGraphic` `getSubframes()` Creates the OMGraphicList by cycling through the caches, getting the images and attribute infomation.
`RpfViewAttributes` `getViewAttributes()` Get the view attributes or the layer.
`void` `setFrameProvider(RpfFrameProvider fp)` Set the RpfFrameProvider for the layer.
`void` `setViewAttributes(RpfViewAttributes rva)` Set the view attributes for the layer.

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. Lowered from 20 to try to conserve memory.

  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 RpfCacheHandler[] caches

  The cache handlers needed to cover the screen. Need one for each earth quadrant, and for each RPF directory, in case coverage is spread out over different sources.

### frameProvider

    protected RpfFrameProvider frameProvider

  The place to look for for image data.

### viewAttributes

    protected RpfViewAttributes viewAttributes

  Contains information about displaying the RPF data. Also passed to the RpfTocHandlers to determine chart selection.

  See Also:
    `RpfViewAttributes`

### graphics

    protected RpfCacheManager.RpfMaps graphics

  A specialized OMGraphicList to handle the maps and info, and switching either/or on/off.

### auxCacheSize

    protected int auxCacheSize

  The size of the aux caches, which are used when the map crosses the equator or dateline.

Constructor Detail

### RpfCacheManager

    public RpfCacheManager()

### RpfCacheManager

    public RpfCacheManager(RpfFrameProvider fp)

  Constructor that lets you set the RPF frame provider

Parameters:
  `fp` - the object supplying the data.

### RpfCacheManager

    public RpfCacheManager(RpfFrameProvider rfp,
                           RpfViewAttributes rva)

  Constructor that lets you set the RPF frame provider, the view attributes and the subframe cache size.

Parameters:
  `rfp` - the object supplying the data.
  `rva` - the view attributes for the images.

### RpfCacheManager

    public RpfCacheManager(RpfFrameProvider rfp,
                           RpfViewAttributes rva,
                           int mainCacheSize,
                           int auxSubframeCacheSize)

  Constructor that lets you set the RPF frame provider, the view attributes and the subframe cache sizes.

Parameters:
  `rfp` - the object supplying the data.
  `rva` - the view attributes for the images.
  `mainCacheSize` - the number of subframes held in the large main cache.
  `auxSubframeCacheSize` - the number of subframes held in the aux caches.

Method Detail

### clearCaches

    public void clearCaches()

  Reset the caches in the RpfCacheHandlers.

### setViewAttributes

    public void setViewAttributes(RpfViewAttributes rva)

  Set the view attributes for the layer. The frame provider view attributes are updated, and the cache is cleared.

  Parameters:
    `rva` - the RpfViewAttributes used for the layer.

### getViewAttributes

    public RpfViewAttributes getViewAttributes()

  Get the view attributes or the layer.

  Returns:
    RpfViewAttributes.

### setFrameProvider

    public void setFrameProvider(RpfFrameProvider fp)

  Set the RpfFrameProvider for the layer. Clears out the cache, and the frame provider gets the RpfViewAttributes held by the layer.

  Parameters:
    `fp` - the frame provider.

### getFrameProvider

    public RpfFrameProvider getFrameProvider()

  Return RpfFrameProvider used by the layer.

### getCoverageBoxes

    public java.util.Vector getCoverageBoxes()

  Returns the Vector containing RpfCoverageBoxes from the primary RpfCacheHandler. The Vector is the same that was returned to the cache handler from the RpfFrameProvider as a result of the last setCache call. These provide rudimentary knowledge about what is being displayed.

  Returns:
    Vector of RpfCoverageBoxes.

### 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. The CADRG projection held inside the view attributes, used by the RpfTocHandlers, is set here. If the projection passed in is not CADRG, and the caller doesn't care, then a new CADRG projection is created.

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

### getSubframes

    protected OMGraphic getSubframes()

  Creates the OMGraphicList by cycling through the caches, getting the images and attribute infomation.

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