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 Details

    • m_BaseDataObject

      protected Object m_BaseDataObject
  • Constructor Details

    • AbstractSextanteRasterLayer

      public AbstractSextanteRasterLayer()
  • Method Details

    • getBaseDataObject

      public Object getBaseDataObject()
      Description copied from interface: ISextanteDataObject
      Returns the base data object (i.e. the object that this class wraps, which contains the data itself)
      Specified by:
      getBaseDataObject in interface ISextanteDataObject
      Returns:
      the base data object
    • setInterpolationMethod

      public void setInterpolationMethod(int iMethod)
      Description copied from interface: ISextanteRasterLayer
      Sets the interpolation method to use for calculating value in points other than cell centers
      Specified by:
      setInterpolationMethod in interface ISextanteRasterLayer
      Parameters:
      iMethod - method to use for interpolation
    • getCellValueAsByte

      public byte getCellValueAsByte(int x, int y)
      Specified by:
      getCellValueAsByte in interface ISextanteRasterLayer
    • getCellValueAsByte

      public byte getCellValueAsByte(int x, int y, int band)
      Specified by:
      getCellValueAsByte in interface ISextanteRasterLayer
    • getCellValueAsShort

      public short getCellValueAsShort(int x, int y)
      Specified by:
      getCellValueAsShort in interface ISextanteRasterLayer
    • getCellValueAsShort

      public short getCellValueAsShort(int x, int y, int band)
      Specified by:
      getCellValueAsShort in interface ISextanteRasterLayer
    • getCellValueAsInt

      public int getCellValueAsInt(int x, int y)
      Specified by:
      getCellValueAsInt in interface ISextanteRasterLayer
    • getCellValueAsInt

      public int getCellValueAsInt(int x, int y, int band)
      Specified by:
      getCellValueAsInt in interface ISextanteRasterLayer
    • getCellValueAsFloat

      public float getCellValueAsFloat(int x, int y)
      Specified by:
      getCellValueAsFloat in interface ISextanteRasterLayer
    • getCellValueAsFloat

      public float getCellValueAsFloat(int x, int y, int band)
      Specified by:
      getCellValueAsFloat in interface ISextanteRasterLayer
    • getCellValueAsDouble

      public double getCellValueAsDouble(int x, int y)
      Specified by:
      getCellValueAsDouble in interface ISextanteRasterLayer
    • getCellValueAsDouble

      public double getCellValueAsDouble(int x, int y, int band)
      Specified by:
      getCellValueAsDouble in interface ISextanteRasterLayer
    • getValueAt

      public double getValueAt(double x, double y)
      Description copied from interface: ISextanteRasterLayer
      Returns 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:
      getValueAt in interface ISextanteRasterLayer
      Parameters:
      x - the x coordinate
      y - 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: ISextanteRasterLayer
      Returns 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:
      getValueAt in interface ISextanteRasterLayer
      Parameters:
      x - the x coordinate
      y - the y coordinate
      band - the band to query
      Returns:
      the value at the given world coordinate
    • isNoDataValue

      public boolean isNoDataValue(double dValue)
      Description copied from interface: ISextanteRasterLayer
      Checks if the given value equals the no-data value of the layer
      Specified by:
      isNoDataValue in interface ISextanteRasterLayer
      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:
      isInWindow in interface ISextanteRasterLayer
      Parameters:
      x - the x coordinate(col) of the cell
      y - 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: ISextanteRasterLayer
      Returns the number of columns in the query window of this layer
      Specified by:
      getNX in interface ISextanteRasterLayer
      Returns:
      the number of columns in the query window
    • getNY

      public int getNY()
      Description copied from interface: ISextanteRasterLayer
      Returns the number of rows in the query window of this layer
      Specified by:
      getNY in interface ISextanteRasterLayer
      Returns:
      the number of rows in the query window
    • getWindowCellSize

      public Point2D.Double getWindowCellSize()
      Description copied from interface: ISextanteRasterLayer
      Return the cellsize of the query window. X and Y cellsizes are assumed to be equal
      Specified by:
      getWindowCellSize in interface ISextanteRasterLayer
      Returns:
      the cellsize of the query window
    • getWindowGridExtent

      public GridExtent getWindowGridExtent()
      Description copied from interface: ISextanteRasterLayer
      Returns 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:
      getWindowGridExtent in interface ISextanteRasterLayer
      Returns:
      the window grid extent
    • assign

      public void assign(double dValue)
      Specified by:
      assign in interface ISextanteRasterLayer
    • assign

      public void assign(ISextanteRasterLayer layer)
      Specified by:
      assign in interface ISextanteRasterLayer
    • add

      public void add(ISextanteRasterLayer driver)
      Description copied from interface: ISextanteRasterLayer
      adds 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:
      add in interface ISextanteRasterLayer
      Parameters:
      driver - the ISextanteRasterLayer to add to this one
    • assignNoData

      public void assignNoData()
      Specified by:
      assignNoData in interface ISextanteRasterLayer
    • setCellValue

      public void setCellValue(int x, int y, double dValue)
      Description copied from interface: ISextanteRasterLayer
      Sets the value at a cell, in the first band of the layer
      Specified by:
      setCellValue in interface ISextanteRasterLayer
      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: ISextanteRasterLayer
      Set the value of a cell in the first band of a layer to the no-data value
      Specified by:
      setNoData in interface ISextanteRasterLayer
      Parameters:
      x - the x coordinate(col) of the cell to set to no-data
      y - 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: ISextanteRasterLayer
      Set the value of a cell to the no-data value
      Specified by:
      setNoData in interface ISextanteRasterLayer
      Parameters:
      x - the x coordinate(col) of the cell to set to no-data
      y - the y coordinate(row) of the cell to set to no-data
      iBand - the band to set to no-data
    • addToCellValue

      public void addToCellValue(int x, int y, int iBand, double dValue)
      Description copied from interface: ISextanteRasterLayer
      Adds a value to the current value of a cell
      Specified by:
      addToCellValue in interface ISextanteRasterLayer
      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: ISextanteRasterLayer
      Adds 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:
      addToCellValue in interface ISextanteRasterLayer
      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: ISextanteRasterLayer
      Multiplies all the values of a layer by a fixed value
      Specified by:
      multiply in interface ISextanteRasterLayer
      Parameters:
      dValue - the value to multiply
    • setWindowExtent

      public void setWindowExtent(ISextanteRasterLayer layer)
      Description copied from interface: ISextanteRasterLayer
      Sets the extent of the query window using the full extent of another layer
      Specified by:
      setWindowExtent in interface ISextanteRasterLayer
      Parameters:
      layer - the layer from which to take the extent
    • setWindowExtent

      public void setWindowExtent(GridExtent extent)
      Description copied from interface: ISextanteRasterLayer
      Sets a new query window extent
      Specified by:
      setWindowExtent in interface ISextanteRasterLayer
      Parameters:
      extent - the new grid extent to set fro this layer
    • setFullExtent

      public void setFullExtent()
      Description copied from interface: ISextanteRasterLayer
      Sets the query window extent to the full extent of the layer
      Specified by:
      setFullExtent in interface ISextanteRasterLayer
    • getHistogram

      public int[] getHistogram(int iBand)
      Description copied from interface: ISextanteRasterLayer
      Returns a histogram of a given band of this layer
      Specified by:
      getHistogram in interface ISextanteRasterLayer
      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: ISextanteRasterLayer
      Returns the histogram of the first band of this layer
      Specified by:
      getHistogram in interface ISextanteRasterLayer
      Returns:
      a histogram of the first band of this layer
    • getAccumulatedHistogram

      public int[] getAccumulatedHistogram(int iBand)
    • getAccumulatedHistogram

      public int[] getAccumulatedHistogram()
      Specified by:
      getAccumulatedHistogram in interface ISextanteRasterLayer
    • getMinValue

      public double getMinValue(int iBand)
      Description copied from interface: ISextanteRasterLayer
      Returns the min value in the given band of the layer
      Specified by:
      getMinValue in interface ISextanteRasterLayer
      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: ISextanteRasterLayer
      Returns the max value in the given band of the layer
      Specified by:
      getMaxValue in interface ISextanteRasterLayer
      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: ISextanteRasterLayer
      Returns the mean value in the given band of the layer
      Specified by:
      getMeanValue in interface ISextanteRasterLayer
      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: ISextanteRasterLayer
      Returns the variance in the given band of the layer
      Specified by:
      getVariance in interface ISextanteRasterLayer
      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: ISextanteRasterLayer
      Returns the mean value in the first band of the layer
      Specified by:
      getMeanValue in interface ISextanteRasterLayer
      Returns:
      the mean value of the first band of this layer
    • getMinValue

      public double getMinValue()
      Description copied from interface: ISextanteRasterLayer
      Returns the min value in the first band of the layer
      Specified by:
      getMinValue in interface ISextanteRasterLayer
      Returns:
      the min value of the first band of this layer
    • getMaxValue

      public double getMaxValue()
      Description copied from interface: ISextanteRasterLayer
      Returns the max value in the first band of the layer
      Specified by:
      getMaxValue in interface ISextanteRasterLayer
      Returns:
      the max value of the first band of this layer
    • getVariance

      public double getVariance()
      Description copied from interface: ISextanteRasterLayer
      Returns the variance in the first band of the layer
      Specified by:
      getVariance in interface ISextanteRasterLayer
      Returns:
      the variance of the first band of this layer
    • getSlope

      public double getSlope(int x, int y)
      Specified by:
      getSlope in interface ISextanteRasterLayer
    • getAspect

      public double getAspect(int x, int y)
      Specified by:
      getAspect in interface ISextanteRasterLayer
    • getDistToNeighborInDir

      public double getDistToNeighborInDir(int iDir)
      Specified by:
      getDistToNeighborInDir in interface ISextanteRasterLayer
    • getUnitDistToNeighborInDir

      public static double getUnitDistToNeighborInDir(int iDir)
    • getDirToNextDownslopeCell

      public int getDirToNextDownslopeCell(int x, int y)
      Specified by:
      getDirToNextDownslopeCell in interface ISextanteRasterLayer
    • getDirToNextDownslopeCell

      public int getDirToNextDownslopeCell(int x, int y, boolean bForceDirToNoDataCell)
      Specified by:
      getDirToNextDownslopeCell in interface ISextanteRasterLayer
    • toString

      public String toString()
      Overrides:
      toString in class Object