Class RasterImageLayerProperties

java.lang.Object
org.openjump.core.ui.plugin.raster.RasterImageLayerProperties

public class RasterImageLayerProperties extends Object
  • Constructor Details

    • RasterImageLayerProperties

      public RasterImageLayerProperties()
  • Method Details

    • getFileSizeMegaBytes

      public static String getFileSizeMegaBytes(long bytes)
      Converts bytes to multiple (Kilo, Mega, Giga-bytes according to the dimension of the file. Return as String
      Parameters:
      bytes - as long
      Returns:
      java.lang.String
    • getFileSizeBytes

      public static long getFileSizeBytes(RasterImageLayer layer)
      Gets dimension of RasterImageLayer in long
      Parameters:
      layer - a RasterImageLayer
      Returns:
      the size of the file containing the image
    • getFileExtension

      public static String getFileExtension(RasterImageLayer layer)
      Return the extension of the file as String
      Parameters:
      layer - a RasterImageLayer
      Returns:
      the file extension as String
    • numBands

      public static String numBands(RasterImageLayer layer)
      Gets the number of bands from A RasterImageLayer as String
      Parameters:
      layer - a RasterImageLayer
      Returns:
      the number of bands as a String
    • getDataType

      public static String getDataType(Raster raster) throws IOException
      Gets data type as String
      Parameters:
      raster - a java.awt.image.Raster
      Returns:
      the data type as a String
      Throws:
      IOException - never
    • getColorDepth

      public static String getColorDepth(Raster raster, File file) throws IOException
      Gets color depth as String It first check into the Raster otherwise uses first Commons Imaging then ImageIO to check into the file
      Parameters:
      raster - a java.awt.image.Raster
      file - the File containing the image
      Returns:
      the color depth as a String
      Throws:
      IOException - if an IOException occurs during file I/O
    • getDPI

      public static String getDPI(Raster raster, File file) throws IOException
      Gets BPP (bits per pixel), first check into the raster then into the file using Commons Imaging
      Parameters:
      raster - the java.awt.image.Raster
      file - the File containing the image
      Returns:
      the number of bits per pixel as a String
      Throws:
      IOException - if an IOException occurs during file I/O
    • cellSizeX

      public static double cellSizeX(Raster raster, org.locationtech.jts.geom.Envelope env) throws IOException
      Gets the cell size along X as Double
      Parameters:
      raster - the java.awt.image.Raster
      env - image Envelope
      Returns:
      pixel width as a double
      Throws:
      IOException - never
    • cellSizeY

      public static double cellSizeY(Raster raster, org.locationtech.jts.geom.Envelope env) throws IOException
      Gets the cell size along Y as double
      Parameters:
      raster - the java.awt.image.Raster
      env - the Envelope
      Returns:
      pixel height as a double
      Throws:
      IOException - never
    • getNumColumns

      public static int getNumColumns(Raster raster) throws IOException
      Gets the number of column in a Raster as int
      Parameters:
      raster - the java.awt.image.Raster
      Returns:
      the number of columns
      Throws:
      IOException - never
    • getNumRows

      public static int getNumRows(Raster raster) throws IOException
      Gets number of rows as int
      Parameters:
      raster - the java.awt.image.Raster
      Returns:
      the number of rows
      Throws:
      IOException - never
    • getNodataCellNumber

      public static int getNodataCellNumber(Raster raster, double nodata) throws IOException, RasterImageLayer.RasterDataNotFoundException
      Count the number of cells in a Raster of a specific double value and return as int.
      Parameters:
      raster - the java.awt.image.Raster
      nodata - the value meaning "no data"
      Returns:
      the number of nodata cells
      Throws:
      IOException - if an IOException occurs during I/O
      RasterImageLayer.RasterDataNotFoundException - if an error occurs accessing raster data
    • getValidCellsNumber

      public static int getValidCellsNumber(Raster raster, double nodata) throws IOException, RasterImageLayer.RasterDataNotFoundException
      Count the number of cells in a Raster excluding the ones of a specific double value and return as int.
      Parameters:
      raster - the java.awt.image.Raster
      nodata - the value meaning "no data"
      Returns:
      the number of valid cells (different from no data)
      Throws:
      IOException - if an IOException occurs during I/O
      RasterImageLayer.RasterDataNotFoundException - if an error occurs accessing raster data