org.deegree.coverage.raster.io.grid
Class GridWriter

java.lang.Object
  extended by org.deegree.coverage.raster.io.grid.GridWriter
All Implemented Interfaces:
RasterWriter

public class GridWriter
extends Object
implements RasterWriter

The GridWriter class TODO add class documentation here.

Version:
$Revision: 31644 $, $Date: 2011-08-24 22:27:43 +0200 (Wed, 24 Aug 2011) $
Author:
Rutger Bezema, last edited by: $Author: mschneider $

Field Summary
static String RASTERIO_COLUMNS
          Defining the number of columns of the grid rasterwriter, to be used in the RasterIOOptions
static String RASTERIO_ROWS
          Defining the number of rows of the grid rasterwriter, to be used in the RasterIOOptions
 
Constructor Summary
GridWriter(int targetColumns, int targetRows, Envelope rasterEnvelope, RasterGeoReference geoRef, File gridFile, RasterDataInfo dataInfo)
          Create a gridfile writer with the given parameters.
 
Method Summary
 boolean canWrite(AbstractRaster raster, RasterIOOptions options)
          Check if the raster writer is able to write the given raster.
 Set<String> getSupportedFormats()
           
protected  Envelope getTileEnvelope(int column, int row)
          Calculates the envelope for a tile at a given position in the grid.
protected  int getTileId(int column, int row)
          Calculates the id for a tile at a given position in the grid.
 int getTileRasterHeight()
           
 int getTileRasterWidth()
           
 void leaveStreamOpen(boolean yesNo)
          Signals the gridfile reader that it should (not) close the stream after a read.
 void setTileRasterHeight(int tileRasterHeight)
           
 void setTileRasterWidth(int tileRasterWidth)
           
 void write(AbstractRaster raster, File gridFile, RasterIOOptions options)
          Write the raster into file.
 void write(AbstractRaster raster, OutputStream out, RasterIOOptions options)
          Write the raster into strem.
 void write(AbstractRaster raster, RasterIOOptions options)
          Write the given raster to the previously defined gridfile.
 void writeEntireFile(ByteBuffer newBytes)
           
 File writeMetadataFile(RasterIOOptions options)
          Writes the metadata file for this grid file.
 boolean writeTile(int column, int row, ByteBuffer tileBuffer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RASTERIO_COLUMNS

public static final String RASTERIO_COLUMNS
Defining the number of columns of the grid rasterwriter, to be used in the RasterIOOptions

See Also:
Constant Field Values

RASTERIO_ROWS

public static final String RASTERIO_ROWS
Defining the number of rows of the grid rasterwriter, to be used in the RasterIOOptions

See Also:
Constant Field Values
Constructor Detail

GridWriter

public GridWriter(int targetColumns,
                  int targetRows,
                  Envelope rasterEnvelope,
                  RasterGeoReference geoRef,
                  File gridFile,
                  RasterDataInfo dataInfo)
           throws IOException
Create a gridfile writer with the given parameters.

Parameters:
targetColumns - the number of tiles in the width of the file (columns)
targetRows - the number of tiles in the height of the file (rows)
rasterEnvelope - the Envelope of the total grid file.
geoRef - the geo reference of the grid file.
gridFile - write to the given file.
dataInfo - information about the data written to the grid file.
Throws:
IOException
Method Detail

getTileRasterWidth

public final int getTileRasterWidth()
Returns:
the tileRasterWidth

setTileRasterWidth

public final void setTileRasterWidth(int tileRasterWidth)
Parameters:
tileRasterWidth - the tileRasterWidth to set

getTileRasterHeight

public final int getTileRasterHeight()
Returns:
the tileRasterHeight

setTileRasterHeight

public final void setTileRasterHeight(int tileRasterHeight)
Parameters:
tileRasterHeight - the tileRasterHeight to set

canWrite

public boolean canWrite(AbstractRaster raster,
                        RasterIOOptions options)
Description copied from interface: RasterWriter
Check if the raster writer is able to write the given raster.

Specified by:
canWrite in interface RasterWriter
Returns:
true if the class can write the raster

getSupportedFormats

public Set<String> getSupportedFormats()
Specified by:
getSupportedFormats in interface RasterWriter
Returns:
a Set of (image) formats mime/types the implementation is able to write.

write

public void write(AbstractRaster raster,
                  File gridFile,
                  RasterIOOptions options)
           throws IOException
Description copied from interface: RasterWriter
Write the raster into file.

Specified by:
write in interface RasterWriter
options - additional information for the raster writer (format, etc)
Throws:
IOException - may be thrown when the file can't be written

write

public void write(AbstractRaster raster,
                  OutputStream out,
                  RasterIOOptions options)
           throws IOException
Description copied from interface: RasterWriter
Write the raster into strem.

Specified by:
write in interface RasterWriter
options - additional information for the raster writer (format, etc)
Throws:
IOException - may be thrown when the file can't be written

write

public void write(AbstractRaster raster,
                  RasterIOOptions options)
           throws IOException
Write the given raster to the previously defined gridfile.

Parameters:
raster - to write
options - can hold information about the info file etc. If null no meta data file will be written. Applications should make sure they call writeMetadataFile(RasterIOOptions)
Throws:
IOException

writeMetadataFile

public File writeMetadataFile(RasterIOOptions options)
                       throws IOException
Writes the metadata file for this grid file.

Parameters:
options -
Returns:
the file containing the metainfo
Throws:
IOException

leaveStreamOpen

public void leaveStreamOpen(boolean yesNo)
Signals the gridfile reader that it should (not) close the stream after a read.

Parameters:
yesNo -

getTileEnvelope

protected Envelope getTileEnvelope(int column,
                                   int row)
Calculates the envelope for a tile at a given position in the grid.

Parameters:
column - column , must be in the range [0 ... #columns - 1]
row - row , must be in the range [0 ... #rows - 1]
Returns:
the tile's envelope

getTileId

protected int getTileId(int column,
                        int row)
Calculates the id for a tile at a given position in the grid.

Parameters:
column - column, must be in the range [0 ... #columns - 1]
row - row, must be in the range [0 ... #rows - 1]
Returns:
the tile's id

writeEntireFile

public void writeEntireFile(ByteBuffer newBytes)
                     throws IOException
Parameters:
newBytes -
Throws:
IOException

writeTile

public boolean writeTile(int column,
                         int row,
                         ByteBuffer tileBuffer)
                  throws IOException
Parameters:
row -
column -
tileBuffer -
Returns:
true if the writing of the tile was successful.
Throws:
IOException


Copyright © 2011. All Rights Reserved.