org.cts.op.transformation.grids
Class GeographicGrid

java.lang.Object
  extended by org.cts.op.transformation.grids.GeographicGrid
All Implemented Interfaces:
Grid
Direct Known Subclasses:
BleggGeographicGrid, IGNGeographicGrid, IGNVerticalGrid

public class GeographicGrid
extends Object
implements Grid

A grid with column and rows representing meridians and parallels and cell values representing any parameter as heights (geoid definition), altitudes (digital elevation model), or transformation parameters for transformations based on a model.

Author:
Michaƫl Michaud, Jules Party

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.cts.op.transformation.grids.Grid
Grid.InterpolationMethod
 
Field Summary
protected  int colNumber
           
protected  Object context
          Context object (may be used to specify the reference Datum).
protected  int dim
          The number of values stored in the grid (for instance 3 for 3D translation grid).
protected  double dx
           
protected  double dy
           
protected  GeographicExtent extent
          Extent of use of the Geographic grid.
protected  double modulo
           
protected  int rowNumber
           
protected  double[][][] values
          3-dimensions float array.
protected  double x0
           
protected  double xL
           
protected  double y0
           
protected  double yL
           
 
Fields inherited from interface org.cts.op.transformation.grids.Grid
BICUBIC, BILINEAR, NEAREST
 
Constructor Summary
protected GeographicGrid()
          Creates a new GeographicGrid.
  GeographicGrid(double westernLongitude, double northernLatitude, double easternLongitude, double southernLatitude, int colNumber, int rowNumber, int dim, double modulo, int scale, Object context)
          Create a new Geographic grid.
 
Method Summary
 double[] bilinearInterpolation(double latitude, double longitude)
          Return a double value interpolated in this geographic grid with a bilinear interpolation method.
 int getColumnNumber()
          Get the number of columns of this grid (also called cn).
 Object getContext()
          Get the context Object.
 double getDX()
          Real world interval between two consecutive columns.
 double getDY()
          Real world interval between two consecutive row.
 double getGridHeight()
          Get the total grid height as a positive number.
 double getGridWidth()
          Get the total grid width as a positive number.
 int getRowNumber()
          Get the number of rows of this grid (also called rn).
 int getScale()
          Get the scale which determine the number of decimal to read/write or to 'scale' factor to use to obtain an integer parameter.
 double[] getValue(double x, double y, Grid.InterpolationMethod method)
          Get the value corrsponding to the x,y position.
 double[][][] getValues()
          Return the array of values.
 double[] getValues(int r, int c)
          get the value in row r and column c
 double getX0()
          Get the real world abscisse (x) of the first column.
 double getXL()
          Get the first ordinate of the last grid column.
 double getY0()
          Get the real world ordinate (y) of the first row.
 double getYL()
          Get the second ordinate of the last grid row.
 void setScale(int scale)
          Set the scale which determine the number of decimal to read/write or the 'scale' factor to use to obtain an integer parameter.
 void setValue(int r, int c, double[] values)
          set the value in row r and column c
 String toString()
          Return a short string representation of the grid.
 String toStringAll()
          Return a complete string representation of the grid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

colNumber

protected int colNumber

rowNumber

protected int rowNumber

dim

protected int dim
The number of values stored in the grid (for instance 3 for 3D translation grid).


x0

protected double x0

y0

protected double y0

xL

protected double xL

yL

protected double yL

dx

protected double dx

dy

protected double dy

extent

protected GeographicExtent extent
Extent of use of the Geographic grid.


modulo

protected double modulo

values

protected double[][][] values
3-dimensions float array. Float values has been choosen because quantities represented in a grid may vary from small quantities (rotation) to greater quantities (translation), but never need a great precision (6 digits are generally sufficient).


context

protected Object context
Context object (may be used to specify the reference Datum).

Constructor Detail

GeographicGrid

protected GeographicGrid()
Creates a new GeographicGrid.


GeographicGrid

public GeographicGrid(double westernLongitude,
                      double northernLatitude,
                      double easternLongitude,
                      double southernLatitude,
                      int colNumber,
                      int rowNumber,
                      int dim,
                      double modulo,
                      int scale,
                      Object context)
Create a new Geographic grid.

Parameters:
westernLongitude -
northernLatitude -
easternLongitude -
southernLatitude -
colNumber - number of column
rowNumber - number of rows
dim - dimension of the stored value(s)
modulo - a tour (360.0 for longitude in degrees, PI*2 for radians and 400 for grades)
context - optional context object
Method Detail

getColumnNumber

public int getColumnNumber()
Get the number of columns of this grid (also called cn).

Specified by:
getColumnNumber in interface Grid

getRowNumber

public int getRowNumber()
Get the number of rows of this grid (also called rn).

Specified by:
getRowNumber in interface Grid

getX0

public double getX0()
Get the real world abscisse (x) of the first column.

Specified by:
getX0 in interface Grid

getY0

public double getY0()
Get the real world ordinate (y) of the first row.

Specified by:
getY0 in interface Grid

getXL

public double getXL()
Get the first ordinate of the last grid column.

Specified by:
getXL in interface Grid

getYL

public double getYL()
Get the second ordinate of the last grid row.

Specified by:
getYL in interface Grid

getDX

public double getDX()
Real world interval between two consecutive columns. The method returns a negative value if x values decreases when column indices increases.

Specified by:
getDX in interface Grid

getDY

public double getDY()
Real world interval between two consecutive row. The method returns a negative value if y values decreases when column indices increases.

Specified by:
getDY in interface Grid

getGridWidth

public double getGridWidth()
Get the total grid width as a positive number.


getGridHeight

public double getGridHeight()
Get the total grid height as a positive number.


getScale

public int getScale()
Get the scale which determine the number of decimal to read/write or to 'scale' factor to use to obtain an integer parameter.


setScale

public void setScale(int scale)
Set the scale which determine the number of decimal to read/write or the 'scale' factor to use to obtain an integer parameter.


getContext

public Object getContext()
Get the context Object.


getValues

public double[] getValues(int r,
                          int c)
get the value in row r and column c

Parameters:
r - row index
c - column index

setValue

public void setValue(int r,
                     int c,
                     double[] values)
set the value in row r and column c

Parameters:
r - row index
c - column index
value - new value of row r column c

getValue

public double[] getValue(double x,
                         double y,
                         Grid.InterpolationMethod method)
                  throws OutOfExtentException,
                         InterpolationMethodException
Get the value corrsponding to the x,y position. WARNING : x, y represent the real world coordinates and not the matrix coordinate.

Specified by:
getValue in interface Grid
Throws:
OutOfExtentException
InterpolationMethodException

getValues

public double[][][] getValues()
Return the array of values.


bilinearInterpolation

public double[] bilinearInterpolation(double latitude,
                                      double longitude)
                               throws OutOfExtentException
Return a double value interpolated in this geographic grid with a bilinear interpolation method.

dx
----------
| |
|ddx |dy
| + ddy |
----------
fx = ddx/dx
fy = ddy/dy

Parameters:
latitude - the latitude
longitude - the longitude
Returns:
the interpolated value as a double
Throws:
OutOfExtentException

toString

public String toString()
Return a short string representation of the grid.

Overrides:
toString in class Object

toStringAll

public String toStringAll()
Return a complete string representation of the grid.



Copyright © 2014 IRSTV CNRS-FR-2488. All Rights Reserved.