Class TLcdMatrixViewRasterFactory

java.lang.Object
com.luciad.tea.TLcdMatrixViewRasterFactory

public class TLcdMatrixViewRasterFactory extends Object

Creates an ILcdRaster from an ILcdMatrixView.

The geometry of the associated matrix points depends on the used factory method and the mapping type. The method createRaster together with a backward mapping requires a rectangular geometry. This means that, when all associated points are drawn on a map, the associated point of pixel (0,0) should correspond to the point that lies in the bottom left corner. In the top right corner, the associated point of pixel (col_count-1,row_count-1) should be found. In combination with the forward mapping, no specific geometry is required.

The method createEquivalentRaster requires also a rectangular matrix view. It creates an ILcdRaster assuming a one-by-one relation, meaning that every pixel in the raster corresponds to one associated matrix point and each associated matrix point corresponds to one raster pixel. An associated matrix point is defined to be the center point of the corresponding raster pixel.

  • Constructor Details

    • TLcdMatrixViewRasterFactory

      public TLcdMatrixViewRasterFactory()
      Constructs a new factory for converting matrix views to rasters.
  • Method Details

    • addStatusListener

      public void addStatusListener(ILcdStatusListener aStatusListener)
      Starts notifying a listener with the progress of the raster creation.
      Parameters:
      aStatusListener - will be notified of progress of the raster creation.
      See Also:
    • removeStatusListener

      public void removeStatusListener(ILcdStatusListener aStatusListener)
      Terminates notifying a listener of the progress of the raster creation.
      Parameters:
      aStatusListener - will no longer be notified of progress of the raster creation.
      See Also:
    • createRaster

      public ILcdRaster createRaster(ILcdMatrixView aMatrix, ILcdGeoReference aMatrixReference, ILcdMatrixRasterValueMapper aMatrixRasterValueMapper, ILcdGeoReference aTargetReference, double aTargetPixelDensity, TLcdCoverageFillMode aFillMode)

      Creates an ILcdRaster from the ILcdMatrixView using the given target reference, pixel density and fill mode. The aTargetReference defines the reference in which the raster will be defined. Using the pixel density and the fill mode, the given matrix view is re-sampled into a rectangular coverage.

      The target pixel density is the pixel density of the resulting raster. This is the average number of pixels in an area of 1 by 1 in model coordinates. Higher densities will lead to more detailed coverage of the area. Note that the result is bound by the density of the samples taken of the underlying terrain data (which depends on the row and column count of the given matrix view). The size occupied in memory by the coverage will increase linearly with this density.

      The fill mode aFillMode indicates how the raster should be filled. Possible choices are:

      • maximum: the pixel value corresponds to the maximum value found in the matrix for that pixel.
      • minimum: the pixel value corresponds to the minimum value found in the matrix for that pixel.
      • nearest neighbor: the pixel value corresponds to the value computed nearest to the bottom left of the pixel location. This mode will ensure that the raster contains no holes.

      The fill mode is combined with the given ILcdMatrixRasterValueMapper to map the matrix entry values onto raster pixel values. There are two possibilities. The first maps a matrix value to a raster value. This forward mapping is used with the minimum and the maximum fill mode. The method ILcdMatrixRasterValueMapper.mapMatrixValue will be used to retrieve the raster value. The second maps a raster pixel to a number of matrix entries and combines the corresponding matrix values to a raster value, ensuring that all raster pixels are filled with a value. This backwards mapping is used with the nearest neighbor fill mode. The interface method ILcdMatrixRasterValueMapper.combineMatrixValues is used with only one matrix value which corresponds to the matrix value of the point nearest to the raster pixel and only one weight value, which is 1.

      For the backward mapping, the geometry of the associated matrix points needs to be rectangular. This means that, when all associated points are drawn on a map, the associated point of pixel (0,0) should correspond to the point that lies in the bottom left corner. In the top right corner, the associated point of pixel (col_count-1,row_count-1) should be found. For the forward mapping, this geometry is not required.

      Parameters:
      aMatrix - The matrix to convert.
      aMatrixReference - The reference in which the matrix is defined.
      aMatrixRasterValueMapper - The mapper to map matrix values on raster values.
      aTargetReference - The target reference in which the result will be defined.
      aTargetPixelDensity - The pixel density of the resulting raster.
      aFillMode - The fill mode indicating how the raster should be filled.
      Returns:
      a raster representation of the given matrix view.
      Throws:
      NullPointerException - when one of the arguments (aMatrix, aMatrixReference, aMatrixRasterValueMapper, aTargetReference or aFillMode) is null.
      IllegalArgumentException - when the required raster bounds has a 0 width or height or when the target pixel density is too low that the column or row count needs to be 0.
    • createEquivalentRaster

      public ILcdRaster createEquivalentRaster(ILcdMatrixView aMatrix, ILcdGeoReference aMatrixReference, ILcdMatrixRasterValueMapper aMatrixRasterValueMapper)

      Creates an ILcdRaster from the ILcdMatrixView assuming a one-by-one relation. This means that every pixel in the raster corresponds to one associated matrix point and each associated matrix point corresponds to one raster pixel. An associated matrix point is defined to be the center point of the corresponding raster pixel.

      The method ILcdMatrixRasterValueMapper.mapMatrixValue(short, double, TLcdCoverageFillMode) is used to find the raster value corresponding to a matrix value. The method arguments are respectively the default value from the given matrix-raster-value mapper, the matrix value from the given matrix view and the fill mode MAXIMUM.

      Parameters:
      aMatrix - The matrix view
      aMatrixReference - The matrix reference that will also be the raster reference.
      aMatrixRasterValueMapper - The mapper to map matrix values on raster values.
      Returns:
      the raster equivalent to the matrix view.
      Throws:
      IllegalArgumentException - when the matrix column count or matrix row count is not greater than 0 or when the required raster bounds has a 0 width or height.