Class TLcdInterpolatedRaster

All Implemented Interfaces:
ILcdRaster, ILcdBounded, ILcdCache, ILcdDisposable, AutoCloseable

public class TLcdInterpolatedRaster extends TLcdRaster implements ILcdRaster
This class provides an implementation of ILcdRaster that interpolates between the values of its tiles. More specifically, the method retrieveValue(double, double) provides bilinear interpolation across the raster. Each tile must provide one additional row and column beyond its returned width and height, in order to support the interpolation. The additional row and column should be duplicates of the first row and column of the neighboring tiles. Such a representation is naturally supported by data formats like DTED and GRIB.

Note that the method TLcdRaster.retrieveTile(int, int) still returns tiles with discrete pixels. If the images of these tiles are painted directly, they still look pixelated.

This class is thread-safe for concurrent read-only access of its contents.

Since:
9.1
See Also:
  • Constructor Details

    • TLcdInterpolatedRaster

      public TLcdInterpolatedRaster(ILcdBounds aBounds, ILcdTile[][] aTiles, double aPixelDensity, int aDefaultValue, ColorModel aColorModel)
      Creates a new TLcdInterpolatedRaster with a regular tiling.
      Parameters:
      aBounds - the bounds of the raster in model coordinates.
      aTiles - the array of tiles of the raster.
      aPixelDensity - an estimate of the number of pixels per unit area in model coordinates.
      aDefaultValue - a default value in case the raster cannot resolve a point.
      aColorModel - an optional ColorModel that overrides the ColorModel of the raster's tiles.
    • TLcdInterpolatedRaster

      public TLcdInterpolatedRaster(ILcdBounds aBounds, double aTileWidth, double aTileHeight, ILcdTile[][] aTiles, double aPixelDensity, int aDefaultValue, ColorModel aColorModel)
      Creates a new TLcdInterpolatedRaster. The tiling is regular, except possibly for the tiles in the right-most column and in the bottom row. If the sums of the tile widths and the tile heights extend beyond the bounds of the raster, the extending parts are considered to be padding and they are ignored.

      For a raster with a uniform pixel density, the tile width (and similarly the tile height) in model coordinates can be computed as follows:

      <tile width> = <tile width in pixels> / <raster width in pixels> * <raster width>

      Parameters:
      aBounds - the bounds of the raster in model coordinates.
      aTileWidth - the width of the tiles in model coordinates.
      aTileHeight - the height of the tiles in model coordinates.
      aTiles - the array of tiles of the raster.
      aPixelDensity - an estimate of the number of pixels per unit area in model coordinates.
      aDefaultValue - a default value in case the raster cannot resolve a point.
      aColorModel - an optional ColorModel that overrides the ColorModel of the raster's tiles.
  • Method Details

    • retrieveValue

      public int retrieveValue(double aX, double aY)
      Description copied from interface: ILcdRaster
      Retrieves the raster value at the specified location.
      Specified by:
      retrieveValue in interface ILcdRaster
      Overrides:
      retrieveValue in class ALcdRaster
      Parameters:
      aX - the x ordinate of the value, expressed in raster coordinates.
      aY - the y ordinate of the value, expressed in raster coordinates.
      Returns:
      the integer raster value at the specified location.