Class AbstractSextanteRasterLayer
- java.lang.Object
-
- org.openjump.core.rasterimage.sextante.AbstractSextanteRasterLayer
-
- All Implemented Interfaces:
ISextanteDataObject,ISextanteLayer,ISextanteRasterLayer
- Direct Known Subclasses:
OpenJUMPSextanteRasterLayer
public abstract class AbstractSextanteRasterLayer extends Object implements ISextanteRasterLayer
A convenience class which implements some of the methods of the IRasterLayer interface. Extending this class is recommended instead of implementing the interface directly- Author:
- volaya
-
-
Field Summary
Fields Modifier and Type Field Description protected Objectm_BaseDataObject-
Fields inherited from interface org.openjump.core.rasterimage.sextante.ISextanteRasterLayer
INTERPOLATION_BicubicSpline, INTERPOLATION_Bilinear, INTERPOLATION_BSpline, INTERPOLATION_InverseDistance, INTERPOLATION_NearestNeighbour, RASTER_DATA_TYPE_BYTE, RASTER_DATA_TYPE_DOUBLE, RASTER_DATA_TYPE_FLOAT, RASTER_DATA_TYPE_INT, RASTER_DATA_TYPE_SHORT
-
-
Constructor Summary
Constructors Constructor Description AbstractSextanteRasterLayer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(ISextanteRasterLayer driver)adds the value of another raster layer to this one.voidaddToCellValue(int x, int y, double dValue)Adds a value to the current value of a cell in the first band of the layer in the first band of the layervoidaddToCellValue(int x, int y, int iBand, double dValue)Adds a value to the current value of a cellvoidassign(double dValue)voidassign(ISextanteRasterLayer layer)voidassignNoData()int[]getAccumulatedHistogram()int[]getAccumulatedHistogram(int iBand)doublegetAspect(int x, int y)ObjectgetBaseDataObject()Returns the base data object (i.e.bytegetCellValueAsByte(int x, int y)bytegetCellValueAsByte(int x, int y, int band)doublegetCellValueAsDouble(int x, int y)doublegetCellValueAsDouble(int x, int y, int band)floatgetCellValueAsFloat(int x, int y)floatgetCellValueAsFloat(int x, int y, int band)intgetCellValueAsInt(int x, int y)intgetCellValueAsInt(int x, int y, int band)shortgetCellValueAsShort(int x, int y)shortgetCellValueAsShort(int x, int y, int band)intgetDirToNextDownslopeCell(int x, int y)intgetDirToNextDownslopeCell(int x, int y, boolean bForceDirToNoDataCell)doublegetDistToNeighborInDir(int iDir)int[]getHistogram()Returns the histogram of the first band of this layerint[]getHistogram(int iBand)Returns a histogram of a given band of this layerdoublegetMaxValue()Returns the max value in the first band of the layerdoublegetMaxValue(int iBand)Returns the max value in the given band of the layerdoublegetMeanValue()Returns the mean value in the first band of the layerdoublegetMeanValue(int iBand)Returns the mean value in the given band of the layerdoublegetMinValue()Returns the min value in the first band of the layerdoublegetMinValue(int iBand)Returns the min value in the given band of the layerintgetNX()Returns the number of columns in the query window of this layerintgetNY()Returns the number of rows in the query window of this layerdoublegetSlope(int x, int y)static doublegetUnitDistToNeighborInDir(int iDir)doublegetValueAt(double x, double y)Returns the value of the first band of this layer, at a given world coordinate.doublegetValueAt(double x, double y, int band)Returns the value at a given world coordinate.doublegetVariance()Returns the variance in the first band of the layerdoublegetVariance(int iBand)Returns the variance in the given band of the layerPoint2D.DoublegetWindowCellSize()Return the cellsize of the query window.GridExtentgetWindowGridExtent()Returns the grid extent of the query window of this layer.booleanisInWindow(int x, int y)booleanisNoDataValue(double dValue)Checks if the given value equals the no-data value of the layervoidmultiply(double dValue)Multiplies all the values of a layer by a fixed valuevoidsetCellValue(int x, int y, double dValue)Sets the value at a cell, in the first band of the layervoidsetFullExtent()Sets the query window extent to the full extent of the layervoidsetInterpolationMethod(int iMethod)Sets the interpolation method to use for calculating value in points other than cell centersvoidsetNoData(int x, int y)Set the value of a cell in the first band of a layer to the no-data valuevoidsetNoData(int x, int y, int iBand)Set the value of a cell to the no-data valuevoidsetWindowExtent(ISextanteRasterLayer layer)Sets the extent of the query window using the full extent of another layervoidsetWindowExtent(GridExtent extent)Sets a new query window extentStringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.openjump.core.rasterimage.sextante.ISextanteDataObject
close, getFilename, getName, open, postProcess, setName
-
Methods inherited from interface org.openjump.core.rasterimage.sextante.ISextanteLayer
getCRS, getFullExtent
-
Methods inherited from interface org.openjump.core.rasterimage.sextante.ISextanteRasterLayer
fitToGridExtent, getBandsCount, getCellValueInLayerCoords, getDataType, getLayerCellSize, getLayerGridExtent, getNoDataValue, setCellValue, setNoDataValue
-
-
-
-
Field Detail
-
m_BaseDataObject
protected Object m_BaseDataObject
-
-
Method Detail
-
getBaseDataObject
public Object getBaseDataObject()
Description copied from interface:ISextanteDataObjectReturns the base data object (i.e. the object that this class wraps, which contains the data itself)- Specified by:
getBaseDataObjectin interfaceISextanteDataObject- Returns:
- the base data object
-
setInterpolationMethod
public void setInterpolationMethod(int iMethod)
Description copied from interface:ISextanteRasterLayerSets the interpolation method to use for calculating value in points other than cell centers- Specified by:
setInterpolationMethodin interfaceISextanteRasterLayer- Parameters:
iMethod- method to use for interpolation
-
getCellValueAsByte
public byte getCellValueAsByte(int x, int y)- Specified by:
getCellValueAsBytein interfaceISextanteRasterLayer
-
getCellValueAsByte
public byte getCellValueAsByte(int x, int y, int band)- Specified by:
getCellValueAsBytein interfaceISextanteRasterLayer
-
getCellValueAsShort
public short getCellValueAsShort(int x, int y)- Specified by:
getCellValueAsShortin interfaceISextanteRasterLayer
-
getCellValueAsShort
public short getCellValueAsShort(int x, int y, int band)- Specified by:
getCellValueAsShortin interfaceISextanteRasterLayer
-
getCellValueAsInt
public int getCellValueAsInt(int x, int y)- Specified by:
getCellValueAsIntin interfaceISextanteRasterLayer
-
getCellValueAsInt
public int getCellValueAsInt(int x, int y, int band)- Specified by:
getCellValueAsIntin interfaceISextanteRasterLayer
-
getCellValueAsFloat
public float getCellValueAsFloat(int x, int y)- Specified by:
getCellValueAsFloatin interfaceISextanteRasterLayer
-
getCellValueAsFloat
public float getCellValueAsFloat(int x, int y, int band)- Specified by:
getCellValueAsFloatin interfaceISextanteRasterLayer
-
getCellValueAsDouble
public double getCellValueAsDouble(int x, int y)- Specified by:
getCellValueAsDoublein interfaceISextanteRasterLayer
-
getCellValueAsDouble
public double getCellValueAsDouble(int x, int y, int band)- Specified by:
getCellValueAsDoublein interfaceISextanteRasterLayer
-
getValueAt
public double getValueAt(double x, double y)Description copied from interface:ISextanteRasterLayerReturns the value of the first band of this layer, at a given world coordinate. The current interpolation method is used if the coordinate does not fall on the exact center of a cell.- Specified by:
getValueAtin interfaceISextanteRasterLayer- Parameters:
x- the x coordinatey- the y coordinate- Returns:
- the value at the given coordinate. If it falls outside of the layer, the current no-data value of the layer is returned
-
getValueAt
public double getValueAt(double x, double y, int band)Description copied from interface:ISextanteRasterLayerReturns the value at a given world coordinate. The current interpolation method is used if the coordinate does not fall on the exact center of a cell.- Specified by:
getValueAtin interfaceISextanteRasterLayer- Parameters:
x- the x coordinatey- the y coordinateband- the band to query- Returns:
- the value at the given world coordinate
-
isNoDataValue
public boolean isNoDataValue(double dValue)
Description copied from interface:ISextanteRasterLayerChecks if the given value equals the no-data value of the layer- Specified by:
isNoDataValuein interfaceISextanteRasterLayer- Parameters:
dValue- a value to check- Returns:
- true if the given value equals the no-data value of the layer
-
isInWindow
public boolean isInWindow(int x, int y)- Specified by:
isInWindowin interfaceISextanteRasterLayer- Parameters:
x- the x coordinate(col) of the celly- the y coordinate(row) of the cell- Returns:
- true if the given ccell is within the query window extent
-
getNX
public int getNX()
Description copied from interface:ISextanteRasterLayerReturns the number of columns in the query window of this layer- Specified by:
getNXin interfaceISextanteRasterLayer- Returns:
- the number of columns in the query window
-
getNY
public int getNY()
Description copied from interface:ISextanteRasterLayerReturns the number of rows in the query window of this layer- Specified by:
getNYin interfaceISextanteRasterLayer- Returns:
- the number of rows in the query window
-
getWindowCellSize
public Point2D.Double getWindowCellSize()
Description copied from interface:ISextanteRasterLayerReturn the cellsize of the query window. X and Y cellsizes are assumed to be equal- Specified by:
getWindowCellSizein interfaceISextanteRasterLayer- Returns:
- the cellsize of the query window
-
getWindowGridExtent
public GridExtent getWindowGridExtent()
Description copied from interface:ISextanteRasterLayerReturns the grid extent of the query window of this layer. Each layer can have a query window, which makes it easier to seamlessly combine several layers.- Specified by:
getWindowGridExtentin interfaceISextanteRasterLayer- Returns:
- the window grid extent
-
assign
public void assign(double dValue)
- Specified by:
assignin interfaceISextanteRasterLayer
-
assign
public void assign(ISextanteRasterLayer layer)
- Specified by:
assignin interfaceISextanteRasterLayer
-
add
public void add(ISextanteRasterLayer driver)
Description copied from interface:ISextanteRasterLayeradds the value of another raster layer to this one. Both layers must have the same window This is supposed to be used with monoband layers, so only the first band of each one is used.- Specified by:
addin interfaceISextanteRasterLayer- Parameters:
driver- the ISextanteRasterLayer to add to this one
-
assignNoData
public void assignNoData()
- Specified by:
assignNoDatain interfaceISextanteRasterLayer
-
setCellValue
public void setCellValue(int x, int y, double dValue)Description copied from interface:ISextanteRasterLayerSets the value at a cell, in the first band of the layer- Specified by:
setCellValuein interfaceISextanteRasterLayer- Parameters:
x- the x coordinate (cols)y- the y coordinate (rows)dValue- the new value
-
setNoData
public void setNoData(int x, int y)Description copied from interface:ISextanteRasterLayerSet the value of a cell in the first band of a layer to the no-data value- Specified by:
setNoDatain interfaceISextanteRasterLayer- Parameters:
x- the x coordinate(col) of the cell to set to no-datay- the y coordinate(row) of the cell to set to no-data
-
setNoData
public void setNoData(int x, int y, int iBand)Description copied from interface:ISextanteRasterLayerSet the value of a cell to the no-data value- Specified by:
setNoDatain interfaceISextanteRasterLayer- Parameters:
x- the x coordinate(col) of the cell to set to no-datay- the y coordinate(row) of the cell to set to no-dataiBand- the band to set to no-data
-
addToCellValue
public void addToCellValue(int x, int y, int iBand, double dValue)Description copied from interface:ISextanteRasterLayerAdds a value to the current value of a cell- Specified by:
addToCellValuein interfaceISextanteRasterLayer- Parameters:
x- the x coordinate (cols)y- the y coordinate (rows)iBand- the band (zero-based)dValue- the value to sum
-
addToCellValue
public void addToCellValue(int x, int y, double dValue)Description copied from interface:ISextanteRasterLayerAdds a value to the current value of a cell in the first band of the layer in the first band of the layer- Specified by:
addToCellValuein interfaceISextanteRasterLayer- Parameters:
x- the x coordinate (cols)y- the y coordinate (rows)dValue- the value to sum
-
multiply
public void multiply(double dValue)
Description copied from interface:ISextanteRasterLayerMultiplies all the values of a layer by a fixed value- Specified by:
multiplyin interfaceISextanteRasterLayer- Parameters:
dValue- the value to multiply
-
setWindowExtent
public void setWindowExtent(ISextanteRasterLayer layer)
Description copied from interface:ISextanteRasterLayerSets the extent of the query window using the full extent of another layer- Specified by:
setWindowExtentin interfaceISextanteRasterLayer- Parameters:
layer- the layer from which to take the extent
-
setWindowExtent
public void setWindowExtent(GridExtent extent)
Description copied from interface:ISextanteRasterLayerSets a new query window extent- Specified by:
setWindowExtentin interfaceISextanteRasterLayer- Parameters:
extent- the new grid extent to set fro this layer
-
setFullExtent
public void setFullExtent()
Description copied from interface:ISextanteRasterLayerSets the query window extent to the full extent of the layer- Specified by:
setFullExtentin interfaceISextanteRasterLayer
-
getHistogram
public int[] getHistogram(int iBand)
Description copied from interface:ISextanteRasterLayerReturns a histogram of a given band of this layer- Specified by:
getHistogramin interfaceISextanteRasterLayer- Parameters:
iBand- the index of the band (zero-based)- Returns:
- a histogram of the given band of this layer
-
getHistogram
public int[] getHistogram()
Description copied from interface:ISextanteRasterLayerReturns the histogram of the first band of this layer- Specified by:
getHistogramin interfaceISextanteRasterLayer- Returns:
- a histogram of the first band of this layer
-
getAccumulatedHistogram
public int[] getAccumulatedHistogram(int iBand)
-
getAccumulatedHistogram
public int[] getAccumulatedHistogram()
- Specified by:
getAccumulatedHistogramin interfaceISextanteRasterLayer
-
getMinValue
public double getMinValue(int iBand)
Description copied from interface:ISextanteRasterLayerReturns the min value in the given band of the layer- Specified by:
getMinValuein interfaceISextanteRasterLayer- Parameters:
iBand- the index of the band (zero-based)- Returns:
- the min value of the given band of this layer
-
getMaxValue
public double getMaxValue(int iBand)
Description copied from interface:ISextanteRasterLayerReturns the max value in the given band of the layer- Specified by:
getMaxValuein interfaceISextanteRasterLayer- Parameters:
iBand- the index of the band (zero-based)- Returns:
- the max value of the given band of this layer
-
getMeanValue
public double getMeanValue(int iBand)
Description copied from interface:ISextanteRasterLayerReturns the mean value in the given band of the layer- Specified by:
getMeanValuein interfaceISextanteRasterLayer- Parameters:
iBand- the index of the band (zero-based)- Returns:
- the mean value of the given band of this layer
-
getVariance
public double getVariance(int iBand)
Description copied from interface:ISextanteRasterLayerReturns the variance in the given band of the layer- Specified by:
getVariancein interfaceISextanteRasterLayer- Parameters:
iBand- the index of the band (zero-based)- Returns:
- the variance of the given band of this layer
-
getMeanValue
public double getMeanValue()
Description copied from interface:ISextanteRasterLayerReturns the mean value in the first band of the layer- Specified by:
getMeanValuein interfaceISextanteRasterLayer- Returns:
- the mean value of the first band of this layer
-
getMinValue
public double getMinValue()
Description copied from interface:ISextanteRasterLayerReturns the min value in the first band of the layer- Specified by:
getMinValuein interfaceISextanteRasterLayer- Returns:
- the min value of the first band of this layer
-
getMaxValue
public double getMaxValue()
Description copied from interface:ISextanteRasterLayerReturns the max value in the first band of the layer- Specified by:
getMaxValuein interfaceISextanteRasterLayer- Returns:
- the max value of the first band of this layer
-
getVariance
public double getVariance()
Description copied from interface:ISextanteRasterLayerReturns the variance in the first band of the layer- Specified by:
getVariancein interfaceISextanteRasterLayer- Returns:
- the variance of the first band of this layer
-
getSlope
public double getSlope(int x, int y)- Specified by:
getSlopein interfaceISextanteRasterLayer
-
getAspect
public double getAspect(int x, int y)- Specified by:
getAspectin interfaceISextanteRasterLayer
-
getDistToNeighborInDir
public double getDistToNeighborInDir(int iDir)
- Specified by:
getDistToNeighborInDirin interfaceISextanteRasterLayer
-
getUnitDistToNeighborInDir
public static double getUnitDistToNeighborInDir(int iDir)
-
getDirToNextDownslopeCell
public int getDirToNextDownslopeCell(int x, int y)- Specified by:
getDirToNextDownslopeCellin interfaceISextanteRasterLayer
-
getDirToNextDownslopeCell
public int getDirToNextDownslopeCell(int x, int y, boolean bForceDirToNoDataCell)- Specified by:
getDirToNextDownslopeCellin interfaceISextanteRasterLayer
-
-