com.bbn.openmap.omGraphics.grid
Class SimpleColorGenerator

java.lang.Object
  |
  +--com.bbn.openmap.omGraphics.grid.SimpleColorGenerator
All Implemented Interfaces:
OMGridGenerator
Direct Known Subclasses:
ElevationMBandGenerator

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.


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)
           
 OMGraphic generate(OMGrid grid, Projection proj)
          Going to return an OMRaster, sized to the current projection, and colored according to the colortable.
 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)


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