org.deegree.coverage.raster.utils
Class Rasters

java.lang.Object
  extended by org.deegree.coverage.raster.utils.Rasters

public class Rasters
extends Object

Rasters supplies handy methods for rasters.

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

Constructor Summary
Rasters()
           
 
Method Summary
static int calcApproxTiles(int rasterWidth, int rasterHeight, int preferredTileSize)
          Calculates the number of tiles fitting the given preferred size and the largest of the given raster sides.
static int calcTileSize(float rasterSide, int numberOfTiles)
          Calculates the size of a single tile side.
static void copyValuesFromTile(RasterRect srcRect, RasterRect destRect, ByteBuffer srcBuffer, ByteBuffer destBuffer, int sampleSize)
          Copies the data from the given source databuffer to the target databuffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Rasters

public Rasters()
Method Detail

calcTileSize

public static final int calcTileSize(float rasterSide,
                                     int numberOfTiles)
Calculates the size of a single tile side.

Parameters:
rasterSide - either the width or the height of the entire raster.
numberOfTiles - of the entire raster.
Returns:
the size (in pixels) of a single tile side.

calcApproxTiles

public static final int calcApproxTiles(int rasterWidth,
                                        int rasterHeight,
                                        int preferredTileSize)
Calculates the number of tiles fitting the given preferred size and the largest of the given raster sides. Determination is based on 1.5 times the given tile size, so if the largest entire raster side (for example the width) is 1600 and the preferred tile size is 1000 this method will return 2, if however the largest side would have been 1400, this method would return 1.

Parameters:
rasterWidth - of the entire raster
rasterHeight - of the entire raster
preferredTileSize - in pixels of the largest side.
Returns:
the number of tiles which will fit the preferred size. Determination is based on the largest given side.

copyValuesFromTile

public static void copyValuesFromTile(RasterRect srcRect,
                                      RasterRect destRect,
                                      ByteBuffer srcBuffer,
                                      ByteBuffer destBuffer,
                                      int sampleSize)
                               throws IOException
Copies the data from the given source databuffer to the target databuffer.

Parameters:
srcRect - the rectangle specifying the layout of the data in the source buffer.
destRect - the rectangle specifying the layout of the data in the result buffer.
srcBuffer - containing the data fitting the srcRect
destBuffer - which will hold the result
sampleSize - size in bytes of a sample (depends on the band size and the datatype)
Throws:
IOException


Copyright © 2011. All Rights Reserved.