Class GridCoverage2DRIA

  • All Implemented Interfaces:
    RenderedImage, ImageJAI, PropertyChangeEmitter, PropertySource, WritablePropertySource

    public class GridCoverage2DRIA
    extends GeometricOpImage
    A RenderedImage that provides values coming from a source GridCoverage2D, with a backing grid addressable as the target GridCoverage2D.

    The exposed Layout will be the same as the target, and each Point in the target grid can be used in the resulting RenderedImage,

    Author:
    ETj
    • Field Summary

      • Fields inherited from class GeometricOpImage

        backgroundValues, computableBounds, extender, intBackgroundValues, interp, setBackground
      • Fields inherited from class OpImage

        cache, cobbleSources, OP_COMPUTE_BOUND, OP_IO_BOUND, OP_NETWORK_BOUND, tileCacheMetric, tileRecycler
      • Fields inherited from class PlanarImage

        colorModel, eventManager, height, minX, minY, properties, sampleModel, tileFactory, tileGridXOffset, tileGridYOffset, tileHeight, tileWidth, width
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected GridCoverage2DRIA​(GridCoverage2D src, GridGeometry2D dst, Vector sources, ImageLayout layout, Map configuration, boolean cobbleSources, BorderExtender extender, Interpolation interp, double[] nodata, ROI roi, Hints hints)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected Rectangle backwardMapRect​(Rectangle destRect, int sourceIndex)
      Returns the minimum bounding box of the region of the specified source to which a particular Rectangle of the destination will be mapped.
      protected void computeRect​(PlanarImage[] sources, WritableRaster dest, Rectangle destRect)
      Warps a rectangle.
      static GridCoverage2DRIA create​(GridCoverage2D src, GridCoverage2D dst, double[] nodata)  
      static GridCoverage2DRIA create​(GridCoverage2D src, GridCoverage2D dst, double[] nodata, Hints hints, ROI roi)
      Wrap the src coverage in the dst layout.
      static GridCoverage2DRIA create​(GridCoverage2D src, GridGeometry2D dst, double[] nodata)
      Wrap the src coverage in the dst layout.
      static GridCoverage2DRIA create​(GridCoverage2D src, GridGeometry2D dst, double[] nodata, Hints hints)  
      static GridCoverage2DRIA create​(GridCoverage2D src, GridGeometry2D dst, double[] nodata, Hints hints, ROI roi)
      Wrap the src coverage in the dst layout.
      protected Rectangle forwardMapRect​(Rectangle pxRect, int sourceIndex)
      Returns the minimum bounding box of the region of the destination to which a particular Rectangle of the specified source will be mapped.
      Vector<RenderedImage> getSources()  
      Raster getTile​(int tileX, int tileY)  
      Point2D mapDestPoint​(Point2D destPt, int sourceIndex)  
      Point2D mapSourcePoint​(Point2D srcPt, int sourceIndex)  
      float[] warpRect​(int x, int y, int width, int height, float[] destRect)  
      float[] warpSparseRect​(int x0, int y0, int width, int height, int periodX, int periodY, float[] destRect)  
      • Methods inherited from class GeometricOpImage

        computeTile, getBorderExtender, getInterpolation, mapDestRect, mapSourceRect
      • Methods inherited from class OpImage

        addTileToCache, cancelTiles, computeRect, computesUniqueTiles, createTile, dispose, getExpandedNumBands, getFormatTags, getOperationComputeType, getTileCache, getTileCacheMetric, getTileDependencies, getTileFromCache, getTileRecycler, getTiles, hasExtender, prefetchTiles, queueTiles, recycleTile, setTileCache, vectorize, vectorize, vectorize
      • Methods inherited from class PlanarImage

        addPropertyChangeListener, addPropertyChangeListener, addSink, addSink, addSource, addTileComputationListener, copyData, copyData, copyExtendedData, createColorModel, createSnapshot, createWritableRaster, finalize, getAsBufferedImage, getAsBufferedImage, getBounds, getColorModel, getData, getData, getDefaultColorModel, getExtendedData, getGraphics, getHeight, getImageID, getMaxTileX, getMaxTileY, getMaxX, getMaxY, getMinTileX, getMinTileY, getMinX, getMinY, getNumBands, getNumSources, getNumXTiles, getNumYTiles, getProperties, getProperty, getPropertyClass, getPropertyNames, getPropertyNames, getSampleModel, getSinks, getSource, getSourceImage, getSourceObject, getSplits, getTileComputationListeners, getTileFactory, getTileGridXOffset, getTileGridYOffset, getTileHeight, getTileIndices, getTileRect, getTiles, getTileWidth, getWidth, overlapsMultipleTiles, removeProperty, removePropertyChangeListener, removePropertyChangeListener, removeSink, removeSink, removeSinks, removeSource, removeSources, removeTileComputationListener, setImageLayout, setProperties, setProperty, setSource, setSources, tileXToX, tileXToX, tileYToY, tileYToY, toString, wrapRenderedImage, XToTileX, XToTileX, YToTileY, YToTileY
    • Constructor Detail

      • GridCoverage2DRIA

        protected GridCoverage2DRIA​(GridCoverage2D src,
                                    GridGeometry2D dst,
                                    Vector sources,
                                    ImageLayout layout,
                                    Map configuration,
                                    boolean cobbleSources,
                                    BorderExtender extender,
                                    Interpolation interp,
                                    double[] nodata,
                                    ROI roi,
                                    Hints hints)
    • Method Detail

      • create

        public static GridCoverage2DRIA create​(GridCoverage2D src,
                                               GridGeometry2D dst,
                                               double[] nodata)
        Wrap the src coverage in the dst layout.
        The resulting RenderedImage will contain the data in src, and will be accessible via the grid specs of dst,
        Parameters:
        src - the data coverage to be remapped on dst grid
        dst - the provider of the final grid
        nodata - the nodata value to set for cells not covered by src but included in dst. All bands will share the same nodata value.
        Returns:
        an instance of Coverage2RenderedImageAdapter
      • create

        public static GridCoverage2DRIA create​(GridCoverage2D src,
                                               GridGeometry2D dst,
                                               double[] nodata,
                                               Hints hints,
                                               ROI roi)
        Wrap the src coverage in the dst layout.
        The resulting RenderedImage will contain the data in src, and will be accessible via the grid specs of dst,
        Parameters:
        src - the data coverage to be remapped on dst grid
        dst - the provider of the final grid
        nodata - the nodata values to set for cells not covered by src but included in dst. All bands will use the related nodata value.
        hints - hints to use for the Rendering, Actually only ImageLayout is considered
        Returns:
        an instance of Coverage2RenderedImageAdapter
      • create

        public static GridCoverage2DRIA create​(GridCoverage2D src,
                                               GridCoverage2D dst,
                                               double[] nodata,
                                               Hints hints,
                                               ROI roi)
        Wrap the src coverage in the dst layout.
        The resulting RenderedImage will contain the data in src, and will be accessible via the grid specs of dst,
        Parameters:
        src - the data coverage to be remapped on dst grid
        dst - the provider of the final grid
        nodata - the nodata values to set for cells not covered by src but included in dst. All bands will use the related nodata value.
        Returns:
        an instance of Coverage2RenderedImageAdapter
      • getTile

        public Raster getTile​(int tileX,
                              int tileY)
        Specified by:
        getTile in interface RenderedImage
        Overrides:
        getTile in class OpImage
      • mapSourcePoint

        public Point2D mapSourcePoint​(Point2D srcPt,
                                      int sourceIndex)
        Overrides:
        mapSourcePoint in class GeometricOpImage
      • forwardMapRect

        protected Rectangle forwardMapRect​(Rectangle pxRect,
                                           int sourceIndex)
        Returns the minimum bounding box of the region of the destination to which a particular Rectangle of the specified source will be mapped.

        The integral source rectangle coordinates should be considered pixel indices. The "energy" of each pixel is defined to be concentrated in the continuous plane of pixels at an offset of (0.5, 0.5) from the index of the pixel. Forward mappings must take this (0.5, 0.5) pixel center into account. Thus given integral source pixel indices as input, the fractional destination location, as calculated by functions Xf(xSrc, ySrc), Yf(xSrc, ySrc), is given by:

        
             xDst = Xf(xSrc+0.5, ySrc+0.5) - 0.5
             yDst = Yf(xSrc+0.5, ySrc+0.5) - 0.5
        
         
        Specified by:
        forwardMapRect in class GeometricOpImage
        Parameters:
        pxRect - the Rectangle in source coordinates.
        sourceIndex - the index of the source image.
        Returns:
        a Rectangle indicating the destination bounding box, or null if the bounding box is unknown.
        Throws:
        IllegalArgumentException - if sourceIndex is negative or greater than the index of the last source.
        IllegalArgumentException - if sourceRect is null.
      • mapDestPoint

        public Point2D mapDestPoint​(Point2D destPt,
                                    int sourceIndex)
        Overrides:
        mapDestPoint in class GeometricOpImage
      • backwardMapRect

        protected Rectangle backwardMapRect​(Rectangle destRect,
                                            int sourceIndex)
        Returns the minimum bounding box of the region of the specified source to which a particular Rectangle of the destination will be mapped.

        The integral destination rectangle coordinates should be considered pixel indices. The "energy" of each pixel is defined to be concentrated in the continuous plane of pixels at an offset of (0.5, 0.5) from the index of the pixel. Backward mappings must take this (0.5, 0.5) pixel center into account. Thus given integral destination pixel indices as input, the fractional source location, as calculated by functions Xb(xDst, yDst), Yb(xDst, yDst), is given by:

        
             xSrc = Xb(xDst+0.5, yDst+0.5) - 0.5
             ySrc = Yb(xDst+0.5, yDst+0.5) - 0.5
        
         
        Specified by:
        backwardMapRect in class GeometricOpImage
        Parameters:
        destRect - the Rectangle in destination coordinates.
        sourceIndex - the index of the source image.
        Returns:
        a Rectangle indicating the source bounding box, or null if the bounding box is unknown.
        Throws:
        IllegalArgumentException - if sourceIndex is negative or greater than the index of the last source.
        IllegalArgumentException - if destRect is null.
      • computeRect

        protected void computeRect​(PlanarImage[] sources,
                                   WritableRaster dest,
                                   Rectangle destRect)
        Warps a rectangle.

        Offers Improved performance with support for no data and region of interest.

        Overrides:
        computeRect in class OpImage
      • warpRect

        public float[] warpRect​(int x,
                                int y,
                                int width,
                                int height,
                                float[] destRect)
      • warpSparseRect

        public float[] warpSparseRect​(int x0,
                                      int y0,
                                      int width,
                                      int height,
                                      int periodX,
                                      int periodY,
                                      float[] destRect)
        Parameters:
        x0 - The minimum X coordinate of the destination region.
        y0 - The minimum Y coordinate of the destination region.
        width - The width of the destination region.
        height - The height of the destination region.
        periodX - The horizontal sampling period.
        periodY - The vertical sampling period.
        destRect - A float array containing at least 2*((width+periodX-1)/periodX)* ((height+periodY-1)/periodY) elements, or null. If null, a new array will be constructed.
        Returns:
        A reference to the destRect parameter if it is non-null, or a new float array otherwise.