## com.bbn.openmap.omGraphics.grid
Class SimpleColorGenerator

    java.lang.Object
      com.bbn.openmap.omGraphics.grid.SimpleColorGenerator

All Implemented Interfaces:
  OMGridGenerator

Direct Known Subclasses:
  ElevationBandGenerator

public class SimpleColorGenerator
extends java.lang.Object
implements OMGridGenerator

The SimpleColorGenerator is an OMGridGenerator that creates an OMRaster out of OMGrid data. The OMgrid data is assumed to be color ARGB integer values. Each pixel is colored according to the closest grid data point value.

Nested Class Summary
`protected class` `SimpleColorGenerator.ByteRasterHelper`
`protected class` `SimpleColorGenerator.CharRasterHelper`
`protected class` `SimpleColorGenerator.DoubleRasterHelper`
`protected class` `SimpleColorGenerator.FloatRasterHelper`
`protected class` `SimpleColorGenerator.IntRasterHelper`
`protected static interface` `SimpleColorGenerator.RasterHelper`
`protected class` `SimpleColorGenerator.ShortRasterHelper`

Constructor Summary
`SimpleColorGenerator()`

Method Summary
`int` `calibratePointValue(int source)` Takes the value assigned to a pixel, as determined by it's location in the grid, and gives a color to paint the pixel.
`int[]` `createGreyscaleColors(int num_colors, int opaqueness)` This method creates a set of greyscale colors.
`OMGraphic` `generate(OMGrid grid, Projection proj)` Going to return an OMRaster, sized to the current projection, and colored according to the colortable.
`protected SimpleColorGenerator.RasterHelper` `getRasterHelper(GridData gd)`
`boolean` `needGenerateToRender()` We at least need one generate for XY and OFFSET grids.

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

Constructor Detail

### SimpleColorGenerator

    public SimpleColorGenerator()

Method Detail

### generate

    public OMGraphic generate(OMGrid grid,
                              Projection proj)

  Going to return an OMRaster, sized to the current projection, and colored according to the colortable. The grid values are indexes into the colortable. The grid should already be generated when it gets here - meaning that the bounds and parameters of the grid, as they apply to the projection, are figured out.

  Specified by:
    `generate` in interface `OMGridGenerator`
  Parameters:
    `grid` - the grid to create a raster for.
    `proj` - description of the map.

### calibratePointValue

    public int calibratePointValue(int source)

  Takes the value assigned to a pixel, as determined by it's location in the grid, and gives a color to paint the pixel. In this case, the grid point value IS the color value.

  Parameters:
    `source` - a grid point value assigned to the raster pixel.
  Returns:
    the ARGB to color the pixel.

### needGenerateToRender

    public boolean needGenerateToRender()

  We at least need one generate for XY and OFFSET grids. We will need a generate every time the projection changes for LATLON rendertype grids. So return true for everything.

  Specified by:
    `needGenerateToRender` in interface `OMGridGenerator`

### createGreyscaleColors

    public int[] createGreyscaleColors(int num_colors,
                                       int opaqueness)

  This method creates a set of greyscale colors. It isn't used in this class (SimpleColorGenerator), but it probably will be used in extended classes.

  Parameters:
    `num_colors` - the number of greys needed.
    `opaqueness` - how clear the color should be (0-255, where 0 is clear).
  Returns:
    an array of color ARGB integers.

### getRasterHelper

    protected SimpleColorGenerator.RasterHelper getRasterHelper(GridData gd)

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