org.geotools.gce.arcgrid
Class ArcGridRaster

java.lang.Object
  extended byorg.geotools.gce.arcgrid.ArcGridRaster
Direct Known Subclasses:
GRASSArcGridRaster

public class ArcGridRaster
extends java.lang.Object

Class user for parsing an ArcGrid header (.arc, .asc) file.

Author:
Christiaan ten Klooster, Andrea Aime, Simone Giannecchini (simboss)

Field Summary
protected  double cellSize
           
static java.lang.String CELLSIZE
          cell size tag in the header file
protected  double maxValue
          max value found in the file
protected  double minValue
          min value found in the file
protected  int nCols
           
static java.lang.String NCOLS
          Column number tag in the header file
protected  double noData
           
static java.lang.String NODATA_VALUE
          no data tag in the header file
protected  int nRows
           
static java.lang.String NROWS
          Row number tag in the header file
protected  double xllCorner
           
static java.lang.String XLLCORNER
          x corner coordinate tag in the header file
protected  double yllCorner
           
static java.lang.String YLLCORNER
          y corner coordinate tag in the header file
 
Constructor Summary
ArcGridRaster(java.io.PrintWriter writer)
          Creates a new instance of ArcGridRaster.
ArcGridRaster(java.io.Reader reader, boolean compress)
          Creates a new instance of ArcGridRaster.
ArcGridRaster(java.net.URL srcURL)
          Creates a new instance of ArcGridRaster.
 
Method Summary
 double getCellSize()
          Returns the cell size.
 double getMaxValue()
          Max value.
 double getMinValue()
          Min value.
 int getNCols()
          Returns the number of columns contained in the file.
 double getNoData()
          Returns the no data (null) value.
 int getNRows()
          Returns the number of rows contained in the file.
 double getXlCorner()
          Returns the x cordinate of the lower left corner.
 double getYlCorner()
          Returns the y cordinate of the lower left corner.
protected  java.io.Reader openReader()
          Obtain the best reader for the situation
protected  java.io.PrintWriter openWriter(boolean compress)
          Open the best writer for the situation.
 void parseHeader()
          Parses the reader for the known properties.
protected  void parseHeader(java.io.StreamTokenizer st)
          Parse the header of an ascii grid file.
protected  double readHeaderDouble(java.io.StreamTokenizer st)
           
 java.awt.image.WritableRaster readRaster()
          Returns the WritableRaster of the raster.
protected  void spaces(java.io.PrintWriter p, int n)
          Print n spaces to the PrintWriter
 java.lang.String toString()
           
 void writeRaster(java.awt.image.Raster raster, double xl, double yl, double cellsize, boolean compress)
          Write out the given raster..
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NCOLS

public static final java.lang.String NCOLS
Column number tag in the header file

See Also:
Constant Field Values

NROWS

public static final java.lang.String NROWS
Row number tag in the header file

See Also:
Constant Field Values

XLLCORNER

public static final java.lang.String XLLCORNER
x corner coordinate tag in the header file

See Also:
Constant Field Values

YLLCORNER

public static final java.lang.String YLLCORNER
y corner coordinate tag in the header file

See Also:
Constant Field Values

CELLSIZE

public static final java.lang.String CELLSIZE
cell size tag in the header file

See Also:
Constant Field Values

NODATA_VALUE

public static final java.lang.String NODATA_VALUE
no data tag in the header file

See Also:
Constant Field Values

maxValue

protected double maxValue
max value found in the file


minValue

protected double minValue
min value found in the file


xllCorner

protected double xllCorner

yllCorner

protected double yllCorner

cellSize

protected double cellSize

noData

protected double noData

nCols

protected int nCols

nRows

protected int nRows
Constructor Detail

ArcGridRaster

public ArcGridRaster(java.net.URL srcURL)
Creates a new instance of ArcGridRaster.

Parameters:
srcURL - URL of a ArcGridRaster.
Throws:
java.io.IOException - DOCUMENT ME!

ArcGridRaster

public ArcGridRaster(java.io.Reader reader,
                     boolean compress)
Creates a new instance of ArcGridRaster. Used Exclusively by ArcGridReader.

Parameters:
reader - reader to be used for reading the Raster.
compress - DOCUMENT ME!
Throws:
java.io.IOException - DOCUMENT ME!

ArcGridRaster

public ArcGridRaster(java.io.PrintWriter writer)
Creates a new instance of ArcGridRaster. Used Exclusively by ArcGridWriter.

Parameters:
writer - writer to be used for writing the Raster.
Throws:
java.io.IOException - DOCUMENT ME!
Method Detail

getMaxValue

public double getMaxValue()
Max value.

Returns:
the max value contained in the data file

getMinValue

public double getMinValue()
Min value.

Returns:
the min value contained in the data file

getNRows

public int getNRows()
Returns the number of rows contained in the file.

Returns:
number of rows

getNCols

public int getNCols()
Returns the number of columns contained in the file.

Returns:
number of columns

getXlCorner

public double getXlCorner()
Returns the x cordinate of the lower left corner.

Returns:
x cordinate of the lower left corner.

getYlCorner

public double getYlCorner()
Returns the y cordinate of the lower left corner.

Returns:
y cordinate of the lower left corner.

getCellSize

public double getCellSize()
Returns the cell size.

Returns:
cell size

getNoData

public double getNoData()
Returns the no data (null) value.

Returns:
no data (null) value.

parseHeader

public void parseHeader()
                 throws java.io.IOException
Parses the reader for the known properties.

Throws:
java.io.IOException - for reading errors

parseHeader

protected void parseHeader(java.io.StreamTokenizer st)
                    throws java.io.IOException
Parse the header of an ascii grid file.

Parameters:
st - StringTokenizer to be used to parse this header.
Throws:
java.io.IOException

readHeaderDouble

protected double readHeaderDouble(java.io.StreamTokenizer st)
                           throws java.io.IOException
Throws:
java.io.IOException

openReader

protected java.io.Reader openReader()
                             throws java.io.IOException
Obtain the best reader for the situation

Returns:
A reader to read this file.
Throws:
java.io.IOException - DOCUMENT ME!

openWriter

protected java.io.PrintWriter openWriter(boolean compress)
                                  throws java.io.IOException
Open the best writer for the situation.

Parameters:
compress - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.io.IOException - DOCUMENT ME!

readRaster

public java.awt.image.WritableRaster readRaster()
                                         throws java.io.IOException
Returns the WritableRaster of the raster. This method first parses the header then reads all the data.

Returns:
RenderedImage
Throws:
java.io.IOException - DOCUMENT ME!

spaces

protected void spaces(java.io.PrintWriter p,
                      int n)
Print n spaces to the PrintWriter

Parameters:
p - DOCUMENT ME!
n - DOCUMENT ME!

writeRaster

public void writeRaster(java.awt.image.Raster raster,
                        double xl,
                        double yl,
                        double cellsize,
                        boolean compress)
                 throws java.io.IOException
Write out the given raster..

Parameters:
raster - DOCUMENT ME!
xl - DOCUMENT ME!
yl - DOCUMENT ME!
cellsize - DOCUMENT ME!
compress - DOCUMENT ME!
Throws:
java.io.IOException - DOCUMENT ME!

toString

public java.lang.String toString()


Copyright © GeoTools. All Rights Reserved.