it.geosolutions.imageio.gdalframework
Class GDALImageWriter

Object
  extended by ImageWriter
      extended by GDALImageWriter
All Implemented Interfaces:
ImageTranscoder

public abstract class GDALImageWriter
extends ImageWriter

Main abstract class defining the main framework which needs to be used to extend Image I/O architecture using GDAL (Geospatial Data Abstraction Library) by means of SWIG (Simplified Wrapper and Interface Generator) bindings in order to perform write operations.

Author:
Daniele Romagnoli, GeoSolutions., Simone Giannecchini, GeoSolutions.

Field Summary
protected  File outputFile
          Output File
 
Fields inherited from class ImageWriter
availableLocales, locale, originatingProvider, output, progressListeners, warningListeners, warningLocales
 
Constructor Summary
GDALImageWriter(ImageWriterSpi originatingProvider)
          Constructor for GDALImageWriter
 
Method Summary
 IIOMetadata convertImageMetadata(IIOMetadata inData, ImageTypeSpecifier imageType, ImageWriteParam param)
           
 IIOMetadata convertStreamMetadata(IIOMetadata inData, ImageWriteParam param)
           
 IIOMetadata getDefaultImageMetadata(ImageTypeSpecifier imageType, ImageWriteParam param)
           
 IIOMetadata getDefaultStreamMetadata(ImageWriteParam param)
           
protected static int getMaxMemorySizeForGDALMemoryDataset()
          Utility method which checks if a system property has been specified to set the maximum allowed size to create a GDAL "In Memory Raster" Dataset in case of CreateCopy.
protected static Driver getMemoryDriver()
          return a "In Memory" Driver which need to be used when using the CreateCopy method.
 void setOutput(Object output)
          Sets the destination to the given Object, usually a File or a FileImageOutputStreamExt.
 void write(IIOImage image)
          This method is a shorthand for write(null, image, null).
 void write(IIOMetadata streamMetadata, IIOImage image, ImageWriteParam param)
          Write the input image to the output.
 void write(RenderedImage image)
          This method is a shorthand for write(null, new IIOImage(image, null, null), null).
 
Methods inherited from class ImageWriter
abort, abortRequested, addIIOWriteProgressListener, addIIOWriteWarningListener, canInsertEmpty, canInsertImage, canRemoveImage, canReplaceImageMetadata, canReplacePixels, canReplaceStreamMetadata, canWriteEmpty, canWriteRasters, canWriteSequence, clearAbortRequest, dispose, endInsertEmpty, endReplacePixels, endWriteEmpty, endWriteSequence, getAvailableLocales, getDefaultWriteParam, getLocale, getNumThumbnailsSupported, getOriginatingProvider, getOutput, getPreferredThumbnailSizes, prepareInsertEmpty, prepareReplacePixels, prepareWriteEmpty, prepareWriteSequence, processImageComplete, processImageProgress, processImageStarted, processThumbnailComplete, processThumbnailProgress, processThumbnailStarted, processWarningOccurred, processWarningOccurred, processWriteAborted, removeAllIIOWriteProgressListeners, removeAllIIOWriteWarningListeners, removeIIOWriteProgressListener, removeIIOWriteWarningListener, removeImage, replaceImageMetadata, replacePixels, replacePixels, replaceStreamMetadata, reset, setLocale, writeInsert, writeToSequence
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

outputFile

protected File outputFile
Output File

Constructor Detail

GDALImageWriter

public GDALImageWriter(ImageWriterSpi originatingProvider)
Constructor for GDALImageWriter

Method Detail

getMaxMemorySizeForGDALMemoryDataset

protected static final int getMaxMemorySizeForGDALMemoryDataset()
Utility method which checks if a system property has been specified to set the maximum allowed size to create a GDAL "In Memory Raster" Dataset in case of CreateCopy. In case of the system property has been set, returns this value, otherwise it returns a default value.

Returns:
the maximum allowed size to create a GDAL "In Memory Raster" Dataset in case of CreateCopy.
See Also:
DEFAULT_GDALMEMORYRASTER_MAXSIZE

getMemoryDriver

protected static Driver getMemoryDriver()
return a "In Memory" Driver which need to be used when using the CreateCopy method.


getDefaultStreamMetadata

public IIOMetadata getDefaultStreamMetadata(ImageWriteParam param)
Specified by:
getDefaultStreamMetadata in class ImageWriter

write

public void write(IIOMetadata streamMetadata,
                  IIOImage image,
                  ImageWriteParam param)
           throws IOException
Write the input image to the output.

The output must have been set beforehand using the setOutput method.

An ImageWriteParam may optionally be supplied to control the writing process. If param is null, a default write param will be used.

If the supplied ImageWriteParam contains optional setting values not supported by this writer (e.g. progressive encoding or any format-specific settings), they will be ignored.

Specified by:
write in class ImageWriter
Parameters:
streamMetadata - an IIOMetadata object representing stream metadata, or null to use default values.
image - an IIOImage object containing an image, and metadata to be written. Note that metadata is actually supposed to be an instance of GDALCommonIIOImageMetadata. GDALWritableCommonIIOImageMetadata may be used to set properties from other type of ImageMetadata to a format which is understood by this writer.
param - an ImageWriteParam, or null to use a default ImageWriteParam.
Throws:
IllegalStateException - if the output has not been set.
IllegalArgumentException - if image is null.
IOException - if an error occurs during writing.

getDefaultImageMetadata

public IIOMetadata getDefaultImageMetadata(ImageTypeSpecifier imageType,
                                           ImageWriteParam param)
Specified by:
getDefaultImageMetadata in class ImageWriter

convertStreamMetadata

public IIOMetadata convertStreamMetadata(IIOMetadata inData,
                                         ImageWriteParam param)
Specified by:
convertStreamMetadata in interface ImageTranscoder
Specified by:
convertStreamMetadata in class ImageWriter

convertImageMetadata

public IIOMetadata convertImageMetadata(IIOMetadata inData,
                                        ImageTypeSpecifier imageType,
                                        ImageWriteParam param)
Specified by:
convertImageMetadata in interface ImageTranscoder
Specified by:
convertImageMetadata in class ImageWriter

setOutput

public void setOutput(Object output)
Sets the destination to the given Object, usually a File or a FileImageOutputStreamExt.

Overrides:
setOutput in class ImageWriter
Parameters:
output - the Object to use for future writing.

write

public void write(IIOImage image)
           throws IOException
This method is a shorthand for write(null, image, null).

Overrides:
write in class ImageWriter
Parameters:
image - an IIOImage object containing an image, thumbnails, and metadata to be written to the output.
Throws:
IOException

write

public void write(RenderedImage image)
           throws IOException
This method is a shorthand for write(null, new IIOImage(image, null, null), null).

Overrides:
write in class ImageWriter
Parameters:
image - a RenderedImage to be written.
Throws:
IOException


Copyright © 2006-2010 GeoSolutions. All Rights Reserved.