com.bbn.openmap.omGraphics
Class OMGrid

java.lang.Object
  extended by com.bbn.openmap.omGraphics.geom.BasicGeometry
      extended by com.bbn.openmap.omGraphics.OMGraphicAdapter
          extended by com.bbn.openmap.omGraphics.OMList<OMGraphic>
              extended by com.bbn.openmap.omGraphics.OMGraphicList
                  extended by com.bbn.openmap.omGraphics.OMGrid
All Implemented Interfaces:
OMGeometry, OMGraphic, OMGraphicConstants, java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<OMGraphic>, java.util.Collection<OMGraphic>, java.util.List<OMGraphic>
Direct Known Subclasses:
OMDTEDGrid

public class OMGrid
extends OMGraphicList

An OMGrid object is a two-dimensional container object for data. The grid can be laid out in geographic or pixel space. There are two different ways that the OMGrid can be used.

The data placed in the array can represent the attributes of what you want the grid to represent - elevation values, temperatures, etc. In order to render the data on the screen, you'll need to set the OMGridGenerator object, and let it interpret the data to create the desired OMGraphics for you.

The OMGrid data values can also contain integer ID keys for objects contained in the OMGridObjects object held by the OMGrid. By using the OMGrid in this way, the OMGrid becomes a placeholder for other graphics, and will manage the generate() function calls to those objects that are on the screen.

The OMGridGenerator object will take precedence over the OMGridObjects - If the OMGridGenerator is set within the grid, the OMGridGenerator will create the OMGraphics to be displayed for the grid, as opposed the OMGridObjects getting a chance to generate themselves. The OMGrid extends OMGraphicList, and the OMGraphics that the OMGridGenerator creates are added to the OMGrid. If you want the OMGrid to hide the OMGraphics that are created, make it vague.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.bbn.openmap.omGraphics.OMList
OMList.OMDist<T>
 
Field Summary
static boolean COLUMN_MAJOR
          Means that the first dimension of the array refers to the column count.
protected  int columns
          Number of columns in the data array.
 GridData data
          The Object holding the data for the OMGrid.
protected  OMGridGenerator generator
          An object that knows how to generate graphics for the matrix.
static int GRID_NULL
          Value of a bad/invalid point in the grid.
protected  OMGridObjects gridObjects
          If needed, the data array can hold numerical identifiers, which are keys to objects stored in this hashtable.
 int height
          Pixel height of grid, set after generate.
protected  double horizontalResolution
          The horizontal/longitude interval, the distance between column data points in the horizontal direction.
protected  double latitude
          The starting latitude point of the grid.
protected  double longitude
          The starting longitude point of the grid.
protected  boolean major
          Keep track of which dimension different parts of the double array represent.
protected  double orientation
          The orientation angle of the grid, in radians.
protected  java.awt.Point point
          Horizontal screen location of the upper left corner of the grid in pixels, before projection, of XY and OFFSET grids.
 java.awt.Point point1
          Horizontal screen location of the upper left corner of the grid in pixels, after projection.
 java.awt.Point point2
          Horizontal screen location of the lower right corner of the grid in pixels, after projection.
static boolean ROW_MAJOR
          Means that the first dimension of the array refers to the row count.
protected  int rows
          Number of rows in the data array.
protected  Length units
          The units, if needed, of the values contained in the grid data array.
protected  double verticalResolution
          The vertical/latitude interval, the distance between row data points in the vertical direction.
 int width
          Pixel width of grid, set after generate.
 
Fields inherited from class com.bbn.openmap.omGraphics.OMList
allowDuplicates, FIRST_ADDED_ON_TOP, graphics, LAST_ADDED_ON_TOP, NONE, processAllGeometries, traverseMode, vague
 
Fields inherited from class com.bbn.openmap.omGraphics.OMGraphicAdapter
declutterType, displayPaint, edgeMatchesFill, fillPaint, hasLabel, linePaint, matted, mattingPaint, renderType, selected, selectPaint, showEditablePalette, stroke, textureMask
 
