org.geotools.gce.grassraster.core
Class GrassBinaryRasterWriteHandler

Object
  extended by GrassBinaryRasterWriteHandler

public class GrassBinaryRasterWriteHandler
extends Object

Grass binary data input/ouput handler.

Reading and writing is supported.

Since:
3.0
Author:
Andrea Antonello (www.hydrologis.com)
See Also:
GrassBinaryImageReader, GrassBinaryImageReadParam, GrassBinaryImageMetadata

Constructor Summary
GrassBinaryRasterWriteHandler(File destMapset, String newMapName, ProgressListener monitor)
          A constructor to build a GrassBinaryRasterWriteHandler usable for writing grass rasters.
 
Method Summary
 void abort()
          sets the abortrequired flag to true.
 void close()
          Closes the I/O streams.
 CoordinateReferenceSystem getCrs()
          Reads the crs definition for the map.
 double getNoData()
          Getter for the noData value.
 JGrassRegion getWriteRegion()
          Calculates the region that is going to be written.
 boolean isAborting()
          Getter for the abortrequired flag.
 void setNoData(double noData)
          Setter for the noData value.
 void setWriteRegion(JGrassRegion writeRegion)
           
 void writeRaster(RenderedImage renderedImage, int columns, int rows, double west, double south, double xRes, double yRes, double noDataValue)
          Writes the raster, given an raster iterator and region metadata.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GrassBinaryRasterWriteHandler

public GrassBinaryRasterWriteHandler(File destMapset,
                                     String newMapName,
                                     ProgressListener monitor)
A constructor to build a GrassBinaryRasterWriteHandler usable for writing grass rasters.

Parameters:
destMapset - the mapset file into which the map has to be written.
newMapName - the name for the written map.
monitor -
Method Detail

writeRaster

public void writeRaster(RenderedImage renderedImage,
                        int columns,
                        int rows,
                        double west,
                        double south,
                        double xRes,
                        double yRes,
                        double noDataValue)
                 throws IOException
Writes the raster, given an raster iterator and region metadata.

Parameters:
renderedImage - the RenderedImage to write.
columns - the columns of the raster to write.
rows - the rows of the raster to write.
west - the western bound of the raster to write.
south - the southern bound of the raster to write.
xRes - the east-west resolution of the raster to write.
yRes - the north-south resolution of the raster to write.
noDataValue - the value representing noData.
Throws:
IOException

getWriteRegion

public JGrassRegion getWriteRegion()
                            throws IOException
Calculates the region that is going to be written.

Returns:
the region that will be written by this Writer.
Throws:
IOException

setWriteRegion

public void setWriteRegion(JGrassRegion writeRegion)

close

public void close()
           throws IOException
Closes the I/O streams.

Throws:
IOException

setNoData

public void setNoData(double noData)
Setter for the noData value.

Parameters:
noData - the nodata value to set.

getNoData

public double getNoData()
Getter for the noData value.

Returns:
the nodata value.

getCrs

public CoordinateReferenceSystem getCrs()
                                 throws IOException
Reads the crs definition for the map.

The definition for grass maps is held in the location. Grass projection definitions are usually in a non parsable internal format. In JGrass we ask the user to choose the CRS. If the user doesn't do so, the CRS will result to be undefined.

Returns:
the CoordinateReferenceSystem for the map. Null if it is not defined.
Throws:
IOException - if there were problems in parsing the CRS file.

abort

public void abort()
sets the abortrequired flag to true.

As soon as possible that should abort the reader.


isAborting

public boolean isAborting()
Getter for the abortrequired flag.

Returns:
the abortRequired flag.


Copyright © 1996-2014 Geotools. All Rights Reserved.