Class JGrassRasterData
- java.lang.Object
-
- org.hortonmachine.gears.io.grasslegacy.map.JGrassRasterData
-
- All Implemented Interfaces:
RasterData
public class JGrassRasterData extends Object implements RasterData
Class representing JGrass's internal data format. Basically a wrapper.- Author:
- Andrea Antonello - www.hydrologis.com
-
-
Constructor Summary
Constructors Constructor Description JGrassRasterData(double[][] data)Create the object from an existing data matrixJGrassRasterData(double[][] data, double value)Create a new data object initializing its values
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetCols()double[][]getData()Get the matrix of data.intgetRows()double[]getRowValue(int row)Get a row of the raster matrixdoublegetValueAt(int index)Get the raster's value at given position.doublegetValueAt(int row, int col)Get the raster's value at given row and col.doublegetValueAt(Point point)Get the raster's value at given position.voidsetValueAt(int index, double value)Set the raster's value at given position.voidsetValueAt(int row, int col, double value)Set the raster's value at given row and col.StringtoString()
-
-
-
Constructor Detail
-
JGrassRasterData
public JGrassRasterData(double[][] data)
Create the object from an existing data matrix- Parameters:
data-
-
JGrassRasterData
public JGrassRasterData(double[][] data, double value)Create a new data object initializing its values- Parameters:
data- the new memory allocation for the datavalue- init value
-
-
Method Detail
-
getValueAt
public double getValueAt(int row, int col)Description copied from interface:RasterDataGet the raster's value at given row and col.- Specified by:
getValueAtin interfaceRasterData- Returns:
- the value in double format
-
getValueAt
public double getValueAt(int index)
Description copied from interface:RasterDataGet the raster's value at given position.- Specified by:
getValueAtin interfaceRasterData- Returns:
- the value in double format
-
getValueAt
public double getValueAt(Point point)
Description copied from interface:RasterDataGet the raster's value at given position.- Specified by:
getValueAtin interfaceRasterData- Parameters:
point- the row, col position- Returns:
- the value in double format
-
setValueAt
public void setValueAt(int row, int col, double value)Description copied from interface:RasterDataSet the raster's value at given row and col.- Specified by:
setValueAtin interfaceRasterData
-
setValueAt
public void setValueAt(int index, double value)Description copied from interface:RasterDataSet the raster's value at given position.- Specified by:
setValueAtin interfaceRasterData
-
getRows
public int getRows()
- Specified by:
getRowsin interfaceRasterData- Returns:
- the number of rows of the raster
-
getCols
public int getCols()
- Specified by:
getColsin interfaceRasterData- Returns:
- the number of cols of the raster
-
toString
public String toString()
- Specified by:
toStringin interfaceRasterData- Overrides:
toStringin classObject- Returns:
- a string representation of the raster
-
getRowValue
public double[] getRowValue(int row)
Description copied from interface:RasterDataGet a row of the raster matrix- Specified by:
getRowValuein interfaceRasterData- Parameters:
row- the row to extract
-
getData
public double[][] getData()
Description copied from interface:RasterDataGet the matrix of data.- Specified by:
getDatain interfaceRasterData- Returns:
- the matrix of data.
-
-