Fields inherited from class com.bbn.openmap.omGraphics.geom.BasicGeometry
attributes, lineType, needToRegenerate, shape, visible
 
Fields inherited from interface com.bbn.openmap.omGraphics.OMGraphicConstants
ADD_GRAPHIC_MASK, APP_OBJECT, BASIC_STROKE, CHANGE_APPEARANCE, clear, DECIMAL_DEGREES, DECLUTTERTYPE_LINE, DECLUTTERTYPE_MOVE, DECLUTTERTYPE_NONE, DECLUTTERTYPE_SPACE, DEFAULT_ROTATIONANGLE, DELETE_GRAPHIC_MASK, DESELECT_GRAPHIC_MASK, DESELECTALL_GRAPHIC_MASK, GRAPHICTYPE_ARC, GRAPHICTYPE_BITMAP, GRAPHICTYPE_CIRCLE, GRAPHICTYPE_ELLIPSE, GRAPHICTYPE_GRAPHIC, GRAPHICTYPE_GRID, GRAPHICTYPE_LINE, GRAPHICTYPE_POINT, GRAPHICTYPE_POLY, GRAPHICTYPE_RASTER, GRAPHICTYPE_RECTANGLE, GRAPHICTYPE_TEXT, INDEX, INFOLINE, LABEL, LINETYPE_GREATCIRCLE, LINETYPE_RHUMB, LINETYPE_STRAIGHT, LINETYPE_UNKNOWN, LOWER_GRAPHIC_MASK, LOWER_TO_BOTTOM_GRAPHIC_MASK, NO_ROTATE, OMGRAPHIC_ELT, OMGRAPHIC_TYPE_ATTR, RADIANS, RAISE_GRAPHIC_MASK, RAISE_TO_TOP_GRAPHIC_MASK, REMOVABLE, RENDERTYPE_LATLON, RENDERTYPE_OFFSET, RENDERTYPE_UNKNOWN, RENDERTYPE_XY, SELECT_GRAPHIC_MASK, SORT_GRAPHICS_MASK, TOOLTIP, UPDATE_GRAPHIC_MASK, UPDATED
 
Constructor Summary
OMGrid()
          Default constructor.
OMGrid(double lat, double lon, double vResolution, double hResolution, GridData data)
          Create a OMGrid that covers a lat/lon area.
OMGrid(double lat, double lon, double vResolution, double hResolution, int[][] data)
          Create a OMGrid that covers a lat/lon area.
OMGrid(double lat, double lon, int x, int y, double vResolution, double hResolution, GridData data)
          Create a OMGrid that covers a x/y screen area, anchored to a lat/lon point.
OMGrid(double lat, double lon, int x, int y, double vResolution, double hResolution, int[][] data)
          Create a OMGrid that covers a x/y screen area, anchored to a lat/lon point.
OMGrid(int x, int y, double vResolution, double hResolution, GridData data)
          Create a OMGrid that covers a x/y screen area.Column major by default.
OMGrid(int x, int y, double vResolution, double hResolution, int[][] data)
          Create a OMGrid that covers a x/y screen area.Column major by default.
 
Method Summary
 boolean generate(Projection proj)
          Generate OMGraphics based on the data array.
 OMGraphic generateGridObjects(Projection proj)
          Called from generate() if there isn't a OMGridGenerator.
 int getColumns()
          Set the horizontal number of data points.
 GridData getData()
          Get the data array for the OMGrid.
 OMGridGenerator getGenerator()
          Get the OMGridGenerator being used to interpret the data array.
 OMGridObjects getGridObjects()
          Get the OMGridObjects containing the mapping of the data array IDs to a set of Objects.
 int getHeight()
           
 double getHorizontalResolution()
          Get the number of decimal degrees between vertical columns.
 double getLatitude()
          Get the latitude of the lower left anchor point of the grid, in decimal degrees.
 double getLongitude()
          Get the latitude of the lower left anchor point of the grid, in decimal degrees.
 boolean getMajor()
          Set which dimension is defined first in the two dimensional array.
 double getOrientation()
          Get the angle that was set for the grid to be rotated.
 java.awt.Point getPoint()
          Get the screen location, or x/y offset from the lat/lon anchor point, of the lower left corner of the grid.
 int getRows()
          Get the vertical number of data points.
 Length getUnits()
          Get the units for the grid data.
 double getVerticalResolution()
          Get the number of decimal degrees between horizontal rows.
 int getWidth()
           
 int interpValueAt(double lat, double lon, Projection proj)
          Interpolated value at a given lat/lon - should be more precise than valueAt(), but that depends on the resolution of the data.
 void render(java.awt.Graphics g)
          Render the OMGraphics created to represent the grid data.
 void restore(OMGeometry source)
          You need to make sure that the Generic type of the source matches the generic type of this list.
