## com.bbn.openmap.dataAccess.asrp
Class ASRPDirectory

    java.lang.Object
      com.bbn.openmap.layer.util.cacheHandler.CacheHandler
          com.bbn.openmap.dataAccess.asrp.ASRPDirectory

All Implemented Interfaces:
  ASRPConstants

public class ASRPDirectory
extends CacheHandler
implements ASRPConstants

An ASRP directory contains information needed to view images. It contains multiple files, each containing complementary information about the image. The GeneralInformationFile (GEN) contains information about the image such as coverage and location. The QualityFile (QAL) contains accuracy and color information. The GeoReferenceFile (GER) contains projection information, the SourceFile (SOU) contains information about the map that was used to create the images. The RasterGeoDataFile (IMG) contains the actual pixel information.

This class knows how to use all of these files to create images, which are made up of subframe tiles called blocks.

Field Summary
`protected int` `arv` Number of pixels 360 degrees east - west.
`protected OMRect` `bounds` The OMRect used to track coverage boundaries.
`protected int` `brv` Number of pixels 360 degrees north - south.
`protected java.awt.Color[]` `colors` The colors from the QAL file.
`protected float` `degPerHorBlock` Calculated number of degrees per block in the horizontal direction.
`protected float` `degPerVerBlock` Calculated number of degrees per block in the vertical direction.
`protected java.io.File` `dir`
`protected GeneralInformationFile` `gen`
`protected GeoReferenceFile` `ger`
`protected RasterGeoDataFile` `img`
`protected float` `lso`
`protected float` `nea`
`protected float` `neo`
`protected int` `numHorBlocks_N` Number of horizontal blocks.
`protected int` `numHorPixels_Q` Number of horizontal pixels per block.
`protected int` `numVerBlocks_M` Number of vertical blocks.
`protected int` `numVerPixels_P` Number of vertical pixels per block.
`protected int` `pixelCountBits` When reading image bytes, the number of bits that represent the number of pixels the next color index stands for.
`protected int` `pixelValueBits` When reading image bytes, the number of bits that represent the color index.
`protected float` `pso`
`protected QualityFile` `qal`
`protected double` `scaleFactor` Protective mechanism, doesn't display data that has images with a base scale that is more than a factor of the scaleFactor away from the scale of the map.
`protected SourceFile` `sou`
`protected float` `swa`
`protected float` `swo`
`protected int` `tileDataOffset` Byte offset into the IMG file where tile data starts.
`protected java.util.List` `tsi` List of tile indexes.

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

Fields inherited from interface com.bbn.openmap.dataAccess.asrp.ASRPConstants
`GEN_NAME, GER_NAME, IMAGE_NAME, QAL_NAME, SOURCE_NAME, TRANS`

Constructor Summary
`ASRPDirectory(java.lang.String path)` Create a new ASRP directory for the given path.

Method Summary
`OMGraphicList` `checkProjAndGetTiledImages(Projection proj)` Get an OMGraphicList of files that cover the projection.
`OMScalingRaster` `getBlock(int x, int y)` Fetch the subframe tile block from the IMG file.
`OMRect` `getBounds()` Get the OMRect used for calculating coverage area.
`protected java.awt.Color[]` `getColors()` Get the colors from the QAL file.
`java.lang.String` `getPath()`
`double` `getScaleFactor()`
`OMGraphicList` `getTiledImages(Projection proj)` Assumes that the projection checks have occured, have passed, and just fetches the image tiles.
`protected OMGraphicList` `getTiledImages(java.awt.Rectangle rect, Projection proj)` Provide an OMGraphicList containing the tile blocks described by the rectangle.
`protected void` `initialize(java.lang.String dirPath, java.lang.String root, java.lang.String DD)` Read in the attribute information about the data.
`boolean` `isOnMap(Projection proj)` Return true of current bounds covers the projection area.
`CacheObject` `load(java.lang.String xAndY)` Load a block image into the cache, based on the relative coordintes of the block as a key.
`static void` `main(java.lang.String[] argv)`
`void` `setScaleFactor(double scaleFactorIn)`
`boolean` `validScale(Projection proj)`

Methods inherited from class com.bbn.openmap.layer.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

### gen

    protected GeneralInformationFile gen

### qal

    protected QualityFile qal

### img

    protected RasterGeoDataFile img

### ger

    protected GeoReferenceFile ger

### sou

    protected SourceFile sou

### tsi

    protected java.util.List tsi

  List of tile indexes.

