com.bbn.openmap.layer.rpf
Class RpfColortable

java.lang.Object
  extended by com.bbn.openmap.layer.rpf.RpfColortable

public class RpfColortable
extends java.lang.Object

Set up the colors used in creating the images. They are created from RGB value arrays read in from the RPF file. If the number of colors that are allowed is less than 216, then the RpfColortable looks inside the RpfFile and uses the color conversion tables inside. There will still be 216 color indexes, but some of the colors will be duplicates.


Nested Class Summary
static class RpfColortable.ColorConversionTable
           
static class RpfColortable.ColorOffset
           
 
Field Summary
static int CADRG_COLORS
           
protected  boolean Cib
           
static int CIB_SPEC_CODE_ID
           
 int[] colorConvTable
          Color conversion table (to be filled) from within frame, colortable section.
 java.awt.Color[] colors
          The actual OMColors to use in the image construction.
static int COLORS_16
           
static int COLORS_216
           
static int COLORS_32
           
static int DEFAULT_OPAQUENESS
           
protected  int entryNumber
          The index of the RpfEntry in the A.TOC file being used for the current colors.
protected  int numColors
           
protected  int opaqueness
           
protected  int reducedColorTable
          Index to use a color conversion table, and if so, which one.
 java.lang.String seriesCode
          Chart Series Code for these colors.
protected  int tocNumber
          The index of the A.TOC file in the RpfTocHandler being used for the current colors.
 char zone
          Zone ID for these colors.
 
Constructor Summary
RpfColortable()
           
RpfColortable(int nColors)
           
RpfColortable(int nColors, int opaque, boolean cib)
           
 
Method Summary
 int getColorTableReduction()
          Returns the color reduction index.
 int getEntryNumber()
          Not really used, but someone might need them.
 int getNumColors()
          Returns the number of colors.
 int getOpaqueness()
           
 int getOpaquePercent()
           
 int getTocNumber()
          Not really used, but someone might need them.
 boolean isCib()
           
 boolean isSameATOCIndexes(int tocIndex, int entryIndex)
          Return true of the toc index and entry index are the same as what the colortable is currently holding.
static void main(java.lang.String[] args)
           
 java.awt.Color[] parseColorLookUpTable(BinaryFile binFile, RpfFileSections.RpfLocationRecord[] loc)
          The method to call to read in the colortable from within the RPF file.
 void setATOCIndexes(int tocIndex, int entryIndex)
          Should be set when a new colortable is read in, so that you can tell when you don't have to read a new one.
 void setCib(boolean value)
          If this object is going to provide colors for CIB imagery, you have to let this object know that.
 void setFrom(RpfColortable colortable)
          Load the provided colortable with the color values of this colortable.
 void setNumColors(int numColorsValue)
           
 void setOpaqueness(int value)
          Set the alpha values of the OMColors, which governs the transparency/opaqueness of the images.
 void setOpaquePercent(int percent)
          Set the alpha values of the OMColors, which governs the transparency/opaqueness of the images.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CADRG_COLORS

public static final int CADRG_COLORS
See Also:
Constant Field Values

COLORS_216

public static final int COLORS_216
See Also:
Constant Field Values

COLORS_32

public static final int COLORS_32
See Also:
Constant Field Values

COLORS_16

public static final int COLORS_16
See Also:
Constant Field Values

CIB_SPEC_CODE_ID

public static final int CIB_SPEC_CODE_ID
See Also:
Constant Field Values

DEFAULT_OPAQUENESS

public static final int DEFAULT_OPAQUENESS
See Also:
Constant Field Values

colorConvTable

public int[] colorConvTable
Color conversion table (to be filled) from within frame, colortable section. The colortable is always 216 entries long. If you want fewer colors, some of the entries are duplicated.


reducedColorTable

protected int reducedColorTable
Index to use a color conversion table, and if so, which one.


numColors

protected int numColors

Cib

protected boolean Cib

opaqueness

protected int opaqueness

colors

public java.awt.Color[] colors
The actual OMColors to use in the image construction.


zone

public char zone
Zone ID for these colors.


seriesCode

public java.lang.String seriesCode
Chart Series Code for these colors.


tocNumber

protected int tocNumber
The index of the A.TOC file in the RpfTocHandler being used for the current colors.


entryNumber

protected int entryNumber
The index of the RpfEntry in the A.TOC file being used for the current colors.

Constructor Detail

RpfColortable

public RpfColortable()

RpfColortable

public RpfColortable(int nColors)

RpfColortable

public RpfColortable(int nColors,
                     int opaque,
                     boolean cib)
Method Detail

setFrom

public void setFrom(RpfColortable colortable)
Load the provided colortable with the color values of this colortable. The A.TOC values that are set by the RpfFrameCacheHandler are not set, just the color table information read from the RPF frame file.

Parameters:
colortable -

setOpaqueness

public void setOpaqueness(int value)
Set the alpha values of the OMColors, which governs the transparency/opaqueness of the images.

Parameters:
value - index between 0-255 (0 is transparent, 255 is opaque)

getOpaqueness

public int getOpaqueness()

setOpaquePercent

public void setOpaquePercent(int percent)
Set the alpha values of the OMColors, which governs the transparency/opaqueness of the images. This method lets you set the value as a percentage between 0-100.

Parameters:
percent - index between 0-100 (0 is transparent, 100 is opaque)

getOpaquePercent

public int getOpaquePercent()

setNumColors

public void setNumColors(int numColorsValue)

getNumColors

public int getNumColors()
Returns the number of colors.


getColorTableReduction

public int getColorTableReduction()
Returns the color reduction index. These values correspond to the constants defined in this class.


setCib

public void setCib(boolean value)
If this object is going to provide colors for CIB imagery, you have to let this object know that. Set this to true. It is false by default.

Parameters:
value - true if the colortable will be used for greyscale images.

isCib

public boolean isCib()

setATOCIndexes

public void setATOCIndexes(int tocIndex,
                           int entryIndex)
Should be set when a new colortable is read in, so that you can tell when you don't have to read a new one.


isSameATOCIndexes

public boolean isSameATOCIndexes(int tocIndex,
                                 int entryIndex)
Return true of the toc index and entry index are the same as what the colortable is currently holding.


getTocNumber

public int getTocNumber()
Not really used, but someone might need them. Returns the A.TOC index number of the colors, to compare to see if a new colortable is needed.


getEntryNumber

public int getEntryNumber()
Not really used, but someone might need them. Returns the A.TOC entry number of the colors, to compare to see if a new colortable is needed.


parseColorLookUpTable

public java.awt.Color[] parseColorLookUpTable(BinaryFile binFile,
                                              RpfFileSections.RpfLocationRecord[] loc)
The method to call to read in the colortable from within the RPF file. The method will use the input to determine where in the file to read from.

Parameters:
binFile - the file to read it in from.
loc - the RpfLocationRecord that tells you where the sections are.
Returns:
an array of OMColors to use in images.

main

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


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