protected  void set(double lat, double lon, int x, int y, double vResolution, double hResolution, GridData data)
          Set the parameters of the OMGrid after construction.
protected  void set(double lat, double lon, int x, int y, double vResolution, double hResolution, int[][] data)
          Set the parameters of the OMGrid after construction.
 void setColumns(int columns)
          Deprecated. set when the data is set
 void setData(GridData data)
          Set the data of the grid.
 void setData(int[][] data)
          Set the data of the grid.
 void setGenerator(OMGridGenerator aGenerator)
          Set the OMGridGenerator that will interpret the data array and create OMGraphics for it.
 void setGridObjects(OMGridObjects someGridObjs)
          There is an option in the OMGrid where the data array contains ID numbers for a set of other objects.
 void setHorizontalResolution(double hRes)
          Set the number of decimal degrees between vertical columns.
 void setLatitude(double lat)
           
 void setLongitude(double lon)
           
 void setMajor(boolean maj)
          Set which dimension is defined first in the two dimensional array.
 void setOrientation(double orient)
          Set the angle that the grid should be rotated.
 void setRows(int rows)
          Deprecated. set when data is set.
 void setShape()
          Set a bounding rectangle as this OMGrid's shape, based on the location and size of the coverage of the grid.
 void setUnits(Length length)
          Set the units for the grid data.
 void setVerticalResolution(double vRes)
          Set the number of decimal degrees between horizontal rows.
 java.lang.Object valueAt(double lat, double lon, Projection proj)
          The value at the closest SW post to the given lat/lon.
 
Methods inherited from class com.bbn.openmap.omGraphics.OMGraphicList
add, add, addAll, addAll, clone, create, createDist, get, getOMGraphicAt, getTargets, iteratorCopy, listIteratorCopy, listIteratorCopy, objectToOMGraphic, readGraphics, readGraphics, remove, set, setFillPaint, setGridGenerator, setLinePaint, setMatted, setMattingPaint, setOMGraphicAt, setSelectPaint, setStroke, setTargets, setTextureMask, sort, writeGraphics, writeGraphics
 
Methods inherited from class com.bbn.openmap.omGraphics.OMList
checkForDuplicate, clear, contains, contains, containsAll, deselect, distance, doAction, findAll, findAll, findAllTest, findClosest, findClosest, findClosest, findClosestTest, findIndexOfClosest, findIndexOfClosest, generate, getAllowDuplicates, getContains, getCopy, getDescription, getDescription, getProcessAllGeometries, getTraverseMode, indexOf, isEmpty, isVague, isVisible, iterator, lastIndexOf, listIterator, listIterator, moveIndexedOneToBack, moveIndexedOneToBottom, moveIndexedOneToFront, moveIndexedOneToTop, moveIndexedToBottom, moveIndexedToFirst, moveIndexedToLast, moveIndexedToTop, project, project, remove, removeAll, renderAllAsSelected, retainAll, select, selectClosest, selectClosest, selectClosestTest, setAllowDuplicates, setProcessAllGeometries, setTraverseMode, setVague, setVisible, shouldProcess, size, subList, toArray, toArray
 
