sim.field.geo
Class GeomGridField

java.lang.Object
  extended by sim.field.geo.GeomField
      extended by sim.field.geo.GeomGridField
All Implemented Interfaces:
java.io.Serializable

public class GeomGridField
extends GeomField

A georeferenced area represented by a grid The associated GeomField.MBR defines the area the grid maps to.

See Also:
Serialized Form

Nested Class Summary
static class GeomGridField.GridDataType
          Used to determine the GeomGridField storage type.
 
Field Summary
 
Fields inherited from class sim.field.geo.GeomField
drawX, drawY, fieldHeight, fieldWidth, MBR
 
Constructor Summary
GeomGridField()
           
GeomGridField(sim.field.grid.Grid2D wrappedGrid)
           
 
Method Summary
 void clear()
          delete contents
 sim.field.grid.Grid2D getGrid()
           
 GeomGridField.GridDataType getGridDataType()
           
 int getGridHeight()
          By contrast, super.getHeight() returns width in spatial reference context.
 int getGridWidth()
          Returns width of grid in pixels.
 double getPixelHeight()
          Height of pixels in units of the underlying coordinate reference system
 double getPixelWidth()
          Width of pixels in units of the underlying coordinate reference system
 boolean isInGrid(int x, int y)
           
 void setGrid(sim.field.grid.Grid2D newGrid)
           
 void setMBR(com.vividsolutions.jts.geom.Envelope MBR)
          Set the MBR
 void setPixelHeight(double pixelHeight)
          Set heigh of pixels in units of the underlying coordinate reference system
 void setPixelWidth(double pixelWidth)
          Set pixel width in units of underlying coordinate reference system
 com.vividsolutions.jts.geom.Point toPoint(int x, int y)
          Return a Point corresponding to center of grid cell
 com.vividsolutions.jts.geom.Polygon toPolygon(int x, int y)
          Return a Polygon corresponding to the grid cell perimeter
 int toXCoord(double x)
           
 int toXCoord(com.vividsolutions.jts.geom.Point p)
           
 int toYCoord(double y)
           
 int toYCoord(com.vividsolutions.jts.geom.Point p)
           
 
Methods inherited from class sim.field.geo.GeomField
getFieldHeight, getFieldWidth, getHeight, getMBR, getWidth, setFieldHeight, setFieldWidth
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeomGridField

public GeomGridField()

GeomGridField

public GeomGridField(sim.field.grid.Grid2D wrappedGrid)
Method Detail

getGridDataType

public GeomGridField.GridDataType getGridDataType()
Returns:
the data type of the grid cells; null if there is no assigned grid

getPixelHeight

public double getPixelHeight()
Height of pixels in units of the underlying coordinate reference system


setPixelHeight

public void setPixelHeight(double pixelHeight)
Set heigh of pixels in units of the underlying coordinate reference system


getPixelWidth

public double getPixelWidth()
Width of pixels in units of the underlying coordinate reference system


setPixelWidth

public void setPixelWidth(double pixelWidth)
Set pixel width in units of underlying coordinate reference system


getGrid

public final sim.field.grid.Grid2D getGrid()

setGrid

public final void setGrid(sim.field.grid.Grid2D newGrid)

getGridWidth

public final int getGridWidth()
Returns width of grid in pixels.

By contrast, super.getWidth() returns width in spatial reference context.

Returns:
Returns width in grid points
Throws:
java.lang.NullPointerException - if grid not assigned

getGridHeight

public final int getGridHeight()
By contrast, super.getHeight() returns width in spatial reference context.

Returns:
height of grid in pixels
Throws:
java.lang.NullPointerException - if grid not assigned

clear

public void clear()
Description copied from class: GeomField
delete contents

Overrides:
clear in class GeomField

setMBR

public void setMBR(com.vividsolutions.jts.geom.Envelope MBR)
Description copied from class: GeomField
Set the MBR

Overrides:
setMBR in class GeomField

isInGrid

public boolean isInGrid(int x,
                        int y)
Returns:
true if (x,y) within grid boundaries

toXCoord

public int toXCoord(com.vividsolutions.jts.geom.Point p)
Parameters:
p - point
Returns:
x grid coordinate for cell 'p' is in

toXCoord

public int toXCoord(double x)
Parameters:
x - Coordinate in base projection
Returns:
x grid coordinate for cell 'x'

toYCoord

public int toYCoord(com.vividsolutions.jts.geom.Point p)
Parameters:
p - point
Returns:
y grid coordinate for cell 'p' is in

toYCoord

public int toYCoord(double y)
Parameters:
y - coordinate in base projection
Returns:
y grid coordinate for cell 'y' is in

toPoint

public com.vividsolutions.jts.geom.Point toPoint(int x,
                                                 int y)
Return a Point corresponding to center of grid cell

Parameters:
x - in pixel coordinates
y - in pixel coordinates
Returns:
Point for center of given grid cell

toPolygon

public com.vividsolutions.jts.geom.Polygon toPolygon(int x,
                                                     int y)
Return a Polygon corresponding to the grid cell perimeter

Parameters:
x - in pixel coordinates
y - in pixel coordinates
Returns:
Polygon representing grid cell area