### numHorBlocks_N

    protected int numHorBlocks_N

  Number of horizontal blocks.

### numVerBlocks_M

    protected int numVerBlocks_M

  Number of vertical blocks.

### numHorPixels_Q

    protected int numHorPixels_Q

  Number of horizontal pixels per block.

### numVerPixels_P

    protected int numVerPixels_P

  Number of vertical pixels per block.

### pixelCountBits

    protected int pixelCountBits

  When reading image bytes, the number of bits that represent the number of pixels the next color index stands for.

### pixelValueBits

    protected int pixelValueBits

  When reading image bytes, the number of bits that represent the color index.

### swo

    protected float swo

### nea

    protected float nea

### neo

    protected float neo

### swa

    protected float swa

### lso

    protected float lso

### pso

    protected float pso

### arv

    protected int arv

  Number of pixels 360 degrees east - west.

### brv

    protected int brv

  Number of pixels 360 degrees north - south.

### degPerHorBlock

    protected float degPerHorBlock

  Calculated number of degrees per block in the horizontal direction.

### degPerVerBlock

    protected float degPerVerBlock

  Calculated number of degrees per block in the vertical direction.

### tileDataOffset

    protected int tileDataOffset

  Byte offset into the IMG file where tile data starts.

### colors

    protected java.awt.Color[] colors

  The colors from the QAL file.

### bounds

    protected OMRect bounds

  The OMRect used to track coverage boundaries.

### dir

    protected java.io.File dir

### scaleFactor

    protected double scaleFactor

  Protective mechanism, doesn't display data that has images with a base scale that is more than a factor of the scaleFactor away from the scale of the map.

Constructor Detail

### ASRPDirectory

    public ASRPDirectory(java.lang.String path)

  Create a new ASRP directory for the given path. Calls initialize() which will read in the different files to find out the attribute information about the data.

Method Detail

### getPath

    public java.lang.String getPath()

### getBounds

    public OMRect getBounds()

  Get the OMRect used for calculating coverage area.

### setScaleFactor

    public void setScaleFactor(double scaleFactorIn)

### getScaleFactor

    public double getScaleFactor()

### isOnMap

    public boolean isOnMap(Projection proj)

  Return true of current bounds covers the projection area.

### validScale

    public boolean validScale(Projection proj)

### checkProjAndGetTiledImages

    public OMGraphicList checkProjAndGetTiledImages(Projection proj)
                                             throws java.io.IOException

  Get an OMGraphicList of files that cover the projection. Returns an empty list if the coverage isn't over the map.

  Throws:
    `java.io.IOException`

### getTiledImages

    public OMGraphicList getTiledImages(Projection proj)
                                 throws java.io.IOException

  Assumes that the projection checks have occured, have passed, and just fetches the image tiles.

  Throws:
    `java.io.IOException`

### getTiledImages

    protected OMGraphicList getTiledImages(java.awt.Rectangle rect,
                                           Projection proj)
                                    throws java.io.IOException

  Provide an OMGraphicList containing the tile blocks described by the rectangle.

  Parameters:
    `rect` - rectangle defining the tile blocks to get. rect.x and rect.y describe the starting upper left block to get, rect.getWidth and rect.getHeight describe the number of tiles to the right and down from the first block to collect.
  Throws:
    `java.io.IOException`

### getBlock

    public OMScalingRaster getBlock(int x,
                                    int y)
                             throws java.io.IOException

  Fetch the subframe tile block from the IMG file.

  Throws:
    `java.io.IOException`

### getColors

    protected java.awt.Color[] getColors()

  Get the colors from the QAL file.

### initialize

    protected void initialize(java.lang.String dirPath,
                              java.lang.String root,
                              java.lang.String DD)
                       throws java.io.IOException

  Read in the attribute information about the data.

  Parameters:
    `dirPath` - path to the ASRP directory.
    `root` - name of all of the files, usually the same as the ASRP directory itself.
    `DD` - the occurance number, usually '01' of the files.
  Throws:
    `java.io.IOException`

### load

    public CacheObject load(java.lang.String xAndY)

  Load a block image into the cache, based on the relative coordintes of the block as a key.

  Specified by:
    `load` in class `CacheHandler`
  Parameters:
    `xAndY` - String of form 'x,y' identifying the relative location of the subframe image.
  Returns:
    Block image, hidden as a CacheObject.

### main

    public static void main(java.lang.String[] argv)

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