Methods inherited from class com.bbn.openmap.omGraphics.OMGraphicAdapter
getDeclutterType, getDisplayColor, getDisplayPaint, getEdgeMatchesFill, getFillColor, getFillPaint, getHasLabel, getLineColor, getLinePaint, getMattingPaint, getRenderType, getSelectColor, getSelectPaint, getShowEditablePalette, getStroke, getTextureMask, hasLineTypeChoice, initLabelingDuringGenerate, isClear, isMatted, isSelected, normalizeDistanceForLineWidth, readStroke, readTextureMask, regenerate, renderLabel, renderShape, setDeclutterType, setEdgeMatchesFill, setFillColor, setGraphicsColor, setGraphicsForEdge, setGraphicsForFill, setHasLabel, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLineColor, setRenderType, setSelectColor, setSelected, setShowEditablePalette, shouldRenderEdge, shouldRenderFill, writeStroke, writeTextureMask
 
Methods inherited from class com.bbn.openmap.omGraphics.geom.BasicGeometry
_distance, appendShapeEdge, appendShapeEdge, appendShapeEdge, appendShapeEdge, clearAttributes, contains, createAttributeMap, createBoxShape, createShape, createShape, describeShapeDetail, describeShapeDetail, distanceToEdge, distanceToEdge, draw, draw, fill, fill, getAppObject, getAttribute, getAttributes, getLineType, getNeedToRegenerate, getShape, isRenderable, isRenderable, putAttribute, removeAttribute, setAppObject, setAttributes, setLineType, setNeedToRegenerate, setShape
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.List
equals, hashCode
 
Methods inherited from interface com.bbn.openmap.omGraphics.OMGraphic
getDeclutterType, getDisplayColor, getDisplayPaint, getFillColor, getFillPaint, getLineColor, getLinePaint, getMattingPaint, getRenderType, getSelectColor, getSelectPaint, getShowEditablePalette, getStroke, getTextureMask, hasLineTypeChoice, isMatted, isSelected, normalizeDistanceForLineWidth, regenerate, renderLabel, setDeclutterType, setGraphicsColor, setGraphicsForEdge, setGraphicsForFill, setLabelLocation, setLabelLocation, setLabelLocation, setRenderType, setSelected, setShowEditablePalette, shouldRenderEdge, shouldRenderFill
 
Methods inherited from interface com.bbn.openmap.omGraphics.OMGeometry
clearAttributes, contains, distanceToEdge, draw, draw, fill, fill, getAppObject, getAttribute, getAttributes, getLineType, getNeedToRegenerate, getShape, isRenderable, isRenderable, putAttribute, removeAttribute, setAppObject, setAttributes, setLineType, setNeedToRegenerate, setShape
 

Field Detail

orientation

protected double orientation
The orientation angle of the grid, in radians. Up/North is zero.


rows

protected int rows
Number of rows in the data array. Gets set by the OMGrid depending on the major of the grid.


columns

protected int columns
Number of columns in the data array. Gets set by the OMGrid depending on the major of the grid.


latitude

protected double latitude
The starting latitude point of the grid. Only relevant when the data points are laid out in a lat/lon grid, or when an x/y grid is anchored to a lat/lon location. DOES NOT follow the OpenMap convention where area object locations are defined by the upper left location - the location of the grid is noted by the lower left corner, because grid data is usually defined by the lower left location. Makes it easier to deal with overlap rows and columns, and to calculate the locations of the rows and columns.


longitude

protected double longitude
The starting longitude point of the grid. Only relevant when the data points are laid out in a lat/lon grid, or when an x/y grid is anchored to a lat/lon location. DOES NOT follow the OpenMap convention where area object locations are defined by the upper left location - the location of the grid is noted by the lower left corner, because grid data is usually defined by the lower left location. Makes it easier to deal with overlap rows and columns, and to calculate the locations of the rows and columns.


verticalResolution

protected double verticalResolution
The vertical/latitude interval, the distance between row data points in the vertical direction. For x/y grids, this can server as a pixel multiplier. For lat/lon grids, it represents the decimal degrees between grid points.


horizontalResolution

protected double horizontalResolution
The horizontal/longitude interval, the distance between column data points in the horizontal direction. For x/y grids, this can server as a pixel multiplier. For lat/lon grids, it represents the decimal degrees between grid points.


data

