org.deegree.coverage.raster
Class RasterTransformer

java.lang.Object
  extended by org.deegree.cs.Transformer
      extended by org.deegree.coverage.raster.RasterTransformer

public class RasterTransformer
extends Transformer

This class transforms raster to a taget coordinate system .

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

Constructor Summary
RasterTransformer(ICRS targetCRS)
          Creates a new RasterTransformer with the given target CRS.
RasterTransformer(String targetCRS)
          Creates a new RasterTransformer with the given id as the target CRS.
 
Method Summary
 void setBackgroundValue(byte[] backgroundValue)
          Sets the background for the raster transformation.
 AbstractRaster transform(AbstractRaster sourceRaster, Envelope dstEnvelope, int dstWidth, int dstHeight, InterpolationType interpolationType)
          Creates a transformed raster from a given source raster.
 AbstractRaster transform(AbstractRaster sourceRaster, InterpolationType interpolationType)
          Transform a raster to the target coordinate system.
 
Methods inherited from class org.deegree.cs.Transformer
createCRSTransformation, createCRSTransformation, createCRSTransformation, getTargetCRS
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RasterTransformer

public RasterTransformer(String targetCRS)
                  throws IllegalArgumentException,
                         UnknownCRSException
Creates a new RasterTransformer with the given id as the target CRS.

Parameters:
targetCRS - an identifier to which all incoming coordinates shall be transformed.
Throws:
UnknownCRSException - if the given crs name could not be mapped to a valid (configured) crs.
IllegalArgumentException - if the given parameter is null.

RasterTransformer

public RasterTransformer(ICRS targetCRS)
                  throws IllegalArgumentException,
                         UnknownCRSException
Creates a new RasterTransformer with the given target CRS.

Parameters:
targetCRS - a coordinate system wrapper, wrapping the crs to which all incoming coordinates shall be transformed.
Throws:
UnknownCRSException - if the given crs name could not be mapped to a valid (configured) crs.
IllegalArgumentException - if the given parameter is null.
Method Detail

transform

public AbstractRaster transform(AbstractRaster sourceRaster,
                                Envelope dstEnvelope,
                                int dstWidth,
                                int dstHeight,
                                InterpolationType interpolationType)
                         throws TransformationException,
                                UnknownCRSException
Creates a transformed raster from a given source raster.

This method transforms the requested envelope and returns a new raster with the requested size. The source raster can be larger than the requested envelope (like a large tiled raster), or smaller (the source raster nodata value will be used outside the source raster).

If the dstEnvelope does not contain a CRS or the CRS is the same as the AbstractCoverage.getCoordinateSystem() only interpolation will be applied. If the requested size is the same as the number of rows/columns of the source raster, only the subset of the given raster will be returned, without interpolation being applied.

Parameters:
sourceRaster - the source raster
dstEnvelope - the requested envelope (already in the target crs)
dstWidth - the requested raster size
dstHeight - the requested raster size
interpolationType - the type of the interpolation
Returns:
the transformed raster
Throws:
TransformationException
UnknownCRSException

transform

public AbstractRaster transform(AbstractRaster sourceRaster,
                                InterpolationType interpolationType)
                         throws IllegalArgumentException,
                                TransformationException,
                                UnknownCRSException
Transform a raster to the target coordinate system.

This method transforms the whole raster into the target CRS of this RasterTransformer. The size of the output raster will be calculated, so that the pixels keep the aspect ratio (i.e. keep square pixels).

If the coordinate system of the source raster is null or equals the target crs, the source raster will be returned unaltered.

Parameters:
sourceRaster - the raster to be transformed
interpolationType -
Returns:
the transformed raster
Throws:
IllegalArgumentException
TransformationException
UnknownCRSException

setBackgroundValue

public void setBackgroundValue(byte[] backgroundValue)
Sets the background for the raster transformation.

Parameters:
backgroundValue -


Copyright © 2011. All Rights Reserved.