com.bbn.openmap.omGraphics.grid
Class SlopeGenerator

java.lang.Object
  extended by com.bbn.openmap.omGraphics.grid.SlopeGenerator
All Implemented Interfaces:
OMGridGenerator
Direct Known Subclasses:
DTEDSlopeGenerator

public class SlopeGenerator
extends java.lang.Object
implements OMGridGenerator

The SlopeGenerator is an OMGridGenerator that looks at elevation data and creates shading images from it. It currently works for short data only, since that what DTED elevation data is. Making it work with different data types is on the to-do list.


Field Summary
protected  ElevationColors colors
           
protected  int contrast
           
protected  boolean incomplete
           
 
Constructor Summary
SlopeGenerator()
           
SlopeGenerator(ElevationColors elevColors)
           
 
Method Summary
 OMGraphic generate(OMGrid grid, Projection proj)
          Called from the OMGrid.generate() method to tell the generator to create something to represent the grid contents.
 OMRaster generateRasterForProjection(OMGrid grid, Projection proj)
          A more defining API method to get what this SlopeGenerator can create.
 ElevationColors getColors()
           
 int getContrast()
           
protected  OMRaster getRaster(OMGrid grid)
          Called from within generate to create an OMRaster object for the OMGrid.
protected  double getSlopeRun(OMGrid grid, int contrastAdj)
          Method to calculate the run part of the slope (rise over run, right?).
 boolean isIncompleteImage()
          A method to check if the last image created was a complete one.
 boolean needGenerateToRender()
           
 void setColors(ElevationColors elevColors)
           
 void setContrast(int val)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

contrast

protected int contrast

colors

protected ElevationColors colors

incomplete

protected boolean incomplete
Constructor Detail

SlopeGenerator

public SlopeGenerator()

SlopeGenerator

public SlopeGenerator(ElevationColors elevColors)
Method Detail

setColors

public void setColors(ElevationColors elevColors)

getColors

public ElevationColors getColors()

setContrast

public void setContrast(int val)

getContrast

public int getContrast()

getRaster

protected OMRaster getRaster(OMGrid grid)
Called from within generate to create an OMRaster object for the OMGrid. This method exists to make it easier to extend this class to create an OMRaster as needed.


isIncompleteImage

public boolean isIncompleteImage()
A method to check if the last image created was a complete one. If it was incomplete, then that means some pixels of the image were not set because they were outside of the projection.


generateRasterForProjection

public OMRaster generateRasterForProjection(OMGrid grid,
                                            Projection proj)
A more defining API method to get what this SlopeGenerator can create. An OMGridGenerator generates an OMGraphic, this method lets you specifically ask for an OMRaster if that's what you want. If SlopeGenerator is extended so that it doesn't necessarily return an OMRaster from generate, this method checks for that and will return null if generate returns something other than an OMRaster.

Parameters:
grid -
proj -
Returns:
OMRaster that reflects slope information.

generate

public OMGraphic generate(OMGrid grid,
                          Projection proj)
Called from the OMGrid.generate() method to tell the generator to create something to represent the grid contents.

Specified by:
generate in interface OMGridGenerator

needGenerateToRender

public boolean needGenerateToRender()
Specified by:
needGenerateToRender in interface OMGridGenerator

getSlopeRun

protected double getSlopeRun(OMGrid grid,
                             int contrastAdj)
Method to calculate the run part of the slope (rise over run, right?). The rise is calculated with the elevations of the points to the northwest and southeast of the point of concern, the run is some factor of the distance between those two posts.

Parameters:
grid - the OMGrid that contains the data, need to get units.
contrastAdj - contrast adjustment from 1-10, 5 being no adjustment. 10 is high contrast, 1 is low contrast.


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