public GridData data
The Object holding the data for the OMGrid. The GridData abstracts the type of data that is held by the OMGrid. Note: the 0 index of the array in both directions is in the lower left corner of the matrix. As you increase indexes in both dimensions, you go up-right.


gridObjects

protected OMGridObjects gridObjects
If needed, the data array can hold numerical identifiers, which are keys to objects stored in this hashtable. That way, the grid can be used to hold an array of objects. If the objs are set, then the OMGrid object automatically assumes that all graphic operations are supposed to involve the objs.


point

protected java.awt.Point point
Horizontal screen location of the upper left corner of the grid in pixels, before projection, of XY and OFFSET grids.


point1

public java.awt.Point point1
Horizontal screen location of the upper left corner of the grid in pixels, after projection.


point2

public java.awt.Point point2
Horizontal screen location of the lower right corner of the grid in pixels, after projection.


height

public int height
Pixel height of grid, set after generate. For non-equidistant projections, this will be a bounding box height.


width

public int width
Pixel width of grid, set after generate. For non-equidistant projections, this will be a bounding box width.


GRID_NULL

public static final int GRID_NULL
Value of a bad/invalid point in the grid. Has roots in the DTED way of doing things.

See Also:
Constant Field Values

generator

protected OMGridGenerator generator
An object that knows how to generate graphics for the matrix.


COLUMN_MAJOR

public static final boolean COLUMN_MAJOR
Means that the first dimension of the array refers to the column count.

See Also:
Constant Field Values

ROW_MAJOR

public static final boolean ROW_MAJOR
Means that the first dimension of the array refers to the row count.

See Also:
Constant Field Values

major

protected boolean major
Keep track of which dimension different parts of the double array represent. COLUMN_MAJOR is the default, meaning that the first dimension of the array represents the vertical location in the array, and the second is the horizontal location in the array.


units

protected Length units
The units, if needed, of the values contained in the grid data array. Null value is default and acceptable.

Constructor Detail

OMGrid

public OMGrid()
Default constructor.


OMGrid

public OMGrid(double lat,
              double lon,
              double vResolution,
              double hResolution,
              int[][] data)
Create a OMGrid that covers a lat/lon area. Column major by default. If your data is row major, use null for the data, set the major direction, and then set the data.

Parameters:
lat - latitude of lower left corner of the grid, in decimal degrees.
lon - longitude of lower left corner of the grid, in decimal degrees.
vResolution - the vertical resolution of the data, as decimal degrees per row.
hResolution - the horizontal resolution of the data, as decimal degrees per column.
data - a double array of integers, representing the rows and columns of data.

OMGrid

public OMGrid(int x,
              int y,
              double vResolution,
              double hResolution,
              int[][] data)
Create a OMGrid that covers a x/y screen area.Column major by default. If your data is row major, use null for the data, set the major direction, and then set the data.

Parameters:
x - horizontal location, in pixels, of the left side of the grid from the left side of the map.
y - vertical location, in pixels, of the top of the grid from the top side of the map.
vResolution - the vertical resolution of the data, as pixels per row.
hResolution - the horizontal resolution of the data, as pixels per column.
data - a double array of integers, representing the rows and columns of data.

OMGrid

public OMGrid(double lat,
              double lon,
              int x,
              int y,
              double vResolution,
              double hResolution,
              int[][] data)
Create a OMGrid that covers a x/y screen area, anchored to a lat/lon point. Column major by default. If your data is row major, use null for the data, set the major direction, and then set the data.

Parameters:
lat - latitude of the anchor point of the grid, in decimal degrees.
lon - longitude of the anchor point of the grid, in decimal degrees.
x - horizontal location, in pixels, of the left side of the grid from the longitude anchor point.
y - vertical location, in pixels, of the top of the grid from the latitude anchor point.
vResolution - the vertical resolution of the data, as pixels per row.
hResolution - the horizontal resolution of the data, as pixels per column.
data - a double array of integers, representing the rows and columns of data.

OMGrid

public OMGrid(double lat,
              double lon,
              double vResolution,
              double hResolution,
              GridData data)
Create a OMGrid that covers a lat/lon area. Column major by default. If your data is row major, use null for the data, set the major direction, and then set the data.

Parameters:
lat - latitude of lower left corner of the grid, in decimal degrees.
lon - longitude of lower left corner of the grid, in decimal degrees.
vResolution - the vertical resolution of the data, as decimal degrees per row.
hResolution - the horizontal resolution of the data, as decimal degrees per column.
data - GridData object holding rows and columns of grid data.

OMGrid

public OMGrid(int x,
              int y,
              double vResolution,
              double hResolution,
              GridData data)
Create a OMGrid that covers a x/y screen area.Column major by default. If your data is row major, use null for the data, set the major direction, and then set the data.

Parameters:
x - horizontal location, in pixels, of the left side of the grid from the left side of the map.
y - vertical location, in pixels, of the top of the grid from the top side of the map.
vResolution - the vertical resolution of the data, as pixels per row.
hResolution - the horizontal resolution of the data, as pixels per column.
data - GridData object holding rows and columns of grid data.

OMGrid

public OMGrid(double lat,
              double lon,
              int x,
              int y,
              double vResolution,
              double hResolution,
              GridData data)
Create a OMGrid that covers a x/y screen area, anchored to a lat/lon point. Column major by default. If your data is row major, use null for the data, set the major direction, and then set the data.

Parameters:
lat - latitude of the anchor point of the grid, in decimal degrees.
lon - longitude of the anchor point of the grid, in decimal degrees.
x - horizontal location, in pixels, of the left side of the grid from the longitude anchor point.
y - vertical location, in pixels, of the top of the grid from the latitude anchor point.
vResolution - the vertical resolution of the data, as pixels per row.
hResolution - the horizontal resolution of the data, as pixels per column.
data - GridData object holding rows and columns of grid data.
Method Detail

set

protected void set(double lat,
                   double lon,
                   int x,
                   int y,
                   double vResolution,
                   double hResolution,
                   int[][] data)
Set the parameters of the OMGrid after construction.


set

protected void set(double lat,
                   double lon,
                   int x,
                   int y,
                   double vResolution,
                   double hResolution,
                   GridData data)
Set the parameters of the OMGrid after construction.


setRows

public void setRows(int rows)
Deprecated. set when data is set.

Set the vertical number of data points. Should correspond to the the data, and to the major setting of the OMGrid. Will be set automatically when the data is set.


getRows

public int getRows()
Get the vertical number of data points.


setLatitude

public void setLatitude(double lat)

getLatitude

public double getLatitude()
Get the latitude of the lower left anchor point of the grid, in decimal degrees.


setLongitude

public void setLongitude(double lon)

getLongitude

public double getLongitude()
Get the latitude of the lower left anchor point of the grid, in decimal degrees.


getPoint

public java.awt.Point getPoint()
Get the screen location, or x/y offset from the lat/lon anchor point, of the lower left corner of the grid.


setColumns

public void setColumns(int columns)
Deprecated. set when the data is set

Set the horizontal number of data points. Should correspond to the the data, and to the major setting of the OMGrid. Will be set automatically when the data is set. Does nothing.


getColumns

public int getColumns()
Set the horizontal number of data points.


setMajor

public void setMajor(boolean maj)
Set which dimension is defined first in the two dimensional array. If COLUMN_MAJOR (true and the default), the first dimension of the data array will represent the horizontal location of the data, and the second dimension will represent the vertical location. Vice versa for COLUMN_ROW. Calling this method will reset the column and row count to match the data to the new orientation.


getMajor

public boolean getMajor()
Set which dimension is defined first in the two dimensional array.


setOrientation

public void setOrientation(double orient)
Set the angle that the grid should be rotated. May not be implemented for some OMGridGenerators.

Parameters:
orient - is the angle of the grid, in radians. Up/North is zero.

getOrientation

public double getOrientation()
Get the angle that was set for the grid to be rotated. In radians, up/north is zero.


setData

public void setData(int[][] data)
Set the data of the grid. The major setting will cause this method to set the number of rows and columns accordingly. The values in the array will be interpreted to the OMGridGenerator that you provide to this OMGrid. The OMGridGenerator will create what gets drawn on the map based on this data. The int[][] will be wrapped by a GridData.Int object.


setData

public void setData(GridData data)
Set the data of the grid. The major setting will cause this method to set the number of rows and columns accordingly. The values in the array will be interpreted to the OMGridGenerator that you provide to this OMGrid. The OMGridGenerator will create what gets drawn on the map based on this data.


getData

public GridData getData()
Get the data array for the OMGrid. What these numbers represent depends on what OMGridGenerator is being used.


setGridObjects

public void setGridObjects(OMGridObjects someGridObjs)
There is an option in the OMGrid where the data array contains ID numbers for a set of other objects. So the grid holds onto the location of these objects, and the OMGridObjects provides the ID mapping to the actual object.


getGridObjects

public OMGridObjects getGridObjects()
Get the OMGridObjects containing the mapping of the data array IDs to a set of Objects.


setGenerator

public void setGenerator(OMGridGenerator aGenerator)
Set the OMGridGenerator that will interpret the data array and create OMGraphics for it.


getGenerator

public OMGridGenerator getGenerator()
Get the OMGridGenerator being used to interpret the data array.


setVerticalResolution

public void setVerticalResolution(double vRes)
Set the number of decimal degrees between horizontal rows.


getVerticalResolution

public double getVerticalResolution()
Get the number of decimal degrees between horizontal rows.


setHorizontalResolution

public void setHorizontalResolution(double hRes)
Set the number of decimal degrees between vertical columns.


getHorizontalResolution

public double getHorizontalResolution()
Get the number of decimal degrees between vertical columns.


getWidth

public int getWidth()

getHeight

public int getHeight()

setUnits

public void setUnits(Length length)
Set the units for the grid data.


getUnits

public Length getUnits()
Get the units for the grid data.


generate

public boolean generate(Projection proj)
Generate OMGraphics based on the data array. If there is an OMGridGenerator, it will be used to generate OMGraphics from the data array. If not, the OMGridObjects will be used to create OMGraphics for the map.

Specified by:
generate in interface OMGeometry
Overrides:
generate in class OMList<OMGraphic>
Parameters:
proj - a Projection
Returns:
boolean true
See Also:
OMList.generate(Projection, boolean)

setShape

public void setShape()
Set a bounding rectangle as this OMGrid's shape, based on the location and size of the coverage of the grid.


render

public void render(java.awt.Graphics g)
Render the OMGraphics created to represent the grid data.

Specified by:
render in interface OMGeometry
Overrides:
render in class OMList<OMGraphic>
Parameters:
g - the AWT Graphics context

generateGridObjects

public OMGraphic generateGridObjects(Projection proj)
Called from generate() if there isn't a OMGridGenerator. Goes through the grid, figuring out which data array indexes are on the map, and then calls generate on those grid objects.


valueAt

public java.lang.Object valueAt(double lat,
                                double lon,
                                Projection proj)
The value at the closest SW post to the given lat/lon. This is just a go-to-the-closest-post solution.

Parameters:
lat - latitude in decimal degrees.
lon - longitude in decimal degrees.
proj - map projection, which is needed for XY or OFFSET grids.
Returns:
value found at the nearest grid point. This is an object returned from the GridObject data object, so what it is depends on that. You can test if it's a java.lang.Number object to get different values out of it if it is.

interpValueAt

public int interpValueAt(double lat,
                         double lon,
                         Projection proj)
Interpolated value at a given lat/lon - should be more precise than valueAt(), but that depends on the resolution of the data. Works with GridData.Int data objects.

Parameters:
lat - latitude in decimal degrees.
lon - longitude in decimal degrees.
proj - map projection, which is needed for XY or OFFSET grids.
Returns:
value at lat/lon

restore

public void restore(OMGeometry source)
Description copied from class: OMList
You need to make sure that the Generic type of the source matches the generic type of this list. Will fail silently. Not sure if this is the right way to handle it, though.

Specified by:
restore in interface OMGeometry
Overrides:
restore in class OMList<OMGraphic>


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